mirror of
https://github.com/azerothcore/mod-anticheat.git
synced 2026-01-13 00:58:35 +00:00
refactor(Script/report): Mute reports if there's no reports (#109)
* Some code clean up changes * backticks on the queries + moving some stuff around so they don't get called when not needed
This commit is contained in:
@@ -98,13 +98,6 @@ void AnticheatMgr::StartHackDetection(Player* player, MovementInfo movementInfo,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dear future me. Please forgive me.
|
|
||||||
// I can't even begin to express how sorry I am for this order
|
|
||||||
// If you bought this you have been scammed.
|
|
||||||
// Visit AC: https://discord.com/invite/kZnFt47U for help on the Open Source Anticheat
|
|
||||||
// The project compromised of various developers of the open source scene and we hang out there.
|
|
||||||
// We would never charge for modules or "lessons"
|
|
||||||
|
|
||||||
TeleportHackDetection(player, movementInfo);
|
TeleportHackDetection(player, movementInfo);
|
||||||
SpeedHackDetection(player, movementInfo);
|
SpeedHackDetection(player, movementInfo);
|
||||||
FlyHackDetection(player, movementInfo);
|
FlyHackDetection(player, movementInfo);
|
||||||
@@ -524,7 +517,6 @@ void AnticheatMgr::JumpHackDetection(Player* player, MovementInfo movementInfo,
|
|||||||
}
|
}
|
||||||
BuildReport(player, JUMP_HACK_REPORT);
|
BuildReport(player, JUMP_HACK_REPORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -595,7 +587,6 @@ void AnticheatMgr::TeleportPlaneHackDetection(Player* player, MovementInfo movem
|
|||||||
|
|
||||||
BuildReport(player, TELEPORT_PLANE_HACK_REPORT);
|
BuildReport(player, TELEPORT_PLANE_HACK_REPORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnticheatMgr::ClimbHackDetection(Player* player, MovementInfo movementInfo, uint32 opcode)
|
void AnticheatMgr::ClimbHackDetection(Player* player, MovementInfo movementInfo, uint32 opcode)
|
||||||
@@ -735,7 +726,6 @@ void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementIn
|
|||||||
}
|
}
|
||||||
else if (player->CanTeleport())
|
else if (player->CanTeleport())
|
||||||
player->SetCanTeleport(false);
|
player->SetCanTeleport(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((xDiff >= 50.0f || yDiff >= 50.0f) && !player->CanTeleport() && !player->IsBeingTeleported())
|
if ((xDiff >= 50.0f || yDiff >= 50.0f) && !player->CanTeleport() && !player->IsBeingTeleported())
|
||||||
@@ -796,7 +786,6 @@ void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementIn
|
|||||||
}
|
}
|
||||||
else if (player->CanTeleport())
|
else if (player->CanTeleport())
|
||||||
player->SetCanTeleport(false);
|
player->SetCanTeleport(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnticheatMgr::IgnoreControlHackDetection(Player* player, MovementInfo movementInfo, uint32 opcode)
|
void AnticheatMgr::IgnoreControlHackDetection(Player* player, MovementInfo movementInfo, uint32 opcode)
|
||||||
@@ -934,7 +923,6 @@ void AnticheatMgr::WalkOnWaterHackDetection(Player* player, MovementInfo movemen
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (!m_Players[key].GetLastMovementInfo().HasMovementFlag(MOVEMENTFLAG_WATERWALKING) && !movementInfo.HasMovementFlag(MOVEMENTFLAG_WATERWALKING))
|
else if (!m_Players[key].GetLastMovementInfo().HasMovementFlag(MOVEMENTFLAG_WATERWALKING) && !movementInfo.HasMovementFlag(MOVEMENTFLAG_WATERWALKING))
|
||||||
{
|
{
|
||||||
@@ -1064,7 +1052,6 @@ void AnticheatMgr::ZAxisHackDetection(Player* player, MovementInfo movementInfo)
|
|||||||
}
|
}
|
||||||
BuildReport(player, ZAXIS_HACK_REPORT);
|
BuildReport(player, ZAXIS_HACK_REPORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// basic detection
|
// basic detection
|
||||||
@@ -1104,7 +1091,6 @@ void AnticheatMgr::AntiSwimHackDetection(Player* player, MovementInfo movementIn
|
|||||||
}
|
}
|
||||||
|
|
||||||
BuildReport(player, ANTISWIM_HACK_REPORT);
|
BuildReport(player, ANTISWIM_HACK_REPORT);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1114,13 +1100,13 @@ void AnticheatMgr::AntiKnockBackHackDetection(Player* player, MovementInfo movem
|
|||||||
if (!sConfigMgr->GetOption<bool>("Anticheat.AntiKnockBack", true))
|
if (!sConfigMgr->GetOption<bool>("Anticheat.AntiKnockBack", true))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ObjectGuid key = player->GetGUID();
|
|
||||||
|
|
||||||
//if a knockback helper is not passed then we ignore
|
//if a knockback helper is not passed then we ignore
|
||||||
//if player has root state we ignore, knock back does not break root
|
//if player has root state we ignore, knock back does not break root
|
||||||
if (!player->CanKnockback() || player->HasUnitState(UNIT_STATE_ROOT))
|
if (!player->CanKnockback() || player->HasUnitState(UNIT_STATE_ROOT))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
ObjectGuid key = player->GetGUID();
|
||||||
|
|
||||||
if (movementInfo.pos == m_Players[key].GetLastMovementInfo().pos)
|
if (movementInfo.pos == m_Players[key].GetLastMovementInfo().pos)
|
||||||
{
|
{
|
||||||
if (sConfigMgr->GetOption<bool>("Anticheat.WriteLog", true))
|
if (sConfigMgr->GetOption<bool>("Anticheat.WriteLog", true))
|
||||||
@@ -1226,14 +1212,11 @@ Position const* AnticheatMgr::GetTeamStartPosition(TeamId teamId) const
|
|||||||
|
|
||||||
void AnticheatMgr::CheckStartPositions(Player* player)
|
void AnticheatMgr::CheckStartPositions(Player* player)
|
||||||
{
|
{
|
||||||
if (!sConfigMgr->GetOption<bool>("Anticheat.BG.StartAreaTeleport", true))
|
|
||||||
return;
|
|
||||||
|
|
||||||
Position pos = player->GetPosition();
|
|
||||||
Position const* startPos = GetTeamStartPosition(player->GetBgTeamId());
|
|
||||||
|
|
||||||
if (sConfigMgr->GetOption<bool>("Anticheat.BG.StartAreaTeleport", true))
|
if (sConfigMgr->GetOption<bool>("Anticheat.BG.StartAreaTeleport", true))
|
||||||
{
|
{
|
||||||
|
Position pos = player->GetPosition();
|
||||||
|
Position const* startPos = GetTeamStartPosition(player->GetBgTeamId());
|
||||||
|
|
||||||
if (pos.GetExactDistSq(!startPos))
|
if (pos.GetExactDistSq(!startPos))
|
||||||
{
|
{
|
||||||
if (sConfigMgr->GetOption<bool>("Anticheat.CM.WriteLog", true))
|
if (sConfigMgr->GetOption<bool>("Anticheat.CM.WriteLog", true))
|
||||||
@@ -1408,9 +1391,8 @@ void AnticheatMgr::HandlePlayerLogin(Player* player)
|
|||||||
CharacterDatabase.Execute("DELETE FROM players_reports_status WHERE guid={}", player->GetGUID().GetCounter());
|
CharacterDatabase.Execute("DELETE FROM players_reports_status WHERE guid={}", player->GetGUID().GetCounter());
|
||||||
// we initialize the pos of lastMovementPosition var.
|
// we initialize the pos of lastMovementPosition var.
|
||||||
m_Players[player->GetGUID()].SetPosition(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation());
|
m_Players[player->GetGUID()].SetPosition(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation());
|
||||||
QueryResult resultDB = CharacterDatabase.Query("SELECT * FROM daily_players_reports WHERE guid={};", player->GetGUID().GetCounter());
|
|
||||||
|
|
||||||
if (resultDB)
|
if (CharacterDatabase.Query("SELECT 0 FROM daily_players_reports WHERE guid={};", player->GetGUID().GetCounter()))
|
||||||
m_Players[player->GetGUID()].SetDailyReportState(true);
|
m_Players[player->GetGUID()].SetDailyReportState(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1540,17 +1522,6 @@ bool AnticheatMgr::MustCheckTempReports(uint8 type)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Dear maintainer:
|
|
||||||
//
|
|
||||||
// Once you are done trying to 'optimize' this script,
|
|
||||||
// and have identify potentionally if there was a terrible
|
|
||||||
// mistake that was here or not, please increment the
|
|
||||||
// following counter as a warning to the next guy:
|
|
||||||
//
|
|
||||||
// total_hours_wasted_here = 42
|
|
||||||
//
|
|
||||||
|
|
||||||
void AnticheatMgr::BuildReport(Player* player, uint16 reportType)
|
void AnticheatMgr::BuildReport(Player* player, uint16 reportType)
|
||||||
{
|
{
|
||||||
OnReport(player, reportType);
|
OnReport(player, reportType);
|
||||||
|
|||||||
@@ -120,15 +120,15 @@ public:
|
|||||||
pTarget->TeleportTo(loc);
|
pTarget->TeleportTo(loc);
|
||||||
pTarget->SetHomebind(loc, 876);// GM Jail Homebind location
|
pTarget->SetHomebind(loc, 876);// GM Jail Homebind location
|
||||||
pTarget->CastSpell(pTarget, SHACKLES);// shackle him in place to ensure no exploit happens for jail break attempt
|
pTarget->CastSpell(pTarget, SHACKLES);// shackle him in place to ensure no exploit happens for jail break attempt
|
||||||
if (Aura* dungdesert = pTarget->AddAura(LFG_SPELL_DUNGEON_DESERTER, pTarget))// LFG_SPELL_DUNGEON_DESERTER
|
if (Aura* dungdesert = pTarget->AddAura(LFG_SPELL_DUNGEON_DESERTER, pTarget))
|
||||||
{
|
{
|
||||||
dungdesert->SetDuration(-1);
|
dungdesert->SetDuration(-1);
|
||||||
}
|
}
|
||||||
if (Aura* bgdesert = pTarget->AddAura(BG_SPELL_DESERTER, pTarget))// BG_SPELL_DESERTER
|
if (Aura* bgdesert = pTarget->AddAura(BG_SPELL_DESERTER, pTarget))
|
||||||
{
|
{
|
||||||
bgdesert->SetDuration(-1);
|
bgdesert->SetDuration(-1);
|
||||||
}
|
}
|
||||||
if (Aura* silent = pTarget->AddAura(SILENCED, pTarget))// SILENCED
|
if (Aura* silent = pTarget->AddAura(SILENCED, pTarget))
|
||||||
{
|
{
|
||||||
silent->SetDuration(-1);
|
silent->SetDuration(-1);
|
||||||
}
|
}
|
||||||
@@ -152,23 +152,22 @@ public:
|
|||||||
|
|
||||||
Player* pTarget = player->GetConnectedPlayer();
|
Player* pTarget = player->GetConnectedPlayer();
|
||||||
|
|
||||||
WorldLocation Aloc = WorldLocation(0, -8833.37f, 628.62f, 94.00f, 1.06f);// Stormwind
|
|
||||||
WorldLocation Hloc = WorldLocation(1, 1569.59f, -4397.63f, 7.7f, 0.54f);// Orgrimmar
|
|
||||||
|
|
||||||
if (pTarget->GetTeamId() == TEAM_ALLIANCE)
|
if (pTarget->GetTeamId() == TEAM_ALLIANCE)
|
||||||
{
|
{
|
||||||
|
WorldLocation Aloc = WorldLocation(0, -8833.37f, 628.62f, 94.00f, 1.06f);// Stormwind
|
||||||
pTarget->TeleportTo(0, -8833.37f, 628.62f, 94.00f, 1.06f);//Stormwind
|
pTarget->TeleportTo(0, -8833.37f, 628.62f, 94.00f, 1.06f);//Stormwind
|
||||||
pTarget->SetHomebind(Aloc, 1519);// Stormwind Homebind location
|
pTarget->SetHomebind(Aloc, 1519);// Stormwind Homebind location
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
WorldLocation Hloc = WorldLocation(1, 1569.59f, -4397.63f, 7.7f, 0.54f);// Orgrimmar
|
||||||
pTarget->TeleportTo(1, 1569.59f, -4397.63f, 7.7f, 0.54f);//Orgrimmar
|
pTarget->TeleportTo(1, 1569.59f, -4397.63f, 7.7f, 0.54f);//Orgrimmar
|
||||||
pTarget->SetHomebind(Hloc, 1653);// Orgrimmar Homebind location
|
pTarget->SetHomebind(Hloc, 1653);// Orgrimmar Homebind location
|
||||||
}
|
}
|
||||||
pTarget->RemoveAura(SHACKLES);// remove shackles
|
pTarget->RemoveAura(SHACKLES);
|
||||||
pTarget->RemoveAura(LFG_SPELL_DUNGEON_DESERTER);// LFG_SPELL_DUNGEON_DESERTER
|
pTarget->RemoveAura(LFG_SPELL_DUNGEON_DESERTER);
|
||||||
pTarget->RemoveAura(BG_SPELL_DESERTER);// BG_SPELL_DESERTER
|
pTarget->RemoveAura(BG_SPELL_DESERTER);
|
||||||
pTarget->RemoveAura(SILENCED);// SILENCED
|
pTarget->RemoveAura(SILENCED);
|
||||||
sAnticheatMgr->AnticheatDeleteCommand(pTarget->GetGUID());// deletes auto reports on player
|
sAnticheatMgr->AnticheatDeleteCommand(pTarget->GetGUID());// deletes auto reports on player
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -187,7 +186,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sAnticheatMgr->AnticheatDeleteCommand(player->GetGUID());
|
sAnticheatMgr->AnticheatDeleteCommand(player->GetGUID());
|
||||||
handler->PSendSysMessage("Anticheat players_reports_status deleted for player %s", player->GetName().c_str());
|
handler->PSendSysMessage("Anticheat players_reports_status deleted for player %s", player->GetName());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,171 +206,146 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectGuid guid = player->GetGUID();
|
if (Player* playerTarget = player->GetConnectedPlayer())
|
||||||
Player* playerTarget = player->GetConnectedPlayer();
|
|
||||||
if (playerTarget)
|
|
||||||
{
|
{
|
||||||
float average = sAnticheatMgr->GetAverage(guid);
|
ObjectGuid guid = player->GetGUID();
|
||||||
uint32 total_reports = sAnticheatMgr->GetTotalReports(guid);
|
uint32 latency = playerTarget->GetSession()->GetLatency();
|
||||||
uint32 speed_reports = sAnticheatMgr->GetTypeReports(guid, 0);
|
|
||||||
uint32 fly_reports = sAnticheatMgr->GetTypeReports(guid, 1);
|
|
||||||
uint32 jump_reports = sAnticheatMgr->GetTypeReports(guid, 3);
|
|
||||||
uint32 waterwalk_reports = sAnticheatMgr->GetTypeReports(guid, 2);
|
|
||||||
uint32 teleportplane_reports = sAnticheatMgr->GetTypeReports(guid, 4);
|
|
||||||
uint32 climb_reports = sAnticheatMgr->GetTypeReports(guid, 5);
|
|
||||||
uint32 teleport_reports = sAnticheatMgr->GetTypeReports(guid, 6);
|
|
||||||
uint32 ignorecontrol_reports = sAnticheatMgr->GetTypeReports(guid, 7);
|
|
||||||
uint32 zaxis_reports = sAnticheatMgr->GetTypeReports(guid, 8);
|
|
||||||
uint32 antiswim_reports = sAnticheatMgr->GetTypeReports(guid, 9);
|
|
||||||
uint32 gravity_reports = sAnticheatMgr->GetTypeReports(guid, 10);
|
|
||||||
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();
|
const char* lineTemplate_u;
|
||||||
uint32 latency = 0;
|
const char* lineTemplate_s;
|
||||||
latency = playerTarget->GetSession()->GetLatency();
|
const char* lineSeparator;
|
||||||
if (!handler->IsConsole())
|
const char* playerInformationTemplate;
|
||||||
{
|
const char* ipAndLatencyTemplate;
|
||||||
// 0 1 2 3 4 5
|
const char* banAndReasonTemplate;
|
||||||
QueryResult resultADB = LoginDatabase.Query("SELECT FROM_UNIXTIME(bandate, '%Y-%m-%d..%H:%i:%s') as bandate, unbandate-bandate, active, unbandate, banreason, bannedby FROM account_banned WHERE id = '{}' ORDER BY bandate ASC", playerTarget->GetSession()->GetAccountId());
|
const char* averageTotalTemplate;
|
||||||
// 0 1 2 3 4 5
|
|
||||||
QueryResult resultCDB = CharacterDatabase.Query("SELECT FROM_UNIXTIME(bandate, '%Y-%m-%d..%H:%i:%s') as bandate, unbandate - bandate, active, unbandate, banreason, bannedby FROM character_banned WHERE guid='{}' ORDER BY bandate ASC;", playerTarget->GetGUID().GetCounter());
|
|
||||||
// 0 1 2 3
|
|
||||||
QueryResult resultLDB = CharacterDatabase.Query("SELECT accountId, type, time, data FROM account_data WHERE `data` LIKE '%CastSpellByName%' AND accountId ='{}';", playerTarget->GetSession()->GetAccountId());
|
|
||||||
|
|
||||||
handler->PSendSysMessage("|cFFFFA500-----------------------------------------------------------------");
|
|
||||||
handler->PSendSysMessage("|cFF20B2AAInformation about player: |cffffff00%s", player->GetName().c_str());
|
|
||||||
handler->PSendSysMessage("|cffff0000IP Address: |cffffff00%s |cffff0000Latency |cffffff00%u ms", playerTarget->GetSession()->GetRemoteAddress().c_str(), latency);
|
|
||||||
if (resultADB)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
Field* fields = resultADB->Fetch();
|
|
||||||
std::string startbanEnd = Acore::Time::TimeToTimestampStr(Seconds(fields[3].Get<uint64>()));
|
|
||||||
std::string bannedReason = fields[4].Get<std::string>();
|
|
||||||
std::string bannedBy = fields[5].Get<std::string>();
|
|
||||||
handler->PSendSysMessage("|cffff0000Account Previously Banned: |cffffff00Yes");
|
|
||||||
handler->PSendSysMessage("|cffff0000Ban Ended: |cffffff00%s", startbanEnd.c_str());
|
|
||||||
handler->PSendSysMessage("|cffff0000Ban by: |cffffff00%s |cffff0000Ban Reason: |cffffff00%s", bannedBy.c_str(), bannedReason.c_str());
|
|
||||||
} while (resultADB->NextRow());
|
|
||||||
}
|
|
||||||
if (!resultADB)
|
|
||||||
{
|
|
||||||
handler->PSendSysMessage("|cffff0000Account Previously Banned: |cffffff00No");
|
|
||||||
}
|
|
||||||
if (resultCDB)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
Field* fields = resultCDB->Fetch();
|
|
||||||
std::string startbanEnd = Acore::Time::TimeToTimestampStr(Seconds(fields[3].Get<uint64>()));
|
|
||||||
std::string bannedReason = fields[4].Get<std::string>();
|
|
||||||
std::string bannedBy = fields[5].Get<std::string>();
|
|
||||||
handler->PSendSysMessage("|cffff0000Character Previously Banned: |cffffff00Yes");
|
|
||||||
handler->PSendSysMessage("|cffff0000Ban Ended: |cffffff00%s", startbanEnd.c_str());
|
|
||||||
handler->PSendSysMessage("|cffff0000Ban by: |cffffff00%s |cffff0000Ban Reason: |cffffff00%s", bannedBy.c_str(), bannedReason.c_str());
|
|
||||||
} while (resultCDB->NextRow());
|
|
||||||
}
|
|
||||||
if (!resultCDB)
|
|
||||||
{
|
|
||||||
handler->PSendSysMessage("|cffff0000Character Previously Banned: |cffffff00No");
|
|
||||||
}
|
|
||||||
if (resultLDB)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
handler->PSendSysMessage("|cffff0000Macro Requiring Lua Unlock Detected: |cffffff00Yes");
|
|
||||||
} while (resultLDB->NextRow());
|
|
||||||
}
|
|
||||||
if (!resultLDB)
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
handler->PSendSysMessage("|cffff0000Teleport Reports: |cffffff00%u |cffff0000Climb Reports: |cffffff00%u", teleport_reports, climb_reports);
|
|
||||||
handler->PSendSysMessage("|cffff0000Ignore Control Reports: |cffffff00%u |cffff0000Ignore Z-Axis Reports: |cffffff00%u", ignorecontrol_reports, zaxis_reports);
|
|
||||||
handler->PSendSysMessage("|cffff0000Ignore Anti-Swim Reports: |cffffff00%u |cffff0000Gravity Reports: |cffffff00%u", antiswim_reports, gravity_reports);
|
|
||||||
handler->PSendSysMessage("|cffff0000Anti-Knock Back Reports: |cffffff00%u |cffff0000No Fall Damage Reports: |cffffff00%u", antiknockback_reports, no_fall_damage_reports);
|
|
||||||
handler->PSendSysMessage("|cffff0000Op Ack Reports: |cffffff00%u", op_ack_reports);
|
|
||||||
}
|
|
||||||
if (handler->IsConsole())
|
if (handler->IsConsole())
|
||||||
{
|
{
|
||||||
// 0 1 2 3 4 5
|
lineTemplate_u = "%s: %u";
|
||||||
QueryResult resultADB = LoginDatabase.Query("SELECT FROM_UNIXTIME(active, '%Y-%m-%d..%H:%i:%s') as bandate, unbandate-bandate, active, unbandate, banreason, bannedby FROM account_banned WHERE id = '{}' ORDER BY bandate ASC", playerTarget->GetSession()->GetAccountId());
|
lineTemplate_s = "%s: %s";
|
||||||
// 0 1 2 3 4 5
|
lineSeparator = "-----------------------------------------------------------------";
|
||||||
QueryResult resultCDB = CharacterDatabase.Query("SELECT FROM_UNIXTIME(active, '%Y-%m-%d..%H:%i:%s') as bandate, unbandate - bandate, active, unbandate, banreason, bannedby FROM character_banned WHERE guid={};", playerTarget->GetGUID().GetCounter());
|
playerInformationTemplate = "Information about player %s";
|
||||||
// 0 1 2 3
|
ipAndLatencyTemplate = "IP Address: %s || Latency %u ms";
|
||||||
QueryResult resultLDB = CharacterDatabase.Query("SELECT accountId, type, time, data FROM account_data WHERE `data` LIKE '%CastSpellByName%' AND accountId ='{}';", playerTarget->GetSession()->GetAccountId());
|
banAndReasonTemplate = "Ban by: %s || Ban Reason: %s";
|
||||||
|
averageTotalTemplate = "Average: %f || Total Reports: %u";
|
||||||
handler->PSendSysMessage("-----------------------------------------------------------------");
|
|
||||||
handler->PSendSysMessage("Information about player %s", player->GetName().c_str());
|
|
||||||
handler->PSendSysMessage("IP Address: %s || Latency %u ms", playerTarget->GetSession()->GetRemoteAddress().c_str(), latency);
|
|
||||||
if (resultADB)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
Field* fields = resultADB->Fetch();
|
|
||||||
std::string startbanEnd = Acore::Time::TimeToTimestampStr(Seconds(fields[3].Get<uint64>()));
|
|
||||||
std::string bannedReason = fields[4].Get<std::string>();
|
|
||||||
std::string bannedBy = fields[5].Get<std::string>();
|
|
||||||
handler->PSendSysMessage("Account Previously Banned: Yes");
|
|
||||||
handler->PSendSysMessage("Ban Ended: %s", startbanEnd.c_str());
|
|
||||||
handler->PSendSysMessage("Ban by: %s || Ban Reason: %s", bannedBy.c_str(), bannedReason.c_str());
|
|
||||||
} while (resultADB->NextRow());
|
|
||||||
}
|
|
||||||
if (!resultADB)
|
|
||||||
{
|
|
||||||
handler->PSendSysMessage("Account Previously Banned: No");
|
|
||||||
}
|
|
||||||
if (resultCDB)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
Field* fields = resultCDB->Fetch();
|
|
||||||
std::string startbanEnd = Acore::Time::TimeToTimestampStr(Seconds(fields[3].Get<uint64>()));
|
|
||||||
std::string bannedReason = fields[4].Get<std::string>();
|
|
||||||
std::string bannedBy = fields[5].Get<std::string>();
|
|
||||||
handler->PSendSysMessage("Character Previously Banned: Yes");
|
|
||||||
handler->PSendSysMessage("Ban Ended: %s", startbanEnd.c_str());
|
|
||||||
handler->PSendSysMessage("Ban by: %s || Ban Reason: %s", bannedBy.c_str(), bannedReason.c_str());
|
|
||||||
} while (resultCDB->NextRow());
|
|
||||||
}
|
|
||||||
if (!resultCDB)
|
|
||||||
{
|
|
||||||
handler->PSendSysMessage("Character Previously Banned: No");
|
|
||||||
}
|
|
||||||
if (resultLDB)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
handler->PSendSysMessage("Macro Requiring Lua Unlock Detected: Yes");
|
|
||||||
} while (resultLDB->NextRow());
|
|
||||||
}
|
|
||||||
if (!resultLDB)
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
handler->PSendSysMessage("Teleport Reports: %u || Climb Reports: %u", teleport_reports, climb_reports);
|
|
||||||
handler->PSendSysMessage("Ignore Control Reports: %u || Ignore Z-Axis Reports: %u", ignorecontrol_reports, zaxis_reports);
|
|
||||||
handler->PSendSysMessage("Ignore Anti-Swim Reports: %u || Gravity Reports: %u", antiswim_reports, gravity_reports);
|
|
||||||
handler->PSendSysMessage("Anti-Knock Back Reports: %u || No Fall Damage Reports: %u", antiknockback_reports, no_fall_damage_reports);
|
|
||||||
handler->PSendSysMessage("Op Ack Reports: %u", op_ack_reports);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lineTemplate_u = "|cffff0000%s:|cffffff00 %u";
|
||||||
|
lineTemplate_s = "|cffff0000%s:|cffffff00 %s";
|
||||||
|
lineSeparator = "|cFFFFA500-----------------------------------------------------------------";
|
||||||
|
playerInformationTemplate = "|cFF20B2AAInformation about player:|cffffff00 %s";
|
||||||
|
ipAndLatencyTemplate = "|cffff0000IP Address: |cffffff00%s |cffff0000Latency |cffffff00%u ms";
|
||||||
|
banAndReasonTemplate = "|cffff0000Ban by:|cffffff00 %s |cffff0000Ban Reason:|cffffff00 %s";
|
||||||
|
averageTotalTemplate = "|cffff0000Average: |cffffff00%f |cffff0000Total Reports:|cffffff00 %u";
|
||||||
|
}
|
||||||
|
|
||||||
|
handler->PSendSysMessage(lineSeparator);
|
||||||
|
handler->PSendSysMessage(playerInformationTemplate, player->GetName());
|
||||||
|
handler->PSendSysMessage(ipAndLatencyTemplate, playerTarget->GetSession()->GetRemoteAddress(), latency);
|
||||||
|
|
||||||
|
// 0 1 2
|
||||||
|
QueryResult resultADB = LoginDatabase.Query("SELECT `unbandate`, `banreason`, `bannedby` FROM `account_banned` WHERE `id` = {} ORDER BY bandate ASC", playerTarget->GetSession()->GetAccountId());
|
||||||
|
if (resultADB)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Field* fields = resultADB->Fetch();
|
||||||
|
std::string startbanEnd = Acore::Time::TimeToTimestampStr(Seconds(fields[0].Get<uint64>()));
|
||||||
|
std::string bannedReason = fields[1].Get<std::string>();
|
||||||
|
std::string bannedBy = fields[2].Get<std::string>();
|
||||||
|
handler->PSendSysMessage(lineTemplate_s, "Account Previously Banned", "Yes");
|
||||||
|
handler->PSendSysMessage(lineTemplate_s, "Ban Ended", startbanEnd);
|
||||||
|
handler->PSendSysMessage(banAndReasonTemplate, bannedBy, bannedReason);
|
||||||
|
} while (resultADB->NextRow());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage(lineTemplate_s, "Account Previously Banned", "No");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 0 1 2
|
||||||
|
QueryResult resultCDB = CharacterDatabase.Query("SELECT `unbandate`, `banreason`, `bannedby` FROM `character_banned` WHERE `guid` = {} ORDER BY `bandate` ASC;", playerTarget->GetGUID().GetCounter());
|
||||||
|
if (resultCDB)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Field* fields = resultCDB->Fetch();
|
||||||
|
std::string startbanEnd = Acore::Time::TimeToTimestampStr(Seconds(fields[0].Get<uint64>()));
|
||||||
|
std::string bannedReason = fields[1].Get<std::string>();
|
||||||
|
std::string bannedBy = fields[2].Get<std::string>();
|
||||||
|
handler->PSendSysMessage(lineTemplate_s, "Character Previously Banned", "Yes");
|
||||||
|
handler->PSendSysMessage(lineTemplate_s, "Ban Ended", startbanEnd);
|
||||||
|
handler->PSendSysMessage(banAndReasonTemplate, bannedBy, bannedReason);
|
||||||
|
} while (resultCDB->NextRow());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage(lineTemplate_s, "Character Previously Banned", "No");
|
||||||
|
}
|
||||||
|
|
||||||
|
// If any row exists, then we consider "detected".
|
||||||
|
if (CharacterDatabase.Query("SELECT TRUE FROM `account_data` WHERE `data` LIKE '%CastSpellByName%' AND `accountId` = {};", playerTarget->GetSession()->GetAccountId()))
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage(lineTemplate_s, "Macro Requiring Lua Unlock Detected", "Yes");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage(lineTemplate_s, "Macro Requiring Lua Unlock Detected", "No");
|
||||||
|
}
|
||||||
|
|
||||||
|
float average = sAnticheatMgr->GetAverage(guid);
|
||||||
|
uint32 total_reports = sAnticheatMgr->GetTotalReports(guid);
|
||||||
|
uint32 counter_measures_reports = sAnticheatMgr->GetTypeReports(guid, ReportTypes::COUNTER_MEASURES_REPORT);
|
||||||
|
|
||||||
|
handler->PSendSysMessage(lineTemplate_u, "Counter Measures Deployed", counter_measures_reports);
|
||||||
|
handler->PSendSysMessage(averageTotalTemplate, average, total_reports);
|
||||||
|
|
||||||
|
if (uint32 speed_reports = sAnticheatMgr->GetTypeReports(guid, ReportTypes::SPEED_HACK_REPORT))
|
||||||
|
handler->PSendSysMessage(lineTemplate_u, "Speed Reports", speed_reports);
|
||||||
|
|
||||||
|
if (uint32 fly_reports = sAnticheatMgr->GetTypeReports(guid, ReportTypes::FLY_HACK_REPORT))
|
||||||
|
handler->PSendSysMessage(lineTemplate_u, "Fly Reports", fly_reports);
|
||||||
|
|
||||||
|
if (uint32 jump_reports = sAnticheatMgr->GetTypeReports(guid, ReportTypes::JUMP_HACK_REPORT))
|
||||||
|
handler->PSendSysMessage(lineTemplate_u, "Jump Reports", jump_reports);
|
||||||
|
|
||||||
|
if (uint32 waterwalk_reports = sAnticheatMgr->GetTypeReports(guid, ReportTypes::WALK_WATER_HACK_REPORT))
|
||||||
|
handler->PSendSysMessage(lineTemplate_u, "Walk On Water Reports", waterwalk_reports);
|
||||||
|
|
||||||
|
if (uint32 teleportplane_reports = sAnticheatMgr->GetTypeReports(guid, ReportTypes::TELEPORT_PLANE_HACK_REPORT))
|
||||||
|
handler->PSendSysMessage(lineTemplate_u, "Teleport To Plane Reports", teleportplane_reports);
|
||||||
|
|
||||||
|
if (uint32 teleport_reports = sAnticheatMgr->GetTypeReports(guid, ReportTypes::TELEPORT_HACK_REPORT))
|
||||||
|
handler->PSendSysMessage(lineTemplate_u, "Teleport Reports", teleport_reports);
|
||||||
|
|
||||||
|
if (uint32 climb_reports = sAnticheatMgr->GetTypeReports(guid, ReportTypes::CLIMB_HACK_REPORT))
|
||||||
|
handler->PSendSysMessage(lineTemplate_u, "Climb Reports", climb_reports);
|
||||||
|
|
||||||
|
if (uint32 ignorecontrol_reports = sAnticheatMgr->GetTypeReports(guid, ReportTypes::IGNORE_CONTROL_REPORT))
|
||||||
|
handler->PSendSysMessage(lineTemplate_u, "Ignore Control Reports", ignorecontrol_reports);
|
||||||
|
|
||||||
|
if (uint32 zaxis_reports = sAnticheatMgr->GetTypeReports(guid, ReportTypes::ZAXIS_HACK_REPORT))
|
||||||
|
handler->PSendSysMessage(lineTemplate_u, "Ignore Z-Axis Reports", zaxis_reports);
|
||||||
|
|
||||||
|
if (uint32 antiswim_reports = sAnticheatMgr->GetTypeReports(guid, ReportTypes::ANTISWIM_HACK_REPORT))
|
||||||
|
handler->PSendSysMessage(lineTemplate_u, "Anti-Swim Reports", antiswim_reports);
|
||||||
|
|
||||||
|
if (uint32 gravity_reports = sAnticheatMgr->GetTypeReports(guid, ReportTypes::GRAVITY_HACK_REPORT))
|
||||||
|
handler->PSendSysMessage(lineTemplate_u, "Gravity Reports", gravity_reports);
|
||||||
|
|
||||||
|
if (uint32 antiknockback_reports = sAnticheatMgr->GetTypeReports(guid, ReportTypes::ANTIKNOCK_BACK_HACK_REPORT))
|
||||||
|
handler->PSendSysMessage(lineTemplate_u, "Anti-Knock Back Reports", antiknockback_reports);
|
||||||
|
|
||||||
|
if (uint32 no_fall_damage_reports = sAnticheatMgr->GetTypeReports(guid, ReportTypes::NO_FALL_DAMAGE_HACK_REPORT))
|
||||||
|
handler->PSendSysMessage(lineTemplate_u, "No Fall Damage Reports", no_fall_damage_reports);
|
||||||
|
|
||||||
|
if (uint32 op_ack_reports = sAnticheatMgr->GetTypeReports(guid, ReportTypes::OP_ACK_HACK_REPORT))
|
||||||
|
handler->PSendSysMessage(lineTemplate_u, "Op Ack Reports", op_ack_reports);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleAntiCheatGlobalCommand(ChatHandler* handler)
|
static bool HandleAntiCheatGlobalCommand(ChatHandler* handler)
|
||||||
|
|||||||
Reference in New Issue
Block a user