feat (new detection\char sql\conf): Anti-swim Detection added

rerun sql for character db to support the new collumn.
new conf Anticheat.AntiSwimClimbHack = 1
This commit is contained in:
MDIC
2022-05-03 17:07:13 -04:00
parent a354b09f1d
commit 05ff193afb
6 changed files with 37 additions and 6 deletions

View File

@@ -421,6 +421,10 @@ void AnticheatMgr::StartHackDetection(Player* player, MovementInfo movementInfo,
{
ZAxisHackDetection(player, movementInfo);
}
if (player->GetLiquidData().Status == LIQUID_MAP_UNDER_WATER)
{
AntiSwimHackDetection(player, movementInfo);
}
m_Players[key].SetLastMovementInfo(movementInfo);
m_Players[key].SetLastOpcode(opcode);
}
@@ -467,6 +471,26 @@ void AnticheatMgr::ClimbHackDetection(Player* player, MovementInfo movementInfo,
}
}
// basic detection
void AnticheatMgr::AntiSwimHackDetection(Player* player, MovementInfo movementInfo)
{
if (!sConfigMgr->GetOption<bool>("Anticheat.AntiSwimClimbHack", true))
return;
if (player->GetLiquidData().Status == LIQUID_MAP_UNDER_WATER && !movementInfo.HasMovementFlag(MOVEMENTFLAG_SWIMMING))
{
if (sConfigMgr->GetOption<bool>("Anticheat.WriteLog", true))
{
uint32 latency = 0;
latency = player->GetSession()->GetLatency();
LOG_INFO("module", "AnticheatMgr:: Anti-Swim-Hack detected player {} ({}) - Latency: {} ms", player->GetName(), player->GetGUID().ToString(), latency);
}
BuildReport(player, ANTISWIM_HACK_REPORT);
}
}
void AnticheatMgr::SpeedHackDetection(Player* player, MovementInfo movementInfo)
{
if (!sConfigMgr->GetOption<bool>("Anticheat.DetectSpeedHack", true))
@@ -594,8 +618,8 @@ void AnticheatMgr::HandlePlayerLogout(Player* player)
}
void AnticheatMgr::SavePlayerData(Player* player)
{// 1 2 3 4 5 6 7 8 9 10 11 12 13
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,creation_time) VALUES ({},{},{},{},{},{},{},{},{},{},{},{},{});", player->GetGUID().GetCounter(), m_Players[player->GetGUID()].GetAverage(), m_Players[player->GetGUID()].GetTotalReports(), m_Players[player->GetGUID()].GetTypeReports(SPEED_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(FLY_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(JUMP_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(WALK_WATER_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(TELEPORT_PLANE_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(CLIMB_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(TELEPORT_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(IGNORE_CONTROL_REPORT), m_Players[player->GetGUID()].GetTypeReports(ZAXIS_HACK_REPORT), m_Players[player->GetGUID()].GetCreationTime());
{// 1 2 3 4 5 6 7 8 9 10 11 12 13 14
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,creation_time) VALUES ({},{},{},{},{},{},{},{},{},{},{},{},{},{});", player->GetGUID().GetCounter(), m_Players[player->GetGUID()].GetAverage(), m_Players[player->GetGUID()].GetTotalReports(), m_Players[player->GetGUID()].GetTypeReports(SPEED_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(FLY_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(JUMP_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(WALK_WATER_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(TELEPORT_PLANE_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(CLIMB_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(TELEPORT_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(IGNORE_CONTROL_REPORT), m_Players[player->GetGUID()].GetTypeReports(ZAXIS_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(ANTISWIM_HACK_REPORT), m_Players[player->GetGUID()].GetCreationTime());
}
uint32 AnticheatMgr::GetTotalReports(ObjectGuid guid)
@@ -686,8 +710,8 @@ void AnticheatMgr::BuildReport(Player* player, uint16 reportType)
if (sConfigMgr->GetOption<uint32>("Anticheat.MaxReportsForDailyReport", 70) < m_Players[key].GetTotalReports())
{
if (!m_Players[key].GetDailyReportState())
{// 1 2 3 4 5 6 7 8 9 10 11 12 13
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,creation_time) VALUES ({},{},{},{},{},{},{},{},{},{},{},{},{});", player->GetGUID().GetCounter(), m_Players[player->GetGUID()].GetAverage(), m_Players[player->GetGUID()].GetTotalReports(), m_Players[player->GetGUID()].GetTypeReports(SPEED_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(FLY_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(JUMP_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(WALK_WATER_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(TELEPORT_PLANE_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(CLIMB_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(TELEPORT_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(IGNORE_CONTROL_REPORT), m_Players[player->GetGUID()].GetTypeReports(ZAXIS_HACK_REPORT), m_Players[player->GetGUID()].GetCreationTime());
{// 1 2 3 4 5 6 7 8 9 10 11 12 13 14
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,creation_time) VALUES ({},{},{},{},{},{},{},{},{},{},{},{},{},{});", player->GetGUID().GetCounter(), m_Players[player->GetGUID()].GetAverage(), m_Players[player->GetGUID()].GetTotalReports(), m_Players[player->GetGUID()].GetTypeReports(SPEED_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(FLY_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(JUMP_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(WALK_WATER_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(TELEPORT_PLANE_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(CLIMB_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(TELEPORT_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(IGNORE_CONTROL_REPORT), m_Players[player->GetGUID()].GetTypeReports(ZAXIS_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(ANTISWIM_HACK_REPORT), m_Players[player->GetGUID()].GetCreationTime());
m_Players[key].SetDailyReportState(true);
}
}