From 04227315ac544eeac0b94efb34953cd3914c8858 Mon Sep 17 00:00:00 2001 From: M'Dic Date: Wed, 24 Aug 2022 09:34:37 -0400 Subject: [PATCH] update(detection): SimpleFly hack jump variations --- src/AnticheatMgr.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/AnticheatMgr.cpp b/src/AnticheatMgr.cpp index 1f91c77..41a3ff7 100644 --- a/src/AnticheatMgr.cpp +++ b/src/AnticheatMgr.cpp @@ -267,13 +267,23 @@ void AnticheatMgr::FlyHackDetection(Player* player, MovementInfo movementInfo) BuildReport(player, FLY_HACK_REPORT); } -void AnticheatMgr::JumpHackDetection(Player* player, MovementInfo /* movementInfo */, uint32 opcode) +void AnticheatMgr::JumpHackDetection(Player* player, MovementInfo movementInfo, uint32 opcode) { if (!sConfigMgr->GetOption("Anticheat.DetectJumpHack", true)) return; ObjectGuid key = player->GetGUID(); + const float ground_Z = movementInfo.pos.GetPositionZ() - player->GetMapHeight(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY(), movementInfo.pos.GetPositionZ()); + + const bool no_fly_auras = !(player->HasAuraType(SPELL_AURA_FLY) || player->HasAuraType(SPELL_AURA_MOD_INCREASE_VEHICLE_FLIGHT_SPEED) + || player->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) || player->HasAuraType(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED) + || player->HasAuraType(SPELL_AURA_MOD_MOUNTED_FLIGHT_SPEED_ALWAYS)); + const bool no_fly_flags = ((movementInfo.flags & (MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_FLYING)) == 0); + const bool no_swim_in_water = !player->IsInWater(); + const bool no_swim_above_water = movementInfo.pos.GetPositionZ() - 7.0f >= player->GetMap()->GetWaterLevel(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY()); + const bool no_swim_water = no_swim_in_water && no_swim_above_water; + if (m_Players[key].GetLastOpcode() == MSG_MOVE_JUMP && opcode == MSG_MOVE_JUMP) { if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) @@ -284,6 +294,19 @@ void AnticheatMgr::JumpHackDetection(Player* player, MovementInfo /* movementInf } BuildReport(player, JUMP_HACK_REPORT); } + else if (no_fly_auras && no_fly_flags && no_swim_water) + { + if (ground_Z > 5.0f && movementInfo.pos.GetPositionZ() >= player->GetPositionZ()) + { + if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) + { + uint32 latency = 0; + latency = player->GetSession()->GetLatency(); + LOG_INFO("anticheat.module", "AnticheatMgr:: Jump-Hack detected player {} ({}) - Latency: {} ms", player->GetName(), player->GetGUID().ToString(), latency); + } + BuildReport(player, JUMP_HACK_REPORT); + } + } }