feat(Core/GameObject): Implement OnGameObjectModifyHealth() hook (#17374)

This commit is contained in:
KJack
2023-09-28 16:39:57 -04:00
committed by GitHub
parent 2779833768
commit c25d0b38e8
3 changed files with 30 additions and 1 deletions

View File

@@ -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);