Jump to content

[patch][8544] Implementing implicit target 40


Guest qsa
 Share

Recommended Posts

What bug does the patch fix? What features does the patch add?

Implementing implicit target 40

TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT(40) - used in 192 spells - quest related mostly.

Always used with spell effect Activate Object (86) or Dummy (3)

If RequiresSpellFocus is set, it is our target. Else we need to use spell_script_target table.

id    spellname_0
7728    Summon Voidwalker
7729    Summon Succubus
8202    Sapta Sight
8674    Summon Succubus
8712    Summon Felhunter
8898    Sapta Sight
8899    Sapta Sight
8900    Sapta Sight
9221    Summon Voidwalker
9222    Summon Voidwalker
9223    Summon Succubus
9224    Summon Succubus
9735    Sapta Sight
11195    Blow Zul'Farrak Door
11440    Quest - Blow Pirate Ship
11757    Digging for Cobalt
11792    Opening Cage
12512    Kalaran Conjures Torch
12564    Summon Treasure Horde Visual
13727    Break Samophlange
15746    Hatch Rookery Egg
15958    Collect Rookery Egg
16054    Flames of the Black Flight
16447    Spawn Challenge to Urok
16556    Disturb Rookery Egg (FAST)
16558    Destroy Spear
16613    Displacing Temporal Rift
17016    Placing Beacon Torch
17671    Mortar Disturb
17675    Lava Trap 1
17676    Lava Trap 3
17677    Lava Trap 4
18655    Mortar Animate
19571    Destroy Ghost Magnet
19873    Destroy Egg
20037    Explode Orb Effect
21014    Anuniaq's Net
21127    Maraudon Portal
21885    Heal Vylestem Vine
21950    Recite Words of Celebras
23208    Exorcise Spirits
23328    Trigger Trap
23360    Trigger Trap2
24731    Fire Cannon
24734    Summon Templar Random
24744    Summon Templar
24756    Summon Templar
24758    Summon Templar
24760    Summon Templar
24763    Summon Duke Random
24765    Summon Duke
24768    Summon Duke
24770    Summon Duke
24772    Summon Duke
24784    Summon Royal Random
24786    Summon Royal
24788    Summon Royal
24789    Summon Royal
24790    Summon Royal
24871    Spore Cloud
24934    Summon RC Tank
24973    Clean Up Stink Bomb
25005    Summon RC Blimp
26063    Ouro Submerge Visual
26286    Small Red Rocket
26291    Small Blue Rocket
26292    Small Green Rocket
26293    Small Purple Rocket
26294    Small White Rocket
26295    Small Yellow Rocket
26304    Blue Firework Cluster
26325    Green Firework Cluster
26326    Purple Firework Cluster
26327    Red Firework Cluster
26328    White Firework Cluster
26329    Yellow Firework Cluster
26333    Large Blue Rocket
26334    Large Green Rocket
26335    Large Purple Rocket
26336    Large Red Rocket
26337    Large White Rocket
26338    Large Yellow Rocket
26373    Lunar Invitation
26488    Large Blue Firework Cluster
26490    Large Green Firework Cluster
26516    Large Purple Firework Cluster
26517    Large Red Firework Cluster
26518    Large White Firework Cluster
26519    Large Yellow Firework Cluster
26521    Lucky Lunar Rocket
27663    Holiday - Valentine,  gift given
28278    Open Circle
28373    Communique, Necropolis-to-Proxies
29437    Toss Fuel on Bonfire (Activate object effect)
29534    Traces of Silithyst
29866    Cast Fishing Net
30098    Defile Uther's Tomb
31927    Living Fire
32439    Neutral Flag Taken (Horde)
32440    Neutral Flag Taken (Alliance)
33710    Disturb Infernaling Summoner (Portal Hound)
34516    Spread Hellfire Fire
36546    Boil Bleeding Hollow Blood
36639    Test Cauldron Bubble
38053    Tune Deathforge Infernal
38680    Magic Sucker Device Despawner, Buttress, Device
38729    Rod of Purification
40169    Simon Game START, red
40170    Simon Game START, blue
40171    Simon Game START, green
40172    Simon Game START, yellow
40176    Simon Game pre-game Begin, blue
40177    Simon Game pre-game Begin, green
40178    Simon Game pre-game Begin, red
40179    Simon Game pre-game Begin, yellow
40244    Simon Game - Visual - Button Push, Blue
40245    Simon Game - Visual - Button Push, Green
40246    Simon Game - Visual - Button Push, Red
40247    Simon Game - Visual - Button Push, Yellow
40283    Simon Game END, blue
40284    Simon Game END, green
40285    Simon Game END, red
40286    Simon Game END, yellow
40494    Simon Game, switched ON
40495    Simon Game, switched OFF
40499    Simon Game, switched ON, enable Off switch
40512    Simon Game, switched ON, disable Off switch
40632    Summon Gezzarak the Huntress
40640    Summon Karrog
40642    Summon Darkscreecher Akkarai
40644    Summon Vakkiz the Windrager
40957    Blade's Edge Terrace Demon Boss Summon 1
40959    Blade's Edge Terrace Demon Boss Summon 2
40960    Blade's Edge Terrace Demon Boss Summon 3
40961    Blade's Edge Terrace Demon Boss Summon 4
41004    Summon Terokk
41110    Simon Game pre-game Begin, yellow Large
41111    Simon Game pre-game Begin, red Large
41112    Simon Game pre-game Begin, green Large
41113    Simon Game pre-game Begin, blue Large
42178    Headless Horseman - Invisible Campfire, Remove
42287    Salvage Wreckage
42433    Smolderwing Fire Breath
42768    PattyMacDisturb
42868    Fire Cannon
43080    Quest - Howling Fjord - Guide Our Sights - FX Master
43994    Vrykul Harpoon DEBUG
44422    Scavenge
44498    Rocket Jump
44499    Iron Rune Construct Credit 01
44608    Rocket Jump
45119    Holiday - Valentine - Romantic Picnic Near Basket Check
45222    Zul'Aman Object Visual
45226    Banging the Gong
46085    Place Fake Fur
46201    Smash Mammoth Trap
46592    Summon Ahune Lieutenant
46610    Freeze
46638    Break Ice
46652    Open Brutallus Back Door
46903    Stamp Out Bonfire (Art Kit)
46904    Light Bonfire (Art Kit)
46936    Check Flag Cap
46937    Check Flag Cap
47674    Access Control Console
48347    Bombard the Ballistae: FX Master
48794    Cast Net
49022    trapdooropen
49030    trapdoorclose
50790    Summon Iron Dwarf
50791    Summon Iron Dwarf
50802    Summon Malformed Ooze
50803    Summon Malformed Ooze
50825    Summon Earthen Dwarf
50826    Summon Earthen Dwarf
52247    Target Crystal
52365    Split Teleport (Horde) (Boat 1)
52528    Split Teleport (Horde) (Boat 2)
53020    Horn of Fecundity
53464    Split Teleport (Alliance) (Boat 1)
53465    Split Teleport (Alliance) (Boat 2)
54040    [PH] Dalaran Lamp Lighter
54047    Light Lamp
56386    WMO Damaged Test
60535    Light Lamp
61488    Copy of Access Control Console
61524    Teleport the Stalker
61537    Teleport the Stalker
61699    Swipe Easter Egg
62731    PattyMac ActivateTransport
62943    Wind-Up Train Wrecker
63381    Goblin Chisel

