From d0b0f35a42948cfa82755256a877d9f92e7496d0 Mon Sep 17 00:00:00 2001 From: Ovahlord <18347559+ovahlord@users.noreply.github.com> Date: Thu, 11 Jun 2026 05:41:38 +0200 Subject: [PATCH] Core/Units: fixed initializing stat multipliers and displaying positive and negative mods --- src/server/game/Entities/Unit/Stats.cpp | 4 ++-- src/server/game/Entities/Unit/Unit.cpp | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/server/game/Entities/Unit/Stats.cpp b/src/server/game/Entities/Unit/Stats.cpp index 18b5923e85..8ab21c74e9 100644 --- a/src/server/game/Entities/Unit/Stats.cpp +++ b/src/server/game/Entities/Unit/Stats.cpp @@ -27,7 +27,7 @@ Stats::Stats(Unit* owner) : _owner(owner), _baseStats({ }), _baseStatModifiers({ _totalModifiers({ }), _totalPctMultipliers({ }) { _basePctMultipliers.fill(1.0); - _totalModifiers.fill(1.0); + _totalPctMultipliers.fill(1.0); } /// Returns the unmodified base value of the specified stat. @@ -255,7 +255,7 @@ void Stats::updateStat(StatType statType) if (totalValue < statValue) posStatValue += statValue - totalValue; else - negStatValue += statValue - totalValue; + negStatValue += totalValue - statValue; // ==== Apply the stats _owner->SetInt32Value(UNIT_FIELD_STAT0 + AsUnderlyingType(statType), statValue); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 70b129f5b7..03a7237e55 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -13631,8 +13631,7 @@ void Unit::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target) // there are some float values which may be negative or can't get negative due to other checks else if ((index >= UNIT_FIELD_NEGSTAT0 && index <= UNIT_FIELD_NEGSTAT4) || (index >= UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE && index <= (UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE + 6)) || - (index >= UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE && index <= (UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE + 6)) || - (index >= UNIT_FIELD_POSSTAT0 && index <= UNIT_FIELD_POSSTAT4)) + (index >= UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE && index <= (UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE + 6))) { fieldBuffer << uint32(m_floatValues[index]); }