Fix some confusion introduced by 98eed42 and b184133

This commit is contained in:
SGKoishi 2025-03-15 14:09:00 +09:00
parent de30678153
commit 4e26051869
No known key found for this signature in database
GPG key ID: 8FFC399070653828
3 changed files with 17 additions and 5 deletions

View file

@ -79,7 +79,7 @@ namespace TShockAPI.DB
public PlayerData GetPlayerData(TSPlayer player, int acctid)
{
PlayerData playerData = new PlayerData(false);
PlayerData playerData = new PlayerData(true);
try
{

View file

@ -3619,8 +3619,9 @@ namespace TShockAPI
return false;
}
private static readonly int[] invasions = { -1, -2, -3, -4, -5, -6, -7, -8, -10, -11 };
private static readonly int[] invasions = { -1, -2, -3, -4, -5, -6, -7, -8, -10 };
private static readonly int[] pets = { -12, -13, -14, -15 };
private static readonly int[] upgrades = { -11, -17, -18 };
private static bool HandleSpawnBoss(GetDataHandlerArgs args)
{
if (args.Player.IsBouncerThrottled())
@ -3632,8 +3633,8 @@ namespace TShockAPI
var plr = args.Data.ReadInt16();
var thingType = args.Data.ReadInt16();
var isKnownBoss = thingType > 0 && thingType < Terraria.ID.NPCID.Count && NPCID.Sets.MPAllowedEnemies[thingType];
if ((isKnownBoss || thingType == -16) && !args.Player.HasPermission(Permissions.summonboss))
var isKnownBoss = (thingType > 0 && thingType < Terraria.ID.NPCID.Count && NPCID.Sets.MPAllowedEnemies[thingType]) || thingType == -16;
if (isKnownBoss && !args.Player.HasPermission(Permissions.summonboss))
{
TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandleSpawnBoss rejected boss {0} {1}", args.Player.Name, thingType));
args.Player.SendErrorMessage(GetString("You do not have permission to summon bosses."));
@ -3654,6 +3655,13 @@ namespace TShockAPI
return true;
}
if (upgrades.Contains(thingType) && !args.Player.HasPermission(Permissions.worldupgrades))
{
TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandleSpawnBoss rejected upgrade {0} {1}", args.Player.Name, thingType));
args.Player.SendErrorMessage(GetString("You do not have permission to use permanent boosters."));
return true;
}
if (plr != args.Player.Index)
return true;
@ -3720,7 +3728,7 @@ namespace TShockAPI
break;
}
if (NPCID.Sets.MPAllowedEnemies[thingType])
if (thingType < 0 || isKnownBoss)
{
if (TShock.Config.Settings.AnonymousBossInvasions)
TShock.Utils.SendLogs(thing, Color.PaleVioletRed, args.Player);

View file

@ -346,9 +346,13 @@ namespace TShockAPI
[Description("User can change the homes of NPCs.")]
public static readonly string movenpc = "tshock.world.movenpc";
[Obsolete("Feature no longer available.")]
[Description("User can convert hallow into corruption and vice-versa.")]
public static readonly string converthardmode = "tshock.world.converthardmode";
[Description("User can use world-based permanent boosters like Advanced Combat Techniques")]
public static readonly string worldupgrades = "tshock.world.worldupgrades";
[Description("User can force the server to Halloween mode.")]
public static readonly string halloween = "tshock.world.sethalloween";