For which repository revision was the patch created?

8542

Who has been writing this patch? Please include either forum user names or email addresses.

Me

diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
index d8ac7fb..cf941c0 100644
--- a/src/game/SharedDefines.h
+++ b/src/game/SharedDefines.h
@@ -1035,6 +1035,7 @@ enum Targets
    TARGET_AREAEFFECT_PARTY            = 37,
    TARGET_SCRIPT                      = 38,
    TARGET_SELF_FISHING                = 39,
+    TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT= 40,
    TARGET_TOTEM_EARTH                 = 41,
    TARGET_TOTEM_WATER                 = 42,
    TARGET_TOTEM_AIR                   = 43,
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 3137f39..e450851 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -488,10 +488,13 @@ void Spell::FillTargetMap()
        if(m_spellInfo->Effect[i] == 0)
            continue;

-        // targets for TARGET_SCRIPT_COORDINATES (A) and TARGET_SCRIPT  filled in Spell::CheckCast call
+        // targets for TARGET_SCRIPT_COORDINATES (A) and TARGET_SCRIPT
+        // and TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT (A) if no RequiresSpellFocus set
+        // filled in Spell::CheckCast call
        if( m_spellInfo->EffectImplicitTargetA[i] == TARGET_SCRIPT_COORDINATES ||
            m_spellInfo->EffectImplicitTargetA[i] == TARGET_SCRIPT ||
-            m_spellInfo->EffectImplicitTargetB[i] == TARGET_SCRIPT && m_spellInfo->EffectImplicitTargetA[i] != TARGET_SELF )
+            (m_spellInfo->EffectImplicitTargetA[i] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT && !m_spellInfo->RequiresSpellFocus) ||
+            (m_spellInfo->EffectImplicitTargetB[i] == TARGET_SCRIPT && m_spellInfo->EffectImplicitTargetA[i] != TARGET_SELF) )
            continue;

        // TODO: find a way so this is not needed?
