From dd425437b86d87062952ea20e3507e92bae0cce7 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Mon, 22 Feb 2021 15:56:54 -0500 Subject: [PATCH] Core/Auras: Implemented new spell modifier type to change max aura stack size Port From (https://github.com/TrinityCore/TrinityCore/commit/b4b13e7b38619b062d209c3547532384623a56c1) --- Source/Game/Spells/Auras/Aura.cs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/Source/Game/Spells/Auras/Aura.cs b/Source/Game/Spells/Auras/Aura.cs index 7c31b5166..183d834e2 100644 --- a/Source/Game/Spells/Auras/Aura.cs +++ b/Source/Game/Spells/Auras/Aura.cs @@ -225,7 +225,7 @@ namespace Game.Spells // send stack amount for aura which could be stacked (never 0 - causes incorrect display) or charges // stack amount has priority over charges (checked on retail with spell 50262) - auraData.Applications = aura.GetSpellInfo().StackAmount != 0 ? aura.GetStackAmount() : aura.GetCharges(); + auraData.Applications = aura.IsUsingStacks() ? aura.GetStackAmount() : aura.GetCharges(); if (!auraData.Flags.HasAnyFlag(AuraFlags.NoCaster)) auraData.CastUnit.Set(aura.GetCasterGUID()); @@ -857,12 +857,31 @@ namespace Game.Spells SetNeedClientUpdateForTargets(); } + public bool IsUsingStacks() + { + return m_spellInfo.StackAmount > 0; + } + + public uint CalcMaxStackAmount() + { + uint maxStackAmount = m_spellInfo.StackAmount; + Unit caster = GetCaster(); + if (caster != null) + { + Player modOwner = caster.GetSpellModOwner(); + if (modOwner != null) + modOwner.ApplySpellMod(m_spellInfo.Id, SpellModOp.StackAmount2, ref maxStackAmount); + } + return maxStackAmount; + } + public bool ModStackAmount(int num, AuraRemoveMode removeMode = AuraRemoveMode.Default, bool resetPeriodicTimer = true) { int stackAmount = m_stackAmount + num; + uint maxStackAmount = CalcMaxStackAmount(); // limit the stack amount (only on stack increase, stack amount may be changed manually) - if ((num > 0) && (stackAmount > (int)m_spellInfo.StackAmount)) + if ((num > 0) && (stackAmount > maxStackAmount)) { // not stackable aura - set stack amount to 1 if (m_spellInfo.StackAmount == 0)