From a6b38b056138944414f175a0dd3f1ae18316850f Mon Sep 17 00:00:00 2001 From: Amin MasterkinG Date: Thu, 8 Nov 2018 21:36:32 +0330 Subject: [PATCH] Send world announce on a user kick by AntiCheat. --- conf/Anticheat.conf.dist | 8 +++++++- src/AnticheatMgr.cpp | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/conf/Anticheat.conf.dist b/conf/Anticheat.conf.dist index 597820b..a3ade82 100644 --- a/conf/Anticheat.conf.dist +++ b/conf/Anticheat.conf.dist @@ -81,4 +81,10 @@ Anticheat.KickPlayerFlyHack = 0 # Default: 0 - (Disabled) # 1 - (Enabled) -Anticheat.KickPlayerWaterWalkHack = 0 \ No newline at end of file +Anticheat.KickPlayerWaterWalkHack = 0 + +# Anticheat.AnnounceKick +# Description: Send a message to all players when a user kicked. +# Default: 0 - (Disabled) +# +Anticheat.AnnounceKick = 1 diff --git a/src/AnticheatMgr.cpp b/src/AnticheatMgr.cpp index d3c5082..18b5b1c 100644 --- a/src/AnticheatMgr.cpp +++ b/src/AnticheatMgr.cpp @@ -66,6 +66,17 @@ void AnticheatMgr::WalkOnWaterHackDetection(Player* player, MovementInfo moveme sLog->outString("AnticheatMgr:: Walk on Water - Hack detected and counteracted by kicking player %s (%u)", player->GetName().c_str(), player->GetGUIDLow()); player->GetSession()->KickPlayer(true); + if(sConfigMgr->GetBoolDefault("Anticheat.AnnounceKick", true)) + { + std::string plr = player->GetName(); + std::string tag_colour = "7bbef7"; + std::string plr_colour = "ff0000"; + std::ostringstream stream; + stream << "|CFF" << plr_colour << "[AntiCheat]|r|CFF" << tag_colour << + " Player |r|cff" << plr_colour << plr << "|r|cff" << tag_colour << + " has been kicked.|r"; + sWorld->SendServerMessage(SERVER_MSG_STRING, stream.str().c_str()); + } } else if (sConfigMgr->GetBoolDefault("Anticheat.WriteLog", false)) { sLog->outString("AnticheatMgr:: Walk on Water - Hack detected player %s (%u)", player->GetName().c_str(), player->GetGUIDLow()); @@ -97,6 +108,17 @@ void AnticheatMgr::FlyHackDetection(Player* player, MovementInfo movementInfo) sLog->outString("AnticheatMgr:: Fly-Hack detected and counteracted by kicking player %s (%u)", player->GetName().c_str(), player->GetGUIDLow()); player->GetSession()->KickPlayer(true); + if(sConfigMgr->GetBoolDefault("Anticheat.AnnounceKick", true)) + { + std::string plr = player->GetName(); + std::string tag_colour = "7bbef7"; + std::string plr_colour = "ff0000"; + std::ostringstream stream; + stream << "|CFF" << plr_colour << "[AntiCheat]|r|CFF" << tag_colour << + " Player |r|cff" << plr_colour << plr << "|r|cff" << tag_colour << + " has been kicked.|r"; + sWorld->SendServerMessage(SERVER_MSG_STRING, stream.str().c_str()); + } } else if (sConfigMgr->GetBoolDefault("Anticheat.WriteLog", false)) { sLog->outString( "AnticheatMgr:: Fly-Hack detected player %s (%u)", player->GetName().c_str(), player->GetGUIDLow()); }