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;
|
recvData >> guid;
|
||||||
LOG_DEBUG("network", "Inspect Arena stats ({})", guid.ToString());
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!GetPlayer()->IsWithinDistInMap(player, INSPECT_DISTANCE, false))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetPlayer()->IsValidAttackTarget(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 talent_points = 0x47;
|
uint32 talent_points = 0x47;
|
||||||
uint32 guid_size = player->GetPackGUID().size();
|
uint32 guid_size = player->GetPackGUID().size();
|
||||||
WorldPacket data(SMSG_INSPECT_TALENT, guid_size + 4 + talent_points);
|
WorldPacket data(SMSG_INSPECT_TALENT, guid_size + 4 + talent_points);
|
||||||
@@ -1074,6 +1084,16 @@ void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recv_data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!GetPlayer()->IsWithinDistInMap(player, INSPECT_DISTANCE, false))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetPlayer()->IsValidAttackTarget(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
WorldPacket data(MSG_INSPECT_HONOR_STATS, 8 + 1 + 4 * 4);
|
WorldPacket data(MSG_INSPECT_HONOR_STATS, 8 + 1 + 4 * 4);
|
||||||
data << player->GetGUID();
|
data << player->GetGUID();
|
||||||
data << uint8(player->GetHonorPoints());
|
data << uint8(player->GetHonorPoints());
|
||||||
@@ -1608,7 +1628,19 @@ void WorldSession::HandleQueryInspectAchievements(WorldPacket& recv_data)
|
|||||||
|
|
||||||
Player* player = ObjectAccessor::GetPlayer(*_player, guid);
|
Player* player = ObjectAccessor::GetPlayer(*_player, guid);
|
||||||
if (!player)
|
if (!player)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!GetPlayer()->IsWithinDistInMap(player, INSPECT_DISTANCE, false))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetPlayer()->IsValidAttackTarget(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
player->SendRespondInspectAchievements(_player);
|
player->SendRespondInspectAchievements(_player);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user