mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
[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:
parent
b078ceb76c
commit
8baee4a73f
8 changed files with 15 additions and 9 deletions
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
DROP TABLE IF EXISTS `realmd_db_version`;
|
||||
CREATE TABLE `realmd_db_version` (
|
||||
`required_8332_01_realmd_realmcharacters` bit(1) default NULL
|
||||
`required_8728_01_realmd_account` bit(1) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';
|
||||
|
||||
--
|
||||
|
|
@ -54,7 +54,7 @@ CREATE TABLE `account` (
|
|||
`failed_logins` int(11) unsigned NOT NULL default '0',
|
||||
`locked` tinyint(3) unsigned NOT NULL default '0',
|
||||
`last_login` timestamp NOT NULL default '0000-00-00 00:00:00',
|
||||
`online` tinyint(4) NOT NULL default '0',
|
||||
`active_realm_id` int(11) unsigned NOT NULL default '0',
|
||||
`expansion` tinyint(3) unsigned NOT NULL default '0',
|
||||
`mutetime` bigint(40) unsigned NOT NULL default '0',
|
||||
`locale` tinyint(3) unsigned NOT NULL default '0',
|
||||
|
|
|
|||
5
sql/updates/8728_01_realmd_account.sql
Normal file
5
sql/updates/8728_01_realmd_account.sql
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
ALTER TABLE realmd_db_version CHANGE COLUMN required_8332_01_realmd_realmcharacters required_8728_01_realmd_account bit;
|
||||
|
||||
ALTER TABLE account
|
||||
DROP COLUMN online,
|
||||
ADD COLUMN active_realm_id int(11) unsigned NOT NULL default '0' AFTER last_login;
|
||||
|
|
@ -143,6 +143,7 @@ pkgdata_DATA = \
|
|||
8721_01_characters_guild.sql \
|
||||
8723_01_mangos_achievement_criteria_requirement.sql \
|
||||
8726_01_mangos_spell_proc_event.sql \
|
||||
8728_01_realmd_account.sql \
|
||||
README
|
||||
|
||||
## Additional files to include when running 'make dist'
|
||||
|
|
@ -266,4 +267,5 @@ EXTRA_DIST = \
|
|||
8721_01_characters_guild.sql \
|
||||
8723_01_mangos_achievement_criteria_requirement.sql \
|
||||
8726_01_mangos_spell_proc_event.sql \
|
||||
8728_01_realmd_account.sql \
|
||||
README
|
||||
|
|
|
|||
|
|
@ -705,7 +705,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder)
|
|||
pCurrChar->SendInitialPacketsAfterAddToMap();
|
||||
|
||||
CharacterDatabase.PExecute("UPDATE characters SET online = 1 WHERE guid = '%u'", pCurrChar->GetGUIDLow());
|
||||
loginDatabase.PExecute("UPDATE account SET online = 1 WHERE id = '%u'", GetAccountId());
|
||||
loginDatabase.PExecute("UPDATE account SET active_realm_id = %d WHERE id = '%u'", realmID, GetAccountId());
|
||||
pCurrChar->SetInGameTime( getMSTime() );
|
||||
|
||||
// announce group about member online (must be after add to player list to receive announce to self)
|
||||
|
|
|
|||
|
|
@ -375,7 +375,7 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
///- Reset the online field in the account table
|
||||
// no point resetting online in character table here as Player::SaveToDB() will set it to 1 since player has not been removed from world at this stage
|
||||
//No SQL injection as AccountID is uint32
|
||||
loginDatabase.PExecute("UPDATE account SET online = 0 WHERE id = '%u'", GetAccountId());
|
||||
loginDatabase.PExecute("UPDATE account SET active_realm_id = 0 WHERE id = '%u'", GetAccountId());
|
||||
|
||||
///- If the player is in a guild, update the guild roster and broadcast a logout message to other guild members
|
||||
Guild *guild = objmgr.GetGuildById(_player->GetGuildId());
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "8727"
|
||||
#define REVISION_NR "8728"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@
|
|||
#define __REVISION_SQL_H__
|
||||
#define REVISION_DB_CHARACTERS "required_8721_01_characters_guild"
|
||||
#define REVISION_DB_MANGOS "required_8726_01_mangos_spell_proc_event"
|
||||
#define REVISION_DB_REALMD "required_8332_01_realmd_realmcharacters"
|
||||
#define REVISION_DB_REALMD "required_8728_01_realmd_account"
|
||||
#endif // __REVISION_SQL_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue