feat (New Detection) Ignore Z-Axis Check

So this happens when a player is able to block their z-axis from updating with the server. This achieves the ability to run across the sky while avoiding fly hack detection. Usually get on a high object and then run accross, their x and y will chance but their elevation will not.
Warning: At times there will be false positives due to "pot holes" in the vmaps. This can not be avoided unless someone wants to redo all the maps with a better map extractor pr or rework all the maps in recast demo.
This commit is contained in:
MDIC
2022-03-30 19:28:05 -04:00
parent 0e8a84637f
commit 870cd832f8
3 changed files with 59 additions and 3 deletions

View File

@@ -72,6 +72,7 @@ Anticheat.DetectSpeedHack = 1
Anticheat.DetectClimbHack = 1
Anticheat.DetectTelePortHack = 1
Anticheat.IgnoreControlHack = 1
Anticheat.DetectZaxisHack =1
# Anticheat.StricterFlyHackCheck
# Description: Checks moveflag ascending (may give false positives)

View File

@@ -186,6 +186,55 @@ void AnticheatMgr::IgnoreControlHackDetection(Player* player, MovementInfo movem
}
}
void AnticheatMgr::ZAxisHackDetection(Player* player, MovementInfo movementInfo)
{
if (!sConfigMgr->GetOption<bool>("Anticheat.DetectZaxisHack", true))
return;
if (!movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY) && !movementInfo.HasMovementFlag(MOVEMENTFLAG_FLYING))
{
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();
float xDiff = fabs(lastX - newX);
float yDiff = fabs(lastY - newY);
float groundZ_vmap = player->GetMap()->GetHeight(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), true, 50.0f);
float groundZ_dyntree = player->GetMap()->GetDynamicMapTree().getHeight(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), 50.0f, player->GetPhaseMask());
float groundZ = std::max<float>(groundZ_vmap, groundZ_dyntree);
if ((xDiff || yDiff) && m_Players[key].GetLastMovementInfo().pos.GetPositionZ() == movementInfo.pos.GetPositionZ()
&& player->GetPositionZ() >= groundZ + 5.0f)
{
if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption<uint32>("Anticheat.ReportsForIngameWarnings", 70))
{
// display warning at the center of the screen, hacky way?
std::string str = "";
str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible Ignore Zaxis Hack Detected!";
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
data << str;
sWorld->SendGlobalGMMessage(&data);
// need better way to limit chat spam
if (m_Players[key].GetTotalReports() >= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Min", 70) && m_Players[key].GetTotalReports() <= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Max", 80))
{
sWorld->SendGMText(LANG_ANTICHEAT_TELEPORT, player->GetName().c_str());
}
}
if (sConfigMgr->GetOption<bool>("Anticheat.WriteLog", true))
{
LOG_INFO("module", "AnticheatMgr:: Ignore Zaxis Hack detected player {} ({})", player->GetName(), player->GetGUID().ToString());
}
BuildReport(player, ZAXIS_HACK_REPORT);
}
}
}
void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementInfo)
{
if (!sConfigMgr->GetOption<bool>("Anticheat.DetectTelePortHack", true))
@@ -257,6 +306,7 @@ void AnticheatMgr::StartHackDetection(Player* player, MovementInfo movementInfo,
ClimbHackDetection(player, movementInfo, opcode);
TeleportHackDetection(player, movementInfo);
IgnoreControlHackDetection(player, movementInfo);
ZAxisHackDetection(player, movementInfo);
m_Players[key].SetLastMovementInfo(movementInfo);
m_Players[key].SetLastOpcode(opcode);
}
@@ -470,6 +520,9 @@ bool AnticheatMgr::MustCheckTempReports(uint8 type)
if (type == IGNORE_CONTROL_REPORT)
return false;
if (type == ZAXIS_HACK_REPORT)
return false;
return true;
}

View File

@@ -36,8 +36,8 @@ enum ReportTypes
TELEPORT_PLANE_HACK_REPORT = 4,
CLIMB_HACK_REPORT = 5,
TELEPORT_HACK_REPORT = 6,
IGNORE_CONTROL_REPORT = 7
IGNORE_CONTROL_REPORT = 7,
ZAXIS_HACK_REPORT = 8
// MAX_REPORT_TYPES
};
@@ -50,7 +50,8 @@ enum DetectionTypes
TELEPORT_PLANE_HACK_DETECTION = 16,
CLIMB_HACK_DETECTION = 32,
TELEPORT_HACK_DETECTION = 64,
IGNORE_CONTROL_DETECTION = 128
IGNORE_CONTROL_DETECTION = 128,
ZAXIS_HACK_DETECTION = 256
};
// GUID is the key.
@@ -92,6 +93,7 @@ class AnticheatMgr
void ClimbHackDetection(Player* player,MovementInfo movementInfo,uint32 opcode);
void TeleportHackDetection(Player* player, MovementInfo movementInfo);
void IgnoreControlHackDetection(Player* player, MovementInfo movementInfo);
void ZAxisHackDetection(Player* player, MovementInfo movementInfo);
void BuildReport(Player* player,uint16 reportType);
bool MustCheckTempReports(uint8 type);