aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2022-01-11 19:21:51 +0100
committerShauren <shauren.trinity@gmail.com>2022-01-11 19:21:51 +0100
commitbf6b3aaed6b87225b970390c45b91a51242206c0 (patch)
treeb5383b0e0efa6d77b6dc7f164bc9fcf7ac923126
parent415aaae7f2fa3a5e09a51b0355120bf4138cde41 (diff)
Core/Auras: Fixed sending EstimatedPoints for auras that have only some effects that use it
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.cpp14
1 files changed, 10 insertions, 4 deletions
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());
+ }
}
}