Update (teleport stuff): Fix false hit with bg

Fix false hit with BG on Rezzing and gps correction with parole cmd with horde
This commit is contained in:
M'Dic
2022-12-27 16:57:09 -05:00
parent b6a100674f
commit fc5e9f07f8
2 changed files with 69 additions and 54 deletions

View File

@@ -482,6 +482,9 @@ void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementIn
if (m_Players[key].GetLastMovementInfo().pos.GetPositionX() == movementInfo.pos.GetPositionX()) if (m_Players[key].GetLastMovementInfo().pos.GetPositionX() == movementInfo.pos.GetPositionX())
return; return;
if (m_Players[key].GetLastOpcode() == MSG_DELAY_GHOST_TELEPORT)
return;
float lastX = m_Players[key].GetLastMovementInfo().pos.GetPositionX(); float lastX = m_Players[key].GetLastMovementInfo().pos.GetPositionX();
float newX = movementInfo.pos.GetPositionX(); float newX = movementInfo.pos.GetPositionX();
@@ -500,31 +503,7 @@ void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementIn
if (player->duel) if (player->duel)
{ {
if ((xDiff >= 50.0f || yDiff >= 50.0f)) if ((xDiff >= 50.0f || yDiff >= 50.0f) && !player->CanTeleport())
{
Player* opponent = player->duel->Opponent;
std::string str = "|cFFFFFC00[DUEL ALERT Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible Teleport Hack Detected! While Dueling [|cFF60FF00" + std::string(opponent->GetName().c_str()) + "|cFF00FFFF]";
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
data << str;
sWorld->SendGlobalGMMessage(&data);
uint32 latency = 0;
latency = player->GetSession()->GetLatency();
std::string goXYZ = ".go xyz " + std::to_string(player->GetPositionX()) + " " + std::to_string(player->GetPositionY()) + " " + std::to_string(player->GetPositionZ() + 1.0f) + " " + std::to_string(player->GetMap()->GetId()) + " " + std::to_string(player->GetOrientation());
std::string goXYZ2 = ".go xyz " + std::to_string(opponent->GetPositionX()) + " " + std::to_string(opponent->GetPositionY()) + " " + std::to_string(opponent->GetPositionZ() + 1.0f) + " " + std::to_string(opponent->GetMap()->GetId()) + " " + std::to_string(opponent->GetOrientation());
uint32 latency2 = 0;
latency2 = opponent->GetSession()->GetLatency();
sWorld->SendGMText(LANG_ANTICHEAT_DUEL, player->GetName().c_str(), latency, opponent->GetName().c_str(), latency2);
if (sConfigMgr->GetOption<bool>("Anticheat.WriteLog", true))
{
LOG_INFO("anticheat.module", "AnticheatMgr:: DUEL ALERT Teleport-Hack detected player {} ({}) while dueling {} - Latency: {} ms - IP: {} - GPS Diff X: {} Y: {} Z: {} - Cheat Flagged At: {} - Cheat Flag At: {}", player->GetName(), player->GetGUID().ToString(), opponent->GetName(), latency, player->GetSession()->GetRemoteAddress().c_str(), xDiff, yDiff, zDiff, goXYZ);
LOG_INFO("anticheat.module", "AnticheatMgr:: DUEL ALERT Teleport-Hack detected player {} ({}) while dueling {} - Latency: {} ms - IP: {} - GPS Diff X: {} Y: {} Z: {} - Cheat Flagged At: {} - Cheat Flag At: {}", opponent->GetName(), opponent->GetGUID().ToString(), player->GetName(), latency2, opponent->GetSession()->GetRemoteAddress().c_str(), xDiff, yDiff, zDiff, goXYZ2);
}
BuildReport(player, TELEPORT_HACK_REPORT);
BuildReport(opponent, TELEPORT_HACK_REPORT);
}
if (zDiff >= 10.0f && !player->IsFlying() && !player->IsFalling() && !player->CanTeleport() && !player->HasAuraType(SPELL_AURA_FEATHER_FALL))
{ {
Player* opponent = player->duel->Opponent; Player* opponent = player->duel->Opponent;
@@ -550,9 +529,39 @@ void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementIn
} }
else if (player->CanTeleport()) else if (player->CanTeleport())
player->SetCanTeleport(false); player->SetCanTeleport(false);
if (zDiff >= 10.0f && !player->CanTeleport() && !player->IsBeingTeleported())
{
if (!player->IsFlying() && !player->IsFalling() && !player->HasAuraType(SPELL_AURA_FEATHER_FALL))
{
Player* opponent = player->duel->Opponent;
std::string str = "|cFFFFFC00[DUEL ALERT Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible Teleport Hack Detected! While Dueling [|cFF60FF00" + std::string(opponent->GetName().c_str()) + "|cFF00FFFF]";
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
data << str;
sWorld->SendGlobalGMMessage(&data);
uint32 latency = 0;
latency = player->GetSession()->GetLatency();
std::string goXYZ = ".go xyz " + std::to_string(player->GetPositionX()) + " " + std::to_string(player->GetPositionY()) + " " + std::to_string(player->GetPositionZ() + 1.0f) + " " + std::to_string(player->GetMap()->GetId()) + " " + std::to_string(player->GetOrientation());
std::string goXYZ2 = ".go xyz " + std::to_string(opponent->GetPositionX()) + " " + std::to_string(opponent->GetPositionY()) + " " + std::to_string(opponent->GetPositionZ() + 1.0f) + " " + std::to_string(opponent->GetMap()->GetId()) + " " + std::to_string(opponent->GetOrientation());
uint32 latency2 = 0;
latency2 = opponent->GetSession()->GetLatency();
sWorld->SendGMText(LANG_ANTICHEAT_DUEL, player->GetName().c_str(), latency, opponent->GetName().c_str(), latency2);
if (sConfigMgr->GetOption<bool>("Anticheat.WriteLog", true))
{
LOG_INFO("anticheat.module", "AnticheatMgr:: DUEL ALERT Teleport-Hack detected player {} ({}) while dueling {} - Latency: {} ms - IP: {} - GPS Diff X: {} Y: {} Z: {} - Cheat Flagged At: {} - Cheat Flag At: {}", player->GetName(), player->GetGUID().ToString(), opponent->GetName(), latency, player->GetSession()->GetRemoteAddress().c_str(), xDiff, yDiff, zDiff, goXYZ);
LOG_INFO("anticheat.module", "AnticheatMgr:: DUEL ALERT Teleport-Hack detected player {} ({}) while dueling {} - Latency: {} ms - IP: {} - GPS Diff X: {} Y: {} Z: {} - Cheat Flagged At: {} - Cheat Flag At: {}", opponent->GetName(), opponent->GetGUID().ToString(), player->GetName(), latency2, opponent->GetSession()->GetRemoteAddress().c_str(), xDiff, yDiff, zDiff, goXYZ2);
}
BuildReport(player, TELEPORT_HACK_REPORT);
BuildReport(opponent, TELEPORT_HACK_REPORT);
}
}
else if (player->CanTeleport())
player->SetCanTeleport(false);
} }
if ((xDiff >= 50.0f || yDiff >= 50.0f)) if ((xDiff >= 50.0f || yDiff >= 50.0f) && !player->CanTeleport() && !player->IsBeingTeleported())
{ {
if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption<uint32>("Anticheat.ReportsForIngameWarnings", 70)) if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption<uint32>("Anticheat.ReportsForIngameWarnings", 70))
{ {
@@ -587,40 +596,46 @@ void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementIn
BuildReport(player, TELEPORT_HACK_REPORT); BuildReport(player, TELEPORT_HACK_REPORT);
} }
if (zDiff >= 10.0f && !player->IsFlying() && !player->IsFalling() && !player->CanTeleport() && !player->HasAuraType(SPELL_AURA_FEATHER_FALL)) else if (player->CanTeleport())
player->SetCanTeleport(false);
if (zDiff >= 10.0f && !player->CanTeleport() && !player->IsBeingTeleported())
{ {
if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption<uint32>("Anticheat.ReportsForIngameWarnings", 70)) if (!player->IsFlying() && !player->IsFalling() && !player->HasAuraType(SPELL_AURA_FEATHER_FALL))
{ {
_alertFrequency = sConfigMgr->GetOption<uint32>("Anticheat.AlertFrequency", 5); if (m_Players[key].GetTotalReports() > sConfigMgr->GetOption<uint32>("Anticheat.ReportsForIngameWarnings", 70))
// So we dont divide by 0 by accident {
if (_alertFrequency < 1) _alertFrequency = sConfigMgr->GetOption<uint32>("Anticheat.AlertFrequency", 5);
_alertFrequency = 1; // So we dont divide by 0 by accident
if (++_counter % _alertFrequency == 0) if (_alertFrequency < 1)
_alertFrequency = 1;
if (++_counter % _alertFrequency == 0)
{
// display warning at the center of the screen, hacky way?
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible Teleport Hack Detected!";
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
data << str;
sWorld->SendGlobalGMMessage(&data);
uint32 latency = 0;
latency = player->GetSession()->GetLatency();
// 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(), player->GetName().c_str(), latency, xDiff, yDiff, zDiff);
}
_counter = 0;
}
}
if (sConfigMgr->GetOption<bool>("Anticheat.WriteLog", true))
{ {
// display warning at the center of the screen, hacky way?
std::string str = "|cFFFFFC00[Playername:|cFF00FFFF[|cFF60FF00" + std::string(player->GetName().c_str()) + "|cFF00FFFF] Possible Teleport Hack Detected!";
WorldPacket data(SMSG_NOTIFICATION, (str.size() + 1));
data << str;
sWorld->SendGlobalGMMessage(&data);
uint32 latency = 0; uint32 latency = 0;
latency = player->GetSession()->GetLatency(); latency = player->GetSession()->GetLatency();
// need better way to limit chat spam std::string goXYZ = ".go xyz " + std::to_string(player->GetPositionX()) + " " + std::to_string(player->GetPositionY()) + " " + std::to_string(player->GetPositionZ() + 1.0f) + " " + std::to_string(player->GetMap()->GetId()) + " " + std::to_string(player->GetOrientation());
if (m_Players[key].GetTotalReports() >= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Min", 70) && m_Players[key].GetTotalReports() <= sConfigMgr->GetOption<uint32>("Anticheat.ReportinChat.Max", 80)) LOG_INFO("anticheat.module", "AnticheatMgr:: Teleport-Hack detected player {} ({}) - Latency: {} ms - IP: {} - GPS Diff X: {} Y: {} Z: {} - Cheat Flagged At: {}", player->GetName(), player->GetGUID().ToString(), latency, player->GetSession()->GetRemoteAddress().c_str(), xDiff, yDiff, zDiff, goXYZ);
{
sWorld->SendGMText(LANG_ANTICHEAT_TELEPORT, player->GetName().c_str(), player->GetName().c_str(), latency, xDiff, yDiff, zDiff);
}
_counter = 0;
} }
}
if (sConfigMgr->GetOption<bool>("Anticheat.WriteLog", true))
{
uint32 latency = 0;
latency = player->GetSession()->GetLatency();
std::string goXYZ = ".go xyz " + std::to_string(player->GetPositionX()) + " " + std::to_string(player->GetPositionY()) + " " + std::to_string(player->GetPositionZ() + 1.0f) + " " + std::to_string(player->GetMap()->GetId()) + " " + std::to_string(player->GetOrientation());
LOG_INFO("anticheat.module", "AnticheatMgr:: Teleport-Hack detected player {} ({}) - Latency: {} ms - IP: {} - GPS Diff X: {} Y: {} Z: {} - Cheat Flagged At: {}", player->GetName(), player->GetGUID().ToString(), latency, player->GetSession()->GetRemoteAddress().c_str(), xDiff, yDiff, zDiff, goXYZ);
}
BuildReport(player, TELEPORT_HACK_REPORT); BuildReport(player, TELEPORT_HACK_REPORT);
}
} }
else if (player->CanTeleport()) else if (player->CanTeleport())
player->SetCanTeleport(false); player->SetCanTeleport(false);

View File

@@ -148,7 +148,7 @@ public:
Player* pTarget = player->GetConnectedPlayer(); Player* pTarget = player->GetConnectedPlayer();
WorldLocation Aloc = WorldLocation(0, -8833.37f, 628.62f, 94.00f, 1.06f);// Stormwind WorldLocation Aloc = WorldLocation(0, -8833.37f, 628.62f, 94.00f, 1.06f);// Stormwind
WorldLocation Hloc = WorldLocation(1, 1569.59f, -4397.63f, 16.06f, 0.54f);// Orgrimmar WorldLocation Hloc = WorldLocation(1, 1569.59f, -4397.63f, 7.7f, 0.54f);// Orgrimmar
if (pTarget->GetTeamId() == TEAM_ALLIANCE) if (pTarget->GetTeamId() == TEAM_ALLIANCE)
{ {