All pastes #923373 Raw Edit

Etwas

public cpp v1 · immutable
#923373 ·published 2008-02-29 14:41 UTC
rendered paste body
Index: src/game/SpellAuras.cpp===================================================================--- src/game/SpellAuras.cpp	(revision 5333)+++ src/game/SpellAuras.cpp	(working copy)@@ -305,7 +305,8 @@ m_procCharges(0), m_spellmod(NULL), m_spellId(spellproto->Id), m_effIndex(eff), m_caster_guid(0), m_target(target), m_timeCla(1000), m_castItemGuid(castItem?castItem->GetGUID():0), m_auraSlot(MAX_AURAS), m_positive(false), m_permanent(false), m_isPeriodic(false), m_isTrigger(false), m_isAreaAura(false), m_isPersistent(false),-m_periodicTimer(0), m_PeriodicEventId(0), m_updated(false), m_removeOnDeath(false),m_fearMoveAngle(0), m_isRemovedOnShapeLost(true)+m_periodicTimer(0), m_PeriodicEventId(0), m_updated(false), m_removeOnDeath(false),m_fearMoveAngle(0), m_isRemovedOnShapeLost(true),+m_casters_target_guid(0) {     assert(target); @@ -334,6 +335,7 @@     else     {         m_caster_guid = caster->GetGUID();+        m_casters_target_guid = caster->GetUInt64Value(UNIT_FIELD_TARGET);          damage        = caster->CalculateSpellDamage(m_spellProto,m_effIndex,m_currentBasePoints,target);         m_maxduration = caster->CalculateSpellDuration(m_spellProto);@@ -1077,14 +1079,6 @@         case 29528: trigger_spell_id = 28713; break;        // Inoculation          case 29917: trigger_spell_id = 29916; break;        // Feed Captured Animal-        case  1515:                                         // Tame Beast-        {-            // TODO: currently this used as hack for Tame beast triggered spell,-            // BUT this can be correct way to provide target for ALL this function calls-            // in case m_target==caster (or GetSpellProto()->EffectImplicitTargetA[m_effIndex]==TARGET_SELF )-            target = ObjectAccessor::GetUnit(*m_target, m_target->GetUInt64Value(UNIT_FIELD_TARGET));-            break;-        }         case 1010:                                          // Curse of Idiocy         {             // TODO: spell casted by result in correct way mostly@@ -1153,6 +1147,18 @@         return;     } +    bool hasTargetSingleEnemy = false;+    for (int i = 0; i < 3; ++i)+        hasTargetSingleEnemy |= (triggredSpellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_ENEMY);++    if (hasTargetSingleEnemy)+    {+        target = ObjectAccessor::GetUnit(*m_target, m_casters_target_guid);+        +        if (!target)+            return;+    }+     Spell *spell = new Spell(caster, triggredSpellInfo, true, originalCasterGUID );      SpellCastTargets targets;Index: src/game/SpellAuras.h===================================================================--- src/game/SpellAuras.h	(revision 5333)+++ src/game/SpellAuras.h	(working copy)@@ -272,6 +272,7 @@         int32 m_currentBasePoints;                          // cache SpellEntry::EffectBasePoints and use for set custom base points         uint64 m_caster_guid;         Unit* m_target;+        uint64 m_casters_target_guid;         int32 m_maxduration;         int32 m_duration;         int32 m_timeCla;Index: src/game/SpellEffects.cpp===================================================================--- src/game/SpellEffects.cpp	(revision 5333)+++ src/game/SpellEffects.cpp	(working copy)@@ -1645,26 +1645,6 @@             sLog.outDebug("Spell: Additional Aura is: %u", AdditionalSpellInfo->EffectApplyAuraName[0]);         }     }--    // arcane missiles, do not affect tame beast-    if(Aur->IsTrigger() && m_spellInfo->Id != 1515)-    {-        SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_spellInfo->EffectTriggerSpell[i]);-        if (!spellInfo) return;-        if (m_caster->GetTypeId() == TYPEID_PLAYER && spellInfo->EffectImplicitTargetA[0] == TARGET_SINGLE_ENEMY)-        {-            Unit *target = ObjectAccessor::GetUnit(*m_caster, ((Player*)m_caster)->GetSelection());-            if (target)-            {-                if (!m_caster->IsFriendlyTo(target))-                    Aur->SetTarget(target);-                else-                    cancel();-            }-            else-                cancel();-        }-    } }  void Spell::EffectUnlearnSpecialization( uint32 i )