Improve max stack hack detection. Don't check for type == 0. Mostly caused by modified save files from inventory editing that don't reset stacks.

This commit is contained in:
Zidonuke 2011-12-20 02:41:21 -05:00
parent 06b487393c
commit 0ac0dd02f8

View file

@ -122,13 +122,16 @@ namespace TShockAPI
short prefix = (short) args.Data.ReadInt8();
int type = (int) args.Data.ReadInt16();
if (type == 0)
return true;
var item = new Item();
item.netDefaults(type);
item.Prefix(prefix);
if (stack > item.maxStack)
{
return TShock.Utils.HandleCheater(args.Player, String.Format("Stack cheat detected. Remove {0} ({1}) and then rejoin", item.name, stack));
return TShock.Utils.HandleCheater(args.Player, String.Format("Stack cheat detected. Remove {0} ({1}) > {2} and then rejoin", item.name, stack, item.maxStack));
}
return false;