fix(core/packets): reduce sending unnecessary packets (#13198)

Co-authored-by: Dehravor <dehravor@gmail.com>
This commit is contained in:
天鹿
2023-01-15 22:31:00 +08:00
committed by GitHub
parent 739165a197
commit 14885e3e96
2 changed files with 52 additions and 7 deletions

View File

@@ -34,15 +34,28 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket& recvData)
recvData >> guid;
LOG_DEBUG("network", "Inspect Arena stats ({})", guid.ToString());
if (Player* player = ObjectAccessor::FindPlayer(guid))
Player* player = ObjectAccessor::FindPlayer(guid);
if (!player)
{
for (uint8 i = 0; i < MAX_ARENA_SLOT; ++i)
return;
}
if (!GetPlayer()->IsWithinDistInMap(player, INSPECT_DISTANCE, false))
{
return;
}
if (GetPlayer()->IsValidAttackTarget(player))
{
return;
}
for (uint8 i = 0; i < MAX_ARENA_SLOT; ++i)
{
if (uint32 a_id = player->GetArenaTeamId(i))
{
if (uint32 a_id = player->GetArenaTeamId(i))
{
if (ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(a_id))
arenaTeam->Inspect(this, player->GetGUID());
}
if (ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(a_id))
arenaTeam->Inspect(this, player->GetGUID());
}
}
}