From 35b07faf2b93bd7d22129724ee881eb4564e96ad Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Sat, 26 Sep 2020 19:57:05 +0200 Subject: [PATCH] Scripts/Quests: scripted Launch Quest spells and use them to launch the 'A Personal Summon' quests when entering Stormwind or Orgrimmar --- .../world/4.3.4/2020_09_26_03_world.sql | 9 +++++ src/server/scripts/Spells/spell_generic.cpp | 37 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 sql/updates/world/4.3.4/2020_09_26_03_world.sql diff --git a/sql/updates/world/4.3.4/2020_09_26_03_world.sql b/sql/updates/world/4.3.4/2020_09_26_03_world.sql new file mode 100644 index 0000000000..4d92a99aac --- /dev/null +++ b/sql/updates/world/4.3.4/2020_09_26_03_world.sql @@ -0,0 +1,9 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`= 'spell_gen_launch_quest_aura'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(93081, 'spell_gen_launch_quest_aura'), +(93216, 'spell_gen_launch_quest_aura'); + +DELETE FROM `spell_area` WHERE `spell` IN (93081, 93216); +INSERT INTO `spell_area` (`spell`, `area`, `gender`, `flags`) VALUES +(93081, 1637, 2, 1), +(93216, 1519, 2, 1); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index dfa73cf24b..d3383ce744 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -5298,6 +5298,42 @@ class spell_gen_zero_energy_zero_regen : public AuraScript } }; +enum LaunchQuestAura +{ + SPELL_LAUNCH_QUEST_PERSONAL_SUMMONS_HORDE = 93079, + SPELL_LAUNCH_QUEST_PERSONAL_SUMMONS_ALLIANCE = 93217, +}; + +// 93081 - Launch Quest Aura +// 93216 - Launch Quest Aura +class spell_gen_launch_quest_aura : public AuraScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( + { + SPELL_LAUNCH_QUEST_PERSONAL_SUMMONS_HORDE, + SPELL_LAUNCH_QUEST_PERSONAL_SUMMONS_ALLIANCE + }); + } + + // According to sniffs the quests are being launched when the aura expires, not when it gets applied. + void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Player* player = GetTarget()->ToPlayer(); + if (!player) + return; + + uint32 spellId = player->GetTeamId() == TEAM_ALLIANCE ? SPELL_LAUNCH_QUEST_PERSONAL_SUMMONS_ALLIANCE : SPELL_LAUNCH_QUEST_PERSONAL_SUMMONS_HORDE; + GetTarget()->CastSpell(GetTarget(), spellId); + } + + void Register() override + { + AfterEffectRemove.Register(&spell_gen_launch_quest_aura::AfterRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -5348,6 +5384,7 @@ void AddSC_generic_spell_scripts() new spell_gen_increase_stats_buff("spell_mage_arcane_brilliance"); new spell_gen_increase_stats_buff("spell_mage_dalaran_brilliance"); new spell_gen_interrupt(); + RegisterSpellScript(spell_gen_launch_quest_aura); new spell_gen_lifebloom("spell_hexlord_lifebloom", SPELL_HEXLORD_MALACRASS_LIFEBLOOM_FINAL_HEAL); new spell_gen_lifebloom("spell_tur_ragepaw_lifebloom", SPELL_TUR_RAGEPAW_LIFEBLOOM_FINAL_HEAL); new spell_gen_lifebloom("spell_cenarion_scout_lifebloom", SPELL_CENARION_SCOUT_LIFEBLOOM_FINAL_HEAL);