From f8ae1f93aaa84b3ae677638f33fcde11a6941f22 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Wed, 23 May 2018 01:05:26 +0200 Subject: [PATCH] Scripts/Gilneas: *fixed quest "Two by Sea" *fixed quest "Leader of the Pack" *implement phaseshift to phase 183 *implement terrainswap for first Duskhaven terrain change --- sql/updates/WIP/Gilneas/chapter2.sql | 77 +++++-- .../EasternKingdoms/Gilneas/chapter2.cpp | 194 +++++++++++++++++- 2 files changed, 258 insertions(+), 13 deletions(-) diff --git a/sql/updates/WIP/Gilneas/chapter2.sql b/sql/updates/WIP/Gilneas/chapter2.sql index effe39f0e97..e1b90419b60 100644 --- a/sql/updates/WIP/Gilneas/chapter2.sql +++ b/sql/updates/WIP/Gilneas/chapter2.sql @@ -58,35 +58,51 @@ PHASING DOCUMENTATION: */ --- Phasing conditions -DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`= 26 AND `SourceEntry`= 4714 AND `SourceGroup` IN (105, 181, 182); +-- Phasing Conditions +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`= 26 AND `SourceEntry`= 4714 AND `SourceGroup` IN (105, 181, 182, 183); INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `ConditionTypeOrReference`, `ConditionValue1`, `NegativeCondition`, `Comment`) VALUES (26, 105, 4714, 8, 14222, 0, 'Gilneas - Phase 105 - active when rewarded quest 14222'), -- (26, 105, 4714, 8, 14375, 1, 'Gilneas - Phase 105 - inactive when rewarded quest 14375'), (26, 181, 4714, 8, 14375, 0, 'Gilneas - Phase 181 - active when rewarded quest 14222'), (26, 181, 4714, 8, 14321, 1, 'Gilneas - Phase 181 - inactive when rewarded quest 14321'), -(26, 182, 4714, 8, 14321, 0, 'Gilneas - Phase 181 - active when rewarded quest 14321'); +(26, 182, 4714, 8, 14321, 0, 'Gilneas - Phase 182 - active when rewarded quest 14321'), +(26, 182, 4714, 8, 14386, 1, 'Gilneas - Phase 182 - inactive when rewarded quest 14386'), +(26, 183, 4714, 8, 14386, 0, 'Gilneas - Phase 183 - active when rewarded quest 14386'); + +-- Terrain Swaps +DELETE FROM `terrain_swap_defaults` WHERE `TerrainSwapMap`= 655; +INSERT INTO `terrain_swap_defaults` (`MapId`, `TerrainSwapMap`, `Comment`) VALUES +(654, 655, 'Gilneas - Duskmist Shore broken'); + +-- Terrain Swap Conditions +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`= 25 AND `SourceEntry` IN (655); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `ConditionTypeOrReference`, `ConditionValue1`, `NegativeCondition`, `Comment`) VALUES +(25, 0, 655, 8, 14386, 0, 'Gilneas - Terrain Swap 655 - active when rewarded quest 14386'); DELETE FROM `phase_area` WHERE `AreaId`= 4714; INSERT INTO `phase_area` (`AreaId`, `PhaseId`, `Comment`) VALUES (4714, 105, 'Gilneas - Phase 105'), (4714, 181, 'Gilneas - Phase 181'), -(4714, 182, 'Gilneas - Phase 182'); +(4714, 182, 'Gilneas - Phase 182'), +(4714, 183, 'Gilneas - Phase 183'); -- Update Phasing for Creatures -- Phase 181, 182, 183 -UPDATE `creature` SET `PhaseId`= 0, `PhaseGroup`= 431 WHERE `guid` IN (255508, 255507, 255506, 255505, 255504, 255503, 255502, 255501, 255500, 255499, 255498, 255497, 255496, 255495, 255494, 255493, 255492, 255491, 255490, 255489, 255488, 255487, 255486, 255485, 255483, 255482, 255480, 255479, 255478, 255476, 255475, 255474, 255473, 255472, 255471, 255470, 255469, 255468, 255467, 255466, 255465, 255464, 255463, 255461, 255460, 255459, 255457, 255456, 255455, 255454, 255453, 255452, 255451, 255450, 255449, 255448, 255447, 255446, 255444, 255443, 255441, 255440, 255439, 255438, 255437, 255436, 255435, 255434, 255433); +UPDATE `creature` SET `PhaseId`= 0, `PhaseGroup`= 431 WHERE `guid` IN (255508, 255507, 255506, 255505, 255504, 255503, 255502, 255501, 255500, 255499, 255498, 255497, 255496, 255495, 255494, 255493, 255492, 255491, 255490, 255489, 255488, 255487, 255486, 255485, 255483, 255482, 255480, 255479, 255478, 255476, 255475, 255474, 255473, 255472, 255471, 255470, 255469, 255468, 255467, 255466, 255465, 255464, 255463, 255461, 255460, 255459, 255457, 255456, 255455, 255454, 255453, 255452, 255451, 255450, 255449, 255448, 255447, 255446, 255444, 255443, 255441, 255440, 255439, 255438, 255437, 255436, 255435, 255434, 255433, 255518, 255519, 255516, 255517, 255522, 255520, 255532, 255528, 255533, 255524, 255527, 255530, 255529, 255535, 255531, 255534); UPDATE `creature` SET `PhaseId`= 0, `PhaseGroup`= 429 WHERE `guid`= 255442; +-- Phase 182, 183 +UPDATE `creature` SET `PhaseId`= 0, `PhaseGroup`= 471 WHERE `guid` IN (255677, 255676, 255679, 255681, 255680); + -- Update Phasing for GameObjects UPDATE `gameobject` SET `PhaseId`= 0, `PhaseGroup`= 431 WHERE `guid` IN (236344, 236345, 236346, 236347, 236348, 236349, 236350, 236351, 236352, 236353, 236354, 236355, 236356, 236358, 235520, 236492); -- Cleanup Duplicate Spawns -DELETE FROM `creature` WHERE `guid` IN (255642, 255755, 255766, 255784, 255651, 255795, 255765, 255686, 255691, 255647); -DELETE FROM `creature_addon` WHERE `guid` IN (255642, 255755, 255766, 255784, 255651, 255795, 255765, 255686, 255691, 255647); +DELETE FROM `creature` WHERE `guid` IN (255642, 255755, 255766, 255784, 255651, 255795, 255765, 255686, 255691, 255647, 255771, 255782, 255775, 255961, 255959, 255786, 255793, 255791, 255794, 255789, 255788, 255792, 255790, 255787); +DELETE FROM `creature_addon` WHERE `guid` IN (255642, 255755, 255766, 255784, 255651, 255795, 255765, 255686, 255691, 255647, 255771, 255782, 255775, 255961, 255959, 255786, 255793, 255791, 255794, 255789, 255788, 255792, 255790, 255787); -- Spell Conditions -DELETE FROM `conditions` WHERE `SourceEntry` IN (69123, 68632, 68634, 68638, 69296, 68558, 68591) AND `SourceTypeOrReferenceId`= 13; +DELETE FROM `conditions` WHERE `SourceEntry` IN (69123, 68632, 68634, 68638, 69296, 68558, 68591, 68659, 68682) AND `SourceTypeOrReferenceId`= 13; INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ScriptName`, `Comment`) VALUES (13, 1, 69123, 0, 0, 31, 0, 3, 0, 255427, 0, 0, '', 'Curse of the Worgen - Target Generic Trigger Lab - Multiphase (Ground)'), (13, 1, 68632, 0, 0, 31, 0, 3, 0, 255423, 0, 0, '', 'Summon Personal Godfrey - Target Generic Trigger Lab - Multiphase (Ground)'), @@ -96,8 +112,17 @@ INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry (13, 2, 68638, 0, 2, 31, 0, 3, 36332, 0, 0, 0, '', 'Worgen Intro Completion - Target King Genn Greymane'), (13, 2, 69296, 0, 0, 31, 0, 5, 197337, 0, 0, 0, '', 'Invasion Camera - Target Invasion Camera'), (13, 1, 68558, 0, 0, 31, 0, 3, 36140, 0, 0, 0, '', 'Gilneas - Quest - Abomination Kill Me - Target Prince Liam Greymane'), -(13, 1, 68591, 0, 0, 31, 0, 3, 36286, 0, 0, 0, '', 'Fiery Boulder - Target Generic Trigger LAB - Multiphase'); --- (17, 0, 69094, 0, 2, 31, 0, 3, 36231, 0, 0, 0, '', 'Toss Keg - Target Horrid Abomination'); +(13, 1, 68591, 0, 0, 31, 0, 3, 36286, 0, 0, 0, '', 'Fiery Boulder - Target Generic Trigger LAB - Multiphase'), +(13, 1, 68659, 0, 0, 31, 0, 3, 0, 255538, 0, 0, '', 'Launch - Target Generic Trigger LAB - Multiphase'), +(13, 1, 68659, 0, 1, 31, 0, 3, 0, 255521, 0, 0, '', 'Launch - Target Generic Trigger LAB - Multiphase'), +(13, 1, 68659, 0, 2, 31, 0, 3, 0, 255515, 0, 0, '', 'Launch - Target Generic Trigger LAB - Multiphase'), +(13, 1, 68659, 0, 3, 31, 0, 3, 0, 255514, 0, 0, '', 'Launch - Target Generic Trigger LAB - Multiphase'), +(13, 1, 68659, 0, 4, 31, 0, 3, 0, 255510, 0, 0, '', 'Launch - Target Generic Trigger LAB - Multiphase'), +(13, 1, 68659, 0, 5, 31, 0, 3, 0, 255511, 0, 0, '', 'Launch - Target Generic Trigger LAB - Multiphase'), +(13, 1, 68659, 0, 6, 31, 0, 3, 0, 255509, 0, 0, '', 'Launch - Target Generic Trigger LAB - Multiphase'), +(13, 1, 68659, 0, 7, 31, 0, 3, 0, 255513, 0, 0, '', 'Launch - Target Generic Trigger LAB - Multiphase'), +(13, 1, 68659, 0, 8, 31, 0, 3, 0, 255512, 0, 0, '', 'Launch - Target Generic Trigger LAB - Multiphase'), +(13, 1, 68682, 0, 0, 31, 0, 3, 36312, 0, 0, 0, '', 'Call Attack Mastiff - Target Dark Ranger Thyala'); -- Spellclick Conditions DELETE FROM `conditions` WHERE `SourceGroup` IN (36287, 36288, 36289) AND `SourceTypeOrReferenceId`= 18; @@ -111,6 +136,9 @@ UPDATE `creature_template` SET `flags_extra`= 128 WHERE `entry`= 36198; UPDATE `creature_template` SET `ScriptName`= 'npc_gilneas_horrid_abomination' WHERE `entry`= 36231; UPDATE `creature_template` SET `npcflag`= 16777216, `ScriptName`= 'npc_gilneas_save_the_children' WHERE `entry` IN (36287, 36288, 36289); UPDATE `creature_template` SET `flags_extra`= 128, `InhabitType`= 4 WHERE `entry`= 36286; +UPDATE `creature_template` SET `flags_extra`= 128 WHERE `entry`= 36198; + +UPDATE `creature_template` SET `unit_flags`= 0x100, `ScriptName`= 'npc_gilneas_forsaken_catapult' WHERE `entry`= 36283; -- Respawn Time corrections UPDATE `creature` SET `spawntimesecs`= 30 WHERE `id` IN (36287, 36288, 36289); @@ -169,12 +197,16 @@ INSERT INTO `creature_sparring_template` (`AttackerEntry`, `VictimEntry`, `Healt -- Spells DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_gilneas_quest_save_the_children', -'spell_gilneas_quest_save_james'); +'spell_gilneas_quest_save_james', +'spell_gilneas_launch', +'spell_gilneas_call_attack_mastiff'); INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (68596, 'spell_gilneas_quest_save_james'), (68597, 'spell_gilneas_quest_save_the_children'), -(68598, 'spell_gilneas_quest_save_the_children'); +(68598, 'spell_gilneas_quest_save_the_children'), +(68659, 'spell_gilneas_launch'), +(68682, 'spell_gilneas_call_attack_mastiff'); -- Creature Krennan Aranas 36331 SAI SET @ENTRY := 36331; @@ -256,3 +288,24 @@ 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, 8, 0, 100, 0, 68558, 0, 0, 0, 11, 68559, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, "On spell 68558 hit - Self: Cast spell 68559 on Action invoker // "); +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry`= 36283 AND `spell_id`= 46598; +INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `cast_flags`, `user_type`) VALUES +(36283, 46598, 0, 1); + +DELETE FROM `vehicle_template_accessory` WHERE `entry` IN (36283); +INSERT INTO `vehicle_template_accessory` (`entry`, `accessory_entry`, `seat_id`, `minion`, `description`) VALUES +(36283,36292,0,0,''); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`= 18 AND `SourceGroup`= 36283; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(18, 36283, 46598, 0, 0, 31, 0, 3, 36292, 0, 0, 0, 0, '', 'Required quest active for spellclick'), +(18, 36283, 69434, 0, 0, 31, 0, 4, 0, 0, 0, 0, 0, '', 'Required quest active for spellclick'); + +-- Creature Lord Godfrey 36290 SAI +SET @ENTRY := 36290; +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, 1, 20, 0, 100, 0, 14386, 0, 0, 0, 11, 69027, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, "When player rewards quest Leader of the Pack (14386) - Self: Cast spell 69027 on Action invoker // "), +(@ENTRY, 0, 1, 0, 61, 0, 100, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, " Linked - Self: Talk 0 // "); + diff --git a/src/server/scripts/EasternKingdoms/Gilneas/chapter2.cpp b/src/server/scripts/EasternKingdoms/Gilneas/chapter2.cpp index f1dbd3a9a85..fde29d954fe 100644 --- a/src/server/scripts/EasternKingdoms/Gilneas/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/Gilneas/chapter2.cpp @@ -19,6 +19,7 @@ #include "ScriptMgr.h" #include "CombatAI.h" #include "MotionMaster.h" +#include "MoveSplineInit.h" #include "ObjectAccessor.h" #include "Player.h" #include "PassiveAI.h" @@ -183,7 +184,6 @@ enum SaveTheChildren SPELL_GILNEAS_QUEST_SAVE_CYNTHIA = 68597, SPELL_GILNEAS_QUEST_SAVE_ASHLEY = 68598, - NPC_CYNTHIA = 36287, NPC_ASHLEY = 36288, NPC_JAMES = 36289, @@ -412,13 +412,205 @@ class npc_gilneas_save_the_children : public CreatureScript } }; +enum ForsakenCatapult +{ + NPC_FORSAKEN_MACHINIST = 36292, + + SPELL_FIERY_BOULDER = 68591, + SPELL_LAUNCH_INTERNAL = 96114, + SPELL_LAUNCH_INTERNAL_2 = 96185, + SPELL_LAUNCH_1 = 68659, + SPELL_LAUNCH_2 = 66251, + + EVENT_FIERY_BOULDER = 1, + SEAT_0 = 0 +}; + +class npc_gilneas_forsaken_catapult : public CreatureScript +{ + public: + npc_gilneas_forsaken_catapult() : CreatureScript("npc_gilneas_forsaken_catapult") { } + + struct npc_gilneas_forsaken_catapultAI : public VehicleAI + { + npc_gilneas_forsaken_catapultAI(Creature* creature) : VehicleAI(creature) { } + + void PassengerBoarded(Unit* passenger, int8 /*seatId*/, bool apply) override + { + if (!passenger) + return; + + if (passenger->GetEntry() == NPC_FORSAKEN_MACHINIST) + { + if (apply) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + passenger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + if (Creature* creature = passenger->ToCreature()) + creature->SetReactState(REACT_PASSIVE); + } + else + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFaction(FACTION_FRIENDLY); + } + } + else if (passenger->GetTypeId() == TYPEID_PLAYER && !apply) + me->DespawnOrUnsummon(Seconds(9)); + } + + void SpellHit(Unit* caster, SpellInfo const* spell) override + { + switch (spell->Id) + { + case SPELL_LAUNCH_INTERNAL: + DoCastSelf(SPELL_LAUNCH_INTERNAL_2, true); + break; + default: + break; + } + } + + void SetTargetDestination(Position pos) + { + _targetPos = pos; + } + + void SpellHitTarget(Unit* target, SpellInfo const* spell) override + { + switch (spell->Id) + { + case SPELL_LAUNCH_2: + if (target->GetVehicleCreatureBase()) + { + Position pos = target->GetPosition(); + pos.m_positionZ += 6.0f; + target->ExitVehicle(&pos); + target->GetMotionMaster()->MoveJump(_targetPos, 58.62504f, 12.75955f); + } + break; + default: + break; + } + } + + void UpdateAI(uint32 diff) override + { + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_FIERY_BOULDER: + break; + default: + break; + } + } + + } + private: + EventMap _events; + Position _targetPos; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return new npc_gilneas_forsaken_catapultAI(creature); + } +}; + +class spell_gilneas_launch : public SpellScriptLoader +{ +public: + spell_gilneas_launch() : SpellScriptLoader("spell_gilneas_launch") { } + + class spell_gilneas_launch_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gilneas_launch_SpellScript); + + void TransferDestination(SpellEffIndex /*effIndex*/) + { + if (Unit* caster = GetCaster()) + if (Creature* creature = caster->ToCreature()) + if (creature->IsAIEnabled) + CAST_AI(npc_gilneas_forsaken_catapult::npc_gilneas_forsaken_catapultAI, + creature->AI())->SetTargetDestination(GetExplTargetDest()->GetPosition()); + } + + void Register() + { + OnEffectLaunch += SpellEffectFn(spell_gilneas_launch_SpellScript::TransferDestination, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_gilneas_launch_SpellScript(); + } +}; + +enum LeaderOfThePack +{ + NPC_ATTACK_MASTIFF = 36405 +}; + +Position const AttackMastiffSummonPositions[] = +{ + { -1944.483f, 2656.656f, 1.051441f, 1.691914f }, + { -1956.602f, 2649.942f, 1.374257f, 1.441419f }, + { -1973.627f, 2654.836f, -0.6995407f, 1.098437f }, + { -1983.201f, 2662.242f, -1.66652f, 0.8627869f }, + { -1994.557f, 2672.134f, -2.303949f, 0.5766099f }, + { -1949.314f, 2642.024f, 1.299083f, 1.580745f }, + { -1972.606f, 2639.383f, 1.211673f, 1.217789f }, + { -1997.009f, 2650.811f, -1.030188f, 0.8184887f }, + { -2006.259f, 2663.115f, -2.00431f, 0.5941383f }, + { -1945.504f, 2653.386f, 1.177739f, 1.675516f } +}; + +class spell_gilneas_call_attack_mastiff : public SpellScriptLoader +{ + public: + spell_gilneas_call_attack_mastiff() : SpellScriptLoader("spell_gilneas_call_attack_mastiff") { } + + class spell_gilneas_call_attack_mastiff_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gilneas_call_attack_mastiff_SpellScript); + + void HandleHit(SpellEffIndex effIndex) + { + if (Unit* caster = GetCaster()) + { + for (uint8 i = 0; i < 10; i++) + if (Creature* mastiff = caster->SummonCreature(NPC_ATTACK_MASTIFF, AttackMastiffSummonPositions[i], TEMPSUMMON_TIMED_DESPAWN, 60000)) + mastiff->AI()->AttackStart(GetHitUnit()); + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_gilneas_call_attack_mastiff_SpellScript::HandleHit, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_gilneas_call_attack_mastiff_SpellScript(); + } +}; + void AddSC_gilneas_c2() { new go_gilneas_invasion_camera(); new npc_gilneas_horrid_abomination(); new npc_gilneas_save_the_children(); + new npc_gilneas_forsaken_catapult(); new spell_gilneas_quest_save_james(); new spell_gilneas_quest_save_the_children(); + new spell_gilneas_launch(); + new spell_gilneas_call_attack_mastiff(); }