Jump to content

[patch] Extend Aura Duration


Sarjuuk
 Share

Recommended Posts

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

  • * Adds a counter to the SpellAura-Object. This is used to fix four Glyphes, that extend the duration of one or more specific Auras by a set amount, if hit by a special spell.
    * Implements those four Glyphs of..:

  1. * Scourge Strike* Shred* Starfire* Backstab

For which repository revision was the patch created?

r8630

Is there a thread in the bug report section or at lighthouse?

found none

Who has been writing this patch?

Sarjuuk

Patch

DELETE FROM `spell_proc_event` WHERE `entry` IN (54845, 54815, 56800, 58642);
INSERT INTO `spell_proc_event` VALUES
(54845, 0, 7, 4, 0, 0, 196608, 0, 0, 100, 0), -- Starfire extends Moonfire
(54815, 0, 7, 32768, 0, 0, 69904, 0, 0, 100, 0), -- Shred extends Rip
(56800, 0, 8, 8388612, 0, 0, 69904, 0, 0, 100, 0), -- Backstab extends Rupture
(58642, 0, 15, 0, 134217728, 0, 69904, 0, 0, 100, 0); -- Scourge Strike extends Diseases

diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 27d2e74..5b0d396 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -383,6 +383,8 @@ m_isRemovedOnShapeLost(true), m_in_use(0), m_deleted(false)

    m_applyTime = time(NULL);

