Core/Scripts: Moved OnPlayerLogout hook call before removing player, fixes crashes in scripts using this hook
--HG-- branch : trunk
This commit is contained in:
@@ -447,6 +447,9 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||||||
sSocialMgr.SendFriendStatus(_player, FRIEND_OFFLINE, _player->GetGUIDLow(), true);
|
sSocialMgr.SendFriendStatus(_player, FRIEND_OFFLINE, _player->GetGUIDLow(), true);
|
||||||
sSocialMgr.RemovePlayerSocial (_player->GetGUIDLow ());
|
sSocialMgr.RemovePlayerSocial (_player->GetGUIDLow ());
|
||||||
|
|
||||||
|
// Call script hook before deletion
|
||||||
|
sScriptMgr.OnPlayerLogout(GetPlayer());
|
||||||
|
|
||||||
///- Remove the player from the world
|
///- Remove the player from the world
|
||||||
// the player may not be in the world when logging out
|
// the player may not be in the world when logging out
|
||||||
// e.g if he got disconnected during a transfer to another map
|
// 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'",
|
CharacterDatabase.PExecute("UPDATE characters SET online = 0 WHERE account = '%u'",
|
||||||
GetAccountId());
|
GetAccountId());
|
||||||
sLog.outDebug("SESSION: Sent SMSG_LOGOUT_COMPLETE Message");
|
sLog.outDebug("SESSION: Sent SMSG_LOGOUT_COMPLETE Message");
|
||||||
sScriptMgr.OnPlayerLogout(GetPlayer());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_playerLogout = false;
|
m_playerLogout = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user