mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 03:15:41 +00:00
feat(Core/GameObject): Implement OnGameObjectModifyHealth() hook (#17374)
This commit is contained in:
@@ -160,6 +160,21 @@ void ScriptMgr::OnGameObjectDamaged(GameObject* go, Player* player)
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptMgr::OnGameObjectModifyHealth(GameObject* go, Unit* attackerOrHealer, int32& change, SpellInfo const* spellInfo)
|
||||
{
|
||||
ASSERT(go);
|
||||
|
||||
ExecuteScript<AllGameObjectScript>([&](AllGameObjectScript* script)
|
||||
{
|
||||
script->OnGameObjectModifyHealth(go, attackerOrHealer, change, spellInfo);
|
||||
});
|
||||
|
||||
if (auto tempScript = ScriptRegistry<GameObjectScript>::GetScriptById(go->GetScriptId()))
|
||||
{
|
||||
tempScript->OnModifyHealth(go, attackerOrHealer, change, spellInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptMgr::OnGameObjectLootStateChanged(GameObject* go, uint32 state, Unit* unit)
|
||||
{
|
||||
ASSERT(go);
|
||||
|
||||
@@ -705,6 +705,9 @@ public:
|
||||
// Called when the game object is damaged (destructible buildings only).
|
||||
virtual void OnGameObjectDamaged(GameObject* /*go*/, Player* /*player*/) { }
|
||||
|
||||
// Called when the health of a game object is modified (destructible buildings only).
|
||||
virtual void OnGameObjectModifyHealth(GameObject* /*go*/, Unit* /*attackerOrHealer*/, int32& /*change*/, SpellInfo const* /*spellInfo*/) { }
|
||||
|
||||
// Called when the game object loot state is changed.
|
||||
virtual void OnGameObjectLootStateChanged(GameObject* /*go*/, uint32 /*state*/, Unit* /*unit*/) { }
|
||||
|
||||
@@ -787,6 +790,9 @@ public:
|
||||
// Called when the game object is damaged (destructible buildings only).
|
||||
virtual void OnDamaged(GameObject* /*go*/, Player* /*player*/) { }
|
||||
|
||||
// Called when the health of a game object is modified (destructible buildings only).
|
||||
virtual void OnModifyHealth(GameObject* /*go*/, Unit* /*attackerOrHealer*/, int32& /*change*/, SpellInfo const* /*spellInfo*/) { }
|
||||
|
||||
// Called when the game object loot state is changed.
|
||||
virtual void OnLootStateChanged(GameObject* /*go*/, uint32 /*state*/, Unit* /*unit*/) { }
|
||||
|
||||
@@ -2228,6 +2234,7 @@ public: /* GameObjectScript */
|
||||
uint32 GetDialogStatus(Player* player, GameObject* go);
|
||||
void OnGameObjectDestroyed(GameObject* go, Player* player);
|
||||
void OnGameObjectDamaged(GameObject* go, Player* player);
|
||||
void OnGameObjectModifyHealth(GameObject* go, Unit* attackerOrHealer, int32& change, SpellInfo const* spellInfo);
|
||||
void OnGameObjectLootStateChanged(GameObject* go, uint32 state, Unit* unit);
|
||||
void OnGameObjectStateChanged(GameObject* go, uint32 state);
|
||||
void OnGameObjectUpdate(GameObject* go, uint32 diff);
|
||||
|
||||
Reference in New Issue
Block a user