mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Scripting: Created a hook for when a player is about to be saved.
This commit is contained in:
@@ -1753,7 +1753,8 @@ void Player::Update(uint32 p_time)
|
||||
{
|
||||
if (p_time >= m_nextSave)
|
||||
{
|
||||
// m_nextSave reseted in SaveToDB call
|
||||
// m_nextSave reset in SaveToDB call
|
||||
sScriptMgr->OnPlayerSave(this);
|
||||
SaveToDB();
|
||||
sLog->outDebug(LOG_FILTER_PLAYER, "Player '%s' (GUID: %u) saved", GetName().c_str(), GetGUIDLow());
|
||||
}
|
||||
|
||||
@@ -1241,6 +1241,11 @@ void ScriptMgr::OnPlayerDelete(uint64 guid)
|
||||
FOREACH_SCRIPT(PlayerScript)->OnDelete(guid);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerSave(Player* player)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnSave(player);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerBindToInstance(Player* player, Difficulty difficulty, uint32 mapid, bool permanent)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnBindToInstance(player, difficulty, mapid, permanent);
|
||||
|
||||
@@ -746,6 +746,9 @@ class PlayerScript : public UnitScript
|
||||
// Called when a player is deleted.
|
||||
virtual void OnDelete(uint64 /*guid*/) { }
|
||||
|
||||
// Called whe is a player is about to be saved.
|
||||
virtual void OnSave(Player* /*player*/) { }
|
||||
|
||||
// Called when a player is bound to an instance
|
||||
virtual void OnBindToInstance(Player* /*player*/, Difficulty /*difficulty*/, uint32 /*mapId*/, bool /*permanent*/) { }
|
||||
|
||||
@@ -1022,6 +1025,7 @@ class ScriptMgr
|
||||
void OnPlayerLogout(Player* player);
|
||||
void OnPlayerCreate(Player* player);
|
||||
void OnPlayerDelete(uint64 guid);
|
||||
void OnPlayerSave(Player* player);
|
||||
void OnPlayerBindToInstance(Player* player, Difficulty difficulty, uint32 mapid, bool permanent);
|
||||
void OnPlayerUpdateZone(Player* player, uint32 newZone, uint32 newArea);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user