diff --git a/conf/Anticheat.conf.dist b/conf/Anticheat.conf.dist index e3169cc..13a9b41 100644 --- a/conf/Anticheat.conf.dist +++ b/conf/Anticheat.conf.dist @@ -40,6 +40,13 @@ Anticheat.MaxReportsForDailyReport = 70 Anticheat.ReportinChat.Min = 70 Anticheat.ReportinChat.Max = 80 +# Anticheat.AlertFrequency +# Description: Once Ingame warngings and report in chat min is met, this will throttle to alert the gms every other count +# Default: So with 5 being the default, u will get a message alert for every 5 violations. +# Anticheat.AlertFrequency = 5 + +Anticheat.AlertFrequency = 5 + # Anticheat.LoginMessage # Description: Enable login message "This server is running an Anticheat module." # Default: 1 diff --git a/src/AnticheatMgr.cpp b/src/AnticheatMgr.cpp index 6da9eb6..bc1d7f6 100644 --- a/src/AnticheatMgr.cpp +++ b/src/AnticheatMgr.cpp @@ -193,15 +193,23 @@ void AnticheatMgr::IgnoreControlHackDetection(Player* player, MovementInfo movem { if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption("Anticheat.ReportsForIngameWarnings", 70)) { - // display warning at the center of the screen, hacky way? - std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible Ignore Control 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)) + _alertFrequency = sConfigMgr->GetOption("Anticheat.AlertFrequency", 5); + // So we dont divide by 0 by accident + if (_alertFrequency < 1) + _alertFrequency = 1; + if (++_counter % _alertFrequency == 0) { - sWorld->SendGMText(LANG_ANTICHEAT_IGNORECONTROL, player->GetName().c_str()); + // display warning at the center of the screen, hacky way? + std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible Ignore Control 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_IGNORECONTROL, player->GetName().c_str()); + } + _counter = 0; } } if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) @@ -258,15 +266,23 @@ void AnticheatMgr::ZAxisHackDetection(Player* player, MovementInfo movementInfo) { if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption("Anticheat.ReportsForIngameWarnings", 70)) { - // display warning at the center of the screen, hacky way? - std::string 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)) + _alertFrequency = sConfigMgr->GetOption("Anticheat.AlertFrequency", 5); + // So we dont divide by 0 by accident + if (_alertFrequency < 1) + _alertFrequency = 1; + if (++_counter % _alertFrequency == 0) { - sWorld->SendGMText(LANG_ANTICHEAT_ALERT, player->GetName().c_str(), player->GetName().c_str()); + // display warning at the center of the screen, hacky way? + std::string 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_ALERT, player->GetName().c_str(), player->GetName().c_str()); + } + _counter = 0; } } if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) @@ -327,15 +343,23 @@ void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementIn { if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption("Anticheat.ReportsForIngameWarnings", 70)) { - // display warning at the center of the screen, hacky way? - std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible Teleport 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)) + _alertFrequency = sConfigMgr->GetOption("Anticheat.AlertFrequency", 5); + // So we dont divide by 0 by accident + if (_alertFrequency < 1) + _alertFrequency = 1; + if (++_counter % _alertFrequency == 0) { - sWorld->SendGMText(LANG_ANTICHEAT_TELEPORT, player->GetName().c_str()); + // display warning at the center of the screen, hacky way? + std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible Teleport 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()); + } + _counter = 0; } } if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) @@ -664,15 +688,23 @@ void AnticheatMgr::BuildReport(Player* player, uint16 reportType) if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption("Anticheat.ReportsForIngameWarnings", 70)) { - // display warning at the center of the screen, hacky way? - std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible cheater!"; - 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)) + _alertFrequency = sConfigMgr->GetOption("Anticheat.AlertFrequency", 5); + // So we dont divide by 0 by accident + if (_alertFrequency < 1) + _alertFrequency = 1; + if (++_counter % _alertFrequency == 0) { - sWorld->SendGMText(LANG_ANTICHEAT_ALERT, player->GetName().c_str(), player->GetName().c_str()); + // display warning at the center of the screen, hacky way? + std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible cheater!"; + 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_ALERT, player->GetName().c_str(), player->GetName().c_str()); + } + _counter = 0; } } diff --git a/src/AnticheatMgr.h b/src/AnticheatMgr.h index f69ffa2..7367ce7 100644 --- a/src/AnticheatMgr.h +++ b/src/AnticheatMgr.h @@ -82,7 +82,8 @@ class AnticheatMgr void BuildReport(Player* player,uint16 reportType); bool MustCheckTempReports(uint8 type); - + uint32 _counter = 0; + uint32 _alertFrequency; AnticheatPlayersDataMap m_Players; ///< Player data };