Scripts/Spells: Migrate Teleporting to Script (#23458)

* Scripts/Spells: Migrate Teleporting to Script

* Rename 9999_99_99_99_world.sql to 2019_06_21_02_world.sql
This commit is contained in:
Sorikoff
2019-06-21 17:25:51 +00:00
committed by Giacomo Pozzoni
parent a4cd4d8b87
commit e9d803ccee
3 changed files with 36 additions and 15 deletions

View File

@@ -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');

View File

@@ -3680,21 +3680,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
return;
}
case 59317: // Teleporting
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
// return from top
if (unitTarget->ToPlayer()->GetAreaId() == 4637)
unitTarget->CastSpell(unitTarget, 59316, true);
// teleport atop
else
unitTarget->CastSpell(unitTarget, 59314, true);
return;
}
case 62482: // Grab Crate
{
if (!unitCaster)

View File

@@ -3354,6 +3354,38 @@ class spell_gen_tournament_pennant : public AuraScript
}
};
enum Teleporting
{
AREA_VIOLET_CITADEL_SPIRE = 4637,
SPELL_TELEPORT_SPIRE_DOWN = 59316,
SPELL_TELEPORT_SPIRE_UP = 59314
};
class spell_gen_teleporting : public SpellScript
{
PrepareSpellScript(spell_gen_teleporting);
void HandleScript(SpellEffIndex /* effIndex */)
{
Unit* target = GetHitUnit();
if (target->GetTypeId() != TYPEID_PLAYER)
return;
// return from top
if (target->ToPlayer()->GetAreaId() == AREA_VIOLET_CITADEL_SPIRE)
target->CastSpell(target, SPELL_TELEPORT_SPIRE_DOWN, true);
// teleport atop
else
target->CastSpell(target, SPELL_TELEPORT_SPIRE_UP, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_gen_teleporting::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
enum PvPTrinketTriggeredSpells
{
SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER = 72752,
@@ -4441,6 +4473,7 @@ void AddSC_generic_spell_scripts()
RegisterSpellScript(spell_gen_throw_shield);
RegisterSpellScript(spell_gen_tournament_duel);
RegisterAuraScript(spell_gen_tournament_pennant);
RegisterSpellScript(spell_gen_teleporting);
new spell_pvp_trinket_wotf_shared_cd<SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER>("spell_pvp_trinket_shared_cd");
new spell_pvp_trinket_wotf_shared_cd<SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER_WOTF>("spell_wotf_shared_cd");
RegisterAuraScript(spell_gen_turkey_marker);