All pastes #894707 Raw Edit

Mangos tageting fixes revision 5

public diff v1 · immutable
·published 2008-02-07 05:17 UTC
rendered paste body
Index: src/game/SharedDefines.h===================================================================--- src/game/SharedDefines.h	(revision 5157)+++ src/game/SharedDefines.h	(working copy)@@ -528,6 +528,7 @@     TARGET_ALL_FRIENDLY_UNITS_AROUND_CASTER = 30,           // in TargetB used only with TARGET_ALL_AROUND_CASTER and in self casting range in TargetA     TARGET_MINION                      = 32,     TARGET_ALL_PARTY                   = 33,+    TARGET_ALL_PARTY_AROUND_CASTER_2   = 34,     TARGET_SINGLE_PARTY                = 35,     TARGET_AREAEFFECT_PARTY            = 37,     TARGET_SCRIPT                      = 38,@@ -542,6 +543,7 @@     TARGET_CURRENT_SELECTED_ENEMY      = 53,                // if used in A and B==16 then enemy and nearest enemies, in B no visible affect different from provided A     TARGET_SINGLE_FRIEND_2             = 57,     TARGET_AREAEFFECT_PARTY_AND_CLASS  = 61,+    TARGET_SET_POINT                   = 76,                // used in AoE spells (Blizzard, Hurricane, etc.) where a peristent dummy aura marks the point.     TARGET_SINGLE_ENEMY                = 77, }; Index: src/game/SpellAuras.cpp===================================================================--- src/game/SpellAuras.cpp	(revision 5157)+++ src/game/SpellAuras.cpp	(working copy)@@ -1113,11 +1113,15 @@         }     } -    if(!trigger_spell_id)+    SpellEntry const *proto = sSpellStore.LookupEntry(trigger_spell_id);+    if(!proto)     {-        sLog.outError("Aura::TriggerSpell: Spell %u have 0 in EffectTriggered[%d], not handled custom case?",GetSpellProto()->Id,GetEffIndex());+        sLog.outError("Aura::TriggerSpell: Unknown spell %u", trigger_spell_id);         return;     }+    +    if(proto->EffectImplicitTargetA[m_effIndex] == TARGET_SELF) //Specific check for target_self+        caster = target;                      if(!caster || !target)         return;Index: src/game/Spell.cpp===================================================================--- src/game/Spell.cpp	(revision 5157)+++ src/game/Spell.cpp	(working copy)@@ -999,25 +999,53 @@             // targets the ground, not the units in the area             if (m_spellInfo->Effect[i]!=SPELL_EFFECT_PERSISTENT_AREA_AURA)             {-                CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY()));+                WorldObject *ref = m_caster;++                //Special case for some AoE spells, was changed that way because of area damage caps+                if(m_triggeredByAuraSpell && m_spellInfo->EffectImplicitTargetA[i] == TARGET_SET_POINT)+                {+                    DynamicObject *point = m_caster->GetDynObject(m_triggeredByAuraSpell->Id, 0);+                    if(point)+                        ref = point;+                }+                else if (m_targets.m_destX && m_targets.m_destY && m_targets.m_destZ)+                {+                        //sLog.outError("Area Spell %u  X:%u Y:%u",m_spellInfo->Id,m_targets.m_destX,m_targets.m_destY);+                        int32 duration = GetDuration(m_spellInfo);+                        DynamicObject* dynObj = new DynamicObject(m_caster);+                        if(!dynObj->Create(objmgr.GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, m_spellInfo->Id, i, m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, duration, radius))+                        {+                            delete dynObj;+                            return;+                        }+                        if(dynObj)+                        {+                           // m_caster->AddDynObject(dynObj);+                           // MapManager::Instance().GetMap(dynObj->GetMapId(), dynObj)->Add(dynObj);+                            ref = dynObj;+                        }+                }+                CellPair p(MaNGOS::ComputeCellPair(ref->GetPositionX(), ref->GetPositionY()));                 Cell cell(p);                 cell.data.Part.reserved = ALL_DISTRICT;                 cell.SetNoCreate(); -                MaNGOS::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, PUSH_DEST_CENTER,SPELL_TARGETS_AOE_DAMAGE);+                MaNGOS::AnyAoETargetUnitInObjectRangeCheck u_check(ref, m_caster, radius);+                MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck> searcher(TagUnitMap, u_check); -                TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_object_notifier(notifier);-                TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, GridTypeMapContainer >  grid_object_notifier(notifier);+                TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher);+                TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer >  grid_unit_searcher(searcher);                  CellLock<GridReadGuard> cell_lock(cell, p);-                cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));-                cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));+                cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));+                cell_lock->Visit(cell_lock, grid_unit_searcher, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));                  // exclude caster (this can be important if this not original caster)                 TagUnitMap.remove(m_caster);             }         }break;         case TARGET_ALL_PARTY_AROUND_CASTER:+        case TARGET_ALL_PARTY_AROUND_CASTER_2:         case TARGET_ALL_PARTY:         {             Unit* owner = m_caster->GetCharmerOrOwner();