diff --git a/src/game/CreatureAI.h b/src/game/CreatureAI.h index 423f2b66f..99d2439bf 100644 --- a/src/game/CreatureAI.h +++ b/src/game/CreatureAI.h @@ -101,6 +101,9 @@ class MANGOS_DLL_SPEC CreatureAI // Called when the creature kills a unit virtual void KilledUnit(Unit *) {} + // Called when owner of m_creature (if m_creature is PROTECTOR_PET) kills a unit + virtual void OwnerKilledUnit(Unit *) {} + // Called when the creature summon successfully other creature virtual void JustSummoned(Creature* ) {} diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 8cd90df5f..a687bc79d 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -785,7 +785,18 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa // Call KilledUnit for creatures if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->AI()) + { ((Creature*)this)->AI()->KilledUnit(pVictim); + } + else if (GetTypeId() == TYPEID_PLAYER) + { + // currently not known if other pet types (not controllable) may have some action at owner kills + if (Pet* pProtector = GetProtectorPet()) + { + if (pProtector->AI()) + pProtector->AI()->OwnerKilledUnit(pVictim); + } + } // achievement stuff if (pVictim->GetTypeId() == TYPEID_PLAYER) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 6464258ca..a52843adb 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10740" + #define REVISION_NR "10741" #endif // __REVISION_NR_H__