Update: Reduced Further False Positives

This is provided by @sveN295 and @Jinnaix who both are better people then me and for that I thank them for their willingness to assist in updating this ancient anticheat.
Per their notes:
We remove the added speed for jumping because otherwise permanently jumping doubles your allowed speed.

We check the last MovementInfo for the falling flag since falling down a hill and sliding a bit triggered a false positive

Co-Authored-By: Sven <36102838+sveN295@users.noreply.github.com>
Co-Authored-By: Jinnaix <37972361+Jinnaix@users.noreply.github.com>
This commit is contained in:
MDIC
2022-04-07 10:43:31 -04:00
parent 5f875291f1
commit cccfa01ca5

View File

@@ -439,7 +439,8 @@ void AnticheatMgr::SpeedHackDetection(Player* player, MovementInfo movementInfo)
moveType = MOVE_RUN;
// how many yards the player can do in one sec.
uint32 speedRate = (uint32)(player->GetSpeed(UnitMoveType(moveType)) + movementInfo.jump.xyspeed);
// We remove the added speed for jumping because otherwise permanently jumping doubles your allowed speed
uint32 speedRate = (uint32)(player->GetSpeed(UnitMoveType(moveType)));
// how long the player took to move to here.
uint32 timeDiff = getMSTimeDiff(m_Players[key].GetLastMovementInfo().time, movementInfo.time);
@@ -473,8 +474,9 @@ void AnticheatMgr::SpeedHackDetection(Player* player, MovementInfo movementInfo)
// this is the distance doable by the player in 1 sec, using the time done to move to this point.
uint32 clientSpeedRate = distance2D * 1000 / timeDiff;
// we did the (uint32) cast to accept a margin of tolerance
if (clientSpeedRate > speedRate * 1.25f)
// We did the (uint32) cast to accept a margin of tolerance
// We check the last MovementInfo for the falling flag since falling down a hill and sliding a bit triggered a false positive
if ((clientSpeedRate > speedRate * 1.25f) && !m_Players[key].GetLastMovementInfo().HasMovementFlag(MOVEMENTFLAG_FALLING))
{
if (sConfigMgr->GetOption<bool>("Anticheat.WriteLog", true))
{