Show
Ignore:
Timestamp:
11/19/08 13:40:25 (17 years ago)
Author:
yumileroy
Message:

[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.

Original author: megamage
Date: 2008-11-02 00:59:44-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/GameObject.cpp

    r120 r145  
    342342                if (ok) 
    343343                { 
    344                     Unit *caster =  owner ? owner : ok; 
    345  
    346                     caster->CastSpell(ok, goInfo->trap.spellId, true); 
     344                    //Unit *caster =  owner ? owner : ok; 
     345 
     346                    //caster->CastSpell(ok, goInfo->trap.spellId, true); 
     347                    CastSpell(ok, goInfo->trap.spellId); 
    347348                    m_cooldownTime = time(NULL) + 4;        // 4 seconds 
    348349 
     
    12641265    spell->prepare(&targets); 
    12651266} 
     1267 
     1268void GameObject::CastSpell(Unit* target, uint32 spell) 
     1269{ 
     1270    //summon world trigger 
     1271    Creature *trigger = SummonCreature(12999, GetPositionX(), GetPositionY(), GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 1); 
     1272    if(!trigger) return; 
     1273 
     1274    Unit *owner = GetOwner(); 
     1275    if(owner) trigger->setFaction(owner->getFaction()); 
     1276    else trigger->setFaction(14); 
     1277    trigger->SetVisibility(VISIBILITY_OFF); //should this be true? 
     1278    trigger->CastSpell(target, spell, true, 0, 0, owner->GetGUID()); 
     1279}