aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-01-01 00:26:53 +0100
committerShauren <shauren.trinity@gmail.com>2023-08-12 14:24:24 +0200
commitb7287e85e4bc8acb2b95271ece9dd8a5b93873cd (patch)
tree6088602ac914ef69573ce551d7fc4f0613beb5ce /src/server/game/Entities
parentf9033a5dbd559fde3030a21d83d664983d95f39f (diff)
Core/Misc: Fixed deprecation warnings for c++20
(cherry picked from commit ba9bbbc9d0c3b80d8954ad6390d23ae3d0f804b2)
Diffstat (limited to 'src/server/game/Entities')
-rw-r--r--src/server/game/Entities/Object/Position.cpp2
-rw-r--r--src/server/game/Entities/Object/Position.h4
-rw-r--r--src/server/game/Entities/Pet/Pet.cpp4
-rw-r--r--src/server/game/Entities/Player/Player.cpp16
-rw-r--r--src/server/game/Entities/Transport/Transport.cpp4
-rw-r--r--src/server/game/Entities/Unit/StatSystem.cpp18
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp26
-rw-r--r--src/server/game/Entities/Unit/Unit.h18
8 files changed, 46 insertions, 46 deletions
diff --git a/src/server/game/Entities/Object/Position.cpp b/src/server/game/Entities/Object/Position.cpp
index 1304acebe5d..ecbe15d96cd 100644
--- a/src/server/game/Entities/Object/Position.cpp
+++ b/src/server/game/Entities/Object/Position.cpp
@@ -25,7 +25,7 @@
#include <G3D/g3dmath.h>
#include <sstream>
-bool Position::operator==(Position const& a)
+bool Position::operator==(Position const& a) const
{
return (G3D::fuzzyEq(a.m_positionX, m_positionX) &&
G3D::fuzzyEq(a.m_positionY, m_positionY) &&
diff --git a/src/server/game/Entities/Object/Position.h b/src/server/game/Entities/Object/Position.h
index a9713f9443c..d029c270380 100644
--- a/src/server/game/Entities/Object/Position.h
+++ b/src/server/game/Entities/Object/Position.h
@@ -61,8 +61,8 @@ private:
float m_orientation;
public:
- bool operator==(Position const& a);
- bool operator!=(Position const& a) { return !(operator==(a)); }
+ bool operator==(Position const& a) const;
+ bool operator!=(Position const& a) const { return !(operator==(a)); }
void Relocate(float x, float y) { m_positionX = x; m_positionY = y; }
void Relocate(float x, float y, float z) { Relocate(x, y); m_positionZ = z; }
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index 26297f26f63..8e57375e2e8 100644
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -960,8 +960,8 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
case SUMMON_PET:
{
// the damage bonus used for pets is either fire or shadow damage, whatever is higher
- int32 fire = GetOwner()->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE);
- int32 shadow = GetOwner()->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW);
+ int32 fire = GetOwner()->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + AsUnderlyingType(SPELL_SCHOOL_FIRE));
+ int32 shadow = GetOwner()->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + AsUnderlyingType(SPELL_SCHOOL_SHADOW));
int32 val = (fire > shadow) ? fire : shadow;
if (val < 0)
val = 0;
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 7cf2edefaab..1eceae7f9bc 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -2172,7 +2172,7 @@ void Player::Regenerate(Powers power)
if (m_regenTimerCount >= 2000)
SetPower(power, curValue);
else
- UpdateUInt32Value(UNIT_FIELD_POWER1 + power, curValue);
+ UpdateUInt32Value(UNIT_FIELD_POWER1 + AsUnderlyingType(power), curValue);
}
void Player::RegenerateHealth()
@@ -2808,8 +2808,8 @@ void Player::InitStatsForLevel(bool reapplyMods)
// set armor (resistance 0) to original value (create_agility*2)
SetArmor(int32(m_createStats[STAT_AGILITY]*2));
- SetFloatValue(UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE + SPELL_SCHOOL_NORMAL, 0.0f);
- SetFloatValue(UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE + SPELL_SCHOOL_NORMAL, 0.0f);
+ SetFloatValue(UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE + AsUnderlyingType(SPELL_SCHOOL_NORMAL), 0.0f);
+ SetFloatValue(UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE + AsUnderlyingType(SPELL_SCHOOL_NORMAL), 0.0f);
// set other resistance to original value (0)
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
{
@@ -5361,7 +5361,7 @@ void Player::GetDodgeFromAgility(float &diminishing, float &nondiminishing) cons
return;
/// @todo research if talents/effects that increase total agility by x% should increase non-diminishing part
- float base_agility = GetCreateStat(STAT_AGILITY) * GetPctModifierValue(UnitMods(UNIT_MOD_STAT_START + STAT_AGILITY), BASE_PCT);
+ float base_agility = GetCreateStat(STAT_AGILITY) * GetPctModifierValue(UnitMods(UNIT_MOD_STAT_START + AsUnderlyingType(STAT_AGILITY)), BASE_PCT);
float bonus_agility = GetStat(STAT_AGILITY) - base_agility;
// calculate diminishing (green in char screen) and non-diminishing (white) contribution
@@ -5404,7 +5404,7 @@ float Player::GetRatingMultiplier(CombatRating cr) const
float Player::GetRatingBonusValue(CombatRating cr) const
{
- return float(GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + cr)) * GetRatingMultiplier(cr);
+ return float(GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + AsUnderlyingType(cr))) * GetRatingMultiplier(cr);
}
float Player::GetExpertiseDodgeOrParryReduction(WeaponAttackType attType) const
@@ -5507,7 +5507,7 @@ void Player::UpdateRating(CombatRating cr)
if (amount < 0)
amount = 0;
- SetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + cr, uint32(amount));
+ SetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + AsUnderlyingType(cr), uint32(amount));
bool affectStats = CanModifyStats();
@@ -8055,7 +8055,7 @@ void Player::CastItemCombatSpell(DamageInfo const& damageInfo, Item* item, ItemT
for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
if (spellEffectInfo.IsEffect())
- args.AddSpellMod(static_cast<SpellValueMod>(SPELLVALUE_BASE_POINT0 + spellEffectInfo.EffectIndex), CalculatePct(spellEffectInfo.CalcValue(this), effectPct));
+ args.AddSpellMod(static_cast<SpellValueMod>(SPELLVALUE_BASE_POINT0 + AsUnderlyingType(spellEffectInfo.EffectIndex)), CalculatePct(spellEffectInfo.CalcValue(this), effectPct));
}
CastSpell(target, spellInfo->Id, args);
}
@@ -20261,7 +20261,7 @@ void Player::_SaveStats(CharacterDatabaseTransaction trans) const
stmt->setUInt32(index++, GetUInt32Value(UNIT_FIELD_ATTACK_POWER));
stmt->setUInt32(index++, GetUInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER));
stmt->setUInt32(index++, GetBaseSpellPowerBonus());
- stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_CRIT_TAKEN_SPELL));
+ stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + AsUnderlyingType(CR_CRIT_TAKEN_SPELL)));
trans->Append(stmt);
}
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 6e4b0ed7857..cd1b4f4b819 100644
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -585,8 +585,8 @@ float Transport::CalculateSegmentPos(float now)
KeyFrame const& frame = *_currentFrame;
const float speed = float(m_goInfo->moTransport.moveSpeed);
const float accel = float(m_goInfo->moTransport.accelRate);
- float timeSinceStop = frame.TimeFrom + (now - (1.0f/IN_MILLISECONDS) * frame.DepartureTime);
- float timeUntilStop = frame.TimeTo - (now - (1.0f/IN_MILLISECONDS) * frame.DepartureTime);
+ float timeSinceStop = frame.TimeFrom + (now - (1.0f / float(IN_MILLISECONDS)) * frame.DepartureTime);
+ float timeUntilStop = frame.TimeTo - (now - (1.0f / float(IN_MILLISECONDS)) * frame.DepartureTime);
float segmentPos, dist;
float accelTime = _transportInfo->accelTime;
float accelDist = _transportInfo->accelDist;
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index 5dccf992645..b4c09f71e31 100644
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -316,7 +316,7 @@ void Player::UpdateMaxHealth()
void Player::UpdateMaxPower(Powers power)
{
- UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
+ UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + AsUnderlyingType(power));
float bonusPower = (power == POWER_MANA && GetCreatePowerValue(power) > 0) ? GetManaBonusFromIntellect() : 0;
@@ -851,7 +851,7 @@ void Player::UpdateSpellCritChance(uint32 school)
void Player::UpdateArmorPenetration(int32 amount)
{
// Store Rating Value
- SetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_ARMOR_PENETRATION, amount);
+ SetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + AsUnderlyingType(CR_ARMOR_PENETRATION), amount);
}
void Player::UpdateMeleeHitChances()
@@ -1036,7 +1036,7 @@ void Creature::UpdateMaxHealth()
void Creature::UpdateMaxPower(Powers power)
{
- UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
+ UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + AsUnderlyingType(power));
float value = GetFlatModifierValue(unitMod, BASE_VALUE) + GetCreatePowerValue(power);
value *= GetPctModifierValue(unitMod, BASE_PCT);
@@ -1329,7 +1329,7 @@ void Guardian::UpdateMaxHealth()
void Guardian::UpdateMaxPower(Powers power)
{
- UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
+ UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + AsUnderlyingType(power));
float addValue = (power == POWER_MANA) ? GetStat(STAT_INTELLECT) - GetCreateStat(STAT_INTELLECT) : 0.0f;
float multiplicator = 15.0f;
@@ -1409,8 +1409,8 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged)
//demons benefit from warlocks shadow or fire damage
else if (IsPet())
{
- int32 fire = owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE) - owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
- int32 shadow = owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW) - owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW);
+ int32 fire = owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + AsUnderlyingType(SPELL_SCHOOL_FIRE)) - owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + AsUnderlyingType(SPELL_SCHOOL_FIRE));
+ int32 shadow = owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + AsUnderlyingType(SPELL_SCHOOL_SHADOW)) - owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + AsUnderlyingType(SPELL_SCHOOL_SHADOW));
int32 maximum = (fire > shadow) ? fire : shadow;
if (maximum < 0)
maximum = 0;
@@ -1420,7 +1420,7 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged)
//water elementals benefit from mage's frost damage
else if (GetEntry() == ENTRY_WATER_ELEMENTAL)
{
- int32 frost = owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST) - owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FROST);
+ int32 frost = owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + AsUnderlyingType(SPELL_SCHOOL_FROST)) - owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + AsUnderlyingType(SPELL_SCHOOL_FROST));
if (frost < 0)
frost = 0;
SetBonusDamage(int32(frost * 0.4f));
@@ -1453,14 +1453,14 @@ void Guardian::UpdateDamagePhysical(WeaponAttackType attType)
//force of nature
if (GetEntry() == ENTRY_TREANT)
{
- int32 spellDmg = m_owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_NATURE) - m_owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_NATURE);
+ int32 spellDmg = m_owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + AsUnderlyingType(SPELL_SCHOOL_NATURE)) - m_owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + AsUnderlyingType(SPELL_SCHOOL_NATURE));
if (spellDmg > 0)
bonusDamage = spellDmg * 0.09f;
}
//greater fire elemental
else if (GetEntry() == ENTRY_FIRE_ELEMENTAL)
{
- int32 spellDmg = m_owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE) - m_owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
+ int32 spellDmg = m_owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + AsUnderlyingType(SPELL_SCHOOL_FIRE)) - m_owner->GetInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + AsUnderlyingType(SPELL_SCHOOL_FIRE));
if (spellDmg > 0)
bonusDamage = spellDmg * 0.4f;
}
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index f2f1fbb955e..be5927abd26 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -4954,8 +4954,8 @@ void Unit::UpdateResistanceBuffModsMod(SpellSchools school)
modPos *= factor;
modNeg *= factor;
- SetFloatValue(UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE + school, modPos);
- SetFloatValue(UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE + school, modNeg);
+ SetFloatValue(UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE + AsUnderlyingType(school), modPos);
+ SetFloatValue(UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE + AsUnderlyingType(school), modNeg);
}
void Unit::InitStatBuffMods()
@@ -4972,7 +4972,7 @@ void Unit::UpdateStatBuffMod(Stats stat)
float modNeg = 0.0f;
float factor = 0.0f;
- UnitMods const unitMod = static_cast<UnitMods>(UNIT_MOD_STAT_START + stat);
+ UnitMods const unitMod = static_cast<UnitMods>(UNIT_MOD_STAT_START + AsUnderlyingType(stat));
// includes value from items and enchantments
float modValue = GetFlatModifierValue(unitMod, BASE_VALUE);
@@ -5021,8 +5021,8 @@ void Unit::UpdateStatBuffMod(Stats stat)
modPos *= factor;
modNeg *= factor;
- SetFloatValue(UNIT_FIELD_POSSTAT0 + stat, modPos);
- SetFloatValue(UNIT_FIELD_NEGSTAT0 + stat, modNeg);
+ SetFloatValue(UNIT_FIELD_POSSTAT0 + AsUnderlyingType(stat), modPos);
+ SetFloatValue(UNIT_FIELD_NEGSTAT0 + AsUnderlyingType(stat), modNeg);
}
void Unit::_RegisterDynObject(DynamicObject* dynObj)
@@ -7023,7 +7023,7 @@ float Unit::SpellCritChanceDone(SpellInfo const* spellInfo, SpellSchoolMask scho
crit_chance = 0.0f;
// For other schools
else if (GetTypeId() == TYPEID_PLAYER)
- crit_chance = GetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + GetFirstSchoolInMask(schoolMask));
+ crit_chance = GetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + AsUnderlyingType(GetFirstSchoolInMask(schoolMask)));
else
{
crit_chance = (float)m_baseSpellCritChance;
@@ -8461,7 +8461,7 @@ int32 Unit::ModifyPower(Powers power, int32 dVal, bool withPowerUpdate /*= true*
uint32 Unit::GetAttackTime(WeaponAttackType att) const
{
- float f_BaseAttackTime = GetFloatValue(UNIT_FIELD_BASEATTACKTIME + att) / m_modAttackSpeedPct[att];
+ float f_BaseAttackTime = GetFloatValue(UNIT_FIELD_BASEATTACKTIME + AsUnderlyingType(att)) / m_modAttackSpeedPct[att];
return (uint32)f_BaseAttackTime;
}
@@ -9212,7 +9212,7 @@ void Unit::UpdateAllDamagePctDoneMods()
float Unit::GetTotalStatValue(Stats stat) const
{
- UnitMods unitMod = UnitMods(UNIT_MOD_STAT_START + stat);
+ UnitMods unitMod = UnitMods(UNIT_MOD_STAT_START + AsUnderlyingType(stat));
// value = ((base_value * base_pct) + total_value) * total_pct
float value = GetFlatModifierValue(unitMod, BASE_VALUE) + GetCreateStat(stat);
@@ -9411,7 +9411,7 @@ void Unit::SetPower(Powers power, uint32 val, bool withPowerUpdate /*= true*/)
if (maxPower < val)
val = maxPower;
- SetStatInt32Value(UNIT_FIELD_POWER1 + power, val);
+ SetStatInt32Value(UNIT_FIELD_POWER1 + AsUnderlyingType(power), val);
if (withPowerUpdate)
{
@@ -9446,7 +9446,7 @@ void Unit::SetPower(Powers power, uint32 val, bool withPowerUpdate /*= true*/)
void Unit::SetMaxPower(Powers power, uint32 val)
{
uint32 cur_power = GetPower(power);
- SetStatInt32Value(UNIT_FIELD_MAXPOWER1 + power, val);
+ SetStatInt32Value(UNIT_FIELD_MAXPOWER1 + AsUnderlyingType(power), val);
// group update
if (GetTypeId() == TYPEID_PLAYER)
@@ -10603,7 +10603,7 @@ void ApplyPercentModFloatVar(float& var, float val, bool apply)
void Unit::ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
{
- float amount = GetFloatValue(UNIT_FIELD_BASEATTACKTIME + att);
+ float amount = GetFloatValue(UNIT_FIELD_BASEATTACKTIME + AsUnderlyingType(att));
float remainingTimePct = (float)m_attackTimer[att] / (GetAttackTime(att) * m_modAttackSpeedPct[att]);
if (val > 0.f)
@@ -10617,7 +10617,7 @@ void Unit::ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply
ApplyPercentModFloatVar(amount, -val, apply);
}
- SetFloatValue(UNIT_FIELD_BASEATTACKTIME + att, amount);
+ SetFloatValue(UNIT_FIELD_BASEATTACKTIME + AsUnderlyingType(att), amount);
m_attackTimer[att] = uint32(GetAttackTime(att) * m_modAttackSpeedPct[att] * remainingTimePct);
}
@@ -12754,7 +12754,7 @@ void Unit::_ExitVehicle(Position const* exitPosition)
}
}
- std::function<void(Movement::MoveSplineInit&)> initializer = [=, vehicleCollisionHeight = vehicle->GetBase()->GetCollisionHeight()](Movement::MoveSplineInit& init)
+ std::function<void(Movement::MoveSplineInit&)> initializer = [=, this, vehicleCollisionHeight = vehicle->GetBase()->GetCollisionHeight()](Movement::MoveSplineInit& init)
{
float height = pos.GetPositionZ() + vehicleCollisionHeight;
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index b7d8afcf47e..99fb781cef8 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -899,14 +899,14 @@ class TC_GAME_API Unit : public WorldObject
virtual Gender GetNativeGender() const { return GetGender(); }
virtual void SetNativeGender(Gender gender) { SetGender(gender); }
- float GetStat(Stats stat) const { return float(GetUInt32Value(UNIT_FIELD_STAT0+stat)); }
- void SetStat(Stats stat, int32 val) { SetStatInt32Value(UNIT_FIELD_STAT0+stat, val); }
+ float GetStat(Stats stat) const { return float(GetUInt32Value(UNIT_FIELD_STAT0 + int32(stat))); }
+ void SetStat(Stats stat, int32 val) { SetStatInt32Value(UNIT_FIELD_STAT0 + int32(stat), val); }
uint32 GetArmor() const { return GetResistance(SPELL_SCHOOL_NORMAL); }
void SetArmor(int32 val) { SetResistance(SPELL_SCHOOL_NORMAL, val); }
- int32 GetResistance(SpellSchools school) const { return GetInt32Value(UNIT_FIELD_RESISTANCES + school); }
+ int32 GetResistance(SpellSchools school) const { return GetInt32Value(UNIT_FIELD_RESISTANCES + int32(school)); }
int32 GetResistance(SpellSchoolMask mask) const;
- void SetResistance(SpellSchools school, int32 val) { SetStatInt32Value(UNIT_FIELD_RESISTANCES + school, val); }
+ void SetResistance(SpellSchools school, int32 val) { SetStatInt32Value(UNIT_FIELD_RESISTANCES + int32(school), val); }
static float CalculateAverageResistReduction(WorldObject const* caster, SpellSchoolMask schoolMask, Unit const* victim, SpellInfo const* spellInfo = nullptr);
uint32 GetHealth() const { return GetUInt32Value(UNIT_FIELD_HEALTH); }
@@ -930,8 +930,8 @@ class TC_GAME_API Unit : public WorldObject
Powers GetPowerType() const { return Powers(GetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_POWER_TYPE)); }
void SetPowerType(Powers power, bool sendUpdate = true);
void UpdateDisplayPower();
- uint32 GetPower(Powers power) const { return GetUInt32Value(UNIT_FIELD_POWER1 +power); }
- uint32 GetMaxPower(Powers power) const { return GetUInt32Value(UNIT_FIELD_MAXPOWER1+power); }
+ uint32 GetPower(Powers power) const { return GetUInt32Value(UNIT_FIELD_POWER1 + int32(power)); }
+ uint32 GetMaxPower(Powers power) const { return GetUInt32Value(UNIT_FIELD_MAXPOWER1 + int32(power)); }
float GetPowerPct(Powers power) const { return GetMaxPower(power) ? 100.f * GetPower(power) / GetMaxPower(power) : 0.0f; }
int32 CountPctFromMaxPower(Powers power, int32 pct) const { return CalculatePct(GetMaxPower(power), pct); }
void SetPower(Powers power, uint32 val, bool withPowerUpdate = true);
@@ -941,7 +941,7 @@ class TC_GAME_API Unit : public WorldObject
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate = true);
uint32 GetAttackTime(WeaponAttackType att) const;
- void SetAttackTime(WeaponAttackType att, uint32 val) { SetFloatValue(UNIT_FIELD_BASEATTACKTIME+att, val*m_modAttackSpeedPct[att]); }
+ void SetAttackTime(WeaponAttackType att, uint32 val) { SetFloatValue(UNIT_FIELD_BASEATTACKTIME + int32(att), val * m_modAttackSpeedPct[att]); }
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply);
void ApplyCastTimePercentMod(float val, bool apply);
@@ -1450,8 +1450,8 @@ class TC_GAME_API Unit : public WorldObject
void SetCreateMana(uint32 val) { SetUInt32Value(UNIT_FIELD_BASE_MANA, val); }
uint32 GetCreateMana() const { return GetUInt32Value(UNIT_FIELD_BASE_MANA); }
uint32 GetCreatePowerValue(Powers power) const;
- float GetPosStat(Stats stat) const { return GetFloatValue(UNIT_FIELD_POSSTAT0+stat); }
- float GetNegStat(Stats stat) const { return GetFloatValue(UNIT_FIELD_NEGSTAT0+stat); }
+ float GetPosStat(Stats stat) const { return GetFloatValue(UNIT_FIELD_POSSTAT0 + int32(stat)); }
+ float GetNegStat(Stats stat) const { return GetFloatValue(UNIT_FIELD_NEGSTAT0 + int32(stat)); }
float GetCreateStat(Stats stat) const { return m_createStats[stat]; }
uint32 GetChannelSpellId() const { return GetUInt32Value(UNIT_CHANNEL_SPELL); }