diff options
author | Carbenium <carbenium@outlook.com> | 2020-07-27 23:05:41 +0200 |
---|---|---|
committer | Peter Keresztes Schmidt <carbenium@outlook.com> | 2021-06-24 22:50:57 +0200 |
commit | c08f086a02729f3b7e4c99f4741063e45301ebf8 (patch) | |
tree | ee20037f18cca9c4ea60db4d6d8dd9eaa9aa2953 /src | |
parent | baaa0b55228a5db69760aa8319bd09ceaaf68fce (diff) |
Scripts/SholazarBasin: Make quest "Engineering a Disaster" more retail-like
* Use correct spells and add the appropriate spell scripts
* Use correct flame GOs
* Fix emotes of the escortee
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Northrend/zone_sholazar_basin.cpp | 188 |
1 files changed, 106 insertions, 82 deletions
diff --git a/src/server/scripts/Northrend/zone_sholazar_basin.cpp b/src/server/scripts/Northrend/zone_sholazar_basin.cpp index 33cc26762c5..723dd0d75de 100644 --- a/src/server/scripts/Northrend/zone_sholazar_basin.cpp +++ b/src/server/scripts/Northrend/zone_sholazar_basin.cpp @@ -26,6 +26,7 @@ #include "SpellAuras.h" #include "SpellScript.h" #include "Vehicle.h" +#include "GameObject.h" /*###### ## npc_engineer_helice @@ -34,8 +35,9 @@ enum EngineerHelice { // Spells - SPELL_EXPLODE_CRYSTAL = 62487, - SPELL_FLAMES = 64561, + SPELL_DETONATE_1 = 52369, + SPELL_DETONATE_2 = 52371, + SPELL_EXPLOSION = 46419, // Yells SAY_WP_1 = 0, @@ -50,109 +52,129 @@ enum EngineerHelice QUEST_DISASTER = 12688 }; -class npc_engineer_helice : public CreatureScript +struct npc_engineer_helice : public EscortAI { -public: - npc_engineer_helice() : CreatureScript("npc_engineer_helice") { } + npc_engineer_helice(Creature* creature) : EscortAI(creature) { } - struct npc_engineer_heliceAI : public EscortAI + void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override { - npc_engineer_heliceAI(Creature* creature) : EscortAI(creature) + switch (waypointId) { - Initialize(); + case 0: + Talk(SAY_WP_2); + break; + case 1: + Talk(SAY_WP_3); + DoCast(SPELL_DETONATE_1); + break; + case 7: + Talk(SAY_WP_5); + break; + case 8: + DoCast(SPELL_DETONATE_2); + break; + case 9: + Talk(SAY_WP_6); + break; + case 13: + if (Player* player = GetPlayerForEscort()) + { + player->GroupEventHappens(QUEST_DISASTER, me); + Talk(SAY_WP_7); + } + break; + default: + break; } + } - void Initialize() + void JustDied(Unit* /*killer*/) override + { + if (HasEscortState(STATE_ESCORT_ESCORTING)) { - m_uiChatTimer = 4000; + if (Player* player = GetPlayerForEscort()) + player->FailQuest(QUEST_DISASTER); } + } - uint32 m_uiChatTimer; - - void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override + void OnQuestAccept(Player* player, Quest const* quest) override + { + if (quest->GetQuestId() == QUEST_DISASTER) { - Player* player = GetPlayerForEscort(); + me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE); - switch (waypointId) - { - case 0: - Talk(SAY_WP_2); - break; - case 1: - Talk(SAY_WP_3); - me->CastSpell({ 5918.33f, 5372.91f, -98.770f }, SPELL_EXPLODE_CRYSTAL, true); - me->SummonGameObject(184743, 5918.33f, 5372.91f, -98.770f, 0, QuaternionData(), 3s, GO_SUMMON_TIMED_DESPAWN); - me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); - break; - case 2: - Talk(SAY_WP_4); - break; - case 7: - Talk(SAY_WP_5); - break; - case 8: - me->CastSpell({ 5887.37f, 5379.39f, -91.289f }, SPELL_EXPLODE_CRYSTAL, true); - me->SummonGameObject(184743, 5887.37f, 5379.39f, -91.289f, 0, QuaternionData(), 3s, GO_SUMMON_TIMED_DESPAWN); - me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); - break; - case 9: - Talk(SAY_WP_6); - break; - case 13: - if (player) - { - player->GroupEventHappens(QUEST_DISASTER, me); - Talk(SAY_WP_7); - } - break; - } + Start(false, false, player->GetGUID()); + Talk(SAY_WP_1); } + } +}; - void Reset() override - { - Initialize(); - } +class spell_q12688_detonate_1 : public SpellScript +{ + PrepareSpellScript(spell_q12688_detonate_1); - void JustDied(Unit* /*killer*/) override - { - if (HasEscortState(STATE_ESCORT_ESCORTING)) - { - if (Player* player = GetPlayerForEscort()) - player->FailQuest(QUEST_DISASTER); - } - } + static constexpr uint32 SPAWN_GROUP_FLAMES = 67; - void UpdateAI(uint32 uiDiff) override + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_EXPLOSION }); + } + + void HandleDummyEffect(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) { - EscortAI::UpdateAI(uiDiff); + target->CastSpell(target, SPELL_EXPLOSION); - if (HasEscortState(STATE_ESCORT_ESCORTING)) - { - if (m_uiChatTimer <= uiDiff) - { - m_uiChatTimer = 12000; - } - else - m_uiChatTimer -= uiDiff; - } + std::vector<WorldObject*> flames; + target->GetMap()->SpawnGroupSpawn(SPAWN_GROUP_FLAMES, false, false, &flames); + target->GetMap()->SetSpawnGroupInactive(SPAWN_GROUP_FLAMES); + for (WorldObject* flame : flames) + dynamic_cast<GameObject*>(flame)->DespawnOrUnsummon(20s); } + } + + void HandleAfterHit() + { + if (Creature* caster = GetCaster()->ToCreature()) + caster->AI()->Talk(EngineerHelice::SAY_WP_4); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_q12688_detonate_1::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY); + AfterHit += SpellHitFn(spell_q12688_detonate_1::HandleAfterHit); + } +}; + +class spell_q12688_detonate_2 : public SpellScript +{ + PrepareSpellScript(spell_q12688_detonate_2); + + static constexpr uint32 SPAWN_GROUP_FLAMES = 68; + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_EXPLOSION }); + } - void OnQuestAccept(Player* player, Quest const* quest) override + void HandleDummyEffect(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) { - if (quest->GetQuestId() == QUEST_DISASTER) - { - me->GetMotionMaster()->MoveJumpTo(0, 0.4f, 0.4f); - me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE); + target->CastSpell(target, SPELL_EXPLOSION); - Start(false, false, player->GetGUID()); - Talk(SAY_WP_1); - } + std::vector<WorldObject*> flames; + target->GetMap()->SpawnGroupSpawn(SPAWN_GROUP_FLAMES, false, false, &flames); + target->GetMap()->SetSpawnGroupInactive(SPAWN_GROUP_FLAMES); + for (WorldObject* flame : flames) + dynamic_cast<GameObject*>(flame)->DespawnOrUnsummon(20s); } - }; + } - CreatureAI* GetAI(Creature* creature) const override + void Register() override { - return new npc_engineer_heliceAI(creature); + OnEffectHitTarget += SpellEffectFn(spell_q12688_detonate_2::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -693,7 +715,9 @@ class spell_q12611_deathbolt : public SpellScript void AddSC_sholazar_basin() { - new npc_engineer_helice(); + RegisterCreatureAI(npc_engineer_helice); + RegisterSpellScript(spell_q12688_detonate_1); + RegisterSpellScript(spell_q12688_detonate_2); new npc_jungle_punch_target(); new spell_q12620_the_lifewarden_wrath(); new spell_q12589_shoot_rjr(); |