Core/Auras: Fixed SPELLVALUE_AURA_STACK adding incorrect number of stacks on aura refresh
Port From (https://github.com/TrinityCore/TrinityCore/commit/4c605ce621a137f32cf02527d48e36fed1b6e235)
This commit is contained in:
@@ -919,6 +919,7 @@ namespace Game.Entities
|
|||||||
AuraCreateInfo createInfo = new(castId, spellInfo, difficulty, key.EffectMask, this);
|
AuraCreateInfo createInfo = new(castId, spellInfo, difficulty, key.EffectMask, this);
|
||||||
createInfo.SetCasterGUID(casterGuid);
|
createInfo.SetCasterGUID(casterGuid);
|
||||||
createInfo.SetBaseAmount(info.BaseAmounts);
|
createInfo.SetBaseAmount(info.BaseAmounts);
|
||||||
|
createInfo.SetStackAmount(stackCount);
|
||||||
|
|
||||||
Aura aura = Aura.TryCreate(createInfo);
|
Aura aura = Aura.TryCreate(createInfo);
|
||||||
if (aura != null)
|
if (aura != null)
|
||||||
@@ -928,7 +929,7 @@ namespace Game.Entities
|
|||||||
aura.Remove();
|
aura.Remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
aura.SetLoadedState(maxDuration, remainTime, remainCharges, stackCount, recalculateMask, info.Amounts);
|
aura.SetLoadedState(maxDuration, remainTime, remainCharges, recalculateMask, info.Amounts);
|
||||||
aura.ApplyForTargets();
|
aura.ApplyForTargets();
|
||||||
Log.outInfo(LogFilter.Pet, "Added aura spellid {0}, effectmask {1}", spellInfo.Id, key.EffectMask);
|
Log.outInfo(LogFilter.Pet, "Added aura spellid {0}, effectmask {1}", spellInfo.Id, key.EffectMask);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -571,6 +571,7 @@ namespace Game.Entities
|
|||||||
createInfo.SetCasterGUID(casterGuid);
|
createInfo.SetCasterGUID(casterGuid);
|
||||||
createInfo.SetBaseAmount(info.BaseAmounts);
|
createInfo.SetBaseAmount(info.BaseAmounts);
|
||||||
createInfo.SetCastItem(itemGuid, castItemId, castItemLevel);
|
createInfo.SetCastItem(itemGuid, castItemId, castItemLevel);
|
||||||
|
createInfo.SetStackAmount(stackCount);
|
||||||
|
|
||||||
Aura aura = Aura.TryCreate(createInfo);
|
Aura aura = Aura.TryCreate(createInfo);
|
||||||
if (aura != null)
|
if (aura != null)
|
||||||
@@ -581,7 +582,7 @@ namespace Game.Entities
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
aura.SetLoadedState(maxDuration, remainTime, remainCharges, stackCount, recalculateMask, info.Amounts);
|
aura.SetLoadedState(maxDuration, remainTime, remainCharges, recalculateMask, info.Amounts);
|
||||||
aura.ApplyForTargets();
|
aura.ApplyForTargets();
|
||||||
Log.outInfo(LogFilter.Player, "Added aura spellid {0}, effectmask {1}", spellInfo.Id, key.EffectMask);
|
Log.outInfo(LogFilter.Player, "Added aura spellid {0}, effectmask {1}", spellInfo.Id, key.EffectMask);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3245,6 +3245,7 @@ namespace Game.Entities
|
|||||||
AuraCreateInfo createInfo = new(aura.GetCastId(), aura.GetSpellInfo(), aura.GetCastDifficulty(), effMask, stealer);
|
AuraCreateInfo createInfo = new(aura.GetCastId(), aura.GetSpellInfo(), aura.GetCastDifficulty(), effMask, stealer);
|
||||||
createInfo.SetCasterGUID(aura.GetCasterGUID());
|
createInfo.SetCasterGUID(aura.GetCasterGUID());
|
||||||
createInfo.SetBaseAmount(baseDamage);
|
createInfo.SetBaseAmount(baseDamage);
|
||||||
|
createInfo.SetStackAmount(stolenCharges);
|
||||||
|
|
||||||
Aura newAura = Aura.TryRefreshStackOrCreate(createInfo);
|
Aura newAura = Aura.TryRefreshStackOrCreate(createInfo);
|
||||||
if (newAura != null)
|
if (newAura != null)
|
||||||
@@ -3258,7 +3259,7 @@ namespace Game.Entities
|
|||||||
caster.GetSingleCastAuras().Add(aura);
|
caster.GetSingleCastAuras().Add(aura);
|
||||||
}
|
}
|
||||||
// FIXME: using aura.GetMaxDuration() maybe not blizzlike but it fixes stealing of spells like Innervate
|
// FIXME: using aura.GetMaxDuration() maybe not blizzlike but it fixes stealing of spells like Innervate
|
||||||
newAura.SetLoadedState(aura.GetMaxDuration(), (int)dur, stealCharge ? stolenCharges : aura.GetCharges(), (byte)stolenCharges, recalculateMask, damage);
|
newAura.SetLoadedState(aura.GetMaxDuration(), (int)dur, stealCharge ? stolenCharges : aura.GetCharges(), recalculateMask, damage);
|
||||||
newAura.ApplyForTargets();
|
newAura.ApplyForTargets();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4262,7 +4263,7 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
// try to increase stack amount
|
// try to increase stack amount
|
||||||
foundAura.ModStackAmount(1, AuraRemoveMode.Default, createInfo.ResetPeriodicTimer);
|
foundAura.ModStackAmount(createInfo.StackAmount, AuraRemoveMode.Default, createInfo.ResetPeriodicTimer);
|
||||||
return foundAura;
|
return foundAura;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ namespace Game.Spells
|
|||||||
m_updateTargetMapInterval = 0;
|
m_updateTargetMapInterval = 0;
|
||||||
m_casterLevel = createInfo.Caster != null ? createInfo.Caster.GetLevel() : m_spellInfo.SpellLevel;
|
m_casterLevel = createInfo.Caster != null ? createInfo.Caster.GetLevel() : m_spellInfo.SpellLevel;
|
||||||
m_procCharges = 0;
|
m_procCharges = 0;
|
||||||
m_stackAmount = 1;
|
m_stackAmount = (byte)createInfo.StackAmount;
|
||||||
m_isRemoved = false;
|
m_isRemoved = false;
|
||||||
m_isSingleTarget = false;
|
m_isSingleTarget = false;
|
||||||
m_isUsingCharges = false;
|
m_isUsingCharges = false;
|
||||||
@@ -1133,13 +1133,12 @@ namespace Game.Spells
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetLoadedState(int maxduration, int duration, int charges, byte stackamount, uint recalculateMask, int[] amount)
|
public void SetLoadedState(int maxduration, int duration, int charges, uint recalculateMask, int[] amount)
|
||||||
{
|
{
|
||||||
m_maxDuration = maxduration;
|
m_maxDuration = maxduration;
|
||||||
m_duration = duration;
|
m_duration = duration;
|
||||||
m_procCharges = (byte)charges;
|
m_procCharges = (byte)charges;
|
||||||
m_isUsingCharges = m_procCharges != 0;
|
m_isUsingCharges = m_procCharges != 0;
|
||||||
m_stackAmount = stackamount;
|
|
||||||
Unit caster = GetCaster();
|
Unit caster = GetCaster();
|
||||||
foreach (AuraEffect effect in GetAuraEffects())
|
foreach (AuraEffect effect in GetAuraEffects())
|
||||||
{
|
{
|
||||||
@@ -3070,6 +3069,7 @@ namespace Game.Spells
|
|||||||
public uint CastItemId = 0;
|
public uint CastItemId = 0;
|
||||||
public int CastItemLevel = -1;
|
public int CastItemLevel = -1;
|
||||||
public bool IsRefresh;
|
public bool IsRefresh;
|
||||||
|
public int StackAmount = 1;
|
||||||
public bool ResetPeriodicTimer = true;
|
public bool ResetPeriodicTimer = true;
|
||||||
|
|
||||||
internal ObjectGuid _castId;
|
internal ObjectGuid _castId;
|
||||||
@@ -3100,6 +3100,8 @@ namespace Game.Spells
|
|||||||
public void SetBaseAmount(int[] bp) { BaseAmount = bp; }
|
public void SetBaseAmount(int[] bp) { BaseAmount = bp; }
|
||||||
public void SetCastItem(ObjectGuid guid, uint itemId, int itemLevel) { CastItemGUID = guid; CastItemId = itemId; CastItemLevel = itemLevel; }
|
public void SetCastItem(ObjectGuid guid, uint itemId, int itemLevel) { CastItemGUID = guid; CastItemId = itemId; CastItemLevel = itemLevel; }
|
||||||
public void SetPeriodicReset(bool reset) { ResetPeriodicTimer = reset; }
|
public void SetPeriodicReset(bool reset) { ResetPeriodicTimer = reset; }
|
||||||
|
public void SetIsRefresh(bool isRefresh) { IsRefresh = isRefresh; }
|
||||||
|
public void SetStackAmount(int stackAmount) { StackAmount = stackAmount > 0 ? stackAmount : 1; }
|
||||||
public void SetOwnerEffectMask(uint effMask) { _targetEffectMask = effMask; }
|
public void SetOwnerEffectMask(uint effMask) { _targetEffectMask = effMask; }
|
||||||
public void SetAuraEffectMask(uint effMask) { _auraEffectMask = effMask; }
|
public void SetAuraEffectMask(uint effMask) { _auraEffectMask = effMask; }
|
||||||
|
|
||||||
|
|||||||
@@ -2354,21 +2354,13 @@ namespace Game.Spells
|
|||||||
createInfo.SetCastItem(m_castItemGUID, m_castItemEntry, m_castItemLevel);
|
createInfo.SetCastItem(m_castItemGUID, m_castItemEntry, m_castItemLevel);
|
||||||
createInfo.SetPeriodicReset(resetPeriodicTimer);
|
createInfo.SetPeriodicReset(resetPeriodicTimer);
|
||||||
createInfo.SetOwnerEffectMask(aura_effmask);
|
createInfo.SetOwnerEffectMask(aura_effmask);
|
||||||
|
createInfo.SetStackAmount(m_spellValue.AuraStackAmount);
|
||||||
|
|
||||||
Aura aura = Aura.TryRefreshStackOrCreate(createInfo, false);
|
Aura aura = Aura.TryRefreshStackOrCreate(createInfo, false);
|
||||||
if (aura != null)
|
if (aura != null)
|
||||||
{
|
{
|
||||||
hitInfo.HitAura = aura.ToUnitAura();
|
hitInfo.HitAura = aura.ToUnitAura();
|
||||||
|
|
||||||
// Set aura stack amount to desired value
|
|
||||||
if (m_spellValue.AuraStackAmount > 1)
|
|
||||||
{
|
|
||||||
if (!createInfo.IsRefresh)
|
|
||||||
hitInfo.HitAura.SetStackAmount((byte)m_spellValue.AuraStackAmount);
|
|
||||||
else
|
|
||||||
hitInfo.HitAura.ModStackAmount(m_spellValue.AuraStackAmount);
|
|
||||||
}
|
|
||||||
|
|
||||||
hitInfo.HitAura.SetDiminishGroup(hitInfo.DRGroup);
|
hitInfo.HitAura.SetDiminishGroup(hitInfo.DRGroup);
|
||||||
|
|
||||||
if (!m_spellValue.Duration.HasValue)
|
if (!m_spellValue.Duration.HasValue)
|
||||||
|
|||||||
Reference in New Issue
Block a user