Jump to content

[Patch] Big Cleanup in SpellMgr::IsNoStackSpellDueToSpell

Auntie Mangos

Recommended Posts

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

This patch rewrites parts of SpellMgr::IsNoStackSpellDueToSpell so that much fewer exceptions are needed.

For which repository revision was the patch created?


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


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


The real changes in this patch are the things changed under the comment "// more generic checks", at the bottom of the patch.

  • * Checks for SPELLFAMILY_GENERIC in the switch make no sense, these lines should take care of these already, but I believe they were misplaced or superceded by the isModifier check at some point:
    if (spellInfo_1->SpellFamilyName == 0 || spellInfo_2->SpellFamilyName == 0)
          return false;

    (I changed this line to use SPELLFAMILY_GENERIC instead of 0; if this part of the code were more readable in the first place, this mess wouldn't have happened ;) ) Now, the only exceptions to be added that I can think of are scrolls (these exceptions are needed on master branch too, so it's unrelated to this patch).
    * IsRankSpellDueToSpell is already checked numerous times before this method is called, so I removed this check.
    * At the very end of these checks, return false if the SpellIcons are different. This allows many of the "exception" checks in the code above to be removed. (Note: the problem with Greater Blessings stacking occurs elsewhere; they are handled differently since they have SpellSpecifics)

This is what can be removed or changed based on these changes:

    * Simply removed all of these
    * MAGE
    * Detect Invisibility and Mana Shield - Would return false due to having different SpellFamilies
    * Combustion and Fire Resistance Aura - Would return false due to having different SpellFamilies
    * Arcane Intellect and Insight - Insight uses SPELLFAMILY_GENERIC
    * Siphon Life and Drain Life - different SpellIcons
    * Corruption and Unstable Affliction - different SpellIcons
    * (Corruption or Unstable Affliction) and (Curse of Agony or Curse of Doom) - different SpellIcons
    * Detect Invisibility and Mana Shield - Would return false due to having different SpellFamilies
    * Hamstring and Improved Hamstring - the triggered debuff from Improved Hamstring is SPELLFAMILY_GENERIC
    * Rend and Deep Wound - different SpellIcons
    * Battle Shout and Rampage - not sure why this was in here in the first place
    * Defensive Stance and Scroll of Protection - scrolls are SPELLFAMILY_GENERIC
    * Bloodlust and Bloodthirst - different SpellFamilies
    * PRIEST
    * Devouring Plague and Shadow Vulnerability - different SpellIcons, so the result is false. (There is no spell called "Shadow Vulnerability," but the family flag points to Shadow Weaving)
    * Starshards - spell removed in 3.0.2
    * DRUID
    * Omen of Clarity and Blood Frenzy - different SpellIcons
    * Wrath of Elune and Nature's Grace - different SpellIcons
    * Omen of Clarity and T4 Buffs - different SpellIcons
    * Leader of the Pack and Scroll of Stamina - Scrolls are SPELLFAMILY_GENERIC
    * Dragonmaw Illusion - one of the spells (40216) is SPELLFAMILY_GENERIC
    * ROGUE
    * Overkill - this exception deals with the two Overkill auras that both have SPELLFAMILY_ROGUE, so it can be moved up into the 'if' block. (not removed)
    * Garrote and Garrote-Silence - Garrote-Silence is SPELLFAMILY_GENERIC
    * HUNTER
    * Rapid Fire & Quick Shots - different SpellIcons
    * Serpent Sting & (Immolation/Explosive Trap Effect) - different SpellIcons
    * Wing Clip and Improved Wing Clip - Improved Wing Clip is SPELLFAMILY_GENERIC
    * Imp. Concussive Shot - spell 19410 no longer exists
    * Paladin Seals - handled by SpellSpecific checks; don't even think this method is called
    * Combustion and Fire Resistance Aura - Would return false due to having different SpellFamilies
    * Sanctity Aura and Unstable Currents - Unstable Currents is SPELLFAMILY_GENERIC
    * Band of Eternal Champion - uses SPELLFAMILY_GENERIC
    * SHAMAN
    * Shaman Shields - just want to note that the SPELL_ELEMENTAL_SHIELD SpellSpecific is never used (not removed)
    * Windfury Weapon and ??? - Not sure, but this looks like it used to handle the old Windfury totem and the passive for Windfury Weapon. So it's no longer needed. (The two spells affected by this check are 32911 and 33757)
    * Bloodlust and Bloodthirst - different SpellFamilies


It goes without saying, but please reply if you have any comments or if I managed to break something that was working before :)

EDIT: Removed SpellIcon check completely, very experimental

EDIT2: Put back SpellIcon checks for SpellFamily Generic spells until I figure out how to handle Food/Drinks and how to use SPELL_ATTR_EX2_UNK31 .

EDIT3: Food/Drinks/Well Fed buffs no longer stack with each other, updated to 8379

Link to comment
Share on other sites

  • 39 years later...
  • 4 weeks later...

Updated to 8379, and added checks to prevent Food/Drinks/Well Fed buffs from stacking with each other.

Some explanation of these checks:

  • * The Replenishment effects of food and drinks are handled in IsNoStackSpellDueToSpell. They are selected based on the AuraInterruptFlag AURA_INTERRUPT_FLAG_NOT_SEATED, which only food and drinks use. The spells are then compared to each other using IsSpellHaveAura, since there does not seem to be a better way to separate foods from drinks. I only found one food spell (48720) without this interrupt flag, but that can only be used underwater, where other foods shouldn't be usable anyway.
    * The Well Fed buffs of foods are handled using a spellspecific, since they were not all SPELLFAMILY_GENERIC. Some were also SPELLFAMILY_PRIEST (18125, 18141, 23697), and some were SPELLFAMILY_POTION (18191, 18192, 18193, 18194, 18222, 22730, 25661).
    * Of the SPELLFAMILY_GENERIC spells, only 46687 was not covered by SPELL_ATTR_EX2_FOOD_BUFF, so I added a SpellIcon check for that.


forget the spell_elixir flag for the Well Fed buffs that are SPELLFAMILY_POTION:

DELETE FROM spell_elixir WHERE entry IN (18191, 18192, 18193, 18194, 18222, 22730, 25661);
INSERT INTO spell_elixir (entry, mask) VALUES
(18191, 16),
(18192, 16),
(18193, 16),
(18194, 16),
(18222, 16),
(22730, 16),
(25661, 16);

Link to comment
Share on other sites

  • 1 month later...

I haven't had much time to work on my patches/keep them up-to-date, but iirc, I encountered some problems mainly with pet spells; they often share the same spell family mask, so using those as the main generic checks here wouldn't be ideal. (Check the ones with SpellFamilyFlags 0x10000000, SpellFamilyName = 9 for example)

I was thinking that SpellVisuals might be a better fall back method than SpellIcons, but I never finished checking. At the least, they might work for these pet spells, and they are the same for spells like Gift of the Wild and Mark of the Wild, Arcane Brilliance and Arcane Intellect, etc. where SpellIcons vary.

Anyway, I haven't looked in the latest client files, so there might be a better way to do these checks now.

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 months later...
  • 3 weeks later...
  • 3 months later...
  • 8 months later...
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