Scripts/Spells: Migrate Teleporting to Script

Port From (https://github.com/TrinityCore/TrinityCore/commit/8fc52bc5e542ab5a572343c64e915d01cf363b76)
This commit is contained in:
hondacrx
2021-12-22 20:39:59 -05:00
parent f21472958d
commit 74c88b43b3
3 changed files with 35 additions and 50 deletions
-48
View File
@@ -2962,21 +2962,6 @@ namespace Game.Spells
} }
} }
return; 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 case 62482: // Grab Crate
{ {
if (unitCaster == null) if (unitCaster == null)
@@ -2998,39 +2983,6 @@ namespace Game.Spells
} }
return; 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 case 45668: // Ultra-Advanced Proto-Typical Shortening Blaster
{ {
if (unitTarget == null || !unitTarget.IsTypeId(TypeId.Unit)) if (unitTarget == null || !unitTarget.IsTypeId(TypeId.Unit))
+32 -2
View File
@@ -251,6 +251,10 @@ namespace Scripts.Spells.Generic
public const uint OnTournamentMount = 63034; public const uint OnTournamentMount = 63034;
public const uint MountedDuel = 62875; public const uint MountedDuel = 62875;
// Teleporting
public const uint TeleportSpireDown = 59316;
public const uint TeleportSpireUp = 59314;
// Pvptrinkettriggeredspells // Pvptrinkettriggeredspells
public const uint WillOfTheForsakenCooldownTrigger = 72752; public const uint WillOfTheForsakenCooldownTrigger = 72752;
public const uint WillOfTheForsakenCooldownTriggerWotf = 72757; public const uint WillOfTheForsakenCooldownTriggerWotf = 72757;
@@ -417,11 +421,14 @@ namespace Scripts.Spells.Generic
struct Misc struct Misc
{ {
//FungalDecay // FungalDecay
public const int AuraDuration = 12600; // found in sniffs, there is no duration entry we can possibly use public const int AuraDuration = 12600; // found in sniffs, there is no duration entry we can possibly use
//FreezingCircleMisc // FreezingCircleMisc
public const uint MapIdBloodInTheSnowScenario = 1130; public const uint MapIdBloodInTheSnowScenario = 1130;
// Teleporting
public const uint AreaVioletCitadelSpire = 4637;
} }
[Script] [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] [Script]
class spell_gen_trigger_exclude_caster_aura_spell : SpellScript class spell_gen_trigger_exclude_caster_aura_spell : SpellScript
{ {
@@ -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');