mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 10:05:32 +01:00
[svn] Add function GameObject::CastSpell. Used for hunter's trap and so.
Use original caster instead caster to check spell hit result. Let spell triggers have the same faction as the summoner. Fix the bug that trigger creatures attack enemy. (no need use civilian extra flag in the future, 128 is enough) Fix shadow step. --HG-- branch : trunk
This commit is contained in:
@@ -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());
|
||||
}
|
||||
Reference in New Issue
Block a user