diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 028e91c4..2196813d 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -8,6 +8,9 @@ namespace TShockAPI public class TSPlayer { public uint tileThreshold; + public bool firstTimeHealth; + public bool firstTimeMana; + private int player; private bool admin; private bool adminSet; diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index f036887d..30b5af07 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -199,6 +199,10 @@ namespace TShockAPI life = br.ReadInt16(); maxLife = br.ReadInt16(); } + if (!players[ply].firstTimeHealth) + { + players[ply].firstTimeHealth = true; + } if (maxLife > Main.player[ply].statLifeMax + 20 || life > maxLife) { Tools.HandleCheater(ply); @@ -207,14 +211,18 @@ namespace TShockAPI else if (e.MsgID == 0x2a) { byte ply; - Int16 life, maxLife; + Int16 mana, maxmana; using (var br = new BinaryReader(new MemoryStream(e.Msg.readBuffer, e.Index, e.Length))) { ply = br.ReadByte(); - life = br.ReadInt16(); - maxLife = br.ReadInt16(); + mana = br.ReadInt16(); + maxmana = br.ReadInt16(); } - if (maxLife > Main.player[ply].statLifeMax + 20 || life > maxLife) + if (!players[ply].firstTimeMana) + { + players[ply].firstTimeMana = true; + } + else if (maxmana > Main.player[ply].statManaMax + 20 || mana > maxmana) { Tools.HandleCheater(ply); }