Refactor expedition member online status requests

This optimizes character status requests by only sending a single
bulk request to world for characters in all expeditions instead of
sending a separate request for each expedition on zone startup
This commit is contained in:
hg
2020-06-01 19:45:12 -04:00
parent 158d934df7
commit 4c9b3ea1df
4 changed files with 28 additions and 23 deletions
+8 -8
View File
@@ -510,15 +510,15 @@ void ExpeditionMessage::GetOnlineMembers(ServerPacket* pack)
for (uint32_t i = 0; i < buf->count; ++i)
{
for (const auto& cle : all_clients)
auto it = std::find_if(all_clients.begin(), all_clients.end(), [&](const ClientListEntry* cle) {
return (cle && cle->CharID() == buf->entries[i].character_id);
});
if (it != all_clients.end())
{
if (cle && cle->CharID() == buf->entries[i].character_id)
{
buf->entries[i].character_zone_id = cle->zone();
buf->entries[i].character_instance_id = cle->instance();
buf->entries[i].character_online = true;
break;
}
buf->entries[i].character_zone_id = (*it)->zone();
buf->entries[i].character_instance_id = (*it)->instance();
buf->entries[i].character_online = true;
}
}