From 31c4e1a37bbcae26d99a4244b962feb055067f4c Mon Sep 17 00:00:00 2001 From: Zidonuke Date: Tue, 27 Dec 2011 14:47:31 -0500 Subject: [PATCH] Changed stack hack handling. --- TShockAPI/GetDataHandlers.cs | 10 +++++++--- TShockAPI/TSPlayer.cs | 2 +- TShockAPI/TShock.cs | 7 ++----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index d4578c53..7bb592de 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -138,9 +138,9 @@ namespace TShockAPI item.netDefaults(type); item.Prefix(prefix); - if (stack > item.maxStack && type != 0) + if (stack > item.maxStack && type != 0 && args.Player.IgnoreActionsForCheating != "none") { - args.Player.IgnoreActionsForCheating = true; + args.Player.IgnoreActionsForCheating = "Item Hack: " + item.name + " (" + stack + ") exceeds max stack of " + item.maxStack; } if (args.Player.IsLoggedIn) @@ -617,7 +617,11 @@ namespace TShockAPI float distance = Vector2.Distance(new Vector2((pos.X / 16f), (pos.Y / 16f)), new Vector2(Main.spawnTileX, Main.spawnTileY)); if (TShock.CheckIgnores(args.Player) && distance > 6f) { - if (TShock.Config.RequireLogin && !args.Player.IsLoggedIn) + if(args.Player.IgnoreActionsForCheating != "none") + { + args.Player.SendMessage("Disabled for cheating: " + args.Player.IgnoreActionsForCheating, Color.Red); + } + else if (TShock.Config.RequireLogin && !args.Player.IsLoggedIn) { args.Player.SendMessage("Please /register or /login to play!", Color.Red); } diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index fbe48203..29edd2a7 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -71,7 +71,7 @@ namespace TShockAPI private string CacheIP; public bool IgnoreActionsForPvP = false; public bool IgnoreActionsForInventory = false; - public bool IgnoreActionsForCheating = false; + public string IgnoreActionsForCheating = "none"; public bool IgnoreActionsForClearingTrashCan = false; public PlayerData PlayerData; diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index f9540322..83fa0791 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -752,10 +752,7 @@ namespace TShockAPI TShock.Utils.ForceKick(player, "You have Hacked Health/Mana, Please use a different character."); } - if (HackedInventory(player)) - { - player.IgnoreActionsForCheating = true; - } + HackedInventory(player); NetMessage.syncPlayers(); @@ -1204,7 +1201,7 @@ namespace TShockAPI check = true; if (player.IgnoreActionsForInventory) check = true; - if (player.IgnoreActionsForCheating) + if (player.IgnoreActionsForCheating != "none") check = true; if (!player.IsLoggedIn && Config.RequireLogin) check = true;