diff --git a/conf/Anticheat.conf.dist b/conf/Anticheat.conf.dist index a9fa157..e3169cc 100644 --- a/conf/Anticheat.conf.dist +++ b/conf/Anticheat.conf.dist @@ -72,6 +72,7 @@ Anticheat.DetectSpeedHack = 1 Anticheat.DetectClimbHack = 1 Anticheat.DetectTelePortHack = 1 Anticheat.IgnoreControlHack = 1 +Anticheat.DetectZaxisHack =1 # Anticheat.StricterFlyHackCheck # Description: Checks moveflag ascending (may give false positives) diff --git a/src/AnticheatMgr.cpp b/src/AnticheatMgr.cpp index 522a092..997598f 100644 --- a/src/AnticheatMgr.cpp +++ b/src/AnticheatMgr.cpp @@ -186,6 +186,55 @@ void AnticheatMgr::IgnoreControlHackDetection(Player* player, MovementInfo movem } } +void AnticheatMgr::ZAxisHackDetection(Player* player, MovementInfo movementInfo) +{ + if (!sConfigMgr->GetOption("Anticheat.DetectZaxisHack", true)) + return; + + if (!movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY) && !movementInfo.HasMovementFlag(MOVEMENTFLAG_FLYING)) + { + 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)) + { + // 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()); + } + } + 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) { if (!sConfigMgr->GetOption("Anticheat.DetectTelePortHack", true)) @@ -257,6 +306,7 @@ void AnticheatMgr::StartHackDetection(Player* player, MovementInfo movementInfo, ClimbHackDetection(player, movementInfo, opcode); TeleportHackDetection(player, movementInfo); IgnoreControlHackDetection(player, movementInfo); + ZAxisHackDetection(player, movementInfo); m_Players[key].SetLastMovementInfo(movementInfo); m_Players[key].SetLastOpcode(opcode); } @@ -470,6 +520,9 @@ bool AnticheatMgr::MustCheckTempReports(uint8 type) if (type == IGNORE_CONTROL_REPORT) return false; + if (type == ZAXIS_HACK_REPORT) + return false; + return true; } diff --git a/src/AnticheatMgr.h b/src/AnticheatMgr.h index 03fbfaa..d8836b3 100644 --- a/src/AnticheatMgr.h +++ b/src/AnticheatMgr.h @@ -36,8 +36,8 @@ enum ReportTypes TELEPORT_PLANE_HACK_REPORT = 4, CLIMB_HACK_REPORT = 5, TELEPORT_HACK_REPORT = 6, - IGNORE_CONTROL_REPORT = 7 - + IGNORE_CONTROL_REPORT = 7, + ZAXIS_HACK_REPORT = 8 // MAX_REPORT_TYPES }; @@ -50,7 +50,8 @@ enum DetectionTypes TELEPORT_PLANE_HACK_DETECTION = 16, CLIMB_HACK_DETECTION = 32, TELEPORT_HACK_DETECTION = 64, - IGNORE_CONTROL_DETECTION = 128 + IGNORE_CONTROL_DETECTION = 128, + ZAXIS_HACK_DETECTION = 256 }; // GUID is the key. @@ -92,6 +93,7 @@ class AnticheatMgr void ClimbHackDetection(Player* player,MovementInfo movementInfo,uint32 opcode); void TeleportHackDetection(Player* player, MovementInfo movementInfo); void IgnoreControlHackDetection(Player* player, MovementInfo movementInfo); + void ZAxisHackDetection(Player* player, MovementInfo movementInfo); void BuildReport(Player* player,uint16 reportType); bool MustCheckTempReports(uint8 type);