Skip to content

Instantly share code, notes, and snippets.

@Emtec
Created October 24, 2009 21:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Emtec/217753 to your computer and use it in GitHub Desktop.
Save Emtec/217753 to your computer and use it in GitHub Desktop.
diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp
index 20ac51d..1ca5f3c 100644
--- a/src/game/CharacterHandler.cpp
+++ b/src/game/CharacterHandler.cpp
-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 online = 1, ActiveRealmID = %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)
diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp
index 30cba2c..bdbc98f 100644
--- a/src/game/WorldSession.cpp
+++ b/src/game/WorldSession.cpp
-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 online = 0, ActiveRealmID = 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());
diff --git a/src/mangosd/Master.cpp b/src/mangosd/Master.cpp
index 68113ee..e0a8300 100644
--- a/src/mangosd/Master.cpp
+++ b/src/mangosd/Master.cpp
-478,8 +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);
+ "UPDATE account SET online = 0, ActiveRealmID = 0 WHERE online > 0 AND ActiveRealmID = '%d'", realmID);
CharacterDatabase.Execute("UPDATE characters SET online = 0 WHERE online<>0");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment