Core/Units: renamed PrimaryStat to AllStats2 as the only known spell with the misc value for that type is also affecting all stats. Also cleaned up accidental include

This commit is contained in:
Ovahlord committed 2026-06-11 10:06:35 +02:00
1 parent 133b635925
commit 8bd0bfdb8c
13 files changed
+29 -49

No files matched your search

@@ -24,6 +24,7 @@
#include "ObjectAccessor.h"
#include "Pet.h"
#include "Player.h"
#include "Stats.h"
TempSummon::TempSummon(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject) :
Creature(isWorldObject), m_Properties(properties), m_type(TEMPSUMMON_MANUAL_DESPAWN),
@@ -131,7 +131,7 @@ class TC_GAME_API Guardian : public Minion
void SetBonusDamage(int32 damage);
protected:
int32 m_bonusSpellDamage;
float m_statFromOwner[AsUnderlyingType(StatType::Max)];
float m_statFromOwner[5];
};
class TC_GAME_API Puppet : public Minion
@@ -102,6 +102,7 @@
#include "SpellHistory.h"
#include "SpellMgr.h"
#include "SpellPackets.h"
#include "Stats.h"
#include "StringConvert.h"
#include "TerrainMgr.h"
#include "TicketMgr.h"
@@ -26,6 +26,7 @@
#include "SpellAuraEffects.h"
#include "SpellAuras.h"
#include "SpellMgr.h"
#include "Stats.h"
#include "World.h"
#include <G3D/g3dmath.h>
#include <numeric>
+7 -34
View File
@@ -75,7 +75,7 @@ void Stats::RemoveBaseStatModifier(StatType statType, int32 value)
/// @param statType The stat which multiplier value will be updated
void Stats::UpdateBaseStatMultiplier(StatType statType)
{
if (statType == StatType::AllStats)
if (statType == StatType::AllStats || statType == StatType::AllStats2)
{
for (StatType stat : AllStats)
{
@@ -84,13 +84,6 @@ void Stats::UpdateBaseStatMultiplier(StatType statType)
updateStat(stat);
}
}
else if (statType == StatType::PrimaryStat)
{
StatType primaryStat = GetPrimaryStat();
float multiplier = getAuraMultiplierForStatType(SPELL_AURA_MOD_PERCENT_STAT, primaryStat);
_basePctMultipliers[AsUnderlyingType(primaryStat)] = multiplier;
updateStat(primaryStat);
}
else
{
float multiplier = getAuraMultiplierForStatType(SPELL_AURA_MOD_PERCENT_STAT, statType);
@@ -104,7 +97,7 @@ void Stats::UpdateBaseStatMultiplier(StatType statType)
/// @param statType The stat which modifier value will be updated
void Stats::UpdateTotalStatModifier(StatType statType)
{
if (statType == StatType::AllStats)
if (statType == StatType::AllStats || statType == StatType::AllStats2)
{
for (StatType stat : AllStats)
{
@@ -113,13 +106,6 @@ void Stats::UpdateTotalStatModifier(StatType statType)
updateStat(stat);
}
}
else if (statType == StatType::PrimaryStat)
{
StatType primaryStat = GetPrimaryStat();
int32 modifier = getAuraModifierForStatType(SPELL_AURA_MOD_STAT, primaryStat);
_totalModifiers[AsUnderlyingType(primaryStat)] = modifier;
updateStat(primaryStat);
}
else
{
int32 modifier = getAuraModifierForStatType(SPELL_AURA_MOD_STAT, statType);
@@ -133,7 +119,7 @@ void Stats::UpdateTotalStatModifier(StatType statType)
/// @param statType The stat which multiplier value will be updated
void Stats::UpdateTotalStatMultiplier(StatType statType)
{
if (statType == StatType::AllStats)
if (statType == StatType::AllStats || statType == StatType::AllStats2)
{
for (StatType stat : AllStats)
{
@@ -142,13 +128,6 @@ void Stats::UpdateTotalStatMultiplier(StatType statType)
updateStat(stat);
}
}
else if (statType == StatType::PrimaryStat)
{
StatType primaryStat = GetPrimaryStat();
float multiplier = getAuraMultiplierForStatType(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, primaryStat);
_totalPctMultipliers[AsUnderlyingType(primaryStat)] = multiplier;
updateStat(primaryStat);
}
else
{
float multiplier = getAuraMultiplierForStatType(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, statType);
@@ -238,7 +217,7 @@ void Stats::updateStat(StatType statType)
if (flatStatValue < baseTotalValue)
posStatValue += baseTotalValue - flatStatValue;
else
negStatValue += flatStatValue - baseTotalValue;
negStatValue += baseTotalValue - flatStatValue;
// ==== Calculate the total value (Total value buff auras)
int32 totalModifier = _totalModifiers[AsUnderlyingType(statType)];
@@ -255,7 +234,7 @@ void Stats::updateStat(StatType statType)
if (totalValue < statValue)
posStatValue += statValue - totalValue;
else
negStatValue += totalValue - statValue;
negStatValue += statValue - totalValue;
// ==== Apply the stats
_owner->SetInt32Value(UNIT_FIELD_STAT0 + AsUnderlyingType(statType), statValue);
@@ -302,10 +281,7 @@ float Stats::getAuraMultiplierForStatType(AuraType auraType, StatType statType)
float multiplier = _owner->GetTotalAuraMultiplier(auraType, [&](AuraEffect const* aurEff)
{
StatType auraStatType = static_cast<StatType>(aurEff->GetMiscValue());
if (auraStatType == StatType::AllStats || auraStatType == statType)
return true;
if (auraStatType == StatType::PrimaryStat && statType == GetPrimaryStat())
if (auraStatType == StatType::AllStats || auraStatType == StatType::AllStats2 || auraStatType == statType)
return true;
return false;
@@ -319,10 +295,7 @@ int32 Stats::getAuraModifierForStatType(AuraType auraType, StatType statType) co
int32 modifier = _owner->GetTotalAuraModifier(auraType, [&](AuraEffect const* aurEff)
{
StatType auraStatType = static_cast<StatType>(aurEff->GetMiscValue());
if (auraStatType == StatType::AllStats || auraStatType == statType)
return true;
if (auraStatType == StatType::PrimaryStat && statType == GetPrimaryStat())
if (auraStatType == StatType::AllStats || auraStatType == StatType::AllStats2 || auraStatType == statType)
return true;
return false;
+1 -1
View File
@@ -27,7 +27,7 @@ enum AuraType : uint32;
enum class StatType : int8
{
PrimaryStat = -2,
AllStats2 = -2, // There is only one spell using this and it also states that it increases all stats
AllStats = -1,
Strength = 0,
Agility = 1,
+1 -2
View File
@@ -13629,8 +13629,7 @@ void Unit::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target)
fieldBuffer << uint32(m_floatValues[index] < 0 ? 0 : m_floatValues[index]);
}
// 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)) ||
else if ((index >= UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE && index <= (UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE + 6)) ||
(index >= UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE && index <= (UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE + 6)))
{
fieldBuffer << uint32(m_floatValues[index]);
+2 -1
View File
@@ -22,7 +22,6 @@
#include "Object.h"
#include "SpellAuraDefines.h"
#include "SpellDefines.h"
#include "Stats.h"
#include "ThreatManager.h"
#include "Timer.h"
#include "UnitDefines.h"
@@ -105,6 +104,8 @@ enum ProcFlagsSpellType : uint32;
enum ZLiquidStatus : uint32;
enum CharmType : uint8;
enum class StatType : int8;
namespace Movement
{
class ExtraMovementStatusElement;
@@ -3570,7 +3570,7 @@ void AuraEffect::HandleAuraModStat(AuraApplication const* aurApp, uint8 mode, bo
return;
StatType stat = static_cast<StatType>(GetMiscValue());
if (stat < StatType::PrimaryStat || stat >= StatType::Max)
if (stat < StatType::AllStats2 || stat >= StatType::Max)
{
TC_LOG_ERROR("spells", "WARNING: Spell %u effect %u has an unsupported misc value (%i) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue());
return;
@@ -3586,7 +3586,7 @@ void AuraEffect::HandleModPercentStat(AuraApplication const* aurApp, uint8 mode,
return;
StatType stat = static_cast<StatType>(GetMiscValue());
if (stat < StatType::PrimaryStat || stat >= StatType::Max)
if (stat < StatType::AllStats2 || stat >= StatType::Max)
{
TC_LOG_ERROR("spells", "WARNING: Spell %u effect %u has an unsupported misc value (%i) for SPELL_AURA_MOD_PERCENT_STAT ", GetId(), GetEffIndex(), GetMiscValue());
return;
@@ -3676,7 +3676,7 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8
return;
StatType stat = static_cast<StatType>(GetMiscValue());
if (stat < StatType::PrimaryStat || stat >= StatType::Max)
if (stat < StatType::AllStats2 || stat >= StatType::Max)
{
TC_LOG_ERROR("spells", "WARNING: Spell %u effect %u has an unsupported misc value (%i) for SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE ", GetId(), GetEffIndex(), GetMiscValue());
return;
+3 -2
View File
@@ -22,10 +22,10 @@
* Scriptnames of files in this file should be prefixed with "spell_gen_"
*/
#include "ScriptMgr.h"
#include "Battleground.h"
#include "CellImpl.h"
#include "Containers.h"
#include "CreatureAIImpl.h"
#include "DBCStores.h"
#include "GameTime.h"
#include "GridNotifiersImpl.h"
@@ -36,13 +36,14 @@
#include "ObjectAccessor.h"
#include "Pet.h"
#include "ReputationMgr.h"
#include "ScriptMgr.h"
#include "SkillDiscovery.h"
#include "SpellAuraEffects.h"
#include "SpellHistory.h"
#include "SpellMgr.h"
#include "SpellScript.h"
#include "Stats.h"
#include "Vehicle.h"
#include "CreatureAIImpl.h"
namespace Spells::Generic
{
+3 -2
View File
@@ -21,20 +21,21 @@
* Scriptnames of files in this file should be prefixed with "spell_item_".
*/
#include "ScriptMgr.h"
#include "Battleground.h"
#include "CreatureAIImpl.h"
#include "Containers.h"
#include "CreatureAIImpl.h"
#include "DBCStores.h"
#include "Map.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SkillDiscovery.h"
#include "SpellAuraEffects.h"
#include "SpellHistory.h"
#include "SpellMgr.h"
#include "SpellScript.h"
#include "Stats.h"
namespace Spells::Items
{
+2 -1
View File
@@ -21,13 +21,14 @@
* Scriptnames of files in this file should be prefixed with "spell_dk_".
*/
#include "ScriptMgr.h"
#include "ObjectMgr.h"
#include "Pet.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "SpellAuraEffects.h"
#include "SpellMgr.h"
#include "SpellScript.h"
#include "Stats.h"
#include "Unit.h"
namespace Spells::Pets
+3 -2
View File
@@ -21,14 +21,15 @@
* Scriptnames of files in this file should be prefixed with "spell_sha_".
*/
#include "ScriptMgr.h"
#include "Player.h"
#include "GridNotifiers.h"
#include "Item.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "SpellAuraEffects.h"
#include "SpellHistory.h"
#include "SpellMgr.h"
#include "SpellScript.h"
#include "Stats.h"
#include "TemporarySummon.h"
#include "Unit.h"