Added check for over-stacked items creating a negative amount for items over max stack count.

Added message output to player for why they are disabled when having an over-stacked item.
Added message output to player for why they are disabled when having a banned item equipped.
This commit is contained in:
atom0s 2014-06-06 09:56:31 -07:00
parent ffa68c1115
commit 15db899b57

View file

@ -807,10 +807,12 @@ namespace TShockAPI
string check = "none";
foreach (Item item in player.TPlayer.inventory)
{
if (!player.Group.HasPermission(Permissions.ignorestackhackdetection) && item.stack > item.maxStack &&
if (!player.Group.HasPermission(Permissions.ignorestackhackdetection) && (item.stack > item.maxStack || item.stack < 0) &&
item.type != 0)
{
check = "Remove item " + item.name + " (" + item.stack + ") exceeds max stack of " + item.maxStack;
player.SendErrorMessage(check);
break;
}
}
player.IgnoreActionsForCheating = check;
@ -822,6 +824,8 @@ namespace TShockAPI
player.SetBuff(30, 120); //Bleeding
player.SetBuff(36, 120); //Broken Armor
check = "Remove armor/accessory " + item.name;
player.SendErrorMessage(string.Format("You are wearing banned equipment. {0}", check));
}
}
player.IgnoreActionsForDisabledArmor = check;