From fc9035caf784ab538e9aa03c02147e1508f26162 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Mon, 3 Sep 2018 08:09:20 +0200 Subject: [PATCH] Scripts/MountHyjal: * fixed quest "Heroe's Call: Mount Hyjal" * fixed quest "Warchief's Command: Mount Hyjal" * fixed quest "As Hyjal Burns" * fixed quest "Inciting the Elements" * fixed quest "Flames from Above" * improved SAI for Hyjal Warden and Furious Hyjal Warden * added sparring data for Hyjal Warden vs. Scalding Rock Elemental and Furious Hyjal Warden vs. Scalding Rock Elemental * corrected damage modifiers for all common hostile npc's under Nordrassil to a more blizzlike value --- .../custom/custom_2018_09_02_00_world.sql | 164 ++++++ src/server/game/Spells/SpellMgr.cpp | 6 + .../Kalimdor/kalimdor_script_loader.cpp | 2 + .../scripts/Kalimdor/zone_mount_hyjal.cpp | 519 ++++++++++++++++++ 4 files changed, 691 insertions(+) create mode 100644 sql/updates/world/custom/custom_2018_09_02_00_world.sql create mode 100644 src/server/scripts/Kalimdor/zone_mount_hyjal.cpp diff --git a/sql/updates/world/custom/custom_2018_09_02_00_world.sql b/sql/updates/world/custom/custom_2018_09_02_00_world.sql new file mode 100644 index 00000000000..fa67d45105c --- /dev/null +++ b/sql/updates/world/custom/custom_2018_09_02_00_world.sql @@ -0,0 +1,164 @@ +-- Scalding Rock Elemental +UPDATE `creature_template` SET `DamageModifier`= 2.3 WHERE `entry`= 40229; +-- Hyjal Warden +UPDATE `creature_template` SET `DamageModifier`= 2.3 WHERE `entry`= 38915; +-- Furious Hyjal Warden +UPDATE `creature_template` SET `DamageModifier`= 2.3 WHERE `entry`= 43427; +-- Faerie Dragon +UPDATE `creature_template` SET `ScriptName`= 'npc_mh_faerie_dragon' WHERE `entry`= 39921; +-- Twilight Inciter +UPDATE `creature_template` SET `DamageModifier`= 1.5, `flags_extra`= 2048, `ScriptName`= 'npc_mh_twilight_inciter' WHERE `entry`= 39926; +-- Emerald Flameweaver +UPDATE `creature_template` SET `InhabitType`= 4, `ScriptName`= 'npc_mh_emerald_flameweaver' WHERE `entry`= 40856; +-- Twilight Infiltrator +UPDATE `creature_template` SET `DamageModifier`= 2.3, `mingold`= 2000, `maxgold`= 2500 WHERE `entry`= 40882; +-- Aronus +UPDATE `creature_template` SET `npcflag`= 16777216, `InhabitType`= 4 WHERE `entry`= 39140; +-- Aronus (summoned vehicle) +UPDATE `creature_template` SET `InhabitType`= 4, `VehicleId`= 726, `unit_flags`= 33032, `ScriptName`= 'npc_mh_aronus' WHERE `entry`= 39128; +-- Ragnaros +UPDATE `creature_template` SET `InhabitType`= 4, `flags_extra`= 2 WHERE `entry`= 38806; +-- Deathwing +UPDATE `creature_template` SET `InhabitType`= 4 WHERE `entry`= 39867; +-- Generic Bunny - PRK (Large AOI) +UPDATE `creature_template` SET `InhabitType`= 4, `flags_extra`= 128 WHERE `entry`= 44775; + +-- Sparring Data +DELETE FROM `creature_sparring_template` WHERE `AttackerEntry` IN (38915, 40229, 43427); +INSERT INTO `creature_sparring_template` (`AttackerEntry`, `VictimEntry`, `HealthLimitPct`) VALUES +-- Scalding Rock Elemental vs. Hyjal Warden +(38915, 40229, 90), +(40229, 38915, 90), +-- Scalding Rock Elemental vs. Furious Hyjal Warden +(43427, 40229, 90), +(40229, 43427, 90); + +-- Texts +DELETE FROM `creature_text` WHERE `CreatureID` IN (39921, 39926, 38806, 39128); +INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `comment`) VALUES +-- Nordrassil Quests +(39921, 0, 0, 'We find evil ones now! Follow!', 12, 0, 100, 0, 0, 0, 40300, 'Faerie Dragon to Player'), +(39921, 0, 1, 'They hide this way! Quick!', 12, 0, 100, 0, 0, 0, 40301, 'Faerie Dragon to Player'), +(39921, 0, 2, 'Meep! $R is good friend. Follow now! We find intruder!', 12, 0, 100, 0, 0, 0, 39943, 'Faerie Dragon to Player'), +(39921, 0, 3, 'We look for the evil ones now, yes?', 12, 0, 100, 0, 0, 0, 40302, 'Faerie Dragon to Player'), +(39921, 1, 0, 'You must fight now, $n!', 14, 0, 100, 0, 0, 0, 40304, 'Faerie Dragon to Player'), +(39921, 1, 1, 'Over here! You must stop them!', 14, 0, 100, 0, 0, 0, 40303, 'Faerie Dragon to Player'), +(39921, 1, 2, 'Over here, $n!', 14, 0, 100, 0, 0, 0, 40305, 'Faerie Dragon to Player'), +(39921, 1, 3, 'We finds evil one! Quick!', 14, 0, 100, 0, 0, 0, 39944, 'Faerie Dragon to Player'), +(39926, 0, 0, 'You will not give away my position, $c!', 12, 0, 100, 0, 0, 0, 39947, 'Twilight Inciter to Player'), +(39926, 0, 1, 'I\'ve been spotted? Time to die!', 12, 0, 100, 0, 0, 0, 39946, 'Twilight Inciter to Player'), +(39926, 0, 2, 'How did you find me? It matters little... you will die!', 12, 0, 100, 0, 0, 0, 39945, 'Twilight Inciter to Player'), +(39926, 0, 3, 'You might have found me, but you won\'t bring word back to the others!', 12, 0, 100, 0, 0, 0, 39948, 'Twilight Inciter to Player'), +-- As Hyjal Burns +(38806, 0, 0, 'BY FIRE BE PURGED!!!!', 14, 0, 100, 449, 0, 23335, 39839, 'Ragnaros to Player'), +(39128, 0, 0, 'No... it can\'t be. Our forward outpost has been obliterated!', 12, 0, 100, 0, 0, 20950, 39185, 'Aronus to Player'), +(39128, 1, 0, 'Is it too late? I feel Deathwing\'s presence nearby!', 12, 0, 100, 0, 0, 20951, 39186, 'Aronus to Player'), +(39128, 2, 0, 'The Firelord has risen! We must send word to the others. Let us hurry!', 12, 0, 100, 0, 0, 20952, 39189, 'Aronus to Player'); + +UPDATE `creature_text` SET `TextRange`= 1 WHERE `CreatureID`= 38806; + +-- Spellclick +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (39140, 39128); +INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `cast_flags`, `user_type`) VALUES +(39140, 73518, 1, 0), +(39128, 76649, 1, 0); + +-- Spells +DELETE FROM `spell_script_names` WHERE `ScriptName` IN +('spell_mh_summon_emerald_flameweaver', +'spell_mh_ragnaros'); + +DELETE FROM `spell_script_names` WHERE `spell_id`= 51254; + +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(76212, 'spell_mh_summon_emerald_flameweaver'), +(74436, 'spell_mh_ragnaros'), +(51254, 'spell_gen_eject_all_passengers'); + +-- Conditions +DELETE FROM `conditions` WHERE `SourceEntry` IN (76205, 73518) AND `SourceTypeOrReferenceId`= 13; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ScriptName`, `Comment`) VALUES +(13, 1, 76205, 0, 0, 31, 0, 5, 203065, 0, 0, 0, '', 'Emerald Flameweaver Drake Breath - Target Emerald Flames'), +(13, 1, 73518, 0, 0, 31, 0, 3, 39140, 0, 0, 0, '', 'Hyjal Intro Flight - Target Aronus'); + +DELETE FROM `conditions` WHERE `SourceEntry` IN (73518) AND `SourceTypeOrReferenceId`= 18; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ScriptName`, `Comment`) VALUES +(18, 39140, 73518, 0, 0, 28, 0, 25316, 0, 0, 0, 0, '', 'Required quest complete for spellclick'); + +-- Update Movements +UPDATE `creature` SET `spawndist`= 0, `MovementType`= 0 WHERE `id`= 39921; +UPDATE `creature` SET `spawndist`= 7, `MovementType`= 1 WHERE `id`= 40229; +UPDATE `creature` SET `spawndist`= 5, `MovementType`= 1 WHERE `id`= 49844; + +-- Gameobject focus (203087) +DELETE FROM `gameobject` WHERE `guid`= 19; +INSERT INTO `gameobject` (`guid`, `id`, `map`, `zoneId`, `areaId`, `spawnMask`, `phaseID`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`, `VerifiedBuild`) VALUES +(19, 203087, 1, 0, 0, 1, 169, 5758.737, -3297.48, 1604.599, 0, 0, 0, 0, 1, 6000, 100, 1, 0); + +-- Quest chains +DELETE FROM `quest_template_addon` WHERE `ID` IN (25584, 27874, 25612, 25611, 29437, 25830, 25520, 25514, 25519, 25807); +INSERT INTO `quest_template_addon` (`ID`, `PrevQuestID`, `NextQuestID`, `ExclusiveGroup`) VALUES +(25584, 25578, 0, 0), +(27874, 25612, 0, 0), +(25612, 25600, 0, 25612), +(25611, 25600, 0, 25612), +(29437, 29326, 0, 0), +(25830, 25520, 0, 0), +(25520, 25514, 0, -25520), +(25807, 25795, 0, -25520), +(25514, 25510, 0, -25514), +(25519, 25510, 0, -25514); + +-- Spell Area +DELETE FROM `spell_area` WHERE `area` IN (493, 5040) AND `spell`= 49416; +INSERT INTO `spell_area` (`spell`, `area`, `quest_start`, `quest_end`, `autocast`, `gender`, `quest_start_status`, `quest_end_status`) VALUES +(49416, 493, 25316, 25316, 1, 2, 2, 11), +(49416, 5040, 25316, 25316, 1, 2, 2, 11); + +-- SAI corrections and additions +-- Creature Furious Hyjal Warden 43427 SAI +SET @ENTRY := 43427; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`= @ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +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`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(@ENTRY, 0, 0, 0, 0, 0, 100, 0, 5000, 6000, 22000, 30000, 11, 18328, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "When in combat and timer at the begining between 5000 and 6000 ms (and later repeats every 22000 and 30000 ms) - Self: Cast spell 18328 on Self // Furious Hyjal Warden - In Combat - Cast 'Incapacitating Shout'"), +(@ENTRY, 0, 1, 0, 0, 0, 100, 0, 1000, 3000, 7000, 14000, 11, 19643, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, "When in combat and timer at the begining between 1000 and 3000 ms (and later repeats every 7000 and 14000 ms) - Self: Cast spell 19643 on Victim // Furious Hyjal Warden - In Combat - Cast 'Mortal Strike'"), +(@ENTRY, 0, 2, 0, 0, 0, 100, 0, 1000, 3000, 11000, 13000, 11, 15618, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, "When in combat and timer at the begining between 1000 and 3000 ms (and later repeats every 11000 and 13000 ms) - Self: Cast spell 15618 on Victim // "), +(@ENTRY, 0, 3, 0, 1, 0, 100, 0, 1000, 1000, 3000, 3000, 49, 0, 0, 0, 0, 0, 0, 11, 40229, 10, 0, 0, 0, 0, 0, "When out of combat and timer at the begining between 1000 and 1000 ms (and later repeats every 3000 and 3000 ms) - Self: Attack Creature Scalding Rock Elemental (40229) in 10 yd // "); + +-- Creature Hyjal Warden 38915 SAI +SET @ENTRY := 38915; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`= @ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +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`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(@ENTRY, 0, 0, 0, 0, 0, 100, 0, 5000, 5000, 11000, 14000, 11, 19643, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, "When in combat and timer at the begining between 5000 and 5000 ms (and later repeats every 11000 and 14000 ms) - Self: Cast spell 19643 on Victim // "), +(@ENTRY, 0, 1, 0, 1, 0, 100, 0, 1000, 1000, 3000, 3000, 49, 0, 0, 0, 0, 0, 0, 11, 40229, 10, 0, 0, 0, 0, 0, "When out of combat and timer at the begining between 1000 and 1000 ms (and later repeats every 3000 and 3000 ms) - Self: Attack Creature Scalding Rock Elemental (40229) in 10 yd // "); + +-- Creature Scalding Rock Elemental 40229 SAI +SET @ENTRY := 40229; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`= @ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +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`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(@ENTRY, 0, 0, 0, 0, 0, 100, 0, 8000, 10000, 15000, 19000, 11, 80638, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, "When in combat and timer at the begining between 8000 and 10000 ms (and later repeats every 15000 and 19000 ms) - Self: Cast spell 80638 on Victim // "); + +-- Creature Cenarion Emissary Jademoon 15187 SAI +SET @ENTRY := 15187; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`= @ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +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`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(@ENTRY, 0, 0, 0, 62, 0, 100, 512, 12129, 0, 0, 0, 86, 86587, 0, 7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, "On gossip action 0 from menu 12129 selected - SMART_TARGET_ACTION_INVOKER: Cast spell 86587 at Action invoker // "); + +-- Creature Cenarion Emissary Blackhoof 15188 SAI +SET @ENTRY := 15188; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`= @ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +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`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(@ENTRY, 0, 0, 0, 62, 0, 100, 512, 12125, 0, 0, 0, 86, 86565, 0, 7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, "On gossip action 0 from menu 12125 selected - SMART_TARGET_ACTION_INVOKER: Cast spell 86565 at Action invoker // "); + +-- Creature Ragnaros 38806 SAI +SET @ENTRY := 38806; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`= @ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +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`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(@ENTRY, 0, 0, 0, 63, 0, 100, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "When just created - Self: Talk 0 // "), +(@ENTRY, 0, 1, 0, 60, 0, 100, 1, 3500, 3500, 0, 0, 5, 53, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Every 0 and 0 ms (for the first time, timer between 3500 and 3500 ms) - Self: Play emote 53 // "); diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 38ffa17d095..175c625b6b0 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -4767,6 +4767,12 @@ void SpellMgr::LoadSpellInfoCorrections() spellInfo->RangeEntry = sSpellRangeStore.LookupEntry(6); // 100yd }); + // Hyjal Intro Flight + ApplySpellFix({ 73518 }, [](SpellInfo* spellInfo) + { + spellInfo->RangeEntry = sSpellRangeStore.LookupEntry(7); // 10yd + }); + for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i) { SpellInfo* spellInfo = mSpellInfoMap[i]; diff --git a/src/server/scripts/Kalimdor/kalimdor_script_loader.cpp b/src/server/scripts/Kalimdor/kalimdor_script_loader.cpp index e47bea93f82..720f4fd0c7a 100644 --- a/src/server/scripts/Kalimdor/kalimdor_script_loader.cpp +++ b/src/server/scripts/Kalimdor/kalimdor_script_loader.cpp @@ -127,6 +127,7 @@ void AddSC_desolace(); void AddSC_durotar(); void AddSC_felwood(); void AddSC_moonglade(); +void AddSC_mount_hyjal(); void AddSC_mulgore(); void AddSC_silithus(); void AddSC_tanaris(); @@ -250,6 +251,7 @@ void AddKalimdorScripts() AddSC_durotar(); AddSC_felwood(); AddSC_moonglade(); + AddSC_mount_hyjal(); AddSC_mulgore(); AddSC_silithus(); AddSC_tanaris(); diff --git a/src/server/scripts/Kalimdor/zone_mount_hyjal.cpp b/src/server/scripts/Kalimdor/zone_mount_hyjal.cpp new file mode 100644 index 00000000000..2c21c62abc5 --- /dev/null +++ b/src/server/scripts/Kalimdor/zone_mount_hyjal.cpp @@ -0,0 +1,519 @@ +/* +* Copyright (C) 2008-2018 TrinityCore +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see . +*/ + +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "GameObjectData.h" +#include "GameObject.h" +#include "MoveSpline.h" +#include "MoveSplineInit.h" +#include "PassiveAI.h" +#include "Spell.h" +#include "Vehicle.h" + +enum CommonDefines +{ + // Move Points + POINT_NONE = 0, + + // Seats + SEAT_0 = 0 +}; + +enum AsHyjalBurns +{ + // Texts + SAY_BURNT_PLAIN = 0, + SAY_APPROACH_FIRELANDS = 1, + SAY_RAGNAROS_SUMMONED = 2, + + // Events + EVENT_ARONUS_FLY_TO_PORTAL = 1, + EVENT_ARONUS_INTRO_TELEPORT, + EVENT_ARONUS_FLY_AFTER_TELEPORT, + EVENT_ARONUS_FLY_OVER_PLAIN, + EVENT_ARONUS_FLY_TO_FIRELANDS, + EVENT_ARONUS_SUMMON_RAGNAROS, + EVENT_ARONUS_FLY_TO_NORDRASSIL, + EVENT_ARONUS_EJECT_PASSENGERS, + + // Spells + SPELL_HYJAL_INTRO_PORT = 73519, + SPELL_PLAY_HYJAL_INTRO_FLIGHT_A = 94508, + SPELL_PLAY_HYJAL_INTRO_FLIGHT_B = 94509, + SPELL_PLAY_HYJAL_INTRO_FLIGHT_C = 94510, + SPELL_PLAY_HYJAL_INTRO_FLIGHT_D = 94511, + SPELL_FLAME_BREATH = 92815, + SPELL_FORCECAST_SUMMON_RAGNAROS = 74437, + SPELL_DANS_EJECT_ALL_PASSENGERS = 51254, + + // Creature + NPC_DEATHWING = 39867 +}; + +Position const AronusPath1[] = +{ + { 7791.06f, -2445.54f, 489.6467f }, + { 7772.387f, -2466.134f, 500.5336f }, + { 7747.4f, -2509.035f, 500.9175f } +}; + +Position const AronusPath2[] = +{ + { 4692.0f, -3190.0f, 1100.0f }, + { 4631.768f, -3206.595f, 1066.634f }, + { 4608.449f, -3278.08f, 1066.634f } +}; + +Position const AronusPath3[] = +{ + { 4608.449f, -3278.08f, 1066.634f }, + { 4674.389f, -3213.078f, 1105.225f }, + { 4595.177f, -3160.993f, 1105.225f }, + { 4444.997f, -3120.368f, 1105.225f } +}; + +Position const AronusPath4[] = +{ + { 4444.997f, -3120.368f, 1105.225f }, + { 4356.268f, -3140.339f, 1079.978f }, + { 4210.395f, -3086.316f, 1075.616f }, + { 4159.675f, -3025.274f, 1042.256f }, + { 4112.436f, -3039.601f, 1015.922f }, + { 4065.911f, -3053.733f, 997.0886f } +}; + +Position const AronusPath5[] = +{ + { 4065.911f, -3053.733f, 997.0886f }, + { 4212.104f, -3126.182f, 1087.835f }, + { 4482.061f, -3015.623f, 1187.483f }, + { 4882.237f, -3406.547f, 1771.693f }, + { 5114.466f, -3483.545f, 1755.137f }, + { 5211.074f, -3609.153f, 1755.137f }, + { 5512.352f, -3793.356f, 1689.859f }, + { 5546.801f, -3691.3f, 1626.61f }, + { 5536.043f, -3629.82f, 1570.572f } +}; + +Position const AronusPath6[] = +{ + { 5536.043f, -3629.82f, 1570.572f }, + { 5534.813f, -3629.128f, 1611.423f }, + { 5520.546f, -3606.208f, 1634.757f } +}; + +struct npc_mh_aronus : public PassiveAI +{ + npc_mh_aronus(Creature* creature) : PassiveAI(creature) { } + + void PassengerBoarded(Unit* /*passenger*/, int8 /*seatId*/, bool apply) override + { + if (!apply) + return; + + _events.ScheduleEvent(EVENT_ARONUS_FLY_TO_PORTAL, 1s); + } + + void UpdateAI(uint32 diff) override + { + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_ARONUS_FLY_TO_PORTAL: + // Preload grid to avoid waypoint issues after teleport + me->GetMap()->LoadGrid(AronusPath2[0].GetPositionX(), AronusPath2[0].GetPositionY()); + + DoCastSelf(SPELL_PLAY_HYJAL_INTRO_FLIGHT_A); + _events.ScheduleEvent(EVENT_ARONUS_INTRO_TELEPORT, MoveByPathAndGetTravelTime(AronusPath1, 3, 7.0f)); + break; + case EVENT_ARONUS_INTRO_TELEPORT: + DoCastSelf(SPELL_HYJAL_INTRO_PORT); + _events.ScheduleEvent(EVENT_ARONUS_FLY_AFTER_TELEPORT, 1s + 500ms); + break; + case EVENT_ARONUS_FLY_AFTER_TELEPORT: + _events.ScheduleEvent(EVENT_ARONUS_FLY_OVER_PLAIN, MoveByPathAndGetTravelTime(AronusPath2, 3, 14.0f)); + break; + case EVENT_ARONUS_FLY_OVER_PLAIN: + Talk(SAY_BURNT_PLAIN); + DoCastSelf(SPELL_PLAY_HYJAL_INTRO_FLIGHT_B); + _events.ScheduleEvent(EVENT_ARONUS_FLY_TO_FIRELANDS, MoveByPathAndGetTravelTime(AronusPath3, 4, 14.0f)); + break; + case EVENT_ARONUS_FLY_TO_FIRELANDS: + Talk(SAY_APPROACH_FIRELANDS); + DoCastSelf(SPELL_PLAY_HYJAL_INTRO_FLIGHT_C); + _events.ScheduleEvent(EVENT_ARONUS_SUMMON_RAGNAROS, MoveByPathAndGetTravelTime(AronusPath4, 6, 21.0f)); + break; + case EVENT_ARONUS_SUMMON_RAGNAROS: + if (Creature* deathwing = me->FindNearestCreature(NPC_DEATHWING, 200.0f, true)) + deathwing->CastSpell(deathwing, SPELL_FLAME_BREATH); + + DoCastSelf(SPELL_FORCECAST_SUMMON_RAGNAROS); + _events.ScheduleEvent(EVENT_ARONUS_FLY_TO_NORDRASSIL, 7s); + break; + case EVENT_ARONUS_FLY_TO_NORDRASSIL: + Talk(SAY_RAGNAROS_SUMMONED); + _events.ScheduleEvent(EVENT_ARONUS_EJECT_PASSENGERS, MoveByPathAndGetTravelTime(AronusPath5, 9, 42.0f)); + break; + case EVENT_ARONUS_EJECT_PASSENGERS: + DoCastSelf(SPELL_PLAY_HYJAL_INTRO_FLIGHT_D); + DoCastSelf(SPELL_DANS_EJECT_ALL_PASSENGERS, true); + me->DespawnOrUnsummon(MoveByPathAndGetTravelTime(AronusPath6, 3, 21.0f)); + break; + default: + break; + } + } + } +private: + EventMap _events; + + int32 MoveByPathAndGetTravelTime(Position const* pathPoints, size_t pathSize, float velocity) + { + Movement::MoveSplineInit init(me); + Movement::PointsArray path; + path.reserve(pathSize); + std::transform(pathPoints, pathPoints + pathSize, std::back_inserter(path), [](Position const& point) + { + return G3D::Vector3(point.GetPositionX(), point.GetPositionY(), point.GetPositionZ()); + }); + + init.SetFly(); + init.SetUncompressed(); + init.MovebyPath(path); + init.SetSmooth(); + init.SetWalk(false); + init.SetVelocity(velocity); + return init.Launch(); + } +}; + +enum IncitingTheElements +{ + // Texts + SAY_FEED_BERRIES = 0, + SAY_FIGHT_INFILTRATOR = 1, + SAY_INFILTRATOR_SPOTTED = 0, + + // Events + EVENT_FIND_INFILTRATOR = 1, + EVENT_SUMMON_INFILTRATOR, + EVENT_INFILTRATOR_ATTACK, + EVENT_INFILTRATOR_TALK_SPOTTED, + EVENT_INFILTRATOR_SHADOWSTEP, + EVENT_INFILTRATOR_BACKSTAB, + + // Move Points + POINT_SUMMON_INFILTRATOR = 1, + + // Spells + SPELL_FEED_BERRIES = 74513, + SPELL_FORCECAST_SPOT_INFILTRATOR = 74515, + SPELL_STEALTH = 30991, + SPELL_SHADOWSTEP = 80576, + SPELL_BACKSTAB = 37685 +}; + +struct npc_mh_faerie_dragon : public ScriptedAI +{ + npc_mh_faerie_dragon(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + _eventInProgress = false; + me->GetMotionMaster()->MoveRandom(7.0f); + } + + void SpellHit(Unit* caster, SpellInfo const* spell) override + { + if (!caster) + return; + + if (spell->Id == SPELL_FEED_BERRIES && !_eventInProgress) + { + me->GetMotionMaster()->InitDefault(); + me->StopMoving(); + Talk(SAY_FEED_BERRIES, caster); + _events.ScheduleEvent(EVENT_FIND_INFILTRATOR, 2s + 500ms); + _actorGUID = caster->GetGUID(); + _eventInProgress = true; + } + } + + void UpdateAI(uint32 diff) override + { + _events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_FIND_INFILTRATOR: + { + Position pos = me->GetPosition(); + me->SetWalk(true); + me->MovePosition(pos, 30.0f, frand(0.0f, float(M_PI * 2))); + me->GetMotionMaster()->MovePoint(POINT_SUMMON_INFILTRATOR, pos); + break; + } + default: + break; + } + } + } + + void MovementInform(uint32 type, uint32 id) override + { + if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE) + return; + + if (id == POINT_SUMMON_INFILTRATOR) + { + if (Player* player = ObjectAccessor::FindPlayer(_actorGUID)) + { + Talk(SAY_FIGHT_INFILTRATOR, player); + DoCast(player, SPELL_FORCECAST_SPOT_INFILTRATOR); + } + me->DespawnOrUnsummon(3s); + } + } +private: + EventMap _events; + ObjectGuid _actorGUID; + bool _eventInProgress; +}; + +struct npc_mh_twilight_inciter : public ScriptedAI +{ + npc_mh_twilight_inciter(Creature* creature) : ScriptedAI(creature) + { + Initialize(); + } + + void Initialize() + { + _spotted = false; + me->SetReactState(REACT_PASSIVE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + } + + void Reset() override + { + _events.Reset(); + } + + void JustEngagedWith(Unit* /*who*/) override + { + _events.ScheduleEvent(EVENT_INFILTRATOR_SHADOWSTEP, 25s); + } + + void IsSummonedBy(Unit* summoner) override + { + DoCastSelf(SPELL_STEALTH); + me->SetFacingToObject(summoner); + _events.ScheduleEvent(EVENT_INFILTRATOR_TALK_SPOTTED, 1s + 500ms); + _events.ScheduleEvent(EVENT_INFILTRATOR_ATTACK, 5s + 500ms); + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim() && _spotted) + return; + + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_INFILTRATOR_ATTACK: + _spotted = true; + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + if (TempSummon* summon = me->ToTempSummon()) + if (Unit* target = summon->GetSummoner()) + AttackStart(target); + break; + case EVENT_INFILTRATOR_TALK_SPOTTED: + if (TempSummon* summon = me->ToTempSummon()) + if (Unit* target = summon->GetSummoner()) + Talk(SAY_INFILTRATOR_SPOTTED, target); + break; + case EVENT_INFILTRATOR_SHADOWSTEP: + DoCastVictim(SPELL_SHADOWSTEP); + _events.ScheduleEvent(EVENT_INFILTRATOR_BACKSTAB, 1s); + _events.Repeat(30s); + break; + case EVENT_INFILTRATOR_BACKSTAB: + DoCastVictim(SPELL_BACKSTAB); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); + } +private: + EventMap _events; + bool _spotted; +}; + +enum FlamesFromAbove +{ + // Events + EVENT_SUMMON_EMERALD_FLAMES = 1, + + // Spells + SPELL_EMERALD_FRAMEWEAVER_DRAKE_BREATH = 76205, + + // Gameobjects + GO_EMERALD_FLAME = 203065 +}; + +Position const EmeraldFlameweaverSummonPos = { 5725.01f, -3305.924f, 1625.791f, 6.019073f }; + +Position const EmeraldFlameweaverPath1[] = +{ + { 5708.011f, -3301.326f, 1620.673f }, + { 5725.01f, -3305.924f, 1625.791f }, + { 5742.01f, -3310.521f, 1630.909f }, + { 5753.374f, -3295.726f, 1614.876f }, + { 5753.374f, -3295.726f, 1614.876f } +}; + +Position const EmeraldFlameweaverPath2[] = +{ + { 5753.374f, -3295.726f, 1614.876f }, + { 5761.196f, -3287.415f, 1611.663f }, + { 5766.298f, -3290.731f, 1616.272f }, + { 5768.874f, -3298.884f, 1620.067f }, + { 5772.097f, -3310.894f, 1623.15f }, + { 5758.483f, -3328.623f, 1639.484f } +}; + +Position const EmeraldFlamesPositions[] = +{ + { 5767.491f, -3286.856f, 1604.598f }, + { 5772.15f, -3282.38f, 1604.77f }, + { 5785.219f, -3292.889f, 1605.573f }, + { 5779.661f, -3303.783f, 1604.636f }, + { 5751.01f, -3293.18f, 1604.63f }, + { 5772.796f, -3307.984f, 1604.598f }, + { 5762.307f, -3285.71f, 1607.487f }, + { 5781.79f, -3303.74f, 1607.733f }, + { 5772.169f, -3288.177f, 1610.019f }, + { 5759.41f, -3285.17f, 1604.83f }, + { 5763.712f, -3281.502f, 1605.107f } +}; + +QuaternionData const emeraldFlameRotation = QuaternionData(); + +struct npc_mh_emerald_flameweaver : public PassiveAI +{ + npc_mh_emerald_flameweaver(Creature* creature) : PassiveAI(creature) { } + + void IsSummonedBy(Unit* /*summoner*/) override + { + me->GetMotionMaster()->MoveSmoothPath(POINT_NONE, EmeraldFlameweaverPath1, 5, false, true); + _events.ScheduleEvent(EVENT_SUMMON_EMERALD_FLAMES, 5s + 500ms); + } + + void UpdateAI(uint32 diff) override + { + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_SUMMON_EMERALD_FLAMES: + for (uint8 i = 0; i < 10; i++) + if (GameObject* flame = me->SummonGameObject(GO_EMERALD_FLAME, EmeraldFlamesPositions[i], emeraldFlameRotation, 0, GO_SUMMON_TIMED_DESPAWN)) + flame->DespawnOrUnsummon(20s); + + DoCastAOE(SPELL_EMERALD_FRAMEWEAVER_DRAKE_BREATH); + + if (TempSummon* summon = me->ToTempSummon()) + if (Unit* target = summon->GetSummoner()) + if (Player* player = target->ToPlayer()) + player->KilledMonsterCredit(me->GetEntry()); + + me->GetMotionMaster()->MoveSmoothPath(POINT_NONE, EmeraldFlameweaverPath2, 6, false, true); + me->DespawnOrUnsummon(9s); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); + } +private: + EventMap _events; +}; + +class spell_mh_summon_emerald_flameweaver : public SpellScript +{ + PrepareSpellScript(spell_mh_summon_emerald_flameweaver); + + void SetDest(SpellDestination& dest) + { + dest.Relocate(EmeraldFlameweaverSummonPos); + } + + void Register() + { + OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_mh_summon_emerald_flameweaver::SetDest, EFFECT_0, TARGET_DEST_NEARBY_ENTRY); + } +}; + +Position const RagnarosSummonPos = { 4039.558f, -3061.701f, 972.6672f, 0.104719f }; + +class spell_mh_ragnaros : public SpellScript +{ + PrepareSpellScript(spell_mh_ragnaros); + + void SetDest(SpellDestination& dest) + { + dest.Relocate(RagnarosSummonPos); + } + + void Register() + { + OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_mh_ragnaros::SetDest, EFFECT_0, TARGET_DEST_NEARBY_ENTRY); + } +}; + +void AddSC_mount_hyjal() +{ + RegisterCreatureAI(npc_mh_aronus); + RegisterCreatureAI(npc_mh_faerie_dragon); + RegisterCreatureAI(npc_mh_twilight_inciter); + RegisterCreatureAI(npc_mh_emerald_flameweaver); + RegisterSpellScript(spell_mh_summon_emerald_flameweaver); + RegisterSpellScript(spell_mh_ragnaros); +}