mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 05:36:23 +00:00
fix(core/packets): reduce sending unnecessary packets (#13198)
Co-authored-by: Dehravor <dehravor@gmail.com>
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1042,6 +1042,16 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GetPlayer()->IsWithinDistInMap(player, INSPECT_DISTANCE, false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetPlayer()->IsValidAttackTarget(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 talent_points = 0x47;
|
||||
uint32 guid_size = player->GetPackGUID().size();
|
||||
WorldPacket data(SMSG_INSPECT_TALENT, guid_size + 4 + talent_points);
|
||||
@@ -1074,6 +1084,16 @@ void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recv_data)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GetPlayer()->IsWithinDistInMap(player, INSPECT_DISTANCE, false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetPlayer()->IsValidAttackTarget(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
WorldPacket data(MSG_INSPECT_HONOR_STATS, 8 + 1 + 4 * 4);
|
||||
data << player->GetGUID();
|
||||
data << uint8(player->GetHonorPoints());
|
||||
@@ -1608,7 +1628,19 @@ void WorldSession::HandleQueryInspectAchievements(WorldPacket& recv_data)
|
||||
|
||||
Player* player = ObjectAccessor::GetPlayer(*_player, guid);
|
||||
if (!player)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GetPlayer()->IsWithinDistInMap(player, INSPECT_DISTANCE, false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetPlayer()->IsValidAttackTarget(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player->SendRespondInspectAchievements(_player);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user