aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <none@none>2010-10-25 11:17:17 +0200
committerShauren <none@none>2010-10-25 11:17:17 +0200
commitb96a206dc350c1fdac0fdef1c11fea5907e3f509 (patch)
tree17fed50ce8e105a48fd7eda40cd3f913220ade81 /src
parent42065a236e98dbd8a6c87d6463b0488c89cf9957 (diff)
Core/Scripts: Moved OnPlayerLogout hook call before removing player, fixes crashes in scripts using this hook
--HG-- branch : trunk
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Server/WorldSession.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index a03c3570b43..55d1b7cdb6a 100755
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -447,6 +447,9 @@ void WorldSession::LogoutPlayer(bool Save)
sSocialMgr.SendFriendStatus(_player, FRIEND_OFFLINE, _player->GetGUIDLow(), true);
sSocialMgr.RemovePlayerSocial (_player->GetGUIDLow ());
+ // Call script hook before deletion
+ sScriptMgr.OnPlayerLogout(GetPlayer());
+
///- Remove the player from the world
// the player may not be in the world when logging out
// e.g if he got disconnected during a transfer to another map
@@ -466,7 +469,6 @@ void WorldSession::LogoutPlayer(bool Save)
CharacterDatabase.PExecute("UPDATE characters SET online = 0 WHERE account = '%u'",
GetAccountId());
sLog.outDebug("SESSION: Sent SMSG_LOGOUT_COMPLETE Message");
- sScriptMgr.OnPlayerLogout(GetPlayer());
}
m_playerLogout = false;