From 15db899b57bf7470807e7d30855eb6a5ba5b6b57 Mon Sep 17 00:00:00 2001 From: atom0s Date: Fri, 6 Jun 2014 09:56:31 -0700 Subject: [PATCH 1/2] 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. --- TShockAPI/TShock.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 4b8b9240..bb25301b 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -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; From 75d3b9624cf0960769598887245a237fccd82c31 Mon Sep 17 00:00:00 2001 From: atom0s Date: Fri, 6 Jun 2014 09:59:32 -0700 Subject: [PATCH 2/2] Changed spaces to tabs. --- TShockAPI/TShock.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index bb25301b..841c4372 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -811,8 +811,8 @@ namespace TShockAPI item.type != 0) { check = "Remove item " + item.name + " (" + item.stack + ") exceeds max stack of " + item.maxStack; - player.SendErrorMessage(check); - break; + player.SendErrorMessage(check); + break; } } player.IgnoreActionsForCheating = check; @@ -824,8 +824,9 @@ 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.SendErrorMessage(string.Format("You are wearing banned equipment. {0}", check)); + break; } } player.IgnoreActionsForDisabledArmor = check;