Merge pull request #10981 from Lillecarl/hookz

Implement OnDamage and OnHeal hooks
This commit is contained in:
Discover- committed 2013-10-04 02:55:23 -07:00
commit 36e6407e24
3 files changed
+24

No files matched your search

+6
View File
@@ -567,6 +567,9 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
if (IsAIEnabled)
GetAI()->DamageDealt(victim, damage, damagetype);
// Hook for OnDamage Event
sScriptMgr->OnDamage(this, victim, damage);
if (victim->GetTypeId() == TYPEID_PLAYER && this != victim)
{
// Signal to pets that their owner was attacked
@@ -9587,6 +9590,9 @@ int32 Unit::DealHeal(Unit* victim, uint32 addhealth)
if (addhealth)
gain = victim->ModifyHealth(int32(addhealth));
// Hook for OnHeal Event
sScriptMgr->OnHeal(this, victim, gain);
Unit* unit = this;
if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsTotem())