diff options
author | offl <11556157+offl@users.noreply.github.com> | 2022-02-01 16:01:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-01 16:01:34 +0200 |
commit | f205e25b337ceb10a9bec111a46406f4af9dc3e2 (patch) | |
tree | d960829c790aeb5283508f03343485555937888d /src | |
parent | 9f7cd3aa13636b9fe774a04063842611cab8b556 (diff) |
Scripts/Quest: Rework Mystery of the Infinite & Mystery of the Infinite, Redux (#27677)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Northrend/zone_dragonblight.cpp | 68 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 42 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_quest.cpp | 28 |
3 files changed, 100 insertions, 38 deletions
diff --git a/src/server/scripts/Northrend/zone_dragonblight.cpp b/src/server/scripts/Northrend/zone_dragonblight.cpp index a280d6757d0..f6805437942 100644 --- a/src/server/scripts/Northrend/zone_dragonblight.cpp +++ b/src/server/scripts/Northrend/zone_dragonblight.cpp @@ -15,17 +15,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Dragonblight -SD%Complete: 100 -SDComment: -SDCategory: Dragonblight -EndScriptData */ - -/* ContentData -npc_alexstrasza_wr_gate -EndContentData */ - #include "ScriptMgr.h" #include "CombatAI.h" #include "CreatureAIImpl.h" @@ -37,6 +26,7 @@ EndContentData */ #include "ScriptedGossip.h" #include "SpellInfo.h" #include "SpellScript.h" +#include "TemporarySummon.h" #include "Vehicle.h" /*##### @@ -733,6 +723,60 @@ class spell_warsong_battle_standard : public SpellScript } }; +/*###### +## Quest 12470 & 13343: Mystery of the Infinite & Mystery of the Infinite, Redux +######*/ + +enum MysteryOfTheInfinite +{ + SPELL_MIRROR_IMAGE_AURA = 49889 +}; + +// 49686 - Mystery of the Infinite: Script Effect Player Cast Mirror Image +class spell_moti_mirror_image_script_effect : public SpellScript +{ + PrepareSpellScript(spell_moti_mirror_image_script_effect); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_MIRROR_IMAGE_AURA }); + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + GetHitUnit()->CastSpell(GetHitUnit(), SPELL_MIRROR_IMAGE_AURA); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_moti_mirror_image_script_effect::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +// 50020 - Mystery of the Infinite: Hourglass cast See Invis on Master +class spell_moti_hourglass_cast_see_invis_on_master : public SpellScript +{ + PrepareSpellScript(spell_moti_hourglass_cast_see_invis_on_master); + + bool Validate(SpellInfo const* spellInfo) override + { + return ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_0).CalcValue()) }); + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Unit* caster = GetCaster()) + if (TempSummon* casterSummon = caster->ToTempSummon()) + if (Unit* summoner = casterSummon->GetSummonerUnit()) + summoner->CastSpell(summoner, uint32(GetEffectValue())); + } + + void Register() override + { + OnEffectHit += SpellEffectFn(spell_moti_hourglass_cast_see_invis_on_master::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + void AddSC_dragonblight() { new npc_commander_eligor_dawnbringer(); @@ -741,4 +785,6 @@ void AddSC_dragonblight() new npc_wyrmrest_defender(); new npc_torturer_lecraft(); RegisterSpellScript(spell_warsong_battle_standard); + RegisterSpellScript(spell_moti_mirror_image_script_effect); + RegisterSpellScript(spell_moti_hourglass_cast_see_invis_on_master); } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index c6ea183a896..20723bfdff3 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -3719,6 +3719,45 @@ class spell_gen_whisper_to_controller : public SpellScript } }; +enum WhisperToControllerTexts +{ + WHISPER_FUTURE_YOU = 2, + WHISPER_DEFENDER = 1, + WHISPER_PAST_YOU = 2 +}; + +// BasePoints of spells is ID of npc_text used to group texts, it's not implemented so texts are grouped the old way +// 50037 - Mystery of the Infinite: Future You's Whisper to Controller - Random +// 50287 - Azure Dragon: On Death Force Cast Wyrmrest Defender to Whisper to Controller - Random +// 60709 - MOTI, Redux: Past You's Whisper to Controller - Random +class spell_gen_whisper_to_controller_random : public SpellScript +{ + PrepareSpellScript(spell_gen_whisper_to_controller_random); + +public: + spell_gen_whisper_to_controller_random(uint32 text) : SpellScript(), _text(text) { } + +private: + void HandleScript(SpellEffIndex /*effIndex*/) + { + // Same for all spells + if (!roll_chance_i(20)) + return; + + if (Creature* target = GetHitCreature()) + if (TempSummon* targetSummon = target->ToTempSummon()) + if (Player* player = targetSummon->GetSummonerUnit()->ToPlayer()) + targetSummon->AI()->Talk(_text, player); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_gen_whisper_to_controller_random::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + + uint32 _text; +}; + class spell_gen_eject_all_passengers : public SpellScript { PrepareSpellScript(spell_gen_eject_all_passengers); @@ -4613,6 +4652,9 @@ void AddSC_generic_spell_scripts() RegisterSpellScript(spell_gen_wg_water); RegisterSpellScript(spell_gen_whisper_gulch_yogg_saron_whisper); RegisterSpellScript(spell_gen_whisper_to_controller); + RegisterSpellScriptWithArgs(spell_gen_whisper_to_controller_random, "spell_future_you_whisper_to_controller_random", WHISPER_FUTURE_YOU); + RegisterSpellScriptWithArgs(spell_gen_whisper_to_controller_random, "spell_wyrmrest_defender_whisper_to_controller_random", WHISPER_DEFENDER); + RegisterSpellScriptWithArgs(spell_gen_whisper_to_controller_random, "spell_past_you_whisper_to_controller_random", WHISPER_PAST_YOU); RegisterSpellScript(spell_gen_eject_all_passengers); RegisterSpellScript(spell_gen_eject_passenger); RegisterSpellScriptWithArgs(spell_gen_eject_passenger_with_seatId, "spell_gen_eject_passenger_1", 0); diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 39e74ad3767..a39e997c541 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -1066,9 +1066,7 @@ class spell_q12372_cast_from_gossip_trigger : public SpellScript enum Quest12372Data { // NPCs - NPC_WYRMREST_TEMPLE_CREDIT = 27698, - // Spells - WHISPER_ON_HIT_BY_FORCE_WHISPER = 1 + NPC_WYRMREST_TEMPLE_CREDIT = 27698 }; // 49370 - Wyrmrest Defender: Destabilize Azure Dragonshrine Effect @@ -1092,29 +1090,6 @@ class spell_q12372_destabilize_azure_dragonshrine_dummy : public SpellScript } }; -enum q12372Creatures -{ - NPC_WYRMREST_DEFENDER = 27629 -}; - -// 50287 - Azure Dragon: On Death Force Cast Wyrmrest Defender to Whisper to Controller - Random (cast from Azure Dragons and Azure Drakes on death) -class spell_q12372_azure_on_death_force_whisper : public SpellScript -{ - PrepareSpellScript(spell_q12372_azure_on_death_force_whisper); - - void HandleScript(SpellEffIndex /*effIndex*/) - { - Creature* defender = GetHitCreature(); - if (defender && defender->GetEntry() == NPC_WYRMREST_DEFENDER) - defender->AI()->Talk(WHISPER_ON_HIT_BY_FORCE_WHISPER, defender->GetCharmerOrOwner()); - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_q12372_azure_on_death_force_whisper::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } -}; - // "Bombing Run" and "Bomb Them Again!" enum Quest11010_11102_11023Data { @@ -2381,7 +2356,6 @@ void AddSC_quest_spell_scripts() RegisterSpellScript(spell_q11010_q11102_q11023_choose_loc); RegisterSpellScript(spell_q11010_q11102_q11023_q11008_check_fly_mount); RegisterSpellScript(spell_q11140salvage_wreckage); - RegisterSpellScript(spell_q12372_azure_on_death_force_whisper); RegisterSpellScript(spell_q12527_zuldrak_rat); RegisterSpellScript(spell_q12661_q12669_q12676_q12677_q12713_summon_stefan); RegisterSpellScript(spell_q12730_quenching_mist); |