add (db\gm cmd): CM DB Logging\GM CM Display

added counter measure report type in database
added new row when using .anticheat player to show deployed counter measures on player as some countermeasures will not count the actual cheat count in the db
This commit is contained in:
M'Dic
2023-04-05 16:53:21 -04:00
parent 1adf8f352e
commit 9e81a435d4
5 changed files with 62 additions and 16 deletions

View File

@@ -0,0 +1,38 @@
-- run on Characters DB
DROP PROCEDURE IF EXISTS `updatemodanticheatdb`;
DELIMITER //
CREATE PROCEDURE updatemodanticheatdb()
proc:BEGIN
SELECT COUNT(*) INTO @COLEXISTS
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'daily_players_reports' AND COLUMN_NAME = 'counter_measures_reports';
IF @COLEXISTS = 1 THEN LEAVE proc; END IF;
START TRANSACTION;
ALTER TABLE `daily_players_reports`
ADD COLUMN `counter_measures_reports` BIGINT UNSIGNED NOT NULL DEFAULT 0 AFTER `op_ack_hack_reports`;
END //
DELIMITER ;
CALL updatemodanticheatdb();
DROP PROCEDURE IF EXISTS `updatemodanticheatdb`;
DELIMITER //
CREATE PROCEDURE updatemodanticheatdb()
proc:BEGIN
SELECT COUNT(*) INTO @COLEXISTS
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'players_reports_status' AND COLUMN_NAME = 'counter_measures_reports';
IF @COLEXISTS = 1 THEN LEAVE proc; END IF;
START TRANSACTION;
ALTER TABLE `players_reports_status`
ADD COLUMN `counter_measures_reports` BIGINT UNSIGNED NOT NULL DEFAULT 0 AFTER `op_ack_hack_reports`;
END //
DELIMITER ;
CALL updatemodanticheatdb();
DROP PROCEDURE IF EXISTS `updatemodanticheatdb`;

View File

