mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[9506] Add missing AI calls to inform summoner of summon-related events
Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
3a5f6ff0fb
commit
d775eea9a4
4 changed files with 20 additions and 2 deletions
|
|
@ -3859,6 +3859,9 @@ void Spell::DoSummon(SpellEffectIndex eff_idx)
|
||||||
spawnCreature->SavePetToDB(PET_SAVE_AS_CURRENT);
|
spawnCreature->SavePetToDB(PET_SAVE_AS_CURRENT);
|
||||||
((Player*)m_caster)->PetSpellInitialize();
|
((Player*)m_caster)->PetSpellInitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI())
|
||||||
|
((Creature*)m_caster)->AI()->JustSummoned((Creature*)spawnCreature);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spell::EffectLearnSpell(SpellEffectIndex eff_idx)
|
void Spell::EffectLearnSpell(SpellEffectIndex eff_idx)
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "SpellMgr.h"
|
#include "SpellMgr.h"
|
||||||
|
#include "CreatureAI.h"
|
||||||
|
|
||||||
Totem::Totem() : Creature(CREATURE_SUBTYPE_TOTEM)
|
Totem::Totem() : Creature(CREATURE_SUBTYPE_TOTEM)
|
||||||
{
|
{
|
||||||
|
|
@ -67,6 +68,9 @@ void Totem::Summon(Unit* owner)
|
||||||
|
|
||||||
AIM_Initialize();
|
AIM_Initialize();
|
||||||
|
|
||||||
|
if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI())
|
||||||
|
((Creature*)owner)->AI()->JustSummoned((Creature*)this);
|
||||||
|
|
||||||
// there are some totems, which exist just for their visual appeareance
|
// there are some totems, which exist just for their visual appeareance
|
||||||
if (!GetSpell())
|
if (!GetSpell())
|
||||||
return;
|
return;
|
||||||
|
|
@ -109,6 +113,9 @@ void Totem::UnSummon()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI())
|
||||||
|
((Creature*)owner)->AI()->SummonedCreatureDespawn((Creature*)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
AddObjectToRemoveList();
|
AddObjectToRemoveList();
|
||||||
|
|
|
||||||
|
|
@ -699,6 +699,10 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
||||||
|
|
||||||
// find player: owner of controlled `this` or `this` itself maybe
|
// find player: owner of controlled `this` or `this` itself maybe
|
||||||
Player *player = GetCharmerOrOwnerPlayerOrPlayerItself();
|
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())
|
if(pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->GetLootRecipient())
|
||||||
player = ((Creature*)pVictim)->GetLootRecipient();
|
player = ((Creature*)pVictim)->GetLootRecipient();
|
||||||
|
|
||||||
|
|
@ -832,7 +836,11 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
||||||
if (pSummoner->AI())
|
if (pSummoner->AI())
|
||||||
pSummoner->AI()->SummonedCreatureJustDied(cVictim);
|
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
|
// Dungeon specific stuff, only applies to players killing creatures
|
||||||
if(cVictim->GetInstanceId())
|
if(cVictim->GetInstanceId())
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "9505"
|
#define REVISION_NR "9506"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue