From 74c88b43b39f23b55a07c73121d7d3ca202b3e47 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 22 Dec 2021 20:39:59 -0500 Subject: [PATCH] Scripts/Spells: Migrate Teleporting to Script Port From (https://github.com/TrinityCore/TrinityCore/commit/8fc52bc5e542ab5a572343c64e915d01cf363b76) --- Source/Game/Spells/SpellEffects.cs | 48 ------------------- Source/Scripts/Spells/Generic.cs | 34 ++++++++++++- ...021_12_11_34_world_2019_06_21_02_world.sql | 3 ++ 3 files changed, 35 insertions(+), 50 deletions(-) create mode 100644 sql/updates/world/master/2021_12_11_34_world_2019_06_21_02_world.sql diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index 672a08da5..d0d9e4393 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -2962,21 +2962,6 @@ namespace Game.Spells } } return; - case 59317: // Teleporting - { - - if (unitTarget == null || !unitTarget.IsTypeId(TypeId.Player)) - return; - - // return from top - if (unitTarget.ToPlayer().GetAreaId() == 4637) - unitTarget.CastSpell(unitTarget, 59316, new CastSpellExtraArgs(TriggerCastFlags.FullMask).SetOriginalCastId(m_castId)); - // teleport atop - else - unitTarget.CastSpell(unitTarget, 59314, new CastSpellExtraArgs(TriggerCastFlags.FullMask).SetOriginalCastId(m_castId)); - - return; - } case 62482: // Grab Crate { if (unitCaster == null) @@ -2998,39 +2983,6 @@ namespace Game.Spells } return; } - case 60123: // Lightwell - { - if (!m_caster.IsTypeId(TypeId.Unit) || !m_caster.ToCreature().IsSummon()) - return; - - uint spell_heal; - - switch (m_caster.GetEntry()) - { - case 31897: spell_heal = 7001; break; - case 31896: spell_heal = 27873; break; - case 31895: spell_heal = 27874; break; - case 31894: spell_heal = 28276; break; - case 31893: spell_heal = 48084; break; - case 31883: spell_heal = 48085; break; - default: - Log.outError(LogFilter.Spells, "Unknown Lightwell spell caster {0}", m_caster.GetEntry()); - return; - } - - // proc a spellcast - Aura chargesAura = m_caster.ToCreature().GetAura(59907); - if (chargesAura != null) - { - m_caster.CastSpell(unitTarget, spell_heal, new CastSpellExtraArgs(TriggerCastFlags.FullMask) - .SetOriginalCaster(m_caster.ToCreature().ToTempSummon().GetSummonerGUID()) - .SetOriginalCastId(m_castId)); - if (chargesAura.ModCharges(-1)) - m_caster.ToCreature().ToTempSummon().UnSummon(); - } - - return; - } case 45668: // Ultra-Advanced Proto-Typical Shortening Blaster { if (unitTarget == null || !unitTarget.IsTypeId(TypeId.Unit)) diff --git a/Source/Scripts/Spells/Generic.cs b/Source/Scripts/Spells/Generic.cs index 4f98727d2..cb75a0cea 100644 --- a/Source/Scripts/Spells/Generic.cs +++ b/Source/Scripts/Spells/Generic.cs @@ -251,6 +251,10 @@ namespace Scripts.Spells.Generic public const uint OnTournamentMount = 63034; public const uint MountedDuel = 62875; + // Teleporting + public const uint TeleportSpireDown = 59316; + public const uint TeleportSpireUp = 59314; + // Pvptrinkettriggeredspells public const uint WillOfTheForsakenCooldownTrigger = 72752; public const uint WillOfTheForsakenCooldownTriggerWotf = 72757; @@ -417,11 +421,14 @@ namespace Scripts.Spells.Generic struct Misc { - //FungalDecay + // FungalDecay public const int AuraDuration = 12600; // found in sniffs, there is no duration entry we can possibly use - //FreezingCircleMisc + // FreezingCircleMisc public const uint MapIdBloodInTheSnowScenario = 1130; + + // Teleporting + public const uint AreaVioletCitadelSpire = 4637; } [Script] @@ -2987,6 +2994,29 @@ namespace Scripts.Spells.Generic } } + [Script] + class spell_gen_teleporting : SpellScript + { + void HandleScript(uint effIndex) + { + Unit target = GetHitUnit(); + if (!target.IsPlayer()) + return; + + // return from top + if (target.ToPlayer().GetAreaId() == Misc.AreaVioletCitadelSpire) + target.CastSpell(target, SpellIds.TeleportSpireDown, true); + // teleport atop + else + target.CastSpell(target, SpellIds.TeleportSpireUp, true); + } + + public override void Register() + { + OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); + } + } + [Script] class spell_gen_trigger_exclude_caster_aura_spell : SpellScript { diff --git a/sql/updates/world/master/2021_12_11_34_world_2019_06_21_02_world.sql b/sql/updates/world/master/2021_12_11_34_world_2019_06_21_02_world.sql new file mode 100644 index 000000000..bc4749e43 --- /dev/null +++ b/sql/updates/world/master/2021_12_11_34_world_2019_06_21_02_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_gen_teleporting'); +INSERT INTO `spell_script_names` VALUES +(59317,'spell_gen_teleporting');