Jump to content

[patch] Invisibility remove at spell cast


Auntie Mangos

Recommended Posts

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

Fixed exploit with using spells under invisibility effects. For example potions or mage invisibility

For which repository revision was the patch created?

9509

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

http://getmangos.eu/community/showthread.php?2668

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

Me

d4cd7f61d79187017a7d96705e3bfa2e4938c8d5
src/game/Spell.cpp |    3 +--
src/game/Unit.h    |    2 +-
2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 68c7d48..01a6cf8 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -2479,8 +2479,7 @@ void Spell::Prepare(SpellCastTargets const* targets, Aura* triggeredByAura)
    // skip triggered spell (item equip spell casting and other not explicit character casts/item uses)
    if ( !m_IsTriggeredSpell && isSpellBreakStealth(m_spellInfo) )
    {
-        m_caster->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
-        m_caster->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+        m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CAST);
    }

    // add non-triggered (with cast time and without)
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 545510b..983bea0 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -66,7 +66,7 @@ enum SpellAuraInterruptFlags
    AURA_INTERRUPT_FLAG_NOT_UNDERWATER              = 0x00000100,   // 8    removed by leaving water
    AURA_INTERRUPT_FLAG_NOT_SHEATHED                = 0x00000200,   // 9    removed by unsheathing
    AURA_INTERRUPT_FLAG_UNK10                       = 0x00000400,   // 10
-    AURA_INTERRUPT_FLAG_UNK11                       = 0x00000800,   // 11
+    AURA_INTERRUPT_FLAG_CAST                        = 0x00000800,   // 11   removed by casting a spell
    AURA_INTERRUPT_FLAG_UNK12                       = 0x00001000,   // 12   removed by attack?
    AURA_INTERRUPT_FLAG_UNK13                       = 0x00002000,   // 13
    AURA_INTERRUPT_FLAG_UNK14                       = 0x00004000,   // 14

thanks to zergtmn for finding a correct solution.

Link to comment
Share on other sites

  • 40 years later...
  • 1 month later...

Maybe right flag is AURA_INTERRUPT_FLAG_CAST = 0x00000800, // 11 removed by casting spells

Look at these spells:

http://www.wowhead.com/?spell=38157 (Overseer Disguise) has AuraInterruptFlags = 0x9801

http://www.wowhead.com/?spell=3680 (Lesser Invisibility Potion) has AuraInterruptFlags = 0x13C03

http://www.wowhead.com/?spell=32612 (Mage Invisibility) has AuraInterruptFlags = 0x3C07

All are removable by casting any spells on offy. By AND-ing flags we get 0x1801.

http://www.wowhead.com/?spell=52842 also has flags 0x1001, but not removable by spell casting. So we get 0x800

Something like http://paste2.org/p/690500

Link to comment
Share on other sites

Maybe right flag is AURA_INTERRUPT_FLAG_CAST = 0x00000800, // 11 removed by casting spells

Look at these spells:

http://www.wowhead.com/?spell=38157 (Overseer Disguise) has AuraInterruptFlags = 0x9801

http://www.wowhead.com/?spell=3680 (Lesser Invisibility Potion) has AuraInterruptFlags = 0x13C03

http://www.wowhead.com/?spell=32612 (Mage Invisibility) has AuraInterruptFlags = 0x3C07

All are removable by casting any spells on offy. By AND-ing flags we get 0x1801.

http://www.wowhead.com/?spell=52842 also has flags 0x1001, but not removable by spell casting. So we get 0x800

Seems you're right, many invisibility/stealth/disguise buffs have this interrupt flag. Even imp's phase shift has this...

Link to comment
Share on other sites

Any news about this?

Try this patch:

diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 699e6ce..c71c48d 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -2462,6 +2462,8 @@ void Spell::Prepare(SpellCastTargets const* targets, Aura* triggeredByAura)
    // add non-triggered (with cast time and without)
    if (!m_IsTriggeredSpell)
    {
+        m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CAST);
+
        // add to cast type slot
        m_caster->SetCurrentCastedSpell( this );

diff --git a/src/game/Unit.h b/src/game/Unit.h
index 00ccca9..baac428 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -66,7 +66,7 @@ enum SpellAuraInterruptFlags
    AURA_INTERRUPT_FLAG_NOT_UNDERWATER              = 0x00000100,   // 8    removed by leaving water
    AURA_INTERRUPT_FLAG_NOT_SHEATHED                = 0x00000200,   // 9    removed by unsheathing
    AURA_INTERRUPT_FLAG_UNK10                       = 0x00000400,   // 10
-    AURA_INTERRUPT_FLAG_UNK11                       = 0x00000800,   // 11
+    AURA_INTERRUPT_FLAG_CAST                        = 0x00000800,   // 11   removed by casting a spell
    AURA_INTERRUPT_FLAG_UNK12                       = 0x00001000,   // 12   removed by attack?
    AURA_INTERRUPT_FLAG_UNK13                       = 0x00002000,   // 13
    AURA_INTERRUPT_FLAG_UNK14                       = 0x00004000,   // 14

Link to comment
Share on other sites

with this you will broke Arena Preparation buff. Don't know why, but it have this flag too :/

Yes, you can add a check like that if (m_spellInfo->ID == 32727) and then remove, BUT arena preparation can be removed in case of using mage invisibility and use any cast.

Because of this i was used a cycle with ID's in my patch

In 3.2.2:

ID - 32727  ()
--------------------------
Category = 0, SpellIconID = 122, activeIconID = 0, SpellVisual_0 = 0, SpellVisual_1 = 0
Family SPELLFAMILY_GENERIC, flag 0x00000000 00000000 00000000
School = SPELL_SCHOOL_NORMAL, DamageClass = SPELL_DAMAGE_CLASS_NONE, PreventionType = NONE
Attributes 0xA9000000, Ex 0x00000420, Ex2 0x10084004, Ex3 0x00130000, Ex4 0x00800000, Ex5 0x00060008, Ex6 0x00001404
Duration = -1, 0, -1
Interrupt Flags: 0x00000000, AuraIF 0x00080000, ChannelIF 0x00000000
Chance = 101, charges - 0

It is 0x00080000 and not 0x00000800, but I don't know if flag was changed since 3.2.2.

Link to comment
Share on other sites

  • 4 weeks later...
there are other opposite cases (buy maybe related) that some spell do remove invisibility/stealth when they shouldn't, like Earthbind Totem and Mass Dispel

it isn't related to my patch, because your cases happens on target at aura apply, but my patch remove stealth on caster at spell cast.

for mass dispel case, maybe related to

        // some spells have effect value = 0 and all from its by meaning expect 1
       if(!damage)
           damage = 1;

in spelleffects.cpp

Link to comment
Share on other sites

  • 1 month later...
Guest
This topic is now closed to further replies.
×
×
  • 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