From 40ba6c56d36f6638e535829511b4f9eb5b0cc79e Mon Sep 17 00:00:00 2001 From: Zack Piispanen Date: Sun, 29 Sep 2013 05:29:18 -0400 Subject: [PATCH] Update packet logic up to 17 (not including 17 ->tile edit...something needs to be done with the last two bytes) --- TShockAPI/GetDataHandlers.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 6045c2a7..9997fcef 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -443,13 +443,15 @@ namespace TShockAPI /// Velocity of the player /// public Vector2 Velocity { get; set; } + + public byte Pulley { get; set; } } /// /// PlayerUpdate - When the player sends it's updated information to the server /// public static HandlerList PlayerUpdate; - private static bool OnPlayerUpdate(byte player, byte control, byte item, Vector2 position, Vector2 velocity) + private static bool OnPlayerUpdate(byte player, byte control, byte item, Vector2 position, Vector2 velocity, byte pulley) { if (PlayerUpdate == null) return false; @@ -461,6 +463,7 @@ namespace TShockAPI Item = item, Position = position, Velocity = velocity, + Pulley = pulley }; PlayerUpdate.Invoke(null, args); return args.Handled; @@ -1251,7 +1254,7 @@ namespace TShockAPI if (args.Player.FirstMaxHP == 0) args.Player.FirstMaxHP = max; - if (max > TShock.Config.MaxHealth && max > args.Player.FirstMaxHP) + if ((max > TShock.Config.MaxHealth && max > args.Player.FirstMaxHP) && !args.Player.Group.HasPermission(Permissions.ignorestathackdetection)) { TShock.Utils.ForceKick(args.Player, "Hacked Client Detected.", true); return false; @@ -1988,13 +1991,19 @@ namespace TShockAPI var item = args.Data.ReadInt8(); var pos = new Vector2(args.Data.ReadSingle(), args.Data.ReadSingle()); var vel = new Vector2(args.Data.ReadSingle(), args.Data.ReadSingle()); - if (OnPlayerUpdate(plr, control, item, pos, vel)) + byte pulley = args.Data.ReadInt8(); + if (OnPlayerUpdate(plr, control, item, pos, vel, pulley)) return true; if (item < 0 || item >= args.TPlayer.inventory.Length) { return true; } + if (pulley > 2) + { + return true; + } + if (args.Player.LastNetPosition == Vector2.Zero) { return true; @@ -2093,6 +2102,8 @@ namespace TShockAPI args.TPlayer.controlRight = false; args.TPlayer.controlJump = false; args.TPlayer.controlUseItem = false; + args.TPlayer.pulley = pulley != 0; + args.TPlayer.pulleyDir = pulley; args.TPlayer.direction = -1; if ((control & 1) == 1) {