Skip to content

Instantly share code, notes, and snippets.

@trkyshorty
Created November 25, 2022 05:11
Show Gist options
  • Save trkyshorty/2c6c8bce308e243eae899465c7360b32 to your computer and use it in GitHub Desktop.
Save trkyshorty/2c6c8bce308e243eae899465c7360b32 to your computer and use it in GitHub Desktop.
UpdateServerList()
void LoginServer::UpdateServerList()
{
// Update the user counts first
m_DBProcess.LoadUserCountList();
Guard lock(m_serverListLock);
Packet & result = m_serverListPacket;
result.clear();
result << uint8_t(m_ServerList.size());
foreach (itr, m_ServerList)
{
_SERVER_INFO *pServer = *itr;
result << pServer->strServerIP;
#if __VERSION >= 1888
result << pServer->strLanIP;
#endif
result << pServer->strServerName;
result << pServer->sUserCount;
#if __VERSION >= 1453
result << pServer->sServerID << pServer->sGroupID;
result << int16_t(PLAYER_CAP) << int16_t(FREE_PLAYER_CAP);
#if __VERSION < 1600
result << uint8_t(1); // unknown, 1 in 15XX samples, 0 in 18XX+
#else
result << uint8_t(0);
#endif
#if __VERSION >= 2383
// 1 - Event | Version 2383+
// 2 - Recommended | Version 2383+
// 3 - New | Version 2442+
result << uint8_t(pServer->bType);
#endif
// we read all this stuff from ini, TODO: make this more versatile.
result << pServer->strKarusKingName << pServer->strKarusNotice
<< pServer->strElMoradKingName << pServer->strElMoradNotice;
#endif
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment