*Fix a bug that JustSummoned is not called and all related script bugs.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-04-12 11:25:55 -05:00
parent cb5b56785f
commit 6a59c3e6a4
+13 -13
View File
@@ -176,10 +176,22 @@ void TempSummon::InitSummon(uint32 duration)
if(m_type == TEMPSUMMON_MANUAL_DESPAWN)
m_type = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN;
Unit* owner = GetSummoner();
if(owner)
{
if(owner->GetTypeId()==TYPEID_UNIT && ((Creature*)owner)->IsAIEnabled)
((Creature*)owner)->AI()->JustSummoned(this);
if(GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER && m_spells[0])
{
setFaction(owner->getFaction());
CastSpell(this, m_spells[0], false, 0, 0, m_summonerGUID);
}
}
if(!m_Properties)
return;
Unit* owner = GetSummoner();
if(uint32 slot = m_Properties->Slot)
{
if(owner)
@@ -194,18 +206,6 @@ void TempSummon::InitSummon(uint32 duration)
}
}
if(owner)
{
if(owner->GetTypeId()==TYPEID_UNIT && ((Creature*)owner)->IsAIEnabled)
((Creature*)owner)->AI()->JustSummoned(this);
if(GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER && m_spells[0])
{
setFaction(owner->getFaction());
CastSpell(this, m_spells[0], false, 0, 0, m_summonerGUID);
}
}
if(m_Properties->Faction)
setFaction(m_Properties->Faction);
}