Implement script hooks: OnDamge, OnHeal

This commit is contained in:
Carl Hjerpe committed 2013-10-01 18:35:09 +02:00
1 parent 586df8d417
commit 8737984b71
3 files changed
+24

No files matched your search

+6
View File
@@ -568,6 +568,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
@@ -9588,6 +9591,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())