aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/DataStores/DB2Stores.cpp4
-rw-r--r--src/server/game/DataStores/DB2Stores.h2
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp15
-rw-r--r--src/server/game/Entities/Creature/Creature.h1
-rw-r--r--src/server/game/Entities/Creature/TemporarySummon.h36
-rw-r--r--src/server/game/Entities/Pet/Pet.cpp18
-rw-r--r--src/server/game/Entities/Player/Player.cpp16
-rw-r--r--src/server/game/Entities/Player/Player.h1
-rw-r--r--src/server/game/Entities/Unit/StatSystem.cpp57
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp58
-rw-r--r--src/server/game/Entities/Unit/Unit.h2
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp2
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp2
13 files changed, 130 insertions, 84 deletions
diff --git a/src/server/game/DataStores/DB2Stores.cpp b/src/server/game/DataStores/DB2Stores.cpp
index ff6c7acced8..4c7502c337a 100644
--- a/src/server/game/DataStores/DB2Stores.cpp
+++ b/src/server/game/DataStores/DB2Stores.cpp
@@ -1280,9 +1280,9 @@ char const* DB2Manager::GetClassName(uint8 class_, LocaleConstant locale /*= DEF
return classEntry->Name->Str[DEFAULT_LOCALE];
}
-uint32 DB2Manager::GetPowerIndexByClass(uint32 powerType, uint32 classId) const
+uint32 DB2Manager::GetPowerIndexByClass(Powers power, uint32 classId) const
{
- return _powersByClass[classId][powerType];
+ return _powersByClass[classId][power];
}
char const* DB2Manager::GetChrRaceName(uint8 race, LocaleConstant locale /*= DEFAULT_LOCALE*/)
diff --git a/src/server/game/DataStores/DB2Stores.h b/src/server/game/DataStores/DB2Stores.h
index 773e2a97894..60c3990ffc9 100644
--- a/src/server/game/DataStores/DB2Stores.h
+++ b/src/server/game/DataStores/DB2Stores.h
@@ -265,7 +265,7 @@ public:
CharSectionsEntry const* GetCharSectionEntry(uint8 race, uint8 gender, CharBaseSectionVariation variation, uint8 variationIndex, uint8 color) const;
CharStartOutfitEntry const* GetCharStartOutfitEntry(uint8 race, uint8 class_, uint8 gender) const;
static char const* GetClassName(uint8 class_, LocaleConstant locale = DEFAULT_LOCALE);
- uint32 GetPowerIndexByClass(uint32 powerType, uint32 classId) const;
+ uint32 GetPowerIndexByClass(Powers power, uint32 classId) const;
static char const* GetChrRaceName(uint8 race, LocaleConstant locale = DEFAULT_LOCALE);
ChrSpecializationEntry const* GetChrSpecializationByIndex(uint32 class_, uint32 index) const;
ChrSpecializationEntry const* GetDefaultChrSpecializationForClass(uint32 class_) const;
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index d4d8f4fccdc..8fa76b560b2 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -1273,23 +1273,18 @@ void Creature::UpdateLevelDependantStats()
switch (getClass())
{
- case CLASS_WARRIOR:
- SetPowerType(POWER_RAGE);
+ case CLASS_PALADIN:
+ case CLASS_MAGE:
+ SetMaxPower(POWER_MANA, mana);
+ SetFullPower(POWER_MANA);
break;
- case CLASS_ROGUE:
- SetPowerType(POWER_ENERGY);
- break;
- default:
- SetMaxPower(POWER_MANA, mana); // MAX Mana
- SetPower(POWER_MANA, mana);
+ default: // We don't set max power here, 0 makes power bar hidden
break;
}
SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, (float)health);
- SetModifierValue(UNIT_MOD_MANA, BASE_VALUE, (float)mana);
// damage
-
float basedamage = stats->GenerateBaseDamage(cInfo);
float weaponBaseMinDamage = basedamage;
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index 8b4a6a9b0ab..4fff15be6ca 100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -153,6 +153,7 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
void UpdateArmor() override;
void UpdateMaxHealth() override;
void UpdateMaxPower(Powers power) override;
+ uint32 GetPowerIndex(Powers power) const override;
void UpdateAttackPowerAndDamage(bool ranged = false) override;
void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float& minDamage, float& maxDamage) override;
diff --git a/src/server/game/Entities/Creature/TemporarySummon.h b/src/server/game/Entities/Creature/TemporarySummon.h
index 29067791364..49662e1ac95 100644
--- a/src/server/game/Entities/Creature/TemporarySummon.h
+++ b/src/server/game/Entities/Creature/TemporarySummon.h
@@ -21,6 +21,24 @@
#include "Creature.h"
+enum PetEntry
+{
+ // Warlock pets
+ PET_IMP = 416,
+ PET_FEL_HUNTER = 691,
+ PET_VOID_WALKER = 1860,
+ PET_SUCCUBUS = 1863,
+ PET_DOOMGUARD = 18540,
+ PET_FELGUARD = 30146,
+
+ // Death Knight pets
+ PET_GHOUL = 26125,
+ PET_ABOMINATION = 106848,
+
+ // Shaman pet
+ PET_SPIRIT_WOLF = 29264
+};
+
struct SummonPropertiesEntry;
class TC_GAME_API TempSummon : public Creature
@@ -59,8 +77,22 @@ class TC_GAME_API Minion : public TempSummon
Unit* GetOwner() const { return m_owner; }
float GetFollowAngle() const override { return m_followAngle; }
void SetFollowAngle(float angle) { m_followAngle = angle; }
- bool IsPetGhoul() const {return GetEntry() == 26125;} // Ghoul may be guardian or pet
- bool IsSpiritWolf() const {return GetEntry() == 29264;} // Spirit wolf from feral spirits
+
+ // Warlock pets
+ bool IsPetImp() const { return GetEntry() == PET_IMP; }
+ bool IsPetFelhunter() const { return GetEntry() == PET_FEL_HUNTER; }
+ bool IsPetVoidwalker() const { return GetEntry() == PET_VOID_WALKER; }
+ bool IsPetSuccubus() const { return GetEntry() == PET_SUCCUBUS; }
+ bool IsPetDoomguard() const { return GetEntry() == PET_DOOMGUARD; }
+ bool IsPetFelguard() const { return GetEntry() == PET_FELGUARD; }
+
+ // Death Knight pets
+ bool IsPetGhoul() const { return GetEntry() == PET_GHOUL; } // Ghoul may be guardian or pet
+ bool IsPetAbomination() const { return GetEntry() == PET_ABOMINATION; } // Sludge Belcher dk talent
+
+ // Shaman pet
+ bool IsSpiritWolf() const { return GetEntry() == PET_SPIRIT_WOLF; } // Spirit wolf from feral spirits
+
bool IsGuardianPet() const;
protected:
Unit* const m_owner;
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index 7896aa54db5..aa18464316a 100644
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -226,7 +226,6 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
SetSheath(SHEATH_STATE_MELEE);
SetByteFlag(UNIT_FIELD_BYTES_2, UNIT_BYTES_2_OFFSET_PET_FLAGS, fields[9].GetBool() ? UNIT_CAN_BE_ABANDONED : UNIT_CAN_BE_RENAMED | UNIT_CAN_BE_ABANDONED);
SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); // this enables popup window (pet abandon, cancel)
- SetPowerType(POWER_FOCUS);
break;
default:
if (!IsPetGhoul())
@@ -780,7 +779,6 @@ bool Pet::CreateBaseAtTamed(CreatureTemplate const* cinfo, Map* map)
if (!Create(map->GenerateLowGuid<HighGuid::Pet>(), map, cinfo->Entry))
return false;
- SetPowerType(POWER_FOCUS);
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0);
SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, uint32(sObjectMgr->GetXPForLevel(getLevel()+1)*PET_XP_FACTOR));
@@ -860,13 +858,12 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
SetModifierValue(UnitMods(UNIT_MOD_RESISTANCE_START + i), BASE_VALUE, float(cinfo->resistance[i]));
- //health, mana, armor and resistance
+ // Health, Mana or Power, Armor
PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(creature_ID, petlevel);
if (pInfo) // exist in DB
{
SetCreateHealth(pInfo->health);
- if (petType != HUNTER_PET) //hunter pet use focus
- SetCreateMana(pInfo->mana);
+ SetCreateMana(pInfo->mana);
if (pInfo->armor > 0)
SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, float(pInfo->armor));
@@ -887,6 +884,17 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
SetCreateStat(STAT_INTELLECT, 28);
}
+ // Power
+ if (petType == HUNTER_PET) // Hunter pets have focus
+ SetPowerType(POWER_FOCUS);
+ else if (IsPetGhoul() || IsPetAbomination()) // DK pets have energy
+ SetPowerType(POWER_ENERGY);
+ else if (IsPetImp() || IsPetFelhunter() || IsPetVoidwalker() || IsPetSuccubus() || IsPetDoomguard() || IsPetFelguard()) // Warlock pets have energy (since 5.x)
+ SetPowerType(POWER_ENERGY);
+ else
+ SetPowerType(POWER_MANA);
+
+ // Damage
SetBonusDamage(0);
switch (petType)
{
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 0d659971970..139bac0dbb0 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -592,8 +592,7 @@ bool Player::Create(ObjectGuid::LowType guidlow, WorldPackets::Character::Charac
// apply original stats mods before spell loading or item equipment that call before equip _RemoveStatsMods()
UpdateMaxHealth(); // Update max Health (for add bonus from stamina)
SetFullHealth();
- if (GetPowerType() == POWER_MANA)
- SetFullPower(POWER_MANA);
+ SetFullPower(POWER_MANA);
// original spells
LearnDefaultSkills();
@@ -2444,13 +2443,9 @@ void Player::GiveLevel(uint8 level)
_ApplyAllLevelScaleItemMods(true); // Moved to above SetFullHealth so player will have full health from Heirlooms
- // set current level health and mana/energy to maximum after applying all mods.
+ // Only health and mana are set to maximum.
SetFullHealth();
SetFullPower(POWER_MANA);
- SetFullPower(POWER_ENERGY);
- if (GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE))
- SetFullPower(POWER_RAGE);
- SetPower(POWER_FOCUS, 0);
// update level to hunter/summon pet
if (Pet* pet = GetPet())
@@ -18084,7 +18079,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SQLQueryHolder *holder)
uint32 loadedPowers = 0;
for (uint32 i = 0; i < MAX_POWERS; ++i)
{
- if (GetPowerIndex(i) != MAX_POWERS)
+ if (GetPowerIndex(Powers(i)) != MAX_POWERS)
{
uint32 savedPower = fields[56 + loadedPowers].GetUInt32();
uint32 maxPower = GetUInt32Value(UNIT_FIELD_MAXPOWER + loadedPowers);
@@ -19880,7 +19875,7 @@ void Player::SaveToDB(bool create /*=false*/)
uint32 storedPowers = 0;
for (uint32 i = 0; i < MAX_POWERS; ++i)
{
- if (GetPowerIndex(i) != MAX_POWERS)
+ if (GetPowerIndex(Powers(i)) != MAX_POWERS)
{
stmt->setUInt32(index++, GetUInt32Value(UNIT_FIELD_POWER + storedPowers));
if (++storedPowers >= MAX_POWERS_PER_CLASS)
@@ -20024,7 +20019,7 @@ void Player::SaveToDB(bool create /*=false*/)
uint32 storedPowers = 0;
for (uint32 i = 0; i < MAX_POWERS; ++i)
{
- if (GetPowerIndex(i) != MAX_POWERS)
+ if (GetPowerIndex(Powers(i)) != MAX_POWERS)
{
stmt->setUInt32(index++, GetUInt32Value(UNIT_FIELD_POWER + storedPowers));
if (++storedPowers >= MAX_POWERS_PER_CLASS)
@@ -27398,7 +27393,6 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
pet->SetCreatorGUID(GetGUID());
pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, getFaction());
- pet->SetPowerType(POWER_MANA);
pet->SetUInt64Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
pet->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
pet->InitStatsForLevel(getLevel());
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 30e96a23232..12b19dd4485 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1786,6 +1786,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
void UpdateArmor() override;
void UpdateMaxHealth() override;
void UpdateMaxPower(Powers power) override;
+ uint32 GetPowerIndex(Powers power) const override;
void UpdateAttackPowerAndDamage(bool ranged = false) override;
void ApplySpellPowerBonus(int32 amount, bool apply);
void UpdateSpellDamageAndHealingBonus();
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index 54f39f1e94d..5c4124a3903 100644
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -300,8 +300,17 @@ void Player::UpdateMaxHealth()
SetMaxHealth((uint32)value);
}
+uint32 Player::GetPowerIndex(Powers power) const
+{
+ return sDB2Manager.GetPowerIndexByClass(power, getClass());
+}
+
void Player::UpdateMaxPower(Powers power)
{
+ uint32 powerIndex = GetPowerIndex(power);
+ if (powerIndex == MAX_POWERS || powerIndex >= MAX_POWERS_PER_CLASS)
+ return;
+
UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
float value = GetModifierValue(unitMod, BASE_VALUE) + GetCreatePowers(power);
@@ -309,7 +318,7 @@ void Player::UpdateMaxPower(Powers power)
value += GetModifierValue(unitMod, TOTAL_VALUE);
value *= GetModifierValue(unitMod, TOTAL_PCT);
- SetMaxPower(power, uint32(value));
+ SetMaxPower(power, (int32)std::lroundf(value));
}
void Player::UpdateAttackPowerAndDamage(bool ranged)
@@ -846,12 +855,30 @@ void Creature::UpdateMaxHealth()
SetMaxHealth(uint32(value));
}
+uint32 Creature::GetPowerIndex(Powers power) const
+{
+ if (power == GetPowerType())
+ return 0;
+ if (power == POWER_ALTERNATE_POWER)
+ return 1;
+ if (power == POWER_COMBO_POINTS)
+ return 2;
+ return MAX_POWERS;
+}
+
void Creature::UpdateMaxPower(Powers power)
{
+ if (GetPowerIndex(power) == MAX_POWERS)
+ return;
+
UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
- float value = GetTotalAuraModValue(unitMod);
- SetMaxPower(power, uint32(value));
+ float value = GetModifierValue(unitMod, BASE_VALUE) + GetCreatePowers(power);
+ value *= GetModifierValue(unitMod, BASE_PCT);
+ value += GetModifierValue(unitMod, TOTAL_VALUE);
+ value *= GetModifierValue(unitMod, TOTAL_PCT);
+
+ SetMaxPower(power, (int32)std::lroundf(value));
}
void Creature::UpdateAttackPowerAndDamage(bool ranged)
@@ -1010,6 +1037,8 @@ bool Guardian::UpdateStats(Stats stat)
bool Guardian::UpdateAllStats()
{
+ UpdateMaxHealth();
+
for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i)
UpdateStats(Stats(i));
@@ -1084,27 +1113,17 @@ void Guardian::UpdateMaxHealth()
void Guardian::UpdateMaxPower(Powers power)
{
- UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
-
- float addValue = (power == POWER_MANA) ? GetStat(STAT_INTELLECT) - GetCreateStat(STAT_INTELLECT) : 0.0f;
- float multiplicator = 15.0f;
+ if (GetPowerIndex(power) == MAX_POWERS)
+ return;
- switch (GetEntry())
- {
- case ENTRY_IMP: multiplicator = 4.95f; break;
- case ENTRY_VOIDWALKER:
- case ENTRY_SUCCUBUS:
- case ENTRY_FELHUNTER:
- case ENTRY_FELGUARD: multiplicator = 11.5f; break;
- default: multiplicator = 15.0f; break;
- }
+ UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
- float value = GetModifierValue(unitMod, BASE_VALUE) + GetCreatePowers(power);
+ float value = GetModifierValue(unitMod, BASE_VALUE) + GetCreatePowers(power);
value *= GetModifierValue(unitMod, BASE_PCT);
- value += GetModifierValue(unitMod, TOTAL_VALUE) + addValue * multiplicator;
+ value += GetModifierValue(unitMod, TOTAL_VALUE);
value *= GetModifierValue(unitMod, TOTAL_PCT);
- SetMaxPower(power, uint32(value));
+ SetMaxPower(power, int32(value));
}
void Guardian::UpdateAttackPowerAndDamage(bool ranged)
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index ae560ca6321..be1ead476fa 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -5182,26 +5182,22 @@ void Unit::SetPowerType(Powers new_powertype)
pet->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_POWER_TYPE);
}*/
- float powerMultiplier = 1.0f;
- if (!IsPet())
- if (Creature* creature = ToCreature())
- powerMultiplier = creature->GetCreatureTemplate()->ModMana;
+ // Update max power
+ UpdateMaxPower(new_powertype);
+ // Update current power
switch (new_powertype)
{
- default:
- case POWER_MANA:
+ case POWER_MANA: // Keep the same (druid form switching...)
+ case POWER_ENERGY:
break;
- case POWER_RAGE:
- SetMaxPower(POWER_RAGE, uint32(std::ceil(GetCreatePowers(POWER_RAGE) * powerMultiplier)));
+ case POWER_RAGE: // Reset to zero
SetPower(POWER_RAGE, 0);
break;
- case POWER_FOCUS:
- SetMaxPower(POWER_FOCUS, uint32(std::ceil(GetCreatePowers(POWER_FOCUS) * powerMultiplier)));
- SetPower(POWER_FOCUS, uint32(std::ceil(GetCreatePowers(POWER_FOCUS) * powerMultiplier)));
+ case POWER_FOCUS: // Make it full
+ SetFullPower(new_powertype);
break;
- case POWER_ENERGY:
- SetMaxPower(POWER_ENERGY, uint32(std::ceil(GetCreatePowers(POWER_ENERGY) * powerMultiplier)));
+ default:
break;
}
}
@@ -5230,12 +5226,29 @@ void Unit::UpdateDisplayPower()
AuraEffect const* powerTypeAura = powerTypeAuras.front();
displayPower = Powers(powerTypeAura->GetMiscValue());
}
- else
+ else if (GetTypeId() == TYPEID_PLAYER)
{
ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(getClass());
if (cEntry && cEntry->PowerType < MAX_POWERS)
displayPower = Powers(cEntry->PowerType);
}
+ else if (GetTypeId() == TYPEID_UNIT)
+ {
+ if (Vehicle* vehicle = GetVehicle())
+ {
+ if (PowerDisplayEntry const* powerDisplay = sPowerDisplayStore.LookupEntry(vehicle->GetVehicleInfo()->PowerDisplayID[0]))
+ displayPower = Powers(powerDisplay->PowerType);
+ else if (getClass() == CLASS_ROGUE)
+ displayPower = POWER_ENERGY;
+ }
+ else if (Pet* pet = ToPet())
+ {
+ if (pet->getPetType() == HUNTER_PET) // Hunter pets have focus
+ displayPower = POWER_FOCUS;
+ else if (pet->IsPetGhoul() || pet->IsPetAbomination()) // DK pets have energy
+ displayPower = POWER_ENERGY;
+ }
+ }
break;
}
}
@@ -5925,10 +5938,6 @@ void Unit::SetMinion(Minion *minion, bool apply)
for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i)
minion->SetSpeedRate(UnitMoveType(i), m_speed_rate[i]);
- // Ghoul pets have energy instead of mana (is anywhere better place for this code?)
- if (minion->IsPetGhoul())
- minion->SetPowerType(POWER_ENERGY);
-
// Send infinity cooldown - client does that automatically but after relog cooldown needs to be set again
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(minion->GetUInt32Value(UNIT_CREATED_BY_SPELL));
@@ -9525,19 +9534,6 @@ void Unit::SetMaxPower(Powers power, int32 val)
SetPower(power, val);
}
-uint32 Unit::GetPowerIndex(uint32 powerType) const
-{
- /// This is here because hunter pets are of the warrior class.
- /// With the current implementation, the core only gives them
- /// POWER_RAGE, so we enforce the class to hunter so that they
- /// effectively get focus power.
- uint32 classId = getClass();
- if (ToPet() && ToPet()->getPetType() == HUNTER_PET)
- classId = CLASS_HUNTER;
-
- return sDB2Manager.GetPowerIndexByClass(powerType, classId);
-}
-
int32 Unit::GetCreatePowers(Powers power) const
{
if (power == POWER_MANA)
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index c26427f1587..c099161dfe3 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1522,7 +1522,6 @@ class TC_GAME_API Unit : public WorldObject
uint32 GetCreateHealth() const { return GetUInt32Value(UNIT_FIELD_BASE_HEALTH); }
void SetCreateMana(uint32 val) { SetUInt32Value(UNIT_FIELD_BASE_MANA, val); }
uint32 GetCreateMana() const { return GetUInt32Value(UNIT_FIELD_BASE_MANA); }
- uint32 GetPowerIndex(uint32 powerType) const;
int32 GetCreatePowers(Powers power) const;
float GetPosStat(Stats stat) const { return GetFloatValue(UNIT_FIELD_POSSTAT+stat); }
float GetNegStat(Stats stat) const { return GetFloatValue(UNIT_FIELD_NEGSTAT+stat); }
@@ -1602,6 +1601,7 @@ class TC_GAME_API Unit : public WorldObject
virtual void UpdateArmor() = 0;
virtual void UpdateMaxHealth() = 0;
virtual void UpdateMaxPower(Powers power) = 0;
+ virtual uint32 GetPowerIndex(Powers power) const = 0;
virtual void UpdateAttackPowerAndDamage(bool ranged = false) = 0;
virtual void UpdateDamagePhysical(WeaponAttackType attType);
float GetTotalAttackPowerValue(WeaponAttackType attType) const;
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index b3a59fbda6d..7933ea5781f 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -3795,7 +3795,7 @@ void AuraEffect::HandleAuraModOverridePowerDisplay(AuraApplication const* aurApp
return;
Unit* target = aurApp->GetTarget();
- if (target->GetPowerIndex(powerDisplay->PowerType) == MAX_POWERS)
+ if (target->GetPowerIndex(Powers(powerDisplay->PowerType)) == MAX_POWERS)
return;
if (apply)
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index 58ab003924b..09d76fd5e20 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -1020,7 +1020,7 @@ public:
return false;
}
- if (target->GetPowerIndex(powerType->PowerTypeEnum) == MAX_POWERS)
+ if (target->GetPowerIndex(Powers(powerType->PowerTypeEnum)) == MAX_POWERS)
{
handler->SendSysMessage(LANG_INVALID_POWER_NAME);
handler->SetSentErrorMessage(true);