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

@@ -193,15 +193,23 @@ void AnticheatMgr::IgnoreControlHackDetection(Player* player, MovementInfo movem
{
if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption<uint32>("Anticheat.ReportsForIngameWarnings", 70))
{
// 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!";
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
data << str;
sWorld->SendGlobalGMMessage(&data);
// need better way to limit chat spam
if (m_Players[key].GetTotalReports() >= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Min", 70) && m_Players[key].GetTotalReports() <= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Max", 80))
_alertFrequency = sConfigMgr->GetOption<uint32>("Anticheat.AlertFrequency", 5);
// So we dont divide by 0 by accident
if (_alertFrequency < 1)
_alertFrequency = 1;
if (++_counter % _alertFrequency == 0)
{
sWorld->SendGMText(LANG_ANTICHEAT_IGNORECONTROL, player->GetName().c_str());
// 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!";
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
data << str;
sWorld->SendGlobalGMMessage(&data);
// need better way to limit chat spam
if (m_Players[key].GetTotalReports() >= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Min", 70) && m_Players[key].GetTotalReports() <= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Max", 80))
{
sWorld->SendGMText(LANG_ANTICHEAT_IGNORECONTROL, player->GetName().c_str());
}
_counter = 0;
}
}
if (sConfigMgr->GetOption<bool>("Anticheat.WriteLog", true))
@@ -258,15 +266,23 @@ void AnticheatMgr::ZAxisHackDetection(Player* player, MovementInfo movementInfo)
{
if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption<uint32>("Anticheat.ReportsForIngameWarnings", 70))
{
// 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!";
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
data << str;
sWorld->SendGlobalGMMessage(&data);
// need better way to limit chat spam
if (m_Players[key].GetTotalReports() >= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Min", 70) && m_Players[key].GetTotalReports() <= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Max", 80))
_alertFrequency = sConfigMgr->GetOption<uint32>("Anticheat.AlertFrequency", 5);
// So we dont divide by 0 by accident
if (_alertFrequency < 1)
_alertFrequency = 1;
if (++_counter % _alertFrequency == 0)
{
sWorld->SendGMText(LANG_ANTICHEAT_ALERT, player->GetName().c_str(), player->GetName().c_str());
// 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!";
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
data << str;
sWorld->SendGlobalGMMessage(&data);
// need better way to limit chat spam
if (m_Players[key].GetTotalReports() >= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Min", 70) && m_Players[key].GetTotalReports() <= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Max", 80))
{
sWorld->SendGMText(LANG_ANTICHEAT_ALERT, player->GetName().c_str(), player->GetName().c_str());
}
_counter = 0;
}
}
if (sConfigMgr->GetOption<bool>("Anticheat.WriteLog", true))
@@ -327,15 +343,23 @@ void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementIn
{
if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption<uint32>("Anticheat.ReportsForIngameWarnings", 70))
{
// 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!";
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
data << str;
sWorld->SendGlobalGMMessage(&data);
// need better way to limit chat spam
if (m_Players[key].GetTotalReports() >= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Min", 70) && m_Players[key].GetTotalReports() <= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Max", 80))
_alertFrequency = sConfigMgr->GetOption<uint32>("Anticheat.AlertFrequency", 5);
// So we dont divide by 0 by accident
if (_alertFrequency < 1)
_alertFrequency = 1;
if (++_counter % _alertFrequency == 0)
{
sWorld->SendGMText(LANG_ANTICHEAT_TELEPORT, player->GetName().c_str());
// 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!";
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
data << str;
sWorld->SendGlobalGMMessage(&data);
// need better way to limit chat spam
if (m_Players[key].GetTotalReports() >= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Min", 70) && m_Players[key].GetTotalReports() <= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Max", 80))
{
sWorld->SendGMText(LANG_ANTICHEAT_TELEPORT, player->GetName().c_str());
}
_counter = 0;
}
}
if (sConfigMgr->GetOption<bool>("Anticheat.WriteLog", true))
@@ -664,15 +688,23 @@ void AnticheatMgr::BuildReport(Player* player, uint16 reportType)
if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption<uint32>("Anticheat.ReportsForIngameWarnings", 70))
{
// 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!";
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
data << str;
sWorld->SendGlobalGMMessage(&data);
// need better way to limit chat spam
if (m_Players[key].GetTotalReports() >= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Min", 70) && m_Players[key].GetTotalReports() <= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Max", 80))
_alertFrequency = sConfigMgr->GetOption<uint32>("Anticheat.AlertFrequency", 5);
// So we dont divide by 0 by accident
if (_alertFrequency < 1)
_alertFrequency = 1;
if (++_counter % _alertFrequency == 0)
{
sWorld->SendGMText(LANG_ANTICHEAT_ALERT, player->GetName().c_str(), player->GetName().c_str());
// 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!";
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
data << str;
sWorld->SendGlobalGMMessage(&data);
// need better way to limit chat spam
if (m_Players[key].GetTotalReports() >= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Min", 70) && m_Players[key].GetTotalReports() <= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Max", 80))
{
sWorld->SendGMText(LANG_ANTICHEAT_ALERT, player->GetName().c_str(), player->GetName().c_str());
}
_counter = 0;
}
}

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
};