Remove duplicate messages in middle of the screen + remove lowest average from anticheat global command

This commit is contained in:
hamecyn@gmail.com
2023-06-09 20:22:49 -04:00
parent 3177f5deca
commit 11379cb5d0
2 changed files with 89 additions and 187 deletions

View File

@@ -135,6 +135,13 @@ void AnticheatMgr::StartHackDetection(Player* player, MovementInfo movementInfo,
m_Players[key].SetLastInformations(movementInfo, opcode, GetPlayerCurrentSpeedRate(player)); m_Players[key].SetLastInformations(movementInfo, opcode, GetPlayerCurrentSpeedRate(player));
} }
void AnticheatMgr::SendMiddleScreenGMMessage(std::string str)
{
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
data << str;
sWorld->SendGlobalGMMessage(&data);
}
uint32 AnticheatMgr::GetTeleportSkillCooldownDurationInMS(Player* player) const uint32 AnticheatMgr::GetTeleportSkillCooldownDurationInMS(Player* player) const
{ {
switch (player->getClass()) switch (player->getClass())
@@ -261,16 +268,13 @@ void AnticheatMgr::SpeedHackDetection(Player* player, MovementInfo movementInfo)
LOG_INFO("anticheat.module", "ANTICHEAT COUNTER MEASURE:: {} Time Diff Corrected (Map: {}) (possible Out of Order Time Manipulation) - Flagged at: {}", player->GetName(), player->GetMapId(), goXYZ); LOG_INFO("anticheat.module", "ANTICHEAT COUNTER MEASURE:: {} Time Diff Corrected (Map: {}) (possible Out of Order Time Manipulation) - Flagged at: {}", player->GetName(), player->GetMapId(), goXYZ);
} }
if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTSCREEN", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTSCREEN", true))
{ // display warning at the center of the screen, hacky way? {
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] TIME MANIPULATION COUNTER MEASURE ALERT"; SendMiddleScreenGMMessage("|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] TIME MANIPULATION COUNTER MEASURE ALERT");
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
data << str;
sWorld->SendGlobalGMMessage(&data);
} }
if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTCHAT", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTCHAT", true))
{ {
std::string str = "|cFFFFFC00 TIME MANIPULATION COUNTER MEASURE ALERT"; const char* str = "|cFFFFFC00 TIME MANIPULATION COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str.c_str(), player->GetName().c_str(), player->GetName().c_str()); sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName().c_str(), player->GetName().c_str());
} }
timeDiff = 1; timeDiff = 1;
BuildReport(player, COUNTER_MEASURES_REPORT); BuildReport(player, COUNTER_MEASURES_REPORT);
@@ -284,16 +288,13 @@ void AnticheatMgr::SpeedHackDetection(Player* player, MovementInfo movementInfo)
LOG_INFO("anticheat.module", "ANTICHEAT COUNTER MEASURE:: {} Time Diff Corrected (Map: {}) (possible Zero Time Manipulation) - Flagged at: {}", player->GetName(), player->GetMapId(), goXYZ); LOG_INFO("anticheat.module", "ANTICHEAT COUNTER MEASURE:: {} Time Diff Corrected (Map: {}) (possible Zero Time Manipulation) - Flagged at: {}", player->GetName(), player->GetMapId(), goXYZ);
} }
if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTSCREEN", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTSCREEN", true))
{ // display warning at the center of the screen, hacky way? {
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] TIME MANIPULATION COUNTER MEASURE ALERT"; SendMiddleScreenGMMessage("|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] TIME MANIPULATION COUNTER MEASURE ALERT");
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
data << str;
sWorld->SendGlobalGMMessage(&data);
} }
if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTCHAT", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTCHAT", true))
{ {
std::string str = "|cFFFFFC00 TIME MANIPULATION COUNTER MEASURE ALERT"; const char* str = "|cFFFFFC00 TIME MANIPULATION COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str.c_str(), player->GetName().c_str(), player->GetName().c_str()); sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName().c_str(), player->GetName().c_str());
} }
timeDiff = 1; timeDiff = 1;
BuildReport(player, COUNTER_MEASURES_REPORT); BuildReport(player, COUNTER_MEASURES_REPORT);
@@ -352,16 +353,13 @@ void AnticheatMgr::SpeedHackDetection(Player* player, MovementInfo movementInfo)
LOG_INFO("anticheat.module", "ANTICHEAT COUNTER MEASURE:: {} Speed Hack Countered and has been set to Server Rate - Flagged at: {}", player->GetName(), goXYZ); LOG_INFO("anticheat.module", "ANTICHEAT COUNTER MEASURE:: {} Speed Hack Countered and has been set to Server Rate - Flagged at: {}", player->GetName(), goXYZ);
} }
if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTSCREEN", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTSCREEN", true))
{ // display warning at the center of the screen, hacky way? {
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] SPEED COUNTER MEASURE ALERT"; SendMiddleScreenGMMessage("|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] SPEED COUNTER MEASURE ALERT");
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
data << str;
sWorld->SendGlobalGMMessage(&data);
} }
if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTCHAT", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTCHAT", true))
{ {
std::string str = "|cFFFFFC00 SPEED HACK COUNTER MEASURE ALERT"; const char* str = "|cFFFFFC00 SPEED HACK COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str.c_str(), player->GetName().c_str(), player->GetName().c_str()); sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName().c_str(), player->GetName().c_str());
} }
BuildReport(player, COUNTER_MEASURES_REPORT); BuildReport(player, COUNTER_MEASURES_REPORT);
} }
@@ -403,12 +401,7 @@ void AnticheatMgr::FlyHackDetection(Player* player, MovementInfo movementInfo)
} }
if (sConfigMgr->GetOption<bool>("Anticheat.CM.FLYHACK", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.FLYHACK", true))
{ // display warning at the center of the screen, hacky way? {
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] FLY HACK COUNTER MEASURE ALERT";
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
data << str;
sWorld->SendGlobalGMMessage(&data);
WorldPacket cheater(12); WorldPacket cheater(12);
cheater.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY); cheater.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY);
cheater << player->GetPackGUID(); cheater << player->GetPackGUID();
@@ -420,16 +413,13 @@ void AnticheatMgr::FlyHackDetection(Player* player, MovementInfo movementInfo)
LOG_INFO("anticheat.module", "ANTICHEAT COUNTER MEASURE:: {} Fly Hack Countered and has Opcode set to SMSG_MOVE_UNSET_CAN_FLY - Flagged at: {}", player->GetName(), goXYZ); LOG_INFO("anticheat.module", "ANTICHEAT COUNTER MEASURE:: {} Fly Hack Countered and has Opcode set to SMSG_MOVE_UNSET_CAN_FLY - Flagged at: {}", player->GetName(), goXYZ);
} }
if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTSCREEN", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTSCREEN", true))
{ // display warning at the center of the screen, hacky way? {
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] FLY HACK COUNTER MEASURE ALERT"; SendMiddleScreenGMMessage("|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] FLY HACK COUNTER MEASURE ALERT");
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
data << str;
sWorld->SendGlobalGMMessage(&data);
} }
if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTCHAT", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTCHAT", true))
{ {
std::string str = "|cFFFFFC00 FLY HACK COUNTER MEASURE ALERT"; const char* str = "|cFFFFFC00 FLY HACK COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str.c_str(), player->GetName().c_str(), player->GetName().c_str()); sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName().c_str(), player->GetName().c_str());
} }
BuildReport(player, COUNTER_MEASURES_REPORT); BuildReport(player, COUNTER_MEASURES_REPORT);
} }
@@ -463,12 +453,7 @@ void AnticheatMgr::JumpHackDetection(Player* player, MovementInfo movementInfo,
LOG_INFO("anticheat.module", "AnticheatMgr:: Jump-Hack detected player {} ({}) - Latency: {} ms - IP: {} - Cheat Flagged At: {}", player->GetName(), player->GetGUID().ToString(), latency, player->GetSession()->GetRemoteAddress().c_str(), goXYZ); LOG_INFO("anticheat.module", "AnticheatMgr:: Jump-Hack detected player {} ({}) - Latency: {} ms - IP: {} - Cheat Flagged At: {}", player->GetName(), player->GetGUID().ToString(), latency, player->GetSession()->GetRemoteAddress().c_str(), goXYZ);
} }
if (sConfigMgr->GetOption<bool>("Anticheat.CM.JUMPHACK", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.JUMPHACK", true))
{ // display warning at the center of the screen, hacky way? {
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] JUMP HACK COUNTER MEASURE ALERT";
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
data << str;
sWorld->SendGlobalGMMessage(&data);
player->GetMotionMaster()->MoveFall(); player->GetMotionMaster()->MoveFall();
if (sConfigMgr->GetOption<bool>("Anticheat.CM.WriteLog", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.WriteLog", true))
@@ -477,16 +462,13 @@ void AnticheatMgr::JumpHackDetection(Player* player, MovementInfo movementInfo,
LOG_INFO("anticheat.module", "ANTICHEAT COUNTER MEASURE:: {} JUMP Hack Countered and has been set to fall - Flagged at: {}", player->GetName(), goXYZ); LOG_INFO("anticheat.module", "ANTICHEAT COUNTER MEASURE:: {} JUMP Hack Countered and has been set to fall - Flagged at: {}", player->GetName(), goXYZ);
} }
if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTSCREEN", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTSCREEN", true))
{ // display warning at the center of the screen, hacky way? {
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] JUMP COUNTER MEASURE ALERT"; SendMiddleScreenGMMessage("|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] JUMP HACK COUNTER MEASURE ALERT");
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
data << str;
sWorld->SendGlobalGMMessage(&data);
} }
if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTCHAT", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTCHAT", true))
{ {
std::string str = "|cFFFFFC00 JUMP HACK COUNTER MEASURE ALERT"; const char* str = "|cFFFFFC00 JUMP HACK COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str.c_str(), player->GetName().c_str(), player->GetName().c_str()); sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName().c_str(), player->GetName().c_str());
} }
BuildReport(player, COUNTER_MEASURES_REPORT); BuildReport(player, COUNTER_MEASURES_REPORT);
} }
@@ -510,10 +492,8 @@ void AnticheatMgr::JumpHackDetection(Player* player, MovementInfo movementInfo,
if (m_Players[key].GetLastOpcode() == MSG_MOVE_JUMP && !player->IsFalling()) if (m_Players[key].GetLastOpcode() == MSG_MOVE_JUMP && !player->IsFalling())
return; return;
uint32 distance2D = (uint32)movementInfo.pos.GetExactDist2d(&m_Players[key].GetLastMovementInfo().pos);
// This is necessary since MovementHandler fires if you rotate the camera in place // This is necessary since MovementHandler fires if you rotate the camera in place
if (!distance2D) if (!movementInfo.pos.GetExactDist2d(&m_Players[key].GetLastMovementInfo().pos))
return; return;
if (!player->HasUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY) && movementInfo.jump.zspeed < -10.0f) if (!player->HasUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY) && movementInfo.jump.zspeed < -10.0f)
@@ -534,12 +514,7 @@ void AnticheatMgr::JumpHackDetection(Player* player, MovementInfo movementInfo,
LOG_INFO("anticheat.module", "AnticheatMgr:: Stricter Check Jump-Hack detected player {} ({}) - Latency: {} ms - IP: {} - Cheat Flagged At: {}", player->GetName(), player->GetGUID().ToString(), latency, player->GetSession()->GetRemoteAddress().c_str(), goXYZ); LOG_INFO("anticheat.module", "AnticheatMgr:: Stricter Check Jump-Hack detected player {} ({}) - Latency: {} ms - IP: {} - Cheat Flagged At: {}", player->GetName(), player->GetGUID().ToString(), latency, player->GetSession()->GetRemoteAddress().c_str(), goXYZ);
} }
if (sConfigMgr->GetOption<bool>("Anticheat.CM.ADVJUMPHACK", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.ADVJUMPHACK", true))
{ // display warning at the center of the screen, hacky way? {
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] ADVANCE JUMP HACK COUNTER MEASURE ALERT";
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
data << str;
sWorld->SendGlobalGMMessage(&data);
player->GetMotionMaster()->MoveFall(); player->GetMotionMaster()->MoveFall();
if (sConfigMgr->GetOption<bool>("Anticheat.CM.WriteLog", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.WriteLog", true))
@@ -548,16 +523,13 @@ void AnticheatMgr::JumpHackDetection(Player* player, MovementInfo movementInfo,
LOG_INFO("anticheat.module", "ANTICHEAT COUNTER MEASURE:: {} ADVANCE JUMP Hack Countered and has been set to fall - Flagged at: {}", player->GetName(), goXYZ); LOG_INFO("anticheat.module", "ANTICHEAT COUNTER MEASURE:: {} ADVANCE JUMP Hack Countered and has been set to fall - Flagged at: {}", player->GetName(), goXYZ);
} }
if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTSCREEN", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTSCREEN", true))
{ // display warning at the center of the screen, hacky way? {
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] ADVANCE JUMP COUNTER MEASURE ALERT"; SendMiddleScreenGMMessage("|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] ADVANCE JUMP HACK COUNTER MEASURE ALERT");
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
data << str;
sWorld->SendGlobalGMMessage(&data);
} }
if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTCHAT", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTCHAT", true))
{ {
std::string str = "|cFFFFFC00 ADVANCE JUMP HACK COUNTER MEASURE ALERT"; const char* str = "|cFFFFFC00 ADVANCE JUMP HACK COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str.c_str(), player->GetName().c_str(), player->GetName().c_str()); sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName().c_str(), player->GetName().c_str());
} }
BuildReport(player, COUNTER_MEASURES_REPORT); BuildReport(player, COUNTER_MEASURES_REPORT);
} }
@@ -592,11 +564,9 @@ void AnticheatMgr::TeleportPlaneHackDetection(Player* player, MovementInfo movem
ObjectGuid key = player->GetGUID(); ObjectGuid key = player->GetGUID();
uint32 distance2D = (uint32)movementInfo.pos.GetExactDist2d(&m_Players[key].GetLastMovementInfo().pos);
// We don't need to check for a water walking hack if the player hasn't moved // We don't need to check for a water walking hack if the player hasn't moved
// This is necessary since MovementHandler fires if you rotate the camera in place // This is necessary since MovementHandler fires if you rotate the camera in place
if (!distance2D) if (!movementInfo.pos.GetExactDist2d(&m_Players[key].GetLastMovementInfo().pos))
return; return;
if (m_Players[key].GetLastOpcode() == MSG_MOVE_JUMP) if (m_Players[key].GetLastOpcode() == MSG_MOVE_JUMP)
@@ -748,10 +718,8 @@ void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementIn
{ {
Player* opponent = player->duel->Opponent; Player* opponent = player->duel->Opponent;
std::string str = "|cFFFFFC00[DUEL ALERT Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] Possible Teleport Hack Detected! While Dueling [|cFF60FF00" + opponent->GetName() + "|cFF00FFFF]"; SendMiddleScreenGMMessage("|cFFFFFC00[DUEL ALERT Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] Possible Teleport Hack Detected! While Dueling [|cFF60FF00" + opponent->GetName() + "|cFF00FFFF]");
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
data << str;
sWorld->SendGlobalGMMessage(&data);
uint32 latency = player->GetSession()->GetLatency(); uint32 latency = player->GetSession()->GetLatency();
std::string goXYZ = ".go xyz " + std::to_string(player->GetPositionX()) + " " + std::to_string(player->GetPositionY()) + " " + std::to_string(player->GetPositionZ() + 1.0f) + " " + std::to_string(player->GetMap()->GetId()) + " " + std::to_string(player->GetOrientation()); std::string goXYZ = ".go xyz " + std::to_string(player->GetPositionX()) + " " + std::to_string(player->GetPositionY()) + " " + std::to_string(player->GetPositionZ() + 1.0f) + " " + std::to_string(player->GetMap()->GetId()) + " " + std::to_string(player->GetOrientation());
std::string goXYZ2 = ".go xyz " + std::to_string(opponent->GetPositionX()) + " " + std::to_string(opponent->GetPositionY()) + " " + std::to_string(opponent->GetPositionZ() + 1.0f) + " " + std::to_string(opponent->GetMap()->GetId()) + " " + std::to_string(opponent->GetOrientation()); std::string goXYZ2 = ".go xyz " + std::to_string(opponent->GetPositionX()) + " " + std::to_string(opponent->GetPositionY()) + " " + std::to_string(opponent->GetPositionZ() + 1.0f) + " " + std::to_string(opponent->GetMap()->GetId()) + " " + std::to_string(opponent->GetOrientation());
@@ -780,15 +748,12 @@ void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementIn
_alertFrequency = 1; _alertFrequency = 1;
if (++_counter % _alertFrequency == 0) if (++_counter % _alertFrequency == 0)
{ {
// display warning at the center of the screen, hacky way? SendMiddleScreenGMMessage("|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] Possible Teleport Hack Detected!");
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] Possible Teleport Hack Detected!";
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
data << str;
sWorld->SendGlobalGMMessage(&data);
uint32 latency = player->GetSession()->GetLatency();
// need better way to limit chat spam // 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)) if (m_Players[key].GetTotalReports() >= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Min", 70) && m_Players[key].GetTotalReports() <= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Max", 80))
{ {
uint32 latency = player->GetSession()->GetLatency();
sWorld->SendGMText(LANG_ANTICHEAT_TELEPORT, player->GetName().c_str(), player->GetName().c_str(), latency, xDiff, yDiff, zDiff); sWorld->SendGMText(LANG_ANTICHEAT_TELEPORT, player->GetName().c_str(), player->GetName().c_str(), latency, xDiff, yDiff, zDiff);
} }
_counter = 0; _counter = 0;
@@ -808,16 +773,13 @@ void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementIn
LOG_INFO("anticheat.module", "ANTICHEAT COUNTER MEASURE:: {} TELEPORT HACK REVERTED PLAYER BACK TO {}", player->GetName(), LastgoXYZ); LOG_INFO("anticheat.module", "ANTICHEAT COUNTER MEASURE:: {} TELEPORT HACK REVERTED PLAYER BACK TO {}", player->GetName(), LastgoXYZ);
} }
if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTSCREEN", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTSCREEN", true))
{ // display warning at the center of the screen, hacky way? {
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] TELEPORT HACK COUNTER MEASURE ALERT"; SendMiddleScreenGMMessage("|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] TELEPORT HACK COUNTER MEASURE ALERT");
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
data << str;
sWorld->SendGlobalGMMessage(&data);
} }
if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTCHAT", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTCHAT", true))
{ {
std::string str = "|cFFFFFC00 TELEPORT COUNTER MEASURE ALERT"; const char* str = "|cFFFFFC00 TELEPORT COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str.c_str(), player->GetName().c_str(), player->GetName().c_str()); sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName().c_str(), player->GetName().c_str());
} }
player->TeleportTo(player->GetMapId(), lastX, lastY, lastZ, player->GetOrientation()); player->TeleportTo(player->GetMapId(), lastX, lastY, lastZ, player->GetOrientation());
BuildReport(player, COUNTER_MEASURES_REPORT); BuildReport(player, COUNTER_MEASURES_REPORT);
@@ -832,12 +794,6 @@ void AnticheatMgr::IgnoreControlHackDetection(Player* player, MovementInfo movem
{ {
ObjectGuid key = player->GetGUID(); ObjectGuid key = player->GetGUID();
float lastX = m_Players[key].GetLastMovementInfo().pos.GetPositionX();
float newX = movementInfo.pos.GetPositionX();
float lastY = m_Players[key].GetLastMovementInfo().pos.GetPositionY();
float newY = movementInfo.pos.GetPositionY();
if (!sConfigMgr->GetOption<bool>("Anticheat.IgnoreControlHack", true)) if (!sConfigMgr->GetOption<bool>("Anticheat.IgnoreControlHack", true))
return; return;
@@ -850,10 +806,17 @@ void AnticheatMgr::IgnoreControlHackDetection(Player* player, MovementInfo movem
if (movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING | MOVEMENTFLAG_SWIMMING)) if (movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING | MOVEMENTFLAG_SWIMMING))
return; return;
bool hasBadLatency = player->GetSession()->GetLatency() >= 400; uint32 latency = player->GetSession()->GetLatency();
bool hasBadLatency = latency >= 400;
if (player->HasAuraType(SPELL_AURA_MOD_ROOT) && !player->GetVehicle() && !hasBadLatency) if (player->HasAuraType(SPELL_AURA_MOD_ROOT) && !player->GetVehicle() && !hasBadLatency)
{ {
float lastX = m_Players[key].GetLastMovementInfo().pos.GetPositionX();
float newX = movementInfo.pos.GetPositionX();
float lastY = m_Players[key].GetLastMovementInfo().pos.GetPositionY();
float newY = movementInfo.pos.GetPositionY();
bool unrestricted = newX != lastX || newY != lastY; bool unrestricted = newX != lastX || newY != lastY;
if (unrestricted) if (unrestricted)
{ {
@@ -865,15 +828,11 @@ void AnticheatMgr::IgnoreControlHackDetection(Player* player, MovementInfo movem
_alertFrequency = 1; _alertFrequency = 1;
if (++_counter % _alertFrequency == 0) if (++_counter % _alertFrequency == 0)
{ {
// display warning at the center of the screen, hacky way? SendMiddleScreenGMMessage("|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] Possible Ignore Control Hack Detected!");
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|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 // 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)) if (m_Players[key].GetTotalReports() >= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Min", 70) && m_Players[key].GetTotalReports() <= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Max", 80))
{ {
uint32 latency = player->GetSession()->GetLatency();
sWorld->SendGMText(LANG_ANTICHEAT_IGNORECONTROL, player->GetName().c_str(), latency); sWorld->SendGMText(LANG_ANTICHEAT_IGNORECONTROL, player->GetName().c_str(), latency);
} }
_counter = 0; _counter = 0;
@@ -881,7 +840,6 @@ void AnticheatMgr::IgnoreControlHackDetection(Player* player, MovementInfo movem
} }
if (sConfigMgr->GetOption<bool>("Anticheat.WriteLog", true)) if (sConfigMgr->GetOption<bool>("Anticheat.WriteLog", true))
{ {
uint32 latency = player->GetSession()->GetLatency();
std::string goXYZ = ".go xyz " + std::to_string(player->GetPositionX()) + " " + std::to_string(player->GetPositionY()) + " " + std::to_string(player->GetPositionZ() + 1.0f) + " " + std::to_string(player->GetMap()->GetId()) + " " + std::to_string(player->GetOrientation()); std::string goXYZ = ".go xyz " + std::to_string(player->GetPositionX()) + " " + std::to_string(player->GetPositionY()) + " " + std::to_string(player->GetPositionZ() + 1.0f) + " " + std::to_string(player->GetMap()->GetId()) + " " + std::to_string(player->GetOrientation());
LOG_INFO("anticheat.module", "AnticheatMgr:: Ignore Control - Hack detected player {} ({}) - Latency: {} ms - IP: {} - Cheat Flagged At: {}", player->GetName(), player->GetGUID().ToString(), latency, player->GetSession()->GetRemoteAddress().c_str(), goXYZ); LOG_INFO("anticheat.module", "AnticheatMgr:: Ignore Control - Hack detected player {} ({}) - Latency: {} ms - IP: {} - Cheat Flagged At: {}", player->GetName(), player->GetGUID().ToString(), latency, player->GetSession()->GetRemoteAddress().c_str(), goXYZ);
} }
@@ -922,11 +880,9 @@ void AnticheatMgr::WalkOnWaterHackDetection(Player* player, MovementInfo movemen
ObjectGuid key = player->GetGUID(); ObjectGuid key = player->GetGUID();
uint32 distance2D = (uint32)movementInfo.pos.GetExactDist2d(&m_Players[key].GetLastMovementInfo().pos);
// We don't need to check for a water walking hack if the player hasn't moved // We don't need to check for a water walking hack if the player hasn't moved
// This is necessary since MovementHandler fires if you rotate the camera in place // This is necessary since MovementHandler fires if you rotate the camera in place
if (!distance2D) if (!movementInfo.pos.GetExactDist2d(&m_Players[key].GetLastMovementInfo().pos))
return; return;
if (player->GetLiquidData().Status == LIQUID_MAP_WATER_WALK && !player->IsFlying()) if (player->GetLiquidData().Status == LIQUID_MAP_WATER_WALK && !player->IsFlying())
@@ -1013,11 +969,9 @@ void AnticheatMgr::ZAxisHackDetection(Player* player, MovementInfo movementInfo)
ObjectGuid key = player->GetGUID(); ObjectGuid key = player->GetGUID();
uint32 distance2D = (uint32)movementInfo.pos.GetExactDist2d(&m_Players[key].GetLastMovementInfo().pos);
// We don't need to check for a ignore z if the player hasn't moved // We don't need to check for a ignore z if the player hasn't moved
// This is necessary since MovementHandler fires if you rotate the camera in place // This is necessary since MovementHandler fires if you rotate the camera in place
if (!distance2D) if (!movementInfo.pos.GetExactDist2d(&m_Players[key].GetLastMovementInfo().pos))
return; return;
// This is Black Magic. Check only for x and y difference but no z difference that is greater then or equal to z +2.5 of the ground // This is Black Magic. Check only for x and y difference but no z difference that is greater then or equal to z +2.5 of the ground
@@ -1032,11 +986,8 @@ void AnticheatMgr::ZAxisHackDetection(Player* player, MovementInfo movementInfo)
_alertFrequency = 1; _alertFrequency = 1;
if (++_counter % _alertFrequency == 0) if (++_counter % _alertFrequency == 0)
{ {
// display warning at the center of the screen, hacky way? SendMiddleScreenGMMessage("|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] Possible Ignore Zaxis Hack Detected!");
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|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 // 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)) if (m_Players[key].GetTotalReports() >= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Min", 70) && m_Players[key].GetTotalReports() <= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Max", 80))
{ {
@@ -1053,12 +1004,7 @@ void AnticheatMgr::ZAxisHackDetection(Player* player, MovementInfo movementInfo)
LOG_INFO("anticheat.module", "AnticheatMgr:: Ignore Zaxis Hack detected player {} ({}) - Latency: {} ms - IP: {} - Cheat Flagged At: {}", player->GetName(), player->GetGUID().ToString(), latency, player->GetSession()->GetRemoteAddress().c_str(), goXYZ); LOG_INFO("anticheat.module", "AnticheatMgr:: Ignore Zaxis Hack detected player {} ({}) - Latency: {} ms - IP: {} - Cheat Flagged At: {}", player->GetName(), player->GetGUID().ToString(), latency, player->GetSession()->GetRemoteAddress().c_str(), goXYZ);
} }
if (sConfigMgr->GetOption<bool>("Anticheat.CM.IGNOREZ", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.IGNOREZ", true))
{ // display warning at the center of the screen, hacky way? {
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] IGNORE-Z HACK COUNTER MEASURE ALERT";
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
data << str;
sWorld->SendGlobalGMMessage(&data);
player->GetMotionMaster()->MoveFall(); player->GetMotionMaster()->MoveFall();
if (sConfigMgr->GetOption<bool>("Anticheat.CM.WriteLog", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.WriteLog", true))
@@ -1067,16 +1013,13 @@ void AnticheatMgr::ZAxisHackDetection(Player* player, MovementInfo movementInfo)
LOG_INFO("anticheat.module", "ANTICHEAT COUNTER MEASURE:: {} IGNORE-Z Hack Countered and has been set to fall - Flagged at: {}", player->GetName(), goXYZ); LOG_INFO("anticheat.module", "ANTICHEAT COUNTER MEASURE:: {} IGNORE-Z Hack Countered and has been set to fall - Flagged at: {}", player->GetName(), goXYZ);
} }
if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTSCREEN", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTSCREEN", true))
{ // display warning at the center of the screen, hacky way? {
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] IGNORE-Z COUNTER MEASURE ALERT"; SendMiddleScreenGMMessage("|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] IGNORE-Z HACK COUNTER MEASURE ALERT");
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
data << str;
sWorld->SendGlobalGMMessage(&data);
} }
if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTCHAT", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTCHAT", true))
{ {
std::string str = "|cFFFFFC00 IGNORE-Z HACK COUNTER MEASURE ALERT"; const char* str = "|cFFFFFC00 IGNORE-Z HACK COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str.c_str(), player->GetName().c_str(), player->GetName().c_str()); sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName().c_str(), player->GetName().c_str());
} }
BuildReport(player, COUNTER_MEASURES_REPORT); BuildReport(player, COUNTER_MEASURES_REPORT);
} }
@@ -1206,15 +1149,12 @@ void AnticheatMgr::BGreport(Player* player)
{ {
ObjectGuid key = player->GetGUID(); ObjectGuid key = player->GetGUID();
// display warning at the center of the screen, hacky way? SendMiddleScreenGMMessage("|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] Player Outside of Starting SPOT before BG has started!");
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] Player Outside of Starting SPOT before BG has started!";
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
data << str;
sWorld->SendGlobalGMMessage(&data);
uint32 latency = player->GetSession()->GetLatency();
// need better way to limit chat spam // 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)) if (m_Players[key].GetTotalReports() >= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Min", 70) && m_Players[key].GetTotalReports() <= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Max", 80))
{ {
uint32 latency = player->GetSession()->GetLatency();
sWorld->SendGMText(LANG_ANTICHEAT_BG_EXPLOIT, player->GetName().c_str(), player->GetName().c_str(), latency); sWorld->SendGMText(LANG_ANTICHEAT_BG_EXPLOIT, player->GetName().c_str(), player->GetName().c_str(), latency);
} }
_counter = 0; _counter = 0;
@@ -1250,16 +1190,13 @@ void AnticheatMgr::CheckStartPositions(Player* player)
LOG_INFO("anticheat.module", "ANTICHEAT COUNTER MEASURE:: Sending {} back to start location (BG Map: {}) (possible exploit) - Flagged at: {}", player->GetName(), player->GetMapId(), goXYZ); LOG_INFO("anticheat.module", "ANTICHEAT COUNTER MEASURE:: Sending {} back to start location (BG Map: {}) (possible exploit) - Flagged at: {}", player->GetName(), player->GetMapId(), goXYZ);
} }
if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTSCREEN", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTSCREEN", true))
{ // display warning at the center of the screen, hacky way? {
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] BG START SPOT COUNTER MEASURE ALERT"; SendMiddleScreenGMMessage("|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] BG START SPOT COUNTER MEASURE ALERT");
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
data << str;
sWorld->SendGlobalGMMessage(&data);
} }
if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTCHAT", true)) if (sConfigMgr->GetOption<bool>("Anticheat.CM.ALERTCHAT", true))
{ {
std::string str = "|cFFFFFC00 BG START SPOT COUNTER MEASURE ALERT"; const char* str = "|cFFFFFC00 BG START SPOT COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str.c_str(), player->GetName().c_str(), player->GetName().c_str()); sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str, player->GetName().c_str(), player->GetName().c_str());
} }
BuildReport(player, COUNTER_MEASURES_REPORT); BuildReport(player, COUNTER_MEASURES_REPORT);
player->TeleportTo(player->GetMapId(), startPos->GetPositionX(), startPos->GetPositionY(), startPos->GetPositionZ(), startPos->GetOrientation()); player->TeleportTo(player->GetMapId(), startPos->GetPositionX(), startPos->GetPositionY(), startPos->GetPositionZ(), startPos->GetOrientation());
@@ -1595,15 +1532,12 @@ void AnticheatMgr::BuildReport(Player* player, ReportTypes reportType)
_alertFrequency = 1; _alertFrequency = 1;
if (++_counter % _alertFrequency == 0) if (++_counter % _alertFrequency == 0)
{ {
// display warning at the center of the screen, hacky way? SendMiddleScreenGMMessage("|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] Possible cheater!");
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] Possible cheater!";
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
data << str;
sWorld->SendGlobalGMMessage(&data);
uint32 latency = player->GetSession()->GetLatency();
// need better way to limit chat spam // 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)) if (m_Players[key].GetTotalReports() >= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Min", 70) && m_Players[key].GetTotalReports() <= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Max", 80))
{ {
uint32 latency = player->GetSession()->GetLatency();
sWorld->SendGMText(LANG_ANTICHEAT_ALERT, player->GetName().c_str(), player->GetName().c_str(), latency); sWorld->SendGMText(LANG_ANTICHEAT_ALERT, player->GetName().c_str(), player->GetName().c_str(), latency);
} }
_counter = 0; _counter = 0;
@@ -1616,11 +1550,8 @@ void AnticheatMgr::BuildReport(Player* player, ReportTypes reportType)
{ {
LOG_INFO("anticheat.module", "AnticheatMgr:: Reports reached assigned threshhold and counteracted by kicking player {} ({})", player->GetName(), player->GetGUID().ToString()); LOG_INFO("anticheat.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 = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] Auto Kicked for Reaching Cheat Threshhold!"; SendMiddleScreenGMMessage("|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] Auto Kicked for Reaching Cheat Threshhold!");
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
data << str;
sWorld->SendGlobalGMMessage(&data);
player->GetSession()->KickPlayer(true); player->GetSession()->KickPlayer(true);
if (sConfigMgr->GetOption<bool>("Anticheat.AnnounceKick", true)) if (sConfigMgr->GetOption<bool>("Anticheat.AnnounceKick", true))
@@ -1642,11 +1573,8 @@ void AnticheatMgr::BuildReport(Player* player, ReportTypes reportType)
{ {
LOG_INFO("anticheat.module", "AnticheatMgr:: Reports reached assigned threshhold and counteracted by banning player {} ({})", player->GetName(), player->GetGUID().ToString()); LOG_INFO("anticheat.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 = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] Auto Banned Account for Reaching Cheat Threshhold!"; SendMiddleScreenGMMessage("|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] Auto Banned Account for Reaching Cheat Threshhold!");
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
data << str;
sWorld->SendGlobalGMMessage(&data);
std::string accountName; std::string accountName;
AccountMgr::GetName(player->GetSession()->GetAccountId(), accountName); AccountMgr::GetName(player->GetSession()->GetAccountId(), accountName);
@@ -1671,11 +1599,8 @@ void AnticheatMgr::BuildReport(Player* player, ReportTypes reportType)
{ {
LOG_INFO("anticheat.module", "AnticheatMgr:: Reports reached assigned threshhold and counteracted by jailing player {} ({})", player->GetName(), player->GetGUID().ToString()); LOG_INFO("anticheat.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 = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] Auto Jailed Account for Reaching Cheat Threshhold!"; SendMiddleScreenGMMessage("|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + player->GetName() + "|cFF00FFFF] Auto Jailed Account for Reaching Cheat Threshhold!");
WorldPacket data(SMSG_NOTIFICATION, str.size() + 1);
data << str;
sWorld->SendGlobalGMMessage(&data);
// GM Jail Location is uncommit and used as default for the jailing. Feel free to commit it out with double forward slashes (//) and uncommit, // GM Jail Location is uncommit and used as default for the jailing. Feel free to commit it out with double forward slashes (//) and uncommit,
// removing the double forward slashes (//) if you wish to use the other locations. // removing the double forward slashes (//) if you wish to use the other locations.
@@ -1718,45 +1643,15 @@ void AnticheatMgr::AnticheatGlobalCommand(ChatHandler* handler)
{ {
// save All Anticheat Player Data before displaying global stats // save All Anticheat Player Data before displaying global stats
for (SessionMap::const_iterator itr = sWorld->GetAllSessions().begin(); itr != sWorld->GetAllSessions().end(); ++itr) for (SessionMap::const_iterator itr = sWorld->GetAllSessions().begin(); itr != sWorld->GetAllSessions().end(); ++itr)
{
if (Player* plr = itr->second->GetPlayer()) if (Player* plr = itr->second->GetPlayer())
{ {
sAnticheatMgr->SavePlayerData(plr); sAnticheatMgr->SavePlayerData(plr);
sAnticheatMgr->SavePlayerDataDaily(plr); sAnticheatMgr->SavePlayerDataDaily(plr);
} }
QueryResult resultDB = CharacterDatabase.Query("SELECT guid,average,total_reports FROM players_reports_status WHERE total_reports != 0 ORDER BY average ASC LIMIT 3;");
if (!resultDB)
{
handler->PSendSysMessage("No players found.");
return;
}
else
{
handler->SendSysMessage("=============================");
handler->PSendSysMessage("Players with the lowest averages:");
do
{
Field* fieldsDB = resultDB->Fetch();
ObjectGuid guid = ObjectGuid::Create<HighGuid::Player>(fieldsDB[0].Get<uint32>());
float average = fieldsDB[1].Get<float>();
uint32 total_reports = fieldsDB[2].Get<uint32>();
if (Player* player = ObjectAccessor::FindConnectedPlayer(guid))
handler->PSendSysMessage("Player: %s Average: %f Total Reports: %u", player->GetName().c_str(), average, total_reports);
} while (resultDB->NextRow());
} }
resultDB = CharacterDatabase.Query("SELECT guid,average,total_reports FROM players_reports_status WHERE total_reports != 0 ORDER BY total_reports DESC LIMIT 3;"); if (QueryResult resultDB = CharacterDatabase.Query("SELECT `guid`, `average`, `total_reports` FROM `players_reports_status` WHERE `total_reports` != 0 ORDER BY `total_reports` DESC LIMIT 3;"))
// this should never happen
if (!resultDB)
{
handler->PSendSysMessage("No players found.");
return;
}
else
{ {
handler->PSendSysMessage("============================="); handler->PSendSysMessage("=============================");
handler->PSendSysMessage("Players with the most reports:"); handler->PSendSysMessage("Players with the most reports:");
@@ -1773,6 +1668,12 @@ void AnticheatMgr::AnticheatGlobalCommand(ChatHandler* handler)
} while (resultDB->NextRow()); } while (resultDB->NextRow());
} }
else
{
// this should never happen
handler->PSendSysMessage("No players found.");
return;
}
} }
void AnticheatMgr::AnticheatDeleteCommand(ObjectGuid guid) void AnticheatMgr::AnticheatDeleteCommand(ObjectGuid guid)

View File

@@ -131,6 +131,7 @@ class AnticheatMgr
void BGStartExploit(Player* player, MovementInfo movementInfo); void BGStartExploit(Player* player, MovementInfo movementInfo);
void BuildReport(Player* player, ReportTypes reportType); void BuildReport(Player* player, ReportTypes reportType);
bool MustCheckTempReports(ReportTypes type); bool MustCheckTempReports(ReportTypes type);
void SendMiddleScreenGMMessage(std::string str);
[[nodiscard]] uint32 GetTeleportSkillCooldownDurationInMS(Player* player) const; [[nodiscard]] uint32 GetTeleportSkillCooldownDurationInMS(Player* player) const;
[[nodiscard]] float GetTeleportSkillDistanceInYards(Player* player) const; [[nodiscard]] float GetTeleportSkillDistanceInYards(Player* player) const;
[[nodiscard]] float GetPlayerCurrentSpeedRate(Player* player) const; [[nodiscard]] float GetPlayerCurrentSpeedRate(Player* player) const;