diff --git a/sql/updates/WIP/Gilneas/chapter2.sql b/sql/updates/world/custom/custom_2018_05_26_02_world.sql similarity index 87% rename from sql/updates/WIP/Gilneas/chapter2.sql rename to sql/updates/world/custom/custom_2018_05_26_02_world.sql index e1b90419b60..03993b74eda 100644 --- a/sql/updates/WIP/Gilneas/chapter2.sql +++ b/sql/updates/world/custom/custom_2018_05_26_02_world.sql @@ -1,64 +1,4 @@ -/* -17:05:42.484 -- phaseshift 105 - -14:55:38.148 -- summon krennan -14:55:39.333 -- move to -1819.53 Y: 2291.25 Z: 42.32689 -14:55:44.653 -- I am not giving up on you - -14:55:49.364 -- forcecast summon personal godfrey 68635 -14:55:50.581 -- move wp - -- godfrey move to -1840.085 Y: 2293.042 Z: 42.53004 - -- -1821.922 Y: 2295.05 Z: 42.17052 - -14:55:59.114 - -14:55:57.788 -- summon personal greymane 68636 -14:55:57.788 -- greymane summon -14:55:58.194 -- move to -1821.09 Y: 2292.597 Z: 42.23363 - - - -14:56:07.413 -- greymane (facing angle --> 1.32645) -14:56:17.039 -- das dachte ich mir -14:56:20.658 -- face to 5.497787 - - -14:57:05.196 -- worgen intro completion 68638 (hitting 36330, 36331 and 36332 - -14:57:05.196 -- player casts altered form (97709) -14:57:05.617 -- everyone despawns -14:57:05.196 -- phase id 181 applied - -22:17:26.108 -- assassin summon cast -22:17:26.108 -- assassin aggro -22:17:26.258 -- gilneas will soon belong to the forsaken - -22:18:18.508 -- complete invasion quest - -22:54:04.069 -- exodus accept -22:55:05.155 -- phase 194 applied - -phase group 415 --> phase 180, 181, 182 -phase group 422 --> phase 183 - 185 -phase group 431 --> phase 181 - 183 -phase group 432 --> phase 184 - 186 -phase group 429 --> phase 181, 182 -phase group 433 --> phase 181 - 184 - -PHASING DOCUMENTATION: -105 - chapter two intro phase -181 - first duskhaven phase after chapter 2 intro -182 - forsaken start attacking -183 - after first terrain swap: first land piece is broken -184 - after seeing horde starts invading gilneas: exodus - -186 - Koroth's Den / Stormglen phase (Ogre zone) (inclduing forsaken attack koroth event) - -194 - exodus caravan phase -*/ - - --- Phasing Conditions +-- 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'), @@ -75,10 +15,12 @@ INSERT INTO `terrain_swap_defaults` (`MapId`, `TerrainSwapMap`, `Comment`) VALUE (654, 655, 'Gilneas - Duskmist Shore broken'); -- Terrain Swap Conditions -DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`= 25 AND `SourceEntry` IN (655); +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`= 25 AND `SourceEntry` IN (655, 638); INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `ConditionTypeOrReference`, `ConditionValue1`, `NegativeCondition`, `Comment`) VALUES +(25, 0, 638, 8, 14222, 1, 'Gilneas - Terrain Swap 638 - inactive when rewarded quest 14222'), (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'), @@ -90,12 +32,16 @@ INSERT INTO `phase_area` (`AreaId`, `PhaseId`, `Comment`) VALUES -- 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, 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 `creature` SET `PhaseId`= 0, `PhaseGroup`= 471 WHERE `guid` IN (255677, 255676, 255679, 255681, 255680, 255428, 255425, 255424, 255422, 255420, 255417, 255416, 255415, 255414, 255430, 255431, 255432); +-- Phase 182 +UPDATE `creature` SET `PhaseId`= 182 WHERE `guid` IN (255538, 255521, 255515, 255514, 255513, 255512, 255511, 255510, 255509); -- Update Phasing for GameObjects +-- Phase 181, 182, 183 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); +-- Phase 182 +UPDATE `gameobject` SET `PhaseGroup`= 0, `PhaseId`= 182 WHERE `guid`= 235506; -- Cleanup Duplicate Spawns 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); @@ -104,7 +50,7 @@ DELETE FROM `creature_addon` WHERE `guid` IN (255642, 255755, 255766, 255784, 25 -- Spell Conditions 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, 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)'), (13, 1, 68634, 0, 0, 31, 0, 3, 0, 255421, 0, 0, '', 'Summon Personal Greymane - Target Generic Trigger Lab - Multiphase (Ground)'), (13, 2, 68638, 0, 0, 31, 0, 3, 36331, 0, 0, 0, '', 'Worgen Intro Completion - Target Krennan Aranas'), @@ -131,19 +77,24 @@ INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry (18, 36288, 68598, 0, 0, 9, 0, 14368, 0, 0, 0, 0, '', 'Required quest active for spellclick'), (18, 36289, 68596, 0, 0, 9, 0, 14368, 0, 0, 0, 0, '', 'Required quest active for spellclick'); +-- spell_target_position entries +DELETE FROM `spell_target_position` WHERE `ID`= 69123; +INSERT INTO `spell_target_position` (`ID`, `EffectIndex`, `MapID`, `PositionX`, `PositionY`, `PositionZ`, `Orientation`) VALUES +(69123, 0, 654, -1815.9, 2283.85, 42.4066, 2.47837); + -- Template Updates 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 `flags_extra`= 128 WHERE `entry` IN (36198, 36449); 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); -DELETE FROM `creature_text` WHERE `CreatureID` IN (36330, 36331, 36332, 36231, 36287, 36288, 36289); +DELETE FROM `creature_text` WHERE `CreatureID` IN (36330, 36331, 36332, 36231, 36287, 36288, 36289, 36290, 36291, 36283); INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `Comment`) VALUES -- Chapter Two Intro (36330, 0, 0, 'Give it up, Krennan. It''s time to put this one down. It''s protocol.', 12, 0, 100, 274, 0, 19635, 36336, 'Lord Godfrey to Player'), @@ -159,7 +110,12 @@ INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Lan -- Save the Children (36287, 0, 0, 'You are scary! I just want my mommy!', 12, 0, 100, 0, 0, 0, 36325, 'Cynthia to Player'), (36288, 0, 0, 'Are you one of the good worgen, $g mister:ma''am;? Did you see Cynthia hiding in the sheds outside?', 12, 0, 100, 0, 0, 0, 36326, 'Ashley to Player'), -(36289, 0, 0, 'Don''t hurt me! I was just looking for my sisters! I think Ashley''s inside that house!', 12, 0, 100, 0, 0, 0, 36324, 'James to Player'); +(36289, 0, 0, 'Don''t hurt me! I was just looking for my sisters! I think Ashley''s inside that house!', 12, 0, 100, 0, 0, 0, 36324, 'James to Player'), +-- Leader of the Pack +(36290, 0, 0, 'Hold your positions, men!', 14, 0, 100, 0, 0, 0, 36632, 'Lord Godfrey to Player'), +(36291, 0, 0, 'What''s happening?!', 12, 0, 100, 430, 0, 0, 36633, 'Melinda Hammond to Player'), +-- Forsaken Catapult +(36283, 0, 0, 'You must return to the Duskmist Shore!', 42, 0, 100, 0, 0, 0, 50651, 'Forsaken Catapult to Player'); DELETE FROM `waypoints` WHERE `entry`= 36330; INSERT INTO `waypoints` (`entry`, `pointid`, `position_x`, `position_y`, `position_z`) VALUES @@ -181,32 +137,41 @@ UPDATE `quest_template_addon` SET `ExclusiveGroup`= -14369 WHERE `ID` IN (14369, UPDATE `gameobject_template` SET `ScriptName`= 'go_gilneas_invasion_camera' WHERE `entry`= 197337; +-- GameObject addons DELETE FROM `gameobject_template_addon` WHERE `entry` IN (196394, 196403); INSERT INTO `gameobject_template_addon` (`entry`, `flags`) VALUES (196394, 4), (196403, 4); +UPDATE `gameobject_template_addon` SET `flags`= 16 WHERE `entry` IN (196411, 196404, 206693, 197333); + -- Sparring Entries -DELETE FROM `creature_sparring_template` WHERE `AttackerEntry` IN (36211, 36140, 34511); +DELETE FROM `creature_sparring_template` WHERE `AttackerEntry` IN (36211, 36140, 34511, 36236); INSERT INTO `creature_sparring_template` (`AttackerEntry`, `VictimEntry`, `HealthLimitPct`) VALUES (36211, 34511, 90), +(36211, 36236, 90), (36140, 34511, 100), (34511, 36211, 90), -(34511, 36140, 100); +(34511, 36140, 100), +(36236, 36211, 100); -- Spells DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_gilneas_quest_save_the_children', 'spell_gilneas_quest_save_james', 'spell_gilneas_launch', -'spell_gilneas_call_attack_mastiff'); +'spell_gilneas_call_attack_mastiff', +'spell_gilneas_fiery_boulder', +'spell_gilneas_forcecast_cataclysm_1'); 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'), (68659, 'spell_gilneas_launch'), -(68682, 'spell_gilneas_call_attack_mastiff'); +(68682, 'spell_gilneas_call_attack_mastiff'), +(68591, 'spell_gilneas_fiery_boulder'), +(69027, 'spell_gilneas_forcecast_cataclysm_1'); -- Creature Krennan Aranas 36331 SAI SET @ENTRY := 36331; @@ -224,6 +189,9 @@ INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_ (3633100,9,2,0,0,0,100,0,4700,4700,0,0,11,68635,0,0,0,0,0,23,0,0,0,0,0,0,0,""), (3633100,9,3,0,0,0,100,0,8400,8400,0,0,11,68636,0,0,0,0,0,23,0,0,0,0,0,0,0,""); +-- Random movement for Horrid Abomination +UPDATE `creature` SET `MovementType`= 1, `spawndist`= 6 WHERE `id`= 36231; + -- Creature Lord Godfrey 36330 SAI SET @ENTRY := 36330; UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`= @ENTRY; @@ -307,5 +275,12 @@ 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 // "); +(@ENTRY, 0, 1, 2, 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 // "), +(@ENTRY, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, 10, 255676, 0, 0, 0, 0, 0, 0, " Linked - Creature Melinda Hammond 36291 (255676): Talk 0 // "); +-- Creature Forsaken Footsoldier 36236 SAI +SET @ENTRY := 36236; +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, 1, 0, 100, 0, 0, 0, 6000, 6000, 49, 0, 0, 0, 0, 0, 0, 19, 36211, 10, 0, 0, 0, 0, 0, "When out of combat and timer at the begining between 0 and 0 ms (and later repeats every 6000 and 6000 ms) - Self: Attack Closest alive creature Duskhaven Watchman (36211) in 10 yards // "); diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 421ee1a78f7..e23d3af5cee 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -4557,9 +4557,10 @@ void SpellMgr::LoadSpellInfoCorrections() // GILNEAS SPELLS // // Curse of the Worgen + // HACK! Correct handling requires high visbility distances ApplySpellFix({ 69123 }, [](SpellInfo* spellInfo) { - spellInfo->RangeEntry = sSpellRangeStore.LookupEntry(13); // 50000yd + spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_DEST_DB); }); // Forcecast summon personal Godfrey @@ -4568,7 +4569,6 @@ void SpellMgr::LoadSpellInfoCorrections() spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_SUMMONER); }); - // ENDOF GILNEAS SPELLS for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i) diff --git a/src/server/scripts/EasternKingdoms/Gilneas/chapter2.cpp b/src/server/scripts/EasternKingdoms/Gilneas/chapter2.cpp index fde29d954fe..e9244fc4bfc 100644 --- a/src/server/scripts/EasternKingdoms/Gilneas/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/Gilneas/chapter2.cpp @@ -32,10 +32,6 @@ #include "GameObjectAI.h" #include "GameObject.h" -/*###### -## Quest 14320 - In Need of Ingredients -######*/ - enum GilneasInvasionCamera { CINEMATIC_FORSAKEN_INVASION = 168 @@ -72,6 +68,7 @@ enum HorridAbomination SPELL_RANDOM_CIRCUMFERENCE_BONE = 42267, SPELL_RANDOM_CIRCUMFERENCE_BONE_2 = 42274, SPELL_HORRID_ABOMINATION_EXPLOSION = 68560, + SPELL_RESTITCHING = 68864, QUEST_HORRID_ABOMINATION_CREDIT = 36233, @@ -113,6 +110,7 @@ class npc_gilneas_horrid_abomination : public CreatureScript Talk(SAY_KEG_PLACED); me->AttackStop(); me->SetReactState(REACT_PASSIVE); + me->GetMotionMaster()->Clear(); _playerGUID = caster->GetGUID(); _allowEvents = true; _events.ScheduleEvent(EVENT_ABOMINATION_KILL_ME, Seconds(2)); @@ -141,6 +139,16 @@ class npc_gilneas_horrid_abomination : public CreatureScript } } + void DamageTaken(Unit* /*attacker*/, uint32& damage) override + { + if (damage >= me->GetHealth()) + { + damage = 0; + if (!me->HasUnitState(UNIT_STATE_CASTING) && !me->HasAura(SPELL_RESTITCHING)) + DoCastSelf(SPELL_RESTITCHING); + } + } + void UpdateAI(uint32 diff) override { if (!UpdateVictim() && !_allowEvents) @@ -419,11 +427,16 @@ enum ForsakenCatapult SPELL_FIERY_BOULDER = 68591, SPELL_LAUNCH_INTERNAL = 96114, SPELL_LAUNCH_INTERNAL_2 = 96185, - SPELL_LAUNCH_1 = 68659, - SPELL_LAUNCH_2 = 66251, + SPELL_LAUNCH = 66251, EVENT_FIERY_BOULDER = 1, - SEAT_0 = 0 + EVENT_CHECK_AREA = 2, + + SEAT_0 = 0, + + SAY_WARN_OUT_OF_AREA = 0, + + AREA_ID_DUSKMIST_SHORE = 5720 }; class npc_gilneas_forsaken_catapult : public CreatureScript @@ -433,7 +446,21 @@ class npc_gilneas_forsaken_catapult : public CreatureScript struct npc_gilneas_forsaken_catapultAI : public VehicleAI { - npc_gilneas_forsaken_catapultAI(Creature* creature) : VehicleAI(creature) { } + npc_gilneas_forsaken_catapultAI(Creature* creature) : VehicleAI(creature) + { + Initialize(); + } + + void Initialize() + { + _preparedDespawn = false; + } + + void Reset() + { + Initialize(); + _events.ScheduleEvent(EVENT_FIERY_BOULDER, Milliseconds(1), Seconds(7)); + } void PassengerBoarded(Unit* passenger, int8 /*seatId*/, bool apply) override { @@ -453,10 +480,13 @@ class npc_gilneas_forsaken_catapult : public CreatureScript { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFaction(FACTION_FRIENDLY); + _events.CancelEvent(EVENT_FIERY_BOULDER); } } else if (passenger->GetTypeId() == TYPEID_PLAYER && !apply) me->DespawnOrUnsummon(Seconds(9)); + else if (passenger->GetTypeId() == TYPEID_PLAYER && apply) + _events.ScheduleEvent(EVENT_CHECK_AREA, Milliseconds(1)); } void SpellHit(Unit* caster, SpellInfo const* spell) override @@ -480,7 +510,7 @@ class npc_gilneas_forsaken_catapult : public CreatureScript { switch (spell->Id) { - case SPELL_LAUNCH_2: + case SPELL_LAUNCH: if (target->GetVehicleCreatureBase()) { Position pos = target->GetPosition(); @@ -503,6 +533,36 @@ class npc_gilneas_forsaken_catapult : public CreatureScript switch (eventId) { case EVENT_FIERY_BOULDER: + DoCastAOE(SPELL_FIERY_BOULDER); + _events.Repeat(Seconds(7), Seconds(8)); + break; + case EVENT_CHECK_AREA: + if (me->GetAreaId() != AREA_ID_DUSKMIST_SHORE) + { + if (!_preparedDespawn) + { + if (Vehicle* vehicle = me->GetVehicleKit()) + if (Unit* passenger = vehicle->GetPassenger(SEAT_0)) + Talk(SAY_WARN_OUT_OF_AREA, passenger); + + _preparedDespawn = true; + + } + else + me->DespawnOrUnsummon(); + + _events.Repeat(Seconds(10)); + } + else + { + if (_preparedDespawn) + { + _preparedDespawn = false; + _events.Repeat(Seconds(2)); + } + else + _events.Repeat(Seconds(2)); + } break; default: break; @@ -513,6 +573,7 @@ class npc_gilneas_forsaken_catapult : public CreatureScript private: EventMap _events; Position _targetPos; + bool _preparedDespawn; }; CreatureAI* GetAI(Creature* creature) const override @@ -523,26 +584,26 @@ class npc_gilneas_forsaken_catapult : public CreatureScript class spell_gilneas_launch : public SpellScriptLoader { -public: - spell_gilneas_launch() : SpellScriptLoader("spell_gilneas_launch") { } + public: + spell_gilneas_launch() : SpellScriptLoader("spell_gilneas_launch") { } - class spell_gilneas_launch_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gilneas_launch_SpellScript); - - void TransferDestination(SpellEffIndex /*effIndex*/) + class spell_gilneas_launch_SpellScript : public SpellScript { - 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()); - } + PrepareSpellScript(spell_gilneas_launch_SpellScript); - void Register() - { - OnEffectLaunch += SpellEffectFn(spell_gilneas_launch_SpellScript::TransferDestination, EFFECT_0, SPELL_EFFECT_DUMMY); - } + 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 @@ -551,9 +612,60 @@ public: } }; +class FireBoulderInFrontCheck +{ + public: + FireBoulderInFrontCheck(Unit* _caster) : caster(_caster) { } + + bool operator()(WorldObject* object) + { + if (Unit* target = object->ToUnit()) + return (!caster->isInFront(target, float(M_PI * 0.3f))); + + return false; + } + private: + Unit* caster; + +}; + +class spell_gilneas_fiery_boulder : public SpellScriptLoader +{ + public: + spell_gilneas_fiery_boulder() : SpellScriptLoader("spell_gilneas_fiery_boulder") { } + + class spell_gilneas_fiery_boulder_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gilneas_fiery_boulder_SpellScript); + + void FilterTargets(std::list& targets) + { + if (targets.empty()) + return; + + targets.remove_if(FireBoulderInFrontCheck(GetCaster())); + + if (targets.empty()) + return; + + Trinity::Containers::RandomResize(targets, 1); + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_gilneas_fiery_boulder_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_gilneas_fiery_boulder_SpellScript(); + } +}; + enum LeaderOfThePack { - NPC_ATTACK_MASTIFF = 36405 + NPC_ATTACK_MASTIFF = 36405 }; Position const AttackMastiffSummonPositions[] = @@ -601,6 +713,34 @@ class spell_gilneas_call_attack_mastiff : public SpellScriptLoader } }; +class spell_gilneas_forcecast_cataclysm_1 : public SpellScriptLoader +{ + public: + spell_gilneas_forcecast_cataclysm_1() : SpellScriptLoader("spell_gilneas_forcecast_cataclysm_1") { } + + class spell_gilneas_forcecast_cataclysm_1_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gilneas_forcecast_cataclysm_1_SpellScript); + + void HandleForcecast(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Unit* caster = GetCaster()) + caster->CastSpell(caster, GetSpellInfo()->Effects[effIndex].TriggerSpell, true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_gilneas_forcecast_cataclysm_1_SpellScript::HandleForcecast, EFFECT_0, SPELL_EFFECT_FORCE_CAST); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gilneas_forcecast_cataclysm_1_SpellScript(); + } +}; + void AddSC_gilneas_c2() { new go_gilneas_invasion_camera(); @@ -612,5 +752,7 @@ void AddSC_gilneas_c2() new spell_gilneas_quest_save_james(); new spell_gilneas_quest_save_the_children(); new spell_gilneas_launch(); + new spell_gilneas_fiery_boulder(); new spell_gilneas_call_attack_mastiff(); + new spell_gilneas_forcecast_cataclysm_1(); }