From 9d3e87fd871192e8b59f16fde96aa9f436b5d970 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 3 Jan 2018 13:57:16 -0500 Subject: [PATCH] Core/Misc: Added helper function Unit::SetFullPower * Also renamed Unit::getPowerType and Unit::setPowerType to follow style guidelines --- Source/Framework/Constants/Language.cs | 2 +- Source/Framework/Constants/UnitConst.cs | 4 +- Source/Game/AI/SmartScripts/SmartScript.cs | 4 +- Source/Game/Chat/Commands/ModifyCommands.cs | 1 - Source/Game/Entities/Creature/Creature.cs | 8 ++-- Source/Game/Entities/Pet.cs | 12 ++--- Source/Game/Entities/Player/Player.Talents.cs | 2 +- Source/Game/Entities/Player/Player.cs | 47 ++++++++----------- Source/Game/Entities/StatSystem.cs | 42 +++++++++-------- Source/Game/Entities/TemporarySummon.cs | 2 +- Source/Game/Entities/Unit/Comparer.cs | 4 +- Source/Game/Entities/Unit/Unit.Combat.cs | 2 +- Source/Game/Entities/Unit/Unit.Pets.cs | 2 +- Source/Game/Entities/Unit/Unit.cs | 4 +- Source/Game/Entities/Vehicle.cs | 4 +- Source/Game/Network/Packets/PartyPackets.cs | 6 +-- Source/Game/Network/Packets/SpellPackets.cs | 4 +- Source/Game/Spells/Auras/AuraEffect.cs | 8 ++-- Source/Game/Spells/Spell.cs | 4 +- Source/Game/Spells/SpellEffects.cs | 6 +-- .../EasternKingdoms/Karazhan/Curator.cs | 18 +++---- .../EasternKingdoms/Karazhan/Moroes.cs | 2 +- .../TrialOfTheCrusader/LordJaraxxus.cs | 2 +- .../FrozenHalls/ForgeOfSouls/BossBronjahm.cs | 2 +- .../IcecrownCitadel/LadyDeathwhisper.cs | 2 +- Source/Scripts/Outlands/Zangarmarsh.cs | 2 +- Source/Scripts/Spells/Generic.cs | 6 +-- Source/Scripts/Spells/Items.cs | 2 +- Source/Scripts/Spells/Priest.cs | 2 +- Source/Scripts/World/DuelReset.cs | 24 +++------- 30 files changed, 106 insertions(+), 124 deletions(-) diff --git a/Source/Framework/Constants/Language.cs b/Source/Framework/Constants/Language.cs index aa0893856..f368a1ddd 100644 --- a/Source/Framework/Constants/Language.cs +++ b/Source/Framework/Constants/Language.cs @@ -172,7 +172,7 @@ namespace Framework.Constants YouChangeEnergy = 122, YoursEnergyChanged = 123, - CurrentEnergy = 124, //Log + CurrentEnergy = 124, YouChangeRage = 125, YoursRageChanged = 126, YouChangeLvl = 127, diff --git a/Source/Framework/Constants/UnitConst.cs b/Source/Framework/Constants/UnitConst.cs index 145bc2a67..ecd273ff8 100644 --- a/Source/Framework/Constants/UnitConst.cs +++ b/Source/Framework/Constants/UnitConst.cs @@ -153,9 +153,9 @@ namespace Framework.Constants Runes, RunicPower, SoulShards, - Eclipse, + LunarPower, HolyPower, - Alternative, + Alternate, Maelstrom, Chi, Insanity, diff --git a/Source/Game/AI/SmartScripts/SmartScript.cs b/Source/Game/AI/SmartScripts/SmartScript.cs index d229e03ae..4db0519f7 100644 --- a/Source/Game/AI/SmartScripts/SmartScript.cs +++ b/Source/Game/AI/SmartScripts/SmartScript.cs @@ -2927,7 +2927,7 @@ namespace Game.AI { if (me == null || !me.IsInCombat() || me.GetMaxPower(PowerType.Mana) == 0) return; - uint perc = (uint)(100.0f * me.GetPower(PowerType.Mana) / me.GetMaxPower(PowerType.Mana)); + uint perc = (uint)me.GetPowerPct(PowerType.Mana); if (perc > e.Event.minMaxRepeat.max || perc < e.Event.minMaxRepeat.min) return; ProcessTimedAction(e, e.Event.minMaxRepeat.repeatMin, e.Event.minMaxRepeat.repeatMax); @@ -2937,7 +2937,7 @@ namespace Game.AI { if (me == null || !me.IsInCombat() || me.GetVictim() == null || me.GetVictim().GetMaxPower(PowerType.Mana) == 0) return; - uint perc = (uint)(100.0f * me.GetVictim().GetPower(PowerType.Mana) / me.GetVictim().GetMaxPower(PowerType.Mana)); + uint perc = (uint)me.GetVictim().GetPowerPct(PowerType.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/Source/Game/Chat/Commands/ModifyCommands.cs b/Source/Game/Chat/Commands/ModifyCommands.cs index d51fb11ec..b1fb44b64 100644 --- a/Source/Game/Chat/Commands/ModifyCommands.cs +++ b/Source/Game/Chat/Commands/ModifyCommands.cs @@ -71,7 +71,6 @@ namespace Game.Chat NotifyModification(handler, target, CypherStrings.YouChangeEnergy, CypherStrings.YoursEnergyChanged, energy / energyMultiplier, energymax / energyMultiplier); target.SetMaxPower(PowerType.Energy, energymax); target.SetPower(PowerType.Energy, energy); - Log.outDebug(LogFilter.Misc, handler.GetCypherString(CypherStrings.CurrentEnergy), target.GetMaxPower(PowerType.Energy)); return true; } return false; diff --git a/Source/Game/Entities/Creature/Creature.cs b/Source/Game/Entities/Creature/Creature.cs index 11900367c..58c55fa3a 100644 --- a/Source/Game/Entities/Creature/Creature.cs +++ b/Source/Game/Entities/Creature/Creature.cs @@ -516,7 +516,7 @@ namespace Game.Entities if (HasFlag(UnitFields.Flags2, UnitFlags2.RegeneratePower)) { - if (getPowerType() == PowerType.Energy) + if (GetPowerType() == PowerType.Energy) Regenerate(PowerType.Energy); else RegenerateMana(); @@ -1133,10 +1133,10 @@ namespace Game.Entities switch (GetClass()) { case Class.Warrior: - setPowerType(PowerType.Rage); + SetPowerType(PowerType.Rage); break; case Class.Rogue: - setPowerType(PowerType.Energy); + SetPowerType(PowerType.Energy); break; default: SetMaxPower(PowerType.Mana, (int)mana); @@ -1409,7 +1409,7 @@ namespace Game.Entities else { curhealth = GetMaxHealth(); - SetPower(PowerType.Mana, GetMaxPower(PowerType.Mana)); + SetFullPower(PowerType.Mana); } SetHealth((m_deathState == DeathState.Alive || m_deathState == DeathState.JustRespawned) ? curhealth : 0); diff --git a/Source/Game/Entities/Pet.cs b/Source/Game/Entities/Pet.cs index c57a0cb2a..6e8df143a 100644 --- a/Source/Game/Entities/Pet.cs +++ b/Source/Game/Entities/Pet.cs @@ -218,7 +218,7 @@ namespace Game.Entities SetByteFlag(UnitFields.Bytes2, UnitBytes2Offsets.PetFlags, (result.Read(9) ? UnitPetFlags.CanBeAbandoned : UnitPetFlags.CanBeRenamed | UnitPetFlags.CanBeAbandoned)); SetUInt32Value(UnitFields.Flags, (uint)UnitFlags.PvpAttackable); // this enables popup window (pet abandon, cancel) - setPowerType(PowerType.Focus); + SetPowerType(PowerType.Focus); break; default: if (!IsPetGhoul()) @@ -247,7 +247,7 @@ namespace Game.Entities SetCanModifyStats(true); if (getPetType() == PetType.Summon && !current) //all (?) summon pets come with full health when called, but not when they are current - SetPower(PowerType.Mana, GetMaxPower(PowerType.Mana)); + SetFullPower(PowerType.Mana); else { uint savedhealth = result.Read(10); @@ -256,8 +256,8 @@ namespace Game.Entities setDeathState(DeathState.JustDied); else { - SetHealth(savedhealth > GetMaxHealth() ? GetMaxHealth() : savedhealth); - SetPower(PowerType.Mana, savedmana > GetMaxPower(PowerType.Mana) ? GetMaxPower(PowerType.Mana) : (int)savedmana); + SetHealth(savedhealth); + SetPower(PowerType.Mana, (int)savedmana); } } @@ -579,7 +579,7 @@ namespace Game.Entities m_focusRegenTimer -= diff; else { - switch (getPowerType()) + switch (GetPowerType()) { case PowerType.Focus: Regenerate(PowerType.Focus); @@ -714,7 +714,7 @@ namespace Game.Entities if (!Create(map.GenerateLowGuid(HighGuid.Pet), map, cinfo.Entry)) return false; - setPowerType(PowerType.Focus); + SetPowerType(PowerType.Focus); SetUInt32Value(UnitFields.PetNameTimestamp, 0); SetUInt32Value(UnitFields.PetExperience, 0); SetUInt32Value(UnitFields.PetNextLevelExp, (uint)(Global.ObjectMgr.GetXPForLevel(getLevel() + 1) * PetXPFactor)); diff --git a/Source/Game/Entities/Player/Player.Talents.cs b/Source/Game/Entities/Player/Player.Talents.cs index 271dd56c9..ed2fc39e5 100644 --- a/Source/Game/Entities/Player/Player.Talents.cs +++ b/Source/Game/Entities/Player/Player.Talents.cs @@ -357,7 +357,7 @@ namespace Game.Entities SendActionButtons(1); UpdateDisplayPower(); - PowerType pw = getPowerType(); + PowerType pw = GetPowerType(); if (pw != PowerType.Mana) SetPower(PowerType.Mana, 0); // Mana must be 0 even if it isn't the active power type. diff --git a/Source/Game/Entities/Player/Player.cs b/Source/Game/Entities/Player/Player.cs index c483b954b..044d66553 100644 --- a/Source/Game/Entities/Player/Player.cs +++ b/Source/Game/Entities/Player/Player.cs @@ -345,8 +345,8 @@ namespace Game.Entities // 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() == PowerType.Mana) - SetPower(PowerType.Mana, GetMaxPower(PowerType.Mana)); + if (GetPowerType() == PowerType.Mana) + SetFullPower(PowerType.Mana); // original spells LearnDefaultSkills(); @@ -3573,19 +3573,12 @@ namespace Game.Entities { ResurrectPlayer(0.0f, false); - if (GetMaxHealth() > _resurrectionData.Health) - SetHealth(_resurrectionData.Health); - else - SetFullHealth(); - - if (GetMaxPower(PowerType.Mana) > _resurrectionData.Mana) - SetPower(PowerType.Mana, (int)_resurrectionData.Mana); - else - SetPower(PowerType.Mana, GetMaxPower(PowerType.Mana)); + SetHealth(_resurrectionData.Health); + SetPower(PowerType.Mana, (int)_resurrectionData.Mana); SetPower(PowerType.Rage, 0); - SetPower(PowerType.Energy, GetMaxPower(PowerType.Energy)); - SetPower(PowerType.Focus, GetMaxPower(PowerType.Focus)); + SetFullPower(PowerType.Energy); + SetFullPower(PowerType.Focus); SetPower(PowerType.LunarPower, 0); uint aura = _resurrectionData.Aura; @@ -3921,17 +3914,17 @@ namespace Game.Entities } public void ResetAllPowers() { - SetHealth(GetMaxHealth()); - switch (getPowerType()) + SetFullHealth(); + switch (GetPowerType()) { case PowerType.Mana: - SetPower(PowerType.Mana, GetMaxPower(PowerType.Mana)); + SetFullPower(PowerType.Mana); break; case PowerType.Rage: SetPower(PowerType.Rage, 0); break; case PowerType.Energy: - SetPower(PowerType.Energy, GetMaxPower(PowerType.Energy)); + SetFullPower(PowerType.Energy); break; case PowerType.RunicPower: SetPower(PowerType.RunicPower, 0); @@ -4484,7 +4477,7 @@ namespace Game.Entities // set health/powers (0- will be set in caller) if (restore_percent > 0.0f) { - SetHealth((uint)(GetMaxHealth() * restore_percent)); + SetHealth((ulong)(GetMaxHealth() * restore_percent)); SetPower(PowerType.Mana, (int)(GetMaxPower(PowerType.Mana) * restore_percent)); SetPower(PowerType.Rage, 0); SetPower(PowerType.Energy, (int)(GetMaxPower(PowerType.Energy) * restore_percent)); @@ -4842,7 +4835,7 @@ namespace Game.Entities pet.SetCreatorGUID(GetGUID()); pet.SetUInt32Value(UnitFields.FactionTemplate, getFaction()); - pet.setPowerType(PowerType.Mana); + pet.SetPowerType(PowerType.Mana); pet.SetUInt64Value(UnitFields.NpcFlags, (uint)NPCFlags.None); pet.SetUInt32Value(UnitFields.Bytes1, 0); pet.InitStatsForLevel(getLevel()); @@ -4858,7 +4851,7 @@ namespace Game.Entities pet.SetUInt32Value(UnitFields.PetExperience, 0); pet.SetUInt32Value(UnitFields.PetNextLevelExp, 1000); pet.SetFullHealth(); - pet.SetPower(PowerType.Mana, pet.GetMaxPower(PowerType.Mana)); + pet.SetFullPower(PowerType.Mana); pet.SetUInt32Value(UnitFields.PetNameTimestamp, (uint)Time.UnixTime); // cast can't be helped in this case break; default: @@ -5332,10 +5325,10 @@ namespace Game.Entities // set current level health and mana/energy to maximum after applying all mods. SetFullHealth(); - SetPower(PowerType.Mana, GetMaxPower(PowerType.Mana)); - SetPower(PowerType.Energy, GetMaxPower(PowerType.Energy)); + SetFullPower(PowerType.Mana); + SetFullPower(PowerType.Energy); if (GetPower(PowerType.Rage) > GetMaxPower(PowerType.Rage)) - SetPower(PowerType.Rage, GetMaxPower(PowerType.Rage)); + SetFullPower(PowerType.Rage); SetPower(PowerType.Focus, 0); // update level to hunter/summon pet @@ -5914,11 +5907,11 @@ namespace Game.Entities // set current level health and mana/energy to maximum after applying all mods. SetFullHealth(); - SetPower(PowerType.Mana, GetMaxPower(PowerType.Mana)); - SetPower(PowerType.Energy, GetMaxPower(PowerType.Energy)); + SetFullPower(PowerType.Mana); + SetFullPower(PowerType.Energy); if (GetPower(PowerType.Rage) > GetMaxPower(PowerType.Rage)) - SetPower(PowerType.Rage, GetMaxPower(PowerType.Rage)); - SetPower(PowerType.Focus, GetMaxPower(PowerType.Focus)); + SetFullPower(PowerType.Rage); + SetFullPower(PowerType.Focus); SetPower(PowerType.RunicPower, 0); // update level to hunter/summon pet diff --git a/Source/Game/Entities/StatSystem.cs b/Source/Game/Entities/StatSystem.cs index be87459c1..dc46f9ddd 100644 --- a/Source/Game/Entities/StatSystem.cs +++ b/Source/Game/Entities/StatSystem.cs @@ -79,9 +79,9 @@ namespace Game.Entities case UnitMods.Runes: case UnitMods.RunicPower: case UnitMods.SoulShards: - case UnitMods.Eclipse: + case UnitMods.LunarPower: case UnitMods.HolyPower: - case UnitMods.Alternative: + case UnitMods.Alternate: case UnitMods.Maelstrom: case UnitMods.Chi: case UnitMods.Insanity: @@ -413,16 +413,16 @@ namespace Game.Entities public virtual float GetArmorMultiplierForTarget(WorldObject target) { return 1.0f; } //Powers - public PowerType getPowerType() + public PowerType GetPowerType() { return (PowerType)GetUInt32Value(UnitFields.DisplayPower); } - public void setPowerType(PowerType newPowerType) + public void SetPowerType(PowerType powerType) { - if (getPowerType() == newPowerType) + if (GetPowerType() == powerType) return; - SetUInt32Value(UnitFields.DisplayPower, (uint)newPowerType); + SetUInt32Value(UnitFields.DisplayPower, (uint)powerType); if (IsTypeId(TypeId.Player)) { @@ -444,7 +444,7 @@ namespace Game.Entities powerMultiplier = creature.GetCreatureTemplate().ModMana; } - switch (newPowerType) + switch (powerType) { default: case PowerType.Mana: @@ -462,13 +462,13 @@ namespace Game.Entities break; } } - public void SetMaxPower(PowerType power, int val) + public void SetMaxPower(PowerType powerType, int val) { - uint powerIndex = GetPowerIndex(power); + uint powerIndex = GetPowerIndex(powerType); if (powerIndex == (int)PowerType.Max || powerIndex >= (int)PowerType.MaxPerClass) return; - int cur_power = GetPower(power); + int cur_power = GetPower(powerType); SetInt32Value(UnitFields.MaxPower + (int)powerIndex, val); // group update @@ -485,7 +485,7 @@ namespace Game.Entities }*/ if (val < cur_power) - SetPower(power, val); + SetPower(powerType, val); } public void SetPower(PowerType powerType, int val) { @@ -521,30 +521,31 @@ namespace Game.Entities pet.SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_CUR_POWER); }*/ } - public int GetPower(PowerType power) + public void SetFullPower(PowerType powerType) { SetPower(powerType, GetMaxPower(powerType)); } + public int GetPower(PowerType powerType) { - uint powerIndex = GetPowerIndex(power); + uint powerIndex = GetPowerIndex(powerType); if (powerIndex == (int)PowerType.Max || powerIndex >= (int)PowerType.MaxPerClass) return 0; return GetInt32Value(UnitFields.Power + (int)powerIndex); } - public int GetMaxPower(PowerType power) + public int GetMaxPower(PowerType powerType) { - uint powerIndex = GetPowerIndex(power); + uint powerIndex = GetPowerIndex(powerType); if (powerIndex == (int)PowerType.Max || powerIndex >= (int)PowerType.MaxPerClass) return 0; return GetInt32Value(UnitFields.MaxPower + (int)powerIndex); } - public int GetCreatePowers(PowerType power) + public int GetCreatePowers(PowerType powerType) { - if (power == PowerType.Mana) + if (powerType == PowerType.Mana) return (int)GetCreateMana(); - PowerTypeRecord powerType = Global.DB2Mgr.GetPowerTypeEntry(power); - if (powerType != null) - return powerType.MaxPower; + PowerTypeRecord powerTypeEntry = Global.DB2Mgr.GetPowerTypeEntry(powerType); + if (powerTypeEntry != null) + return powerTypeEntry.MaxPower; return 0; } @@ -560,6 +561,7 @@ namespace Game.Entities return Global.DB2Mgr.GetPowerIndexByClass(powerType, _class); } + public float GetPowerPct(PowerType powerType) { return GetMaxPower(powerType) != 0 ? 100.0f* GetPower(powerType) / GetMaxPower(powerType) : 0.0f; } public void ApplyResilience(Unit victim, ref uint damage) { diff --git a/Source/Game/Entities/TemporarySummon.cs b/Source/Game/Entities/TemporarySummon.cs index 801283f92..0fa2392a7 100644 --- a/Source/Game/Entities/TemporarySummon.cs +++ b/Source/Game/Entities/TemporarySummon.cs @@ -629,7 +629,7 @@ namespace Game.Entities UpdateAllStats(); SetFullHealth(); - SetPower(PowerType.Mana, GetMaxPower(PowerType.Mana)); + SetFullPower(PowerType.Mana); return true; } diff --git a/Source/Game/Entities/Unit/Comparer.cs b/Source/Game/Entities/Unit/Comparer.cs index 4d63f0fba..ac307da1a 100644 --- a/Source/Game/Entities/Unit/Comparer.cs +++ b/Source/Game/Entities/Unit/Comparer.cs @@ -33,8 +33,8 @@ namespace Game.Entities { Unit a = objA.ToUnit(); Unit b = objB.ToUnit(); - float rA = a.GetMaxPower(m_power) != 0 ? a.GetPower(m_power) / (float)a.GetMaxPower(m_power) : 0.0f; - float rB = b.GetMaxPower(m_power) != 0 ? b.GetPower(m_power) / (float)b.GetMaxPower(m_power) : 0.0f; + float rA = a != null ? a.GetPowerPct(m_power) : 0.0f; + float rB = b != null ? b.GetPowerPct(m_power) : 0.0f; return Convert.ToInt32(m_ascending ? rA < rB : rA > rB); } diff --git a/Source/Game/Entities/Unit/Unit.Combat.cs b/Source/Game/Entities/Unit/Unit.Combat.cs index 23ab6e461..72b08632c 100644 --- a/Source/Game/Entities/Unit/Unit.Combat.cs +++ b/Source/Game/Entities/Unit/Unit.Combat.cs @@ -944,7 +944,7 @@ namespace Game.Entities } // Rage from Damage made (only from direct weapon damage) - if (cleanDamage != null && (cleanDamage.attackType == WeaponAttackType.BaseAttack || cleanDamage.attackType == WeaponAttackType.OffAttack) && damagetype == DamageEffectType.Direct && this != victim && getPowerType() == PowerType.Rage) + if (cleanDamage != null && (cleanDamage.attackType == WeaponAttackType.BaseAttack || cleanDamage.attackType == WeaponAttackType.OffAttack) && damagetype == DamageEffectType.Direct && this != victim && GetPowerType() == PowerType.Rage) { uint rage = (uint)(GetBaseAttackTime(cleanDamage.attackType) / 1000.0f * 1.75f); if (cleanDamage.attackType == WeaponAttackType.OffAttack) diff --git a/Source/Game/Entities/Unit/Unit.Pets.cs b/Source/Game/Entities/Unit/Unit.Pets.cs index 970bf15f5..47deaa566 100644 --- a/Source/Game/Entities/Unit/Unit.Pets.cs +++ b/Source/Game/Entities/Unit/Unit.Pets.cs @@ -215,7 +215,7 @@ namespace Game.Entities // Ghoul pets have energy instead of mana (is anywhere better place for this code?) if (minion.IsPetGhoul()) - minion.setPowerType(PowerType.Energy); + minion.SetPowerType(PowerType.Energy); // Send infinity cooldown - client does that automatically but after relog cooldown needs to be set again SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(minion.GetUInt32Value(UnitFields.CreatedBySpell)); diff --git a/Source/Game/Entities/Unit/Unit.cs b/Source/Game/Entities/Unit/Unit.cs index 0ddc254f2..55f01e8dc 100644 --- a/Source/Game/Entities/Unit/Unit.cs +++ b/Source/Game/Entities/Unit/Unit.cs @@ -1651,7 +1651,7 @@ namespace Game.Entities // 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(UnitFields.NpcEmotestate, 0); // players in instance don't have ZoneScript, but they have InstanceScript @@ -1969,7 +1969,7 @@ namespace Game.Entities } } - setPowerType(displayPower); + SetPowerType(displayPower); } public FactionTemplateRecord GetFactionTemplateEntry() diff --git a/Source/Game/Entities/Vehicle.cs b/Source/Game/Entities/Vehicle.cs index 61e6f1b30..d3af2edf2 100644 --- a/Source/Game/Entities/Vehicle.cs +++ b/Source/Game/Entities/Vehicle.cs @@ -75,9 +75,9 @@ namespace Game.Entities { PowerDisplayRecord powerDisplay = CliDB.PowerDisplayStorage.LookupByKey(_vehicleInfo.PowerDisplayID[0]); if (powerDisplay != null) - _me.setPowerType((PowerType)powerDisplay.PowerType); + _me.SetPowerType((PowerType)powerDisplay.PowerType); else if (_me.GetClass() == Class.Rogue) - _me.setPowerType(PowerType.Energy); + _me.SetPowerType(PowerType.Energy); } _status = Status.Installed; diff --git a/Source/Game/Network/Packets/PartyPackets.cs b/Source/Game/Network/Packets/PartyPackets.cs index 8e307a45a..692b03f87 100644 --- a/Source/Game/Network/Packets/PartyPackets.cs +++ b/Source/Game/Network/Packets/PartyPackets.cs @@ -268,10 +268,10 @@ namespace Game.Network.Packets MemberStats.MaxHealth = (int)player.GetMaxHealth(); // Power - MemberStats.PowerType = (byte)player.getPowerType(); + MemberStats.PowerType = (byte)player.GetPowerType(); MemberStats.PowerDisplayID = 0; - MemberStats.CurrentPower = (ushort)player.GetPower(player.getPowerType()); - MemberStats.MaxPower = (ushort)player.GetMaxPower(player.getPowerType()); + MemberStats.CurrentPower = (ushort)player.GetPower(player.GetPowerType()); + MemberStats.MaxPower = (ushort)player.GetMaxPower(player.GetPowerType()); // Position MemberStats.ZoneID = (ushort)player.GetZoneId(); diff --git a/Source/Game/Network/Packets/SpellPackets.cs b/Source/Game/Network/Packets/SpellPackets.cs index f42f97fcc..691afdc13 100644 --- a/Source/Game/Network/Packets/SpellPackets.cs +++ b/Source/Game/Network/Packets/SpellPackets.cs @@ -1101,7 +1101,7 @@ namespace Game.Network.Packets Health = (long)unit.GetHealth(); AttackPower = (int)unit.GetTotalAttackPowerValue(unit.GetClass() == Class.Hunter ? WeaponAttackType.RangedAttack : WeaponAttackType.BaseAttack); SpellPower = unit.SpellBaseDamageBonusDone(SpellSchoolMask.Spell); - PowerData.Add(new SpellLogPowerData((int)unit.getPowerType(), unit.GetPower(unit.getPowerType()), 0)); + PowerData.Add(new SpellLogPowerData((int)unit.GetPowerType(), unit.GetPower(unit.GetPowerType()), 0)); } public void Initialize(Spell spell) @@ -1109,7 +1109,7 @@ namespace Game.Network.Packets Health = (long)spell.GetCaster().GetHealth(); AttackPower = (int)spell.GetCaster().GetTotalAttackPowerValue(spell.GetCaster().GetClass() == Class.Hunter ? WeaponAttackType.RangedAttack : WeaponAttackType.BaseAttack); SpellPower = spell.GetCaster().SpellBaseDamageBonusDone(SpellSchoolMask.Spell); - PowerType primaryPowerType = spell.GetCaster().getPowerType(); + PowerType primaryPowerType = spell.GetCaster().GetPowerType(); bool primaryPowerAdded = false; foreach (SpellPowerCost cost in spell.GetPowerCost()) { diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index 5e3ef19ca..9caa7f734 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -4820,7 +4820,7 @@ namespace Game.Spells { // 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() != PowerType.Rage) + if (target.GetPowerType() != PowerType.Rage) break; int rage = target.GetPower(PowerType.Rage); // Nothing todo @@ -5595,7 +5595,7 @@ namespace Game.Spells { PowerType powerType = (PowerType)GetMiscValue(); - if (caster == null || !caster.IsAlive() || !target.IsAlive() || target.getPowerType() != powerType) + if (caster == null || !caster.IsAlive() || !target.IsAlive() || target.GetPowerType() != powerType) return; if (target.HasUnitState(UnitState.Isolated) || target.IsImmunedToDamage(GetSpellInfo())) @@ -5646,7 +5646,7 @@ namespace Game.Spells { PowerType powerType; if (GetMiscValue() == (int)PowerType.All) - powerType = target.getPowerType(); + powerType = target.GetPowerType(); else powerType = (PowerType)GetMiscValue(); @@ -5708,7 +5708,7 @@ namespace Game.Spells { PowerType powerType = (PowerType)GetMiscValue(); - if (caster == null || !target.IsAlive() || target.getPowerType() != powerType) + if (caster == null || !target.IsAlive() || target.GetPowerType() != powerType) return; if (target.HasUnitState(UnitState.Isolated) || target.IsImmunedToDamage(GetSpellInfo())) diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index ecf0b33ef..1ea1018ae 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -4931,7 +4931,7 @@ namespace Game.Spells { Unit target1 = m_targets.GetUnitTarget(); if (target1 != null) - if (target1 != m_caster && unitTarget.getPowerType() != (PowerType)effect.MiscValue) + if (target1 != m_caster && unitTarget.GetPowerType() != (PowerType)effect.MiscValue) return SpellCastResult.BadTargets; } break; @@ -5378,7 +5378,7 @@ namespace Game.Spells if (!m_caster.IsTypeId(TypeId.Player) || m_CastItem != null) break; - if (m_targets.GetUnitTarget().getPowerType() != PowerType.Mana) + if (m_targets.GetUnitTarget().GetPowerType() != PowerType.Mana) return SpellCastResult.BadTargets; break; diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index 4b23ae233..7ab705f0c 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -823,7 +823,7 @@ namespace Game.Spells PowerType powerType = (PowerType)effectInfo.MiscValue; - if (unitTarget == null || !unitTarget.IsAlive() || unitTarget.getPowerType() != powerType || damage < 0) + if (unitTarget == null || !unitTarget.IsAlive() || unitTarget.GetPowerType() != powerType || damage < 0) return; // add spell damage bonus @@ -902,7 +902,7 @@ namespace Game.Spells PowerType powerType = (PowerType)effectInfo.MiscValue; - if (unitTarget == null || !unitTarget.IsAlive() || unitTarget.getPowerType() != powerType || damage < 0) + if (unitTarget == null || !unitTarget.IsAlive() || unitTarget.GetPowerType() != powerType || damage < 0) return; int newDamage = -(unitTarget.ModifyPower(powerType, -damage)); @@ -4077,7 +4077,7 @@ namespace Game.Spells player.SetHealth(health); player.SetPower(PowerType.Mana, mana); player.SetPower(PowerType.Rage, 0); - player.SetPower(PowerType.Energy, player.GetMaxPower(PowerType.Energy)); + player.SetFullPower(PowerType.Energy); player.SetPower(PowerType.Focus, 0); player.SpawnCorpseBones(); diff --git a/Source/Scripts/EasternKingdoms/Karazhan/Curator.cs b/Source/Scripts/EasternKingdoms/Karazhan/Curator.cs index 5804d3823..4153a3c13 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/Curator.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/Curator.cs @@ -57,8 +57,8 @@ namespace Scripts.EasternKingdoms.Karazhan.Curator { _scheduler.Schedule(TimeSpan.FromSeconds(10), task => { - //Summon Astral Flare - Creature AstralFlare = DoSpawnCreature(17096, RandomHelper.Rand32() % 37, RandomHelper.Rand32() % 37, 0, 0, TempSummonType.TimedDespawnOOC, 5000); + //Summon Astral Flare + Creature AstralFlare = DoSpawnCreature(17096, RandomHelper.Rand32() % 37, RandomHelper.Rand32() % 37, 0, 0, TempSummonType.TimedDespawnOOC, 5000); Unit target = SelectTarget(SelectAggroTarget.Random, 0); if (AstralFlare && target) @@ -67,23 +67,23 @@ namespace Scripts.EasternKingdoms.Karazhan.Curator AstralFlare.GetAI().AttackStart(target); } - //Reduce Mana by 10% of max health - int mana = me.GetMaxPower(PowerType.Mana); + //Reduce Mana by 10% of max health + int mana = me.GetMaxPower(PowerType.Mana); if (mana != 0) { mana /= 10; me.ModifyPower(PowerType.Mana, -mana); - //if this get's us below 10%, then we evocate (the 10th should be summoned now) - if (me.GetPower(PowerType.Mana) * 100 / me.GetMaxPower(PowerType.Mana) < 10) + //if this get's us below 10%, then we evocate (the 10th should be summoned now) + if (me.GetPower(PowerType.Mana) * 100 / me.GetMaxPower(PowerType.Mana) < 10) { Talk(TextIds.SayEvocate); me.InterruptNonMeleeSpells(false); DoCast(me, SpellIds.Evocation); _scheduler.DelayAll(TimeSpan.FromSeconds(20)); - //Evocating = true; - //no AddTimer cooldown, this will make first flare appear instantly after evocate end, like expected - return; + //Evocating = true; + //no AddTimer cooldown, this will make first flare appear instantly after evocate end, like expected + return; } else { diff --git a/Source/Scripts/EasternKingdoms/Karazhan/Moroes.cs b/Source/Scripts/EasternKingdoms/Karazhan/Moroes.cs index 05ee622da..d8a47f182 100644 --- a/Source/Scripts/EasternKingdoms/Karazhan/Moroes.cs +++ b/Source/Scripts/EasternKingdoms/Karazhan/Moroes.cs @@ -421,7 +421,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Moroes { Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100, true); if (target) - if (target.getPowerType() == PowerType.Mana) + if (target.GetPowerType() == PowerType.Mana) DoCast(target, SpellIds.Manaburn); ManaBurn_Timer = 5000; // 3 sec cast } diff --git a/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/LordJaraxxus.cs b/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/LordJaraxxus.cs index 77b65a04f..394cef3c1 100644 --- a/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/LordJaraxxus.cs +++ b/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/LordJaraxxus.cs @@ -464,7 +464,7 @@ namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheCrusader void FilterTargets(List targets) { // get a list of players with mana - targets.RemoveAll(unit => unit.IsTypeId(TypeId.Player) && unit.ToPlayer().getPowerType() == PowerType.Mana); + targets.RemoveAll(unit => unit.IsTypeId(TypeId.Player) && unit.ToPlayer().GetPowerType() == PowerType.Mana); if (targets.Empty()) return; diff --git a/Source/Scripts/Northrend/FrozenHalls/ForgeOfSouls/BossBronjahm.cs b/Source/Scripts/Northrend/FrozenHalls/ForgeOfSouls/BossBronjahm.cs index dc0edeced..d169b39bb 100644 --- a/Source/Scripts/Northrend/FrozenHalls/ForgeOfSouls/BossBronjahm.cs +++ b/Source/Scripts/Northrend/FrozenHalls/ForgeOfSouls/BossBronjahm.cs @@ -258,7 +258,7 @@ namespace Scripts.Northrend.FrozenHalls.ForgeOfSouls.Bronjahm { void RecalculateDamage() { - if (GetHitUnit().getPowerType() != PowerType.Mana) + if (GetHitUnit().GetPowerType() != PowerType.Mana) return; int maxDamage = GetCaster().GetMap().IsHeroic() ? 15000 : 10000; diff --git a/Source/Scripts/Northrend/IcecrownCitadel/LadyDeathwhisper.cs b/Source/Scripts/Northrend/IcecrownCitadel/LadyDeathwhisper.cs index 489ba6d27..0e30a574c 100644 --- a/Source/Scripts/Northrend/IcecrownCitadel/LadyDeathwhisper.cs +++ b/Source/Scripts/Northrend/IcecrownCitadel/LadyDeathwhisper.cs @@ -225,7 +225,7 @@ namespace Scripts.Northrend.IcecrownCitadel public override void Reset() { _Reset(); - me.SetPower(PowerType.Mana, me.GetMaxPower(PowerType.Mana)); + me.SetFullPower(PowerType.Mana); _events.SetPhase(LadyConst.PhaseOne); _waveCounter = 0; _nextVengefulShadeTargetGUID.Clear(); diff --git a/Source/Scripts/Outlands/Zangarmarsh.cs b/Source/Scripts/Outlands/Zangarmarsh.cs index bc787068a..23bc11eb1 100644 --- a/Source/Scripts/Outlands/Zangarmarsh.cs +++ b/Source/Scripts/Outlands/Zangarmarsh.cs @@ -49,7 +49,7 @@ namespace Scripts.Outlands player.PlayerTalkClass.ClearMenus(); if (action == eTradeskill.GossipActionInfoDef + 1) { - creature.setPowerType(PowerType.Mana); + creature.SetPowerType(PowerType.Mana); creature.SetMaxPower(PowerType.Mana, 200); //set a "fake" mana value, we can't depend on database doing it in this case creature.SetPower(PowerType.Mana, 200); diff --git a/Source/Scripts/Spells/Generic.cs b/Source/Scripts/Spells/Generic.cs index 139fac13f..8e0bb08ba 100644 --- a/Source/Scripts/Spells/Generic.cs +++ b/Source/Scripts/Spells/Generic.cs @@ -2047,7 +2047,7 @@ namespace Scripts.Spells.Generic newPet.setDeathState(DeathState.Alive); newPet.SetFullHealth(); - newPet.SetPower(newPet.getPowerType(), newPet.GetMaxPower(newPet.getPowerType())); + newPet.SetFullPower(newPet.GetPowerType()); switch (newPet.GetEntry()) { @@ -2171,7 +2171,7 @@ namespace Scripts.Spells.Generic { var target = obj.ToUnit(); if (target) - return target.getPowerType() != PowerType.Mana; + return target.GetPowerType() != PowerType.Mana; return true; }); @@ -3312,7 +3312,7 @@ namespace Scripts.Spells.Generic { Unit unit = target.ToUnit(); if (unit) - return unit.getPowerType() != PowerType.Mana; + return unit.GetPowerType() != PowerType.Mana; return false; }); } diff --git a/Source/Scripts/Spells/Items.cs b/Source/Scripts/Spells/Items.cs index a2e1c8ed0..2203dab2f 100644 --- a/Source/Scripts/Spells/Items.cs +++ b/Source/Scripts/Spells/Items.cs @@ -1180,7 +1180,7 @@ namespace Scripts.Spells.Items Unit caster = eventInfo.GetActor(); uint spellId; - switch (caster.getPowerType()) + switch (caster.GetPowerType()) { case PowerType.Mana: spellId = _manaSpellId; diff --git a/Source/Scripts/Spells/Priest.cs b/Source/Scripts/Spells/Priest.cs index 7014ffd13..0f43dff2f 100644 --- a/Source/Scripts/Spells/Priest.cs +++ b/Source/Scripts/Spells/Priest.cs @@ -496,7 +496,7 @@ namespace Scripts.Spells.Priest { Unit target = obj.ToUnit(); if (target) - return target.getPowerType() != PowerType.Mana; + return target.GetPowerType() != PowerType.Mana; return true; })); diff --git a/Source/Scripts/World/DuelReset.cs b/Source/Scripts/World/DuelReset.cs index 97d8f2822..654f6aaaa 100644 --- a/Source/Scripts/World/DuelReset.cs +++ b/Source/Scripts/World/DuelReset.cs @@ -49,24 +49,12 @@ namespace Scripts.World if (_resetHealthMana) { 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() == PowerType.Mana || player1.GetClass() == Class.Druid) - { - player1.SaveManaBeforeDuel(); - player1.SetPower(PowerType.Mana, player1.GetMaxPower(PowerType.Mana)); - } - - // check if player2 class uses mana - if (player2.getPowerType() == PowerType.Mana || player2.GetClass() == Class.Druid) - { - player2.SaveManaBeforeDuel(); - player2.SetPower(PowerType.Mana, player2.GetMaxPower(PowerType.Mana)); - } + player2.SaveManaBeforeDuel(); + player2.ResetAllPowers(); } } @@ -92,11 +80,11 @@ namespace Scripts.World loser.RestoreHealthAfterDuel(); // check if player1 class uses mana - if (winner.getPowerType() == PowerType.Mana || winner.GetClass() == Class.Druid) + if (winner.GetPowerType() == PowerType.Mana || winner.GetClass() == Class.Druid) winner.RestoreManaAfterDuel(); // check if player2 class uses mana - if (loser.getPowerType() == PowerType.Mana || loser.GetClass() == Class.Druid) + if (loser.GetPowerType() == PowerType.Mana || loser.GetClass() == Class.Druid) loser.RestoreManaAfterDuel(); } }