Core/Social: Fix SMSG_WHO. Packet should contain number of players matching given criteria + number of players displayed, instead of total number of players online + number of players displayed.
Fixes issue #4886 --HG-- branch : trunk
This commit is contained in:
@@ -170,7 +170,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket & recv_data)
|
||||
sLog.outDebug("WORLD: Recvd CMSG_WHO Message");
|
||||
//recv_data.hexlike();
|
||||
|
||||
uint32 clientcount = 0;
|
||||
uint32 matchcount = 0;
|
||||
|
||||
uint32 level_min, level_max, racemask, classmask, zones_count, str_count;
|
||||
uint32 zoneids[10]; // 10 is client limit
|
||||
@@ -234,10 +234,11 @@ void WorldSession::HandleWhoOpcode(WorldPacket & recv_data)
|
||||
uint32 security = GetSecurity();
|
||||
bool allowTwoSideWhoList = sWorld.getBoolConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST);
|
||||
uint32 gmLevelInWhoList = sWorld.getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST);
|
||||
uint32 displaycount = 0;
|
||||
|
||||
WorldPacket data(SMSG_WHO, 50); // guess size
|
||||
data << uint32(clientcount); // clientcount place holder, listed count
|
||||
data << uint32(clientcount); // clientcount place holder, online count
|
||||
data << uint32(matchcount); // placeholder, count of players matching criteria
|
||||
data << uint32(displaycount); // placeholder, count of players displayed
|
||||
|
||||
ACE_GUARD(ACE_Thread_Mutex, g, *HashMapHolder<Player>::GetLock());
|
||||
HashMapHolder<Player>::MapType& m = sObjectAccessor.GetPlayers();
|
||||
@@ -334,6 +335,11 @@ void WorldSession::HandleWhoOpcode(WorldPacket & recv_data)
|
||||
if (!s_show)
|
||||
continue;
|
||||
|
||||
// 49 is maximum player count sent to client - can be overridden
|
||||
// through config, but is unstable
|
||||
if ((matchcount++) == sWorld.getIntConfig(CONFIG_MAX_WHO))
|
||||
continue;
|
||||
|
||||
data << pname; // player name
|
||||
data << gname; // guild name
|
||||
data << uint32(lvl); // player level
|
||||
@@ -342,15 +348,11 @@ void WorldSession::HandleWhoOpcode(WorldPacket & recv_data)
|
||||
data << uint8(gender); // player gender
|
||||
data << uint32(pzoneid); // player zone id
|
||||
|
||||
// 49 is maximum player count sent to client - can be overridden
|
||||
// through config, but is unstable
|
||||
if ((++clientcount) == sWorld.getIntConfig(CONFIG_MAX_WHO))
|
||||
break;
|
||||
++displaycount;
|
||||
}
|
||||
|
||||
uint32 count = m.size();
|
||||
data.put( 0, clientcount ); // insert right count, listed count
|
||||
data.put( 4, count > 50 ? count : clientcount ); // insert right count, online count
|
||||
data.put(0, matchcount); // insert right count, count of matches
|
||||
data.put(4, displaycount); // insert right count, count displayed
|
||||
|
||||
SendPacket(&data);
|
||||
sLog.outDebug("WORLD: Send SMSG_WHO Message");
|
||||
|
||||
Reference in New Issue
Block a user