Feat (Module) New\removed confs, automation moderation

So fly for kick and water walking is removed, lets be honest, it was a useless idea.
In its place is the Auto Kick and Auto Ban conf with server wide announcement for kick and ban based on its own unique count conf. How this works is if it reachs a number of reports for either ban or kick, it will automatically enact it. The ban is a account ban.
This commit is contained in:
MDIC
2022-03-10 17:03:34 -05:00
parent b7691d8ef9
commit ee8b516cac
2 changed files with 84 additions and 51 deletions

View File

@@ -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

View File

@@ -78,27 +78,7 @@ void AnticheatMgr::WalkOnWaterHackDetection(Player* player, MovementInfo moveme
return;
}
if (sConfigMgr->GetOption<bool>("Anticheat.KickPlayerWaterWalkHack", false))
{
if (sConfigMgr->GetOption<bool>("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<bool>("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<bool>("Anticheat.WriteLog", true))
if (sConfigMgr->GetOption<bool>("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<bool>("Anticheat.KickPlayerFlyHack", false))
{
if (sConfigMgr->GetOption<bool>("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<bool>("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<bool>("Anticheat.WriteLog", true))
if (sConfigMgr->GetOption<bool>("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<bool>("Anticheat.KickPlayer", true) && m_Players[key].GetTotalReports() > sConfigMgr->GetOption<uint32>("Anticheat.ReportsForKick", 70))
{
if (sConfigMgr->GetOption<bool>("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<bool>("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<bool>("Anticheat.BanPlayer", true) && m_Players[key].GetTotalReports() > sConfigMgr->GetOption<uint32>("Anticheat.ReportsForBan", 70))
{
if (sConfigMgr->GetOption<bool>("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<bool>("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)