From df127e135a252a7d1b1714051a5dce70d3b03f52 Mon Sep 17 00:00:00 2001 From: MDIC Date: Wed, 27 Apr 2022 13:26:32 -0400 Subject: [PATCH] update (module) Ignore Z-Axis improved upon Project Nemesis Devs @sveN295 and @jinnaix provided much cleaner detection formula for ignore z axis detection Co-Authored-By: Sven <36102838+sven295@users.noreply.github.com> Co-Authored-By: Jinnaix <37972361+jinnaix@users.noreply.github.com> --- src/AnticheatMgr.cpp | 44 ++++++++++++++------------------------------ 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/src/AnticheatMgr.cpp b/src/AnticheatMgr.cpp index f6ada22..d5e20a2 100644 --- a/src/AnticheatMgr.cpp +++ b/src/AnticheatMgr.cpp @@ -228,41 +228,25 @@ void AnticheatMgr::ZAxisHackDetection(Player* player, MovementInfo movementInfo) if (!sConfigMgr->GetOption("Anticheat.DetectZaxisHack", true)) return; - // if we are a ghost we can walk on water may false flag z -axis - if (player->HasAuraType(SPELL_AURA_GHOST)) - return; - - if (movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_FLYING | MOVEMENTFLAG_SWIMMING)) - return; - ObjectGuid key = player->GetGUID(); - float lastX = m_Players[key].GetLastMovementInfo().pos.GetPositionX(); - float newX = movementInfo.pos.GetPositionX(); - - float lastY = m_Players[key].GetLastMovementInfo().pos.GetPositionY(); - float newY = movementInfo.pos.GetPositionY(); - - float xDiff = fabs(lastX - newX); - float yDiff = fabs(lastY - newY); - - float groundZ_vmap = player->GetMap()->GetHeight(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), true, 50.0f); - float groundZ_dyntree = player->GetMap()->GetDynamicMapTree().getHeight(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), 50.0f, player->GetPhaseMask()); - float groundZ = std::max(groundZ_vmap, groundZ_dyntree); - - if (m_Players[key].GetLastMovementInfo().HasMovementFlag(MOVEMENTFLAG_WATERWALKING) && movementInfo.HasMovementFlag(MOVEMENTFLAG_WATERWALKING)) + // If he is flying we dont need to check + if (movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_FLYING)) return; - switch (player->GetAreaId()) - { - case 4281: //Acherus: The Ebon Hold - case 4342: //Acherus: The Ebon Hold - return; - break; - } + // If the player is allowed to waterwalk (or he is dead because he automatically waterwalks then) we dont need to check any further + // We also stop if the player is in water, because otherwise you get a false positive for swimming + if (movementInfo.HasMovementFlag(MOVEMENTFLAG_WATERWALKING) || player->IsInWater() || !player->IsAlive()) + return; - if ((xDiff || yDiff) && m_Players[key].GetLastMovementInfo().pos.GetPositionZ() == movementInfo.pos.GetPositionZ() - && player->GetPositionZ() >= groundZ + 5.0f) + // We want to exclude this LiquidStatus from detection because it leads to false positives on boats, docks etc. + // Basically everytime you stand on a game object in water + if (player->GetLiquidData().Status == LIQUID_MAP_ABOVE_WATER) + return; + + // This is Black Magic. Check only for x and y difference but no z difference that is greater then or equal to z +5 of the ground + if (m_Players[key].GetLastMovementInfo().pos.GetPositionZ() == movementInfo.pos.GetPositionZ() + && player->GetPositionZ() >= player->GetFloorZ() + 2.5f) { if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption("Anticheat.ReportsForIngameWarnings", 70)) {