From f87224ac3d26093ec52444dda0324a5cb12ac21b Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sun, 26 Aug 2018 01:20:46 -0400 Subject: [PATCH] Core/Spells: Removed useless calls of Spell.GetEffect and SpellInfo.GetEffect --- Source/Game/Spells/SpellEffects.cs | 16 +++++++--------- Source/Scripts/Spells/Generic.cs | 6 +++--- Source/Scripts/Spells/Holiday.cs | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index 869bc2a0b..419394ad5 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -5334,7 +5334,7 @@ namespace Game.Spells Player caster = m_caster.ToPlayer(); Guild guild = caster.GetGuild(); if (guild != null) - guild.HandleBuyBankTab(caster.GetSession(), (byte)(effectInfo.BasePoints - 1)); // Bank tabs start at zero internally + guild.HandleBuyBankTab(caster.GetSession(), (byte)(damage - 1)); // Bank tabs start at zero internally } [SpellEffectHandler(SpellEffectName.ResurrectWithAura)] @@ -5411,9 +5411,7 @@ namespace Game.Spells return; Player player = unitTarget.ToPlayer(); - SpellEffectInfo effect = GetEffect(effIndex); - uint itemId = effect.ItemType; - Item item = player.GetItemByEntry(itemId); + Item item = player.GetItemByEntry(effectInfo.ItemType); if (item) player.DestroyItem(item.GetBagSlot(), item.GetSlot(), true); } @@ -5429,7 +5427,7 @@ namespace Game.Spells Garrison garrison = unitTarget.ToPlayer().GetGarrison(); if (garrison != null) - garrison.LearnBlueprint((uint)GetEffect(effIndex).MiscValue); + garrison.LearnBlueprint((uint)effectInfo.MiscValue); } [SpellEffectHandler(SpellEffectName.CreateGarrison)] @@ -5441,7 +5439,7 @@ namespace Game.Spells if (!unitTarget || !unitTarget.IsTypeId(TypeId.Player)) return; - unitTarget.ToPlayer().CreateGarrison((uint)GetEffect(effIndex).MiscValue); + unitTarget.ToPlayer().CreateGarrison((uint)effectInfo.MiscValue); } [SpellEffectHandler(SpellEffectName.CreateConversation)] @@ -5467,7 +5465,7 @@ namespace Game.Spells Garrison garrison = unitTarget.ToPlayer().GetGarrison(); if (garrison != null) - garrison.AddFollower((uint)GetEffect(effIndex).MiscValue); + garrison.AddFollower((uint)effectInfo.MiscValue); } [SpellEffectHandler(SpellEffectName.CreateHeirloomItem)] @@ -5502,7 +5500,7 @@ namespace Game.Spells Garrison garrison = unitTarget.ToPlayer().GetGarrison(); if (garrison != null) - garrison.ActivateBuilding((uint)GetEffect(effIndex).MiscValue); + garrison.ActivateBuilding((uint)effectInfo.MiscValue); } [SpellEffectHandler(SpellEffectName.HealBattlepetPct)] @@ -5516,7 +5514,7 @@ namespace Game.Spells BattlePetMgr battlePetMgr = unitTarget.ToPlayer().GetSession().GetBattlePetMgr(); if (battlePetMgr != null) - battlePetMgr.HealBattlePetsPct((byte)GetEffect(effIndex).BasePoints); + battlePetMgr.HealBattlePetsPct((byte)damage); } [SpellEffectHandler(SpellEffectName.EnableBattlePets)] diff --git a/Source/Scripts/Spells/Generic.cs b/Source/Scripts/Spells/Generic.cs index ba6a62af5..b1e420564 100644 --- a/Source/Scripts/Spells/Generic.cs +++ b/Source/Scripts/Spells/Generic.cs @@ -1203,7 +1203,7 @@ namespace Scripts.Spells.Generic void HandleDummy(uint effIndex) { - if (GetSpellInfo().GetEffect(effIndex).Effect == SpellEffectName.Dummy || GetSpellInfo().GetEffect(effIndex).Effect == SpellEffectName.ScriptEffect) + if (GetEffectInfo().IsEffect(SpellEffectName.Dummy) || GetEffectInfo().IsEffect(SpellEffectName.ScriptEffect)) GetCaster().ToCreature().DespawnOrUnsummon(); } @@ -1922,8 +1922,8 @@ namespace Scripts.Spells.Generic void HandleDummy(uint effIndex) { Player player = GetCaster().ToPlayer(); - uint factionId = (uint)GetSpellInfo().GetEffect(effIndex).CalcValue(); - int repChange = GetSpellInfo().GetEffect(1).CalcValue(); + uint factionId = (uint)GetEffectInfo(effIndex).CalcValue(); + int repChange = GetEffectInfo(1).CalcValue(); FactionRecord factionEntry = CliDB.FactionStorage.LookupByKey(factionId); diff --git a/Source/Scripts/Spells/Holiday.cs b/Source/Scripts/Spells/Holiday.cs index dfddced02..b97838868 100644 --- a/Source/Scripts/Spells/Holiday.cs +++ b/Source/Scripts/Spells/Holiday.cs @@ -626,7 +626,7 @@ namespace Scripts.Spells.Holiday PreventHitDefaultEffect(effIndex); // All this spells trigger a spell that requires reagents; if the // triggered spell is cast as "triggered", reagents are not consumed - GetHitUnit().CastSpell(null, GetSpellInfo().GetEffect(effIndex).TriggerSpell, TriggerCastFlags.FullMask & ~TriggerCastFlags.IgnorePowerAndReagentCost); + GetHitUnit().CastSpell(null, GetEffectInfo().TriggerSpell, TriggerCastFlags.FullMask & ~TriggerCastFlags.IgnorePowerAndReagentCost); } public override void Register()