From db4a6bab3471d7f7721168541bcaec45d08a7e01 Mon Sep 17 00:00:00 2001 From: Grimgravy Date: Mon, 8 Jan 2024 15:46:05 -0300 Subject: [PATCH] fix(Scripts/Quest): improve Securing the Celestial Ridge (#17847) * fix(Scripts/Quest): improve Securing the Celestial Ridge * update --- .../rev_1700913491921182500.sql | 9 ++++++ .../scripts/Outland/zone_netherstorm.cpp | 32 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1700913491921182500.sql diff --git a/data/sql/updates/pending_db_world/rev_1700913491921182500.sql b/data/sql/updates/pending_db_world/rev_1700913491921182500.sql new file mode 100644 index 000000000..72d7db1a2 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1700913491921182500.sql @@ -0,0 +1,9 @@ +-- +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 18544); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(18544, 0, 0, 0, 1, 0, 100, 257, 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 3832.74, 1448.12, -138.4, 0, 'Veraku - Out of Combat - Move To Position'), +(18544, 0, 1, 0, 54, 0, 100, 0, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 21, 100, 0, 0, 0, 0, 0, 0, 0, 'Veraku - On Just Summoned - Start Attacking'); + +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_challenge_veraku'; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(34895, 'spell_challenge_veraku'); diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp index bdaa848d8..e61baf0ff 100644 --- a/src/server/scripts/Outland/zone_netherstorm.cpp +++ b/src/server/scripts/Outland/zone_netherstorm.cpp @@ -950,6 +950,37 @@ class spell_q10190_battery_recharging_blaster_aura : public AuraScript } }; +enum Veraku +{ + NPC_VERAKU = 18544, + SPELL_CHALLENGE_VERAKU = 34895 +}; + +class spell_challenge_veraku : public SpellScript +{ +public: + PrepareSpellScript(spell_challenge_veraku); + + bool Validate(SpellInfo const* /*SpellInfo*/) override + { + return ValidateSpellInfo({ SPELL_CHALLENGE_VERAKU }); + } + + SpellCastResult CheckRequirement() + { + if (Unit* caster = GetCaster()) + if (Creature* veraku = caster->FindNearestCreature(NPC_VERAKU, 100.0f)) + if (!veraku->HasAura(SPELL_CHALLENGE_VERAKU)) + return SPELL_FAILED_CASTER_AURASTATE; + return SPELL_CAST_OK; + } + + void Register() override + { + OnCheckCast += SpellCheckCastFn(spell_challenge_veraku::CheckRequirement); + } +}; + void AddSC_netherstorm() { // Ours @@ -962,5 +993,6 @@ void AddSC_netherstorm() new npc_bessy(); new npc_maxx_a_million_escort(); RegisterSpellAndAuraScriptPair(spell_q10190_battery_recharging_blaster, spell_q10190_battery_recharging_blaster_aura); + RegisterSpellScript(spell_challenge_veraku); }