mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 16:37:00 +00:00
[9746] Implement show realm version and build in realm list.
* Rename `realmlist`.`color` field to `realmflags` * Client 2.x and later support show in realm list supported client version for specific realm. For client 1.x this implemented by adding version to name in similar way as it look in more recent clients. For enable version show each affected realm must have in `realmflags` set flag 4. For realm work with not officially supported builds (build > last suported) will show version 0.0.0 and correct build value.
This commit is contained in:
parent
88139a7857
commit
822ec31cb9
10 changed files with 157 additions and 78 deletions
|
|
@ -234,6 +234,8 @@ AuthSocket::AuthSocket(ISocketHandler &h) : TcpSocket(h)
|
|||
pPatch = NULL;
|
||||
|
||||
_accountSecurityLevel = SEC_PLAYER;
|
||||
|
||||
_build = 0;
|
||||
}
|
||||
|
||||
/// Close patch file descriptor before leaving
|
||||
|
|
@ -579,22 +581,7 @@ bool AuthSocket::_HandleLogonProof()
|
|||
ibuf.Read((char *)&lp, sizeof(sAuthLogonProof_C));
|
||||
|
||||
///- Check if the client has one of the expected version numbers
|
||||
bool valid_version = false;
|
||||
int accepted_versions[] = EXPECTED_REALMD_CLIENT_BUILD;
|
||||
if (_build >= accepted_versions[0]) // first build is low bound of always accepted range
|
||||
valid_version = true;
|
||||
else
|
||||
{
|
||||
// continue from 1 with explict equal check
|
||||
for(int i = 1; accepted_versions[i]; ++i)
|
||||
{
|
||||
if(_build == accepted_versions[i])
|
||||
{
|
||||
valid_version = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
bool valid_version = FindBuildInfo(_build) != NULL;
|
||||
|
||||
/// <ul><li> If the client has no valid version
|
||||
if(!valid_version)
|
||||
|
|
@ -961,13 +948,30 @@ void AuthSocket::LoadRealmlist(ByteBuffer &pkt, uint32 acctid)
|
|||
else
|
||||
AmountOfCharacters = 0;
|
||||
|
||||
// Show offline state for unsupported client builds
|
||||
uint8 color = (std::find(i->second.realmbuilds.begin(), i->second.realmbuilds.end(), _build) != i->second.realmbuilds.end()) ? i->second.color : 2;
|
||||
color = (i->second.allowedSecurityLevel > _accountSecurityLevel) ? 2 : color;
|
||||
bool ok_build = std::find(i->second.realmbuilds.begin(), i->second.realmbuilds.end(), _build) != i->second.realmbuilds.end();
|
||||
|
||||
RealmBuildInfo const* buildInfo = ok_build ? FindBuildInfo(_build) : NULL;
|
||||
if (!buildInfo)
|
||||
buildInfo = &i->second.realmBuildInfo;
|
||||
|
||||
RealmFlags realmflags = i->second.realmflags;
|
||||
|
||||
// 1.x clients not support explicitly REALM_FLAG_SPECIFYBUILD, so manually form similar name as show in more recent clients
|
||||
std::string name = i->first;
|
||||
if (realmflags & REALM_FLAG_SPECIFYBUILD)
|
||||
{
|
||||
char buf[20];
|
||||
snprintf(buf, 20," (%u,%u,%u)", buildInfo->major_version, buildInfo->minor_version, buildInfo->bugfix_version);
|
||||
name += buf;
|
||||
}
|
||||
|
||||
// Show offline state for unsupported client builds and locked realms (1.x clients not support locked state show)
|
||||
if (!ok_build || (i->second.allowedSecurityLevel >= _accountSecurityLevel))
|
||||
realmflags = RealmFlags(realmflags | REALM_FLAG_OFFLINE);
|
||||
|
||||
pkt << uint32(i->second.icon); // realm type
|
||||
pkt << uint8(color); // if 2, then realm is offline
|
||||
pkt << i->first; // name
|
||||
pkt << uint8(realmflags); // realmflags
|
||||
pkt << name; // name
|
||||
pkt << i->second.address; // address
|
||||
pkt << float(i->second.populationLevel);
|
||||
pkt << uint8(AmountOfCharacters);
|
||||
|
|
@ -1005,14 +1009,26 @@ void AuthSocket::LoadRealmlist(ByteBuffer &pkt, uint32 acctid)
|
|||
else
|
||||
AmountOfCharacters = 0;
|
||||
|
||||
bool ok_build = std::find(i->second.realmbuilds.begin(), i->second.realmbuilds.end(), _build) != i->second.realmbuilds.end();
|
||||
|
||||
RealmBuildInfo const* buildInfo = ok_build ? FindBuildInfo(_build) : NULL;
|
||||
if (!buildInfo)
|
||||
buildInfo = &i->second.realmBuildInfo;
|
||||
|
||||
uint8 lock = (i->second.allowedSecurityLevel > _accountSecurityLevel) ? 1 : 0;
|
||||
|
||||
RealmFlags realmFlags = i->second.realmflags;
|
||||
|
||||
// Show offline state for unsupported client builds
|
||||
uint8 color = (std::find(i->second.realmbuilds.begin(), i->second.realmbuilds.end(), _build) != i->second.realmbuilds.end()) ? i->second.color : 2;
|
||||
if (!ok_build)
|
||||
realmFlags = RealmFlags(realmFlags | REALM_FLAG_OFFLINE);
|
||||
|
||||
if (!buildInfo)
|
||||
realmFlags = RealmFlags(realmFlags & ~REALM_FLAG_SPECIFYBUILD);
|
||||
|
||||
pkt << uint8(i->second.icon); // realm type (this is second column in Cfg_Configs.dbc)
|
||||
pkt << uint8(lock); // flags, if 0x01, then realm locked
|
||||
pkt << uint8(color); // see enum RealmFlags
|
||||
pkt << uint8(realmFlags); // see enum RealmFlags
|
||||
pkt << i->first; // name
|
||||
pkt << i->second.address; // address
|
||||
pkt << float(i->second.populationLevel);
|
||||
|
|
@ -1020,13 +1036,13 @@ void AuthSocket::LoadRealmlist(ByteBuffer &pkt, uint32 acctid)
|
|||
pkt << uint8(i->second.timezone); // realm category (Cfg_Categories.dbc)
|
||||
pkt << uint8(0x2C); // unk, may be realm number/id?
|
||||
|
||||
/*if(realmFlags & REALM_FLAG_SPECIFYBUILD)
|
||||
if (realmFlags & REALM_FLAG_SPECIFYBUILD)
|
||||
{
|
||||
pkt << uint8(0); // major
|
||||
pkt << uint8(0); // minor
|
||||
pkt << uint8(0); // revision
|
||||
pkt << uint16(0); // build
|
||||
}*/
|
||||
pkt << uint8(buildInfo->major_version);
|
||||
pkt << uint8(buildInfo->minor_version);
|
||||
pkt << uint8(buildInfo->bugfix_version);
|
||||
pkt << uint16(_build);
|
||||
}
|
||||
}
|
||||
|
||||
pkt << uint16(0x0010);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue