Jump to content

[9523] Stacking Auras from different castItems.


Auntie Mangos

Recommended Posts

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

Allows Auras procced by items to stack, if the castItems are different.

Popular example: Dualwielding weapons with Crusader- or Mongoose-Enchant or unsing these Maces from Blacksmithing

For which repository revision was the patch created?

mangos-0.12 @ 061b4a3147da182e7fda3845ac4c543eeaddc3bb

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

Thread

Who has been writing this patch?

Sarjuuk

diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 6d02ea4..e078127 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -849,8 +849,9 @@ void Aura::_AddAura()
        Unit::spellEffectPair spair = Unit::spellEffectPair(GetId(), i);
        for(Unit::AuraMap::const_iterator itr = m_target->GetAuras().lower_bound(spair); itr != m_target->GetAuras().upper_bound(spair); ++itr)
        {
-            // allow use single slot only by auras from same caster
-            if(itr->second->GetCasterGUID()==GetCasterGUID())
+            // allow use single slot only by auras from same caster (and item)
+            if ((itr->second->GetCasterGUID() == GetCasterGUID()) &&
+                (itr->second->GetCastItemGUID() == GetCastItemGUID()))
            {
                samespell = true;
                if (m_effIndex > itr->second->GetEffIndex())
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 076f6e7..46b36ce 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -3662,6 +3662,10 @@ bool Unit::AddAura(Aura *Aur)
                    Aura* aur2 = i2->second;
                    if(aur2->GetCasterGUID()==Aur->GetCasterGUID())
                    {
+                        // proced Auras may stack, if their Source-Item differ
+                        if (aur2->GetCastItemGUID() != Aur->GetCastItemGUID())
+                            continue;
+
                        // Carry over removed Aura's remaining damage if Aura still has ticks remaining
                        if (!aurSpellInfo->StackAmount && aur2->GetSpellProto()->AttributesEx4 & SPELL_ATTR_EX4_STACK_DOT_MODIFIER &&
                            aurName == SPELL_AURA_PERIODIC_DAMAGE && aur2->GetAuraDuration() > 0)

Notes:

1) Item, that you can be worn twice are: weapons, rings, trinkets. I know of no trinket or ring, that applies a buff, without causing a cooldown to that effect. If you prove me wrong, a more explicit check for the itemSlot or something may be needed.

2) this rule falls short for Enchant Weapon: Executioner, that may not stack. It will require an addition in SpellMgr::IsNoStackSpellDueToSpell() to work propperly

Link to comment
Share on other sites

  • 40 years later...

As i understand this applied and for master? same problem expected...

[added]Hmm, referenced enchantment spell affects in master not allowed stacked by aura type for spells with not specified stack size amount... (0)

Same for 0.12. You sure that see working this after patch for 0.12...

[added2]Ah, i see now own typo for master version that i attempt prepare...

Link to comment
Share on other sites

got finally around to test this.

Weapon cast buffs are stacking, other item-cast Auras are not.

diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 6d02ea4..e078127 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -849,8 +849,9 @@ void Aura::_AddAura()
        Unit::spellEffectPair spair = Unit::spellEffectPair(GetId(), i);
        for(Unit::AuraMap::const_iterator itr = m_target->GetAuras().lower_bound(spair); itr != m_target->GetAuras().upper_bound(spair); ++itr)
        {
-            // allow use single slot only by auras from same caster
-            if(itr->second->GetCasterGUID()==GetCasterGUID())
+            // allow use single slot only by auras from same caster (and item)
+            if (itr->second->GetCasterGUID() == GetCasterGUID() &&
+                itr->second->GetCastItemGUID() == GetCastItemGUID())
            {
                samespell = true;
                if (m_effIndex > itr->second->GetEffIndex())
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 076f6e7..fd3d0a5 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -3657,11 +3657,25 @@ bool Unit::AddAura(Aura *Aur)
            // if StackAmount==0 not allow auras from same caster
            else
            {
+                bool isWeaponCastAura = false;
+                if (GetTypeId() == TYPEID_PLAYER)
+                {
+                    if (Item* castItem = ((Player*)this)->GetItemByGuid(Aur->GetCastItemGUID()))
+                    {
+                        if (castItem->GetPos() == ((INVENTORY_SLOT_BAG_0<<8) + EQUIPMENT_SLOT_MAINHAND) ||
+                            castItem->GetPos() == ((INVENTORY_SLOT_BAG_0<<8) + EQUIPMENT_SLOT_OFFHAND))
+                                isWeaponCastAura = true;
+                    }
+                }
                for(AuraMap::iterator i2 = m_Auras.lower_bound(spair); i2 != m_Auras.upper_bound(spair); ++i2)
                {
                    Aura* aur2 = i2->second;
                    if(aur2->GetCasterGUID()==Aur->GetCasterGUID())
                    {
+                        // proced Auras may stack, if their Source-Item differ
+                        if (aur2->GetCastItemGUID() != Aur->GetCastItemGUID() && isWeaponCastAura)
+                            continue;
+
                        // Carry over removed Aura's remaining damage if Aura still has ticks remaining
                        if (!aurSpellInfo->StackAmount && aur2->GetSpellProto()->AttributesEx4 & SPELL_ATTR_EX4_STACK_DOT_MODIFIER &&
                            aurName == SPELL_AURA_PERIODIC_DAMAGE && aur2->GetAuraDuration() > 0)

I'll try to get this for master too.

Link to comment
Share on other sites

  • 2 weeks later...

no, thats highly unlikely :]

imagine 2x 50% reduced healing .. the QQ would be absurd^^

I think, what the tooltip means is, that, rather adding another application ontop of a full stack, the poison of the other weapon is allowed to proc. But thats just an idea. I read this addition to deadly poison for the first time :o

Link to comment
Share on other sites

Ok, more clean look now.

But note:

if (castItem->GetPos() == ((INVENTORY_SLOT_BAG_0<<8) + EQUIPMENT_SLOT_MAINHAND) ||

You can use for example less horriable ;)

item->IsEquipped() && (item->GetSlot() == EQUIPMENT_SLOT_MAINHAND || ...)
I do still plan do adapt it for master.
Nice. Because in most cases in 0.12 not added fixes that appropriate also to master but not fixed yet into master. Because master is primary development target.
Link to comment
Share on other sites

yay, for more visual appeal (:

for master @ 1f4ddbf71ad2ef824b30aa0a639685f2ed61601c :

http://paste2.org/p/691723

for 0.12 @ 66809ac9576d359c416b442c3104819ba287b72a :

http://paste2.org/p/691730

it would be nice, if someone with a player-base, could actually test the master-version a bit more in depths.

/e: got SegFaults .. apparently GetCaster() can be NULL..... diffs updated manually.

Thanks to DasMy, for throwing crashlogs at me.

Link to comment
Share on other sites

+ if (!ref || !IsPositiveSpell(GetId()))

I think need test aura itself:
if (!IsPositive())

Because spell effects applied to different targets and can be buffs/debufs in same spell.

if (GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER)

Hmm, if we skip debufs then from weapon can be only exist auras at caster itself only? So safe GetTarget link maybe...

Link to comment
Share on other sites

  • 2 weeks 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