diff options
Diffstat (limited to 'src/game/GameObject.cpp')
-rw-r--r-- | src/game/GameObject.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 2a5b9fb1867..57d206fa1aa 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -341,9 +341,10 @@ void GameObject::Update(uint32 /*p_time*/) if (ok) { - Unit *caster = owner ? owner : ok; + //Unit *caster = owner ? owner : ok; - caster->CastSpell(ok, goInfo->trap.spellId, true); + //caster->CastSpell(ok, goInfo->trap.spellId, true); + CastSpell(ok, goInfo->trap.spellId); m_cooldownTime = time(NULL) + 4; // 4 seconds if(NeedDespawn) @@ -1263,3 +1264,16 @@ void GameObject::Use(Unit* user) spell->prepare(&targets); } + +void GameObject::CastSpell(Unit* target, uint32 spell) +{ + //summon world trigger + Creature *trigger = SummonCreature(12999, GetPositionX(), GetPositionY(), GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 1); + if(!trigger) return; + + Unit *owner = GetOwner(); + if(owner) trigger->setFaction(owner->getFaction()); + else trigger->setFaction(14); + trigger->SetVisibility(VISIBILITY_OFF); //should this be true? + trigger->CastSpell(target, spell, true, 0, 0, owner->GetGUID()); +}
\ No newline at end of file |