From bac7aefd12d2594b28109fa890278ada4bd86d71 Mon Sep 17 00:00:00 2001 From: MDIC Date: Sat, 9 Apr 2022 13:41:46 -0400 Subject: [PATCH] Add: Purge cmd .anticheat purge clears the whole daily_player_reports table. only administrator level can do run the command. --- src/AnticheatMgr.cpp | 5 +++++ src/AnticheatMgr.h | 2 +- src/cs_anticheat.cpp | 8 ++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/AnticheatMgr.cpp b/src/AnticheatMgr.cpp index 0031ac9..50db4dc 100644 --- a/src/AnticheatMgr.cpp +++ b/src/AnticheatMgr.cpp @@ -781,6 +781,11 @@ void AnticheatMgr::AnticheatDeleteCommand(ObjectGuid guid) } } +void AnticheatMgr::AnticheatPurgeCommand(ChatHandler* handler) +{ + CharacterDatabase.Execute("TRUNCATE TABLE daily_players_reports;"); +} + void AnticheatMgr::ResetDailyReportStates() { for (AnticheatPlayersDataMap::iterator it = m_Players.begin(); it != m_Players.end(); ++it) diff --git a/src/AnticheatMgr.h b/src/AnticheatMgr.h index 03eb9b0..966721e 100644 --- a/src/AnticheatMgr.h +++ b/src/AnticheatMgr.h @@ -80,7 +80,7 @@ class AnticheatMgr void AnticheatGlobalCommand(ChatHandler* handler); void AnticheatDeleteCommand(ObjectGuid guid); - + void AnticheatPurgeCommand(ChatHandler* handler); void ResetDailyReportStates(); private: void SpeedHackDetection(Player* player, MovementInfo movementInfo); diff --git a/src/cs_anticheat.cpp b/src/cs_anticheat.cpp index 279ea5e..8f73aad 100644 --- a/src/cs_anticheat.cpp +++ b/src/cs_anticheat.cpp @@ -40,6 +40,7 @@ public: { "delete", SEC_ADMINISTRATOR, true, &HandleAntiCheatDeleteCommand, "" }, { "jail", SEC_GAMEMASTER, false, &HandleAnticheatJailCommand, "" }, { "parole", SEC_GAMEMASTER, false, &HandleAnticheatParoleCommand, "" }, + { "purge", SEC_ADMINISTRATOR, true, &HandleAntiCheatPurgeCommand, "" }, { "warn", SEC_GAMEMASTER, true, &HandleAnticheatWarnCommand, "" } }; @@ -276,6 +277,13 @@ public: return true; } + + static bool HandleAntiCheatPurgeCommand(ChatHandler* handler, const char* /* args */) + { + sAnticheatMgr->AnticheatPurgeCommand(handler); + handler->PSendSysMessage("The Anticheat daily_player_reports has been purged."); + return true; + } }; void AddSC_anticheat_commandscript()