@@ -27,7 +27,7 @@
#include "AnticheatMgr.h"
#define MAX_REPORT_TYPES 14
#define MAX_REPORT_TYPES 15
class AnticheatData
{

View File

@@ -238,7 +238,7 @@ void AnticheatMgr::SpeedHackDetection(Player* player, MovementInfo movementInfo)
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str.c_str(), player->GetName().c_str(), player->GetName().c_str());
}
timeDiff = 1;
BuildReport(player, SPEED_HACK_REPORT);
BuildReport(player, COUNTER_MEASURES_REPORT);
}
if (!timeDiff && sConfigMgr->GetOption<bool>("Anticheat.CM.TIMEMANIPULATION", true))
@@ -260,7 +260,7 @@ void AnticheatMgr::SpeedHackDetection(Player* player, MovementInfo movementInfo)
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str.c_str(), player->GetName().c_str(), player->GetName().c_str());
}
timeDiff = 1;
BuildReport(player, SPEED_HACK_REPORT);
BuildReport(player, COUNTER_MEASURES_REPORT);
}
// this is the distance doable by the player in 1 sec, using the time done to move to this point.
@@ -299,7 +299,6 @@ void AnticheatMgr::SpeedHackDetection(Player* player, MovementInfo movementInfo)
{
slowcheater->SetDuration(1000);
}
BuildReport(player, SPEED_HACK_REPORT);
if (sConfigMgr->GetOption<bool>("Anticheat.CM.WriteLog", true))
{
LOG_INFO("anticheat.module", "ANTICHEAT COUNTER MEASURE:: {} Speed Hack Countered and has been set to Server Rate.", player->GetName());
@@ -316,6 +315,7 @@ void AnticheatMgr::SpeedHackDetection(Player* player, MovementInfo movementInfo)
std::string str = "|cFFFFFC00 SPEED HACK COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str.c_str(), player->GetName().c_str(), player->GetName().c_str());
}
BuildReport(player, COUNTER_MEASURES_REPORT);
}
BuildReport(player, SPEED_HACK_REPORT);
}
@@ -387,7 +387,7 @@ void AnticheatMgr::FlyHackDetection(Player* player, MovementInfo movementInfo)
std::string str = "|cFFFFFC00 FLY HACK COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str.c_str(), player->GetName().c_str(), player->GetName().c_str());
}
BuildReport(player, FLY_HACK_REPORT);
BuildReport(player, COUNTER_MEASURES_REPORT);
}
BuildReport(player, FLY_HACK_REPORT);
@@ -446,7 +446,7 @@ void AnticheatMgr::JumpHackDetection(Player* player, MovementInfo movementInfo,
std::string str = "|cFFFFFC00 JUMP HACK COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str.c_str(), player->GetName().c_str(), player->GetName().c_str());
}
BuildReport(player, JUMP_HACK_REPORT);
BuildReport(player, COUNTER_MEASURES_REPORT);
}
BuildReport(player, JUMP_HACK_REPORT);
}
@@ -513,7 +513,7 @@ void AnticheatMgr::JumpHackDetection(Player* player, MovementInfo movementInfo,
std::string str = "|cFFFFFC00 JUMP HACK COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str.c_str(), player->GetName().c_str(), player->GetName().c_str());
}
BuildReport(player, JUMP_HACK_REPORT);
BuildReport(player, COUNTER_MEASURES_REPORT);
}
BuildReport(player, JUMP_HACK_REPORT);
}
@@ -739,6 +739,7 @@ void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementIn
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str.c_str(), player->GetName().c_str(), player->GetName().c_str());
}
player->TeleportTo(player->GetMapId(), lastX, lastY, lastZ, player->GetOrientation());
BuildReport(player, COUNTER_MEASURES_REPORT);
}
BuildReport(player, TELEPORT_HACK_REPORT);
}
@@ -995,7 +996,7 @@ void AnticheatMgr::ZAxisHackDetection(Player* player, MovementInfo movementInfo)
std::string str = "|cFFFFFC00 IGNORE-Z HACK COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str.c_str(), player->GetName().c_str(), player->GetName().c_str());
}
BuildReport(player, ZAXIS_HACK_REPORT);
BuildReport(player, COUNTER_MEASURES_REPORT);
}
BuildReport(player, ZAXIS_HACK_REPORT);
}
@@ -1187,6 +1188,7 @@ void AnticheatMgr::CheckStartPositions(Player* player)
std::string str = "|cFFFFFC00 BG START SPOT COUNTER MEASURE ALERT";
sWorld->SendGMText(LANG_ANTICHEAT_COUNTERMEASURE, str.c_str(), player->GetName().c_str(), player->GetName().c_str());
}
BuildReport(player, COUNTER_MEASURES_REPORT);
player->TeleportTo(player->GetMapId(), startPos->GetPositionX(), startPos->GetPositionY(), startPos->GetPositionZ(), startPos->GetOrientation());
}
}
@@ -1419,15 +1421,15 @@ void AnticheatMgr::CheckForOrderAck(uint32 opcode)
void AnticheatMgr::SavePlayerData(Player* player)
{
AnticheatData playerData = m_Players[player->GetGUID()];
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
CharacterDatabase.Execute("REPLACE INTO players_reports_status (guid,average,total_reports,speed_reports,fly_reports,jump_reports,waterwalk_reports,teleportplane_reports,climb_reports,teleport_reports,ignorecontrol_reports,zaxis_reports,antiswim_reports,gravity_reports,antiknockback_reports,no_fall_damage_reports,op_ack_hack_reports,creation_time) VALUES ({},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{});", player->GetGUID().GetCounter(), playerData.GetAverage(), playerData.GetTotalReports(), playerData.GetTypeReports(SPEED_HACK_REPORT), playerData.GetTypeReports(FLY_HACK_REPORT), playerData.GetTypeReports(JUMP_HACK_REPORT), playerData.GetTypeReports(WALK_WATER_HACK_REPORT), playerData.GetTypeReports(TELEPORT_PLANE_HACK_REPORT), playerData.GetTypeReports(CLIMB_HACK_REPORT), playerData.GetTypeReports(TELEPORT_HACK_REPORT), playerData.GetTypeReports(IGNORE_CONTROL_REPORT), playerData.GetTypeReports(ZAXIS_HACK_REPORT), playerData.GetTypeReports(ANTISWIM_HACK_REPORT), playerData.GetTypeReports(GRAVITY_HACK_REPORT), playerData.GetTypeReports(ANTIKNOCK_BACK_HACK_REPORT), playerData.GetTypeReports(NO_FALL_DAMAGE_HACK_REPORT), playerData.GetTypeReports(OP_ACK_HACK_REPORT), playerData.GetCreationTime());
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
CharacterDatabase.Execute("REPLACE INTO players_reports_status (guid,average,total_reports,speed_reports,fly_reports,jump_reports,waterwalk_reports,teleportplane_reports,climb_reports,teleport_reports,ignorecontrol_reports,zaxis_reports,antiswim_reports,gravity_reports,antiknockback_reports,no_fall_damage_reports,op_ack_hack_reports,counter_measures_reports, creation_time) VALUES ({},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{});", player->GetGUID().GetCounter(), playerData.GetAverage(), playerData.GetTotalReports(), playerData.GetTypeReports(SPEED_HACK_REPORT), playerData.GetTypeReports(FLY_HACK_REPORT), playerData.GetTypeReports(JUMP_HACK_REPORT), playerData.GetTypeReports(WALK_WATER_HACK_REPORT), playerData.GetTypeReports(TELEPORT_PLANE_HACK_REPORT), playerData.GetTypeReports(CLIMB_HACK_REPORT), playerData.GetTypeReports(TELEPORT_HACK_REPORT), playerData.GetTypeReports(IGNORE_CONTROL_REPORT), playerData.GetTypeReports(ZAXIS_HACK_REPORT), playerData.GetTypeReports(ANTISWIM_HACK_REPORT), playerData.GetTypeReports(GRAVITY_HACK_REPORT), playerData.GetTypeReports(ANTIKNOCK_BACK_HACK_REPORT), playerData.GetTypeReports(NO_FALL_DAMAGE_HACK_REPORT), playerData.GetTypeReports(OP_ACK_HACK_REPORT), playerData.GetTypeReports(COUNTER_MEASURES_REPORT), playerData.GetCreationTime());
}
void AnticheatMgr::SavePlayerDataDaily(Player* player)
{
AnticheatData playerData = m_Players[player->GetGUID()];
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
CharacterDatabase.Execute("REPLACE INTO daily_players_reports (guid,average,total_reports,speed_reports,fly_reports,jump_reports,waterwalk_reports,teleportplane_reports,climb_reports,teleport_reports,ignorecontrol_reports,zaxis_reports,antiswim_reports,gravity_reports,antiknockback_reports,no_fall_damage_reports,op_ack_hack_reports,creation_time) VALUES ({},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{});", player->GetGUID().GetCounter(), playerData.GetAverage(), playerData.GetTotalReports(), playerData.GetTypeReports(SPEED_HACK_REPORT), playerData.GetTypeReports(FLY_HACK_REPORT), playerData.GetTypeReports(JUMP_HACK_REPORT), playerData.GetTypeReports(WALK_WATER_HACK_REPORT), playerData.GetTypeReports(TELEPORT_PLANE_HACK_REPORT), playerData.GetTypeReports(CLIMB_HACK_REPORT), playerData.GetTypeReports(TELEPORT_HACK_REPORT), playerData.GetTypeReports(IGNORE_CONTROL_REPORT), playerData.GetTypeReports(ZAXIS_HACK_REPORT), playerData.GetTypeReports(ANTISWIM_HACK_REPORT), playerData.GetTypeReports(GRAVITY_HACK_REPORT), playerData.GetTypeReports(ANTIKNOCK_BACK_HACK_REPORT), playerData.GetTypeReports(NO_FALL_DAMAGE_HACK_REPORT), playerData.GetTypeReports(OP_ACK_HACK_REPORT), playerData.GetCreationTime());
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
CharacterDatabase.Execute("REPLACE INTO players_reports_status (guid,average,total_reports,speed_reports,fly_reports,jump_reports,waterwalk_reports,teleportplane_reports,climb_reports,teleport_reports,ignorecontrol_reports,zaxis_reports,antiswim_reports,gravity_reports,antiknockback_reports,no_fall_damage_reports,op_ack_hack_reports,counter_measures_reports, creation_time) VALUES ({},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{});", player->GetGUID().GetCounter(), playerData.GetAverage(), playerData.GetTotalReports(), playerData.GetTypeReports(SPEED_HACK_REPORT), playerData.GetTypeReports(FLY_HACK_REPORT), playerData.GetTypeReports(JUMP_HACK_REPORT), playerData.GetTypeReports(WALK_WATER_HACK_REPORT), playerData.GetTypeReports(TELEPORT_PLANE_HACK_REPORT), playerData.GetTypeReports(CLIMB_HACK_REPORT), playerData.GetTypeReports(TELEPORT_HACK_REPORT), playerData.GetTypeReports(IGNORE_CONTROL_REPORT), playerData.GetTypeReports(ZAXIS_HACK_REPORT), playerData.GetTypeReports(ANTISWIM_HACK_REPORT), playerData.GetTypeReports(GRAVITY_HACK_REPORT), playerData.GetTypeReports(ANTIKNOCK_BACK_HACK_REPORT), playerData.GetTypeReports(NO_FALL_DAMAGE_HACK_REPORT), playerData.GetTypeReports(OP_ACK_HACK_REPORT), playerData.GetTypeReports(COUNTER_MEASURES_REPORT), playerData.GetCreationTime());
}
uint32 AnticheatMgr::GetTotalReports(ObjectGuid guid)
{
@@ -1467,6 +1469,9 @@ bool AnticheatMgr::MustCheckTempReports(uint8 type)
if (type == OP_ACK_HACK_REPORT)
return false;
if (type == COUNTER_MEASURES_REPORT)
return false;
return true;
}
@@ -1532,8 +1537,8 @@ void AnticheatMgr::BuildReport(Player* player, uint16 reportType)
if (!m_Players[key].GetDailyReportState())
{
AnticheatData playerData = m_Players[player->GetGUID()];
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
CharacterDatabase.Execute("REPLACE INTO daily_players_reports (guid,average,total_reports,speed_reports,fly_reports,jump_reports,waterwalk_reports,teleportplane_reports,climb_reports,teleport_reports,ignorecontrol_reports,zaxis_reports,antiswim_reports,gravity_reports,antiknockback_reports,no_fall_damage_reports,op_ack_hack_reports,creation_time) VALUES ({},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{});", player->GetGUID().GetCounter(), playerData.GetAverage(), playerData.GetTotalReports(), playerData.GetTypeReports(SPEED_HACK_REPORT), playerData.GetTypeReports(FLY_HACK_REPORT), playerData.GetTypeReports(JUMP_HACK_REPORT), playerData.GetTypeReports(WALK_WATER_HACK_REPORT), playerData.GetTypeReports(TELEPORT_PLANE_HACK_REPORT), playerData.GetTypeReports(CLIMB_HACK_REPORT), playerData.GetTypeReports(TELEPORT_HACK_REPORT), playerData.GetTypeReports(IGNORE_CONTROL_REPORT), playerData.GetTypeReports(ZAXIS_HACK_REPORT), playerData.GetTypeReports(ANTISWIM_HACK_REPORT), playerData.GetTypeReports(GRAVITY_HACK_REPORT), playerData.GetTypeReports(ANTIKNOCK_BACK_HACK_REPORT), playerData.GetTypeReports(NO_FALL_DAMAGE_HACK_REPORT), playerData.GetTypeReports(OP_ACK_HACK_REPORT), playerData.GetCreationTime());
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
CharacterDatabase.Execute("REPLACE INTO players_reports_status (guid,average,total_reports,speed_reports,fly_reports,jump_reports,waterwalk_reports,teleportplane_reports,climb_reports,teleport_reports,ignorecontrol_reports,zaxis_reports,antiswim_reports,gravity_reports,antiknockback_reports,no_fall_damage_reports,op_ack_hack_reports,counter_measures_reports, creation_time) VALUES ({},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{});", player->GetGUID().GetCounter(), playerData.GetAverage(), playerData.GetTotalReports(), playerData.GetTypeReports(SPEED_HACK_REPORT), playerData.GetTypeReports(FLY_HACK_REPORT), playerData.GetTypeReports(JUMP_HACK_REPORT), playerData.GetTypeReports(WALK_WATER_HACK_REPORT), playerData.GetTypeReports(TELEPORT_PLANE_HACK_REPORT), playerData.GetTypeReports(CLIMB_HACK_REPORT), playerData.GetTypeReports(TELEPORT_HACK_REPORT), playerData.GetTypeReports(IGNORE_CONTROL_REPORT), playerData.GetTypeReports(ZAXIS_HACK_REPORT), playerData.GetTypeReports(ANTISWIM_HACK_REPORT), playerData.GetTypeReports(GRAVITY_HACK_REPORT), playerData.GetTypeReports(ANTIKNOCK_BACK_HACK_REPORT), playerData.GetTypeReports(NO_FALL_DAMAGE_HACK_REPORT), playerData.GetTypeReports(OP_ACK_HACK_REPORT), playerData.GetTypeReports(COUNTER_MEASURES_REPORT), playerData.GetCreationTime());
m_Players[key].SetDailyReportState(true);
}
}

