diff options
author | Mihapro <miha.penger@outlook.com> | 2018-01-03 16:39:00 +0100 |
---|---|---|
committer | joschiwald <joschiwald.trinity@gmail.com> | 2018-01-03 16:39:32 +0100 |
commit | 8199eef81cad464bb43f3613ed884a2c8fc3973d (patch) | |
tree | 7a17cb8ede0a45814532dd306fcf7f37d2f90ce8 /src | |
parent | c2aead1da5b6cb9a3a69e276b3f12a2c76b9ab86 (diff) |
Core/Misc: Added helper function Unit::SetFullPower
* Also renamed Unit::getPowerType and Unit::setPowerType to follow style guidelines
Ref #20981
Diffstat (limited to 'src')
37 files changed, 108 insertions, 126 deletions
diff --git a/src/server/game/AI/PlayerAI/PlayerAI.cpp b/src/server/game/AI/PlayerAI/PlayerAI.cpp index b2f5ad9ed91..6d1765430c7 100644 --- a/src/server/game/AI/PlayerAI/PlayerAI.cpp +++ b/src/server/game/AI/PlayerAI/PlayerAI.cpp @@ -777,7 +777,7 @@ PlayerAI::TargetedSpell SimpleCharmedPlayerAI::SelectAppropriateCastForSpec() VerifyAndPushSpellCast(spells, SPELL_FREEZING_ARROW, TARGET_VICTIM, 2); VerifyAndPushSpellCast(spells, SPELL_RAPID_FIRE, TARGET_NONE, 10); VerifyAndPushSpellCast(spells, SPELL_KILL_SHOT, TARGET_VICTIM, 10); - if (me->GetVictim() && me->GetVictim()->getPowerType() == POWER_MANA && !me->GetVictim()->GetAuraApplicationOfRankedSpell(SPELL_VIPER_STING, me->GetGUID())) + if (me->GetVictim() && me->GetVictim()->GetPowerType() == POWER_MANA && !me->GetVictim()->GetAuraApplicationOfRankedSpell(SPELL_VIPER_STING, me->GetGUID())) VerifyAndPushSpellCast(spells, SPELL_VIPER_STING, TARGET_VICTIM, 5); switch (GetSpec()) diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 7227eafbd57..c293c1914a1 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -3134,7 +3134,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui { if (!me || !me->IsInCombat() || !me->GetMaxPower(POWER_MANA)) return; - uint32 perc = uint32(100.0f * me->GetPower(POWER_MANA) / me->GetMaxPower(POWER_MANA)); + uint32 perc = uint32(me->GetPowerPct(POWER_MANA)); if (perc > e.event.minMaxRepeat.max || perc < e.event.minMaxRepeat.min) return; ProcessTimedAction(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax); @@ -3144,7 +3144,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui { if (!me || !me->IsInCombat() || !me->GetVictim() || !me->EnsureVictim()->GetMaxPower(POWER_MANA)) return; - uint32 perc = uint32(100.0f * me->EnsureVictim()->GetPower(POWER_MANA) / me->EnsureVictim()->GetMaxPower(POWER_MANA)); + uint32 perc = uint32(me->EnsureVictim()->GetPowerPct(POWER_MANA)); if (perc > e.event.minMaxRepeat.max || perc < e.event.minMaxRepeat.min) return; ProcessTimedAction(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax, me->GetVictim()); diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 4e09769218e..3f480de69f2 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -677,7 +677,7 @@ void Creature::Update(uint32 diff) if (HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER)) { - if (getPowerType() == POWER_ENERGY) + if (GetPowerType() == POWER_ENERGY) Regenerate(POWER_ENERGY); else RegenerateMana(); @@ -1229,10 +1229,10 @@ void Creature::UpdateLevelDependantStats() switch (getClass()) { case CLASS_WARRIOR: - setPowerType(POWER_RAGE); + SetPowerType(POWER_RAGE); break; case CLASS_ROGUE: - setPowerType(POWER_ENERGY); + SetPowerType(POWER_ENERGY); break; default: SetMaxPower(POWER_MANA, mana); // MAX Mana @@ -1504,7 +1504,7 @@ void Creature::SetSpawnHealth() else { curhealth = GetMaxHealth(); - SetPower(POWER_MANA, GetMaxPower(POWER_MANA)); + SetFullPower(POWER_MANA); } SetHealth((m_deathState == ALIVE || m_deathState == JUST_RESPAWNED) ? curhealth : 0); diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 60e6bbeac20..7896aa54db5 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -226,7 +226,7 @@ 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); + SetPowerType(POWER_FOCUS); break; default: if (!IsPetGhoul()) @@ -257,7 +257,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c SetCanModifyStats(true); if (getPetType() == SUMMON_PET && !current) //all (?) summon pets come with full health when called, but not when they are current - SetPower(POWER_MANA, GetMaxPower(POWER_MANA)); + SetFullPower(POWER_MANA); else { uint32 savedhealth = fields[10].GetUInt32(); @@ -266,8 +266,8 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c setDeathState(JUST_DIED); else { - SetHealth(savedhealth > GetMaxHealth() ? GetMaxHealth() : savedhealth); - SetPower(POWER_MANA, savedmana > uint32(GetMaxPower(POWER_MANA)) ? GetMaxPower(POWER_MANA) : savedmana); + SetHealth(savedhealth); + SetPower(POWER_MANA, savedmana); } } @@ -599,7 +599,7 @@ void Pet::Update(uint32 diff) m_focusRegenTimer -= diff; else { - switch (getPowerType()) + switch (GetPowerType()) { case POWER_FOCUS: Regenerate(POWER_FOCUS); @@ -780,7 +780,7 @@ bool Pet::CreateBaseAtTamed(CreatureTemplate const* cinfo, Map* map) if (!Create(map->GenerateLowGuid<HighGuid::Pet>(), map, cinfo->Entry)) return false; - setPowerType(POWER_FOCUS); + 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)); @@ -1036,7 +1036,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) UpdateAllStats(); SetFullHealth(); - SetPower(POWER_MANA, GetMaxPower(POWER_MANA)); + SetFullPower(POWER_MANA); return true; } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index d8bf94c7cb1..1050ba2ff7c 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -591,8 +591,8 @@ 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) - SetPower(POWER_MANA, GetMaxPower(POWER_MANA)); + if (GetPowerType() == POWER_MANA) + SetFullPower(POWER_MANA); // original spells LearnDefaultSkills(); @@ -2019,17 +2019,18 @@ void Player::RegenerateHealth() void Player::ResetAllPowers() { - SetHealth(GetMaxHealth()); - switch (getPowerType()) + SetFullHealth(); + + switch (GetPowerType()) { case POWER_MANA: - SetPower(POWER_MANA, GetMaxPower(POWER_MANA)); + SetFullPower(POWER_MANA); break; case POWER_RAGE: SetPower(POWER_RAGE, 0); break; case POWER_ENERGY: - SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY)); + SetFullPower(POWER_ENERGY); break; case POWER_RUNIC_POWER: SetPower(POWER_RUNIC_POWER, 0); @@ -2453,10 +2454,10 @@ void Player::GiveLevel(uint8 level) // set current level health and mana/energy to maximum after applying all mods. SetFullHealth(); - SetPower(POWER_MANA, GetMaxPower(POWER_MANA)); - SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY)); + SetFullPower(POWER_MANA); + SetFullPower(POWER_ENERGY); if (GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE)) - SetPower(POWER_RAGE, GetMaxPower(POWER_RAGE)); + SetFullPower(POWER_RAGE); SetPower(POWER_FOCUS, 0); // update level to hunter/summon pet @@ -2681,11 +2682,11 @@ void Player::InitStatsForLevel(bool reapplyMods) // set current level health and mana/energy to maximum after applying all mods. SetFullHealth(); - SetPower(POWER_MANA, GetMaxPower(POWER_MANA)); - SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY)); + SetFullPower(POWER_MANA); + SetFullPower(POWER_ENERGY); if (GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE)) - SetPower(POWER_RAGE, GetMaxPower(POWER_RAGE)); - SetPower(POWER_FOCUS, GetMaxPower(POWER_FOCUS)); + SetFullPower(POWER_RAGE); + SetFullPower(POWER_FOCUS); SetPower(POWER_RUNIC_POWER, 0); // update level to hunter/summon pet @@ -4199,11 +4200,11 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness) // set health/powers (0- will be set in caller) if (restore_percent > 0.0f) { - SetHealth(uint32(GetMaxHealth()*restore_percent)); - SetPower(POWER_MANA, uint32(GetMaxPower(POWER_MANA)*restore_percent)); + SetHealth(GetMaxHealth() * restore_percent); + SetPower(POWER_MANA, GetMaxPower(POWER_MANA) * restore_percent); SetPower(POWER_RAGE, 0); - SetPower(POWER_ENERGY, uint32(GetMaxPower(POWER_ENERGY)*restore_percent)); - SetPower(POWER_FOCUS, uint32(GetMaxPower(POWER_FOCUS)*restore_percent)); + SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY) * restore_percent); + SetPower(POWER_FOCUS, GetMaxPower(POWER_FOCUS) * restore_percent); SetPower(POWER_LUNAR_POWER, 0); } @@ -24827,19 +24828,12 @@ void Player::ResurrectUsingRequestDataImpl() { ResurrectPlayer(0.0f, false); - if (GetMaxHealth() > _resurrectionData->Health) - SetHealth(_resurrectionData->Health); - else - SetFullHealth(); - - if (uint32(GetMaxPower(POWER_MANA)) > _resurrectionData->Mana) - SetPower(POWER_MANA, _resurrectionData->Mana); - else - SetPower(POWER_MANA, GetMaxPower(POWER_MANA)); + SetHealth(_resurrectionData->Health); + SetPower(POWER_MANA, _resurrectionData->Mana); SetPower(POWER_RAGE, 0); - SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY)); - SetPower(POWER_FOCUS, GetMaxPower(POWER_FOCUS)); + SetFullPower(POWER_ENERGY); + SetFullPower(POWER_FOCUS); SetPower(POWER_LUNAR_POWER, 0); if (uint32 aura = _resurrectionData->Aura) @@ -26628,7 +26622,7 @@ void Player::ActivateTalentGroup(ChrSpecializationEntry const* spec) SendActionButtons(1); UpdateDisplayPower(); - Powers pw = getPowerType(); + Powers pw = GetPowerType(); if (pw != POWER_MANA) SetPower(POWER_MANA, 0); // Mana must be 0 even if it isn't the active power type. @@ -27321,7 +27315,7 @@ 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->SetPowerType(POWER_MANA); pet->SetUInt64Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); pet->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pet->InitStatsForLevel(getLevel()); @@ -27337,7 +27331,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy pet->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); pet->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000); pet->SetFullHealth(); - pet->SetPower(POWER_MANA, pet->GetMaxPower(POWER_MANA)); + pet->SetFullPower(POWER_MANA); pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(nullptr))); // cast can't be helped in this case break; default: diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index e3b4958b330..8233d7b2457 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -780,7 +780,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam } // Rage from Damage made (only from direct weapon damage) - if (cleanDamage && (cleanDamage->attackType == BASE_ATTACK || cleanDamage->attackType == OFF_ATTACK) && damagetype == DIRECT_DAMAGE && this != victim && getPowerType() == POWER_RAGE) + if (cleanDamage && (cleanDamage->attackType == BASE_ATTACK || cleanDamage->attackType == OFF_ATTACK) && damagetype == DIRECT_DAMAGE && this != victim && GetPowerType() == POWER_RAGE) { uint32 rage = uint32(GetBaseAttackTime(cleanDamage->attackType) / 1000.f * 1.75f); if (cleanDamage->attackType == OFF_ATTACK) @@ -5159,9 +5159,9 @@ void Unit::SendAttackStateUpdate(uint32 HitInfo, Unit* target, uint8 /*SwingType SendAttackStateUpdate(&dmgInfo); } -void Unit::setPowerType(Powers new_powertype) +void Unit::SetPowerType(Powers new_powertype) { - if (getPowerType() == new_powertype) + if (GetPowerType() == new_powertype) return; SetUInt32Value(UNIT_FIELD_DISPLAY_POWER, new_powertype); @@ -5235,7 +5235,7 @@ void Unit::UpdateDisplayPower() } } - setPowerType(displayPower); + SetPowerType(displayPower); } FactionTemplateEntry const* Unit::GetFactionTemplateEntry() const @@ -5923,7 +5923,7 @@ void Unit::SetMinion(Minion *minion, bool apply) // Ghoul pets have energy instead of mana (is anywhere better place for this code?) if (minion->IsPetGhoul()) - minion->setPowerType(POWER_ENERGY); + 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)); @@ -8540,7 +8540,7 @@ void Unit::setDeathState(DeathState s) // without this when removing IncreaseMaxHealth aura player may stuck with 1 hp // do not why since in IncreaseMaxHealth currenthealth is checked SetHealth(0); - SetPower(getPowerType(), 0); + SetPower(GetPowerType(), 0); SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); // players in instance don't have ZoneScript, but they have InstanceScript @@ -9265,9 +9265,9 @@ bool Unit::HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, f case UNIT_MOD_RUNES: case UNIT_MOD_RUNIC_POWER: case UNIT_MOD_SOUL_SHARDS: - case UNIT_MOD_ECLIPSE: + case UNIT_MOD_LUNAR_POWER: case UNIT_MOD_HOLY_POWER: - case UNIT_MOD_ALTERNATIVE: + case UNIT_MOD_ALTERNATE: case UNIT_MOD_MAELSTROM: case UNIT_MOD_CHI: case UNIT_MOD_INSANITY: @@ -9508,7 +9508,7 @@ void Unit::SetPower(Powers power, int32 val) if (powerIndex == MAX_POWERS || powerIndex >= MAX_POWERS_PER_CLASS) return; - int32 maxPower = int32(GetMaxPower(power)); + int32 maxPower = GetMaxPower(power); if (maxPower < val) val = maxPower; diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index f9096940b48..7caa345a89f 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -292,9 +292,9 @@ enum UnitMods UNIT_MOD_RUNES, UNIT_MOD_RUNIC_POWER, UNIT_MOD_SOUL_SHARDS, - UNIT_MOD_ECLIPSE, + UNIT_MOD_LUNAR_POWER, UNIT_MOD_HOLY_POWER, - UNIT_MOD_ALTERNATIVE, + UNIT_MOD_ALTERNATE, UNIT_MOD_MAELSTROM, UNIT_MOD_CHI, UNIT_MOD_INSANITY, @@ -1043,8 +1043,8 @@ class TC_GAME_API Unit : public WorldObject virtual float GetDamageMultiplierForTarget(WorldObject const* /*target*/) const { return 1.0f; } virtual float GetArmorMultiplierForTarget(WorldObject const* /*target*/) const { return 1.0f; } - Powers getPowerType() const { return Powers(GetUInt32Value(UNIT_FIELD_DISPLAY_POWER)); } - void setPowerType(Powers power); + Powers GetPowerType() const { return Powers(GetUInt32Value(UNIT_FIELD_DISPLAY_POWER)); } + void SetPowerType(Powers power); void UpdateDisplayPower(); int32 GetPower(Powers power) const; int32 GetMinPower(Powers power) const { return power == POWER_LUNAR_POWER ? -100 : 0; } @@ -1053,6 +1053,7 @@ class TC_GAME_API Unit : public WorldObject int32 CountPctFromMaxPower(Powers power, int32 pct) const { return CalculatePct(GetMaxPower(power), pct); } void SetPower(Powers power, int32 val); void SetMaxPower(Powers power, int32 val); + inline void SetFullPower(Powers power) { SetPower(power, GetMaxPower(power)); } // returns the change in power int32 ModifyPower(Powers power, int32 val); @@ -2027,15 +2028,15 @@ namespace Trinity { Unit const* a = objA->ToUnit(); Unit const* b = objB->ToUnit(); - float rA = (a && a->GetMaxPower(_power)) ? float(a->GetPower(_power)) / float(a->GetMaxPower(_power)) : 0.0f; - float rB = (b && b->GetMaxPower(_power)) ? float(b->GetPower(_power)) / float(b->GetMaxPower(_power)) : 0.0f; + float rA = a ? a->GetPowerPct(_power) : 0.0f; + float rB = b ? b->GetPowerPct(_power) : 0.0f; return _ascending ? rA < rB : rA > rB; } bool operator()(Unit const* a, Unit const* b) const { - float rA = a->GetMaxPower(_power) ? float(a->GetPower(_power)) / float(a->GetMaxPower(_power)) : 0.0f; - float rB = b->GetMaxPower(_power) ? float(b->GetPower(_power)) / float(b->GetMaxPower(_power)) : 0.0f; + float rA = a->GetPowerPct(_power); + float rB = b->GetPowerPct(_power); return _ascending ? rA < rB : rA > rB; } diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index 4c1e90c2c1e..636a1e83fe1 100644 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -77,9 +77,9 @@ void Vehicle::Install() if (_me->GetTypeId() == TYPEID_UNIT) { if (PowerDisplayEntry const* powerDisplay = sPowerDisplayStore.LookupEntry(_vehicleInfo->PowerDisplayID[0])) - _me->setPowerType(Powers(powerDisplay->PowerType)); + _me->SetPowerType(Powers(powerDisplay->PowerType)); else if (_me->getClass() == CLASS_ROGUE) - _me->setPowerType(POWER_ENERGY); + _me->SetPowerType(POWER_ENERGY); } _status = STATUS_INSTALLED; diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index e5cbe0895bb..58fc0dfecc8 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -152,7 +152,7 @@ enum TrinityStrings LANG_YOU_CHANGE_ENERGY = 122, LANG_YOURS_ENERGY_CHANGED = 123, - LANG_CURRENT_ENERGY = 124, //log + LANG_CURRENT_ENERGY = 124, LANG_YOU_CHANGE_RAGE = 125, LANG_YOURS_RAGE_CHANGED = 126, LANG_YOU_CHANGE_LVL = 127, diff --git a/src/server/game/Server/Packets/CombatLogPacketsCommon.cpp b/src/server/game/Server/Packets/CombatLogPacketsCommon.cpp index bf7fe6374ba..6afac0117c9 100644 --- a/src/server/game/Server/Packets/CombatLogPacketsCommon.cpp +++ b/src/server/game/Server/Packets/CombatLogPacketsCommon.cpp @@ -27,7 +27,7 @@ void WorldPackets::Spells::SpellCastLogData::Initialize(Unit const* unit) Health = unit->GetHealth(); AttackPower = unit->GetTotalAttackPowerValue(unit->getClass() == CLASS_HUNTER ? RANGED_ATTACK : BASE_ATTACK); SpellPower = unit->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SPELL); - PowerData.emplace_back(int32(unit->getPowerType()), unit->GetPower(unit->getPowerType()), int32(0)); + PowerData.emplace_back(int32(unit->GetPowerType()), unit->GetPower(unit->GetPowerType()), int32(0)); } void WorldPackets::Spells::SpellCastLogData::Initialize(Spell const* spell) @@ -35,7 +35,7 @@ void WorldPackets::Spells::SpellCastLogData::Initialize(Spell const* spell) Health = spell->GetCaster()->GetHealth(); AttackPower = spell->GetCaster()->GetTotalAttackPowerValue(spell->GetCaster()->getClass() == CLASS_HUNTER ? RANGED_ATTACK : BASE_ATTACK); SpellPower = spell->GetCaster()->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SPELL); - Powers primaryPowerType = spell->GetCaster()->getPowerType(); + Powers primaryPowerType = spell->GetCaster()->GetPowerType(); bool primaryPowerAdded = false; for (SpellPowerCost const& cost : spell->GetPowerCost()) { diff --git a/src/server/game/Server/Packets/PartyPackets.cpp b/src/server/game/Server/Packets/PartyPackets.cpp index 6172377199a..d3d1f45995d 100644 --- a/src/server/game/Server/Packets/PartyPackets.cpp +++ b/src/server/game/Server/Packets/PartyPackets.cpp @@ -579,10 +579,10 @@ void WorldPackets::Party::PartyMemberState::Initialize(Player const* player) MemberStats.MaxHealth = player->GetMaxHealth(); // Power - MemberStats.PowerType = player->getPowerType(); + MemberStats.PowerType = player->GetPowerType(); MemberStats.PowerDisplayID = 0; - MemberStats.CurrentPower = player->GetPower(player->getPowerType()); - MemberStats.MaxPower = player->GetMaxPower(player->getPowerType()); + MemberStats.CurrentPower = player->GetPower(player->GetPowerType()); + MemberStats.MaxPower = player->GetMaxPower(player->GetPowerType()); // Position MemberStats.ZoneID = player->GetZoneId(); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 6fd3c015288..4763b6ff735 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -3723,8 +3723,8 @@ void AuraEffect::HandleAuraModIncreaseEnergyPercent(AuraApplication const* aurAp UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType); // Save old powers for further calculation - int32 oldPower = int32(target->GetPower(powerType)); - int32 oldMaxPower = int32(target->GetMaxPower(powerType)); + int32 oldPower = target->GetPower(powerType); + int32 oldMaxPower = target->GetMaxPower(powerType); // Handle aura effect for max power target->HandleStatModifier(unitMod, TOTAL_PCT, float(GetAmount()), apply); @@ -5031,7 +5031,7 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const { // Converts up to 10 rage per second into health for $d. Each point of rage is converted into ${$m2/10}.1% of max health. // Should be manauser - if (target->getPowerType() != POWER_RAGE) + if (target->GetPowerType() != POWER_RAGE) break; uint32 rage = target->GetPower(POWER_RAGE); // Nothing todo @@ -5793,7 +5793,7 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con { Powers powerType = Powers(GetMiscValue()); - if (!caster || !caster->IsAlive() || !target->IsAlive() || target->getPowerType() != powerType) + if (!caster || !caster->IsAlive() || !target->IsAlive() || target->GetPowerType() != powerType) return; if (target->HasUnitState(UNIT_STATE_ISOLATED) || target->IsImmunedToDamage(GetSpellInfo())) @@ -5848,7 +5848,7 @@ void AuraEffect::HandleObsModPowerAuraTick(Unit* target, Unit* caster) const { Powers powerType; if (GetMiscValue() == POWER_ALL) - powerType = target->getPowerType(); + powerType = target->GetPowerType(); else powerType = Powers(GetMiscValue()); @@ -5914,7 +5914,7 @@ void AuraEffect::HandlePeriodicPowerBurnAuraTick(Unit* target, Unit* caster) con { Powers powerType = Powers(GetMiscValue()); - if (!caster || !target->IsAlive() || target->getPowerType() != powerType) + if (!caster || !target->IsAlive() || target->GetPowerType() != powerType) return; if (target->HasUnitState(UNIT_STATE_ISOLATED) || target->IsImmunedToDamage(GetSpellInfo())) diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 07a5b326a11..6fbe7e5dadc 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5368,7 +5368,7 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint // Can be area effect, Check only for players and not check if target - caster (spell can have multiply drain/burn effects) if (m_caster->GetTypeId() == TYPEID_PLAYER) if (Unit* target = m_targets.GetUnitTarget()) - if (target != m_caster && target->getPowerType() != Powers(effect->MiscValue)) + if (target != m_caster && target->GetPowerType() != Powers(effect->MiscValue)) return SPELL_FAILED_BAD_TARGETS; break; } @@ -5801,7 +5801,7 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint if (m_caster->GetTypeId() != TYPEID_PLAYER || m_CastItem) break; - if (m_targets.GetUnitTarget()->getPowerType() != POWER_MANA) + if (m_targets.GetUnitTarget()->GetPowerType() != POWER_MANA) return SPELL_FAILED_BAD_TARGETS; break; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index b373d48fa19..54bda15ee37 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1090,7 +1090,7 @@ void Spell::EffectPowerDrain(SpellEffIndex effIndex) Powers powerType = Powers(effectInfo->MiscValue); - if (!unitTarget || !unitTarget->IsAlive() || unitTarget->getPowerType() != powerType || damage < 0) + if (!unitTarget || !unitTarget->IsAlive() || unitTarget->GetPowerType() != powerType || damage < 0) return; // add spell damage bonus @@ -1165,7 +1165,7 @@ void Spell::EffectPowerBurn(SpellEffIndex effIndex) Powers powerType = Powers(effectInfo->MiscValue); - if (!unitTarget || !unitTarget->IsAlive() || unitTarget->getPowerType() != powerType || damage < 0) + if (!unitTarget || !unitTarget->IsAlive() || unitTarget->GetPowerType() != powerType || damage < 0) return; int32 newDamage = -(unitTarget->ModifyPower(powerType, -damage)); @@ -4188,7 +4188,7 @@ void Spell::EffectSelfResurrect(SpellEffIndex /*effIndex*/) player->SetHealth(health); player->SetPower(POWER_MANA, mana); player->SetPower(POWER_RAGE, 0); - player->SetPower(POWER_ENERGY, player->GetMaxPower(POWER_ENERGY)); + player->SetFullPower(POWER_ENERGY); player->SetPower(POWER_FOCUS, 0); player->SpawnCorpseBones(); diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index 92791b214d0..58ab003924b 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -166,7 +166,6 @@ public: NotifyModification(handler, target, LANG_YOU_CHANGE_ENERGY, LANG_YOURS_ENERGY_CHANGED, energy / energyMultiplier, energymax / energyMultiplier); target->SetMaxPower(POWER_ENERGY, energymax); target->SetPower(POWER_ENERGY, energy); - TC_LOG_DEBUG("misc", handler->GetTrinityString(LANG_CURRENT_ENERGY), target->GetMaxPower(POWER_ENERGY)); return true; } return false; diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp index 264f4610436..bad4f2d728b 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp @@ -196,7 +196,7 @@ public: { ++i; target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); // not aggro leader - if (target && target->getPowerType() == POWER_MANA) + if (target && target->GetPowerType() == POWER_MANA) i = 3; } if (target) // cast on self (see below) diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp index 800dc1d8d8d..12f8a2251e2 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp @@ -159,7 +159,7 @@ public: me->ModifyPower(POWER_MANA, -mana); //if this get's us below 10%, then we evocate (the 10th should be summoned now) - if (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA) < 10) + if (me->GetPowerPct(POWER_MANA) < 10.f) { Talk(SAY_EVOCATE); me->InterruptNonMeleeSpells(false); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp index 82a51286719..073903707b5 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp @@ -436,7 +436,7 @@ public: if (ManaBurn_Timer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - if (target->getPowerType() == POWER_MANA) + if (target->GetPowerType() == POWER_MANA) DoCast(target, SPELL_MANABURN); ManaBurn_Timer = 5000; // 3 sec cast } else ManaBurn_Timer -= diff; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp index c2eb129810b..0398c4d56c3 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp @@ -274,7 +274,7 @@ public: else FrostCooldown = 0; } - if (!Drinking && me->GetMaxPower(POWER_MANA) && (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA)) < 20) + if (!Drinking && me->GetMaxPower(POWER_MANA) && me->GetPowerPct(POWER_MANA) < 20.f) { Drinking = true; me->InterruptNonMeleeSpells(false); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp index f3469d172de..2710958552b 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp @@ -176,7 +176,7 @@ class MarkTargetFilter bool operator()(WorldObject* target) const { if (Unit* unit = target->ToUnit()) - return unit->getPowerType() != POWER_MANA; + return unit->GetPowerType() != POWER_MANA; return false; } }; diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp index 35a3478abd4..798d49c963f 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp @@ -150,7 +150,7 @@ class boss_moam : public CreatureScript { const std::list<HostileReference*>& threatlist = me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) - if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->getPowerType() == POWER_MANA) + if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->GetPowerType() == POWER_MANA) targetList.push_back((*itr)->getTarget()); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp index c31ca72b43d..b5468a8f266 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp @@ -629,7 +629,7 @@ struct boss_faction_championsAI : public BossAI void UpdatePower() { - if (me->getPowerType() == POWER_MANA) + if (me->GetPowerType() == POWER_MANA) me->ModifyPower(POWER_MANA, me->GetMaxPower(POWER_MANA) / 3); } @@ -698,7 +698,7 @@ struct boss_faction_championsAI : public BossAI for (iter = tList.begin(); iter!=tList.end(); ++iter) { Unit* target = ObjectAccessor::GetUnit(*me, (*iter)->getUnitGuid()); - if (target && target->getPowerType() == POWER_MANA) + if (target && target->GetPowerType() == POWER_MANA) return target; } return NULL; @@ -1850,7 +1850,7 @@ class npc_toc_rogue : public CreatureScript events.ScheduleEvent(EVENT_EVISCERATE, urand(20*IN_MILLISECONDS, 40*IN_MILLISECONDS)); events.ScheduleEvent(EVENT_WOUND_POISON, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS)); SetEquipmentSlots(false, 47422, 49982, EQUIP_NO_CHANGE); - me->setPowerType(POWER_ENERGY); + me->SetPowerType(POWER_ENERGY); me->SetMaxPower(POWER_ENERGY, 100); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp index 0ab3388f7b9..94a3815ab2a 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp @@ -531,7 +531,7 @@ class MistressKissTargetSelector bool operator()(WorldObject* unit) const { - if (unit->GetTypeId() == TYPEID_PLAYER && unit->ToUnit()->getPowerType() == POWER_MANA) + if (unit->GetTypeId() == TYPEID_PLAYER && unit->ToUnit()->GetPowerType() == POWER_MANA) return false; return true; diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp index b97e96c7eae..a873dc565ac 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp @@ -270,7 +270,7 @@ class spell_bronjahm_magic_bane : public SpellScriptLoader void RecalculateDamage() { - if (GetHitUnit()->getPowerType() != POWER_MANA) + if (GetHitUnit()->GetPowerType() != POWER_MANA) return; int32 const maxDamage = GetCaster()->GetMap()->IsHeroic() ? 15000 : 10000; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index c96bdc7388b..dd5dd5a5e64 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -1050,7 +1050,7 @@ class spell_deathbringer_blood_link_aura : public SpellScriptLoader void HandlePeriodicTick(AuraEffect const* /*aurEff*/) { PreventDefaultAction(); - if (GetUnitOwner()->getPowerType() == POWER_ENERGY && GetUnitOwner()->GetPower(POWER_ENERGY) == GetUnitOwner()->GetMaxPower(POWER_ENERGY)) + if (GetUnitOwner()->GetPowerType() == POWER_ENERGY && GetUnitOwner()->GetPower(POWER_ENERGY) == GetUnitOwner()->GetMaxPower(POWER_ENERGY)) if (Creature* saurfang = GetUnitOwner()->ToCreature()) saurfang->AI()->DoAction(ACTION_MARK_OF_THE_FALLEN_CHAMPION); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp index c4f03cefb10..e019c0d5933 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp @@ -220,7 +220,7 @@ class boss_lady_deathwhisper : public CreatureScript Initialize(); _phase = PHASE_ONE; DoCastSelf(SPELL_SHADOW_CHANNELING); - me->SetPower(POWER_MANA, me->GetMaxPower(POWER_MANA)); + me->SetFullPower(POWER_MANA); me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, false); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 0503c8f3764..963e02740db 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -1145,7 +1145,7 @@ class UnchainedMagicTargetSelector bool operator()(WorldObject* object) const { if (Unit* unit = object->ToUnit()) - return unit->getPowerType() != POWER_MANA; + return unit->GetPowerType() != POWER_MANA; return true; } }; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index e422eab5488..664121ccd55 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -167,7 +167,7 @@ struct ManaVoidSelector : public std::unary_function<Unit*, bool> bool operator()(Unit* unit) const { - return unit->getPowerType() == POWER_MANA && _source->GetDistance(unit) > 15.0f; + return unit->GetPowerType() == POWER_MANA && _source->GetDistance(unit) > 15.0f; } WorldObject const* _source; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index 38eb73a9750..746922eef0f 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -200,7 +200,7 @@ struct ManaUserTargetSelector : public std::unary_function<Unit*, bool> { bool operator()(Unit const* target) const { - return target->GetTypeId() == TYPEID_PLAYER && target->getPowerType() == POWER_MANA; + return target->GetTypeId() == TYPEID_PLAYER && target->GetPowerType() == POWER_MANA; } }; diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_anzu.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_anzu.cpp index a6b3b69c2b3..d5d0d4b9f7a 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_anzu.cpp +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_anzu.cpp @@ -145,7 +145,7 @@ class boss_anzu : public CreatureScript case EVENT_SPELL_BOMB: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { - if (target->getPowerType() == POWER_MANA) + if (target->GetPowerType() == POWER_MANA) { DoCast(target, SPELL_SPELL_BOMB); Talk(SAY_SPELL_BOMB, target); diff --git a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp index 61f0783d9c1..92bc675a597 100644 --- a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp @@ -211,7 +211,7 @@ public: if (ManaBurn_Timer <= diff) { Unit* target = me->GetVictim(); - if (target && target->getPowerType() == POWER_MANA) + if (target && target->GetPowerType() == POWER_MANA) DoCast(target, SPELL_MANA_BURN); ManaBurn_Timer = 8000 + rand32() % 8000; } else ManaBurn_Timer -= diff; diff --git a/src/server/scripts/Outland/zone_zangarmarsh.cpp b/src/server/scripts/Outland/zone_zangarmarsh.cpp index 00b8b36e0c4..457769d4911 100644 --- a/src/server/scripts/Outland/zone_zangarmarsh.cpp +++ b/src/server/scripts/Outland/zone_zangarmarsh.cpp @@ -83,7 +83,7 @@ public: ClearGossipMenuFor(player); if (action == GOSSIP_ACTION_INFO_DEF+1) { - creature->setPowerType(POWER_MANA); + creature->SetPowerType(POWER_MANA); creature->SetMaxPower(POWER_MANA, 200); //set a "fake" mana value, we can't depend on database doing it in this case creature->SetPower(POWER_MANA, 200); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index c65d37b53f2..c0b4d56bf40 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -2643,7 +2643,7 @@ class spell_gen_pet_summoned : public SpellScriptLoader newPet->setDeathState(ALIVE); newPet->SetFullHealth(); - newPet->SetPower(newPet->getPowerType(), newPet->GetMaxPower(newPet->getPowerType())); + newPet->SetFullPower(newPet->GetPowerType()); switch (newPet->GetEntry()) { @@ -2806,7 +2806,7 @@ public: bool operator()(WorldObject* obj) const { if (Unit* target = obj->ToUnit()) - return target->getPowerType() != POWER_MANA; + return target->GetPowerType() != POWER_MANA; return true; } @@ -2862,7 +2862,7 @@ class spell_gen_replenishment : public SpellScriptLoader bool Load() override { - return GetUnitOwner()->getPowerType() == POWER_MANA; + return GetUnitOwner()->GetPowerType() == POWER_MANA; } void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) @@ -4455,7 +4455,7 @@ class MarkTargetHellfireFilter bool operator()(WorldObject* target) const { if (Unit* unit = target->ToUnit()) - return unit->getPowerType() != POWER_MANA; + return unit->GetPowerType() != POWER_MANA; return false; } }; diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index dbdecc18f70..fc9eeacc6bc 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -1145,7 +1145,7 @@ class spell_item_heartpierce : public SpellScriptLoader Unit* caster = eventInfo.GetActor(); uint32 spellId; - switch (caster->getPowerType()) + switch (caster->GetPowerType()) { case POWER_MANA: spellId = Mana; diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 0d85582b341..821937ae60c 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -101,7 +101,7 @@ class PowerCheck bool operator()(WorldObject* obj) const { if (Unit* target = obj->ToUnit()) - return target->getPowerType() != _power; + return target->GetPowerType() != _power; return true; } diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 8a3e76b44cb..f19b8a270e5 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -838,7 +838,7 @@ class spell_symbol_of_life_dummy : public SpellScriptLoader target->SetUInt32Value(OBJECT_DYNAMIC_FLAGS, 0); target->SetUInt32Value(UNIT_FIELD_FLAGS_2, 0); target->SetHealth(target->GetMaxHealth() / 2); - target->SetPower(POWER_MANA, uint32(target->GetMaxPower(POWER_MANA) * 0.75f)); + target->SetPower(POWER_MANA, target->GetMaxPower(POWER_MANA) * 0.75f); } } } diff --git a/src/server/scripts/World/duel_reset.cpp b/src/server/scripts/World/duel_reset.cpp index 1d279f84880..cdf8808aa52 100644 --- a/src/server/scripts/World/duel_reset.cpp +++ b/src/server/scripts/World/duel_reset.cpp @@ -45,24 +45,12 @@ class DuelResetScript : public PlayerScript if (sWorld->getBoolConfig(CONFIG_RESET_DUEL_HEALTH_MANA)) { player1->SaveHealthBeforeDuel(); - player1->SetHealth(player1->GetMaxHealth()); + player1->SaveManaBeforeDuel(); + player1->ResetAllPowers(); player2->SaveHealthBeforeDuel(); - player2->SetHealth(player2->GetMaxHealth()); - - // check if player1 class uses mana - if (player1->getPowerType() == POWER_MANA || player1->getClass() == CLASS_DRUID) - { - player1->SaveManaBeforeDuel(); - player1->SetPower(POWER_MANA, player1->GetMaxPower(POWER_MANA)); - } - - // check if player2 class uses mana - if (player2->getPowerType() == POWER_MANA || player2->getClass() == CLASS_DRUID) - { - player2->SaveManaBeforeDuel(); - player2->SetPower(POWER_MANA, player2->GetMaxPower(POWER_MANA)); - } + player2->SaveManaBeforeDuel(); + player2->ResetAllPowers(); } } @@ -89,11 +77,11 @@ class DuelResetScript : public PlayerScript loser->RestoreHealthAfterDuel(); // check if player1 class uses mana - if (winner->getPowerType() == POWER_MANA || winner->getClass() == CLASS_DRUID) + if (winner->GetPowerType() == POWER_MANA || winner->getClass() == CLASS_DRUID) winner->RestoreManaAfterDuel(); // check if player2 class uses mana - if (loser->getPowerType() == POWER_MANA || loser->getClass() == CLASS_DRUID) + if (loser->GetPowerType() == POWER_MANA || loser->getClass() == CLASS_DRUID) loser->RestoreManaAfterDuel(); } } |