Merge branch 'master' of github.com:TShock/TShock

This commit is contained in:
high 2011-06-10 19:47:40 -04:00
commit 022fd43660
2 changed files with 5 additions and 5 deletions

View file

@ -649,7 +649,7 @@ namespace TShockAPI
return; return;
} }
if (type >= 1 && type <= 45) if (type >= 1 && type < Main.maxNPCTypes)
{ {
int npcid = -1; int npcid = -1;
for (int i = 0; i < amount; i++) for (int i = 0; i < amount; i++)
@ -679,7 +679,7 @@ namespace TShockAPI
if (!int.TryParse(args.Parameters[0], out type)) if (!int.TryParse(args.Parameters[0], out type))
type = TShock.GetItemID(String.Join(" ", args.Parameters)); 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); Tools.SendMessage(adminplr, "Invalid item type!", Color.Red);
return; return;
@ -732,7 +732,7 @@ namespace TShockAPI
if (!int.TryParse(args.Parameters[0], out type)) if (!int.TryParse(args.Parameters[0], out type))
type = TShock.GetItemID(args.Parameters[0]); 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); Tools.SendMessage(args.PlayerID, "Invalid item type!", Color.Red);
return; return;

View file

@ -806,7 +806,7 @@ namespace TShockAPI
public static int GetNPCID(string name, bool exact = false) public static int GetNPCID(string name, bool exact = false)
{ {
NPC npc = new NPC(); NPC npc = new NPC();
for (int i = 1; i <= 45; i++) for (int i = 1; i < Main.maxNPCTypes; i++)
{ {
if (exact) if (exact)
{ {
@ -831,7 +831,7 @@ namespace TShockAPI
{ {
Item item = new Item(); Item item = new Item();
name = name.ToLower(); name = name.ToLower();
for (int i = 1; i <= 238; i++) for (int i = 1; i < Main.maxItemTypes; i++)
{ {
item.SetDefaults(i); item.SetDefaults(i);
if (item.name.ToLower().StartsWith(name)) if (item.name.ToLower().StartsWith(name))