From 27286b4f93b9584885ae6413143f9b59767b8bee Mon Sep 17 00:00:00 2001 From: MDIC Date: Fri, 25 Feb 2022 17:58:25 -0500 Subject: [PATCH] feat: New logging,conf, and world sql Apply additional SQL to world db for in chat gm reporting. In game gm chat messages with conf for minimal and maximum chat spam once reportable limit is met. Default min report in chat is 70 and max being 80 so it will only in game chat spam GM's 10 times, Adjustable per conf --- conf/Anticheat.conf.dist | 9 +++++++++ sql/world/Acore_strings.sql | 5 +++++ src/AnticheatMgr.cpp | 19 +++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 sql/world/Acore_strings.sql diff --git a/conf/Anticheat.conf.dist b/conf/Anticheat.conf.dist index 70ec1d1..b230200 100644 --- a/conf/Anticheat.conf.dist +++ b/conf/Anticheat.conf.dist @@ -31,6 +31,15 @@ Anticheat.ReportsForIngameWarnings = 70 Anticheat.MaxReportsForDailyReport = 70 +# Anticheat.ReportinChat +# Description: min and max total reports to trigger gm chat message spam. +# Default: So with 70 being min and 80 being max, it will spam gm in chat 10 times. +# Anticheat.ReportinChat.Min = 70 +# Anticheat.ReportinChat.Max = 80 + +Anticheat.ReportinChat.Min = 70 +Anticheat.ReportinChat.Max = 80 + # Anticheat.LoginMessage # Description: Enable login message "This server is running an Anticheat module." # Default: 1 diff --git a/sql/world/Acore_strings.sql b/sql/world/Acore_strings.sql new file mode 100644 index 0000000..9e017fd --- /dev/null +++ b/sql/world/Acore_strings.sql @@ -0,0 +1,5 @@ +DELETE FROM `acore_string` WHERE `entry` IN (30087,30088,30089); +INSERT INTO `acore_string` (`entry`, `content_default`, `locale_koKR`, `locale_frFR`, `locale_deDE`, `locale_zhCN`, `locale_zhTW`, `locale_esES`, `locale_esMX`, `locale_ruRU`) VALUES +(30087, '|cffffff00[|cffff0000ANTICHEAT ALERT|r|cffffff00]:|r |cFFFF8C00 %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(30088, '|cffffff00[|cffff0000ANTICHEAT ALERT|r|cffffff00]:|r POSSIBLE TELEPORT HACK DETECTED|cFFFF8C00 %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(30089, '|cffffff00[|cffff0000ANTICHEAT ALERT|r|cffffff00]:|r POSSIBLE IGNORE CONTROL HACK DETECTED|cFFFF8C00] %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); \ No newline at end of file diff --git a/src/AnticheatMgr.cpp b/src/AnticheatMgr.cpp index f970c51..7c5b871 100644 --- a/src/AnticheatMgr.cpp +++ b/src/AnticheatMgr.cpp @@ -20,6 +20,10 @@ #define CLIMB_ANGLE 1.87f +#define LANG_ANTICHEAT_ALERT 30087 +#define LANG_ANTICHEAT_TELEPORT 30088 +#define LANG_ANTICHEAT_IGNORECONTROL 30089 + AnticheatMgr::AnticheatMgr() { } @@ -203,6 +207,11 @@ void AnticheatMgr::IgnoreControlHackDetection(Player* player, MovementInfo movem 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()); + } } if (sConfigMgr->GetOption("Anticheat.WriteLog", false)) LOG_INFO("module", "AnticheatMgr:: Ignore Control - Hack detected player {} ({})", player->GetName(), player->GetGUID().ToString()); @@ -242,6 +251,11 @@ void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementIn 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", false)) LOG_INFO("module", "AnticheatMgr:: Teleport-Hack detected player {} ({})", player->GetName(), player->GetGUID().ToString()); @@ -522,6 +536,11 @@ void AnticheatMgr::BuildReport(Player* player, uint16 reportType) 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()); + } } }