mirror of
https://github.com/azerothcore/mod-anticheat.git
synced 2026-01-13 09:07:22 +00:00
Feat (Conf\BG): BG Star Area Cheat Countermeasure
If a player cheats by teleporting outside of the start spot before the BG starts, a counter measure will applied and log (if WriteLog is enabled) and send the player to a void spot for a few seconds and return them back in the team start spot
This commit is contained in:
@@ -936,6 +936,30 @@ void AnticheatMgr::BGreport(Player* player)
|
||||
BuildReport(player, TELEPORT_HACK_REPORT);
|
||||
}
|
||||
|
||||
Position const* AnticheatMgr::GetTeamStartPosition(TeamId teamId) const
|
||||
{
|
||||
return &_startPosition[teamId];
|
||||
}
|
||||
|
||||
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 (pos.GetExactDistSq(!startPos))
|
||||
{
|
||||
if (sConfigMgr->GetOption<bool>("Anticheat.WriteLog", true))
|
||||
{
|
||||
LOG_INFO("anticheat.module", "ANTICHEAT COUNTER MEASURE:: Sending {} back to start location (BG Map: {}) (possible exploit)", player->GetName(), player->GetMapId());
|
||||
}
|
||||
player->TeleportTo(player->GetMapId(), startPos->GetPositionX(), startPos->GetPositionY(), startPos->GetPositionZ(), startPos->GetOrientation());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void AnticheatMgr::BGStartExploit(Player* player, MovementInfo movementInfo)
|
||||
{
|
||||
if (!sConfigMgr->GetOption<bool>("Anticheat.DetectBGStartHack", true))
|
||||
@@ -957,12 +981,14 @@ void AnticheatMgr::BGStartExploit(Player* player, MovementInfo movementInfo)
|
||||
(player->GetTeamId() == TEAM_ALLIANCE && movementInfo.pos.GetPositionY() < -525.0f))
|
||||
{
|
||||
sAnticheatMgr->BGreport(player);
|
||||
sAnticheatMgr->CheckStartPositions(player);
|
||||
}
|
||||
if ((player->GetTeamId() == TEAM_HORDE && movementInfo.pos.GetPositionY() > -535.0f) ||
|
||||
(player->GetTeamId() == TEAM_HORDE && movementInfo.pos.GetPositionX() > -1283.33f) ||
|
||||
(player->GetTeamId() == TEAM_HORDE && movementInfo.pos.GetPositionY() < -716.0f))
|
||||
{
|
||||
sAnticheatMgr->BGreport(player);
|
||||
sAnticheatMgr->CheckStartPositions(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -974,6 +1000,7 @@ void AnticheatMgr::BGStartExploit(Player* player, MovementInfo movementInfo)
|
||||
if (!(movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING_FAR) || m_Players[key].GetLastOpcode() == MSG_MOVE_JUMP) && movementInfo.pos.GetPositionZ() > 380.0f)
|
||||
{
|
||||
sAnticheatMgr->BGreport(player);
|
||||
sAnticheatMgr->CheckStartPositions(player);
|
||||
}
|
||||
if (Battleground* bg = player->GetBattleground())
|
||||
{
|
||||
@@ -985,12 +1012,14 @@ void AnticheatMgr::BGStartExploit(Player* player, MovementInfo movementInfo)
|
||||
(player->GetTeamId() == TEAM_ALLIANCE && movementInfo.pos.GetPositionY() < 1450.0f))
|
||||
{
|
||||
sAnticheatMgr->BGreport(player);
|
||||
sAnticheatMgr->CheckStartPositions(player);
|
||||
}
|
||||
if ((player->GetTeamId() == TEAM_HORDE && movementInfo.pos.GetPositionX() > 957.0f) ||
|
||||
(player->GetTeamId() == TEAM_HORDE && movementInfo.pos.GetPositionY() < 1416.0f) ||
|
||||
(player->GetTeamId() == TEAM_HORDE && movementInfo.pos.GetPositionY() > 1466.0f))
|
||||
{
|
||||
sAnticheatMgr->BGreport(player);
|
||||
sAnticheatMgr->CheckStartPositions(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1008,11 +1037,13 @@ void AnticheatMgr::BGStartExploit(Player* player, MovementInfo movementInfo)
|
||||
(player->GetTeamId() == TEAM_ALLIANCE && movementInfo.pos.GetPositionY() > 1361.0f))
|
||||
{
|
||||
sAnticheatMgr->BGreport(player);
|
||||
sAnticheatMgr->CheckStartPositions(player);
|
||||
}
|
||||
if ((player->GetTeamId() == TEAM_HORDE && movementInfo.pos.GetPositionX() > 730.0f) ||
|
||||
(player->GetTeamId() == TEAM_HORDE && movementInfo.pos.GetPositionY() > 724.8f))
|
||||
{
|
||||
sAnticheatMgr->BGreport(player);
|
||||
sAnticheatMgr->CheckStartPositions(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1030,12 +1061,14 @@ void AnticheatMgr::BGStartExploit(Player* player, MovementInfo movementInfo)
|
||||
(player->GetTeamId() == TEAM_ALLIANCE && movementInfo.pos.GetPositionY() < 1584.0f))
|
||||
{
|
||||
sAnticheatMgr->BGreport(player);
|
||||
sAnticheatMgr->CheckStartPositions(player);
|
||||
}
|
||||
if ((player->GetTeamId() == TEAM_HORDE && movementInfo.pos.GetPositionX() > 1816.0f) ||
|
||||
(player->GetTeamId() == TEAM_HORDE && movementInfo.pos.GetPositionY() > 1554.0f) ||
|
||||
(player->GetTeamId() == TEAM_HORDE && movementInfo.pos.GetPositionY() < 1526.0f))
|
||||
{
|
||||
sAnticheatMgr->BGreport(player);
|
||||
sAnticheatMgr->CheckStartPositions(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1053,12 +1086,14 @@ void AnticheatMgr::BGStartExploit(Player* player, MovementInfo movementInfo)
|
||||
(player->GetTeamId() == TEAM_ALLIANCE && movementInfo.pos.GetPositionY() > -760.0f))
|
||||
{
|
||||
sAnticheatMgr->BGreport(player);
|
||||
sAnticheatMgr->CheckStartPositions(player);
|
||||
}
|
||||
if ((player->GetTeamId() == TEAM_HORDE && movementInfo.pos.GetPositionX() < 1147.8f) ||
|
||||
(player->GetTeamId() == TEAM_HORDE && movementInfo.pos.GetPositionY() < -855.0f) ||
|
||||
(player->GetTeamId() == TEAM_HORDE && movementInfo.pos.GetPositionY() > -676.0f))
|
||||
{
|
||||
sAnticheatMgr->BGreport(player);
|
||||
sAnticheatMgr->CheckStartPositions(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,6 +109,8 @@ class AnticheatMgr
|
||||
void AnticheatDeleteCommand(ObjectGuid guid);
|
||||
void AnticheatPurgeCommand(ChatHandler* handler);
|
||||
void ResetDailyReportStates();
|
||||
void SetMapId(uint32 MapID) { m_MapId = MapID; }
|
||||
[[nodiscard]] uint32 GetMapId() const { return m_MapId; }
|
||||
|
||||
private:
|
||||
void SpeedHackDetection(Player* player, MovementInfo movementInfo);
|
||||
@@ -125,6 +127,7 @@ class AnticheatMgr
|
||||
void AntiKnockBackHackDetection(Player* player, MovementInfo movementInfo);
|
||||
void NoFallDamageDetection(Player* player, MovementInfo movementInfo);
|
||||
void BGreport(Player* player);
|
||||
void CheckStartPositions(Player* player);
|
||||
void BGStartExploit(Player* player, MovementInfo movementInfo);
|
||||
void BuildReport(Player* player,uint16 reportType);
|
||||
bool MustCheckTempReports(uint8 type);
|
||||
@@ -132,6 +135,9 @@ class AnticheatMgr
|
||||
uint32 _alertFrequency = 0;
|
||||
uint32 _assignedspeeddiff = 0;
|
||||
uint32 _updateCheckTimer = 4000;
|
||||
uint32 m_MapId;
|
||||
std::array<Position, PVP_TEAMS_COUNT> _startPosition;
|
||||
Position const* GetTeamStartPosition(TeamId teamId) const;
|
||||
AnticheatPlayersDataMap m_Players; ///< Player data
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user