From cccfa01ca5501a121f3053bd86ef499bd845f358 Mon Sep 17 00:00:00 2001 From: MDIC Date: Thu, 7 Apr 2022 10:43:31 -0400 Subject: [PATCH] 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> --- src/AnticheatMgr.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/AnticheatMgr.cpp b/src/AnticheatMgr.cpp index a33a774..90c0046 100644 --- a/src/AnticheatMgr.cpp +++ b/src/AnticheatMgr.cpp @@ -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("Anticheat.WriteLog", true)) {