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>
This commit is contained in:
MDIC
2022-04-27 13:26:32 -04:00
parent 27f0772047
commit df127e135a

View File

@@ -228,41 +228,25 @@ void AnticheatMgr::ZAxisHackDetection(Player* player, MovementInfo movementInfo)
if (!sConfigMgr->GetOption<bool>("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<float>(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
// 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;
break;
}
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<uint32>("Anticheat.ReportsForIngameWarnings", 70))
{