From 74f6229a663c279a7ff1e61feed87d8d0b0f453b Mon Sep 17 00:00:00 2001 From: MDIC Date: Tue, 3 May 2022 09:34:17 -0400 Subject: [PATCH] update (module): Climb Hack Detection Reworked --- src/AnticheatMgr.cpp | 32 +++++++++++++++----------------- src/AnticheatMgr.h | 2 +- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/AnticheatMgr.cpp b/src/AnticheatMgr.cpp index 2785dff..380a966 100644 --- a/src/AnticheatMgr.cpp +++ b/src/AnticheatMgr.cpp @@ -412,7 +412,7 @@ void AnticheatMgr::StartHackDetection(Player* player, MovementInfo movementInfo, FlyHackDetection(player, movementInfo); JumpHackDetection(player, movementInfo, opcode); TeleportPlaneHackDetection(player, movementInfo); - ClimbHackDetection(player, movementInfo, opcode); + ClimbHackDetection(player, movementInfo); TeleportHackDetection(player, movementInfo); IgnoreControlHackDetection(player, movementInfo); if (player->GetLiquidData().Status == LIQUID_MAP_WATER_WALK) @@ -428,17 +428,13 @@ void AnticheatMgr::StartHackDetection(Player* player, MovementInfo movementInfo, } // basic detection -void AnticheatMgr::ClimbHackDetection(Player* player, MovementInfo movementInfo, uint32 opcode) +void AnticheatMgr::ClimbHackDetection(Player* player, MovementInfo movementInfo) { if (!sConfigMgr->GetOption("Anticheat.DetectClimbHack", true)) return; ObjectGuid key = player->GetGUID(); - if (opcode != MSG_MOVE_HEARTBEAT || - m_Players[key].GetLastOpcode() != MSG_MOVE_HEARTBEAT) - return; - // in this case we don't care if they are "legal" flags, they are handled in another parts of the Anticheat Manager. if (player->IsInWater() || player->IsFlying() || @@ -447,21 +443,23 @@ void AnticheatMgr::ClimbHackDetection(Player* player, MovementInfo movementInfo, Position playerPos = player->GetPosition(); - float deltaZ = fabs(playerPos.GetPositionZ() - movementInfo.pos.GetPositionZ()); - float deltaXY = movementInfo.pos.GetExactDist2d(&playerPos); + float diffz = fabs(movementInfo.pos.GetPositionZ() - playerPos.GetPositionZ()); + float tanangle = movementInfo.pos.GetExactDist2d(&playerPos) / diffz; - float angle = Position::NormalizeOrientation(tan(deltaZ / deltaXY)); - - if (angle > CLIMB_ANGLE) + if (!player->HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_FLYING | MOVEMENTFLAG_SWIMMING)) { - if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) + if (movementInfo.pos.GetPositionZ() > playerPos.GetPositionZ() && + diffz > 1.87f && tanangle < 0.57735026919f) // 30 degrees { - uint32 latency = 0; - latency = player->GetSession()->GetLatency(); - LOG_INFO("module", "AnticheatMgr:: Climb-Hack detected player {} ({}) - Latency: {} ms", player->GetName(), player->GetGUID().ToString(), latency); - } + if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) + { + uint32 latency = 0; + latency = player->GetSession()->GetLatency(); + LOG_INFO("module", "AnticheatMgr:: Climb-Hack detected player {} ({}) - Latency: {} ms", player->GetName(), player->GetGUID().ToString(), latency); + } - BuildReport(player, CLIMB_HACK_REPORT); + BuildReport(player, CLIMB_HACK_REPORT); + } } } diff --git a/src/AnticheatMgr.h b/src/AnticheatMgr.h index 7367ce7..1b04aca 100644 --- a/src/AnticheatMgr.h +++ b/src/AnticheatMgr.h @@ -75,7 +75,7 @@ class AnticheatMgr void WalkOnWaterHackDetection(Player* player, MovementInfo movementInfo); void JumpHackDetection(Player* player, MovementInfo movementInfo,uint32 opcode); void TeleportPlaneHackDetection(Player* player, MovementInfo); - void ClimbHackDetection(Player* player,MovementInfo movementInfo,uint32 opcode); + void ClimbHackDetection(Player* player,MovementInfo movementInfo); void TeleportHackDetection(Player* player, MovementInfo movementInfo); void IgnoreControlHackDetection(Player* player, MovementInfo movementInfo); void ZAxisHackDetection(Player* player, MovementInfo movementInfo);