[8728] Store current realmid for online account in realm Db account table.

* Replace old `account`.`online` field by `account`.`active_realm_id`.
  It have 0 if account offline.

NOTE: this break all scripts that use `online` field for seelct online characters, and it required update.
But from other side this reolve
* Bug with reset online state active realm at restart another realm.
* Let easy select online accounts for some specific realm if need.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Andeeria 2009-10-25 02:38:57 +04:00 committed by VladimirMangos
parent b078ceb76c
commit 8baee4a73f
8 changed files with 15 additions and 9 deletions

View file

@ -460,6 +460,7 @@ bool Master::_StartDB()
sLog.outError("Realm ID not defined in configuration file");
return false;
}
sLog.outString("Realm running as realm ID %d", realmID);
///- Clean the database before starting
@ -477,9 +478,7 @@ void Master::clearOnlineAccounts()
{
// Cleanup online status for characters hosted at current realm
/// \todo Only accounts with characters logged on *this* realm should have online status reset. Move the online column from 'account' to 'realmcharacters'?
loginDatabase.PExecute(
"UPDATE account SET online = 0 WHERE online > 0 "
"AND id IN (SELECT acctid FROM realmcharacters WHERE realmid = '%d')",realmID);
loginDatabase.PExecute("UPDATE account SET active_realm_id = 0 WHERE active_realm_id = '%d'", realmID);
CharacterDatabase.Execute("UPDATE characters SET online = 0 WHERE online<>0");