feat (Module\Conf): Alert Fequency

Once Ingame warngings and report in chat min is met, this will throttle to alert the gms every other count, Example so with 5 being the default, u will get a message alert for every 5 violations.
Inspired and approved by project nemesis devs

Co-Authored-By: Sven <36102838+sven295@users.noreply.github.com>
Co-Authored-By: Jinnaix <37972361+jinnaix@users.noreply.github.com>
This commit is contained in:
MDIC
2022-04-22 08:54:07 -04:00
parent 728dbfa440
commit 9f2565f602
3 changed files with 73 additions and 33 deletions

View File

@@ -40,6 +40,13 @@ Anticheat.MaxReportsForDailyReport = 70
Anticheat.ReportinChat.Min = 70
Anticheat.ReportinChat.Max = 80
# Anticheat.AlertFrequency
# Description: Once Ingame warngings and report in chat min is met, this will throttle to alert the gms every other count
# Default: So with 5 being the default, u will get a message alert for every 5 violations.
# Anticheat.AlertFrequency = 5
Anticheat.AlertFrequency = 5
# Anticheat.LoginMessage
# Description: Enable login message "This server is running an Anticheat module."
# Default: 1

View File

@@ -192,6 +192,12 @@ void AnticheatMgr::IgnoreControlHackDetection(Player* player, MovementInfo movem
if (unrestricted)
{
if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption<uint32>("Anticheat.ReportsForIngameWarnings", 70))
{
_alertFrequency = sConfigMgr->GetOption<uint32>("Anticheat.AlertFrequency", 5);
// So we dont divide by 0 by accident
if (_alertFrequency < 1)
_alertFrequency = 1;
if (++_counter % _alertFrequency == 0)
{
// display warning at the center of the screen, hacky way?
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible Ignore Control Hack Detected!";
@@ -203,6 +209,8 @@ void AnticheatMgr::IgnoreControlHackDetection(Player* player, MovementInfo movem
{
sWorld->SendGMText(LANG_ANTICHEAT_IGNORECONTROL, player->GetName().c_str());
}
_counter = 0;
}
}
if (sConfigMgr->GetOption<bool>("Anticheat.WriteLog", true))
{
@@ -257,6 +265,12 @@ void AnticheatMgr::ZAxisHackDetection(Player* player, MovementInfo movementInfo)
&& player->GetPositionZ() >= groundZ + 5.0f)
{
if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption<uint32>("Anticheat.ReportsForIngameWarnings", 70))
{
_alertFrequency = sConfigMgr->GetOption<uint32>("Anticheat.AlertFrequency", 5);
// So we dont divide by 0 by accident
if (_alertFrequency < 1)
_alertFrequency = 1;
if (++_counter % _alertFrequency == 0)
{
// display warning at the center of the screen, hacky way?
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible Ignore Zaxis Hack Detected!";
@@ -268,6 +282,8 @@ void AnticheatMgr::ZAxisHackDetection(Player* player, MovementInfo movementInfo)
{
sWorld->SendGMText(LANG_ANTICHEAT_ALERT, player->GetName().c_str(), player->GetName().c_str());
}
_counter = 0;
}
}
if (sConfigMgr->GetOption<bool>("Anticheat.WriteLog", true))
{
@@ -326,6 +342,12 @@ void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementIn
if ((xDiff >= 50.0f || yDiff >= 50.0f) && !player->CanTeleport())
{
if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption<uint32>("Anticheat.ReportsForIngameWarnings", 70))
{
_alertFrequency = sConfigMgr->GetOption<uint32>("Anticheat.AlertFrequency", 5);
// So we dont divide by 0 by accident
if (_alertFrequency < 1)
_alertFrequency = 1;
if (++_counter % _alertFrequency == 0)
{
// display warning at the center of the screen, hacky way?
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible Teleport Hack Detected!";
@@ -337,6 +359,8 @@ void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementIn
{
sWorld->SendGMText(LANG_ANTICHEAT_TELEPORT, player->GetName().c_str());
}
_counter = 0;
}
}
if (sConfigMgr->GetOption<bool>("Anticheat.WriteLog", true))
{
@@ -663,6 +687,12 @@ void AnticheatMgr::BuildReport(Player* player, uint16 reportType)
}
if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption<uint32>("Anticheat.ReportsForIngameWarnings", 70))
{
_alertFrequency = sConfigMgr->GetOption<uint32>("Anticheat.AlertFrequency", 5);
// So we dont divide by 0 by accident
if (_alertFrequency < 1)
_alertFrequency = 1;
if (++_counter % _alertFrequency == 0)
{
// display warning at the center of the screen, hacky way?
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible cheater!";
@@ -674,6 +704,8 @@ void AnticheatMgr::BuildReport(Player* player, uint16 reportType)
{
sWorld->SendGMText(LANG_ANTICHEAT_ALERT, player->GetName().c_str(), player->GetName().c_str());
}
_counter = 0;
}
}
if (sConfigMgr->GetOption<bool>("Anticheat.KickPlayer", true) && m_Players[key].GetTotalReports() > sConfigMgr->GetOption<uint32>("Anticheat.ReportsForKick", 70))

View File

@@ -82,7 +82,8 @@ class AnticheatMgr
void BuildReport(Player* player,uint16 reportType);
bool MustCheckTempReports(uint8 type);
uint32 _counter = 0;
uint32 _alertFrequency;
AnticheatPlayersDataMap m_Players; ///< Player data
};