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:
ricky 2011-06-11 09:43:23 +10:00
parent a928a59fe3
commit e663698497
2 changed files with 5 additions and 5 deletions

View file

@ -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))