From 24e45f2665eb05ee0abc6ef1a731b4938284ea28 Mon Sep 17 00:00:00 2001 From: MDIC Date: Sun, 13 Mar 2022 16:29:57 -0400 Subject: [PATCH] Feat (AutoMod\Jail) and fixes in conf typo Automatic Moderation feature: Auto Jail. It auto sends the offender to gm jail room, sets their homebind to the jail and freezes them as a precaution for them "jail breaking out" .unfreeze to undo the freeze. tele them out if innocent, or do whatever to your captive. --- conf/Anticheat.conf.dist | 21 ++++++++++++++++++--- src/AnticheatMgr.cpp | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/conf/Anticheat.conf.dist b/conf/Anticheat.conf.dist index b73203a..8aa7a88 100644 --- a/conf/Anticheat.conf.dist +++ b/conf/Anticheat.conf.dist @@ -70,7 +70,7 @@ Anticheat.DetectJumpHack = 1 Anticheat.DetectTelePlaneHack = 1 Anticheat.DetectSpeedHack = 1 Anticheat.DetectClimbHack = 1 -Anticheat.DetectTelePortHack =1 +Anticheat.DetectTelePortHack = 1 Anticheat.IgnoreControlHack = 1 # Anticheat.StricterFlyHackCheck @@ -98,7 +98,7 @@ Anticheat.ReportsForKick = 70 # Anticheat.ReportsForBan # # Description: Enables and Auto kick when reports reach threshhold -# Description: Kick option for first detect on waterwalkhack (may give false positives) +# Description: Enables and Auto ban when reports reach threshhold # Default: 0 - (Disabled) # 1 - (Enabled) # Default: 70 - (Kick at 70 auto reports) @@ -107,11 +107,26 @@ Anticheat.ReportsForKick = 70 Anticheat.BanPlayer = 0 Anticheat.ReportsForBan = 70 +# Anticheat.JailPlayer +# Anticheat.ReportsForJail +# +# Description: Enables and Auto Jail when reports reach threshhold +# Description: Enables and Auto Jail when reports reach threshhold +# Default: 0 - (Disabled) +# 1 - (Enabled) +# Default: 70 - (Kick at 70 auto reports) +# + +Anticheat.JailPlayer = 0 +Anticheat.ReportsForJail = 70 + # Anticheat.AnnounceKick # Anticheat.AnnounceBan -# Description: Send a message to all players when a user kicked or banned. +# Anticheat.AnnounceJail +# Description: Send a message to all players when a user kicked, banned, jailed. # Default: 0 - (Disabled) # 1 - (Enabled) Anticheat.AnnounceKick = 0 Anticheat.AnnounceBan = 0 +Anticheat.AnnounceJail = 0 diff --git a/src/AnticheatMgr.cpp b/src/AnticheatMgr.cpp index fc95d4a..9a104ab 100644 --- a/src/AnticheatMgr.cpp +++ b/src/AnticheatMgr.cpp @@ -598,6 +598,38 @@ void AnticheatMgr::BuildReport(Player* player, uint16 reportType) sWorld->SendServerMessage(SERVER_MSG_STRING, stream.str().c_str()); } } + + if (sConfigMgr->GetOption("Anticheat.JailPlayer", true) && m_Players[key].GetTotalReports() > sConfigMgr->GetOption("Anticheat.ReportsForJail", 70)) + { + if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) + { + LOG_INFO("module", "AnticheatMgr:: Reports reached assigned threshhold and counteracted by jailing player {} ({})", player->GetName(), player->GetGUID().ToString()); + } + // 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] Auto Jailed Account for Reaching Cheat Threshhold!"; + WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1)); + data << str; + sWorld->SendGlobalGMMessage(&data); + + WorldLocation loc; + loc = WorldLocation(1, 16226.5f, 16403.6f, -64.5f, 3.2f);// GM Jail Location + player->TeleportTo(loc); + player->SetHomebind(loc, 876);// GM Jail Homebind location + player->CastSpell(player,9454);// freeze him in place to ensure no exploit happens for jail break attempt + + if (sConfigMgr->GetOption("Anticheat.AnnounceJail", 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 Jailed by the Anticheat Module.|r"; + sWorld->SendServerMessage(SERVER_MSG_STRING, stream.str().c_str()); + } + } } void AnticheatMgr::AnticheatGlobalCommand(ChatHandler* handler)