From 8a2f548461b110134b16054d05fc7a12118000d1 Mon Sep 17 00:00:00 2001 From: MDIC Date: Wed, 30 Mar 2022 20:19:50 -0400 Subject: [PATCH] Reduce indents Thanks again for the assistance Co-Authored-By: ModoX --- src/AnticheatMgr.cpp | 73 ++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/src/AnticheatMgr.cpp b/src/AnticheatMgr.cpp index 997598f..9b88abb 100644 --- a/src/AnticheatMgr.cpp +++ b/src/AnticheatMgr.cpp @@ -191,48 +191,49 @@ void AnticheatMgr::ZAxisHackDetection(Player* player, MovementInfo movementInfo) if (!sConfigMgr->GetOption("Anticheat.DetectZaxisHack", true)) return; - if (!movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY) && !movementInfo.HasMovementFlag(MOVEMENTFLAG_FLYING)) + if (movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_FLYING)) + 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 ((xDiff || yDiff) && m_Players[key].GetLastMovementInfo().pos.GetPositionZ() == movementInfo.pos.GetPositionZ() + && player->GetPositionZ() >= groundZ + 5.0f) { - 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 ((xDiff || yDiff) && m_Players[key].GetLastMovementInfo().pos.GetPositionZ() == movementInfo.pos.GetPositionZ() - && player->GetPositionZ() >= groundZ + 5.0f) + if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption("Anticheat.ReportsForIngameWarnings", 70)) { - if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption("Anticheat.ReportsForIngameWarnings", 70)) + // display warning at the center of the screen, hacky way? + std::string str = ""; + str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible Ignore Zaxis Hack Detected!"; + WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1)); + data << str; + sWorld->SendGlobalGMMessage(&data); + // need better way to limit chat spam + if (m_Players[key].GetTotalReports() >= sConfigMgr->GetOption("Anticheat.ReportinChat.Min", 70) && m_Players[key].GetTotalReports() <= sConfigMgr->GetOption("Anticheat.ReportinChat.Max", 80)) { - // display warning at the center of the screen, hacky way? - std::string str = ""; - str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible Ignore Zaxis Hack Detected!"; - WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1)); - data << str; - sWorld->SendGlobalGMMessage(&data); - // need better way to limit chat spam - if (m_Players[key].GetTotalReports() >= sConfigMgr->GetOption("Anticheat.ReportinChat.Min", 70) && m_Players[key].GetTotalReports() <= sConfigMgr->GetOption("Anticheat.ReportinChat.Max", 80)) - { - sWorld->SendGMText(LANG_ANTICHEAT_TELEPORT, player->GetName().c_str()); - } + sWorld->SendGMText(LANG_ANTICHEAT_TELEPORT, player->GetName().c_str()); } - if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) - { - LOG_INFO("module", "AnticheatMgr:: Ignore Zaxis Hack detected player {} ({})", player->GetName(), player->GetGUID().ToString()); - } - - BuildReport(player, ZAXIS_HACK_REPORT); } + if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) + { + LOG_INFO("module", "AnticheatMgr:: Ignore Zaxis Hack detected player {} ({})", player->GetName(), player->GetGUID().ToString()); + } + + BuildReport(player, ZAXIS_HACK_REPORT); } + } void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementInfo)