Scripts/Quest: Rework Mystery of the Infinite & Mystery of the Infinite, Redux (#27677)

(cherry picked from commit f205e25b33)
This commit is contained in:
offl
2022-02-01 16:01:34 +02:00
committed by Shauren
parent c60c5455d2
commit a2236616cc
4 changed files with 333 additions and 37 deletions

View File

@@ -3678,6 +3678,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);
@@ -4911,6 +4950,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);