mirror of
https://github.com/azerothcore/mod-anticheat.git
synced 2026-01-13 09:07:22 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user