mirror of
https://github.com/mangosfour/server.git
synced 2025-12-18 10:37:01 +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
|
|
@ -31,6 +31,36 @@ INSTANTIATE_SINGLETON_1( RealmList );
|
|||
|
||||
extern DatabaseType loginDatabase;
|
||||
|
||||
// will only support WoW 1.12.1/1.12.2 , WoW:TBC 2.4.3 and official release for WoW:WotLK and later, client builds 10505, 8606, 6005, 5875
|
||||
// if you need more from old build then add it in cases in realmd sources code
|
||||
// list sorted from high to low build and first build used as low bound for accepted by default range (any > it will accepted by realmd at least)
|
||||
|
||||
static RealmBuildInfo ExpectedRealmdClientBuilds[] = {
|
||||
{11723, 3, 3, 3, 'a'}, // highest supported build, also auto accept all above for simplify future supported builds testing
|
||||
{11403, 3, 3, 2, ' '},
|
||||
{11159, 3, 3, 0, 'a'},
|
||||
{10505, 3, 2, 2, 'a'},
|
||||
{8606, 2, 4, 3, ' '},
|
||||
{6005, 1,12, 2, ' '},
|
||||
{5875, 1,12, 1, ' '},
|
||||
{0, 0, 0, 0, ' '} // terminator
|
||||
};
|
||||
|
||||
RealmBuildInfo const* FindBuildInfo(uint16 _build)
|
||||
{
|
||||
// first build is low bound of always accepted range
|
||||
if (_build >= ExpectedRealmdClientBuilds[0].build)
|
||||
return &ExpectedRealmdClientBuilds[0];
|
||||
|
||||
// continue from 1 with explicit equal check
|
||||
for(int i = 1; ExpectedRealmdClientBuilds[i].build; ++i)
|
||||
if(_build == ExpectedRealmdClientBuilds[i].build)
|
||||
return &ExpectedRealmdClientBuilds[i];
|
||||
|
||||
// none appropriate build
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RealmList::RealmList( ) : m_UpdateInterval(0), m_NextUpdateTime(time(NULL))
|
||||
{
|
||||
}
|
||||
|
|
@ -50,15 +80,17 @@ void RealmList::Initialize(uint32 updateInterval)
|
|||
UpdateRealms(true);
|
||||
}
|
||||
|
||||
void RealmList::UpdateRealm( uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, const char* builds)
|
||||
void RealmList::UpdateRealm( uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, RealmFlags realmflags, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, const char* builds)
|
||||
{
|
||||
realmflags = RealmFlags(realmflags | REALM_FLAG_SPECIFYBUILD);
|
||||
|
||||
///- Create new if not exist or update existed
|
||||
Realm& realm = m_realms[name];
|
||||
|
||||
realm.m_ID = ID;
|
||||
realm.icon = icon;
|
||||
realm.color = color;
|
||||
realm.timezone = timezone;
|
||||
realm.m_ID = ID;
|
||||
realm.icon = icon;
|
||||
realm.realmflags = realmflags;
|
||||
realm.timezone = timezone;
|
||||
realm.allowedSecurityLevel = allowedSecurityLevel;
|
||||
realm.populationLevel = popu;
|
||||
|
||||
|
|
@ -71,6 +103,19 @@ void RealmList::UpdateRealm( uint32 ID, const std::string& name, const std::stri
|
|||
realm.realmbuilds.insert(build);
|
||||
}
|
||||
|
||||
uint16 first_build = !realm.realmbuilds.empty() ? *realm.realmbuilds.begin() : 0;
|
||||
|
||||
realm.realmBuildInfo.build = first_build;
|
||||
realm.realmBuildInfo.major_version = 0;
|
||||
realm.realmBuildInfo.minor_version = 0;
|
||||
realm.realmBuildInfo.bugfix_version = 0;
|
||||
realm.realmBuildInfo.hotfix_version = ' ';
|
||||
|
||||
if (first_build)
|
||||
if (RealmBuildInfo const* bInfo = FindBuildInfo(first_build))
|
||||
if (bInfo->build == first_build)
|
||||
realm.realmBuildInfo = *bInfo;
|
||||
|
||||
///- Append port to IP address.
|
||||
std::ostringstream ss;
|
||||
ss << address << ":" << port;
|
||||
|
|
@ -96,8 +141,8 @@ void RealmList::UpdateRealms(bool init)
|
|||
{
|
||||
sLog.outDetail("Updating Realm List...");
|
||||
|
||||
//// 0 1 2 3 4 5 6 7 8 9
|
||||
QueryResult *result = loginDatabase.Query( "SELECT id, name, address, port, icon, color, timezone, allowedSecurityLevel, population, realmbuilds FROM realmlist WHERE color <> 3 ORDER BY name" );
|
||||
//// 0 1 2 3 4 5 6 7 8 9
|
||||
QueryResult *result = loginDatabase.Query( "SELECT id, name, address, port, icon, realmflags, timezone, allowedSecurityLevel, population, realmbuilds FROM realmlist WHERE (realmflags & 1) = 0 ORDER BY name" );
|
||||
|
||||
///- Circle through results and add them to the realm map
|
||||
if(result)
|
||||
|
|
@ -108,7 +153,20 @@ void RealmList::UpdateRealms(bool init)
|
|||
|
||||
uint8 allowedSecurityLevel = fields[7].GetUInt8();
|
||||
|
||||
UpdateRealm(fields[0].GetUInt32(), fields[1].GetCppString(),fields[2].GetCppString(),fields[3].GetUInt32(),fields[4].GetUInt8(), fields[5].GetUInt8(), fields[6].GetUInt8(), (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), fields[8].GetFloat(), fields[9].GetString() );
|
||||
uint8 realmflags = fields[5].GetUInt8();
|
||||
|
||||
if (realmflags & ~(REALM_FLAG_NEW_PLAYERS|REALM_FLAG_RECOMMENDED|REALM_FLAG_SPECIFYBUILD))
|
||||
{
|
||||
sLog.outError("Realm allowed have only NEWPLAYERS (mask 0x20), or RECOMENDED (mask 0x40), or SPECIFICBUILD (mask 0x04) flags in DB");
|
||||
realmflags &= (REALM_FLAG_NEW_PLAYERS|REALM_FLAG_RECOMMENDED|REALM_FLAG_SPECIFYBUILD);
|
||||
}
|
||||
|
||||
UpdateRealm(
|
||||
fields[0].GetUInt32(), fields[1].GetCppString(),fields[2].GetCppString(),fields[3].GetUInt32(),
|
||||
fields[4].GetUInt8(), RealmFlags(realmflags), fields[6].GetUInt8(),
|
||||
(allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR),
|
||||
fields[8].GetFloat(), fields[9].GetString());
|
||||
|
||||
if(init)
|
||||
sLog.outString("Added realm \"%s\"", fields[1].GetString());
|
||||
} while( result->NextRow() );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue