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

@@ -15,16 +15,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* ScriptData
SDName: Dragonblight
SD%Complete: 100
SDComment:
SDCategory: Dragonblight
EndScriptData */
/* ContentData
EndContentData */
#include "ScriptMgr.h"
#include "CombatAI.h"
#include "CreatureAIImpl.h"
@@ -36,6 +26,7 @@ EndContentData */
#include "ScriptedGossip.h"
#include "SpellInfo.h"
#include "SpellScript.h"
#include "TemporarySummon.h"
#include "Vehicle.h"
/*#####
@@ -732,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();
@@ -740,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);
}

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

View File

@@ -1071,9 +1071,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
@@ -1097,29 +1095,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
{
@@ -2493,7 +2468,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);