Core/Auras: Registering a new owned aura will now search existing owned auras instead of applied auras to check for unstackable one

Port From (https://github.com/TrinityCore/TrinityCore/commit/dc661a34b1d1e099e2c1854e8fa9446115e30c96)
This commit is contained in:
hondacrx
2024-02-01 10:25:03 -05:00
parent febab9baed
commit cfc8a8bfa8
+7 -10
View File
@@ -3937,7 +3937,7 @@ namespace Game.Entities
{
Aura aura = aurApp.GetBase();
_RemoveNoStackAurasDueToAura(aura);
_RemoveNoStackAurasDueToAura(aura, false);
if (aurApp.HasRemoveMode())
return;
@@ -3995,7 +3995,7 @@ namespace Game.Entities
Cypher.Assert(!m_cleanupDone);
m_ownedAuras.Add(aura.GetId(), aura);
_RemoveNoStackAurasDueToAura(aura);
_RemoveNoStackAurasDueToAura(aura, true);
if (aura.IsRemoved())
return;
@@ -4084,7 +4084,7 @@ namespace Game.Entities
return null;
}
void _RemoveNoStackAurasDueToAura(Aura aura)
void _RemoveNoStackAurasDueToAura(Aura aura, bool owned)
{
SpellInfo spellProto = aura.GetSpellInfo();
@@ -4098,13 +4098,10 @@ namespace Game.Entities
return;
}
foreach (var app in GetAppliedAuras())
{
if (aura.CanStackWith(app.Value.GetBase()))
continue;
RemoveAura(app, AuraRemoveMode.Default);
}
if (owned)
RemoveOwnedAuras(ownedAura => !aura.CanStackWith(ownedAura), AuraRemoveMode.Default);
else
RemoveAppliedAuras(appliedAura => !aura.CanStackWith(appliedAura.GetBase()), AuraRemoveMode.Default);
}
public int GetHighestExclusiveSameEffectSpellGroupValue(AuraEffect aurEff, AuraType auraType, bool checkMiscValue = false, int miscValue = 0)
{