Using the maxNPCTypes and maxItemTypes constants from Terraria.Main so we don't have to update everytime new things are added
This commit is contained in:
parent
a928a59fe3
commit
e663698497
2 changed files with 5 additions and 5 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -816,7 +816,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)
|
||||
{
|
||||
|
|
@ -841,7 +841,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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue