Core/Auras: Refactor logic determining which spell aura type values need to be sent

Port From (https://github.com/TrinityCore/TrinityCore/commit/512931646ada2fab3796d362bb1955d7494f06ff)
This commit is contained in:
hondacrx
2021-02-21 21:49:50 -05:00
parent 26c57969fb
commit d2552107b6
2 changed files with 22 additions and 8 deletions
+21 -7
View File
@@ -154,13 +154,9 @@ namespace Game.Spells
_flags |= positiveFound ? AuraFlags.Positive : AuraFlags.Negative;
}
if (GetBase().GetSpellInfo().HasAttribute(SpellAttr8.AuraSendAmount) ||
GetBase().HasEffectType(AuraType.OverrideActionbarSpells) ||
GetBase().HasEffectType(AuraType.OverrideActionbarSpellsTriggered) ||
GetBase().HasEffectType(AuraType.ModSpellCategoryCooldown) ||
GetBase().HasEffectType(AuraType.ModMaxCharges) ||
GetBase().HasEffectType(AuraType.ChargeRecoveryMod) ||
GetBase().HasEffectType(AuraType.ChargeRecoveryMultiplier))
bool effectNeedsAmount(AuraEffect effect) => effect != null && (GetEffectsToApply() & (1 << effect.GetEffIndex())) != 0 && Aura.EffectTypeNeedsSendingAmount(effect.GetAuraType());
if (GetBase().GetSpellInfo().HasAttribute(SpellAttr8.AuraSendAmount) || GetBase().GetAuraEffects().Any(effectNeedsAmount))
_flags |= AuraFlags.Scalable;
}
@@ -1096,6 +1092,24 @@ namespace Game.Spells
return false;
}
public static bool EffectTypeNeedsSendingAmount(AuraType type)
{
switch (type)
{
case AuraType.OverrideActionbarSpells:
case AuraType.OverrideActionbarSpellsTriggered:
case AuraType.ModSpellCategoryCooldown:
case AuraType.ModMaxCharges:
case AuraType.ChargeRecoveryMod:
case AuraType.ChargeRecoveryMultiplier:
return true;
default:
break;
}
return false;
}
public void RecalculateAmountOfEffects()
{
Cypher.Assert(!IsRemoved());
+1 -1
View File
@@ -262,7 +262,7 @@ namespace Game.Spells
HandleEffect(aurApp, handleMask, true);
}
if (GetSpellInfo().HasAttribute(SpellAttr8.AuraSendAmount))
if (GetSpellInfo().HasAttribute(SpellAttr8.AuraSendAmount) || Aura.EffectTypeNeedsSendingAmount(GetAuraType()))
GetBase().SetNeedClientUpdateForTargets();
}