diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index f21b3a13..5c612da0 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -649,7 +649,7 @@ namespace TShockAPI return; } - if (type >= 1 && type <= 45) + if (type >= 1 && type < Main.maxNPCTypes) { int npcid = -1; for (int i = 0; i < amount; i++) @@ -679,7 +679,7 @@ namespace TShockAPI if (!int.TryParse(args.Parameters[0], out type)) type = TShock.GetItemID(String.Join(" ", args.Parameters)); - if (type < 1 || type > 238) + if (type < 1 || type >= Main.maxItemTypes) { Tools.SendMessage(adminplr, "Invalid item type!", Color.Red); return; @@ -732,7 +732,7 @@ namespace TShockAPI if (!int.TryParse(args.Parameters[0], out type)) type = TShock.GetItemID(args.Parameters[0]); - if (type < 1 || type > 238) + if (type < 1 || type >= Main.maxItemTypes) { Tools.SendMessage(args.PlayerID, "Invalid item type!", Color.Red); return; diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 90ac8734..e05cd0b4 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -806,7 +806,7 @@ namespace TShockAPI public static int GetNPCID(string name, bool exact = false) { NPC npc = new NPC(); - for (int i = 1; i <= 45; i++) + for (int i = 1; i < Main.maxNPCTypes; i++) { if (exact) { @@ -831,7 +831,7 @@ namespace TShockAPI { Item item = new Item(); name = name.ToLower(); - for (int i = 1; i <= 238; i++) + for (int i = 1; i < Main.maxItemTypes; i++) { item.SetDefaults(i); if (item.name.ToLower().StartsWith(name))