mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-28 21:02:14 +01:00
Core/SocialMgr: fix case when contacts appears in friend list many times
Closes #19306
This commit is contained in:
@@ -126,14 +126,13 @@ void PlayerSocial::SendSocialList(Player* player, uint32 flags)
|
||||
{
|
||||
ASSERT(player);
|
||||
|
||||
uint32 size = _playerSocialMap.size();
|
||||
|
||||
uint32 count = 0;
|
||||
WorldPacket data(SMSG_CONTACT_LIST, (4 + 4 + size * 25)); // just can guess size
|
||||
WorldPacket data(SMSG_CONTACT_LIST, (4 + 4 + _playerSocialMap.size() * 25)); // just can guess size
|
||||
data << uint32(flags); // 0x1 = Friendlist update. 0x2 = Ignorelist update. 0x4 = Mutelist update.
|
||||
data << uint32(size); // friends count
|
||||
size_t countPos = data.wpos();
|
||||
data << uint32(count); // friends count placeholder
|
||||
|
||||
for (PlayerSocialMap::value_type& v : _playerSocialMap)
|
||||
for (auto& v : _playerSocialMap)
|
||||
{
|
||||
if (!(v.second.Flags & flags))
|
||||
continue;
|
||||
@@ -160,6 +159,8 @@ void PlayerSocial::SendSocialList(Player* player, uint32 flags)
|
||||
break;
|
||||
}
|
||||
|
||||
data.put<uint32>(countPos, count);
|
||||
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user