+    m_durationExtends = 3;                                  // Aura Duration may be extended by up to three times
+
    int32 damage;
    if(!caster)
    {
diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
index 3973382..28ac91c 100644
--- a/src/game/SpellAuras.h
+++ b/src/game/SpellAuras.h
@@ -234,7 +234,7 @@ class MANGOS_DLL_SPEC Aura
        void SetAuraDuration(int32 duration) { m_duration = duration; }
        time_t GetAuraApplyTime() { return m_applyTime; }

-        SpellModifier *getAuraSpellMod() {return m_spellmod; }
+        SpellModifier *getAuraSpellMod() { return m_spellmod; }

        uint64 const& GetCasterGUID() const { return m_caster_guid; }
        Unit* GetCaster() const;
@@ -277,11 +277,14 @@ class MANGOS_DLL_SPEC Aura
        void SetAura(bool remove) { m_target->SetVisibleAura(m_auraSlot, remove ? 0 : GetId()); }
        void SendAuraUpdate(bool remove);

-        int8 GetStackAmount() {return m_stackAmount;}
+        int8 GetStackAmount() { return m_stackAmount; }
        void SetStackAmount(uint8 num);
        bool modStackAmount(int32 num); // return true if last charge dropped
        void RefreshAura();

+        int8 GetDurationExtends() { return m_durationExtends; }
+        void UpdateDurationExtends() { m_durationExtends -= m_durationExtends ? 1 : 0; }
+
        bool IsPositive() { return m_positive; }
        void SetNegative() { m_positive = false; }
        void SetPositive() { m_positive = true; }
@@ -293,8 +296,8 @@ class MANGOS_DLL_SPEC Aura
        bool IsPersistent() const { return m_isPersistent; }
        bool IsDeathPersistent() const { return m_isDeathPersist; }
        bool IsRemovedOnShapeLost() const { return m_isRemovedOnShapeLost; }
-        bool IsInUse() const { return m_in_use;}
-        bool IsDeleted() const { return m_deleted;}
+        bool IsInUse() const { return m_in_use; }
+        bool IsDeleted() const { return m_deleted; }

        void SetInUse(bool state)
        {
@@ -312,8 +315,8 @@ class MANGOS_DLL_SPEC Aura
        void _AddAura();
        bool _RemoveAura();

-        bool IsSingleTarget() {return m_isSingleTargetAura;}
-        void SetIsSingleTarget(bool val) { m_isSingleTargetAura = val;}
+        bool IsSingleTarget() { return m_isSingleTargetAura; }
+        void SetIsSingleTarget(bool val) { m_isSingleTargetAura = val; }

        void SetRemoveMode(AuraRemoveMode mode) { m_removeMode = mode; }

@@ -369,6 +372,7 @@ class MANGOS_DLL_SPEC Aura
        uint8 m_auraLevel;                                  // Aura level (store caster level for correct show level dep amount)
        uint8 m_procCharges;                                // Aura charges (0 for infinite)
        uint8 m_stackAmount;                                // Aura stack amount
+        uint8 m_durationExtends;                            // Remaining Aura extends

        bool m_positive:1;
        bool m_permanent:1;
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index b803a90..07444ee 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -4820,12 +4820,40 @@ void Spell::EffectScriptEffect(uint32 effIndex)
{
    // TODO: we must implement hunter pet summon at login there (spell 6962)

+    uint64 targetFlags1 = UI64LIT(0x0);                     // SpellFamilyFlags for Aura that is to be extended
+    uint16 targetFlags2 = UI64LIT(0x0);
+
    switch(m_spellInfo->SpellFamilyName)
    {
        case SPELLFAMILY_GENERIC:
        {
            switch(m_spellInfo->Id)
            {
+                // Glyph of Starfire : Starfire extends Moonfire
+                case 54846:
+                {
+                    targetFlags1 = UI64LIT(0x00000002);
+                    break;
+                }
+                // Glyph of Shred : Shred extends Rip
+                case 63974:
+                {
+                    targetFlags1 = UI64LIT(0x00800000);
+                    break;
+                }
+                // Glyph of Backstab : Backstab extends Rupture
+                case 63975:
+                {
+                    targetFlags1 = UI64LIT(0x00100000);
+                    break;
+                }
+                // Glyph of Scourge Strike : Scourge Strike extends Diseases
+                case 69961:
+                {
+                    targetFlags1 = UI64LIT(0x0600080000000000);
+                    targetFlags2 = UI64LIT(0x0052);
+                    break;
+                }
                // PX-238 Winter Wondervolt TRAP
                case 26275:
                {
@@ -5505,6 +5533,37 @@ void Spell::EffectScriptEffect(uint32 effIndex)
        }
    }

+    // Extend remaining Aura duration
+    if((targetFlags1 || targetFlags2) && unitTarget)
+    {
+        Unit::AuraMap const& auras = unitTarget->GetAuras();
+        for(Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
+        {
+            // Only extend expected Auras (SpellFamily is checked through CasterGUID)
+            if(targetFlags1 && !(itr->second->GetSpellProto()->SpellFamilyFlags & targetFlags1))
+                continue;
+
+            if(targetFlags2 && !(itr->second->GetSpellProto()->SpellFamilyFlags2 & targetFlags2))
+                continue;
+
+            // Aura must be owned by Caster
+            if(itr->second->GetCaster()->GetGUID() != m_caster->GetGUID())
+                continue;
+
+            // Aura must not be extended more than three times
+            if(!itr->second->GetDurationExtends())
+                continue;
+
+            // Decremet remaining extends and prolong Aura
+            itr->second->UpdateDurationExtends();
+
+            // Use fixed amount [3000ms], if one of the corresponding Spells is cast directly.. (read: would cause crash otherwise)
+            int addtime = m_triggeredByAuraSpell ? (m_triggeredByAuraSpell->EffectBasePoints[0] + 1) * 1000 : 3000;
+            itr->second->SetAuraDuration(itr->second->GetAuraDuration() + addtime);
+            itr->second->SendAuraUpdate(false);
+        }
+    }
+
    // normal DB scripted effect
    if(!unitTarget)
        return;
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 868905b..9332967 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -5025,6 +5025,12 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
                    }
                    return true;
                }
+                // Glyph of Scourge Strike ScriptEffect-Proc
+                case 58642:
+                {
+                    triggered_spell_id = 69961;
+                    break;
+                }
            }
            break;
        }
@@ -5542,6 +5548,18 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
                    triggered_spell_id = 32747;
                    break;
                }
+                // Glyph of Shred ScriptEffect-Proc
+                case 54815:
+                {
+                    triggered_spell_id = 63974;
+                    break;
+                }
+                // Glyph of Starfire ScriptEffect-Proc
+                case 54845:
+                {
+                    triggered_spell_id = 54846;
+                    break;
+                }
            }
            // Eclipse
            if (dummySpell->SpellIconID == 2856)
@@ -5614,6 +5632,12 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
                    triggered_spell_id = 32747;
                    break;
                }
+                // Glyph of Backstab ScriptEffect-Proc
+                case 56800:
+                {
+                    triggered_spell_id = 63975;
+                    break;
+                }
            }
            // Cut to the Chase
            if (dummySpell->SpellIconID == 2909)

Notes

The Flag for the Deathknight Diseases is composed from these four spells. You may yell at me, if i forgot one ;)

Name:         FamilyFlags 3 FamilyFlags 1+2
Blood Plague: 0x02          0x0200080000000000
Frost Fever:  0x02          0x0400080000000000
Crypt Fever:  0x10          0x0
Ebon Plague:  0x40          0x0000080000000000

Currently it is possible to push the current duration beyond the initial duration. Eg. backstabbing, right after applying Rupture. It would be nice, if someone could confirm or deny, whether this is official behavior.

Thank You

/e: Behavior confirmed. It is possible, to put an aura over its initial duration. I even have Screenshots to prove it, if needed ;)

Link to comment
Share on other sites

Not sure that this good way (adding some vars in Aura) just for support 4 auras.

