diff --git a/conf/Anticheat.conf.dist b/conf/Anticheat.conf.dist index 48598e2..53a7379 100644 --- a/conf/Anticheat.conf.dist +++ b/conf/Anticheat.conf.dist @@ -101,6 +101,17 @@ Anticheat.StricterFlyHackCheck = 0 Anticheat.StricterDetectJumpHack = 0 +# Anticheat.SpeedLimitTolerance +# Description: Speed Limit Tolerance allows a certain whole percentage of tolerance to speed +# hack logging and detection. +# +# Example: AnticheatMgr:: Speed-Hack (Speed Movement at 12% above allowed Server Set rate 8%.) +# will be detected since its 4 (default) and higher, but anything 3 and lower will not be flagged. +# Default: 4 - (Default) +# + +Anticheat.SpeedLimitTolerance = 4 + # Automatic Moderation Features # # Anticheat.KickPlayer diff --git a/src/AnticheatMgr.cpp b/src/AnticheatMgr.cpp index 1d65873..22165df 100644 --- a/src/AnticheatMgr.cpp +++ b/src/AnticheatMgr.cpp @@ -222,22 +222,32 @@ 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 + // we create a diff speed in uint32 for further precision checking to avoid legit fall and slide + uint32 diffspeed = clientSpeedRate - speedRate; + + // create a conf to establish a speed limit tolerance over server rate set speed + // this is done so we can ignore minor violations that are not false positives such as going 1 or 2 over the speed limit + _assignedspeeddiff = sConfigMgr->GetOption("Anticheat.SpeedLimitTolerance", 4); + + // We did the (uint32) cast to accept a margin of tolerance for seasonal spells and buffs such as sugar rush // 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.05f) && !m_Players[key].GetLastMovementInfo().HasMovementFlag(MOVEMENTFLAG_FALLING)) + if ((diffspeed >= _assignedspeeddiff) && !m_Players[key].GetLastMovementInfo().HasMovementFlag(MOVEMENTFLAG_FALLING)) { - if (!player->CanTeleport()) + if ((clientSpeedRate > speedRate * 1.05f) && !m_Players[key].GetLastMovementInfo().HasMovementFlag(MOVEMENTFLAG_FALLING)) { - if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) + if (!player->CanTeleport()) { - uint32 latency = 0; - latency = player->GetSession()->GetLatency(); - std::string goXYZ = ".go xyz " + std::to_string(player->GetPositionX()) + " " + std::to_string(player->GetPositionY()) + " " + std::to_string(player->GetPositionZ() + 1.0f) + " " + std::to_string(player->GetMap()->GetId()) + " " + std::to_string(player->GetOrientation()); - LOG_INFO("anticheat.module", "AnticheatMgr:: Speed-Hack (Speed Movement at {}% above allowed Server Set rate {}%.) detected player {} ({}) - Latency: {} ms - IP: {} - Cheat Flagged At: {}", clientSpeedRate, speedRate, player->GetName(), player->GetGUID().ToString(), latency, player->GetSession()->GetRemoteAddress().c_str(), goXYZ); + if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) + { + uint32 latency = 0; + latency = player->GetSession()->GetLatency(); + std::string goXYZ = ".go xyz " + std::to_string(player->GetPositionX()) + " " + std::to_string(player->GetPositionY()) + " " + std::to_string(player->GetPositionZ() + 1.0f) + " " + std::to_string(player->GetMap()->GetId()) + " " + std::to_string(player->GetOrientation()); + LOG_INFO("anticheat.module", "AnticheatMgr:: Speed-Hack (Speed Movement at {}% above allowed Server Set rate {}%.) detected player {} ({}) - Latency: {} ms - IP: {} - Cheat Flagged At: {}", clientSpeedRate, speedRate, player->GetName(), player->GetGUID().ToString(), latency, player->GetSession()->GetRemoteAddress().c_str(), goXYZ); + } + BuildReport(player, SPEED_HACK_REPORT); } - BuildReport(player, SPEED_HACK_REPORT); + return; } - return; } } diff --git a/src/AnticheatMgr.h b/src/AnticheatMgr.h index 4751cfa..23b9b8a 100644 --- a/src/AnticheatMgr.h +++ b/src/AnticheatMgr.h @@ -130,6 +130,7 @@ class AnticheatMgr bool MustCheckTempReports(uint8 type); uint32 _counter = 0; uint32 _alertFrequency = 0; + uint32 _assignedspeeddiff = 0; uint32 _updateCheckTimer = 4000; AnticheatPlayersDataMap m_Players; ///< Player data };