View File

@@ -51,8 +51,8 @@ enum ReportTypes
GRAVITY_HACK_REPORT = 10,
ANTIKNOCK_BACK_HACK_REPORT = 11,
NO_FALL_DAMAGE_HACK_REPORT = 12,
OP_ACK_HACK_REPORT = 13
OP_ACK_HACK_REPORT = 13,
COUNTER_MEASURES_REPORT = 14
// MAX_REPORT_TYPES
};

View File

@@ -227,6 +227,7 @@ public:
uint32 antiknockback_reports = sAnticheatMgr->GetTypeReports(guid, 11);
uint32 no_fall_damage_reports = sAnticheatMgr->GetTypeReports(guid, 12);
uint32 op_ack_reports = sAnticheatMgr->GetTypeReports(guid, 13);
uint32 counter_measures_reports = sAnticheatMgr->GetTypeReports(guid, 14);
Player* playerTarget = player->GetConnectedPlayer();
uint32 latency = 0;
@@ -288,6 +289,7 @@ public:
{
handler->PSendSysMessage("|cffff0000Macro Requiring Lua Unlock Detected: |cffffff00No");
}
handler->PSendSysMessage("|cffff0000Counter Measures Deployed: |cffffff00%u", counter_measures_reports);
handler->PSendSysMessage("|cffff0000Average: |cffffff00%f |cffff0000Total Reports: |cffffff00%u ", average, total_reports);
handler->PSendSysMessage("|cffff0000Speed Reports: |cffffff00%u |cffff0000Fly Reports: |cffffff00%u |cffff0000Jump Reports: |cffffff00%u ", speed_reports, fly_reports, jump_reports);
handler->PSendSysMessage("|cffff0000Walk On Water Reports:|cffffff00 %u |cffff0000Teleport To Plane Reports: |cffffff00%u", waterwalk_reports, teleportplane_reports);
@@ -354,6 +356,7 @@ public:
{
handler->PSendSysMessage("Macro Requiring Lua Unlock Detected: No");
}
handler->PSendSysMessage("Counter Measures Deployed: %u", counter_measures_reports);
handler->PSendSysMessage("Average: %f || Total Reports: %u ", average, total_reports);
handler->PSendSysMessage("Speed Reports: %u || Fly Reports: %u || Jump Reports: %u ", speed_reports, fly_reports, jump_reports);
handler->PSendSysMessage("Walk On Water Reports: %u || Teleport To Plane Reports: %u", waterwalk_reports, teleportplane_reports);