Fixed mana and HP first time getting flagged as cheat
This commit is contained in:
parent
e50d855f5f
commit
fbad9d6d67
2 changed files with 15 additions and 4 deletions
|
|
@ -8,6 +8,9 @@ namespace TShockAPI
|
||||||
public class TSPlayer
|
public class TSPlayer
|
||||||
{
|
{
|
||||||
public uint tileThreshold;
|
public uint tileThreshold;
|
||||||
|
public bool firstTimeHealth;
|
||||||
|
public bool firstTimeMana;
|
||||||
|
|
||||||
private int player;
|
private int player;
|
||||||
private bool admin;
|
private bool admin;
|
||||||
private bool adminSet;
|
private bool adminSet;
|
||||||
|
|
|
||||||
|
|
@ -199,6 +199,10 @@ namespace TShockAPI
|
||||||
life = br.ReadInt16();
|
life = br.ReadInt16();
|
||||||
maxLife = br.ReadInt16();
|
maxLife = br.ReadInt16();
|
||||||
}
|
}
|
||||||
|
if (!players[ply].firstTimeHealth)
|
||||||
|
{
|
||||||
|
players[ply].firstTimeHealth = true;
|
||||||
|
}
|
||||||
if (maxLife > Main.player[ply].statLifeMax + 20 || life > maxLife)
|
if (maxLife > Main.player[ply].statLifeMax + 20 || life > maxLife)
|
||||||
{
|
{
|
||||||
Tools.HandleCheater(ply);
|
Tools.HandleCheater(ply);
|
||||||
|
|
@ -207,14 +211,18 @@ namespace TShockAPI
|
||||||
else if (e.MsgID == 0x2a)
|
else if (e.MsgID == 0x2a)
|
||||||
{
|
{
|
||||||
byte ply;
|
byte ply;
|
||||||
Int16 life, maxLife;
|
Int16 mana, maxmana;
|
||||||
using (var br = new BinaryReader(new MemoryStream(e.Msg.readBuffer, e.Index, e.Length)))
|
using (var br = new BinaryReader(new MemoryStream(e.Msg.readBuffer, e.Index, e.Length)))
|
||||||
{
|
{
|
||||||
ply = br.ReadByte();
|
ply = br.ReadByte();
|
||||||
life = br.ReadInt16();
|
mana = br.ReadInt16();
|
||||||
maxLife = 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);
|
Tools.HandleCheater(ply);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue