diff --git a/conf/Anticheat.conf.dist b/conf/Anticheat.conf.dist index b230200..b73203a 100644 --- a/conf/Anticheat.conf.dist +++ b/conf/Anticheat.conf.dist @@ -69,7 +69,7 @@ Anticheat.DetectWaterWalkHack = 1 Anticheat.DetectJumpHack = 1 Anticheat.DetectTelePlaneHack = 1 Anticheat.DetectSpeedHack = 1 -Anticheat.DetectClimbHack = 0 +Anticheat.DetectClimbHack = 1 Anticheat.DetectTelePortHack =1 Anticheat.IgnoreControlHack = 1 @@ -80,22 +80,38 @@ Anticheat.IgnoreControlHack = 1 Anticheat.StricterFlyHackCheck = 0 -# Anticheat.KickPlayerFlyHack -# Description: Kick option for first detect on flyhack (may give false positives) +# Automatic Moderation Features +# +# Anticheat.KickPlayer +# Anticheat.ReportsForKick +# +# Description: Enables and Auto kick when reports reach threshhold # Default: 0 - (Disabled) # 1 - (Enabled) +# Default: 70 - (Kick at 70 auto reports) +# -Anticheat.KickPlayerFlyHack = 0 +Anticheat.KickPlayer = 0 +Anticheat.ReportsForKick = 70 -# Anticheat.KickPlayerWaterWalkHack +# Anticheat.BanPlayer +# Anticheat.ReportsForBan +# +# Description: Enables and Auto kick when reports reach threshhold # Description: Kick option for first detect on waterwalkhack (may give false positives) # Default: 0 - (Disabled) # 1 - (Enabled) +# Default: 70 - (Kick at 70 auto reports) +# -Anticheat.KickPlayerWaterWalkHack = 0 +Anticheat.BanPlayer = 0 +Anticheat.ReportsForBan = 70 # Anticheat.AnnounceKick -# Description: Send a message to all players when a user kicked. +# Anticheat.AnnounceBan +# Description: Send a message to all players when a user kicked or banned. # Default: 0 - (Disabled) -# -Anticheat.AnnounceKick = 1 +# 1 - (Enabled) + +Anticheat.AnnounceKick = 0 +Anticheat.AnnounceBan = 0 diff --git a/src/AnticheatMgr.cpp b/src/AnticheatMgr.cpp index 27a48ef..1f978dc 100644 --- a/src/AnticheatMgr.cpp +++ b/src/AnticheatMgr.cpp @@ -78,27 +78,7 @@ void AnticheatMgr::WalkOnWaterHackDetection(Player* player, MovementInfo moveme return; } - if (sConfigMgr->GetOption("Anticheat.KickPlayerWaterWalkHack", false)) - { - if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) - { - LOG_INFO("module", "AnticheatMgr:: Walk on Water - Hack detected and counteracted by kicking player {} ({})", player->GetName(), player->GetGUID().ToString()); - } - - player->GetSession()->KickPlayer(true); - if (sConfigMgr->GetOption("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->GetOption("Anticheat.WriteLog", true)) + if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) { LOG_INFO("module", "AnticheatMgr:: Walk on Water - Hack detected player {} ({})", player->GetName(), player->GetGUID().ToString()); } @@ -129,27 +109,7 @@ void AnticheatMgr::FlyHackDetection(Player* player, MovementInfo movementInfo) return; } - if (sConfigMgr->GetOption("Anticheat.KickPlayerFlyHack", false)) - { - if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) - { - LOG_INFO("module", "AnticheatMgr:: Fly-Hack detected and counteracted by kicking player {} ({})", player->GetName(), player->GetGUID().ToString()); - } - - player->GetSession()->KickPlayer(true); - if (sConfigMgr->GetOption("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->GetOption("Anticheat.WriteLog", true)) + if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) { LOG_INFO("module", "AnticheatMgr:: Fly-Hack detected player {} ({})", player->GetName(), player->GetGUID().ToString()); } @@ -569,6 +529,63 @@ void AnticheatMgr::BuildReport(Player* player, uint16 reportType) sWorld->SendGMText(LANG_ANTICHEAT_ALERT, player->GetName().c_str(), player->GetName().c_str()); } } + + if (sConfigMgr->GetOption("Anticheat.KickPlayer", true) && m_Players[key].GetTotalReports() > sConfigMgr->GetOption("Anticheat.ReportsForKick", 70)) + { + if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) + { + LOG_INFO("module", "AnticheatMgr:: Reports reached assigned threshhold and counteracted by kicking 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 Kicked for Reaching Cheat Threshhold!"; + WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1)); + data << str; + sWorld->SendGlobalGMMessage(&data); + + player->GetSession()->KickPlayer(true); + if (sConfigMgr->GetOption("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 by the Anticheat Module.|r"; + sWorld->SendServerMessage(SERVER_MSG_STRING, stream.str().c_str()); + } + } + + if (sConfigMgr->GetOption("Anticheat.BanPlayer", true) && m_Players[key].GetTotalReports() > sConfigMgr->GetOption("Anticheat.ReportsForBan", 70)) + { + if (sConfigMgr->GetOption("Anticheat.WriteLog", true)) + { + LOG_INFO("module", "AnticheatMgr:: Reports reached assigned threshhold and counteracted by banning 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 Banned Account for Reaching Cheat Threshhold!"; + WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1)); + data << str; + sWorld->SendGlobalGMMessage(&data); + + std::string accountName; + AccountMgr::GetName(player->GetSession()->GetAccountId(), accountName); + sBan->BanAccount(accountName, "0s", "Anticheat module Auto Banned Account for Reach Cheat Threshhold", "Server"); + + if (sConfigMgr->GetOption("Anticheat.AnnounceBan", 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 Banned by the Anticheat Module.|r"; + sWorld->SendServerMessage(SERVER_MSG_STRING, stream.str().c_str()); + } + } } void AnticheatMgr::AnticheatGlobalCommand(ChatHandler* handler)