mirror of
https://github.com/araxiaonline/TrinityCore2.git
synced 2026-06-17 05:19:40 -04:00
Core/ScriptMgr: Add OnBindToInstance Player hook
--HG-- branch : trunk
This commit is contained in:
@@ -17595,6 +17595,7 @@ InstancePlayerBind* Player::BindToInstance(InstanceSave *save, bool permanent, b
|
||||
bind.perm = permanent;
|
||||
if (!load)
|
||||
sLog.outDebug("Player::BindToInstance: %s(%d) is now bound to map %d, instance %d, difficulty %d", GetName(), GetGUIDLow(), save->GetMapId(), save->GetInstanceId(), save->GetDifficulty());
|
||||
sScriptMgr->OnPlayerBindToInstance(this, save->GetDifficulty(), save->GetMapId(), permanent);
|
||||
return &bind;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1191,6 +1191,11 @@ void ScriptMgr::OnPlayerDelete(uint64 guid)
|
||||
FOREACH_SCRIPT(PlayerScript)->OnDelete(guid);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerBindToInstance(Player* player, Difficulty difficulty, uint32 mapid, bool permanent)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnBindToInstance(player, difficulty, mapid, permanent);
|
||||
}
|
||||
|
||||
// Guild
|
||||
void ScriptMgr::OnGuildAddMember(Guild *guild, Player *player, uint8& plRank)
|
||||
{
|
||||
|
||||
@@ -709,6 +709,9 @@ class PlayerScript : public ScriptObject
|
||||
// Called when a player is created/deleted
|
||||
virtual void OnCreate(Player* /*player*/) { }
|
||||
virtual void OnDelete(uint64 /*guid*/) { }
|
||||
|
||||
// Called when a player is binded to an instance
|
||||
virtual void OnBindToInstance(Player* /*player*/, Difficulty /*difficulty*/, uint32 /*mapid*/, bool /*permanent*/) { }
|
||||
};
|
||||
|
||||
class GuildScript : public ScriptObject
|
||||
@@ -943,6 +946,7 @@ class ScriptMgr
|
||||
void OnPlayerLogout(Player* player);
|
||||
void OnPlayerCreate(Player* player);
|
||||
void OnPlayerDelete(uint64 guid);
|
||||
void OnPlayerBindToInstance(Player* player, Difficulty difficulty, uint32 mapid, bool permanent);
|
||||
|
||||
public: /* GuildScript */
|
||||
void OnGuildAddMember(Guild *guild, Player *player, uint8& plRank);
|
||||
|
||||
Reference in New Issue
Block a user