From ed0f522d60716e87889edd2d23238ccdbc863ca4 Mon Sep 17 00:00:00 2001 From: MDIC Date: Sun, 8 May 2022 19:59:38 -0400 Subject: [PATCH] fix (module) Reduce false positives Anti-Swim --- src/AnticheatMgr.cpp | 15 +++++++++++++-- src/AnticheatMgr.h | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/AnticheatMgr.cpp b/src/AnticheatMgr.cpp index 728d75e..f02fd7a 100644 --- a/src/AnticheatMgr.cpp +++ b/src/AnticheatMgr.cpp @@ -424,7 +424,7 @@ void AnticheatMgr::StartHackDetection(Player* player, MovementInfo movementInfo, } if (player->GetLiquidData().Status == LIQUID_MAP_UNDER_WATER) { - AntiSwimHackDetection(player, movementInfo); + AntiSwimHackDetection(player, movementInfo, opcode); } m_Players[key].SetLastMovementInfo(movementInfo); m_Players[key].SetLastOpcode(opcode); @@ -473,7 +473,7 @@ void AnticheatMgr::ClimbHackDetection(Player* player, MovementInfo movementInfo, } // basic detection -void AnticheatMgr::AntiSwimHackDetection(Player* player, MovementInfo movementInfo) +void AnticheatMgr::AntiSwimHackDetection(Player* player, MovementInfo movementInfo, uint32 opcode) { if (!sConfigMgr->GetOption("Anticheat.AntiSwimHack", true)) return; @@ -487,6 +487,17 @@ void AnticheatMgr::AntiSwimHackDetection(Player* player, MovementInfo movementIn } } + if (player->GetLiquidData().Status == (LIQUID_MAP_ABOVE_WATER | LIQUID_MAP_WATER_WALK | LIQUID_MAP_IN_WATER)) + { + return; + } + + if (opcode == MSG_MOVE_JUMP) + return; + + if (movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING || MOVEMENTFLAG_SWIMMING)) + return; + if (player->GetLiquidData().Status == LIQUID_MAP_UNDER_WATER && !movementInfo.HasMovementFlag(MOVEMENTFLAG_SWIMMING)) { if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) diff --git a/src/AnticheatMgr.h b/src/AnticheatMgr.h index b0439ff..81d5470 100644 --- a/src/AnticheatMgr.h +++ b/src/AnticheatMgr.h @@ -78,7 +78,7 @@ class AnticheatMgr void JumpHackDetection(Player* player, MovementInfo movementInfo,uint32 opcode); void TeleportPlaneHackDetection(Player* player, MovementInfo); void ClimbHackDetection(Player* player,MovementInfo movementInfo, uint32 opcode); - void AntiSwimHackDetection(Player* player, MovementInfo movementInfo); + void AntiSwimHackDetection(Player* player, MovementInfo movementInfo, uint32 opcode); void TeleportHackDetection(Player* player, MovementInfo movementInfo); void IgnoreControlHackDetection(Player* player, MovementInfo movementInfo); void ZAxisHackDetection(Player* player, MovementInfo movementInfo);