feat(core): Increased limit of realms (#1664)

This commit is contained in:
Pondaveia
2019-04-13 17:07:26 +01:00
committed by Francesco Borzì
parent 135b4470ce
commit c1ebc70b58
4 changed files with 18 additions and 5 deletions

View File

@@ -471,11 +471,21 @@ bool Master::_StartDB()
///- Get the realm Id from the configuration file
realmID = sConfigMgr->GetIntDefault("RealmID", 0);
if (!realmID || realmID > 8) // pussywizard: above 8 spoils 8-bit online mask for the accounts
if (!realmID)
{
sLog->outError("Realm ID not defined in configuration file");
return false;
}
else if (realmID > 255)
{
/*
* Due to the client only being able to read a realmID
* with a size of uint8 we can "only" store up to 255 realms
* anything further the client will behave anormaly
*/
sLog->outError("Realm ID must range from 1 to 255");
return false;
}
sLog->outString("Realm running as realm ID %d", realmID);
///- Initialize the DB logging system
@@ -507,7 +517,7 @@ void Master::ClearOnlineAccounts()
{
// Reset online status for all accounts with characters on the current realm
// pussywizard: tc query would set online=0 even if logged in on another realm >_>
LoginDatabase.DirectPExecute("UPDATE account SET online = online & ~(1<<(%u-1)) WHERE online & (1<<(%u-1))", realmID, realmID);
LoginDatabase.DirectPExecute("UPDATE account SET online = 0 WHERE online = %u", realmID);
// Reset online status for all characters
CharacterDatabase.DirectExecute("UPDATE characters SET online = 0 WHERE online <> 0");