diff options
author | _manuel_ <manue.l@live.com.ar> | 2010-12-03 14:23:49 -0300 |
---|---|---|
committer | _manuel_ <manue.l@live.com.ar> | 2010-12-03 14:23:49 -0300 |
commit | ada9c4ae98be890624ed68dc8f7ca62feb99a708 (patch) | |
tree | 01fa4e7e5c7de1c262847010387cf7193e9972c7 | |
parent | e0c992a8ba499d3ae7302d134017593f4ee6dae5 (diff) |
Core/CreatureAI: Implemented SummonedCreatureDies function for scripting, it is called when the summoner's summon dies.
--HG--
branch : trunk
-rwxr-xr-x | src/server/game/AI/CreatureAI.h | 1 | ||||
-rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h index 7be9290a732..e1067dadd88 100755 --- a/src/server/game/AI/CreatureAI.h +++ b/src/server/game/AI/CreatureAI.h @@ -106,6 +106,7 @@ class CreatureAI : public UnitAI virtual void IsSummonedBy(Unit * /*summoner*/) {} virtual void SummonedCreatureDespawn(Creature* /*unit*/) {} + virtual void SummonedCreatureDies(Creature* /*unit*/, Unit* /*killer*/) {} // Called when hit by a spell virtual void SpellHit(Unit*, const SpellEntry*) {} diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index b88021cbb50..58829667ae6 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -15194,6 +15194,15 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss) // Call creature just died function if (creature->IsAIEnabled) creature->AI()->JustDied(this); + + if (creature->ToTempSummon()) + { + if (Unit* pSummoner = creature->ToTempSummon()->GetSummoner()) + { + if (pSummoner->ToCreature() && pSummoner->ToCreature()->IsAIEnabled) + pSummoner->ToCreature()->AI()->SummonedCreatureDies(creature, this); + } + } // Dungeon specific stuff, only applies to players killing creatures if (creature->GetInstanceId()) |