Jump to content

[patch] Spelleffectradius For Trap Search (chest/button/goober))


Guest Ramses
 Share

Recommended Posts

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

Traps linked with Chests,Buttons,Goobers do only trigger when standing on top of Gameobject

For which SubVersion revision was the patch created?

6126

Is there a thread in the bug report section? If yes, please add a link to the thread.

did not find one, too much hunter trap threads

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

Ramses

Additional info:

All spells associated with GO type 6 in my DB have SpellRange = 0, so it is not reasonable to use range for searching a trap in distance to player.

So I changed GameObject::TriggeringLinkedGameObject to use SpellEffectRadius for searching a trap in distance of player.

This patch may cause traps with e.g. AoE dmg effects to cast the damage around player,

the current code does this also, but with this patch the distance between player and trap increases.

But imo this is a better solution than having traps not triggered cause player is to far away while standing beside the trap.

This patch may get useless if GO casting is added, the trap can cast the spell and the targetMap may be filled correctly.

If then spell is still casted by GO on player, and casters (GO) position is used as base for filling the target map, this patch will still be correct for check, if a player can be affected by a linked trap.

http://pastebin.ca/1050221

Index: src/game/GameObject.cpp
===================================================================
--- src/game/GameObject.cpp         (revision 6126)
+++ src/game/GameObject.cpp         (working copy)
@@ -752,8 +752,17 @@
        if(!trapSpell)                                                                                    // checked at load already
                return;

-        float range = GetSpellMaxRange(sSpellRangeStore.LookupEntry(trapSpell->rangeIndex));
-
+        //all spells associated with GO type 6 have range 0 yards (self), use effect radius for trap search
+        float distance = 0.0f;
+        float radius;
+        //search largest Effect Radius
+        for (int i = 0; i < 3; i++)
+        {
+             radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(trapSpell->EffectRadiusIndex[i]));
+             if ( radius    > distance ) distance = radius;
+        }
+        
+        sLog.outDebug("Triggering trap [id: %u] with Spell [entry:%u] in distance %f yards",trapEntry,trapInfo->trap.spellId, distance);
        // search nearest linked GO
        GameObject* trapGO = NULL;
        {
@@ -762,7 +771,7 @@
                Cell cell(p);
                cell.data.Part.reserved = ALL_DISTRICT;

-                MaNGOS::NearestGameObjectEntryInObjectRangeCheck go_check(*target,trapEntry,range);
+                MaNGOS::NearestGameObjectEntryInObjectRangeCheck go_check(*target,trapEntry,distance);
                MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck> checker(trapGO,go_check);

                TypeContainerVisitor<MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck>, GridTypeMapContainer > object_checker(checker);
@@ -774,6 +783,7 @@
        // FIXME: when GO casting will be implemented trap must cast spell to target
        if(trapGO)
                target->CastSpell(target,trapSpell,true);
+        else sLog.outDebug("Trap [id: %u] not found in distance %f yards",trapEntry, distance);
}

GameObject* GameObject::LookupFishingHoleAround(float range)

Link to comment
Share on other sites

  • 3 years later...
 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