diff --git a/Source/Scripts/EasternKingdoms/AlteracValley/AlteracValley.cs b/Source/Scripts/EasternKingdoms/AlteracValley/AlteracValley.cs index 53250924e..c4eca811c 100644 --- a/Source/Scripts/EasternKingdoms/AlteracValley/AlteracValley.cs +++ b/Source/Scripts/EasternKingdoms/AlteracValley/AlteracValley.cs @@ -5,6 +5,7 @@ using Framework.Constants; using Game.AI; using Game.DataStorage; using Game.Entities; +using Game.Maps; using Game.Scripting; using System; @@ -136,6 +137,69 @@ namespace Scripts.EasternKingdoms.AlteracValley } } + [Script] + class go_av_capturable_object : GameObjectAI + { + public go_av_capturable_object(GameObject go) : base(go) { } + + public override void Reset() + { + me.SetActive(true); + } + + public override bool OnGossipHello(Player player) + { + if (me.GetGoState() != GameObjectState.Ready) + return true; + + ZoneScript zonescript = me.GetZoneScript(); + if (zonescript != null) + { + zonescript.DoAction(1, player, me); + return false; + } + + return true; + } + } + + [Script] + class go_av_contested_object : GameObjectAI + { + public go_av_contested_object(GameObject go) : base(go) { } + + public override void Reset() + { + me.SetActive(true); + _scheduler.Schedule(TimeSpan.FromMinutes(4), _ => + { + ZoneScript zonescript = me.GetZoneScript(); + if (zonescript != null) + zonescript.DoAction(2, me, me); + }); + } + + public override bool OnGossipHello(Player player) + { + if (me.GetGoState() != GameObjectState.Ready) + return true; + + ZoneScript zonescript = me.GetZoneScript(); + if (zonescript != null) + { + zonescript.DoAction(1, player, me); + return false; + } + + return true; + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + } + [Script] class at_av_exploit : AreaTriggerScript { diff --git a/Source/Scripts/EasternKingdoms/ArathiBasin/ArathiBasin.cs b/Source/Scripts/EasternKingdoms/ArathiBasin/ArathiBasin.cs new file mode 100644 index 000000000..8a358fbab --- /dev/null +++ b/Source/Scripts/EasternKingdoms/ArathiBasin/ArathiBasin.cs @@ -0,0 +1,62 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using Game.AI; +using Game.Entities; +using Game.Scripting; +using System; +using Game.Spells; +using Framework.Constants; +using System.Collections.Generic; + +namespace Scripts.EasternKingdoms.ArathiBasin +{ + // 150513 - Arathor Gryphon Rider + // 150459 - Defiler Bat Rider + [Script("npc_bg_ab_arathor_gryphon_rider_leader")] + [Script("npc_bg_ab_defiler_bat_rider_leader")] + class npc_bg_ab_gryphon_bat_rider_leader : ScriptedAI + { + const uint PathGryphonRiderLeader = 800000059; + const uint PathBatRiderLeader = 800000058; + + public npc_bg_ab_gryphon_bat_rider_leader(Creature creature) : base(creature) { } + + public override void WaypointPathEnded(uint nodeId, uint pathId) + { + if (pathId != PathGryphonRiderLeader || pathId != PathBatRiderLeader) + return; + + // despawn formation group + List followers = me.GetCreatureListWithEntryInGrid(me.GetEntry()); + foreach (Creature follower in followers) + follower.DespawnOrUnsummon(TimeSpan.FromMilliseconds(500)); + + me.DespawnOrUnsummon(TimeSpan.FromMilliseconds(500)); + } + } + + [Script] // 261985 - Blacksmith Working + class spell_bg_ab_blacksmith_working : AuraScript + { + const uint ItemBlacksmithHammer = 5956; + + void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode) + { + GetTarget().SetVirtualItem(0, ItemBlacksmithHammer); + } + + void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode) + { + Creature creature = GetTarget().ToCreature(); + if (creature != null) + creature.LoadEquipment(creature.GetOriginalEquipmentId()); + } + + public override void Register() + { + AfterEffectApply.Add(new(OnApply, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + AfterEffectRemove.Add(new(OnRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + } + } +} \ No newline at end of file diff --git a/Source/Scripts/EasternKingdoms/BaradinHold/Alizabal.cs b/Source/Scripts/EasternKingdoms/BaradinHold/Alizabal.cs index a874ac14e..816ae85b1 100644 --- a/Source/Scripts/EasternKingdoms/BaradinHold/Alizabal.cs +++ b/Source/Scripts/EasternKingdoms/BaradinHold/Alizabal.cs @@ -62,7 +62,7 @@ namespace Scripts.EasternKingdoms.BaradinHold.Alizabal InstanceScript instance = player.GetInstanceScript(); if (instance != null) { - Creature alizabal = ObjectAccessor.GetCreature(player, instance.GetGuidData(DataTypes.Alizabal)); + Creature alizabal = ObjectAccessor.GetCreature(player, instance.GetGuidData((uint)DataTypes.Alizabal)); if (alizabal != null) alizabal.GetAI().DoAction(ActionIds.Intro); } @@ -77,7 +77,7 @@ namespace Scripts.EasternKingdoms.BaradinHold.Alizabal bool _hate; bool _skewer; - public boss_alizabal(Creature creature) : base(creature, DataTypes.Alizabal) { } + public boss_alizabal(Creature creature) : base(creature, (uint)DataTypes.Alizabal) { } public override void Reset() { @@ -250,5 +250,4 @@ namespace Scripts.EasternKingdoms.BaradinHold.Alizabal }); } } -} - +} \ No newline at end of file diff --git a/Source/Scripts/EasternKingdoms/BaradinHold/InstanceBaradinHold.cs b/Source/Scripts/EasternKingdoms/BaradinHold/InstanceBaradinHold.cs index bb6a4ffa1..626152f04 100644 --- a/Source/Scripts/EasternKingdoms/BaradinHold/InstanceBaradinHold.cs +++ b/Source/Scripts/EasternKingdoms/BaradinHold/InstanceBaradinHold.cs @@ -5,35 +5,48 @@ using Framework.Constants; using Game.Entities; using Game.Maps; using Game.Scripting; +using System; +using System.Collections.Generic; namespace Scripts.EasternKingdoms.BaradinHold { - struct DataTypes + enum DataTypes { - public const uint Argaloth = 0; - public const uint Occuthar = 1; - public const uint Alizabal = 2; + Argaloth = 0, + Occuthar = 1, + Alizabal = 2, + + // Encounter Related + ExtinuishFelFlames } - struct CreatureIds + enum CreatureIds { - public const uint EyeOfOccuthar = 52389; - public const uint FocusFireDummy = 52369; - public const uint OccutharEye = 52368; + // Bosses + Argaloth = 47120, + Occuthar = 52363, + Alizabal = 55869, + + // Encounter Related Creatures + /*Argaloth*/ + FelFlames = 47829, + + EyeOfOccuthar = 52389, + FocusFireDummy = 52369, + OccutharEye = 52368 } - struct BossIds + enum GameObjectIds { - public const uint Argaloth = 47120; - public const uint Occuthar = 52363; - public const uint Alizabal = 55869; + ArgalothDoor = 207619, + OccutharDoor = 208953, + AlizabalDoor = 209849 } - struct GameObjectIds + enum SpellIds { - public const uint ArgalothDoor = 207619; - public const uint OccutharDoor = 208953; - public const uint AlizabalDoor = 209849; + // Fel Flames + FelFlames = 88999 } [Script] @@ -41,89 +54,68 @@ namespace Scripts.EasternKingdoms.BaradinHold { static DoorData[] doorData = { - new DoorData(GameObjectIds.ArgalothDoor, DataTypes.Argaloth, EncounterDoorBehavior.OpenWhenNotInProgress), - new DoorData(GameObjectIds.OccutharDoor, DataTypes.Occuthar, EncounterDoorBehavior.OpenWhenNotInProgress), - new DoorData(GameObjectIds.AlizabalDoor, DataTypes.Alizabal, EncounterDoorBehavior.OpenWhenNotInProgress), + new DoorData((uint)GameObjectIds.ArgalothDoor, (uint)DataTypes.Argaloth, EncounterDoorBehavior.OpenWhenNotInProgress), + new DoorData((uint)GameObjectIds.OccutharDoor, (uint)DataTypes.Occuthar, EncounterDoorBehavior.OpenWhenNotInProgress), + new DoorData((uint)GameObjectIds.AlizabalDoor, (uint)DataTypes.Alizabal, EncounterDoorBehavior.OpenWhenNotInProgress), + }; + + static ObjectData[] creatureData = + { + new ObjectData((uint)CreatureIds.Argaloth, (uint)DataTypes.Argaloth), + new ObjectData((uint)CreatureIds.Occuthar, (uint)DataTypes.Occuthar), + new ObjectData((uint)CreatureIds.Alizabal, (uint)DataTypes.Alizabal), }; static DungeonEncounterData[] encounters = { - new DungeonEncounterData(DataTypes.Argaloth, 1033), - new DungeonEncounterData(DataTypes.Occuthar, 1250), - new DungeonEncounterData(DataTypes.Alizabal, 1332) + new DungeonEncounterData((uint)DataTypes.Argaloth, 1033), + new DungeonEncounterData((uint)DataTypes.Occuthar, 1250), + new DungeonEncounterData((uint)DataTypes.Alizabal, 1332) }; public instance_baradin_hold() : base(nameof(instance_baradin_hold), 757) { } class instance_baradin_hold_InstanceMapScript : InstanceScript { - ObjectGuid ArgalothGUID; - ObjectGuid OccutharGUID; - ObjectGuid AlizabalGUID; + List _felFlameGUIDs = new(); public instance_baradin_hold_InstanceMapScript(InstanceMap map) : base(map) { SetHeaders("BH"); SetBossNumber(3); + LoadObjectData(creatureData, null); LoadDoorData(doorData); LoadDungeonEncounterData(encounters); } public override void OnCreatureCreate(Creature creature) { - switch (creature.GetEntry()) + switch ((CreatureIds)creature.GetEntry()) { - case BossIds.Argaloth: - ArgalothGUID = creature.GetGUID(); - break; - case BossIds.Occuthar: - OccutharGUID = creature.GetGUID(); - break; - case BossIds.Alizabal: - AlizabalGUID = creature.GetGUID(); + case CreatureIds.FelFlames: + _felFlameGUIDs.Add(creature.GetGUID()); + creature.m_Events.AddEventAtOffset(() => creature.CastSpell(null, (uint)SpellIds.FelFlames), TimeSpan.FromSeconds(1)); break; } } - public override void OnGameObjectCreate(GameObject go) + public override void SetData(uint type, uint value) { - switch (go.GetEntry()) + switch ((DataTypes)type) { - case GameObjectIds.ArgalothDoor: - case GameObjectIds.OccutharDoor: - case GameObjectIds.AlizabalDoor: - AddDoor(go, true); - break; - } - } + case DataTypes.ExtinuishFelFlames: + foreach (ObjectGuid guid in _felFlameGUIDs) + { + Creature felFlame = instance.GetCreature(guid); + if (felFlame != null) + felFlame.RemoveAllAuras(); + } - public override ObjectGuid GetGuidData(uint data) - { - switch (data) - { - case DataTypes.Argaloth: - return ArgalothGUID; - case DataTypes.Occuthar: - return OccutharGUID; - case DataTypes.Alizabal: - return AlizabalGUID; + _felFlameGUIDs.Clear(); + break; default: break; } - - return ObjectGuid.Empty; - } - - public override void OnGameObjectRemove(GameObject go) - { - switch (go.GetEntry()) - { - case GameObjectIds.ArgalothDoor: - case GameObjectIds.OccutharDoor: - case GameObjectIds.AlizabalDoor: - AddDoor(go, false); - break; - } } } diff --git a/Source/Scripts/EasternKingdoms/BaradinHold/Occuthar.cs b/Source/Scripts/EasternKingdoms/BaradinHold/Occuthar.cs index 5552d04d2..bd77fa02a 100644 --- a/Source/Scripts/EasternKingdoms/BaradinHold/Occuthar.cs +++ b/Source/Scripts/EasternKingdoms/BaradinHold/Occuthar.cs @@ -45,7 +45,7 @@ namespace Scripts.EasternKingdoms.BaradinHold.Occuthar { Vehicle _vehicle; - public boss_occuthar(Creature creature) : base(creature, DataTypes.Occuthar) + public boss_occuthar(Creature creature) : base(creature, (uint)DataTypes.Occuthar) { _vehicle = me.GetVehicleKit(); Cypher.Assert(_vehicle != null); @@ -78,7 +78,7 @@ namespace Scripts.EasternKingdoms.BaradinHold.Occuthar { summons.Summon(summon); - if (summon.GetEntry() == CreatureIds.FocusFireDummy) + if (summon.GetEntry() == (uint)CreatureIds.FocusFireDummy) { DoCast(summon, SpellIds.FocusedFire); @@ -142,7 +142,7 @@ namespace Scripts.EasternKingdoms.BaradinHold.Occuthar public override void IsSummonedBy(WorldObject summoner) { // player is the spellcaster so register summon manually - Creature occuthar = ObjectAccessor.GetCreature(me, _instance.GetGuidData(DataTypes.Occuthar)); + Creature occuthar = ObjectAccessor.GetCreature(me, _instance.GetGuidData((uint)DataTypes.Occuthar)); if (occuthar != null) occuthar.GetAI().JustSummoned(me); } @@ -169,7 +169,7 @@ namespace Scripts.EasternKingdoms.BaradinHold.Occuthar } [Script] // 96872 - Focused Fire - class spell_occuthar_focused_fire_SpellScript : SpellScript + class spell_occuthar_focused_fire : SpellScript { void FilterTargets(List targets) { @@ -189,7 +189,7 @@ namespace Scripts.EasternKingdoms.BaradinHold.Occuthar } [Script] // Id - 96931 Eyes of Occu'thar - class spell_occuthar_eyes_of_occuthar_SpellScript : SpellScript + class spell_occuthar_eyes_of_occuthar : SpellScript { public override bool Validate(SpellInfo spellInfo) { @@ -222,7 +222,7 @@ namespace Scripts.EasternKingdoms.BaradinHold.Occuthar } [Script] // Id - 96932 Eyes of Occu'thar - class spell_occuthar_eyes_of_occuthar_vehicle_SpellScript : SpellScript + class spell_occuthar_eyes_of_occuthar_vehicle : SpellScript { public override bool Load() { @@ -237,10 +237,10 @@ namespace Scripts.EasternKingdoms.BaradinHold.Occuthar { Position pos = GetHitUnit().GetPosition(); - Creature occuthar = ObjectAccessor.GetCreature(GetCaster(), GetCaster().GetInstanceScript().GetGuidData(DataTypes.Occuthar)); + Creature occuthar = ObjectAccessor.GetCreature(GetCaster(), GetCaster().GetInstanceScript().GetGuidData((uint)DataTypes.Occuthar)); if (occuthar != null) { - Creature creature = occuthar.SummonCreature(CreatureIds.EyeOfOccuthar, pos); + Creature creature = occuthar.SummonCreature((uint)CreatureIds.EyeOfOccuthar, pos); if (creature != null) creature.CastSpell(GetHitUnit(), SpellIds.GazeOfOccuthar, false); } @@ -253,7 +253,7 @@ namespace Scripts.EasternKingdoms.BaradinHold.Occuthar } [Script] // 96942 / 101009 - Gaze of Occu'thar - class spell_occuthar_occuthars_destruction_AuraScript : AuraScript + class spell_occuthar_occuthars_destruction : AuraScript { public override bool Load() { @@ -277,5 +277,4 @@ namespace Scripts.EasternKingdoms.BaradinHold.Occuthar OnEffectRemove.Add(new EffectApplyHandler(OnRemove, 2, AuraType.PeriodicTriggerSpell, AuraEffectHandleModes.Real)); } } -} - +} \ No newline at end of file diff --git a/Source/Scripts/EasternKingdoms/BaradinHold/PitLordArgaloth.cs b/Source/Scripts/EasternKingdoms/BaradinHold/PitLordArgaloth.cs index 657c8c5ba..8e5689380 100644 --- a/Source/Scripts/EasternKingdoms/BaradinHold/PitLordArgaloth.cs +++ b/Source/Scripts/EasternKingdoms/BaradinHold/PitLordArgaloth.cs @@ -22,7 +22,7 @@ namespace Scripts.EasternKingdoms.BaradinHold.PitLordArgaloth [Script] class boss_pit_lord_argaloth : BossAI { - boss_pit_lord_argaloth(Creature creature) : base(creature, DataTypes.Argaloth) { } + public boss_pit_lord_argaloth(Creature creature) : base(creature, (uint)DataTypes.Argaloth) { } public override void JustEngagedWith(Unit who) { @@ -112,5 +112,4 @@ namespace Scripts.EasternKingdoms.BaradinHold.PitLordArgaloth OnHit.Add(new HitHandler(SplitDamage)); } } -} - +} \ No newline at end of file diff --git a/Source/Scripts/EasternKingdoms/BastionOfTwilight/InstanceBastionOfTwilight.cs b/Source/Scripts/EasternKingdoms/BastionOfTwilight/InstanceBastionOfTwilight.cs new file mode 100644 index 000000000..d4f0a846c --- /dev/null +++ b/Source/Scripts/EasternKingdoms/BastionOfTwilight/InstanceBastionOfTwilight.cs @@ -0,0 +1,96 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using Framework.Constants; +using Game.Maps; +using Game.Scripting; + +namespace Scripts.EasternKingdoms.BastionOfTwilight +{ + enum DataTypes + { + // Encounters + HalfusWyrmbreaker = 0, + TheralionAndValiona = 1, + AscendantCouncil = 2, + Chogall = 3, + Sinestra = 4 + } + + enum CreatureIds + { + // Bosses + HalfusWyrmbreaker = 44600, + Theralion = 45993, + Valiona = 45992, + Ignacious = 43686, + Feludius = 43687, + Terrastra = 43689, + Arion = 43688, + ElementiumMonstrosity = 43735, + Chogall = 43324, + Sinestra = 45213 + } + + enum GameobjectIds + { + HalfusEntrance = 205222, + HalfusExit = 205223, + DragonSiblingsDoorEntrance = 205224, + DragonSiblingsDoorExit = 205225, + AscendantCouncilEntrance = 205226, + AscendantCouncilExit = 205227, + ChogallEntrance = 205228, + GrimBatolRaidTrapDoor = 205898 + } + + [Script] + class instance_bastion_of_twilight : InstanceMapScript + { + static ObjectData[] creatureData = + { + new ObjectData((uint)CreatureIds.HalfusWyrmbreaker, (uint)DataTypes.HalfusWyrmbreaker), + new ObjectData((uint)CreatureIds.Chogall, (uint)DataTypes.Chogall), + new ObjectData((uint)CreatureIds.Sinestra, (uint)DataTypes.Sinestra), + }; + + static DoorData[] doorData = + { + new DoorData((uint)GameobjectIds.HalfusEntrance, (uint)DataTypes.HalfusWyrmbreaker, EncounterDoorBehavior.OpenWhenNotInProgress), + new DoorData((uint)GameobjectIds.HalfusExit, (uint)DataTypes.HalfusWyrmbreaker, EncounterDoorBehavior.OpenWhenDone), + new DoorData((uint)GameobjectIds.DragonSiblingsDoorEntrance, (uint)DataTypes.TheralionAndValiona, EncounterDoorBehavior.OpenWhenNotInProgress), + new DoorData((uint)GameobjectIds.DragonSiblingsDoorExit, (uint)DataTypes.TheralionAndValiona, EncounterDoorBehavior.OpenWhenDone), + new DoorData((uint)GameobjectIds.AscendantCouncilEntrance, (uint)DataTypes.AscendantCouncil, EncounterDoorBehavior.OpenWhenNotInProgress), + new DoorData((uint)GameobjectIds.AscendantCouncilExit, (uint)DataTypes.AscendantCouncil, EncounterDoorBehavior.OpenWhenDone), + new DoorData((uint)GameobjectIds.ChogallEntrance, (uint)DataTypes.Chogall, EncounterDoorBehavior.OpenWhenNotInProgress), + }; + + static DungeonEncounterData[] encounters = + { + new DungeonEncounterData((uint)DataTypes.HalfusWyrmbreaker, 1030), + new DungeonEncounterData((uint)DataTypes.TheralionAndValiona, 1032), + new DungeonEncounterData((uint)DataTypes.AscendantCouncil, 1028), + new DungeonEncounterData((uint)DataTypes.Chogall, 1029), + new DungeonEncounterData((uint)DataTypes.Sinestra, 1082, 1083) + }; + + public instance_bastion_of_twilight() : base(nameof(instance_bastion_of_twilight), 671) { } + + class instance_bastion_of_twilight_InstanceMapScript : InstanceScript + { + public instance_bastion_of_twilight_InstanceMapScript(InstanceMap map) : base(map) + { + SetHeaders("BOT"); + SetBossNumber(5); + LoadObjectData(creatureData, null); + LoadDoorData(doorData); + LoadDungeonEncounterData(encounters); + } + } + + public override InstanceScript GetInstanceScript(InstanceMap map) + { + return new instance_bastion_of_twilight_InstanceMapScript(map); + } + } +} diff --git a/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/BlackrockCaverns.cs b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/BlackrockCaverns.cs new file mode 100644 index 000000000..b7cccfd4a --- /dev/null +++ b/Source/Scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/BlackrockCaverns.cs @@ -0,0 +1,487 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using Framework.Constants; +using Game.AI; +using Game.Entities; +using Game.Scripting; +using Game.Spells; +using System; + +namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockCaverns +{ + enum SpellIds + { + // Firecyclone + FireCycloneAura = 74851, + + // Twilightflamecaller + FireChanneling1 = 74911, + FireChanneling2 = 74912, + BlastWave = 76473, + CallFlames = 76325, + + // Twilighttorturer + InflictPain = 75590, + RedHotPoker = 76478, + Shackles = 76484, + WildBeatdown = 76487, + + // Twilightsadist + InflictPain1 = 76497, + HeatSeekerBlade = 76502, + ShortThrow = 76572, + SinisterStrike = 76500, + + // Madprisoner + HeadCrack = 77568, + InfectedWound = 76512, + Enrage = 8599, + + // Razthecrazed + AggroNearbyTargets = 80196, + ShadowPrison = 79725, + LeapFromCage = 79720, + FuriousSwipe = 80206, + LeapFromBridge = 80273, + + // Chainsofwoe + ChainsOfWoe1 = 75437, + ChainsOfWoe2 = 75441, + ChainsOfWoe3 = 75464, + ChainsOfWoe4 = 82189, + ChainsOfWoe5 = 82192, + + // Netherdragonessence + NetherDragonEssence1 = 75649, + NetherDragonEssence2 = 75650, + NetherDragonEssence3 = 75653, + NetherDragonEssence4 = 75654 + } + + [Script] + class npc_fire_cyclone : ScriptedAI + { + public npc_fire_cyclone(Creature creature) : base(creature) { } + + public override void Reset() + { + _scheduler.CancelAll(); + _scheduler.Schedule(TimeSpan.FromMilliseconds(100), task => + { + DoCast(me, (uint)SpellIds.FireCycloneAura, true); + task.Repeat(TimeSpan.FromSeconds(4)); + }); + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + } + + [Script] + class npc_twilight_flame_caller : ScriptedAI + { + static Position[] SummonPos = + { + new Position(162.5990f, 1085.321f, 201.1190f, 0.0f), + new Position(170.5469f, 1063.403f, 201.1409f, 0.0f), + new Position(191.2326f, 1100.160f, 201.1071f, 0.0f), + new Position(228.0816f, 1106.000f, 201.1292f, 0.0f), + new Position(252.8351f, 1095.127f, 201.1436f, 0.0f), + new Position(253.6476f, 1070.226f, 201.1344f, 0.0f) + }; + + const uint NPC_FIRE_CYCLONE = 40164; + + ObjectGuid _flamecaller1GUID; + ObjectGuid _flamecaller2GUID; + SummonList _summons; + + public npc_twilight_flame_caller(Creature creature) : base(creature) + { + _summons = new(me); + } + + public override void Reset() + { + _flamecaller1GUID.Clear(); + _flamecaller2GUID.Clear(); + + if (me.GetPositionX() > 172 && me.GetPositionX() < 173 && me.GetPositionY() > 1086 && me.GetPositionY() < 1087) + { + _flamecaller1GUID = me.GetGUID(); + me.SummonCreature(NPC_FIRE_CYCLONE, SummonPos[0], TempSummonType.CorpseDespawn, TimeSpan.FromSeconds(0)); + me.SummonCreature(NPC_FIRE_CYCLONE, SummonPos[1], TempSummonType.CorpseDespawn, TimeSpan.FromSeconds(0)); + me.SummonCreature(NPC_FIRE_CYCLONE, SummonPos[2], TempSummonType.CorpseDespawn, TimeSpan.FromSeconds(0)); + } + if (me.GetPositionX() > 247 && me.GetPositionX() < 248 && me.GetPositionY() > 1081 && me.GetPositionY() < 1082) + { + _flamecaller2GUID = me.GetGUID(); + me.SummonCreature(NPC_FIRE_CYCLONE, SummonPos[3], TempSummonType.CorpseDespawn, TimeSpan.FromSeconds(0)); + me.SummonCreature(NPC_FIRE_CYCLONE, SummonPos[4], TempSummonType.CorpseDespawn, TimeSpan.FromSeconds(0)); + me.SummonCreature(NPC_FIRE_CYCLONE, SummonPos[5], TempSummonType.CorpseDespawn, TimeSpan.FromSeconds(0)); + } + + _scheduler.Schedule(TimeSpan.FromMilliseconds(100), task => + { + if (me.GetGUID() == _flamecaller1GUID) + DoCast(me, (uint)SpellIds.FireChanneling1); + if (me.GetGUID() == _flamecaller2GUID) + DoCast(me, (uint)SpellIds.FireChanneling2); + task.Repeat(TimeSpan.FromSeconds(12)); + }); + } + + public override void JustSummoned(Creature summoned) + { + _summons.Summon(summoned); + } + + public override void JustDied(Unit killer) + { + _summons.DespawnAll(); + } + + public override void JustEngagedWith(Unit who) + { + _scheduler.CancelAll(); + _scheduler.Schedule(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(10), task => + { + DoCast(me, (uint)SpellIds.BlastWave); + task.Repeat(TimeSpan.FromSeconds(16), TimeSpan.FromSeconds(20)); + }); + _scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(14), task => + { + DoCast(me, (uint)SpellIds.CallFlames); + task.Repeat(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(15)); + }); + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + } + + [Script] + class npc_twilight_torturer : ScriptedAI + { + public npc_twilight_torturer(Creature creature) : base(creature) { } + + public override void Reset() + { + if (me.GetWaypointPathId() == 0) + { + _scheduler.Schedule(TimeSpan.FromSeconds(6), TimeSpan.FromSeconds(18), task => + { + DoCast(me, (uint)SpellIds.InflictPain); + task.Repeat(TimeSpan.FromSeconds(25), TimeSpan.FromSeconds(32)); + }); + } + } + + public override void JustEngagedWith(Unit who) + { + _scheduler.CancelAll(); + _scheduler.Schedule(TimeSpan.FromSeconds(9), task => + { + DoCast(me, (uint)SpellIds.RedHotPoker); + task.Repeat(TimeSpan.FromSeconds(16), TimeSpan.FromSeconds(20)); + }); + _scheduler.Schedule(TimeSpan.FromSeconds(13), task => + { + DoCast(me, (uint)SpellIds.Shackles); + task.Repeat(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(15)); + }); + _scheduler.Schedule(TimeSpan.FromSeconds(17), task => + { + DoCast(me, (uint)SpellIds.WildBeatdown); + task.Repeat(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(15)); + }); + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + } + + [Script] + class npc_twilight_sadist : ScriptedAI + { + public npc_twilight_sadist(Creature creature) : base(creature) { } + + public override void Reset() + { + if (me.GetWaypointPathId() == 0) + { + _scheduler.Schedule(TimeSpan.FromSeconds(6), TimeSpan.FromSeconds(18), task => + { + DoCast(me, (uint)SpellIds.InflictPain); + task.Repeat(TimeSpan.FromSeconds(25), TimeSpan.FromSeconds(32)); + }); + } + } + + public override void JustEngagedWith(Unit who) + { + _scheduler.CancelAll(); + _scheduler.Schedule(TimeSpan.FromSeconds(13), task => + { + DoCast(me, (uint)SpellIds.InflictPain1); + task.Repeat(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(15)); + }); + _scheduler.Schedule(TimeSpan.FromSeconds(13), task => + { + DoCast(me, (uint)SpellIds.HeatSeekerBlade); + task.Repeat(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(15)); + }); + _scheduler.Schedule(TimeSpan.FromSeconds(17), task => + { + DoCast(me, (uint)SpellIds.ShortThrow); + task.Repeat(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(15)); + }); + _scheduler.Schedule(TimeSpan.FromSeconds(17), task => + { + DoCast(me, (uint)SpellIds.SinisterStrike); + task.Repeat(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(15)); + }); + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + } + + [Script] + class npc_mad_prisoner : ScriptedAI + { + public npc_mad_prisoner(Creature creature) : base(creature) { } + + public override void Reset() { } + + public override void JustEngagedWith(Unit who) + { + _scheduler.CancelAll(); + _scheduler.Schedule(TimeSpan.FromSeconds(9), task => + { + DoCast(me, (uint)SpellIds.HeadCrack); + task.Repeat(TimeSpan.FromSeconds(16), TimeSpan.FromSeconds(20)); + }); + _scheduler.Schedule(TimeSpan.FromSeconds(13), task => + { + DoCast(me, (uint)SpellIds.InfectedWound); + task.Repeat(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(15)); + }); + _scheduler.Schedule(TimeSpan.FromSeconds(17), task => + { + DoCast(me, (uint)SpellIds.Enrage); + task.Repeat(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(15)); + }); + } + + public override void UpdateAI(uint diff) + { + if (!UpdateVictim()) + return; + + _scheduler.Update(diff); + } + } + + [Script] + class npc_crazed_mage : ScriptedAI + { + public npc_crazed_mage(Creature creature) : base(creature) { } + + public override void Reset() { } + + public override void JustEngagedWith(Unit who) + { + _scheduler.CancelAll(); + _scheduler.Schedule(TimeSpan.FromSeconds(9), task => + { + DoCast(me, (uint)SpellIds.HeadCrack); + task.Repeat(TimeSpan.FromSeconds(16), TimeSpan.FromSeconds(20)); + }); + _scheduler.Schedule(TimeSpan.FromSeconds(13), task => + { + DoCast(me, (uint)SpellIds.InfectedWound); + task.Repeat(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(15)); + }); + _scheduler.Schedule(TimeSpan.FromSeconds(17), task => + { + DoCast(me, (uint)SpellIds.Enrage); + task.Repeat(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(15)); + }); + } + + public override void UpdateAI(uint diff) + { + if (!UpdateVictim()) + return; + + _scheduler.Update(diff); + } + } + + [Script] + class npc_raz_the_crazed : ScriptedAI + { + const uint SaySmash = 0; + const uint TypeRaz = 1; + const uint DataRomoggDead = 1; + + public npc_raz_the_crazed(Creature creature) : base(creature) { } + + public override void Reset() { } + + public override void JustEngagedWith(Unit who) + { + _scheduler.CancelAll(); + _scheduler.Schedule(TimeSpan.FromMilliseconds(500), task => + { + DoCastVictim((uint)SpellIds.FuriousSwipe, true); + task.Repeat(TimeSpan.FromMilliseconds(500)); + }); + } + + public override void IsSummonedBy(WorldObject summoner) + { + if (summoner.GetEntry() == CreatureIds.RomoggBonecrusher) + { + me.SetDisableGravity(true); + DoCast(me, (uint)SpellIds.ShadowPrison); + _scheduler.Schedule(TimeSpan.FromSeconds(1), task => + { + DoCast(me, (uint)SpellIds.AggroNearbyTargets); + task.Repeat(TimeSpan.FromSeconds(1.5)); + }); + } + } + + public override void SetData(uint id, uint data) + { + if (id == TypeRaz && data == DataRomoggDead) + { + me.RemoveAura((uint)SpellIds.ShadowPrison); + me.SetDisableGravity(false); + DoCast(me, (uint)SpellIds.LeapFromCage); + _scheduler.Schedule(TimeSpan.FromSeconds(3), _ => Talk(SaySmash)); + } + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + } + + [Script] + class npc_chains_of_woe : ScriptedAI + { + const uint ModelInvisible = 38330; + + public npc_chains_of_woe(Creature creature) : base(creature) { } + + public override void IsSummonedBy(WorldObject summoner) + { + me.SetDisplayId(ModelInvisible); + DoCast(me, (uint)SpellIds.ChainsOfWoe1, true); + DoCast(me, (uint)SpellIds.ChainsOfWoe2, true); + } + } + + [Script] + class spell_chains_of_woe_1 : SpellScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo((uint)SpellIds.ChainsOfWoe1); + } + + void HandleScriptEffect(uint effIndex) + { + if (GetHitUnit().IsPlayer()) + GetHitUnit().CastSpell(GetCaster(), (uint)SpellIds.ChainsOfWoe3, true); + } + + public override void Register() + { + OnEffectHitTarget.Add(new(HandleScriptEffect, 0, SpellEffectName.ScriptEffect)); + } + } + + [Script] + class spell_chains_of_woe_4 : SpellScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo((uint)SpellIds.ChainsOfWoe4); + } + + void HandleScriptEffect(uint effIndex) + { + if (GetHitUnit().IsPlayer()) + GetHitUnit().CastSpell(GetHitUnit(), (uint)SpellIds.ChainsOfWoe5, true); + } + + public override void Register() + { + OnEffectHitTarget.Add(new(HandleScriptEffect, 0, SpellEffectName.ScriptEffect)); + } + } + + [Script] + class spell_nether_dragon_essence_1 : AuraScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo((uint)SpellIds.NetherDragonEssence2, (uint)SpellIds.NetherDragonEssence3, (uint)SpellIds.NetherDragonEssence4); + } + + void HandleTriggerSpell(AuraEffect aurEff) + { + Unit caster = GetCaster(); + if (caster != null) + caster.CastSpell(caster, RandomHelper.RAND((uint)SpellIds.NetherDragonEssence2, (uint)SpellIds.NetherDragonEssence3, (uint)SpellIds.NetherDragonEssence4)); + } + + public override void Register() + { + OnEffectPeriodic.Add(new(HandleTriggerSpell, 0, AuraType.PeriodicTriggerSpell)); + } + } + + [Script] + class spell_nether_dragon_essence_2 : SpellScript + { + void ModDestHeight(ref SpellDestination dest) + { + Position offset = new(RandomHelper.FRand(-35.0f, 35.0f), RandomHelper.FRand(-25.0f, 25.0f), 0.0f, 0.0f); + + switch (GetSpellInfo().Id) + { + case (uint)SpellIds.NetherDragonEssence2: + offset.posZ = 25.0f; + break; + case (uint)SpellIds.NetherDragonEssence3: + offset.posZ = 17.0f; + break; + case (uint)SpellIds.NetherDragonEssence4: + offset.posZ = 33.0f; + break; + } + + dest.RelocateOffset(offset); + } + + public override void Register() + { + OnDestinationTargetSelect.Add(new(ModDestHeight, 0, Targets.DestCasterRandom)); + } + } +} \ No newline at end of file