Core/Auras: Fixed sending EstimatedPoints for auras that have only some effects that use it
Port From (https://github.com/TrinityCore/TrinityCore/commit/bf6b3aaed6b87225b970390c45b91a51242206c0)
This commit is contained in:
@@ -269,18 +269,24 @@ namespace Game.Spells
|
|||||||
|
|
||||||
if (auraData.Flags.HasFlag(AuraFlags.Scalable))
|
if (auraData.Flags.HasFlag(AuraFlags.Scalable))
|
||||||
{
|
{
|
||||||
|
bool hasEstimatedAmounts = false;
|
||||||
foreach (AuraEffect effect in GetBase().GetAuraEffects())
|
foreach (AuraEffect effect in GetBase().GetAuraEffects())
|
||||||
{
|
{
|
||||||
if (effect != null && HasEffect(effect.GetEffIndex())) // Not all of aura's effects have to be applied on every target
|
if (effect != null && HasEffect(effect.GetEffIndex())) // Not all of aura's effects have to be applied on every target
|
||||||
{
|
{
|
||||||
auraData.Points.Add(effect.GetAmount());
|
auraData.Points.Add(effect.GetAmount());
|
||||||
if (effect.GetEstimatedAmount().HasValue)
|
if (effect.GetEstimatedAmount().HasValue)
|
||||||
auraData.EstimatedPoints.Add(effect.GetEstimatedAmount().Value);
|
hasEstimatedAmounts = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!auraData.EstimatedPoints.Empty())
|
if (hasEstimatedAmounts)
|
||||||
auraData.EstimatedPoints.Resize((uint)auraData.Points.Count); // pad to equal sizes
|
{
|
||||||
|
// When sending EstimatedPoints all effects (at least up to the last one that uses GetEstimatedAmount) must have proper value in packet
|
||||||
|
foreach (AuraEffect effect in GetBase().GetAuraEffects())
|
||||||
|
if (effect != null && HasEffect(effect.GetEffIndex())) // Not all of aura's effects have to be applied on every target
|
||||||
|
auraData.EstimatedPoints[(int)effect.GetEffIndex()] = effect.GetEstimatedAmount().GetValueOrDefault(effect.GetAmount());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user