From 6a59c3e6a42caffe526e474461b5b9d411a22407 Mon Sep 17 00:00:00 2001 From: megamage Date: Sun, 12 Apr 2009 11:25:55 -0500 Subject: *Fix a bug that JustSummoned is not called and all related script bugs. --HG-- branch : trunk --- src/game/TemporarySummon.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/game/TemporarySummon.cpp b/src/game/TemporarySummon.cpp index acf0dbc78ba..c87ad91ff90 100644 --- a/src/game/TemporarySummon.cpp +++ b/src/game/TemporarySummon.cpp @@ -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); } -- cgit v1.2.3