Jump to content

[11366][Patch] Use original caster as summoner of DynObjects


Schmoozerd

Recommended Posts

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

Fixes wrong faction based targeting of DynObject-Auras

* For which repository revision was the patch created?

11325

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

none afaik

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

me

Example where this makes a difference:

* Supremus, and his summoned flames:

- Supremus - npc 22898, faction = 16

- Supremus Punch Invis Stalker - npc 23095, faction = 1375 (summoned by spell 40126)

factions and used spells have been confirmed by NF.

- Triggered spell for dynobjects: 40255

The triggered dynObjects hit supremus, which is clearly wrong;

Patch:

http://paste2.org/p/1353675

Resp

commit 743cd42bfc66541935d32f4877c755e64f51c629
Author: Schmoozerd <[email protected]>
Date:   Tue Mar 22 13:04:31 2011 +0100

   AreaAura - Add original caster

diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 0eff2aa..178d6ab 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -4005,13 +4005,14 @@ void Spell::EffectPersistentAA(SpellEffectIndex eff_idx)
        modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius);

    DynamicObject* dynObj = new DynamicObject;
-    if (!dynObj->Create(m_caster->GetMap()->GenerateLocalLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, m_spellInfo->Id, eff_idx, m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, m_duration, radius))
+    Unit* caster = GetAffectiveCaster() ? GetAffectiveCaster() : m_caster;
+    if (!dynObj->Create(m_caster->GetMap()->GenerateLocalLowGuid(HIGHGUID_DYNAMICOBJECT), caster, m_spellInfo->Id, eff_idx, m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, m_duration, radius))
    {
        delete dynObj;
        return;
    }

-    m_caster->AddDynObject(dynObj);
+    caster->AddDynObject(dynObj);
    m_caster->GetMap()->Add(dynObj);
}

Link to comment
Share on other sites

×
×
  • 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