From bf6b3aaed6b87225b970390c45b91a51242206c0 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 11 Jan 2022 19:21:51 +0100 Subject: Core/Auras: Fixed sending EstimatedPoints for auras that have only some effects that use it --- src/server/game/Spells/Auras/SpellAuras.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index d9d6a9091b7..1a7ca313a2d 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -261,18 +261,24 @@ void AuraApplication::BuildUpdatePacket(WorldPackets::Spells::AuraInfo& auraInfo if (auraData.Flags & AFLAG_SCALABLE) { auraData.Points.reserve(aura->GetAuraEffects().size()); - auraData.EstimatedPoints.reserve(aura->GetAuraEffects().size()); + bool hasEstimatedAmounts = false; for (AuraEffect const* effect : GetBase()->GetAuraEffects()) { if (effect && HasEffect(effect->GetEffIndex())) // Not all of aura's effects have to be applied on every target { Trinity::Containers::EnsureWritableVectorIndex(auraData.Points, effect->GetEffIndex()) = float(effect->GetAmount()); if (effect->GetEstimatedAmount()) - Trinity::Containers::EnsureWritableVectorIndex(auraData.EstimatedPoints, effect->GetEffIndex()) = *effect->GetEstimatedAmount(); + hasEstimatedAmounts = true; } } - if (!auraData.EstimatedPoints.empty()) - auraData.EstimatedPoints.resize(auraData.Points.size()); // pad to equal sizes + if (hasEstimatedAmounts) + { + // When sending EstimatedPoints all effects (at least up to the last one that uses GetEstimatedAmount) must have proper value in packet + auraData.EstimatedPoints.resize(auraData.Points.size()); + for (AuraEffect const* effect : GetBase()->GetAuraEffects()) + if (effect && HasEffect(effect->GetEffIndex())) // Not all of aura's effects have to be applied on every target + auraData.EstimatedPoints[effect->GetEffIndex()] = effect->GetEstimatedAmount().value_or(effect->GetAmount()); + } } } -- cgit v1.2.3