As i look (2 cases) this glyph spells have spell like http://www.wowhead.com/?spell=63975

with scripting support.

Poosible gliph just triggering apply this aura to target (up to 3 stack size)? and script affect increase duration of at fixed amount. Applied script aura not have duration itself and expected to be remove at targeted aura remove (last in stack) and then most good place remove in Aura::HandleSpellSpecificBoosts

Link to comment
Share on other sites

Hmm, i don't see how this could work out, especially in the case of Deathknights.

In this case, i'd need to add up to four stackable Auras to his target (one for each possible disease), and i don't know, from where to pull them off.

Mind you, the spells i posted in the original post get applied to the caster, when equiping the coresponding Glyph. Spells, like the one you posted, exist one for each Glyph and sadly are just ScriptEffects.

What i could try, is to solve this with already existent variables, like Charges. But i'd expect visual side-effects like a number on the Debuff-Icon in this case.

Link to comment
Share on other sites

  • 1 month later...

right, i give up^^

what i tried was to:

extend m_maxduration too to +X seconds like m_duration to have a reference

before each possible extend, calculate the regular maximum SpellDuration with ->CalculateSpellDuration()

if m_maxduration is equal or larger than the just calculated duration plus three times the Glyphs modifier in ms, do not extend any more.

Works on paper, but does not in reality, since Ruptures duration can't be recalculated as it was based upon Combo Points that got used up :/

So, i'm out of ideas .. again

Link to comment
Share on other sites

What happens to scripted spells like those used by the glyphs, when one is casted multiples times to the same target ? I don't know, just asking.

As they don't seem to be auras, so if they dissappear immediatly, it's not doable without a counter somewhere.

If they are handled like cumulatives auras, in this case, EffectScriptEffect should fire only when one is applied. In this function, apply just one extend only if the total number of aura is less or equal to 3. Each extend is applied with successives EffectScriptEffect calls, so only when each aura is applied.

Just an idea

Link to comment
Share on other sites

Your right, they're no Auras. So when cast at someone/-thing, you have to catch the spellcast in Spell::EffectScriptEffect() and write what should happen there manually.

ie: if there are "extension-charges" (which i added to Aura) left, decrement those and extend the Duration of the Aura by X seconds.

But i didn't get it to work without those 'charges', so this patch will most likely stay custom content :/

Link to comment
Share on other sites

Maybe there's a way, your idea sounds on the right track. Using a counter would get more efficient if such glyphs would be more frequents, anyway :

After looking in the code, it seems the aura apply time is set only when the aura is applied, and aura duration has the real duration value (ex for rupture : 3 cp then duration = 12 s, if 8 cp, then it's 16 s). Assuming aura apply time isn't updated when the aura remaning time is updated (doesn't seem, but I may have overlook it) here's the essai :

note : not usable as is, C++ is still new for me

+// Extend remaining Aura duration
+    if((targetFlags1 || targetFlags2) && unitTarget)
+    {
+        Unit::AuraMap const& auras = unitTarget->GetAuras();
+        for(Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
+        {
+            // Only extend expected Auras (SpellFamily is checked through CasterGUID)
+            if(targetFlags1 && !(itr->second->GetSpellProto()->SpellFamilyFlags & targetFlags1))
+                continue;
+
+            if(targetFlags2 && !(itr->second->GetSpellProto()->SpellFamilyFlags2 & targetFlags2))
+                continue;
+
+            // Aura must be owned by Caster
+            if(itr->second->GetCaster()->GetGUID() != m_caster->GetGUID())
+                continue;
+
+            // Use fixed amount [3], if one of the corresponding Spells is cast directly.. (read: would cause crash otherwise)
+            int extendAmount = m_triggeredByAuraSpell ? m_triggeredByAuraSpell->EffectBasePoints[0] * IN_MILISECONDS : 3 * IN_MILISECONDS ;
+
+            // check the time difference between the current remaning duration  and the remaning duration at cast before any extend
+            time_t AuraRemaningTimeInitial = time(NULL) - itr->second=>GetAuraApplyTime()
+            int32 AuraRemaningTimeDiff = itr->second=>GetAuraDuration() - int32 AuraRemaningTimeInitial
+
+            // now, if the real remaning time difference is greater than the extendAmount, then the aura has already been changed at least once.
+            if ( ( AuraRemaningTimeDiff > extendAmount ) && ( (AuraRemaningTimeDiff / extendAmount) > 3 ) )
+                    continue;  // 3 extends maximum are allowed
+
+            itr->second->SetAuraDuration(itr->second->GetAuraDuration() + addtime);
+            itr->second->SendAuraUpdate(false);
+        }
+    }

Link to comment
Share on other sites

  • 4 months 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