@@ -1313,6 +1316,31 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)

    switch(targetMode)
    {
+        case TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT:
+        {
+            if(m_spellInfo->RequiresSpellFocus)
+            {
+                CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY()));
+                Cell cell(p);
+                cell.data.Part.reserved = ALL_DISTRICT;
+
+                GameObject* goTarget = NULL;
+                MaNGOS::GameObjectFocusCheck go_check(m_caster, m_spellInfo->RequiresSpellFocus);
+                MaNGOS::GameObjectSearcher<MaNGOS::GameObjectFocusCheck> checker(m_caster, goTarget, go_check);
+
+                TypeContainerVisitor<MaNGOS::GameObjectSearcher<MaNGOS::GameObjectFocusCheck>, GridTypeMapContainer > object_checker(checker);
+                CellLock<GridReadGuard> cell_lock(cell, p);
+                Map& map = *m_caster->GetMap();
+                cell_lock->Visit(cell_lock, object_checker, map, *m_caster, map.GetVisibilityDistance());
+
+                if(goTarget)
+                    AddGOTarget(goTarget, effIndex);
+            }
+            else if(m_targets.getGOTarget())
+                AddGOTarget(m_targets.getGOTarget(), effIndex);
+
+            break;
+        }
        case TARGET_RANDOM_NEARBY_LOC:
            radius *= sqrt(rand_norm()); // Get a random point in circle. Use sqrt(rand) to correct distribution when converting polar to Cartesian coordinates.
                                         // no 'break' expected since we use code in case TARGET_RANDOM_CIRCUMFERENCE_POINT!!!
@@ -1346,7 +1374,6 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)

            break;
        }
-
        case TARGET_TOTEM_EARTH:
        case TARGET_TOTEM_WATER:
        case TARGET_TOTEM_AIR:
@@ -4104,8 +4131,10 @@ SpellCastResult Spell::CheckCast(bool strict)
            if( m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT ||
                m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT && m_spellInfo->EffectImplicitTargetA[j] != TARGET_SELF ||
                m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES ||
-                m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT_COORDINATES )
+                m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT_COORDINATES ||
+                m_spellInfo->EffectImplicitTargetA[j] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT )
            {
+
                SpellScriptTargetBounds bounds = spellmgr.GetSpellScriptTargetBounds(m_spellInfo->Id);
                if(bounds.first==bounds.second)
                    sLog.outErrorDb("Spell (ID: %u) has effect EffectImplicitTargetA/EffectImplicitTargetB = TARGET_SCRIPT or TARGET_SCRIPT_COORDINATES, but does not have record in `spell_script_target`",m_spellInfo->Id);
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index 7bc2f86..7e7bb7d 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -2125,7 +2125,9 @@ void SpellMgr::LoadSpellScriptTarget()
            if( spellProto->EffectImplicitTargetA[i]==TARGET_SCRIPT ||
                spellProto->EffectImplicitTargetB[i]==TARGET_SCRIPT ||
                spellProto->EffectImplicitTargetA[i]==TARGET_SCRIPT_COORDINATES ||
-                spellProto->EffectImplicitTargetB[i]==TARGET_SCRIPT_COORDINATES )
+                spellProto->EffectImplicitTargetB[i]==TARGET_SCRIPT_COORDINATES ||
+                spellProto->EffectImplicitTargetA[i]==TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT ||
+                spellProto->EffectImplicitTargetB[i]==TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT )
            {
                targetfound = true;
                break;
@@ -2133,7 +2135,7 @@ void SpellMgr::LoadSpellScriptTarget()
        }
        if(!targetfound)
        {
-            sLog.outErrorDb("Table `spell_script_target`: spellId %u listed for TargetEntry %u does not have any implicit target TARGET_SCRIPT(38) or TARGET_SCRIPT_COORDINATES (46).",spellId,targetEntry);
+            sLog.outErrorDb("Table `spell_script_target`: spellId %u listed for TargetEntry %u does not have any implicit target TARGET_SCRIPT(38) or TARGET_SCRIPT_COORDINATES (46) or TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT (40).",spellId,targetEntry);
            continue;
        }

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use