aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/world/master/2023_09_07_00_world.sql213
-rw-r--r--src/server/game/Spells/SpellMgr.cpp19
-rw-r--r--src/server/scripts/BrokenIsles/zone_mardum.cpp568
3 files changed, 799 insertions, 1 deletions
diff --git a/sql/updates/world/master/2023_09_07_00_world.sql b/sql/updates/world/master/2023_09_07_00_world.sql
new file mode 100644
index 00000000000..a5abeab9a4d
--- /dev/null
+++ b/sql/updates/world/master/2023_09_07_00_world.sql
@@ -0,0 +1,213 @@
+-- Conversation
+DELETE FROM `conversation_actors` WHERE (`ConversationId`=922 AND `Idx` IN (2,1,0));
+INSERT INTO `conversation_actors` (`ConversationId`, `ConversationActorId`, `Idx`, `CreatureId`, `CreatureDisplayInfoId`, `NoActorObject`, `ActivePlayerObject`, `VerifiedBuild`) VALUES
+(922, 50662, 2, 0, 0, 0, 0, 50622), -- Full: 0x203AE8B9205FFD0000062700004BB5D8 Creature/0 R3770/S1575 Map: 1481 (Mardum) Entry: 98292 (Kor'vas Bloodthorn) Low: 4961752
+(922, 48466, 1, 0, 0, 0, 0, 50622), -- Full: 0x203AE8B9205AD4C000062700004BB5D8 Creature/0 R3770/S1575 Map: 1481 (Mardum) Entry: 93011 (Kayn Sunfury) Low: 4961752
+(922, 0, 0, 0, 0, 0, 1, 50622); -- Full: 0x0800040000000000FFFFFFFFFFFFFFFF Player/0 R1/S16777215 Map: 0 (Eastern Kingdoms) Low: 1099511627775
+
+DELETE FROM `conversation_line_template` WHERE `Id` IN (2289, 2288, 2287, 2529);
+INSERT INTO `conversation_line_template` (`Id`, `UiCameraID`, `ActorIdx`, `Flags`, `ChatType`, `VerifiedBuild`) VALUES
+(2289, 0, 2, 0, 1, 50622),
+(2288, 0, 1, 0, 0, 50622),
+(2287, 0, 1, 0, 0, 50622),
+(2529, 0, 0, 0, 0, 50622);
+
+DELETE FROM `conversation_template` WHERE `Id`=922;
+INSERT INTO `conversation_template` (`Id`, `FirstLineID`, `TextureKitId`, `VerifiedBuild`) VALUES
+(922, 2529, 0, 50622);
+
+-- Quest stuff
+DELETE FROM `quest_details` WHERE `ID`=40077;
+INSERT INTO `quest_details` (`ID`, `Emote1`, `Emote2`, `Emote3`, `Emote4`, `EmoteDelay1`, `EmoteDelay2`, `EmoteDelay3`, `EmoteDelay4`, `VerifiedBuild`) VALUES
+(40077, 0, 0, 0, 0, 0, 0, 0, 0, 50622); -- The Invasion Begins
+
+DELETE FROM `creature_queststarter` WHERE (`id`=93011 AND `quest`=40077);
+INSERT INTO `creature_queststarter` (`id`, `quest`, `VerifiedBuild`) VALUES
+(93011, 40077, 50622); -- The Invasion Begins offered Kayn Sunfury
+
+-- Creature Difficulty
+DELETE FROM `creature_template_difficulty` WHERE (`Entry`=94580 AND `DifficultyID`=0);
+INSERT INTO `creature_template_difficulty` (`Entry`, `DifficultyID`, `LevelScalingDeltaMin`, `LevelScalingDeltaMax`, `ContentTuningID`, `HealthScalingExpansion`, `HealthModifier`, `ManaModifier`, `CreatureDifficultyID`, `TypeFlags`, `TypeFlags2`, `VerifiedBuild`) VALUES
+(94580, 0, 0, 0, 699, 6, 1, 1, 94555, 0, 0, 50622); -- Wrath Warrior
+
+-- Creature Equip
+DELETE FROM `creature_equip_template` WHERE (`CreatureID`=94580 AND `ID`=1);
+INSERT INTO `creature_equip_template` (`CreatureID`, `ID`, `ItemID1`, `AppearanceModID1`, `ItemVisual1`, `ItemID2`, `AppearanceModID2`, `ItemVisual2`, `ItemID3`, `AppearanceModID3`, `ItemVisual3`, `VerifiedBuild`) VALUES
+(94580, 1, 127651, 0, 0, 0, 0, 0, 0, 0, 0, 50622); -- Wrath Warrior
+
+-- Creature Template
+UPDATE `creature_template` SET `faction`=954, `BaseAttackTime`=2000, `unit_flags`=32768, `unit_flags2`=33556480, `unit_flags3`=524288, `flags_extra` = 536870912 WHERE `entry`=94580; -- Wrath Warrior
+
+-- Creature Template Addon
+DELETE FROM `creature_template_addon` WHERE `entry` IN (94580);
+INSERT INTO `creature_template_addon` (`entry`, `path_id`, `mount`, `StandState`, `AnimTier`, `VisFlags`, `SheathState`, `PvpFlags`, `emote`, `aiAnimKit`, `movementAnimKit`, `meleeAnimKit`, `visibilityDistanceType`, `auras`) VALUES
+(94580, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 5, ''); -- 94580 (Wrath Warrior)
+
+-- Update Condition for Phase 4899
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=26 AND `SourceGroup` = 4899 AND `SourceEntry` = 0;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `Comment`) VALUES
+(26, 4899, 0, 0, 0, 47, 0, 40076, 64, 0, 0, 'Apply Phase 4899 if Quest 40076 is rewarded'),
+(26, 4899, 0, 0, 0, 47, 0, 40077, 2 | 8 | 64, 0, 1, 'Apply Phase 4899 if Quest 40076 is not in progress | complete | rewarded');
+
+-- Update Scripts
+UPDATE `creature_template` SET `AIName` = '', `ScriptName` = 'npc_kayn_sunfury_invasion_begins' WHERE `entry` = 93011;
+UPDATE `creature_template` SET `AIName` = '', `ScriptName` = 'npc_jayce_darkweaver_invasion_begins' WHERE `entry` = 98228;
+UPDATE `creature_template` SET `AIName` = '', `ScriptName` = 'npc_allari_the_souleater_invasion_begins' WHERE `entry` = 98227;
+UPDATE `creature_template` SET `AIName` = '', `ScriptName` = 'npc_korvas_bloodthorn_invasion_begins' WHERE `entry` = 98292;
+UPDATE `creature_template` SET `AIName` = '', `ScriptName` = 'npc_sevis_brightflame_invasion_begins' WHERE `entry` = 99918;
+UPDATE `creature_template` SET `AIName` = '', `ScriptName` = 'npc_cyana_nightglaive_invasion_begins' WHERE `entry` = 98290;
+UPDATE `creature_template` SET `AIName` = '', `ScriptName` = 'npc_illidari_fighting_invasion_begins' WHERE `entry` IN (98459, 98458, 98456, 98460, 99919, 98457);
+UPDATE `conversation_template` SET `ScriptName` = 'conversation_the_invasion_begins' WHERE `Id` = 922;
+
+-- Serverside Spells
+DELETE FROM `serverside_spell` WHERE `Id` = 175799;
+INSERT INTO `serverside_spell` (`Id`, `DifficultyID`, `CategoryId`, `Dispel`, `Mechanic`, `Attributes`, `AttributesEx`, `AttributesEx2`, `AttributesEx3`, `AttributesEx4`, `AttributesEx5`, `AttributesEx6`, `AttributesEx7`, `AttributesEx8`, `AttributesEx9`, `AttributesEx10`, `AttributesEx11`, `AttributesEx12`, `AttributesEx13`, `AttributesEx14`, `Stances`, `StancesNot`, `Targets`, `TargetCreatureType`, `RequiresSpellFocus`, `FacingCasterFlags`, `CasterAuraState`, `TargetAuraState`, `ExcludeCasterAuraState`, `ExcludeTargetAuraState`, `CasterAuraSpell`, `TargetAuraSpell`, `ExcludeCasterAuraSpell`, `ExcludeTargetAuraSpell`, `CasterAuraType`, `TargetAuraType`, `ExcludeCasterAuraType`, `ExcludeTargetAuraType`, `CastingTimeIndex`, `RecoveryTime`, `CategoryRecoveryTime`, `StartRecoveryCategory`, `StartRecoveryTime`, `InterruptFlags`, `AuraInterruptFlags1`, `AuraInterruptFlags2`, `ChannelInterruptFlags1`, `ChannelInterruptFlags2`, `ProcFlags`, `ProcFlags2`, `ProcChance`, `ProcCharges`, `ProcCooldown`, `ProcBasePPM`, `MaxLevel`, `BaseLevel`, `SpellLevel`, `DurationIndex`, `RangeIndex`, `Speed`, `LaunchDelay`, `StackAmount`, `EquippedItemClass`, `EquippedItemSubClassMask`, `EquippedItemInventoryTypeMask`, `ContentTuningId`, `SpellName`, `ConeAngle`, `ConeWidth`, `MaxTargetLevel`, `MaxAffectedTargets`, `SpellFamilyName`, `SpellFamilyFlags1`, `SpellFamilyFlags2`, `SpellFamilyFlags3`, `SpellFamilyFlags4`, `DmgClass`, `PreventionType`, `AreaGroupId`, `SchoolMask`, `ChargeCategoryId`) VALUES
+(175799, 0, 0, 0, 0, 0, (0x00000004 | 0x00004000), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, (0x00000008), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 13, 0, 0, 0, -1, 0, 0, 0, '(Serverside/Non-DB2) Generic - Track Target in Channel (Not Unique)', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+
+DELETE FROM `serverside_spell_effect` WHERE `SpellID` = 175799;
+INSERT INTO `serverside_spell_effect` (`SpellID`, `EffectIndex`, `DifficultyID`, `Effect`, `EffectAura`, `EffectAmplitude`, `EffectAttributes`, `EffectAuraPeriod`, `EffectBonusCoefficient`, `EffectChainAmplitude`, `EffectChainTargets`, `EffectItemType`, `EffectMechanic`, `EffectPointsPerResource`, `EffectPosFacing`, `EffectRealPointsPerLevel`, `EffectTriggerSpell`, `BonusCoefficientFromAP`, `PvpMultiplier`, `Coefficient`, `Variance`, `ResourceCoefficient`, `GroupSizeBasePointsCoefficient`, `EffectBasePoints`, `EffectMiscValue1`, `EffectMiscValue2`, `EffectRadiusIndex1`, `EffectRadiusIndex2`, `EffectSpellClassMask1`, `EffectSpellClassMask2`, `EffectSpellClassMask3`, `EffectSpellClassMask4`, `ImplicitTarget1`, `ImplicitTarget2`) VALUES
+(175799, 0, 0, 6, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 0);
+
+ -- Wrath Warrior smart ai
+SET @ENTRY := 94580;
+UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE `entry` = @ENTRY;
+DELETE FROM `smart_scripts` WHERE `source_type` = 0 AND `entryOrGuid` = @ENTRY;
+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, 53, 1, 9458000, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'On just created - Self: Start path #9458000, run, do not repeat, Passive');
+
+-- Waypoints for Illidari
+SET @ENTRY := 98228; -- Jayce Darkweaver
+SET @PATHOFFSET := 0;
+SET @PATH := @ENTRY * 100 + @PATHOFFSET;
+DELETE FROM `waypoint_data` WHERE `id`= @PATH;
+INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`) VALUES
+(@PATH, 0, 1159.479, 3209.122, 50.16586, NULL, 0, 1),
+(@PATH, 1, 1146.019, 3207.825, 46.61276, NULL, 0, 1),
+(@PATH, 2, 1137.608, 3206.883, 43.31707, NULL, 324, 1);
+
+SET @ENTRY := 98228;
+SET @PATHOFFSET := 1;
+SET @PATH := @ENTRY * 100 + @PATHOFFSET;
+DELETE FROM `waypoint_data` WHERE `id`= @PATH;
+INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`) VALUES
+(@PATH, 0, 1119.24, 3203.42, 38.1061, NULL, 404, 1),
+(@PATH, 1, 1106.443, 3197.732, 34.12574, NULL, 0, 1),
+(@PATH, 2, 1098.535, 3194.377, 31.75129, NULL, 0, 1),
+(@PATH, 3, 1087.286, 3189.897, 27.46083, NULL, 0, 1),
+(@PATH, 4, 1081.759, 3187.692, 26.16743, NULL, 0, 1),
+(@PATH, 5, 1068.651, 3181.97, 22.13405, NULL, 0, 1),
+(@PATH, 6, 1060.307, 3176.874, 19.37006, NULL, 0, 1);
+
+-- Kayn Sunfury
+SET @ENTRY := 93011;
+SET @PATHOFFSET := 0;
+SET @PATH := @ENTRY * 100 + @PATHOFFSET;
+DELETE FROM `waypoint_data` WHERE `id`= @PATH;
+INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`) VALUES
+(@PATH, 0, 1095.367, 3186.3792, 29.398575, NULL, 0, 1),
+(@PATH, 1, 1096.117, 3186.6292, 29.898575, NULL, 0, 1),
+(@PATH, 2, 1096.995, 3186.7002, 29.981531, NULL, 0, 1);
+
+SET @ENTRY := 93011;
+SET @PATHOFFSET := 1;
+SET @PATH := @ENTRY * 100 + @PATHOFFSET;
+DELETE FROM `waypoint_data` WHERE `id`= @PATH;
+INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`) VALUES
+(@PATH, 0, 1069.715, 3177.44, 21.46352, NULL, 3000, 1),
+(@PATH, 1, 1063.477, 3172.725, 18.63585, NULL, 0, 1);
+
+-- Allari the Souleater
+SET @ENTRY := 98227;
+SET @PATHOFFSET := 0;
+SET @PATH := @ENTRY * 100 + @PATHOFFSET;
+DELETE FROM `waypoint_data` WHERE `id`= @PATH;
+INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`) VALUES
+(@PATH, 0, 1150.981, 3205.185, 47.57572, NULL, 0, 1),
+(@PATH, 1, 1142.78, 3203.735, 44.76439, NULL, 366, 1);
+
+SET @ENTRY := 98227;
+SET @PATHOFFSET := 1;
+SET @PATH := @ENTRY * 100 + @PATHOFFSET;
+DELETE FROM `waypoint_data` WHERE `id`= @PATH;
+INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`) VALUES
+(@PATH, 0, 1120.08, 3197.2, 36.8502, NULL, 320, 1),
+(@PATH, 1, 1098.106, 3190.198, 30.81477, NULL, 0, 1),
+(@PATH, 2, 1087.92, 3186.326, 27.1753, NULL, 0, 1),
+(@PATH, 3, 1083.852, 3184.756, 26.13717, NULL, 0, 1),
+(@PATH, 4, 1076.007, 3181.132, 23.98388, NULL, 0, 1),
+(@PATH, 5, 1065.649, 3175.742, 19.78723, NULL, 0, 1),
+(@PATH, 6, 1055.398, 3167.896, 17.91369, NULL, 0, 1),
+(@PATH, 7, 1054.142, 3166.28, 17.57548, NULL, 0, 1);
+
+-- Kor'vas Bloodthorn
+SET @ENTRY := 98292;
+SET @PATHOFFSET := 0;
+SET @PATH := @ENTRY * 100 + @PATHOFFSET;
+DELETE FROM `waypoint_data` WHERE `id`= @PATH;
+INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`) VALUES
+(@PATH, 0, 1155.078, 3204.171, 48.49304, NULL, 0, 1),
+(@PATH, 1, 1138.806, 3200.725, 42.95776, NULL, 213, 1);
+
+SET @ENTRY := 98292;
+SET @PATHOFFSET := 1;
+SET @PATH := @ENTRY * 100 + @PATHOFFSET;
+DELETE FROM `waypoint_data` WHERE `id`= @PATH;
+INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`) VALUES
+(@PATH, 0, 1117.89, 3196.24, 36.2158, NULL, 237, 1),
+(@PATH, 1, 1100.179, 3189.184, 31.32025, NULL, 0, 1),
+(@PATH, 2, 1092.804, 3186.828, 28.65943, NULL, 0, 1),
+(@PATH, 3, 1079.504, 3181.279, 24.81245, NULL, 0, 1),
+(@PATH, 4, 1065.17, 3172.552, 18.92646, NULL, 0, 1),
+(@PATH, 5, 1058.738, 3166.632, 17.96959, NULL, 0, 1);
+
+-- Sevis Brightflame
+SET @ENTRY := 99918;
+SET @PATHOFFSET := 0;
+SET @PATH := @ENTRY * 100 + @PATHOFFSET;
+DELETE FROM `waypoint_data` WHERE `id`= @PATH;
+INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`) VALUES
+(@PATH, 0, 1150.524, 3206.556, 47.50604, NULL, 0, 1),
+(@PATH, 1, 1140.031, 3203.963, 43.88533, NULL, 93, 1);
+
+SET @ENTRY := 99918;
+SET @PATHOFFSET := 1;
+SET @PATH := @ENTRY * 100 + @PATHOFFSET;
+DELETE FROM `waypoint_data` WHERE `id`= @PATH;
+INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`) VALUES
+(@PATH, 0, 1120.74, 3199.47, 37.5157, NULL, 278, 1),
+(@PATH, 1, 1101.424, 3194.313, 32.54323, NULL, 0, 1),
+(@PATH, 2, 1088.533, 3188.805, 27.74644, NULL, 0, 1),
+(@PATH, 3, 1075.568, 3183.056, 24.12158, NULL, 0, 1),
+(@PATH, 4, 1065.212, 3177.734, 19.99919, NULL, 0, 1),
+(@PATH, 5, 1059.837, 3173.674, 19.00958, NULL, 0, 1);
+
+-- Cyana Nightglaive
+SET @ENTRY := 98290;
+SET @PATHOFFSET := 0;
+SET @PATH := @ENTRY * 100 + @PATHOFFSET;
+DELETE FROM `waypoint_data` WHERE `id`= @PATH;
+INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`) VALUES
+(@PATH, 0, 1154.392, 3203.176, 48.01282, NULL, 0, 1),
+(@PATH, 1, 1144.257, 3200.841, 44.53834, NULL, 159, 1);
+
+SET @ENTRY := 98290;
+SET @PATHOFFSET := 1;
+SET @PATH := @ENTRY * 100 + @PATHOFFSET;
+DELETE FROM `waypoint_data` WHERE `id`= @PATH;
+INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`) VALUES
+(@PATH, 0, 1120.34, 3194.28, 36.4321, NULL, 242, 1),
+(@PATH, 1, 1104.913, 3188.93, 32.40257, NULL, 0, 1),
+(@PATH, 2, 1096.353, 3186.152, 29.55845, NULL, 0, 1),
+(@PATH, 3, 1090.165, 3183.755, 27.35834, NULL, 0, 1),
+(@PATH, 4, 1081.186, 3180.038, 25.01144, NULL, 0, 1),
+(@PATH, 5, 1064.868, 3170.523, 18.56903, NULL, 0, 1),
+(@PATH, 6, 1059.193, 3164.68, 17.53739, NULL, 0, 1);
+
+-- Wrath Warrior
+SET @ENTRY := 94580;
+SET @PATHOFFSET := 0;
+SET @PATH := @ENTRY * 100 + @PATHOFFSET;
+DELETE FROM `waypoint_data` WHERE `id`= @PATH;
+INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`) VALUES
+(@PATH, 0, 1088.1326, 3184.2913, 27.202965, NULL, 0),
+(@PATH, 1, 1098.8898, 3187.22, 30.489897, NULL, 0);
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index 9b09bb4abb3..72ad8ccd7fa 100644
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -4628,7 +4628,24 @@ void SpellMgr::LoadSpellInfoCorrections()
{
spellInfo->AuraInterruptFlags |= SpellAuraInterruptFlags::LeaveWorld;
});
- // ENDOF FIRELANDS SPELLS
+ // ENDOF FIRELANDS
+
+ //
+ // MARDUM SPELLS
+ //
+
+ // 187382 - The Invasion Begins: Summon Wrath Warrior
+ ApplySpellFix({ 187382 }, [](SpellInfo* spellInfo)
+ {
+ spellInfo->RangeEntry = sSpellRangeStore.LookupEntry(13); // 50000 yards
+
+ ApplySpellEffectFix(spellInfo, EFFECT_0, [](SpellEffectInfo* spellEffectInfo)
+ {
+ spellEffectInfo->TargetA = SpellImplicitTargetInfo(TARGET_DEST_DEST);
+ });
+ });
+
+ // ENDOF MARDUM SPELLS
//
// ANTORUS THE BURNING THRONE SPELLS
diff --git a/src/server/scripts/BrokenIsles/zone_mardum.cpp b/src/server/scripts/BrokenIsles/zone_mardum.cpp
index 15785185c0d..da64e6ac27c 100644
--- a/src/server/scripts/BrokenIsles/zone_mardum.cpp
+++ b/src/server/scripts/BrokenIsles/zone_mardum.cpp
@@ -15,11 +15,18 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "CellImpl.h"
+#include "Containers.h"
#include "Conversation.h"
+#include "GridNotifiersImpl.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "PhasingHandler.h"
#include "Player.h"
#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "SpellScript.h"
+#include "TemporarySummon.h"
enum MardumSpellData
{
@@ -36,6 +43,12 @@ enum MardumConversationData
CONVO_DEMONHUNTER_INTRO_START = 705
};
+enum MardumSoundData
+{
+ SOUND_METAL_WEAPON_UNSHEATH = 700,
+ SOUND_SPELL_DOUBLE_JUMP = 53780,
+};
+
class scene_demonhunter_intro : public SceneScript
{
public:
@@ -66,8 +79,563 @@ class spell_demon_hunter_intro_aura : public AuraScript
}
};
+enum TheInvasionBeginsQuestData
+{
+ QUEST_THE_INVASION_BEGINS = 40077,
+
+ CONVO_THE_INVASION_BEGINS = 922,
+
+ NPC_KAYN_SUNFURY_INVASION_BEGINS = 93011,
+ NPC_JAYCE_DARKWEAVER_INVASION_BEGINS = 98228,
+ NPC_ALLARI_THE_SOULEATER_INVASION_BEGINS = 98227,
+ NPC_CYANA_NIGHTGLAIVE_INVASION_BEGINS = 98290,
+ NPC_KORVAS_BLOODTHORN_INVASION_BEGINS = 98292,
+ NPC_SEVIS_BRIGHTFLAME_INVASION_BEGINS = 99918,
+ NPC_WRATH_WARRIOR_INVASION_BEGINS = 94580,
+
+ SPELL_THE_INVASION_BEGINS = 187382,
+ SPELL_TRACK_TARGET_IN_CHANNEL = 175799,
+ SPELL_DEMON_HUNTER_GLIDE_STATE = 199303
+};
+
+enum TheInvasionsBeginsWaypointData
+{
+ // Kayn
+ PATH_KAYN_ATTACK_DEMON = 9301100,
+ PATH_KAYN_AFTER_DEMON = 9301101,
+
+ // Path before Jump
+ PATH_JAYCE_INVASION_BEGINS = 9822800,
+ PATH_ALLARI_INVASION_BEGINS = 9822700,
+ PATH_CYANA_INVASION_BEGINS = 9829000,
+ PATH_KORVAS_INVASION_BEGINS = 9829200,
+ PATH_SEVIS_INVASION_BEGINS = 9991800,
+
+ // Path after Jump
+ PATH_JAYCE_JUMP_INVASION_BEGINS = 9822801,
+ PATH_ALLARI_JUMP_INVASION_BEGINS = 9822701,
+ PATH_CYANA_JUMP_INVASION_BEGINS = 9829001,
+ PATH_KORVAS_JUMP_INVASION_BEGINS = 9829201,
+ PATH_SEVIS_JUMP_INVASION_BEGINS = 9991801,
+
+ POINT_ILLIDARI_LAND_POS = 1,
+ POINT_KAYN_TRIGGER_DOUBLE_JUMP = 2,
+ POINT_KAYN_MOVE_TO_DEMON = 3,
+};
+
+enum TheInvasionBeginsAnimKitsData
+{
+ ANIM_DH_WINGS = 58110,
+ ANIM_DH_RUN = 9767,
+ ANIM_DH_RUN_ALLARI = 9180,
+};
+
+enum TheInvasionBeginsVisualData
+{
+ SPELL_VISUAL_KIT_KAYN_GLIDE = 59738,
+ SPELL_VISUAL_KIT_KAYN_WINGS = 59406,
+ SPELL_VISUAL_KIT_KAYN_DOUBLE_JUMP = 58110,
+ SPELL_VISUAL_KIT_KORVAS_JUMP = 63071,
+ SPELL_VISUAL_KIT_WRATH_WARRIOR_DIE = 58476,
+};
+
+Position const WrathWarriorSpawnPosition = { 1081.9166f, 3183.8716f, 26.335993f };
+Position const KaynJumpPos = { 1172.17f, 3202.55f, 54.3479f };
+Position const KaynDoubleJumpPosition = { 1094.2384f, 3186.058f, 28.81562f };
+Position const JayceJumpPos = { 1119.24f, 3203.42f, 38.1061f };
+Position const AllariJumpPos = { 1120.08f, 3197.2f, 36.8502f };
+Position const KorvasJumpPos = { 1117.89f, 3196.24f, 36.2158f };
+Position const SevisJumpPos = { 1120.74f, 3199.47f, 37.5157f };
+Position const CyanaJumpPos = { 1120.34f, 3194.28f, 36.4321f };
+
+// 93011 - Kayn Sunfury
+struct npc_kayn_sunfury_invasion_begins : public ScriptedAI
+{
+ npc_kayn_sunfury_invasion_begins(Creature* creature) : ScriptedAI(creature) { }
+
+ void OnQuestAccept(Player* player, Quest const* quest) override
+ {
+ if (quest->GetQuestId() == QUEST_THE_INVASION_BEGINS)
+ {
+ PhasingHandler::OnConditionChange(player);
+ player->CastSpell(WrathWarriorSpawnPosition, SPELL_THE_INVASION_BEGINS, false);
+ Conversation::CreateConversation(CONVO_THE_INVASION_BEGINS, player, *player, player->GetGUID(), nullptr, false);
+ }
+ }
+
+ void WaypointPathEnded(uint32 /*nodeId*/, uint32 pathId) override
+ {
+ if (pathId == PATH_KAYN_ATTACK_DEMON)
+ {
+ Creature* wrathWarrior = me->FindNearestCreatureWithOptions(100.0f, { .CreatureId = NPC_WRATH_WARRIOR_INVASION_BEGINS, .IgnorePhases = true, .OwnerGuid = me->GetOwnerGUID() });
+ if (!wrathWarrior)
+ return;
+
+ me->SetFacingToObject(wrathWarrior);
+
+ wrathWarrior->SendPlaySpellVisualKit(SPELL_VISUAL_KIT_WRATH_WARRIOR_DIE, 0, 0);
+ wrathWarrior->KillSelf();
+
+ _scheduler.Schedule(600ms, [this](TaskContext /*context*/)
+ {
+ me->GetMotionMaster()->MovePath(PATH_KAYN_AFTER_DEMON, false);
+ });
+ }
+ else if (pathId == PATH_KAYN_AFTER_DEMON)
+ me->DespawnOrUnsummon();
+ }
+
+ void MovementInform(uint32 type, uint32 pointId) override
+ {
+ if (type != EFFECT_MOTION_TYPE)
+ return;
+
+ if (pointId == POINT_KAYN_TRIGGER_DOUBLE_JUMP)
+ {
+ TempSummon* summon = me->ToTempSummon();
+ if (!summon)
+ return;
+ WorldObject* summoner = summon->GetSummoner();
+ if (!summoner)
+ return;
+ Player* summonerPlayer = summoner->ToPlayer();
+ if (!summonerPlayer)
+ return;
+
+ me->SendPlaySpellVisualKit(SPELL_VISUAL_KIT_KAYN_WINGS, 4, 3000);
+ me->PlayObjectSound(SOUND_SPELL_DOUBLE_JUMP, me->GetGUID(), summonerPlayer);
+ me->SendPlaySpellVisualKit(SPELL_VISUAL_KIT_KAYN_DOUBLE_JUMP, 0, 0);
+ me->GetMotionMaster()->MoveJumpWithGravity(KaynDoubleJumpPosition, 24.0, 0.9874f, POINT_KAYN_MOVE_TO_DEMON);
+ }
+ else if (pointId == POINT_KAYN_MOVE_TO_DEMON)
+ {
+ me->SetAIAnimKitId(ANIM_DH_RUN);
+ me->GetMotionMaster()->MovePath(PATH_KAYN_ATTACK_DEMON, false, {}, 4.0f);
+ }
+ }
+
+ void UpdateAI(uint32 diff) override
+ {
+ _scheduler.Update(diff);
+ }
+
+private:
+ TaskScheduler _scheduler;
+};
+
+// 98228 - Jayce Darkweaver
+struct npc_jayce_darkweaver_invasion_begins : public ScriptedAI
+{
+ npc_jayce_darkweaver_invasion_begins(Creature* creature) : ScriptedAI(creature) { }
+
+ void WaypointPathEnded(uint32 /*nodeId*/, uint32 pathId) override
+ {
+ if (pathId == PATH_JAYCE_INVASION_BEGINS)
+ {
+ me->CastSpell(nullptr, SPELL_DEMON_HUNTER_GLIDE_STATE, true);
+ me->GetMotionMaster()->MoveJumpWithGravity(JayceJumpPos, 12.0f, 15.2792f, POINT_ILLIDARI_LAND_POS);
+ }
+ else if (pathId == PATH_JAYCE_JUMP_INVASION_BEGINS)
+ me->DespawnOrUnsummon();
+ }
+
+ void MovementInform(uint32 type, uint32 pointId) override
+ {
+ if (type != EFFECT_MOTION_TYPE)
+ return;
+
+ if (pointId == POINT_ILLIDARI_LAND_POS)
+ {
+ me->RemoveAurasDueToSpell(SPELL_DEMON_HUNTER_GLIDE_STATE);
+ me->GetMotionMaster()->MovePath(PATH_JAYCE_JUMP_INVASION_BEGINS, false);
+ }
+ }
+};
+
+// 98227 - Allari the Souleater
+struct npc_allari_the_souleater_invasion_begins : public ScriptedAI
+{
+ npc_allari_the_souleater_invasion_begins(Creature* creature) : ScriptedAI(creature) { }
+
+ void WaypointPathEnded(uint32 /*nodeId*/, uint32 pathId) override
+ {
+ if (pathId == PATH_ALLARI_INVASION_BEGINS)
+ {
+ me->CastSpell(nullptr, SPELL_DEMON_HUNTER_GLIDE_STATE, true);
+ me->GetMotionMaster()->MoveJumpWithGravity(AllariJumpPos, 12.0f, 9.2722f, POINT_ILLIDARI_LAND_POS);
+ }
+ else if (pathId == PATH_ALLARI_JUMP_INVASION_BEGINS)
+ me->DespawnOrUnsummon();
+ }
+
+ void MovementInform(uint32 type, uint32 pointId) override
+ {
+ if (type != EFFECT_MOTION_TYPE)
+ return;
+
+ if (pointId == POINT_ILLIDARI_LAND_POS)
+ {
+ me->RemoveAurasDueToSpell(SPELL_DEMON_HUNTER_GLIDE_STATE);
+ me->GetMotionMaster()->MovePath(PATH_ALLARI_JUMP_INVASION_BEGINS, false);
+ }
+ }
+};
+
+// 98292 - Korvas Bloodthorn
+struct npc_korvas_bloodthorn_invasion_begins : public ScriptedAI
+{
+ npc_korvas_bloodthorn_invasion_begins(Creature* creature) : ScriptedAI(creature) { }
+
+ void WaypointPathEnded(uint32 /*nodeId*/, uint32 pathId) override
+ {
+ if (pathId == PATH_KORVAS_INVASION_BEGINS)
+ {
+ me->SendPlaySpellVisualKit(SPELL_VISUAL_KIT_KORVAS_JUMP, 4, 2000);
+ me->GetMotionMaster()->MoveJumpWithGravity(KorvasJumpPos, 24.0f, 19.2911f, POINT_ILLIDARI_LAND_POS);
+ }
+ else if (pathId == PATH_KORVAS_JUMP_INVASION_BEGINS)
+ me->DespawnOrUnsummon();
+ }
+
+ void MovementInform(uint32 type, uint32 pointId) override
+ {
+ if (type != EFFECT_MOTION_TYPE)
+ return;
+
+ if (pointId == POINT_ILLIDARI_LAND_POS)
+ {
+ me->RemoveAurasDueToSpell(SPELL_DEMON_HUNTER_GLIDE_STATE);
+ me->GetMotionMaster()->MovePath(PATH_KORVAS_JUMP_INVASION_BEGINS, false);
+ }
+ }
+};
+
+// 99918 - Sevis Brightflame
+struct npc_sevis_brightflame_invasion_begins : public ScriptedAI
+{
+ npc_sevis_brightflame_invasion_begins(Creature* creature) : ScriptedAI(creature) { }
+
+ void WaypointPathEnded(uint32 /*nodeId*/, uint32 pathId) override
+ {
+ if (pathId == PATH_SEVIS_INVASION_BEGINS)
+ {
+ me->CastSpell(nullptr, SPELL_DEMON_HUNTER_GLIDE_STATE, true);
+ me->GetMotionMaster()->MoveJumpWithGravity(SevisJumpPos, 12.0f, 13.3033f, POINT_ILLIDARI_LAND_POS);
+ }
+ else if (pathId == PATH_SEVIS_JUMP_INVASION_BEGINS)
+ me->DespawnOrUnsummon();
+ }
+
+ void MovementInform(uint32 type, uint32 pointId) override
+ {
+ if (type != EFFECT_MOTION_TYPE)
+ return;
+
+ if (pointId == POINT_ILLIDARI_LAND_POS)
+ {
+ me->RemoveAurasDueToSpell(SPELL_DEMON_HUNTER_GLIDE_STATE);
+ me->GetMotionMaster()->MovePath(PATH_SEVIS_JUMP_INVASION_BEGINS, false);
+ }
+ }
+};
+
+// 98290 - Cyana Nightglaive
+struct npc_cyana_nightglaive_invasion_begins : public ScriptedAI
+{
+ npc_cyana_nightglaive_invasion_begins(Creature* creature) : ScriptedAI(creature) { }
+
+ void WaypointPathEnded(uint32 /*nodeId*/, uint32 pathId) override
+ {
+ if (pathId == PATH_CYANA_INVASION_BEGINS)
+ {
+ me->CastSpell(nullptr, SPELL_DEMON_HUNTER_GLIDE_STATE, true);
+ me->GetMotionMaster()->MoveJumpWithGravity(CyanaJumpPos, 12.0f, 8.4555f, POINT_ILLIDARI_LAND_POS);
+ }
+ else if (pathId == PATH_CYANA_JUMP_INVASION_BEGINS)
+ me->DespawnOrUnsummon();
+ }
+
+ void MovementInform(uint32 type, uint32 pointId) override
+ {
+ if (type != EFFECT_MOTION_TYPE)
+ return;
+
+ if (pointId == POINT_ILLIDARI_LAND_POS)
+ {
+ me->RemoveAurasDueToSpell(SPELL_DEMON_HUNTER_GLIDE_STATE);
+ me->GetMotionMaster()->MovePath(PATH_CYANA_JUMP_INVASION_BEGINS, false);
+ }
+ }
+};
+
+// 922 - The Invasion Begins
+class conversation_the_invasion_begins : public ConversationScript
+{
+public:
+ conversation_the_invasion_begins() : ConversationScript("conversation_the_invasion_begins") { }
+
+ enum TheInvasionBeginsConversationData
+ {
+ CONVO_LINE_TRIGGER_FACING = 2529,
+ CONVO_LINE_START_PATH = 2288,
+
+ CONVO_ACTOR_IDX_KAYN = 1,
+ CONVO_ACTOR_IDX_KORVAS = 2,
+ };
+
+ enum TheInvasionBeginsEventData
+ {
+ EVENT_ILLIDARI_FACE_PLAYERS = 1,
+ EVENT_ILLIDARI_START_PATH
+ };
+
+ void OnConversationCreate(Conversation* conversation, Unit* creator) override
+ {
+ Creature* kaynObject = GetClosestCreatureWithOptions(creator, 10.0f, { .CreatureId = NPC_KAYN_SUNFURY_INVASION_BEGINS, .IgnorePhases = true });
+ Creature* jayceObject = GetClosestCreatureWithOptions(creator, 10.0f, { .CreatureId = NPC_JAYCE_DARKWEAVER_INVASION_BEGINS, .IgnorePhases = true });
+ Creature* allariaObject = GetClosestCreatureWithOptions(creator, 10.0f, { .CreatureId = NPC_ALLARI_THE_SOULEATER_INVASION_BEGINS, .IgnorePhases = true });
+ Creature* cyanaObject = GetClosestCreatureWithOptions(creator, 10.0f, { .CreatureId = NPC_CYANA_NIGHTGLAIVE_INVASION_BEGINS, .IgnorePhases = true });
+ Creature* korvasObject = GetClosestCreatureWithOptions(creator, 10.0f, { .CreatureId = NPC_KORVAS_BLOODTHORN_INVASION_BEGINS, .IgnorePhases = true });
+ Creature* sevisObject = GetClosestCreatureWithOptions(creator, 10.0f, { .CreatureId = NPC_SEVIS_BRIGHTFLAME_INVASION_BEGINS, .IgnorePhases = true });
+ if (!kaynObject || !jayceObject || !allariaObject || !cyanaObject || !korvasObject || !sevisObject)
+ return;
+
+ TempSummon* kaynClone = kaynObject->SummonPersonalClone(kaynObject->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer());
+ TempSummon* jayceClone = jayceObject->SummonPersonalClone(jayceObject->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer());
+ TempSummon* allariaClone = allariaObject->SummonPersonalClone(allariaObject->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer());
+ TempSummon* cyanaClone = cyanaObject->SummonPersonalClone(cyanaObject->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer());
+ TempSummon* korvasClone = korvasObject->SummonPersonalClone(korvasObject->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer());
+ TempSummon* sevisClone = sevisObject->SummonPersonalClone(sevisObject->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer());
+ if (!kaynClone || !jayceClone || !allariaClone || !cyanaClone || !korvasClone || !sevisClone)
+ return;
+
+ _jayceGUID = jayceClone->GetGUID();
+ _allariGUID = allariaClone->GetGUID();
+ _cyanaGUID = cyanaClone->GetGUID();
+ _sevisGUID = sevisClone->GetGUID();
+ allariaClone->SetAIAnimKitId(ANIM_DH_RUN_ALLARI);
+ kaynClone->RemoveNpcFlag(NPCFlags(UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER));
+
+ conversation->AddActor(CONVO_THE_INVASION_BEGINS, CONVO_ACTOR_IDX_KAYN, kaynClone->GetGUID());
+ conversation->AddActor(CONVO_THE_INVASION_BEGINS, CONVO_ACTOR_IDX_KORVAS, korvasClone->GetGUID());
+ conversation->Start();
+ }
+
+ void OnConversationStart(Conversation* conversation) override
+ {
+ LocaleConstant privateOwnerLocale = conversation->GetPrivateObjectOwnerLocale();
+
+ if (Milliseconds const* illidariFacingLineStarted = conversation->GetLineStartTime(privateOwnerLocale, CONVO_LINE_TRIGGER_FACING))
+ _events.ScheduleEvent(EVENT_ILLIDARI_FACE_PLAYERS, *illidariFacingLineStarted);
+
+ if (Milliseconds const* illidariStartPathLineStarted = conversation->GetLineStartTime(privateOwnerLocale, CONVO_LINE_START_PATH))
+ _events.ScheduleEvent(EVENT_ILLIDARI_START_PATH, *illidariStartPathLineStarted);
+ }
+
+ static void StartCloneChannel(ObjectGuid guid, Conversation* conversation)
+ {
+ Unit* privateObjectOwner = ObjectAccessor::GetUnit(*conversation, conversation->GetPrivateObjectOwner());
+ if (!privateObjectOwner)
+ return;
+
+ Creature* clone = ObjectAccessor::GetCreature(*conversation, guid);
+ if (!clone)
+ return;
+
+ clone->CastSpell(privateObjectOwner, SPELL_TRACK_TARGET_IN_CHANNEL, false);
+ }
+
+ static void StartCloneMovement(ObjectGuid cloneGUID, uint32 pathId, uint32 animKit, Conversation* conversation)
+ {
+ Creature* clone = ObjectAccessor::GetCreature(*conversation, cloneGUID);
+ if (!clone)
+ return;
+
+ clone->InterruptNonMeleeSpells(true);
+ clone->GetMotionMaster()->MovePath(pathId, false);
+ if (animKit)
+ clone->SetAIAnimKitId(animKit);
+ }
+
+ void OnConversationUpdate(Conversation* conversation, uint32 diff) override
+ {
+ _events.Update(diff);
+
+ switch (_events.ExecuteEvent())
+ {
+ case EVENT_ILLIDARI_FACE_PLAYERS:
+ {
+ StartCloneChannel(conversation->GetActorUnit(CONVO_ACTOR_IDX_KAYN)->GetGUID(), conversation);
+ StartCloneChannel(conversation->GetActorUnit(CONVO_ACTOR_IDX_KORVAS)->GetGUID(), conversation);
+ StartCloneChannel(_jayceGUID, conversation);
+ StartCloneChannel(_allariGUID, conversation);
+ StartCloneChannel(_cyanaGUID, conversation);
+ StartCloneChannel(_sevisGUID, conversation);
+ break;
+ }
+ case EVENT_ILLIDARI_START_PATH:
+ {
+ Creature* kaynClone = conversation->GetActorCreature(CONVO_ACTOR_IDX_KAYN);
+ if (!kaynClone)
+ break;
+
+ Unit* privateObjectOwner = ObjectAccessor::GetUnit(*conversation, conversation->GetPrivateObjectOwner());
+ if (!privateObjectOwner)
+ return;
+
+ Player* player = privateObjectOwner->ToPlayer();
+ if (!player)
+ return;
+
+ kaynClone->PlayObjectSound(SOUND_METAL_WEAPON_UNSHEATH, kaynClone->GetGUID(), player);
+ kaynClone->SendPlaySpellVisualKit(SPELL_VISUAL_KIT_KAYN_GLIDE, 4, 3000);
+ kaynClone->SendPlaySpellVisualKit(SPELL_VISUAL_KIT_KAYN_WINGS, 4, 4000);
+ kaynClone->GetMotionMaster()->MoveJumpWithGravity(KaynJumpPos, 20.5f, 396.3535f, POINT_KAYN_TRIGGER_DOUBLE_JUMP);
+ kaynClone->SetSheath(SHEATH_STATE_MELEE);
+ kaynClone->SetNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
+
+ StartCloneMovement(conversation->GetActorUnit(CONVO_ACTOR_IDX_KORVAS)->GetGUID(), PATH_KORVAS_INVASION_BEGINS, ANIM_DH_RUN, conversation);
+ StartCloneMovement(_jayceGUID, PATH_JAYCE_INVASION_BEGINS, 0, conversation);
+ StartCloneMovement(_allariGUID, PATH_ALLARI_INVASION_BEGINS, ANIM_DH_RUN_ALLARI, conversation);
+ StartCloneMovement(_cyanaGUID, PATH_CYANA_INVASION_BEGINS, 0, conversation);
+ StartCloneMovement(_sevisGUID, PATH_SEVIS_INVASION_BEGINS, ANIM_DH_RUN, conversation);
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+private:
+ ObjectGuid _jayceGUID;
+ ObjectGuid _allariGUID;
+ ObjectGuid _cyanaGUID;
+ ObjectGuid _sevisGUID;
+ EventMap _events;
+};
+
+// 98459 - Kayn Sunfury
+// 98458 - Jayce Darkweaver
+// 98456 - Allari the Souleater
+// 98460 - Korvas Bloodthorn
+// 99919 - Sevis Brightflame
+// 98457 - Cyana Nightglaive
+struct npc_illidari_fighting_invasion_begins : public ScriptedAI
+{
+ npc_illidari_fighting_invasion_begins(Creature* creature) : ScriptedAI(creature) { }
+
+ enum IllidariFightingSpells
+ {
+ SPELL_ILLIDARI_CHAOS_STRIKE = 197639,
+ SPELL_ILLIDARI_FEL_RUSH = 200879,
+ };
+
+ enum IllidariFightingEvents
+ {
+ EVENT_CHAOS_STRIKE = 1,
+ EVENT_FEL_RUSH
+ };
+
+ Unit* GetNextTarget()
+ {
+ std::list<Unit*> targetList;
+ Trinity::AnyUnfriendlyUnitInObjectRangeCheck checker(me, me, 100.0f);
+ Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(me, targetList, checker);
+ Cell::VisitAllObjects(me, searcher, 100.0f);
+ targetList.remove_if([](Unit* possibleTarget)
+ {
+ return possibleTarget->isAttackingPlayer();
+ });
+ return Trinity::Containers::SelectRandomContainerElement(targetList);
+ }
+
+ void ScheduleTargetSelection()
+ {
+ _oocScheduler.Schedule(200ms, [this](TaskContext context)
+ {
+ Unit* target = GetNextTarget();
+ if (!target)
+ {
+ context.Repeat(500ms);
+ return;
+ }
+ AttackStart(target);
+ });
+ }
+
+ void JustAppeared() override
+ {
+ ScheduleTargetSelection();
+ }
+
+ void Reset() override
+ {
+ _events.Reset();
+ }
+
+ void JustEngagedWith(Unit* /*who*/) override
+ {
+ _events.ScheduleEvent(EVENT_CHAOS_STRIKE, 5s);
+ _events.ScheduleEvent(EVENT_FEL_RUSH, 7s);
+ }
+
+ void EnterEvadeMode(EvadeReason why) override
+ {
+ // manualling calling it to not move to home position but move to next target instead
+ _EnterEvadeMode(why);
+ Reset();
+ ScheduleTargetSelection();
+ }
+
+ void UpdateAI(uint32 diff) override
+ {
+ if (!UpdateVictim())
+ {
+ _oocScheduler.Update(diff);
+ return;
+ }
+
+ _events.Update(diff);
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ switch (_events.ExecuteEvent())
+ {
+ case EVENT_CHAOS_STRIKE:
+ DoCastVictim(SPELL_ILLIDARI_CHAOS_STRIKE);
+ _events.ScheduleEvent(EVENT_CHAOS_STRIKE, 5s);
+ break;
+ case EVENT_FEL_RUSH:
+ DoCastVictim(SPELL_ILLIDARI_FEL_RUSH);
+ _events.ScheduleEvent(SPELL_ILLIDARI_FEL_RUSH, 7s);
+ break;
+ default:
+ break;
+ }
+
+ DoMeleeAttackIfReady();
+ }
+
+private:
+ EventMap _events;
+ TaskScheduler _oocScheduler;
+};
+
void AddSC_zone_mardum()
{
+ // Creature
+ RegisterCreatureAI(npc_kayn_sunfury_invasion_begins);
+ RegisterCreatureAI(npc_jayce_darkweaver_invasion_begins);
+ RegisterCreatureAI(npc_allari_the_souleater_invasion_begins);
+ RegisterCreatureAI(npc_korvas_bloodthorn_invasion_begins);
+ RegisterCreatureAI(npc_sevis_brightflame_invasion_begins);
+ RegisterCreatureAI(npc_cyana_nightglaive_invasion_begins);
+ RegisterCreatureAI(npc_illidari_fighting_invasion_begins);
+
+ // Conversation
+ new conversation_the_invasion_begins();
+
// Scene
new scene_demonhunter_intro();