[9506] Add missing AI calls to inform summoner of summon-related events

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-03-03 00:24:34 +01:00
parent 3a5f6ff0fb
commit d775eea9a4
4 changed files with 20 additions and 2 deletions

View file

@ -699,6 +699,10 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
// find player: owner of controlled `this` or `this` itself maybe
Player *player = GetCharmerOrOwnerPlayerOrPlayerItself();
// find owner of pVictim, used for creature cases, AI calls
Unit* pOwner = pVictim->GetCharmerOrOwner();
if(pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->GetLootRecipient())
player = ((Creature*)pVictim)->GetLootRecipient();
@ -832,7 +836,11 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
if (pSummoner->AI())
pSummoner->AI()->SummonedCreatureJustDied(cVictim);
}
else if (pOwner && pOwner->GetTypeId() == TYPEID_UNIT)
{
if (((Creature*)pOwner)->AI())
((Creature*)pOwner)->AI()->SummonedCreatureJustDied(cVictim);
}
// Dungeon specific stuff, only applies to players killing creatures
if(cVictim->GetInstanceId())