Replace references to Main.max*whatever*count

All of the Main.maxwhatever fields have been replaced with
Terraria.ID.WhateverID.Count fields.
This commit is contained in:
Lucas Nicodemus 2022-11-09 22:53:29 -08:00
parent afb966dcff
commit b322c4c1e0
No known key found for this signature in database
4 changed files with 30 additions and 30 deletions

View file

@ -2862,7 +2862,7 @@ namespace TShockAPI
else
{
var npc = npcs[0];
if (npc.type >= 1 && npc.type < Main.maxNPCTypes && npc.type != 113)
if (npc.type >= 1 && npc.type < Terraria.ID.NPCID.Count && npc.type != 113)
{
TSPlayer.Server.SpawnNPC(npc.netID, npc.FullName, amount, args.Player.TileX, args.Player.TileY, 50, 20);
if (args.Silent)
@ -4027,7 +4027,7 @@ namespace TShockAPI
return;
}
short id;
if (Int16.TryParse(args.Parameters[1], out id) && id > 0 && id < Main.maxProjectileTypes)
if (Int16.TryParse(args.Parameters[1], out id) && id > 0 && id < Terraria.ID.ProjectileID.Count)
{
TShock.ProjectileBans.AddNewBan(id);
args.Player.SendSuccessMessage(GetString("Banned projectile {0}.", id));
@ -4047,7 +4047,7 @@ namespace TShockAPI
}
short id;
if (Int16.TryParse(args.Parameters[1], out id) && id > 0 && id < Main.maxProjectileTypes)
if (Int16.TryParse(args.Parameters[1], out id) && id > 0 && id < Terraria.ID.ProjectileID.Count)
{
if (!TShock.Groups.GroupExists(args.Parameters[2]))
{
@ -4084,7 +4084,7 @@ namespace TShockAPI
}
short id;
if (Int16.TryParse(args.Parameters[1], out id) && id > 0 && id < Main.maxProjectileTypes)
if (Int16.TryParse(args.Parameters[1], out id) && id > 0 && id < Terraria.ID.ProjectileID.Count)
{
TShock.ProjectileBans.RemoveBan(id);
args.Player.SendSuccessMessage(GetString("Unbanned projectile {0}.", id));
@ -4105,7 +4105,7 @@ namespace TShockAPI
}
short id;
if (Int16.TryParse(args.Parameters[1], out id) && id > 0 && id < Main.maxProjectileTypes)
if (Int16.TryParse(args.Parameters[1], out id) && id > 0 && id < Terraria.ID.ProjectileID.Count)
{
if (!TShock.Groups.GroupExists(args.Parameters[2]))
{
@ -4203,7 +4203,7 @@ namespace TShockAPI
return;
}
short id;
if (Int16.TryParse(args.Parameters[1], out id) && id >= 0 && id < Main.maxTileSets)
if (Int16.TryParse(args.Parameters[1], out id) && id >= 0 && id < Terraria.ID.TileID.Count)
{
TShock.TileBans.AddNewBan(id);
args.Player.SendSuccessMessage(GetString("Banned tile {0}.", id));
@ -4223,7 +4223,7 @@ namespace TShockAPI
}
short id;
if (Int16.TryParse(args.Parameters[1], out id) && id >= 0 && id < Main.maxTileSets)
if (Int16.TryParse(args.Parameters[1], out id) && id >= 0 && id < Terraria.ID.TileID.Count)
{
if (!TShock.Groups.GroupExists(args.Parameters[2]))
{
@ -4260,7 +4260,7 @@ namespace TShockAPI
}
short id;
if (Int16.TryParse(args.Parameters[1], out id) && id >= 0 && id < Main.maxTileSets)
if (Int16.TryParse(args.Parameters[1], out id) && id >= 0 && id < Terraria.ID.TileID.Count)
{
TShock.TileBans.RemoveBan(id);
args.Player.SendSuccessMessage(GetString("Unbanned tile {0}.", id));
@ -4281,7 +4281,7 @@ namespace TShockAPI
}
short id;
if (Int16.TryParse(args.Parameters[1], out id) && id >= 0 && id < Main.maxTileSets)
if (Int16.TryParse(args.Parameters[1], out id) && id >= 0 && id < Terraria.ID.TileID.Count)
{
if (!TShock.Groups.GroupExists(args.Parameters[2]))
{
@ -6088,7 +6088,7 @@ namespace TShockAPI
{
item = matchedItems[0];
}
if (item.type < 1 && item.type >= Main.maxItemTypes)
if (item.type < 1 && item.type >= Terraria.ID.ItemID.Count)
{
args.Player.SendErrorMessage(GetString("The item type {0} is invalid.", itemNameOrId));
return;
@ -6251,7 +6251,7 @@ namespace TShockAPI
prefix = prefixIds[0];
}
if (item.type >= 1 && item.type < Main.maxItemTypes)
if (item.type >= 1 && item.type < Terraria.ID.ItemID.Count)
{
var players = TSPlayer.FindByNameOrID(plStr);
if (players.Count == 0)
@ -6393,7 +6393,7 @@ namespace TShockAPI
if (args.Parameters.Count == 2)
int.TryParse(args.Parameters[1], out time);
if (id > 0 && id < Main.maxBuffTypes)
if (id > 0 && id < Terraria.ID.BuffID.Count)
{
// Max possible buff duration as of Terraria 1.4.2.3 is 35791393 seconds (415 days).
if (time < 0 || time > timeLimit)
@ -6449,7 +6449,7 @@ namespace TShockAPI
}
if (args.Parameters.Count == 3)
int.TryParse(args.Parameters[2], out time);
if (id > 0 && id < Main.maxBuffTypes)
if (id > 0 && id < Terraria.ID.BuffID.Count)
{
var target = foundplr[0];
if (time < 0 || time > timeLimit)