Core/Spells: Removed useless calls of Spell.GetEffect and SpellInfo.GetEffect

This commit is contained in:
hondacrx
2018-08-26 01:20:46 -04:00
parent 388c20a4cf
commit f87224ac3d
3 changed files with 11 additions and 13 deletions
+7 -9
View File
@@ -5334,7 +5334,7 @@ namespace Game.Spells
Player caster = m_caster.ToPlayer(); Player caster = m_caster.ToPlayer();
Guild guild = caster.GetGuild(); Guild guild = caster.GetGuild();
if (guild != null) 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)] [SpellEffectHandler(SpellEffectName.ResurrectWithAura)]
@@ -5411,9 +5411,7 @@ namespace Game.Spells
return; return;
Player player = unitTarget.ToPlayer(); Player player = unitTarget.ToPlayer();
SpellEffectInfo effect = GetEffect(effIndex); Item item = player.GetItemByEntry(effectInfo.ItemType);
uint itemId = effect.ItemType;
Item item = player.GetItemByEntry(itemId);
if (item) if (item)
player.DestroyItem(item.GetBagSlot(), item.GetSlot(), true); player.DestroyItem(item.GetBagSlot(), item.GetSlot(), true);
} }
@@ -5429,7 +5427,7 @@ namespace Game.Spells
Garrison garrison = unitTarget.ToPlayer().GetGarrison(); Garrison garrison = unitTarget.ToPlayer().GetGarrison();
if (garrison != null) if (garrison != null)
garrison.LearnBlueprint((uint)GetEffect(effIndex).MiscValue); garrison.LearnBlueprint((uint)effectInfo.MiscValue);
} }
[SpellEffectHandler(SpellEffectName.CreateGarrison)] [SpellEffectHandler(SpellEffectName.CreateGarrison)]
@@ -5441,7 +5439,7 @@ namespace Game.Spells
if (!unitTarget || !unitTarget.IsTypeId(TypeId.Player)) if (!unitTarget || !unitTarget.IsTypeId(TypeId.Player))
return; return;
unitTarget.ToPlayer().CreateGarrison((uint)GetEffect(effIndex).MiscValue); unitTarget.ToPlayer().CreateGarrison((uint)effectInfo.MiscValue);
} }
[SpellEffectHandler(SpellEffectName.CreateConversation)] [SpellEffectHandler(SpellEffectName.CreateConversation)]
@@ -5467,7 +5465,7 @@ namespace Game.Spells
Garrison garrison = unitTarget.ToPlayer().GetGarrison(); Garrison garrison = unitTarget.ToPlayer().GetGarrison();
if (garrison != null) if (garrison != null)
garrison.AddFollower((uint)GetEffect(effIndex).MiscValue); garrison.AddFollower((uint)effectInfo.MiscValue);
} }
[SpellEffectHandler(SpellEffectName.CreateHeirloomItem)] [SpellEffectHandler(SpellEffectName.CreateHeirloomItem)]
@@ -5502,7 +5500,7 @@ namespace Game.Spells
Garrison garrison = unitTarget.ToPlayer().GetGarrison(); Garrison garrison = unitTarget.ToPlayer().GetGarrison();
if (garrison != null) if (garrison != null)
garrison.ActivateBuilding((uint)GetEffect(effIndex).MiscValue); garrison.ActivateBuilding((uint)effectInfo.MiscValue);
} }
[SpellEffectHandler(SpellEffectName.HealBattlepetPct)] [SpellEffectHandler(SpellEffectName.HealBattlepetPct)]
@@ -5516,7 +5514,7 @@ namespace Game.Spells
BattlePetMgr battlePetMgr = unitTarget.ToPlayer().GetSession().GetBattlePetMgr(); BattlePetMgr battlePetMgr = unitTarget.ToPlayer().GetSession().GetBattlePetMgr();
if (battlePetMgr != null) if (battlePetMgr != null)
battlePetMgr.HealBattlePetsPct((byte)GetEffect(effIndex).BasePoints); battlePetMgr.HealBattlePetsPct((byte)damage);
} }
[SpellEffectHandler(SpellEffectName.EnableBattlePets)] [SpellEffectHandler(SpellEffectName.EnableBattlePets)]
+3 -3
View File
@@ -1203,7 +1203,7 @@ namespace Scripts.Spells.Generic
void HandleDummy(uint effIndex) 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(); GetCaster().ToCreature().DespawnOrUnsummon();
} }
@@ -1922,8 +1922,8 @@ namespace Scripts.Spells.Generic
void HandleDummy(uint effIndex) void HandleDummy(uint effIndex)
{ {
Player player = GetCaster().ToPlayer(); Player player = GetCaster().ToPlayer();
uint factionId = (uint)GetSpellInfo().GetEffect(effIndex).CalcValue(); uint factionId = (uint)GetEffectInfo(effIndex).CalcValue();
int repChange = GetSpellInfo().GetEffect(1).CalcValue(); int repChange = GetEffectInfo(1).CalcValue();
FactionRecord factionEntry = CliDB.FactionStorage.LookupByKey(factionId); FactionRecord factionEntry = CliDB.FactionStorage.LookupByKey(factionId);
+1 -1
View File
@@ -626,7 +626,7 @@ namespace Scripts.Spells.Holiday
PreventHitDefaultEffect(effIndex); PreventHitDefaultEffect(effIndex);
// All this spells trigger a spell that requires reagents; if the // All this spells trigger a spell that requires reagents; if the
// triggered spell is cast as "triggered", reagents are not consumed // 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() public override void Register()