diff --git a/Source/Scripts/EasternKingdoms/Deadmines/InstanceDeadmines.cs b/Source/Scripts/EasternKingdoms/Deadmines/InstanceDeadmines.cs deleted file mode 100644 index e4f5106d2..000000000 --- a/Source/Scripts/EasternKingdoms/Deadmines/InstanceDeadmines.cs +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -namespace Scripts.EasternKingdoms.Deadmines -{ - /*class instance_deadmines : InstanceMapScript - { - public instance_deadmines() : base("instance_deadmines", 36) - { - } - - class instance_deadmines_InstanceMapScript : InstanceScript - { - public instance_deadmines_InstanceMapScript(Map map) : base(map) - { - SetHeaders(DataHeader); - - State = CANNON_NOT_USED; - CannonBlast_Timer = 0; - PiratesDelay_Timer = 0; - } - - public override void Initialize() - { - - } - - public override void Update(uint diff) - { - if (IronCladDoorGUID.IsEmpty() || DefiasCannonGUID.IsEmpty() || DoorLeverGUID.IsEmpty()) - return; - - GameObject pIronCladDoor = instance.GetGameObject(IronCladDoorGUID); - if (!pIronCladDoor) - return; - - switch (State) - { - case CANNON_GUNPOWDER_USED: - CannonBlast_Timer = DATA_CANNON_BLAST_TIMER; - // it's a hack - Mr. Smite should do that but his too far away - //pIronCladDoor.SetName("Mr. Smite"); - //pIronCladDoor.MonsterYell(SAY_MR_SMITE_ALARM1, LANG_UNIVERSAL, NULL); - pIronCladDoor.PlayDirectSound(SOUND_MR_SMITE_ALARM1); - State = CANNON_BLAST_INITIATED; - break; - case CANNON_BLAST_INITIATED: - PiratesDelay_Timer = DATA_PIRATES_DELAY_TIMER; - if (CannonBlast_Timer <= diff) - { - SummonCreatures(); - GameObject pDefiasCannon = instance.GetGameObject(DefiasCannonGUID); - if (pDefiasCannon) - { - pDefiasCannon.SetGoState(GO_STATE_ACTIVE); - pDefiasCannon.PlayDirectSound(SOUND_CANNONFIRE); - } - pIronCladDoor.SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); - pIronCladDoor.PlayDirectSound(SOUND_DESTROYDOOR); - GameObject pDoorLever = instance.GetGameObject(DoorLeverGUID); - if (pDoorLever) - pDoorLever.SetUInt32Value(GAMEOBJECT_FLAGS, 4); - //pIronCladDoor.MonsterYell(SAY_MR_SMITE_ALARM2, LANG_UNIVERSAL, NULL); - pIronCladDoor.PlayDirectSound(SOUND_MR_SMITE_ALARM2); - State = PIRATES_ATTACK; - } - else CannonBlast_Timer -= diff; - break; - case PIRATES_ATTACK: - if (PiratesDelay_Timer <= diff) - { - MoveCreaturesInside(); - State = EVENT_DONE; - } - else PiratesDelay_Timer -= diff; - break; - } - } - - void SummonCreatures() - { - GameObject pIronCladDoor = instance.GetGameObject(IronCladDoorGUID); - if (pIronCladDoor) - { - Creature DefiasPirate1 = pIronCladDoor.SummonCreature(657, pIronCladDoor.GetPositionX() - 2, pIronCladDoor.GetPositionY() - 7, pIronCladDoor.GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000); - Creature DefiasPirate2 = pIronCladDoor.SummonCreature(657, pIronCladDoor.GetPositionX() + 3, pIronCladDoor.GetPositionY() - 6, pIronCladDoor.GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000); - Creature DefiasCompanion = pIronCladDoor.SummonCreature(3450, pIronCladDoor.GetPositionX() + 2, pIronCladDoor.GetPositionY() - 6, pIronCladDoor.GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000); - - DefiasPirate1GUID = DefiasPirate1.GetGUID(); - DefiasPirate2GUID = DefiasPirate2.GetGUID(); - DefiasCompanionGUID = DefiasCompanion.GetGUID(); - } - } - - void MoveCreaturesInside() - { - if (DefiasPirate1GUID.IsEmpty() || DefiasPirate2GUID.IsEmpty() || DefiasCompanionGUID.IsEmpty()) - return; - - Creature pDefiasPirate1 = instance.GetCreature(DefiasPirate1GUID); - Creature pDefiasPirate2 = instance.GetCreature(DefiasPirate2GUID); - Creature pDefiasCompanion = instance.GetCreature(DefiasCompanionGUID); - if (!pDefiasPirate1 || !pDefiasPirate2 || !pDefiasCompanion) - return; - - MoveCreatureInside(pDefiasPirate1); - MoveCreatureInside(pDefiasPirate2); - MoveCreatureInside(pDefiasCompanion); - } - - void MoveCreatureInside(Creature creature) - { - creature.SetWalk(false); - creature.GetMotionMaster().MovePoint(0, -102.7f, -655.9f, creature.GetPositionZ()); - } - - public override void OnGameObjectCreate(GameObject go) - { - switch (go.GetEntry()) - { - case GO_FACTORY_DOOR: FactoryDoorGUID = go.GetGUID(); break; - case GO_IRONCLAD_DOOR: IronCladDoorGUID = go.GetGUID(); break; - case GO_DEFIAS_CANNON: DefiasCannonGUID = go.GetGUID(); break; - case GO_DOOR_LEVER: DoorLeverGUID = go.GetGUID(); break; - case GO_MR_SMITE_CHEST: uiSmiteChestGUID = go.GetGUID(); break; - } - } - - public override void SetData(uint type, uint data) - { - switch (type) - { - case EVENT_STATE: - if (!DefiasCannonGUID.IsEmpty() && !IronCladDoorGUID.IsEmpty()) - State = data; - break; - case EVENT_RHAHKZOR: - if (data == DONE) - { - GameObject go = instance.GetGameObject(FactoryDoorGUID); - if (go) - go.SetGoState(GO_STATE_ACTIVE); - } - break; - } - } - - public override uint GetData(uint type) - { - switch (type) - { - case EVENT_STATE: - return State; - } - - return 0; - } - - public override ObjectGuid GetGuidData(uint data) - { - switch (data) - { - case DATA_SMITE_CHEST: - return uiSmiteChestGUID; - } - - return ObjectGuid::Empty; - } - - ObjectGuid FactoryDoorGUID; - ObjectGuid IronCladDoorGUID; - ObjectGuid DefiasCannonGUID; - ObjectGuid DoorLeverGUID; - ObjectGuid DefiasPirate1GUID; - ObjectGuid DefiasPirate2GUID; - ObjectGuid DefiasCompanionGUID; - - uint State; - uint CannonBlast_Timer; - uint PiratesDelay_Timer; - ObjectGuid uiSmiteChestGUID; - } - - public override InstanceScript GetInstanceScript(InstanceMap map) - { - return new instance_deadmines_InstanceMapScript(map); - } - }*/ -} diff --git a/Source/Scripts/EasternKingdoms/Karazhan/AttumenMidnight.cs b/Source/Scripts/EasternKingdoms/Karazhan/AttumenMidnight.cs deleted file mode 100644 index 3e821c952..000000000 --- a/Source/Scripts/EasternKingdoms/Karazhan/AttumenMidnight.cs +++ /dev/null @@ -1,373 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Scripting; -using Game.Spells; -using System; -using System.Collections.Generic; - -namespace Scripts.EasternKingdoms.Karazhan.Midnight -{ - struct Misc - { - public const uint MountedDisplayid = 16040; - - //Attumen (@Todo Use The Summoning Spell Instead Of Creature Id. It Works; But Is Not Convenient For Us) - public const uint SummonAttumen = 15550; - } - - struct TextIds - { - public const uint SayKill = 0; - public const uint SayRandom = 1; - public const uint SayDisarmed = 2; - public const uint SayMidnightKill = 3; - public const uint SayAppear = 4; - public const uint SayMount = 5; - - public const uint SayDeath = 3; - - // Midnight - public const uint EmoteCallAttumen = 0; - public const uint EmoteMountUp = 1; - } - - struct SpellIds - { - public const uint Shadowcleave = 29832; - public const uint IntangiblePresence = 29833; - public const uint SpawnSmoke = 10389; - public const uint Charge = 29847; - - // Midnight - public const uint Knockdown = 29711; - public const uint SummonAttumen = 29714; - public const uint Mount = 29770; - public const uint SummonAttumenMounted = 29799; - } - - enum Phases - { - None, - AttumenEngages, - Mounted - } - - [Script] - public class boss_attumen : BossAI - { - public boss_attumen(Creature creature) : base(creature, DataTypes.Attumen) - { - Initialize(); - } - - void Initialize() - { - _midnightGUID.Clear(); - _phase = Phases.None; - } - - public override void Reset() - { - Initialize(); - base.Reset(); - } - - public override void EnterEvadeMode(EvadeReason why) - { - Creature midnight = ObjectAccessor.GetCreature(me, _midnightGUID); - if (midnight != null) - _DespawnAtEvade(10, midnight); - - me.DespawnOrUnsummon(); - } - - public override void ScheduleTasks() - { - _scheduler.Schedule(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(25), task => - { - DoCastVictim(SpellIds.Shadowcleave); - task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(25)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(25), TimeSpan.FromSeconds(45), task => - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0); - if (target != null) - DoCast(target, SpellIds.IntangiblePresence); - - task.Repeat(TimeSpan.FromSeconds(25), TimeSpan.FromSeconds(45)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(60), task => - { - Talk(TextIds.SayRandom); - task.Repeat(TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(60)); - }); - } - - public override void DamageTaken(Unit attacker, ref uint damage) - { - // Attumen does not die until he mounts Midnight, let health fall to 1 and prevent further damage. - if (damage >= me.GetHealth() && _phase != Phases.Mounted) - damage = (uint)(me.GetHealth() - 1); - - if (_phase == Phases.AttumenEngages && me.HealthBelowPctDamaged(25, damage)) - { - _phase = Phases.None; - - Creature midnight = ObjectAccessor.GetCreature(me, _midnightGUID); - if (midnight != null) - midnight.GetAI().DoCastAOE(SpellIds.Mount, true); - } - } - - public override void KilledUnit(Unit victim) - { - Talk(TextIds.SayKill); - } - - public override void JustSummoned(Creature summon) - { - if (summon.GetEntry() == CreatureIds.AttumenMounted) - { - Creature midnight = ObjectAccessor.GetCreature(me, _midnightGUID); - if (midnight != null) - { - if (midnight.GetHealth() > me.GetHealth()) - summon.SetHealth(midnight.GetHealth()); - else - summon.SetHealth(me.GetHealth()); - - summon.GetAI().DoZoneInCombat(); - summon.GetAI().SetGUID(_midnightGUID, (int)CreatureIds.Midnight); - } - } - - base.JustSummoned(summon); - } - - public override void IsSummonedBy(Unit summoner) - { - if (summoner.GetEntry() == CreatureIds.Midnight) - _phase = Phases.AttumenEngages; - - if (summoner.GetEntry() == CreatureIds.AttumenUnmounted) - { - _phase = Phases.Mounted; - DoCastSelf(SpellIds.SpawnSmoke); - - _scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(25), task => - { - Unit target = null; - var t_list = me.GetThreatManager().GetThreatList(); - List target_list = new List(); - - foreach (var itr in t_list) - { - target = Global.ObjAccessor.GetUnit(me, itr.GetUnitGuid()); - if (target && !target.IsWithinDist(me, 8.00f, false) && target.IsWithinDist(me, 25.0f, false)) - target_list.Add(target); - - target = null; - } - - if (!target_list.Empty()) - target = target_list.SelectRandom(); - - DoCast(target, SpellIds.Charge); - task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(25)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(25), TimeSpan.FromSeconds(35), task => - { - DoCastVictim(SpellIds.Knockdown); - task.Repeat(TimeSpan.FromSeconds(25), TimeSpan.FromSeconds(35)); - }); - } - } - - public override void JustDied(Unit killer) - { - Talk(TextIds.SayDeath); - Unit midnight = Global.ObjAccessor.GetUnit(me, _midnightGUID); - if (midnight) - midnight.KillSelf(); - - base.JustDied(killer); - } - - public override void SetGUID(ObjectGuid guid, int id = 0) - { - if (id == CreatureIds.Midnight) - _midnightGUID = guid; - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim() && _phase != Phases.None) - return; - - _scheduler.Update(diff, DoMeleeAttackIfReady); - } - - public override void SpellHit(Unit source, SpellInfo spell) - { - if (spell.Mechanic == Mechanics.Disarm) - Talk(TextIds.SayDisarmed); - - if (spell.Id == SpellIds.Mount) - { - Creature midnight = ObjectAccessor.GetCreature(me, _midnightGUID); - if (midnight != null) - { - _phase = Phases.None; - _scheduler.CancelAll(); - - midnight.AttackStop(); - midnight.RemoveAllAttackers(); - midnight.SetReactState(ReactStates.Passive); - midnight.GetMotionMaster().MoveChase(me); - midnight.GetAI().Talk(TextIds.EmoteMountUp); - - me.AttackStop(); - me.RemoveAllAttackers(); - me.SetReactState(ReactStates.Passive); - me.GetMotionMaster().MoveChase(midnight); - Talk(TextIds.SayMount); - - _scheduler.Schedule(TimeSpan.FromSeconds(3), task => - { - Creature midnight1 = ObjectAccessor.GetCreature(me, _midnightGUID); - if (midnight1 != null) - { - if (me.IsWithinMeleeRange(midnight1)) - { - DoCastAOE(SpellIds.SummonAttumenMounted); - me.SetVisible(false); - midnight1.SetVisible(false); - } - else - { - midnight1.GetMotionMaster().MoveChase(me); - me.GetMotionMaster().MoveChase(midnight1); - task.Repeat(TimeSpan.FromSeconds(3)); - } - } - }); - } - } - } - - ObjectGuid _midnightGUID; - Phases _phase; - } - - [Script] - public class boss_midnight : BossAI - { - public boss_midnight(Creature creature) : base(creature, DataTypes.Attumen) - { - Initialize(); - } - - void Initialize() - { - _phase = Phases.None; - } - - public override void Reset() - { - Initialize(); - base.Reset(); - me.SetVisible(true); - me.SetReactState(ReactStates.Defensive); - } - - public override void DamageTaken(Unit attacker, ref uint damage) - { - // Midnight never dies, let health fall to 1 and prevent further damage. - if (damage >= me.GetHealth()) - damage = (uint)(me.GetHealth() - 1); - - if (_phase == Phases.None && me.HealthBelowPctDamaged(95, damage)) - { - _phase = Phases.AttumenEngages; - Talk(TextIds.EmoteCallAttumen); - DoCastAOE(SpellIds.SummonAttumen); - } - else if (_phase == Phases.AttumenEngages && me.HealthBelowPctDamaged(25, damage)) - { - _phase = Phases.Mounted; - DoCastAOE(SpellIds.Mount, true); - } - } - - public override void JustSummoned(Creature summon) - { - if (summon.GetEntry() == CreatureIds.AttumenUnmounted) - { - _attumenGUID = summon.GetGUID(); - summon.GetAI().SetGUID(me.GetGUID(), (int)CreatureIds.Midnight); - summon.GetAI().AttackStart(me.GetVictim()); - summon.GetAI().Talk(TextIds.SayAppear); - } - - base.JustSummoned(summon); - } - - public override void EnterCombat(Unit who) - { - base.EnterCombat(who); - - _scheduler.Schedule(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(25), task => - { - DoCastVictim(SpellIds.Knockdown); - task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(25)); - }); - } - - public override void EnterEvadeMode(EvadeReason why = EvadeReason.Other) - { - base._DespawnAtEvade(10); - } - - public override void KilledUnit(Unit victim) - { - if (_phase == Phases.AttumenEngages) - { - Unit unit = Global.ObjAccessor.GetUnit(me, _attumenGUID); - if (unit != null) - Talk(TextIds.SayMidnightKill, unit); - } - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim() || _phase == Phases.Mounted) - return; - - _scheduler.Update(diff, DoMeleeAttackIfReady); - } - - ObjectGuid _attumenGUID; - Phases _phase; - } -} diff --git a/Source/Scripts/EasternKingdoms/Karazhan/Curator.cs b/Source/Scripts/EasternKingdoms/Karazhan/Curator.cs deleted file mode 100644 index 49f7f07f8..000000000 --- a/Source/Scripts/EasternKingdoms/Karazhan/Curator.cs +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Scripting; -using System; - -namespace Scripts.EasternKingdoms.Karazhan.Curator -{ - struct TextIds - { - public const uint SayAggro = 0; - public const uint SaySummon = 1; - public const uint SayEvocate = 2; - public const uint SayEnrage = 3; - public const uint SayKill = 4; - public const uint SayDeath = 5; - } - - struct SpellIds - { - public const uint HatefulBolt = 30383; - public const uint Evocation = 30254; - public const uint ArcaneInfusion = 30403; - public const uint Berserk = 26662; - public const uint SummonAstralFlareNE = 30236; - public const uint SummonAstralFlareNW = 30239; - public const uint SummonAstralFlareSE = 30240; - public const uint SummonAstralFlareSW = 30241; - } - - struct EventIds - { - public const uint HatefulBolt = 1; - public const uint SummonAstralFlare = 2; - public const uint ArcaneInfusion = 3; - public const uint Berserk = 4; - } - - [Script] - class boss_curator : BossAI - { - public boss_curator(Creature creature) : base(creature, DataTypes.Curator) { } - - public override void Reset() - { - _Reset(); - _infused = false; - me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Arcane, true); - } - - public override void KilledUnit(Unit victim) - { - if (victim.GetTypeId() == TypeId.Player) - Talk(TextIds.SayKill); - } - - public override void JustDied(Unit killer) - { - _JustDied(); - Talk(TextIds.SayDeath); - } - - public override void EnterCombat(Unit victim) - { - _EnterCombat(); - Talk(TextIds.SayAggro); - - _events.ScheduleEvent(EventIds.HatefulBolt, TimeSpan.FromSeconds(12)); - _events.ScheduleEvent(EventIds.SummonAstralFlare, TimeSpan.FromSeconds(10)); - _events.ScheduleEvent(EventIds.Berserk, TimeSpan.FromMinutes(12)); - } - - public override void DamageTaken(Unit attacker, ref uint damage) - { - if (!HealthAbovePct(15) && !_infused) - { - _infused = true; - _events.ScheduleEvent(EventIds.ArcaneInfusion, TimeSpan.FromMilliseconds(1)); - _events.CancelEvent(EventIds.SummonAstralFlare); - } - } - - public override void ExecuteEvent(uint eventId) - { - switch (eventId) - { - case EventIds.HatefulBolt: - Unit target = SelectTarget(SelectAggroTarget.MaxThreat, 1); - if (target != null) - DoCast(target, SpellIds.HatefulBolt); - _events.Repeat(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(15)); - break; - case EventIds.ArcaneInfusion: - DoCastSelf(SpellIds.ArcaneInfusion, true); - break; - case EventIds.SummonAstralFlare: - if (RandomHelper.randChance(50)) - Talk(TextIds.SaySummon); - - - DoCastSelf(RandomHelper.RAND(SpellIds.SummonAstralFlareNE, SpellIds.SummonAstralFlareNW, SpellIds.SummonAstralFlareSE, SpellIds.SummonAstralFlareSW), true); - - int mana = me.GetMaxPower(PowerType.Mana) / 10; - if (mana != 0) - { - me.ModifyPower(PowerType.Mana, -mana); - - if (me.GetPower(PowerType.Mana) * 100 / me.GetMaxPower(PowerType.Mana) < 10) - { - Talk(TextIds.SayEvocate); - me.InterruptNonMeleeSpells(false); - DoCastSelf(SpellIds.Evocation); - } - } - _events.Repeat(TimeSpan.FromSeconds(10)); - break; - case EventIds.Berserk: - Talk(TextIds.SayEnrage); - DoCastSelf(SpellIds.Berserk, true); - break; - default: - break; - } - } - - bool _infused; - } - - [Script] - class npc_curator_astral_flareAI : ScriptedAI - { - public npc_curator_astral_flareAI(Creature creature) : base(creature) - { - me.SetReactState(ReactStates.Passive); - } - - public override void Reset() - { - _scheduler.Schedule(TimeSpan.FromSeconds(2), task => - { - me.SetReactState(ReactStates.Aggressive); - me.RemoveUnitFlag(UnitFlags.NotSelectable); - DoZoneInCombat(); - }); - } - - public override void UpdateAI(uint diff) - { - _scheduler.Update(diff); - } - } -} diff --git a/Source/Scripts/EasternKingdoms/Karazhan/InstanceKarazhan.cs b/Source/Scripts/EasternKingdoms/Karazhan/InstanceKarazhan.cs deleted file mode 100644 index f672c3b9e..000000000 --- a/Source/Scripts/EasternKingdoms/Karazhan/InstanceKarazhan.cs +++ /dev/null @@ -1,477 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.Entities; -using Game.Maps; -using Game.Scripting; - -namespace Scripts.EasternKingdoms.Karazhan -{ - struct karazhanConst - { - public const uint MaxEncounter = 12; - - public static Dialogue[] OzDialogue = - { - new Dialogue(0, 6000), - new Dialogue(1, 18000), - new Dialogue(2, 9000), - new Dialogue(3, 15000) - }; - - public static Dialogue[] HoodDialogue = - { - new Dialogue(4, 6000), - new Dialogue(5, 10000), - new Dialogue(6, 14000), - new Dialogue(7, 15000) - }; - - public static Dialogue[] RAJDialogue = - { - new Dialogue(8, 5000), - new Dialogue(9, 7000), - new Dialogue(10, 14000), - new Dialogue(11, 14000) - }; - - // Entries and spawn locations for creatures in Oz event - public static float[][] Spawns = - { - new float[] { 17535, -10896}, // Dorothee - new float[] { 17546, -10891}, // Roar - new float[] { 17547, -10884}, // Tinhead - new float[] { 17543, -10902}, // Strawman - new float[] { 17603, -10892}, // Grandmother - new float[] { 17534, -10900}, // Julianne - }; - - public static float SPAWN_Z = 90.5f; - public static float SPAWN_Y = -1758f; - public static float SPAWN_O = 4.738f; - - public static string SAY_READY = "Splendid, I'm going to get the audience ready. Break a leg!"; - public static string SAY_OZ_INTRO1 = "Finally, everything is in place. Are you ready for your big stage debut?"; - public static string OZ_GOSSIP1 = "I'm not an actor."; - public static string SAY_OZ_INTRO2 = "Don't worry, you'll be fine. You look like a natural!"; - public static string OZ_GOSSIP2 = "Ok, I'll give it a try, then."; - - public static string SAY_RAJ_INTRO1 = "The romantic plays are really tough, but you'll do better this time. You have TALENT. Ready?"; - public static string RAJ_GOSSIP1 = "I've never been more ready."; - - public static string OZ_GM_GOSSIP1 = "[GM] Change event to EVENT_OZ"; - public static string OZ_GM_GOSSIP2 = "[GM] Change event to EVENT_HOOD"; - public static string OZ_GM_GOSSIP3 = "[GM] Change event to EVENT_RAJ"; - - // Barnes - public const uint SpellSpotlight = 25824; - public const uint SpellTuxedo = 32616; - - // Berthold - public const uint SpellTeleport = 39567; - - // Image of Medivh - public const uint SpellFireBall = 30967; - public const uint SpellUberFireball = 30971; - public const uint SpellConflagrationBlast = 30977; - public const uint SpellManaShield = 31635; - - public const uint NpcArcanagos = 17652; - public const uint NpcSpotlight = 19525; - - public static Position[] OptionalSpawn = - { - new Position(-10960.981445f, -1940.138428f, 46.178097f, 4.12f), // Hyakiss the Lurker - new Position(-10945.769531f, -2040.153320f, 49.474438f, 0.077f), // Shadikith the Glider - new Position(-10899.903320f, -2085.573730f, 49.474449f, 1.38f) // Rokad the Ravager - }; - - public const uint OptionalBossRequiredDeathCount = 50; - } - - struct Dialogue - { - public Dialogue(int textid, uint timer) - { - TextId = textid; - Timer = timer; - } - - public int TextId; - public uint Timer; - } - - struct DataTypes - { - public const uint Attumen = 1; - public const uint Moroes = 2; - public const uint MaidenOfVirtue = 3; - public const uint OptionalBoss = 4; - public const uint OperaPerformance = 5; - public const uint Curator = 6; - public const uint Aran = 7; - public const uint Terestian = 8; - public const uint Netherspite = 9; - public const uint Chess = 10; - public const uint Malchezzar = 11; - public const uint Nightbane = 12; - - public const uint OperaOzDeathcount = 14; - - public const uint Kilrek = 15; - public const uint GoCurtains = 18; - public const uint GoStagedoorleft = 19; - public const uint GoStagedoorright = 20; - public const uint GoLibraryDoor = 21; - public const uint GoMassiveDoor = 22; - public const uint GoNetherDoor = 23; - public const uint GoGameDoor = 24; - public const uint GoGameExitDoor = 25; - - public const uint ImageOfMedivh = 26; - public const uint MastersTerraceDoor1 = 27; - public const uint MastersTerraceDoor2 = 28; - public const uint GoSideEntranceDoor = 29; - public const uint GoBlackenedUrn = 30; - } - - struct OperaEvents - { - public const uint Oz = 1; - public const uint Hood = 2; - public const uint RAJ = 3; - } - - struct CreatureIds - { - public const uint HyakissTheLurker = 16179; - public const uint RokadTheRavager = 16181; - public const uint ShadikithTheGlider = 16180; - public const uint TerestianIllhoof = 15688; - public const uint Moroes = 15687; - public const uint Nightbane = 17225; - public const uint AttumenUnmounted = 15550; - public const uint AttumenMounted = 16152; - public const uint Midnight = 16151; - - // Trash - public const uint ColdmistWidow = 16171; - public const uint ColdmistStalker = 16170; - public const uint Shadowbat = 16173; - public const uint VampiricShadowbat = 16175; - public const uint GreaterShadowbat = 16174; - public const uint PhaseHound = 16178; - public const uint Dreadbeast = 16177; - public const uint Shadowbeast = 16176; - public const uint Kilrek = 17229; - } - - struct GameObjectIds - { - public const uint StageCurtain = 183932; - public const uint StageDoorLeft = 184278; - public const uint StageDoorRight = 184279; - public const uint PrivateLibraryDoor = 184517; - public const uint MassiveDoor = 185521; - public const uint GamesmanHallDoor = 184276; - public const uint GamesmanHallExitDoor = 184277; - public const uint NetherspaceDoor = 185134; - public const uint MastersTerraceDoor = 184274; - public const uint MastersTerraceDoor2 = 184280; - public const uint SideEntranceDoor = 184275; - public const uint DustCoveredChest = 185119; - public const uint BlackenedUrn = 194092; - } - - [Script] - public class instance_karazhan : InstanceMapScript - { - public instance_karazhan() : base("instance_karazhan", 532) { } - - public class instance_karazhan_InstanceMapScript : InstanceScript - { - public instance_karazhan_InstanceMapScript(InstanceMap map) : base(map) - { - SetHeaders("KZ"); - SetBossNumber(karazhanConst.MaxEncounter); - - // 1 - OZ, 2 - HOOD, 3 - RAJ, this never gets altered. - OperaEvent = RandomHelper.URand(1, 3); - OzDeathCount = 0; - OptionalBossCount = 0; - } - - public override void OnCreatureCreate(Creature creature) - { - switch (creature.GetEntry()) - { - case CreatureIds.Kilrek: - KilrekGUID = creature.GetGUID(); - break; - case CreatureIds.TerestianIllhoof: - TerestianGUID = creature.GetGUID(); - break; - case CreatureIds.Moroes: - MoroesGUID = creature.GetGUID(); - break; - case CreatureIds.Nightbane: - NightbaneGUID = creature.GetGUID(); - break; - } - } - - public override void OnUnitDeath(Unit unit) - { - Creature creature = unit.ToCreature(); - if (creature == null) - return; - - switch (creature.GetEntry()) - { - case CreatureIds.ColdmistWidow: - case CreatureIds.ColdmistStalker: - case CreatureIds.Shadowbat: - case CreatureIds.VampiricShadowbat: - case CreatureIds.GreaterShadowbat: - case CreatureIds.PhaseHound: - case CreatureIds.Dreadbeast: - case CreatureIds.Shadowbeast: - if (GetBossState(DataTypes.OptionalBoss) == EncounterState.ToBeDecided) - { - ++OptionalBossCount; - if (OptionalBossCount == karazhanConst.OptionalBossRequiredDeathCount) - { - switch (RandomHelper.URand(CreatureIds.HyakissTheLurker, CreatureIds.RokadTheRavager)) - { - case CreatureIds.HyakissTheLurker: - instance.SummonCreature(CreatureIds.HyakissTheLurker, karazhanConst.OptionalSpawn[0]); - break; - case CreatureIds.ShadikithTheGlider: - instance.SummonCreature(CreatureIds.ShadikithTheGlider, karazhanConst.OptionalSpawn[1]); - break; - case CreatureIds.RokadTheRavager: - instance.SummonCreature(CreatureIds.RokadTheRavager, karazhanConst.OptionalSpawn[2]); - break; - } - } - } - break; - default: - break; - } - } - - public override void SetData(uint type, uint uiData) - { - switch (type) - { - case DataTypes.OperaOzDeathcount: - if (uiData == (uint)EncounterState.Special) - ++OzDeathCount; - else if (uiData == (uint)EncounterState.InProgress) - OzDeathCount = 0; - break; - } - } - - public override bool SetBossState(uint id, EncounterState state) - { - if (!base.SetBossState(id, state)) - return false; - - switch (id) - { - case DataTypes.OperaPerformance: - if (state == EncounterState.Done) - { - HandleGameObject(StageDoorLeftGUID, true); - HandleGameObject(StageDoorRightGUID, true); - GameObject sideEntrance = instance.GetGameObject(SideEntranceDoor); - if (sideEntrance != null) - sideEntrance.RemoveFlag(GameObjectFlags.Locked); - UpdateEncounterStateForKilledCreature(16812, null); - } - break; - case DataTypes.Chess: - if (state == EncounterState.Done) - DoRespawnGameObject(DustCoveredChest, Time.Day); - break; - default: - break; - } - - return true; - } - - public override void SetGuidData(uint identifier, ObjectGuid data) - { - if (identifier == DataTypes.ImageOfMedivh) - ImageGUID = data; - } - - public override void OnGameObjectCreate(GameObject go) - { - switch (go.GetEntry()) - { - case GameObjectIds.StageCurtain: - CurtainGUID = go.GetGUID(); - break; - case GameObjectIds.StageDoorLeft: - StageDoorLeftGUID = go.GetGUID(); - if (GetBossState(DataTypes.OperaPerformance) == EncounterState.Done) - go.SetGoState(GameObjectState.Active); - break; - case GameObjectIds.StageDoorRight: - StageDoorRightGUID = go.GetGUID(); - if (GetBossState(DataTypes.OperaPerformance) == EncounterState.Done) - go.SetGoState(GameObjectState.Active); - break; - case GameObjectIds.PrivateLibraryDoor: - LibraryDoor = go.GetGUID(); - break; - case GameObjectIds.MassiveDoor: - MassiveDoor = go.GetGUID(); - break; - case GameObjectIds.GamesmanHallDoor: - GamesmansDoor = go.GetGUID(); - break; - case GameObjectIds.GamesmanHallExitDoor: - GamesmansExitDoor = go.GetGUID(); - break; - case GameObjectIds.NetherspaceDoor: - NetherspaceDoor = go.GetGUID(); - break; - case GameObjectIds.MastersTerraceDoor: - MastersTerraceDoor[0] = go.GetGUID(); - break; - case GameObjectIds.MastersTerraceDoor2: - MastersTerraceDoor[1] = go.GetGUID(); - break; - case GameObjectIds.SideEntranceDoor: - SideEntranceDoor = go.GetGUID(); - if (GetBossState(DataTypes.OperaPerformance) == EncounterState.Done) - go.AddFlag(GameObjectFlags.Locked); - else - go.RemoveFlag(GameObjectFlags.Locked); - break; - case GameObjectIds.DustCoveredChest: - DustCoveredChest = go.GetGUID(); - break; - case GameObjectIds.BlackenedUrn: - BlackenedUrnGUID = go.GetGUID(); - break; - } - - switch (OperaEvent) - { - // @todo Set Object visibilities for Opera based on performance - case OperaEvents.Oz: - break; - - case OperaEvents.Hood: - break; - - case OperaEvents.RAJ: - break; - } - } - - public override uint GetData(uint uiData) - { - switch (uiData) - { - case DataTypes.OperaPerformance: - return OperaEvent; - case DataTypes.OperaOzDeathcount: - return OzDeathCount; - } - - return 0; - } - - public override ObjectGuid GetGuidData(uint uiData) - { - switch (uiData) - { - case DataTypes.Kilrek: - return KilrekGUID; - case DataTypes.Terestian: - return TerestianGUID; - case DataTypes.Moroes: - return MoroesGUID; - case DataTypes.Nightbane: - return NightbaneGUID; - case DataTypes.GoStagedoorleft: - return StageDoorLeftGUID; - case DataTypes.GoStagedoorright: - return StageDoorRightGUID; - case DataTypes.GoCurtains: - return CurtainGUID; - case DataTypes.GoLibraryDoor: - return LibraryDoor; - case DataTypes.GoMassiveDoor: - return MassiveDoor; - case DataTypes.GoSideEntranceDoor: - return SideEntranceDoor; - case DataTypes.GoGameDoor: - return GamesmansDoor; - case DataTypes.GoGameExitDoor: - return GamesmansExitDoor; - case DataTypes.GoNetherDoor: - return NetherspaceDoor; - case DataTypes.MastersTerraceDoor1: - return MastersTerraceDoor[0]; - case DataTypes.MastersTerraceDoor2: - return MastersTerraceDoor[1]; - case DataTypes.ImageOfMedivh: - return ImageGUID; - case DataTypes.GoBlackenedUrn: - return BlackenedUrnGUID; - } - - return ObjectGuid.Empty; - } - - uint OperaEvent; - uint OzDeathCount; - uint OptionalBossCount; - ObjectGuid CurtainGUID; - ObjectGuid StageDoorLeftGUID; - ObjectGuid StageDoorRightGUID; - ObjectGuid KilrekGUID; - ObjectGuid TerestianGUID; - ObjectGuid MoroesGUID; - ObjectGuid NightbaneGUID; - ObjectGuid LibraryDoor; // Door at Shade of Aran - ObjectGuid MassiveDoor; // Door at Netherspite - ObjectGuid SideEntranceDoor; // Side Entrance - ObjectGuid GamesmansDoor; // Door before Chess - ObjectGuid GamesmansExitDoor; // Door after Chess - ObjectGuid NetherspaceDoor; // Door at Malchezaar - ObjectGuid[] MastersTerraceDoor = new ObjectGuid[2]; - ObjectGuid ImageGUID; - ObjectGuid DustCoveredChest; - ObjectGuid BlackenedUrnGUID; - } - - public override InstanceScript GetInstanceScript(InstanceMap map) - { - return new instance_karazhan_InstanceMapScript(map); - } - } -} diff --git a/Source/Scripts/EasternKingdoms/Karazhan/Moroes.cs b/Source/Scripts/EasternKingdoms/Karazhan/Moroes.cs deleted file mode 100644 index 6c3e1fe3c..000000000 --- a/Source/Scripts/EasternKingdoms/Karazhan/Moroes.cs +++ /dev/null @@ -1,725 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using System.Collections.Generic; - -namespace Scripts.EasternKingdoms.Karazhan.Moroes -{ - struct Misc - { - public static Position[] Locations = - { - new Position(-10991.0f, -1884.33f, 81.73f, 0.614315f), - new Position(-10989.4f, -1885.88f, 81.73f, 0.904913f), - new Position(-10978.1f, -1887.07f, 81.73f, 2.035550f), - new Position(-10975.9f, -1885.81f, 81.73f, 2.253890f), - }; - - public static uint[] Adds = - { - 17007, - 19872, - 19873, - 19874, - 19875, - 19876, - }; - } - - struct TextIds - { - public const uint Aggro = 0; - public const uint Special = 1; - public const uint Kill = 2; - public const uint Death = 3; - } - - struct SpellIds - { - public const uint Vanish = 29448; - public const uint Garrote = 37066; - public const uint Blind = 34694; - public const uint Gouge = 29425; - public const uint Frenzy = 37023; - - // Adds - public const uint Manaburn = 29405; - public const uint Mindfly = 29570; - public const uint Swpain = 34441; - public const uint Shadowform = 29406; - - public const uint Hammerofjustice = 13005; - public const uint Judgementofcommand = 29386; - public const uint Sealofcommand = 29385; - - public const uint Dispelmagic = 15090; - public const uint Greaterheal = 29564; - public const uint Holyfire = 29563; - public const uint Pwshield = 29408; - - public const uint Cleanse = 29380; - public const uint Greaterblessofmight = 29381; - public const uint Holylight = 29562; - public const uint Divineshield = 41367; - - public const uint Hamstring = 9080; - public const uint Mortalstrike = 29572; - public const uint Whirlwind = 29573; - - public const uint Disarm = 8379; - public const uint Heroicstrike = 29567; - public const uint Shieldbash = 11972; - public const uint Shieldwall = 29390; - } - - [Script] - public class boss_moroes : ScriptedAI - { - public boss_moroes(Creature creature) : base(creature) - { - instance = creature.GetInstanceScript(); - } - - public override void Reset() - { - Vanish_Timer = 30000; - Blind_Timer = 35000; - Gouge_Timer = 23000; - Wait_Timer = 0; - CheckAdds_Timer = 5000; - - Enrage = false; - InVanish = false; - if (me.IsAlive()) - SpawnAdds(); - - instance.SetBossState(DataTypes.Moroes, EncounterState.NotStarted); - } - - void StartEvent() - { - instance.SetBossState(DataTypes.Moroes, EncounterState.InProgress); - - DoZoneInCombat(); - } - - public override void EnterCombat(Unit who) - { - StartEvent(); - - Talk(TextIds.Aggro); - AddsAttack(); - DoZoneInCombat(); - } - - public override void KilledUnit(Unit victim) - { - Talk(TextIds.Kill); - } - - public override void JustDied(Unit killer) - { - Talk(TextIds.Death); - - instance.SetBossState(DataTypes.Moroes, EncounterState.Done); - - DeSpawnAdds(); - - //remove aura from spell Garrote when Moroes dies - instance.DoRemoveAurasDueToSpellOnPlayers(SpellIds.Garrote); - } - - void SpawnAdds() - { - DeSpawnAdds(); - - if (isAddlistEmpty()) - { - List AddList = new List(); - - for (byte i = 0; i < 6; ++i) - AddList.Add(Misc.Adds[i]); - - AddList.RandomResize(4); - - byte c = 0; - for (var i = 0; i != AddList.Count && c < 4; ++i, ++c) - { - uint entry = AddList[i]; - Creature creature = me.SummonCreature(entry, Misc.Locations[c], TempSummonType.CorpseTimedDespawn, 10000); - if (creature) - { - AddGUID[c] = creature.GetGUID(); - AddId[c] = entry; - } - } - } - else - { - for (byte i = 0; i < 4; ++i) - { - Creature creature = me.SummonCreature(AddId[i], Misc.Locations[i], TempSummonType.CorpseTimedDespawn, 10000); - if (creature) - AddGUID[i] = creature.GetGUID(); - } - } - } - - bool isAddlistEmpty() - { - for (byte i = 0; i < 4; ++i) - if (AddId[i] == 0) - return true; - - return false; - } - - void DeSpawnAdds() - { - for (byte i = 0; i < 4; ++i) - { - if (!AddGUID[i].IsEmpty()) - { - Creature temp = ObjectAccessor.GetCreature(me, AddGUID[i]); - if (temp) - temp.DespawnOrUnsummon(); - } - } - } - - void AddsAttack() - { - for (byte i = 0; i < 4; ++i) - { - if (!AddGUID[i].IsEmpty()) - { - Creature temp = ObjectAccessor.GetCreature((me), AddGUID[i]); - if (temp && temp.IsAlive()) - { - temp.GetAI().AttackStart(me.GetVictim()); - DoZoneInCombat(temp); - } - else - EnterEvadeMode(); - } - } - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - if (instance.GetData(DataTypes.Moroes) == 0) - { - EnterEvadeMode(); - return; - } - - if (!Enrage && HealthBelowPct(30)) - { - DoCast(me, SpellIds.Frenzy); - Enrage = true; - } - - if (CheckAdds_Timer <= diff) - { - for (byte i = 0; i < 4; ++i) - { - if (!AddGUID[i].IsEmpty()) - { - Creature temp = ObjectAccessor.GetCreature((me), AddGUID[i]); - if (temp && temp.IsAlive()) - if (!temp.GetVictim()) - temp.GetAI().AttackStart(me.GetVictim()); - } - } - CheckAdds_Timer = 5000; - } - else CheckAdds_Timer -= diff; - - if (!Enrage) - { - //Cast Vanish, then Garrote random victim - if (Vanish_Timer <= diff) - { - DoCast(me, SpellIds.Vanish); - InVanish = true; - Vanish_Timer = 30000; - Wait_Timer = 5000; - } - else Vanish_Timer -= diff; - - if (Gouge_Timer <= diff) - { - DoCastVictim(SpellIds.Gouge); - Gouge_Timer = 40000; - } - else Gouge_Timer -= diff; - - if (Blind_Timer <= diff) - { - Unit target = SelectTarget(SelectAggroTarget.MinDistance, 0, 0.0f, true, false); - if (target != null) - DoCast(target, SpellIds.Blind); - Blind_Timer = 40000; - } - else - Blind_Timer -= diff; - } - - if (InVanish) - { - if (Wait_Timer <= diff) - { - Talk(TextIds.Special); - - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100, true); - if (target) - target.CastSpell(target, SpellIds.Garrote, true); - - InVanish = false; - } - else - Wait_Timer -= diff; - } - - if (!InVanish) - DoMeleeAttackIfReady(); - } - - InstanceScript instance; - - public ObjectGuid[] AddGUID = new ObjectGuid[4]; - - uint Vanish_Timer; - uint Blind_Timer; - uint Gouge_Timer; - uint Wait_Timer; - uint CheckAdds_Timer; - uint[] AddId = new uint[4]; - - bool InVanish; - bool Enrage; - } - - class boss_moroes_guestAI : ScriptedAI - { - public boss_moroes_guestAI(Creature creature) : base(creature) - { - instance = creature.GetInstanceScript(); - } - - public override void Reset() - { - instance.SetBossState(DataTypes.Moroes, EncounterState.NotStarted); - } - - public void AcquireGUID() - { - Creature Moroes = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.Moroes)); - if (Moroes) - { - for (byte i = 0; i < 4; ++i) - { - ObjectGuid GUID = ((boss_moroes)Moroes.GetAI()).AddGUID[i]; - if (!GUID.IsEmpty()) - GuestGUID[i] = GUID; - } - } - - } - - public Unit SelectGuestTarget() - { - ObjectGuid TempGUID = GuestGUID[RandomHelper.Rand32() % 4]; - if (!TempGUID.IsEmpty()) - { - Unit unit = Global.ObjAccessor.GetUnit(me, TempGUID); - if (unit && unit.IsAlive()) - return unit; - } - - return me; - } - - public override void UpdateAI(uint diff) - { - if (instance.GetData(DataTypes.Moroes) == 0) - EnterEvadeMode(); - - DoMeleeAttackIfReady(); - } - - InstanceScript instance; - - ObjectGuid[] GuestGUID = new ObjectGuid[4]; - } - - [Script] - class boss_baroness_dorothea_millstipe : boss_moroes_guestAI - { - //Shadow Priest - public boss_baroness_dorothea_millstipe(Creature creature) : base(creature) { } - - uint ManaBurn_Timer; - uint MindFlay_Timer; - uint ShadowWordPain_Timer; - - public override void Reset() - { - ManaBurn_Timer = 7000; - MindFlay_Timer = 1000; - ShadowWordPain_Timer = 6000; - - DoCast(me, SpellIds.Shadowform, true); - - base.Reset(); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - base.UpdateAI(diff); - - if (MindFlay_Timer <= diff) - { - DoCastVictim(SpellIds.Mindfly); - MindFlay_Timer = 12000; // 3 sec channeled - } - else MindFlay_Timer -= diff; - - if (ManaBurn_Timer <= diff) - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100, true); - if (target) - if (target.GetPowerType() == PowerType.Mana) - DoCast(target, SpellIds.Manaburn); - ManaBurn_Timer = 5000; // 3 sec cast - } - else ManaBurn_Timer -= diff; - - if (ShadowWordPain_Timer <= diff) - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100, true); - if (target) - { - DoCast(target, SpellIds.Swpain); - ShadowWordPain_Timer = 7000; - } - } - else ShadowWordPain_Timer -= diff; - } - } - - [Script] - class boss_baron_rafe_dreuger : boss_moroes_guestAI - { - //Retr Pally - public boss_baron_rafe_dreuger(Creature creature) : base(creature) { } - - uint HammerOfJustice_Timer; - uint SealOfCommand_Timer; - uint JudgementOfCommand_Timer; - - public override void Reset() - { - HammerOfJustice_Timer = 1000; - SealOfCommand_Timer = 7000; - JudgementOfCommand_Timer = SealOfCommand_Timer + 29000; - - base.Reset(); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - base.UpdateAI(diff); - - if (SealOfCommand_Timer <= diff) - { - DoCast(me, SpellIds.Sealofcommand); - SealOfCommand_Timer = 32000; - JudgementOfCommand_Timer = 29000; - } - else SealOfCommand_Timer -= diff; - - if (JudgementOfCommand_Timer <= diff) - { - DoCastVictim(SpellIds.Judgementofcommand); - JudgementOfCommand_Timer = SealOfCommand_Timer + 29000; - } - else JudgementOfCommand_Timer -= diff; - - if (HammerOfJustice_Timer <= diff) - { - DoCastVictim(SpellIds.Hammerofjustice); - HammerOfJustice_Timer = 12000; - } - else HammerOfJustice_Timer -= diff; - } - } - - [Script] - class boss_lady_catriona_von_indi : boss_moroes_guestAI - { - //Holy Priest - public boss_lady_catriona_von_indi(Creature creature) : base(creature) { } - - uint DispelMagic_Timer; - uint GreaterHeal_Timer; - uint HolyFire_Timer; - uint PowerWordShield_Timer; - - public override void Reset() - { - DispelMagic_Timer = 11000; - GreaterHeal_Timer = 1500; - HolyFire_Timer = 5000; - PowerWordShield_Timer = 1000; - - AcquireGUID(); - - base.Reset(); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - base.UpdateAI(diff); - - if (PowerWordShield_Timer <= diff) - { - DoCast(me, SpellIds.Pwshield); - PowerWordShield_Timer = 15000; - } - else PowerWordShield_Timer -= diff; - - if (GreaterHeal_Timer <= diff) - { - Unit target = SelectGuestTarget(); - - DoCast(target, SpellIds.Greaterheal); - GreaterHeal_Timer = 17000; - } - else GreaterHeal_Timer -= diff; - - if (HolyFire_Timer <= diff) - { - DoCastVictim(SpellIds.Holyfire); - HolyFire_Timer = 22000; - } - else HolyFire_Timer -= diff; - - if (DispelMagic_Timer <= diff) - { - Unit target = RandomHelper.RAND(SelectGuestTarget(), SelectTarget(SelectAggroTarget.Random, 0, 100, true)); - if (target) - DoCast(target, SpellIds.Dispelmagic); - - DispelMagic_Timer = 25000; - } - else DispelMagic_Timer -= diff; - } - } - - [Script] - class boss_lady_keira_berrybuck : boss_moroes_guestAI - { - //Holy Pally - public boss_lady_keira_berrybuck(Creature creature) : base(creature) { } - - uint Cleanse_Timer; - uint GreaterBless_Timer; - uint HolyLight_Timer; - uint DivineShield_Timer; - - public override void Reset() - { - Cleanse_Timer = 13000; - GreaterBless_Timer = 1000; - HolyLight_Timer = 7000; - DivineShield_Timer = 31000; - - AcquireGUID(); - - base.Reset(); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - base.UpdateAI(diff); - - if (DivineShield_Timer <= diff) - { - DoCast(me, SpellIds.Divineshield); - DivineShield_Timer = 31000; - } - else DivineShield_Timer -= diff; - - if (HolyLight_Timer <= diff) - { - Unit target = SelectGuestTarget(); - - DoCast(target, SpellIds.Holylight); - HolyLight_Timer = 10000; - } - else HolyLight_Timer -= diff; - - if (GreaterBless_Timer <= diff) - { - Unit target = SelectGuestTarget(); - - DoCast(target, SpellIds.Greaterblessofmight); - - GreaterBless_Timer = 50000; - } - else GreaterBless_Timer -= diff; - - if (Cleanse_Timer <= diff) - { - Unit target = SelectGuestTarget(); - - DoCast(target, SpellIds.Cleanse); - - Cleanse_Timer = 10000; - } - else Cleanse_Timer -= diff; - } - } - - [Script] - class boss_lord_robin_daris : boss_moroes_guestAI - { - //Arms Warr - public boss_lord_robin_daris(Creature creature) : base(creature) { } - - uint Hamstring_Timer; - uint MortalStrike_Timer; - uint WhirlWind_Timer; - - public override void Reset() - { - Hamstring_Timer = 7000; - MortalStrike_Timer = 10000; - WhirlWind_Timer = 21000; - - base.Reset(); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - base.UpdateAI(diff); - - if (Hamstring_Timer <= diff) - { - DoCastVictim(SpellIds.Hamstring); - Hamstring_Timer = 12000; - } - else Hamstring_Timer -= diff; - - if (MortalStrike_Timer <= diff) - { - DoCastVictim(SpellIds.Mortalstrike); - MortalStrike_Timer = 18000; - } - else MortalStrike_Timer -= diff; - - if (WhirlWind_Timer <= diff) - { - DoCast(me, SpellIds.Whirlwind); - WhirlWind_Timer = 21000; - } - else WhirlWind_Timer -= diff; - } - } - - [Script] - class boss_lord_crispin_ference : boss_moroes_guestAI - { - //Arms Warr - public boss_lord_crispin_ference(Creature creature) : base(creature) { } - - uint Disarm_Timer; - uint HeroicStrike_Timer; - uint ShieldBash_Timer; - uint ShieldWall_Timer; - - public override void Reset() - { - Disarm_Timer = 6000; - HeroicStrike_Timer = 10000; - ShieldBash_Timer = 8000; - ShieldWall_Timer = 4000; - - base.Reset(); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - base.UpdateAI(diff); - - if (Disarm_Timer <= diff) - { - DoCastVictim(SpellIds.Disarm); - Disarm_Timer = 12000; - } - else Disarm_Timer -= diff; - - if (HeroicStrike_Timer <= diff) - { - DoCastVictim(SpellIds.Heroicstrike); - HeroicStrike_Timer = 10000; - } - else HeroicStrike_Timer -= diff; - - if (ShieldBash_Timer <= diff) - { - DoCastVictim(SpellIds.Shieldbash); - ShieldBash_Timer = 13000; - } - else ShieldBash_Timer -= diff; - - if (ShieldWall_Timer <= diff) - { - DoCast(me, SpellIds.Shieldwall); - ShieldWall_Timer = 21000; - } - else ShieldWall_Timer -= diff; - } - } -} diff --git a/Source/Scripts/EasternKingdoms/Karazhan/OperaEvent.cs b/Source/Scripts/EasternKingdoms/Karazhan/OperaEvent.cs deleted file mode 100644 index 71d43c6a7..000000000 --- a/Source/Scripts/EasternKingdoms/Karazhan/OperaEvent.cs +++ /dev/null @@ -1,1657 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using Game.Spells; -using System.Collections.Generic; - -namespace Scripts.EasternKingdoms.Karazhan.OperaEvent -{ - struct TextIds - { - public const uint SayDorotheeDeath = 0; - public const uint SayDorotheeSummon = 1; - public const uint SayDorotheeTitoDeath = 2; - public const uint SayDorotheeAggro = 3; - - public const uint SayRoarAggro = 0; - public const uint SayRoarDeath = 1; - public const uint SayRoarSlay = 2; - - public const uint SayStrawmanAggro = 0; - public const uint SayStrawmanDeath = 1; - public const uint SayStrawmanSlay = 2; - - public const uint SayTinheadAggro = 0; - public const uint SayTinheadDeath = 1; - public const uint SayTinheadSlay = 2; - public const uint EmoteRust = 3; - - public const uint SayCroneAggro = 0; - public const uint SayCroneDeath = 1; - public const uint SayCroneSlay = 2; - } - - struct SpellIds - { - // Dorothee - public const uint Waterbolt = 31012; - public const uint Scream = 31013; - public const uint Summontito = 31014; - - // Tito - public const uint Yipping = 31015; - - // Strawman - public const uint BrainBash = 31046; - public const uint BrainWipe = 31069; - public const uint BurningStraw = 31075; - - // Tinhead - public const uint Cleave = 31043; - public const uint Rust = 31086; - - // Roar - public const uint Mangle = 31041; - public const uint Shred = 31042; - public const uint FrightenedScream = 31013; - - // Crone - public const uint ChainLightning = 32337; - - // Cyclone - public const uint Knockback = 32334; - public const uint CycloneVisual = 32332; - } - - struct CreatureIds - { - public const uint Tito = 17548; - public const uint Cyclone = 18412; - public const uint Crone = 18168; - } - - #region Wizard of Oz - public abstract class WizardofOzBase : ScriptedAI - { - public WizardofOzBase(Creature creature) : base(creature) - { - Initialize(); - instance = creature.GetInstanceScript(); - } - - public abstract void Initialize(); - - public override void Reset() - { - Initialize(); - } - - public void SummonCroneIfReady(InstanceScript instance, Creature creature) - { - instance.SetBossState(DataTypes.OperaOzDeathcount, EncounterState.Special); // Increment DeathCount - - if (instance.GetData(DataTypes.OperaOzDeathcount) == 4) - { - Creature pCrone = creature.SummonCreature(CreatureIds.Crone, -10891.96f, -1755.95f, creature.GetPositionZ(), 4.64f, TempSummonType.TimedOrDeadDespawn, Time.Hour * 2 * Time.InMilliseconds); - if (pCrone) - { - if (creature.GetVictim()) - pCrone.GetAI().AttackStart(creature.GetVictim()); - } - } - } - - public bool TitoDied; - public ObjectGuid DorotheeGUID; - public uint AggroTimer; - - public InstanceScript instance; - } - - [Script] - public class boss_dorothee : WizardofOzBase - { - public boss_dorothee(Creature creature) : base(creature) { } - - public override void Initialize() - { - AggroTimer = 500; - - WaterBoltTimer = 5000; - FearTimer = 15000; - SummonTitoTimer = 47500; - - SummonedTito = false; - TitoDied = false; - } - - public override void EnterCombat(Unit who) - { - Talk(TextIds.SayDorotheeAggro); - } - - public override void JustReachedHome() - { - me.DespawnOrUnsummon(); - } - - public override void JustDied(Unit killer) - { - Talk(TextIds.SayDorotheeDeath); - - SummonCroneIfReady(instance, me); - } - - public override void AttackStart(Unit who) - { - if (me.HasUnitFlag(UnitFlags.NonAttackable)) - return; - - base.AttackStart(who); - } - - public override void MoveInLineOfSight(Unit who) - { - if (me.HasUnitFlag(UnitFlags.NonAttackable)) - return; - - base.MoveInLineOfSight(who); - } - - public override void UpdateAI(uint diff) - { - if (AggroTimer != 0) - { - if (AggroTimer <= diff) - { - me.RemoveUnitFlag(UnitFlags.NonAttackable); - AggroTimer = 0; - } - else AggroTimer -= diff; - } - - if (!UpdateVictim()) - return; - - if (WaterBoltTimer <= diff) - { - DoCast(SelectTarget(SelectAggroTarget.Random, 0), SpellIds.Waterbolt); - WaterBoltTimer = (uint)(TitoDied ? 1500 : 5000); - } - else WaterBoltTimer -= diff; - - if (FearTimer <= diff) - { - DoCastVictim(SpellIds.Scream); - FearTimer = 30000; - } - else FearTimer -= diff; - - if (!SummonedTito) - { - if (SummonTitoTimer <= diff) - SummonTito(); - else SummonTitoTimer -= diff; - } - - DoMeleeAttackIfReady(); - } - - void SummonTito() - { - Creature pTito = me.SummonCreature(CreatureIds.Tito, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.TimedDespawnOOC, 30000); - if (pTito) - { - Talk(TextIds.SayDorotheeSummon); - DorotheeGUID = me.GetGUID(); - pTito.GetAI().AttackStart(me.GetVictim()); - SummonedTito = true; - TitoDied = false; - } - } - - uint WaterBoltTimer; - uint FearTimer; - uint SummonTitoTimer; - - bool SummonedTito; - } - - [Script] - public class npc_tito : WizardofOzBase - { - public npc_tito(Creature creature) : base(creature) - { - Initialize(); - } - - public override void Initialize() - { - DorotheeGUID.Clear(); - YipTimer = 10000; - } - - public override void EnterCombat(Unit who) { } - - public override void JustDied(Unit killer) - { - if (!DorotheeGUID.IsEmpty()) - { - Creature Dorothee = ObjectAccessor.GetCreature(me, DorotheeGUID); - if (Dorothee && Dorothee.IsAlive()) - { - TitoDied = true; - Talk(TextIds.SayDorotheeTitoDeath, Dorothee); - } - } - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - if (YipTimer <= diff) - { - DoCastVictim(SpellIds.Yipping); - YipTimer = 10000; - } - else YipTimer -= diff; - - DoMeleeAttackIfReady(); - } - - uint YipTimer; - } - - [Script] - class boss_strawman : WizardofOzBase - { - public boss_strawman(Creature creature) : base(creature) - { - Initialize(); - instance = creature.GetInstanceScript(); - } - - public override void Initialize() - { - AggroTimer = 13000; - BrainBashTimer = 5000; - BrainWipeTimer = 7000; - } - - public override void AttackStart(Unit who) - { - if (me.HasUnitFlag(UnitFlags.NonAttackable)) - return; - - base.AttackStart(who); - } - - public override void MoveInLineOfSight(Unit who) - { - if (me.HasUnitFlag(UnitFlags.NonAttackable)) - return; - - base.MoveInLineOfSight(who); - } - - public override void EnterCombat(Unit who) - { - Talk(TextIds.SayStrawmanAggro); - } - - public override void SpellHit(Unit caster, SpellInfo Spell) - { - if ((Spell.SchoolMask == SpellSchoolMask.Fire) && ((RandomHelper.randChance() % 10) == 0)) - { - DoCast(me, SpellIds.BurningStraw, true); - } - } - - public override void JustDied(Unit killer) - { - Talk(TextIds.SayStrawmanDeath); - - SummonCroneIfReady(instance, me); - } - - public override void KilledUnit(Unit victim) - { - Talk(TextIds.SayStrawmanSlay); - } - - public override void UpdateAI(uint diff) - { - if (AggroTimer != 0) - { - if (AggroTimer <= diff) - { - me.RemoveUnitFlag(UnitFlags.NonAttackable); - AggroTimer = 0; - } - else AggroTimer -= diff; - } - - if (!UpdateVictim()) - return; - - if (BrainBashTimer <= diff) - { - DoCastVictim(SpellIds.BrainBash); - BrainBashTimer = 15000; - } - else BrainBashTimer -= diff; - - if (BrainWipeTimer <= diff) - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100, true); - if (target) - DoCast(target, SpellIds.BrainWipe); - BrainWipeTimer = 20000; - } - else BrainWipeTimer -= diff; - - DoMeleeAttackIfReady(); - } - - uint BrainBashTimer; - uint BrainWipeTimer; - } - - [Script] - class boss_tinhead : WizardofOzBase - { - public boss_tinhead(Creature creature) : base(creature) { } - - public override void Initialize() - { - AggroTimer = 15000; - CleaveTimer = 5000; - RustTimer = 30000; - - RustCount = 0; - } - - public override void EnterCombat(Unit who) - { - Talk(TextIds.SayTinheadAggro); - } - - public override void JustReachedHome() - { - me.DespawnOrUnsummon(); - } - - public override void AttackStart(Unit who) - { - if (me.HasUnitFlag(UnitFlags.NonAttackable)) - return; - - base.AttackStart(who); - } - - public override void MoveInLineOfSight(Unit who) - { - if (me.HasUnitFlag(UnitFlags.NonAttackable)) - return; - - base.MoveInLineOfSight(who); - } - - public override void JustDied(Unit killer) - { - Talk(TextIds.SayTinheadDeath); - - SummonCroneIfReady(instance, me); - } - - public override void KilledUnit(Unit victim) - { - Talk(TextIds.SayTinheadSlay); - } - - public override void UpdateAI(uint diff) - { - if (AggroTimer != 0) - { - if (AggroTimer <= diff) - { - me.RemoveUnitFlag(UnitFlags.NonAttackable); - AggroTimer = 0; - } - else AggroTimer -= diff; - } - - if (!UpdateVictim()) - return; - - if (CleaveTimer <= diff) - { - DoCastVictim(SpellIds.Cleave); - CleaveTimer = 5000; - } - else CleaveTimer -= diff; - - if (RustCount < 8) - { - if (RustTimer <= diff) - { - ++RustCount; - Talk(TextIds.EmoteRust); - DoCast(me, SpellIds.Rust); - RustTimer = 6000; - } - else RustTimer -= diff; - } - - DoMeleeAttackIfReady(); - } - - uint CleaveTimer; - uint RustTimer; - - byte RustCount; - } - - [Script] - class boss_roar : WizardofOzBase - { - public boss_roar(Creature creature) : base(creature) { } - - public override void Initialize() - { - AggroTimer = 20000; - MangleTimer = 5000; - ShredTimer = 10000; - ScreamTimer = 15000; - } - - public override void AttackStart(Unit who) - { - if (me.HasUnitFlag(UnitFlags.NonAttackable)) - return; - - base.AttackStart(who); - } - - public override void MoveInLineOfSight(Unit who) - { - if (me.HasUnitFlag(UnitFlags.NonAttackable)) - return; - - base.MoveInLineOfSight(who); - } - - public override void EnterCombat(Unit who) - { - Talk(TextIds.SayRoarAggro); - } - - public override void JustReachedHome() - { - me.DespawnOrUnsummon(); - } - - public override void JustDied(Unit killer) - { - Talk(TextIds.SayRoarDeath); - - SummonCroneIfReady(instance, me); - } - - public override void KilledUnit(Unit victim) - { - Talk(TextIds.SayRoarSlay); - } - - public override void UpdateAI(uint diff) - { - if (AggroTimer != 0) - { - if (AggroTimer <= diff) - { - me.RemoveUnitFlag(UnitFlags.NonAttackable); - AggroTimer = 0; - } - else AggroTimer -= diff; - } - - if (!UpdateVictim()) - return; - - if (MangleTimer <= diff) - { - DoCastVictim(SpellIds.Mangle); - MangleTimer = RandomHelper.URand(5000, 8000); - } - else MangleTimer -= diff; - - if (ShredTimer <= diff) - { - DoCastVictim(SpellIds.Shred); - ShredTimer = RandomHelper.URand(10000, 15000); - } - else ShredTimer -= diff; - - if (ScreamTimer <= diff) - { - DoCastVictim(SpellIds.FrightenedScream); - ScreamTimer = RandomHelper.URand(20000, 30000); - } - else ScreamTimer -= diff; - - DoMeleeAttackIfReady(); - } - - uint MangleTimer; - uint ShredTimer; - uint ScreamTimer; - } - - [Script] - class boss_crone : WizardofOzBase - { - public boss_crone(Creature creature) : base(creature) - { - instance = creature.GetInstanceScript(); - } - - public override void Initialize() - { - me.RemoveUnitFlag(UnitFlags.ImmuneToPc | UnitFlags.NonAttackable); - CycloneTimer = 30000; - ChainLightningTimer = 10000; - } - - public override void JustReachedHome() - { - me.DespawnOrUnsummon(); - } - - public override void KilledUnit(Unit victim) - { - Talk(TextIds.SayCroneSlay); - } - - public override void EnterCombat(Unit who) - { - Talk(TextIds.SayCroneAggro); - me.RemoveUnitFlag(UnitFlags.NonAttackable); - me.RemoveUnitFlag(UnitFlags.ImmuneToPc); - } - - public override void JustDied(Unit killer) - { - Talk(TextIds.SayCroneDeath); - - instance.SetBossState(DataTypes.OperaPerformance, EncounterState.Done); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - if (me.HasUnitFlag(UnitFlags.NonAttackable)) - me.RemoveUnitFlag(UnitFlags.NonAttackable); - - if (CycloneTimer <= diff) - { - Creature Cyclone = DoSpawnCreature(CreatureIds.Cyclone, RandomHelper.FRand(0, 9), RandomHelper.FRand(0, 9), 0, 0, TempSummonType.TimedDespawn, 15000); - if (Cyclone) - Cyclone.CastSpell(Cyclone, SpellIds.CycloneVisual, true); - CycloneTimer = 30000; - } - else CycloneTimer -= diff; - - if (ChainLightningTimer <= diff) - { - DoCastVictim(SpellIds.ChainLightning); - ChainLightningTimer = 15000; - } - else ChainLightningTimer -= diff; - - DoMeleeAttackIfReady(); - } - - uint CycloneTimer; - uint ChainLightningTimer; - } - - [Script] - class npc_cyclone : ScriptedAI - { - public npc_cyclone(Creature creature) : base(creature) { } - - public override void Reset() - { - MoveTimer = 1000; - } - - public override void EnterCombat(Unit who) { } - - public override void MoveInLineOfSight(Unit who) { } - - public override void UpdateAI(uint diff) - { - if (!me.HasAura(SpellIds.Knockback)) - DoCast(me, SpellIds.Knockback, true); - - if (MoveTimer <= diff) - { - Position pos = me.GetRandomNearPosition(10); - me.GetMotionMaster().MovePoint(0, pos); - MoveTimer = RandomHelper.URand(5000, 8000); - } - else MoveTimer -= diff; - } - - uint MoveTimer; - } - - #endregion - - #region Red Riding Hood - struct RedRidingHood - { - public const uint SayWolfAggro = 0; - public const uint SayWolfSlay = 1; - public const uint SayWolfHood = 2; - public const uint OptionWhatPhatLewtsYouHave = 7443; - public const uint SoundWolfDeath = 9275; - - public const uint SpellLittleRedRidingHood = 30768; - public const uint SpellTerrifyingHowl = 30752; - public const uint SpellWideSwipe = 30761; - - public const uint NpcBigBadWolf = 17521; - } - - [Script] - class npc_grandmother : ScriptedAI - { - public npc_grandmother(Creature creature) : base(creature) { } - - public override bool GossipSelect(Player player, uint menuId, uint gossipListId) - { - if (menuId == RedRidingHood.OptionWhatPhatLewtsYouHave && gossipListId == 0) - { - player.PlayerTalkClass.SendCloseGossip(); - - Creature pBigBadWolf = me.SummonCreature(RedRidingHood.NpcBigBadWolf, me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), me.GetOrientation(), TempSummonType.TimedOrDeadDespawn, Time.Hour * 2 * Time.InMilliseconds); - if (pBigBadWolf) - pBigBadWolf.GetAI().AttackStart(player); - - me.DespawnOrUnsummon(); - } - return false; - } - } - - [Script] - class boss_bigbadwolf : ScriptedAI - { - public boss_bigbadwolf(Creature creature) : base(creature) - { - instance = creature.GetInstanceScript(); - } - - public override void Reset() - { - ChaseTimer = 30000; - FearTimer = RandomHelper.URand(25000, 35000); - SwipeTimer = 5000; - - HoodGUID.Clear(); - TempThreat = 0; - - IsChasing = false; - } - - public override void EnterCombat(Unit who) - { - Talk(RedRidingHood.SayWolfAggro); - } - - public override void KilledUnit(Unit victim) - { - Talk(RedRidingHood.SayWolfSlay); - } - - public override void JustReachedHome() - { - me.DespawnOrUnsummon(); - } - - public override void JustDied(Unit killer) - { - DoPlaySoundToSet(me, RedRidingHood.SoundWolfDeath); - instance.SetBossState(DataTypes.OperaPerformance, EncounterState.Done); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); - - if (ChaseTimer <= diff) - { - if (!IsChasing) - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100, true); - if (target) - { - Talk(RedRidingHood.SayWolfHood); - DoCast(target, RedRidingHood.SpellLittleRedRidingHood, true); - TempThreat = GetThreat(target); - if (TempThreat != 0.0f) - ModifyThreatByPercent(target, -100); - HoodGUID = target.GetGUID(); - AddThreat(target, 1000000.0f); - ChaseTimer = 20000; - IsChasing = true; - } - } - else - { - IsChasing = false; - Unit target = Global.ObjAccessor.GetUnit(me, HoodGUID); - if (target) - { - HoodGUID.Clear(); - if (GetThreat(target) != 0f) - ModifyThreatByPercent(target, -100); - AddThreat(target, TempThreat); - TempThreat = 0; - } - - ChaseTimer = 40000; - } - } - else ChaseTimer -= diff; - - if (IsChasing) - return; - - if (FearTimer <= diff) - { - DoCastVictim(RedRidingHood.SpellTerrifyingHowl); - FearTimer = RandomHelper.URand(25000, 35000); - } - else FearTimer -= diff; - - if (SwipeTimer <= diff) - { - DoCastVictim(RedRidingHood.SpellWideSwipe); - SwipeTimer = RandomHelper.URand(25000, 30000); - } - else SwipeTimer -= diff; - } - - InstanceScript instance; - - uint ChaseTimer; - uint FearTimer; - uint SwipeTimer; - - ObjectGuid HoodGUID; - float TempThreat; - - bool IsChasing; - } - - #endregion - - #region Romeo & Juliet - struct JulianneRomulo - { - public const uint SayJulianneAggro = 0; - public const uint SayJulianneEnter = 1; - public const uint SayJulianneDeath01 = 2; - public const uint SayJulianneDeath02 = 3; - public const uint SayJulianneResurrect = 4; - public const uint SayJulianneSlay = 5; - - public const uint SayRomuloAggro = 0; - public const uint SayRomuloDeath = 1; - public const uint SayRomuloEnter = 2; - public const uint SayRomuloResurrect = 3; - public const uint SayRomuloSlay = 4; - - public const uint SpellBlindingPassion = 30890; - public const uint SpellDevotion = 30887; - public const uint SpellEternalAffection = 30878; - public const uint SpellPowerfulAttraction = 30889; - public const uint SpellDrinkPoison = 30907; - - public const uint SpellBackwardLunge = 30815; - public const uint SpellDaring = 30841; - public const uint SpellDeadlySwathe = 30817; - public const uint SpellPoisonThrust = 30822; - - public const uint SpellUndyingLove = 30951; - public const uint SpellResVisual = 24171; - - public const uint NpcRomulo = 17533; - public const int RomuloX = -10900; - public const int RomuloY = -1758; - } - - public enum RAJPhase - { - Julianne = 0, - Romulo = 1, - Both = 2, - } - - public class julianne_romuloAI : ScriptedAI - { - public julianne_romuloAI(Creature creature) : base(creature) { } - - public override void JustReachedHome() - { - me.DespawnOrUnsummon(); - } - - public override void MoveInLineOfSight(Unit who) - { - if (me.HasUnitFlag(UnitFlags.NonAttackable)) - return; - - base.MoveInLineOfSight(who); - } - - public void PretendToDie() - { - me.InterruptNonMeleeSpells(true); - me.RemoveAllAuras(); - me.SetHealth(0); - me.AddUnitFlag(UnitFlags.NotSelectable); - me.GetMotionMaster().MovementExpired(false); - me.GetMotionMaster().MoveIdle(); - me.SetStandState(UnitStandStateType.Dead); - } - - public void Resurrect(Creature target) - { - target.RemoveUnitFlag(UnitFlags.NotSelectable); - target.SetFullHealth(); - target.SetStandState(UnitStandStateType.Stand); - target.CastSpell(target, JulianneRomulo.SpellResVisual, true); - if (target.GetVictim()) - { - target.GetMotionMaster().MoveChase(target.GetVictim()); - target.GetAI().AttackStart(target.GetVictim()); - } - else - target.GetMotionMaster().Initialize(); - } - - public InstanceScript instance; - - public ObjectGuid JulianneGUID; - public ObjectGuid RomuloGUID; - - public uint EntryYellTimer; - public uint AggroYellTimer; - - public RAJPhase Phase; - - public uint ResurrectSelfTimer; - public uint ResurrectTimer; - public bool JulianneDead; - public bool RomuloDead; - - public bool IsFakingDeath; - } - - [Script] - public class boss_julianne : julianne_romuloAI - { - public boss_julianne(Creature creature) : base(creature) - { - instance = creature.GetInstanceScript(); - EntryYellTimer = 1000; - AggroYellTimer = 10000; - IsFakingDeath = false; - } - - public override void Reset() - { - RomuloGUID.Clear(); - Phase = RAJPhase.Julianne; - - BlindingPassionTimer = 30000; - DevotionTimer = 15000; - EternalAffectionTimer = 25000; - PowerfulAttractionTimer = 5000; - SummonRomuloTimer = 10000; - DrinkPoisonTimer = 0; - ResurrectSelfTimer = 0; - - if (IsFakingDeath) - { - Resurrect(me); - IsFakingDeath = false; - } - - SummonedRomulo = false; - RomuloDead = false; - } - - public override void EnterCombat(Unit who) { } - - public override void AttackStart(Unit who) - { - if (me.HasUnitFlag(UnitFlags.NonAttackable)) - return; - - base.AttackStart(who); - } - - public override void SpellHit(Unit caster, SpellInfo Spell) - { - if (Spell.Id == JulianneRomulo.SpellDrinkPoison) - { - Talk(JulianneRomulo.SayJulianneDeath01); - DrinkPoisonTimer = 2500; - } - } - - public override void DamageTaken(Unit done_by, ref uint damage) - { - if (damage < me.GetHealth()) - return; - - //anything below only used if incoming damage will kill - - if (Phase == RAJPhase.Julianne) - { - damage = 0; - - //this means already drinking, so return - if (IsFakingDeath) - return; - - me.InterruptNonMeleeSpells(true); - DoCast(me, JulianneRomulo.SpellDrinkPoison); - - IsFakingDeath = true; - //IS THIS USEFULL? Creature Julianne = (Global.ObjAccessor.GetCreature(me, JulianneGUID)); - return; - } - - if (Phase == RAJPhase.Romulo) - { - Log.outError(LogFilter.Scripts, "boss_julianneAI: cannot take damage in PHASE_ROMULO, why was i here?"); - damage = 0; - return; - } - - if (Phase == RAJPhase.Both) - { - Creature Romulo; - //if this is true then we have to kill romulo too - if (RomuloDead) - { - Romulo = ObjectAccessor.GetCreature(me, RomuloGUID); - if (Romulo) - { - Romulo.RemoveUnitFlag(UnitFlags.NotSelectable); - Romulo.GetMotionMaster().Clear(); - Romulo.SetDeathState(DeathState.JustDied); - Romulo.CombatStop(true); - Romulo.GetThreatManager().ClearAllThreat(); - Romulo.SetDynamicFlags(UnitDynFlags.Lootable); - } - - return; - } - - //if not already returned, then romulo is alive and we can pretend die - Romulo = ObjectAccessor.GetCreature(me, RomuloGUID); - if (Romulo) - { - PretendToDie(); - IsFakingDeath = true; - ((julianne_romuloAI)Romulo.GetAI()).ResurrectTimer = 10000; - ((julianne_romuloAI)Romulo.GetAI()).JulianneDead = true; - damage = 0; - return; - } - } - Log.outError(LogFilter.Scripts, "boss_julianneAI: DamageTaken reach end of code, that should not happen."); - } - - public override void JustDied(Unit killer) - { - Talk(JulianneRomulo.SayJulianneDeath02); - instance.SetBossState(DataTypes.OperaPerformance, EncounterState.Done); - } - - public override void KilledUnit(Unit victim) - { - Talk(JulianneRomulo.SayJulianneSlay); - } - - public override void UpdateAI(uint diff) - { - if (EntryYellTimer != 0) - { - if (EntryYellTimer <= diff) - { - Talk(JulianneRomulo.SayJulianneEnter); - EntryYellTimer = 0; - } - else EntryYellTimer -= diff; - } - - if (AggroYellTimer != 0) - { - if (AggroYellTimer <= diff) - { - Talk(JulianneRomulo.SayJulianneAggro); - me.RemoveUnitFlag(UnitFlags.NonAttackable); - me.SetFaction(16); - AggroYellTimer = 0; - } - else AggroYellTimer -= diff; - } - - if (DrinkPoisonTimer != 0) - { - //will do this 2secs after spell hit. this is time to display visual as expected - if (DrinkPoisonTimer <= diff) - { - PretendToDie(); - Phase = RAJPhase.Romulo; - SummonRomuloTimer = 10000; - DrinkPoisonTimer = 0; - } - else DrinkPoisonTimer -= diff; - } - - if (Phase == RAJPhase.Romulo && !SummonedRomulo) - { - if (SummonRomuloTimer <= diff) - { - Creature pRomulo = me.SummonCreature(JulianneRomulo.NpcRomulo, JulianneRomulo.RomuloX, JulianneRomulo.RomuloY, me.GetPositionZ(), 0, TempSummonType.TimedOrDeadDespawn, Time.Hour * 2 * Time.InMilliseconds); - if (pRomulo) - { - RomuloGUID = pRomulo.GetGUID(); - ((julianne_romuloAI)pRomulo.GetAI()).JulianneGUID = me.GetGUID(); - ((julianne_romuloAI)pRomulo.GetAI()).Phase = RAJPhase.Romulo; - DoZoneInCombat(pRomulo); - - pRomulo.SetFaction(16); - } - SummonedRomulo = true; - } - else SummonRomuloTimer -= diff; - } - - if (ResurrectSelfTimer != 0) - { - if (ResurrectSelfTimer <= diff) - { - Resurrect(me); - Phase = RAJPhase.Both; - IsFakingDeath = false; - - if (me.GetVictim()) - AttackStart(me.GetVictim()); - - ResurrectSelfTimer = 0; - ResurrectTimer = 1000; - } - else ResurrectSelfTimer -= diff; - } - - if (!UpdateVictim() || IsFakingDeath) - return; - - if (RomuloDead) - { - if (ResurrectTimer <= diff) - { - Creature Romulo = ObjectAccessor.GetCreature(me, RomuloGUID); - if (Romulo && ((julianne_romuloAI)Romulo.GetAI()).IsFakingDeath) - { - Talk(JulianneRomulo.SayJulianneResurrect); - Resurrect(Romulo); - ((julianne_romuloAI)Romulo.GetAI()).IsFakingDeath = false; - RomuloDead = false; - ResurrectTimer = 10000; - } - } - else ResurrectTimer -= diff; - } - - if (BlindingPassionTimer <= diff) - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100, true); - if (target) - DoCast(target, JulianneRomulo.SpellBlindingPassion); - BlindingPassionTimer = RandomHelper.URand(30000, 45000); - } - else BlindingPassionTimer -= diff; - - if (DevotionTimer <= diff) - { - DoCast(me, JulianneRomulo.SpellDevotion); - DevotionTimer = RandomHelper.URand(15000, 45000); - } - else DevotionTimer -= diff; - - if (PowerfulAttractionTimer <= diff) - { - DoCast(SelectTarget(SelectAggroTarget.Random, 0), JulianneRomulo.SpellPowerfulAttraction); - PowerfulAttractionTimer = RandomHelper.URand(5000, 30000); - } - else PowerfulAttractionTimer -= diff; - - if (EternalAffectionTimer <= diff) - { - if (RandomHelper.URand(0, 1) != 0 && SummonedRomulo) - { - Creature Romulo = ObjectAccessor.GetCreature(me, RomuloGUID); - if (Romulo && Romulo.IsAlive() && !RomuloDead) - DoCast(Romulo, JulianneRomulo.SpellEternalAffection); - } - else DoCast(me, JulianneRomulo.SpellEternalAffection); - - EternalAffectionTimer = RandomHelper.URand(45000, 60000); - } - else EternalAffectionTimer -= diff; - - DoMeleeAttackIfReady(); - } - - uint BlindingPassionTimer; - uint DevotionTimer; - uint EternalAffectionTimer; - uint PowerfulAttractionTimer; - uint SummonRomuloTimer; - uint DrinkPoisonTimer; - - bool SummonedRomulo; - } - - [Script] - public class boss_romulo : julianne_romuloAI - { - public boss_romulo(Creature creature) : base(creature) - { - instance = creature.GetInstanceScript(); - EntryYellTimer = 8000; - AggroYellTimer = 15000; - } - - public override void Reset() - { - JulianneGUID.Clear(); - Phase = RAJPhase.Romulo; - - BackwardLungeTimer = 15000; - DaringTimer = 20000; - DeadlySwatheTimer = 25000; - PoisonThrustTimer = 10000; - ResurrectTimer = 10000; - - IsFakingDeath = false; - JulianneDead = false; - } - - public override void DamageTaken(Unit attacker, ref uint damage) - { - if (damage < me.GetHealth()) - return; - - //anything below only used if incoming damage will kill - - if (Phase == RAJPhase.Romulo) - { - Talk(JulianneRomulo.SayRomuloDeath); - PretendToDie(); - IsFakingDeath = true; - Phase = RAJPhase.Both; - - Creature Julianne = ObjectAccessor.GetCreature(me, JulianneGUID); - if (Julianne) - { - ((julianne_romuloAI)Julianne.GetAI()).RomuloDead = true; - ((julianne_romuloAI)Julianne.GetAI()).ResurrectSelfTimer = 10000; - } - - damage = 0; - return; - } - - if (Phase == RAJPhase.Both) - { - Creature Julianne; - if (JulianneDead) - { - Julianne = ObjectAccessor.GetCreature(me, JulianneGUID); - if (Julianne) - { - Julianne.RemoveUnitFlag(UnitFlags.NotSelectable); - Julianne.GetMotionMaster().Clear(); - Julianne.SetDeathState(DeathState.JustDied); - Julianne.CombatStop(true); - Julianne.GetThreatManager().ClearAllThreat(); - Julianne.SetDynamicFlags(UnitDynFlags.Lootable); - } - return; - } - - Julianne = ObjectAccessor.GetCreature(me, JulianneGUID); - if (Julianne) - { - PretendToDie(); - IsFakingDeath = true; - ((julianne_romuloAI)Julianne.GetAI()).ResurrectTimer = 10000; - ((julianne_romuloAI)Julianne.GetAI()).RomuloDead = true; - damage = 0; - return; - } - } - - Log.outError(LogFilter.Scripts, "boss_romuloAI: DamageTaken reach end of code, that should not happen."); - } - - public override void EnterCombat(Unit who) - { - Talk(JulianneRomulo.SayRomuloAggro); - if (!JulianneGUID.IsEmpty()) - { - Creature Julianne = (ObjectAccessor.GetCreature(me, JulianneGUID)); - if (Julianne && Julianne.GetVictim()) - { - AddThreat(Julianne.GetVictim(), 1.0f); - AttackStart(Julianne.GetVictim()); - } - } - } - - public override void JustDied(Unit killer) - { - Talk(JulianneRomulo.SayRomuloDeath); - instance.SetBossState(DataTypes.OperaPerformance, EncounterState.Done); - } - - public override void KilledUnit(Unit victim) - { - Talk(JulianneRomulo.SayRomuloSlay); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim() || IsFakingDeath) - return; - - if (JulianneDead) - { - if (ResurrectTimer <= diff) - { - Creature Julianne = (ObjectAccessor.GetCreature(me, JulianneGUID)); - if (Julianne && ((julianne_romuloAI)Julianne.GetAI()).IsFakingDeath) - { - Talk(JulianneRomulo.SayRomuloResurrect); - Resurrect(Julianne); - ((julianne_romuloAI)Julianne.GetAI()).IsFakingDeath = false; - JulianneDead = false; - ResurrectTimer = 10000; - } - } - else ResurrectTimer -= diff; - } - - if (BackwardLungeTimer <= diff) - { - Unit target = SelectTarget(SelectAggroTarget.Random, 1, 100, true); - if (target && !me.HasInArc(MathFunctions.PI, target)) - { - DoCast(target, JulianneRomulo.SpellBackwardLunge); - BackwardLungeTimer = RandomHelper.URand(15000, 30000); - } - } - else BackwardLungeTimer -= diff; - - if (DaringTimer <= diff) - { - DoCast(me, JulianneRomulo.SpellDaring); - DaringTimer = RandomHelper.URand(20000, 40000); - } - else DaringTimer -= diff; - - if (DeadlySwatheTimer <= diff) - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100, true); - if (target) - DoCast(target, JulianneRomulo.SpellDeadlySwathe); - DeadlySwatheTimer = RandomHelper.URand(15000, 25000); - } - else DeadlySwatheTimer -= diff; - - if (PoisonThrustTimer <= diff) - { - DoCastVictim(JulianneRomulo.SpellPoisonThrust); - PoisonThrustTimer = RandomHelper.URand(10000, 20000); - } - else PoisonThrustTimer -= diff; - - DoMeleeAttackIfReady(); - } - - uint BackwardLungeTimer; - uint DaringTimer; - uint DeadlySwatheTimer; - uint PoisonThrustTimer; - } - - #endregion - - [Script] - class npc_barnes : CreatureScript - { - public npc_barnes() : base("npc_barnes") { } - - class npc_barnesAI : EscortAI - { - public npc_barnesAI(Creature creature) : base(creature) - { - Initialize(); - instance = creature.GetInstanceScript(); - } - - void Initialize() - { - m_uiSpotlightGUID.Clear(); - - TalkCount = 0; - TalkTimer = 2000; - WipeTimer = 5000; - - PerformanceReady = false; - } - - public override void Reset() - { - Initialize(); - - m_uiEventId = instance.GetData(DataTypes.OperaPerformance); - } - - public void StartEvent() - { - instance.SetBossState(DataTypes.OperaPerformance, EncounterState.InProgress); - - //resets count for this event, in case earlier failed - if (m_uiEventId == OperaEvents.Oz) - instance.SetData(DataTypes.OperaOzDeathcount, (uint)EncounterState.InProgress); - - Start(false, false); - } - - public override void EnterCombat(Unit who) { } - - public override void WaypointReached(uint waypointId, uint pathId) - { - switch (waypointId) - { - case 0: - DoCast(me, karazhanConst.SpellTuxedo, false); - instance.DoUseDoorOrButton(instance.GetGuidData(DataTypes.GoStagedoorleft)); - break; - case 4: - TalkCount = 0; - SetEscortPaused(true); - - Creature spotlight = me.SummonCreature(karazhanConst.NpcSpotlight, me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), 0.0f, TempSummonType.TimedOrDeadDespawn, 60000); - if (spotlight) - { - spotlight.AddUnitFlag(UnitFlags.NotSelectable); - spotlight.CastSpell(spotlight, karazhanConst.SpellSpotlight, false); - m_uiSpotlightGUID = spotlight.GetGUID(); - } - break; - case 8: - instance.DoUseDoorOrButton(instance.GetGuidData(DataTypes.GoStagedoorleft)); - PerformanceReady = true; - break; - case 9: - PrepareEncounter(); - instance.DoUseDoorOrButton(instance.GetGuidData(DataTypes.GoCurtains)); - break; - } - } - - void Talk(uint count) - { - int text = 0; - - switch (m_uiEventId) - { - case OperaEvents.Oz: - if (karazhanConst.OzDialogue[count].TextId != 0) - text = karazhanConst.OzDialogue[count].TextId; - if (karazhanConst.OzDialogue[count].Timer != 0) - TalkTimer = karazhanConst.OzDialogue[count].Timer; - break; - - case OperaEvents.Hood: - if (karazhanConst.HoodDialogue[count].TextId != 0) - text = karazhanConst.HoodDialogue[count].TextId; - if (karazhanConst.HoodDialogue[count].Timer != 0) - TalkTimer = karazhanConst.HoodDialogue[count].Timer; - break; - - case OperaEvents.RAJ: - if (karazhanConst.RAJDialogue[count].TextId != 0) - text = karazhanConst.RAJDialogue[count].TextId; - if (karazhanConst.RAJDialogue[count].Timer != 0) - TalkTimer = karazhanConst.RAJDialogue[count].Timer; - break; - } - - if (text != 0) - base.Talk((uint)text); - } - - void PrepareEncounter() - { - int index = 0; - int count = 0; - - switch (m_uiEventId) - { - case OperaEvents.Oz: - index = 0; - count = 4; - break; - case OperaEvents.Hood: - index = 4; - count = index + 1; - break; - case OperaEvents.RAJ: - index = 5; - count = index + 1; - break; - } - - for (; index < count; ++index) - { - uint entry = (uint)karazhanConst.Spawns[index][0]; - float PosX = karazhanConst.Spawns[index][1]; - - Creature creature = me.SummonCreature(entry, PosX, karazhanConst.SPAWN_Y, karazhanConst.SPAWN_Z, karazhanConst.SPAWN_O, TempSummonType.TimedOrDeadDespawn, Time.Hour * 2 * Time.InMilliseconds); - if (creature) - creature.AddUnitFlag(UnitFlags.NonAttackable); - } - - RaidWiped = false; - } - - public override void UpdateAI(uint diff) - { - base.UpdateAI(diff); - - if (HasEscortState(EscortState.Paused)) - { - if (TalkTimer <= diff) - { - if (TalkCount > 3) - { - Creature pSpotlight = ObjectAccessor.GetCreature(me, m_uiSpotlightGUID); - if (pSpotlight) - pSpotlight.DespawnOrUnsummon(); - - SetEscortPaused(false); - return; - } - - Talk(TalkCount); - ++TalkCount; - } - else - TalkTimer -= diff; - } - - if (PerformanceReady) - { - if (!RaidWiped) - { - if (WipeTimer <= diff) - { - var PlayerList = me.GetMap().GetPlayers(); - if (PlayerList.Empty()) - return; - - RaidWiped = true; - foreach (var player in PlayerList) - { - if (player.IsAlive() && !player.IsGameMaster()) - { - RaidWiped = false; - break; - } - } - - if (RaidWiped) - { - RaidWiped = true; - EnterEvadeMode(); - return; - } - - WipeTimer = 15000; - } - else - WipeTimer -= diff; - } - } - } - - public override bool GossipHello(Player player) - { - // Check for death of Moroes and if opera event is not done already - if (instance.GetBossState(DataTypes.Moroes) == EncounterState.Done && instance.GetBossState(DataTypes.OperaPerformance) != EncounterState.Done) - { - AddGossipItemFor(player, GossipOptionIcon.Chat, karazhanConst.OZ_GOSSIP1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1); - - if (player.IsGameMaster()) - { - AddGossipItemFor(player, GossipOptionIcon.Dot, karazhanConst.OZ_GM_GOSSIP1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 3); - AddGossipItemFor(player, GossipOptionIcon.Dot, karazhanConst.OZ_GM_GOSSIP2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 4); - AddGossipItemFor(player, GossipOptionIcon.Dot, karazhanConst.OZ_GM_GOSSIP3, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 5); - } - - if (!RaidWiped) - SendGossipMenuFor(player, 8970, me.GetGUID()); - else - SendGossipMenuFor(player, 8975, me.GetGUID()); - - return true; - } - - SendGossipMenuFor(player, 8978, me.GetGUID()); - return true; - } - - public override bool GossipSelect(Player player, uint menuId, uint gossipListId) - { - uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId); - ClearGossipMenuFor(player); - - switch (action) - { - case eTradeskill.GossipActionInfoDef + 1: - AddGossipItemFor(player, GossipOptionIcon.Chat, karazhanConst.OZ_GOSSIP2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2); - SendGossipMenuFor(player, 8971, me.GetGUID()); - break; - case eTradeskill.GossipActionInfoDef + 2: - player.CLOSE_GOSSIP_MENU(); - StartEvent(); - break; - case eTradeskill.GossipActionInfoDef + 3: - CloseGossipMenuFor(player); - m_uiEventId = OperaEvents.Oz; - Log.outInfo(LogFilter.Scripts, "player (GUID {0}) manually set Opera event to EVENT_OZ", player.GetGUID()); - break; - case eTradeskill.GossipActionInfoDef + 4: - CloseGossipMenuFor(player); - m_uiEventId = OperaEvents.Hood; - Log.outInfo(LogFilter.Scripts, "player (GUID {0}) manually set Opera event to EVENT_HOOD", player.GetGUID()); - break; - case eTradeskill.GossipActionInfoDef + 5: - CloseGossipMenuFor(player); - m_uiEventId = OperaEvents.RAJ; - Log.outInfo(LogFilter.Scripts, "player (GUID {0}) manually set Opera event to EVENT_RAJ", player.GetGUID()); - break; - } - - return true; - } - - InstanceScript instance; - - ObjectGuid m_uiSpotlightGUID; - - uint TalkCount; - uint TalkTimer; - uint WipeTimer; - public uint m_uiEventId; - - bool PerformanceReady; - public bool RaidWiped; - } - - public override CreatureAI GetAI(Creature creature) - { - return GetInstanceAI(creature); - } - } -} diff --git a/Source/Scripts/EasternKingdoms/ScarletEnclave/Chapter1.cs b/Source/Scripts/EasternKingdoms/ScarletEnclave/Chapter1.cs deleted file mode 100644 index 8be52f432..000000000 --- a/Source/Scripts/EasternKingdoms/ScarletEnclave/Chapter1.cs +++ /dev/null @@ -1,1080 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Scripting; -using Game.Movement; -using Game.Spells; -using System.Collections.Generic; - -namespace Scripts.EasternKingdoms -{ - struct SpellIds - { - //Unworthy Initiate - public const uint SoulPrisonChainSelf = 54612; - public const uint SoulPrisonChain = 54613; - public const uint DKInitateVisual = 51519; - public const uint IcyTouch = 52372; - public const uint PlagueStrike = 52373; - public const uint BloodStrike = 52374; - public const uint DeathCoil = 52375; - - //EyeOfAcherus - public const uint EyeVisual = 51892; - public const uint EyeFlightBoost = 51923; - public const uint EyeFlight = 51890; - - //DeathKnightInitiate - public const uint Duel = 52996; - //public const uint SPELL_DUEL_TRIGGERED = 52990; - public const uint DuelVictory = 52994; - public const uint DuelFlag = 52991; - public const uint Grovel = 7267; - - //DarkRiderOfAcherus - public const uint DespawnHorse = 51918; - - //SalanarTheHorseman - public const uint EffectStolenHorse = 52263; - public const uint DeliverStolenHorse = 52264; - public const uint CallDarkRider = 52266; - public const uint EffectOvertake = 52349; - public const uint RealmOfShadows = 52693; - - //ScarletMinerCart - public const uint CartCheck = 54173; - public const uint SummonCart = 52463; - public const uint SummonMiner = 52464; - public const uint CartDrag = 52465; - } - - struct TextIds - { - //Unworthy Initiate - public const uint SayEventStart = 0; - public const uint SayEventAttack = 1; - - //EyeOfAcherus - public const uint TalkMoveStart = 0; - public const uint TalkControl = 1; - - //DeathKnightInitiate - public const uint SayDuel = 0; - - //DarkRiderOfAcherus - public const uint SayDarkRider = 0; - - //SalanarTheHorseman - public const uint SaySalanar = 0; - - //ScarletMiner - public const uint SayScarletMiner0 = 0; - public const uint SayScarletMiner1 = 1; - } - - struct CreatureIds - { - //SalanarTheHorseman - public const uint DarkRiderOfAcherus = 28654; - public const uint SalanarInRealmOfShadows = 28788; - - //dkc1_gothik - public const uint Ghouls = 28845; - public const uint Ghosts = 28846; - - //ScarletMinerCart - public const uint Miner = 28841; - } - - struct EventIds - { - //Unworthy Initiate - public const uint IcyTouch = 1; - public const uint PlagueStrike = 2; - public const uint BloodStrike = 3; - public const uint DeathCoil = 4; - } - - struct MiscConst - { - //Unworthy Initiate - public static uint[] acherus_soul_prison = { 191577, 191580, 191581, 191582, 191583, 191584, 191585, 191586, 191587, 191588, 191589, 191590 }; - - //EyeOfAcherus - public static Position EyeOFAcherusFallPoint = new Position(2361.21f, -5660.45f, 496.7444f, 0.0f); - - //DeathKnightInitiate - public static uint QuestDeathChallenge = 12733; - public static uint FactionHostile = 2068; - - //SalanarTheHorseman - public static uint GossipSalanarMenu = 9739; - public static uint GossipSalanarOption = 0; - public static uint QuestIntoRealmOfShadows = 12687; - } - - [Script] - class npc_unworthy_initiate : ScriptedAI - { - public npc_unworthy_initiate(Creature creature) : base(creature) - { - Initialize(); - me.SetReactState(ReactStates.Passive); - if (me.GetCurrentEquipmentId() == 0) - me.SetCurrentEquipmentId((byte)me.GetOriginalEquipmentId()); - } - - void Initialize() - { - anchorGUID.Clear(); - phase = UnworthyInitiatePhase.Chained; - } - - public override void Reset() - { - Initialize(); - _events.Reset(); - me.SetFaction(7); - me.AddUnitFlag(UnitFlags.ImmuneToPc); - me.SetStandState(UnitStandStateType.Kneel); - me.LoadEquipment(0, true); - } - - public override void EnterCombat(Unit who) - { - _events.ScheduleEvent(EventIds.IcyTouch, 1000, 1); - _events.ScheduleEvent(EventIds.PlagueStrike, 3000, 1); - _events.ScheduleEvent(EventIds.BloodStrike, 2000, 1); - _events.ScheduleEvent(EventIds.DeathCoil, 5000, 1); - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - if (type != MovementGeneratorType.Point) - return; - - if (id == 1) - { - wait_timer = 5000; - me.LoadEquipment(1); - me.CastSpell(me, SpellIds.DKInitateVisual, true); - - Player starter = Global.ObjAccessor.GetPlayer(me, playerGUID); - if (starter) - Talk(TextIds.SayEventAttack, starter); - - phase = UnworthyInitiatePhase.ToAttack; - } - } - - public void EventStart(Creature anchor, Player target) - { - wait_timer = 5000; - phase = UnworthyInitiatePhase.ToEquip; - - me.SetStandState(UnitStandStateType.Stand); - me.RemoveAurasDueToSpell(SpellIds.SoulPrisonChainSelf); - me.RemoveAurasDueToSpell(SpellIds.SoulPrisonChain); - - float z; - anchor.GetContactPoint(me, out anchorX, out anchorY, out z, 1.0f); - - playerGUID = target.GetGUID(); - Talk(TextIds.SayEventStart); - } - - public override void UpdateAI(uint diff) - { - switch (phase) - { - case UnworthyInitiatePhase.Chained: - if (anchorGUID.IsEmpty()) - { - Creature anchor = me.FindNearestCreature(29521, 30); - if (anchor) - { - anchor.GetAI().SetGUID(me.GetGUID()); - anchor.CastSpell(me, SpellIds.SoulPrisonChain, true); - anchorGUID = anchor.GetGUID(); - } - else - Log.outError(LogFilter.Scripts, "npc_unworthy_initiateAI: unable to find anchor!"); - - float dist = 99.0f; - GameObject prison = null; - - for (byte i = 0; i < 12; ++i) - { - GameObject temp_prison = me.FindNearestGameObject(MiscConst.acherus_soul_prison[i], 30); - if (temp_prison) - { - if (me.IsWithinDist(temp_prison, dist, false)) - { - dist = me.GetDistance2d(temp_prison); - prison = temp_prison; - } - } - } - - if (prison) - prison.ResetDoorOrButton(); - else - Log.outError(LogFilter.Scripts, "npc_unworthy_initiateAI: unable to find prison!"); - } - break; - case UnworthyInitiatePhase.ToEquip: - if (wait_timer != 0) - { - if (wait_timer > diff) - wait_timer -= diff; - else - { - me.GetMotionMaster().MovePoint(1, anchorX, anchorY, me.GetPositionZ()); - phase = UnworthyInitiatePhase.Equiping; - wait_timer = 0; - } - } - break; - case UnworthyInitiatePhase.ToAttack: - if (wait_timer != 0) - { - if (wait_timer > diff) - wait_timer -= diff; - else - { - me.SetFaction(14); - me.RemoveUnitFlag(UnitFlags.ImmuneToPc); - phase = UnworthyInitiatePhase.Attacking; - - Player target = Global.ObjAccessor.GetPlayer(me, playerGUID); - if (target) - AttackStart(target); - wait_timer = 0; - } - } - break; - case UnworthyInitiatePhase.Attacking: - if (!UpdateVictim()) - return; - - _events.Update(diff); - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case EventIds.IcyTouch: - DoCastVictim(SpellIds.IcyTouch); - _events.DelayEvents(1000, 1); - _events.ScheduleEvent(EventIds.IcyTouch, 5000, 1); - break; - case EventIds.PlagueStrike: - DoCastVictim(SpellIds.PlagueStrike); - _events.DelayEvents(1000, 1); - _events.ScheduleEvent(EventIds.PlagueStrike, 5000, 1); - break; - case EventIds.BloodStrike: - DoCastVictim(SpellIds.BloodStrike); - _events.DelayEvents(1000, 1); - _events.ScheduleEvent(EventIds.BloodStrike, 5000, 1); - break; - case EventIds.DeathCoil: - DoCastVictim(SpellIds.DeathCoil); - _events.DelayEvents(1000, 1); - _events.ScheduleEvent(EventIds.DeathCoil, 5000, 1); - break; - } - }); - - DoMeleeAttackIfReady(); - break; - default: - break; - } - } - - ObjectGuid playerGUID; - UnworthyInitiatePhase phase; - uint wait_timer; - float anchorX, anchorY; - ObjectGuid anchorGUID; - - enum UnworthyInitiatePhase - { - Chained, - ToEquip, - Equiping, - ToAttack, - Attacking, - } - } - - [Script] - class npc_unworthy_initiate_anchor : PassiveAI - { - public npc_unworthy_initiate_anchor(Creature creature) : base(creature) { } - - public override void SetGUID(ObjectGuid guid, int id) - { - if (prisonerGUID.IsEmpty()) - prisonerGUID = guid; - } - - public override ObjectGuid GetGUID(int id) - { - return prisonerGUID; - } - - ObjectGuid prisonerGUID; - } - - [Script] - class go_acherus_soul_prison : GameObjectScript - { - public go_acherus_soul_prison() : base("go_acherus_soul_prison") { } - - class go_acherus_soul_prisonAI : GameObjectAI - { - public go_acherus_soul_prisonAI(GameObject go) : base(go) { } - - public override bool GossipHello(Player player) - { - Creature anchor = me.FindNearestCreature(29521, 15); - if (anchor) - { - ObjectGuid prisonerGUID = anchor.GetAI().GetGUID(); - if (!prisonerGUID.IsEmpty()) - { - Creature prisoner = ObjectAccessor.GetCreature(player, prisonerGUID); - if (prisoner) - ((npc_unworthy_initiate)prisoner.GetAI()).EventStart(anchor, player); - } - } - - return false; - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_acherus_soul_prisonAI(go); - } - } - - [Script] - class npc_eye_of_acherus : ScriptedAI - { - public npc_eye_of_acherus(Creature creature) : base(creature) - { - me.SetDisplayFromModel(0); - - Player owner = me.GetCharmerOrOwner().ToPlayer(); - if (owner) - { - me.GetCharmInfo().InitPossessCreateSpells(); - owner.SendAutoRepeatCancel(me); - } - - me.SetReactState(ReactStates.Passive); - - me.GetMotionMaster().MovePoint(1, MiscConst.EyeOFAcherusFallPoint, false); - - MoveSplineInit init = new MoveSplineInit(me); - init.MoveTo(MiscConst.EyeOFAcherusFallPoint.GetPositionX(), MiscConst.EyeOFAcherusFallPoint.GetPositionY(), MiscConst.EyeOFAcherusFallPoint.GetPositionZ(), false); - init.SetFall(); - init.Launch(); - } - - public override void OnCharmed(bool apply) { } - - public override void UpdateAI(uint diff) - { - _scheduler.Update(diff); - } - - public override void MovementInform(MovementGeneratorType movementType, uint pointId) - { - if (movementType == MovementGeneratorType.Waypoint && pointId == 2) - { - me.SetSheath(SheathState.Melee); - me.RemoveAllAuras(); - - Player owner = me.GetCharmerOrOwner().ToPlayer(); - if (owner) - { - owner.RemoveAura(SpellIds.EyeFlightBoost); - for (UnitMoveType i = 0; i < UnitMoveType.Max; ++i) - me.SetSpeedRate(i, owner.GetSpeedRate(i)); - - Talk(TextIds.TalkControl, owner); - } - me.SetDisableGravity(false); - DoCast(me, SpellIds.EyeFlight); - } - - if (movementType == MovementGeneratorType.Point && pointId == 1) - { - me.SetDisableGravity(true); - me.SetControlled(true, UnitState.Root); - _scheduler.Schedule(System.TimeSpan.FromSeconds(5), task => - { - DoCast(me, SpellIds.EyeFlightBoost); - - me.SetControlled(false, UnitState.Root); - - Player owner = me.GetCharmerOrOwner().ToPlayer(); - if (owner) - { - for (UnitMoveType i = 0; i < UnitMoveType.Max; ++i) - me.SetSpeedRate(i, owner.GetSpeedRate(i)); - Talk(TextIds.TalkMoveStart, owner); - } - me.GetMotionMaster().MovePath(me.GetEntry() * 100, false); - }); - } - } - } - - [Script] - class npc_death_knight_initiate : CreatureScript - { - public npc_death_knight_initiate() : base("npc_death_knight_initiate") { } - - class npc_death_knight_initiateAI : CombatAI - { - public npc_death_knight_initiateAI(Creature creature) : base(creature) - { - Initialize(); - } - - void Initialize() - { - m_uiDuelerGUID.Clear(); - m_uiDuelTimer = 5000; - m_bIsDuelInProgress = false; - lose = false; - } - - public override void Reset() - { - Initialize(); - - me.RestoreFaction(); - base.Reset(); - me.AddUnitFlag(UnitFlags.Unk15); - } - - public override void SpellHit(Unit pCaster, SpellInfo pSpell) - { - if (!m_bIsDuelInProgress && pSpell.Id == SpellIds.Duel) - { - m_uiDuelerGUID = pCaster.GetGUID(); - Talk(TextIds.SayDuel, pCaster); - m_bIsDuelInProgress = true; - } - } - - public override void DamageTaken(Unit pDoneBy, ref uint uiDamage) - { - if (m_bIsDuelInProgress && pDoneBy.IsControlledByPlayer()) - { - if (pDoneBy.GetGUID() != m_uiDuelerGUID && pDoneBy.GetOwnerGUID() != m_uiDuelerGUID) // other players cannot help - uiDamage = 0; - else if (uiDamage >= me.GetHealth()) - { - uiDamage = 0; - - if (!lose) - { - pDoneBy.RemoveGameObject(SpellIds.DuelFlag, true); - pDoneBy.AttackStop(); - me.CastSpell(pDoneBy, SpellIds.DuelVictory, true); - lose = true; - me.CastSpell(me, SpellIds.Grovel, true); - me.RestoreFaction(); - } - } - } - } - - public override void UpdateAI(uint uiDiff) - { - if (!UpdateVictim()) - { - if (m_bIsDuelInProgress) - { - if (m_uiDuelTimer <= uiDiff) - { - me.SetFaction(MiscConst.FactionHostile); - - Unit unit = Global.ObjAccessor.GetUnit(me, m_uiDuelerGUID); - if (unit) - AttackStart(unit); - } - else - m_uiDuelTimer -= uiDiff; - } - return; - } - - if (m_bIsDuelInProgress) - { - if (lose) - { - if (!me.HasAura(SpellIds.Grovel)) - EnterEvadeMode(); - return; - } - else if (me.GetVictim() && me.GetVictim().IsTypeId(TypeId.Player) && me.GetVictim().HealthBelowPct(10)) - { - me.GetVictim().CastSpell(me.GetVictim(), SpellIds.Grovel, true); // beg - me.GetVictim().RemoveGameObject(SpellIds.DuelFlag, true); - EnterEvadeMode(); - return; - } - } - - /// @todo spells - - base.UpdateAI(uiDiff); - } - - public override bool GossipHello(Player player) - { - if (player.GetQuestStatus(MiscConst.QuestDeathChallenge) == QuestStatus.Incomplete && me.IsFullHealth()) - { - if (player.HealthBelowPct(10)) - return true; - - if (player.IsInCombat() || me.IsInCombat()) - return true; - - AddGossipItemFor(player, Player.GetDefaultGossipMenuForSource(me), 0, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef); - SendGossipMenuFor(player, player.GetGossipTextId(me), me.GetGUID()); - } - return true; - } - - public override bool GossipSelect(Player player, uint menuId, uint gossipListId) - { - uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId); - ClearGossipMenuFor(player); - if (action == eTradeskill.GossipActionInfoDef) - { - CloseGossipMenuFor(player); - - if (player.IsInCombat() || me.IsInCombat()) - return true; - - if (m_bIsDuelInProgress) - return true; - - me.RemoveUnitFlag(UnitFlags.ImmuneToPc); - me.RemoveUnitFlag(UnitFlags.Unk15); - - player.CastSpell(me, SpellIds.Duel, false); - player.CastSpell(player, SpellIds.DuelFlag, true); - } - return true; - } - - bool lose; - ObjectGuid m_uiDuelerGUID; - uint m_uiDuelTimer; - public bool m_bIsDuelInProgress; - } - - public override CreatureAI GetAI(Creature creature) - { - return new npc_death_knight_initiateAI(creature); - } - } - - [Script] - class npc_dark_rider_of_acherus : ScriptedAI - { - public npc_dark_rider_of_acherus(Creature creature) : base(creature) - { - Initialize(); - } - - void Initialize() - { - PhaseTimer = 4000; - Phase = 0; - Intro = false; - TargetGUID.Clear(); - } - - public override void Reset() - { - Initialize(); - } - - public override void UpdateAI(uint diff) - { - if (!Intro || TargetGUID.IsEmpty()) - return; - - if (PhaseTimer <= diff) - { - switch (Phase) - { - case 0: - Talk(TextIds.SayDarkRider); - PhaseTimer = 5000; - Phase = 1; - break; - case 1: - Unit target = Global.ObjAccessor.GetUnit(me, TargetGUID); - if (target) - DoCast(target, SpellIds.DespawnHorse, true); - PhaseTimer = 3000; - Phase = 2; - break; - case 2: - me.SetVisible(false); - PhaseTimer = 2000; - Phase = 3; - break; - case 3: - me.DespawnOrUnsummon(); - break; - default: - break; - } - } - else - PhaseTimer -= diff; - } - - public void InitDespawnHorse(Unit who) - { - if (!who) - return; - - TargetGUID = who.GetGUID(); - me.SetWalk(true); - me.SetSpeedRate(UnitMoveType.Run, 0.4f); - me.GetMotionMaster().MoveChase(who); - me.SetTarget(TargetGUID); - Intro = true; - } - - uint PhaseTimer; - uint Phase; - bool Intro; - ObjectGuid TargetGUID; - } - - [Script] - class npc_salanar_the_horseman : ScriptedAI - { - public npc_salanar_the_horseman(Creature creature) : base(creature) { } - - public override bool GossipSelect(Player player, uint menuId, uint gossipListId) - { - if (menuId == MiscConst.GossipSalanarMenu && gossipListId == MiscConst.GossipSalanarOption) - { - player.CastSpell(player, SpellIds.RealmOfShadows, true); - player.PlayerTalkClass.SendCloseGossip(); - } - return false; - } - - public override void SpellHit(Unit caster, SpellInfo spell) - { - if (spell.Id == SpellIds.DeliverStolenHorse) - { - if (caster.IsTypeId(TypeId.Unit) && caster.IsVehicle()) - { - Unit charmer = caster.GetCharmer(); - if (charmer) - { - if (charmer.HasAura(SpellIds.EffectStolenHorse)) - { - charmer.RemoveAurasDueToSpell(SpellIds.EffectStolenHorse); - caster.RemoveNpcFlag(NPCFlags.SpellClick); - caster.SetFaction(35); - DoCast(caster, SpellIds.CallDarkRider, true); - Creature Dark_Rider = me.FindNearestCreature(CreatureIds.DarkRiderOfAcherus, 15); - if (Dark_Rider) - Dark_Rider.GetAI().InitDespawnHorse(caster); - } - } - } - } - } - - public override void MoveInLineOfSight(Unit who) - { - base.MoveInLineOfSight(who); - - if (who.IsTypeId(TypeId.Unit) && who.IsVehicle() && me.IsWithinDistInMap(who, 5.0f)) - { - Unit charmer = who.GetCharmer(); - if (charmer) - { - Player player = charmer.ToPlayer(); - if (player) - { - // for quest Into the Realm of Shadows(QUEST_INTO_REALM_OF_SHADOWS) - if (me.GetEntry() == CreatureIds.SalanarInRealmOfShadows && player.GetQuestStatus(MiscConst.QuestIntoRealmOfShadows) == QuestStatus.Incomplete) - { - player.GroupEventHappens(MiscConst.QuestIntoRealmOfShadows, me); - Talk(TextIds.SaySalanar); - charmer.RemoveAurasDueToSpell(SpellIds.EffectOvertake); - Creature creature = who.ToCreature(); - if (creature) - { - creature.DespawnOrUnsummon(); - //creature.Respawn(true); - } - } - - player.RemoveAurasDueToSpell(SpellIds.RealmOfShadows); - } - } - } - } - } - - [Script] - class npc_ros_dark_rider : ScriptedAI - { - public npc_ros_dark_rider(Creature creature) : base(creature) { } - - public override void EnterCombat(Unit who) - { - me.ExitVehicle(); - } - - public override void Reset() - { - Creature deathcharger = me.FindNearestCreature(28782, 30); - if (!deathcharger) - return; - - deathcharger.RestoreFaction(); - deathcharger.RemoveNpcFlag(NPCFlags.SpellClick); - deathcharger.AddUnitFlag(UnitFlags.NotSelectable); - if (!me.GetVehicle() && deathcharger.IsVehicle() && deathcharger.GetVehicleKit().HasEmptySeat(0)) - me.EnterVehicle(deathcharger); - } - - public override void JustDied(Unit killer) - { - Creature deathcharger = me.FindNearestCreature(28782, 30); - if (!deathcharger) - return; - - if (killer.IsTypeId(TypeId.Player) && deathcharger.IsTypeId(TypeId.Unit) && deathcharger.IsVehicle()) - { - deathcharger.AddNpcFlag(NPCFlags.SpellClick); - deathcharger.RemoveUnitFlag(UnitFlags.NotSelectable); - deathcharger.SetFaction(2096); - } - } - } - - [Script] - class npc_dkc1_gothik : ScriptedAI - { - public npc_dkc1_gothik(Creature creature) : base(creature) { } - - public override void MoveInLineOfSight(Unit who) - { - base.MoveInLineOfSight(who); - - if (who.GetEntry() == CreatureIds.Ghouls && me.IsWithinDistInMap(who, 10.0f)) - { - Unit owner = who.GetOwner(); - if (owner) - { - Player player = owner.ToPlayer(); - if (player) - { - Creature creature = who.ToCreature(); - if (player.GetQuestStatus(12698) == QuestStatus.Incomplete) - creature.CastSpell(owner, 52517, true); - - /// @todo Creatures must not be removed, but, must instead - // stand next to Gothik and be commanded into the pit - // and dig into the ground. - creature.DespawnOrUnsummon(); - - if (player.GetQuestStatus(12698) == QuestStatus.Complete) - owner.RemoveAllMinionsByEntry(CreatureIds.Ghosts); - } - } - } - } - } - - [Script] - class npc_scarlet_ghoul : ScriptedAI - { - public npc_scarlet_ghoul(Creature creature) : base(creature) - { - // Ghouls should display their Birth Animation - // Crawling out of the ground - //DoCast(me, 35177, true); - //me.MonsterSay("Mommy?", LANG_UNIVERSAL, 0); - me.SetReactState(ReactStates.Defensive); - } - - void FindMinions(Unit owner) - { - List MinionList = new List(); - owner.GetAllMinionsByEntry(MinionList, CreatureIds.Ghouls); - - foreach (TempSummon summon in MinionList) - if (summon.GetOwnerGUID() == me.GetOwnerGUID()) - if (summon.IsInCombat() && summon.GetAttackerForHelper()) - AttackStart(summon.GetAttackerForHelper()); - } - - public override void UpdateAI(uint diff) - { - if (!me.IsInCombat()) - { - Unit owner = me.GetOwner(); - if (owner) - { - Player plrOwner = owner.ToPlayer(); - if (plrOwner && plrOwner.IsInCombat()) - { - if (plrOwner.GetAttackerForHelper() && plrOwner.GetAttackerForHelper().GetEntry() == CreatureIds.Ghosts) - AttackStart(plrOwner.GetAttackerForHelper()); - else - FindMinions(owner); - } - } - } - - if (!UpdateVictim() || !me.GetVictim()) - return; - - //ScriptedAI::UpdateAI(diff); - //Check if we have a current target - if (me.GetVictim().GetEntry() == CreatureIds.Ghosts) - { - if (me.IsAttackReady()) - { - //If we are within range melee the target - if (me.IsWithinMeleeRange(me.GetVictim())) - { - me.AttackerStateUpdate(me.GetVictim()); - me.ResetAttackTimer(); - } - } - } - } - } - - [Script] - class npc_scarlet_miner_cart : PassiveAI - { - public npc_scarlet_miner_cart(Creature creature) : base(creature) - { - me.SetDisplayFromModel(0); // Modelid2 - } - - public override void JustSummoned(Creature summon) - { - if (summon.GetEntry() == CreatureIds.Miner) - { - _minerGUID = summon.GetGUID(); - summon.GetAI().SetGUID(_playerGUID); - } - } - - public override void SummonedCreatureDespawn(Creature summon) - { - if (summon.GetEntry() == CreatureIds.Miner) - _minerGUID.Clear(); - } - - public override void DoAction(int param) - { - Creature miner = ObjectAccessor.GetCreature(me, _minerGUID); - if (miner) - { - me.SetWalk(false); - - // Not 100% correct, but movement is smooth. Sometimes miner walks faster - // than normal, this speed is fast enough to keep up at those times. - me.SetSpeedRate(UnitMoveType.Run, 1.25f); - - me.GetMotionMaster().MoveFollow(miner, 1.0f, 0); - } - } - - public override void PassengerBoarded(Unit who, sbyte seatId, bool apply) - { - if (apply) - { - _playerGUID = who.GetGUID(); - me.CastSpell((Unit)null, SpellIds.SummonMiner, true); - } - else - { - _playerGUID.Clear(); - Creature miner = ObjectAccessor.GetCreature(me, _minerGUID); - if (miner) - miner.DespawnOrUnsummon(); - } - } - - ObjectGuid _minerGUID; - ObjectGuid _playerGUID; - } - - [Script] - class npc_scarlet_miner : EscortAI - { - public npc_scarlet_miner(Creature creature) : base(creature) - { - Initialize(); - me.SetReactState(ReactStates.Passive); - } - - void Initialize() - { - carGUID.Clear(); - IntroTimer = 0; - IntroPhase = 0; - } - - public override void Reset() - { - Initialize(); - } - - public override void IsSummonedBy(Unit summoner) - { - carGUID = summoner.GetGUID(); - } - - void InitWaypoint() - { - AddWaypoint(1, 2389.03f, -5902.74f, 109.014f, 5000); - AddWaypoint(2, 2341.812012f, -5900.484863f, 102.619743f); - AddWaypoint(3, 2306.561279f, -5901.738281f, 91.792419f); - AddWaypoint(4, 2300.098389f, -5912.618652f, 86.014885f); - AddWaypoint(5, 2294.142090f, -5927.274414f, 75.316849f); - AddWaypoint(6, 2286.984375f, -5944.955566f, 63.714966f); - AddWaypoint(7, 2280.001709f, -5961.186035f, 54.228283f); - AddWaypoint(8, 2259.389648f, -5974.197754f, 42.359348f); - AddWaypoint(9, 2242.882812f, -5984.642578f, 32.827850f); - AddWaypoint(10, 2217.265625f, -6028.959473f, 7.675705f); - AddWaypoint(11, 2202.595947f, -6061.325684f, 5.882018f); - AddWaypoint(12, 2188.974609f, -6080.866699f, 3.370027f); - - if (RandomHelper.URand(0, 1) != 0) - { - AddWaypoint(13, 2176.483887f, -6110.407227f, 1.855181f); - AddWaypoint(14, 2172.516602f, -6146.752441f, 1.074235f); - AddWaypoint(15, 2138.918457f, -6158.920898f, 1.342926f); - AddWaypoint(16, 2129.866699f, -6174.107910f, 4.380779f); - AddWaypoint(17, 2117.709473f, -6193.830078f, 13.3542f, 10000); - } - else - { - AddWaypoint(13, 2184.190186f, -6166.447266f, 0.968877f); - AddWaypoint(14, 2234.265625f, -6163.741211f, 0.916021f); - AddWaypoint(15, 2268.071777f, -6158.750977f, 1.822252f); - AddWaypoint(16, 2270.028320f, -6176.505859f, 6.340538f); - AddWaypoint(17, 2271.739014f, -6195.401855f, 13.3542f, 10000); - } - } - - public override void SetGUID(ObjectGuid guid, int id = 0) - { - InitWaypoint(); - Start(false, false, guid); - SetDespawnAtFar(false); - } - - public override void WaypointReached(uint waypointId, uint pathId) - { - switch (waypointId) - { - case 1: - { - Unit car = ObjectAccessor.GetCreature(me, carGUID); - if (car) - me.SetFacingToObject(car); - Talk(TextIds.SayScarletMiner0); - SetRun(true); - IntroTimer = 4000; - IntroPhase = 1; - break; - } - case 17: - { - Unit car = ObjectAccessor.GetCreature(me, carGUID); - if (car) - { - me.SetFacingToObject(car); - car.Relocate(car.GetPositionX(), car.GetPositionY(), me.GetPositionZ() + 1); - car.StopMoving(); - car.RemoveAura(SpellIds.CartDrag); - } - Talk(TextIds.SayScarletMiner1); - break; - } - default: - break; - } - } - - public override void UpdateAI(uint diff) - { - if (IntroPhase != 0) - { - if (IntroTimer <= diff) - { - if (IntroPhase == 1) - { - Creature car = ObjectAccessor.GetCreature(me, carGUID); - if (car) - DoCast(car, SpellIds.CartDrag); - IntroTimer = 800; - IntroPhase = 2; - } - else - { - Creature car = ObjectAccessor.GetCreature(me, carGUID); - if (car) - car.GetAI().DoAction(0); - IntroPhase = 0; - } - } - else - IntroTimer -= diff; - } - base.UpdateAI(diff); - } - - uint IntroTimer; - uint IntroPhase; - ObjectGuid carGUID; - } -} diff --git a/Source/Scripts/EasternKingdoms/TheStockade/BossHogger.cs b/Source/Scripts/EasternKingdoms/TheStockade/BossHogger.cs deleted file mode 100644 index 459ab2719..000000000 --- a/Source/Scripts/EasternKingdoms/TheStockade/BossHogger.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using Game.Entities; -using Game.AI; -using Game.Scripting; -using Framework.Constants; - -namespace Scripts.EasternKingdoms.TheStockade -{ - struct TextIds - { - public const uint SayPull = 0; // Forest Just Setback! - public const uint SayEnrage = 1; // Areatriggermessage: Hogger Enrages! - public const uint SayDeath = 2; // Yiipe! - - public const uint SayWarden1 = 0; // Yell - This Ends Here; Hogger! - public const uint SayWarden2 = 1; // Say - He'S...He'S Dead? - public const uint SayWarden3 = 2; // Say - It'S Simply Too Good To Be True. You Couldn'T Have Killed Him So Easily! - } - - struct SpellIds - { - public const uint ViciousSlice = 86604; - public const uint MaddeningCall = 86620; - public const uint Enrage = 86736; - } - - struct Events - { - public const uint SayWarden1 = 1; - public const uint SayWarden2 = 2; - public const uint SayWarden3 = 3; - } - - [Script] - class boss_hogger : BossAI - { - public boss_hogger(Creature creature) : base(creature, DataTypes.Hogger) { } - - public override void EnterCombat(Unit who) - { - _EnterCombat(); - Talk(TextIds.SayPull); - - _scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting)); - - _scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(4), task => - { - DoCastVictim(SpellIds.ViciousSlice); - task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(14)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(2), task => - { - DoCast(SpellIds.MaddeningCall); - task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(20)); - }); - } - - public override void JustDied(Unit killer) - { - Talk(TextIds.SayDeath); - _JustDied(); - me.SummonCreature(CreatureIds.WardenThelwater, Misc.WardenThelwaterPos); - } - - public override void JustSummoned(Creature summon) - { - base.JustSummoned(summon); - if (summon.GetEntry() == CreatureIds.WardenThelwater) - summon.GetMotionMaster().MovePoint(0, Misc.WardenThelwaterMovePos); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - DoMeleeAttackIfReady(); - } - - public override void DamageTaken(Unit attacker, ref uint damage) - { - if (me.HealthBelowPctDamaged(30, damage) && !_hasEnraged) - { - _hasEnraged = true; - Talk(TextIds.SayEnrage); - DoCastSelf(SpellIds.Enrage); - } - } - - bool _hasEnraged; - } - - [Script] - class npc_warden_thelwater : ScriptedAI - { - public npc_warden_thelwater(Creature creature) : base(creature) { } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - if (type == MovementGeneratorType.Point && id == 0) - _events.ScheduleEvent(Events.SayWarden1, TimeSpan.FromSeconds(1)); - } - - public override void UpdateAI(uint diff) - { - _events.Update(diff); - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case Events.SayWarden1: - Talk(TextIds.SayWarden1); - _events.ScheduleEvent(Events.SayWarden2, TimeSpan.FromSeconds(4)); - break; - case Events.SayWarden2: - Talk(TextIds.SayWarden2); - _events.ScheduleEvent(Events.SayWarden3, TimeSpan.FromSeconds(3)); - break; - case Events.SayWarden3: - Talk(TextIds.SayWarden3); - break; - } - }); - } - } -} diff --git a/Source/Scripts/EasternKingdoms/TheStockade/InstanceTheStockade.cs b/Source/Scripts/EasternKingdoms/TheStockade/InstanceTheStockade.cs deleted file mode 100644 index b56fe5529..000000000 --- a/Source/Scripts/EasternKingdoms/TheStockade/InstanceTheStockade.cs +++ /dev/null @@ -1,50 +0,0 @@ -using Game.Maps; -using Game.Scripting; -using Game.Entities; - -namespace Scripts.EasternKingdoms.TheStockade -{ - struct Misc - { - public static Position WardenThelwaterMovePos = new Position(152.019f, 106.198f, -35.1896f, 1.082104f); - public static Position WardenThelwaterPos = new Position(138.369f, 78.2932f, -33.85627f, 1.082104f); - } - - struct DataTypes - { - public const uint RandolphMoloch = 0; - public const uint LordOverheat = 1; - public const uint Hogger = 2; - } - - struct CreatureIds - { - public const uint RandolphMoloch = 46383; - public const uint LordOverheat = 46264; - public const uint Hogger = 46254; - public const uint WardenThelwater = 46409; - public const uint MortimerMoloch = 46482; - } - - - - [Script] - class instance_the_stockade : InstanceMapScript - { - public instance_the_stockade() : base("instance_the_stockade", 34) { } - - class instance_the_stockade_InstanceMapScript : InstanceScript - { - public instance_the_stockade_InstanceMapScript(InstanceMap map) : base(map) - { - SetHeaders("SS"); - SetBossNumber(3); - } - } - - public override InstanceScript GetInstanceScript(InstanceMap map) - { - return new instance_the_stockade_InstanceMapScript(map); - } - } -} diff --git a/Source/Scripts/Kalimdor/RagefireChasm/InstanceRageFireChasm.cs b/Source/Scripts/Kalimdor/RagefireChasm/InstanceRageFireChasm.cs deleted file mode 100644 index d6dcce3d1..000000000 --- a/Source/Scripts/Kalimdor/RagefireChasm/InstanceRageFireChasm.cs +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Game.Maps; -using Game.Scripting; - -namespace Scripts.Kalimdor -{ - [Script] - public class instance_ragefire_chasm : InstanceMapScript - { - public instance_ragefire_chasm() : base("instance_ragefire_chasm", 389) { } - - public override InstanceScript GetInstanceScript(InstanceMap map) - { - return new RagefireChasmInstanceMapScript(map); - } - - class RagefireChasmInstanceMapScript : InstanceScript - { - public RagefireChasmInstanceMapScript(InstanceMap map) : base(map) { } - } - } -} diff --git a/Source/Scripts/Kalimdor/ZoneAshenvale.cs b/Source/Scripts/Kalimdor/ZoneAshenvale.cs deleted file mode 100644 index ffb72ae24..000000000 --- a/Source/Scripts/Kalimdor/ZoneAshenvale.cs +++ /dev/null @@ -1,366 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game; -using Game.AI; -using Game.Entities; -using Game.Scripting; -using System; - -namespace Scripts.Kalimdor.ZoneAshenvale -{ - struct CreatureIds - { - //RuulSnowhoof - public const uint ThistlefurUrsa = 3921; - public const uint ThistlefurTotemic = 3922; - public const uint ThistlefurPathfinder = 3926; - - //Muglash - public const uint WrathRider = 3713; - public const uint WrathSorceress = 3717; - public const uint WrathRazortail = 3712; - public const uint WrathPriestess = 3944; - public const uint WrathMyrmidon = 3711; - public const uint WrathSeawitch = 3715; - public const uint Vorsha = 12940; - public const uint Muglash = 12717; - } - - struct GameObjectIds - { - //RuulSnowhoof - public const uint Cage = 178147; - - //Muglash - public const uint NagaBrazier = 178247; - - //KingoftheFoulweald - public const uint Banner = 178205; - } - - struct QuestIds - { - //RuulSnowhoof - public const uint FreedomToRuul = 6482; - - //Muglash - public const uint Vorsha = 6641; - } - - struct TextIds - { - //Muglash - public const uint SayMugStart1 = 0; - public const uint SayMugStart2 = 1; - public const uint SayMugBrazier = 2; - public const uint SayMugBrazierWait = 3; - public const uint SayMugOnGuard = 4; - public const uint SayMugRest = 5; - public const uint SayMugDone = 6; - public const uint SayMugGratitude = 7; - public const uint SayMugPatrol = 8; - public const uint SayMugReturn = 9; - } - - struct Misc - { - //RuulSnowhoof - public const uint FactionQuest = 113; - public static Position[] RuulSnowhoofSummonsCoord = - { - new Position(3449.218018f, -587.825073f, 174.978867f, 4.714445f), - new Position(3446.384521f, -587.830872f, 175.186279f, 4.714445f), - new Position(3444.218994f, -587.835327f, 175.380600f, 4.714445f), - new Position(3508.344482f, -492.024261f, 186.929031f, 4.145029f), - new Position(3506.265625f, -490.531006f, 186.740128f, 4.239277f), - new Position(3503.682373f, -489.393799f, 186.629684f, 4.349232f) - }; - - //Muglash - public static Position[] FirstNagaCoord = - { - new Position(3603.504150f, 1122.631104f, 1.635f, 0.0f), // rider - new Position(3589.293945f, 1148.664063f, 5.565f, 0.0f), // sorceress - new Position(3609.925537f, 1168.759521f, -1.168f, 0.0f) // razortail - }; - - public static Position[] SecondNagaCoord = - { - new Position(3609.925537f, 1168.759521f, -1.168f, 0.0f), // witch - new Position(3645.652100f, 1139.425415f, 1.322f, 0.0f), // priest - new Position(3583.602051f, 1128.405762f, 2.347f, 0.0f) // myrmidon - }; - public static Position VorshaCoord = new Position(3633.056885f, 1172.924072f, -5.388f, 0.0f); - } - - - [Script] - class npc_ruul_snowhoof : EscortAI - { - public npc_ruul_snowhoof(Creature creature) : base(creature) { } - - public override void Reset() - { - GameObject cage = me.FindNearestGameObject(GameObjectIds.Cage, 20); - if (cage) - cage.SetGoState(GameObjectState.Ready); - } - - public override void EnterCombat(Unit who) { } - - public override void JustSummoned(Creature summoned) - { - summoned.GetAI().AttackStart(me); - } - - public override void QuestAccept(Player player, Quest quest) - { - if (quest.Id == QuestIds.FreedomToRuul) - { - me.SetFaction(Misc.FactionQuest); - Start(true, false, player.GetGUID()); - } - } - - public override void WaypointReached(uint waypointId, uint pathId) - { - Player player = GetPlayerForEscort(); - if (!player) - return; - - switch (waypointId) - { - case 0: - me.SetStandState(UnitStandStateType.Stand); - GameObject cage = me.FindNearestGameObject(GameObjectIds.Cage, 20); - if (cage) - cage.SetGoState(GameObjectState.Active); - break; - case 13: - me.SummonCreature(CreatureIds.ThistlefurTotemic, Misc.RuulSnowhoofSummonsCoord[0], TempSummonType.DeadDespawn, 60000); - me.SummonCreature(CreatureIds.ThistlefurUrsa, Misc.RuulSnowhoofSummonsCoord[1], TempSummonType.DeadDespawn, 60000); - me.SummonCreature(CreatureIds.ThistlefurPathfinder, Misc.RuulSnowhoofSummonsCoord[2], TempSummonType.DeadDespawn, 60000); - break; - case 19: - me.SummonCreature(CreatureIds.ThistlefurTotemic, Misc.RuulSnowhoofSummonsCoord[3], TempSummonType.DeadDespawn, 60000); - me.SummonCreature(CreatureIds.ThistlefurUrsa, Misc.RuulSnowhoofSummonsCoord[4], TempSummonType.DeadDespawn, 60000); - me.SummonCreature(CreatureIds.ThistlefurPathfinder, Misc.RuulSnowhoofSummonsCoord[5], TempSummonType.DeadDespawn, 60000); - break; - case 21: - player.GroupEventHappens(QuestIds.FreedomToRuul, me); - break; - } - } - } - - [Script] - public class npc_muglash : EscortAI - { - public npc_muglash(Creature creature) : base(creature) - { - Initialize(); - } - - void Initialize() - { - eventTimer = 10000; - waveId = 0; - _isBrazierExtinguished = false; - } - - public override void Reset() - { - Initialize(); - } - - public override void EnterCombat(Unit who) - { - Player player = GetPlayerForEscort(); - if (player) - { - if (HasEscortState(EscortState.Paused)) - { - if (Convert.ToBoolean(RandomHelper.URand(0, 1))) - Talk(TextIds.SayMugOnGuard, player); - return; - } - } - } - - public override void JustDied(Unit killer) - { - if (HasEscortState(EscortState.Escorting)) - { - Player player = GetPlayerForEscort(); - if (player) - player.FailQuest(QuestIds.Vorsha); - } - } - - public override void JustSummoned(Creature summoned) - { - summoned.GetAI().AttackStart(me); - } - - public override void QuestAccept(Player player, Quest quest) - { - if (quest.Id == QuestIds.Vorsha) - { - Talk(TextIds.SayMugStart1); - me.SetFaction(Misc.FactionQuest); - Start(true, false, player.GetGUID()); - } - } - - public override void WaypointReached(uint waypointId, uint pathId) - { - Player player = GetPlayerForEscort(); - if (player) - { - switch (waypointId) - { - case 0: - Talk(TextIds.SayMugStart2, player); - break; - case 24: - Talk(TextIds.SayMugBrazier, player); - - GameObject go = GetClosestGameObjectWithEntry(me, GameObjectIds.NagaBrazier, SharedConst.InteractionDistance * 2); - if (go) - { - go.RemoveFlag(GameObjectFlags.NotSelectable); - SetEscortPaused(true); - } - break; - case 25: - Talk(TextIds.SayMugGratitude); - player.GroupEventHappens(QuestIds.Vorsha, me); - break; - case 26: - Talk(TextIds.SayMugPatrol); - break; - case 27: - Talk(TextIds.SayMugReturn); - break; - } - } - } - - void DoWaveSummon() - { - switch (waveId) - { - case 1: - me.SummonCreature(CreatureIds.WrathRider, Misc.FirstNagaCoord[0], TempSummonType.TimedDespawnOOC, 60000); - me.SummonCreature(CreatureIds.WrathSorceress, Misc.FirstNagaCoord[1], TempSummonType.TimedDespawnOOC, 60000); - me.SummonCreature(CreatureIds.WrathRazortail, Misc.FirstNagaCoord[2], TempSummonType.TimedDespawnOOC, 60000); - break; - case 2: - me.SummonCreature(CreatureIds.WrathPriestess, Misc.SecondNagaCoord[0], TempSummonType.TimedDespawnOOC, 60000); - me.SummonCreature(CreatureIds.WrathMyrmidon, Misc.SecondNagaCoord[1], TempSummonType.TimedDespawnOOC, 60000); - me.SummonCreature(CreatureIds.WrathSeawitch, Misc.SecondNagaCoord[2], TempSummonType.TimedDespawnOOC, 60000); - break; - case 3: - me.SummonCreature(CreatureIds.Vorsha, Misc.VorshaCoord, TempSummonType.TimedDespawnOOC, 60000); - break; - case 4: - SetEscortPaused(false); - Talk(TextIds.SayMugDone); - break; - } - } - - public override void UpdateAI(uint diff) - { - base.UpdateAI(diff); - - if (!me.GetVictim()) - { - if (HasEscortState(EscortState.Paused) && _isBrazierExtinguished) - { - if (eventTimer < diff) - { - ++waveId; - DoWaveSummon(); - eventTimer = 10000; - } - else - eventTimer -= diff; - } - return; - } - DoMeleeAttackIfReady(); - } - - uint eventTimer; - byte waveId; - - public bool _isBrazierExtinguished { get; set; } - } - - [Script] - class go_naga_brazier : GameObjectScript - { - public go_naga_brazier() : base("go_naga_brazier") { } - - class go_naga_brazierAI : GameObjectAI - { - public go_naga_brazierAI(GameObject go) : base(go) { } - - public override bool GossipHello(Player player) - { - Creature creature = ScriptedAI.GetClosestCreatureWithEntry(me, CreatureIds.Muglash, SharedConst.InteractionDistance * 2); - if (creature) - { - npc_muglash pEscortAI = creature.GetAI(); - if (pEscortAI != null) - { - creature.GetAI().Talk(TextIds.SayMugBrazierWait); - - pEscortAI._isBrazierExtinguished = true; - return false; - } - } - - return true; - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_naga_brazierAI(go); - } - } - - [Script] - class spell_destroy_karangs_banner : SpellScript - { - void HandleAfterCast() - { - GameObject banner = GetCaster().FindNearestGameObject(GameObjectIds.Banner, GetSpellInfo().GetMaxRange(true)); - if (banner) - banner.Delete(); - } - - public override void Register() - { - AfterCast.Add(new CastHandler(HandleAfterCast)); - } - } -} diff --git a/Source/Scripts/Kalimdor/ZoneDurotar.cs b/Source/Scripts/Kalimdor/ZoneDurotar.cs deleted file mode 100644 index cb10fb9c5..000000000 --- a/Source/Scripts/Kalimdor/ZoneDurotar.cs +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Framework.Dynamic; -using Game.AI; -using Game.Entities; -using Game.Scripting; -using Game.Spells; -using System; - -namespace Scripts.Kalimdor -{ - [Script] - class npc_lazy_peon : NullCreatureAI - { - public npc_lazy_peon(Creature creature) : base(creature) { } - - public override void InitializeAI() - { - me.SetWalk(true); - - scheduler.Schedule(TimeSpan.FromSeconds(1), TimeSpan.FromMilliseconds(120000), task => - { - GameObject Lumberpile = me.FindNearestGameObject(GoLumberpile, 20); - if (Lumberpile) - me.GetMotionMaster().MovePoint(1, Lumberpile.GetPositionX() - 1, Lumberpile.GetPositionY(), Lumberpile.GetPositionZ()); - task.Repeat(); - }); - - scheduler.Schedule(TimeSpan.FromMilliseconds(300000), task => - { - me.HandleEmoteCommand(Emote.StateNone); - me.GetMotionMaster().MovePoint(2, me.GetHomePosition()); - task.Repeat(); - }); - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - switch (id) - { - case 1: - me.HandleEmoteCommand(Emote.StateWorkChopwood); - break; - case 2: - DoCast(me, SpellBuffSleep); - break; - } - } - - public override void SpellHit(Unit caster, SpellInfo spell) - { - if (spell.Id != SpellAwakenPeon) - return; - - Player player = caster.ToPlayer(); - if (player && player.GetQuestStatus(QuestLazyPeons) == QuestStatus.Incomplete) - { - player.KilledMonsterCredit(me.GetEntry(), me.GetGUID()); - Talk(SaySpellHit, caster); - me.RemoveAllAuras(); - GameObject Lumberpile = me.FindNearestGameObject(GoLumberpile, 20); - if (Lumberpile) - me.GetMotionMaster().MovePoint(1, Lumberpile.GetPositionX() - 1, Lumberpile.GetPositionY(), Lumberpile.GetPositionZ()); - } - } - - public override void UpdateAI(uint diff) - { - scheduler.Update(diff); - - //if (!UpdateVictim()) - //return; - - //DoMeleeAttackIfReady(); - } - - const int QuestLazyPeons = 37446; - const int GoLumberpile = 175784; - const uint SpellBuffSleep = 17743; - const int SpellAwakenPeon = 19938; - const int SaySpellHit = 0; - - TaskScheduler scheduler = new TaskScheduler(); - } - - [Script] - class spell_voodoo : SpellScript - { - public override bool Validate(SpellInfo spellInfo) - { - return ValidateSpellInfo(SpellBrew, SpellGhostly, SpellHex1, SpellHex2, SpellHex3, SpellGrow, SpellLaunch); - } - - void HandleDummy(uint effIndex) - { - uint spellid = RandomHelper.RAND(SpellBrew, SpellGhostly, RandomHelper.RAND(SpellHex1, SpellHex2, SpellHex3), SpellGrow, SpellLaunch); - Unit target = GetHitUnit(); - if (target) - GetCaster().CastSpell(target, spellid, false); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); - } - - const uint SpellBrew = 16712; // Special Brew - const uint SpellGhostly = 16713; // Ghostly - const uint SpellHex1 = 16707; // Hex - const uint SpellHex2 = 16708; // Hex - const uint SpellHex3 = 16709; // Hex - const uint SpellGrow = 16711; // Grow - const uint SpellLaunch = 16716; // Launch (Whee!) - } -} diff --git a/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/BossAmanitar.cs b/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/BossAmanitar.cs deleted file mode 100644 index d62282487..000000000 --- a/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/BossAmanitar.cs +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Scripting; -using System; - -namespace Scripts.Northrend.AzjolNerub.Ahnkahet.Amanitar -{ - struct SpellIds - { - public const uint Bash = 57094; // Victim - public const uint EntanglingRoots = 57095; // Random Victim 100y - public const uint Mini = 57055; // Self - public const uint VenomBoltVolley = 57088; // Random Victim 100y - public const uint HealthyMushroomPotentFungus = 56648; // Killer 3y - public const uint PoisonousMushroomPoisonCloud = 57061; // Self - Duration 8 Sec - public const uint PoisonousMushroomVisualArea = 61566; // Self - public const uint PoisonousMushroomVisualAura = 56741; // Self - public const uint PutridMushroom = 31690; // To Make The Mushrooms Visible - public const uint PowerMushroomVisualAura = 56740; - } - - struct CreatureIds - { - public const uint Trigger = 19656; - public const uint HealthyMushroom = 30391; - public const uint PoisonousMushroom = 30435; - } - - [Script] - class boss_amanitar : BossAI - { - public boss_amanitar(Creature creature) : base(creature, DataTypes.Amanitar) { } - - public override void Reset() - { - _Reset(); - me.SetMeleeDamageSchool(SpellSchools.Nature); - me.ApplySpellImmune(0, SpellImmunity.School, SpellSchoolMask.Nature, true); - } - - public override void EnterCombat(Unit who) - { - _EnterCombat(); - - _scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting)); - - _scheduler.Schedule(TimeSpan.FromSeconds(5), task => - { - SpawnAdds(); - task.Repeat(TimeSpan.FromSeconds(20)); - }); - _scheduler.Schedule(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(9), task => - { - DoCast(SelectTarget(SelectAggroTarget.Random, 0, 100, true), SpellIds.EntanglingRoots, true); - task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15)); - }); - _scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(14), task => - { - DoCastVictim(SpellIds.Bash); - task.Repeat(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(12)); - }); - _scheduler.Schedule(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(18), task => - { - DoCast(SpellIds.Mini); - task.Repeat(TimeSpan.FromSeconds(25), TimeSpan.FromSeconds(30)); - }); - _scheduler.Schedule(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(20), task => - { - DoCast(SelectTarget(SelectAggroTarget.Random, 0, 100, true), SpellIds.VenomBoltVolley, true); - task.Repeat(TimeSpan.FromSeconds(18), TimeSpan.FromSeconds(22)); - }); - } - - public override void JustDied(Unit killer) - { - _JustDied(); - instance.DoRemoveAurasDueToSpellOnPlayers(SpellIds.Mini); - } - - void SpawnAdds() - { - int u = 0; - - for (byte i = 0; i < 30; ++i) - { - Position pos = me.GetRandomNearPosition(30.0f); - me.UpdateGroundPositionZ(pos.GetPositionX(), pos.GetPositionY(), ref pos.posZ); - - Creature trigger = me.SummonCreature(CreatureIds.Trigger, pos); - if (trigger) - { - Creature temp1 = trigger.FindNearestCreature(CreatureIds.HealthyMushroom, 4.0f, true); - Creature temp2 = trigger.FindNearestCreature(CreatureIds.PoisonousMushroom, 4.0f, true); - if (!temp1 && !temp2) - { - u = 1 - u; - me.SummonCreature(u > 0 ? CreatureIds.PoisonousMushroom : CreatureIds.HealthyMushroom, pos, TempSummonType.TimedOrCorpseDespawn, 60 * Time.InMilliseconds); - } - trigger.DespawnOrUnsummon(); - } - } - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - DoMeleeAttackIfReady(); - } - } - - [Script] - class npc_amanitar_mushrooms : ScriptedAI - { - public npc_amanitar_mushrooms(Creature creature) : base(creature) { } - - public override void Reset() - { - _scheduler.CancelAll(); - _scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting)); - - _scheduler.Schedule(TimeSpan.FromSeconds(1), task => - { - if (me.GetEntry() == CreatureIds.PoisonousMushroom) - { - DoCast(me, SpellIds.PoisonousMushroomVisualArea, true); - DoCast(me, SpellIds.PoisonousMushroomPoisonCloud); - } - task.Repeat(TimeSpan.FromSeconds(7)); - }); - - me.SetDisplayFromModel(1); - DoCast(SpellIds.PutridMushroom); - - if (me.GetEntry() == CreatureIds.PoisonousMushroom) - DoCast(SpellIds.PoisonousMushroomVisualAura); - else - DoCast(SpellIds.PowerMushroomVisualAura); - } - - public override void DamageTaken(Unit attacker, ref uint damage) - { - if (damage >= me.GetHealth() && me.GetEntry() == CreatureIds.HealthyMushroom) - DoCast(me, SpellIds.HealthyMushroomPotentFungus, true); - } - - public override void EnterCombat(Unit who) { } - public override void AttackStart(Unit victim) { } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - } - } -} diff --git a/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/BossElderNadox.cs b/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/BossElderNadox.cs deleted file mode 100644 index daa77e0bf..000000000 --- a/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/BossElderNadox.cs +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Scripting; -using Game.Spells; -using System; -using System.Collections.Generic; - - -namespace Scripts.Northrend.AzjolNerub.Ahnkahet.ElderNadox -{ - struct SpellIds - { - public const uint BroodPlague = 56130; - public const uint HBroodRage = 59465; - public const uint Enrage = 26662; // Enraged If Too Far Away From Home - public const uint SummonSwarmers = 56119; // 2x 30178 -- 2x Every 10secs - public const uint SummonSwarmGuard = 56120; // 1x 30176 - - // Adds - public const uint SwarmBuff = 56281; - public const uint Sprint = 56354; - } - - struct TextIds - { - public const uint SayAggro = 0; - public const uint SaySlay = 1; - public const uint SayDeath = 2; - public const uint SayEggSac = 3; - public const uint EmoteHatches = 4; - } - - struct Misc - { - public const uint DataRespectYourElders = 6; - } - - [Script] - class boss_elder_nadox : BossAI - { - public boss_elder_nadox(Creature creature) : base(creature, DataTypes.ElderNadox) - { - Initialize(); - } - - void Initialize() - { - GuardianSummoned = false; - GuardianDied = false; - } - - public override void Reset() - { - _Reset(); - Initialize(); - } - - public override void EnterCombat(Unit who) - { - _EnterCombat(); - Talk(TextIds.SayAggro); - - _scheduler.Schedule(TimeSpan.FromSeconds(13), task => - { - DoCast(SelectTarget(SelectAggroTarget.Random, 0, 100, true), SpellIds.BroodPlague, true); - task.Repeat(TimeSpan.FromSeconds(15)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(10), task => - { - // @todo: summoned by egg - DoCast(me, SpellIds.SummonSwarmers); - if (RandomHelper.URand(1, 3) == 3) // 33% chance of dialog - Talk(TextIds.SayEggSac); - task.Repeat(); - }); - - if (IsHeroic()) - { - _scheduler.Schedule(TimeSpan.FromSeconds(12), task => - { - DoCast(SpellIds.HBroodRage); - task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(50)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(5), task => - { - if (me.HasAura(SpellIds.Enrage)) - return; - if (me.GetPositionZ() < 24.0f) - DoCast(me, SpellIds.Enrage, true); - task.Repeat(); - }); - } - } - - public override void SummonedCreatureDies(Creature summon, Unit killer) - { - if (summon.GetEntry() == AKCreatureIds.AhnkaharGuardian) - GuardianDied = true; - } - - public override uint GetData(uint type) - { - if (type == Misc.DataRespectYourElders) - return !GuardianDied ? 1 : 0u; - - return 0; - } - - public override void KilledUnit(Unit who) - { - if (who.IsTypeId(TypeId.Player)) - Talk(TextIds.SaySlay); - } - - public override void JustDied(Unit killer) - { - _JustDied(); - Talk(TextIds.SayDeath); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - if (!GuardianSummoned && me.HealthBelowPct(50)) - { - // @todo: summoned by egg - Talk(TextIds.EmoteHatches, me); - DoCast(me, SpellIds.SummonSwarmGuard); - GuardianSummoned = true; - } - - DoMeleeAttackIfReady(); - } - - bool GuardianSummoned; - bool GuardianDied; - } - - [Script] - class npc_ahnkahar_nerubian : ScriptedAI - { - public npc_ahnkahar_nerubian(Creature creature) : base(creature) { } - - public override void Reset() - { - _scheduler.CancelAll(); - _scheduler.Schedule(TimeSpan.FromSeconds(13), task => - { - DoCast(me, SpellIds.Sprint); - task.Repeat(TimeSpan.FromSeconds(20)); - }); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - if (me.HasUnitState(UnitState.Casting)) - return; - - _scheduler.Update(diff); - - DoMeleeAttackIfReady(); - } - } - - // 56159 - Swarm - [Script] - class spell_ahn_kahet_swarm : SpellScript - { - public spell_ahn_kahet_swarm() - { - _targetCount = 0; - } - - public override bool Validate(SpellInfo spellInfo) - { - return ValidateSpellInfo(SpellIds.SwarmBuff); - } - - void CountTargets(List targets) - { - _targetCount = targets.Count; - } - - void HandleDummy(uint effIndex) - { - if (_targetCount != 0) - { - Aura aura = GetCaster().GetAura(SpellIds.SwarmBuff); - if (aura != null) - { - aura.SetStackAmount((byte)_targetCount); - aura.RefreshDuration(); - } - else - GetCaster().CastCustomSpell(SpellIds.SwarmBuff, SpellValueMod.AuraStack, _targetCount, GetCaster(), TriggerCastFlags.FullMask); - } - else - GetCaster().RemoveAurasDueToSpell(SpellIds.SwarmBuff); - } - - public override void Register() - { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(CountTargets, 0, Targets.UnitSrcAreaAlly)); - OnEffectHit.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); - } - - int _targetCount; - } - - [Script] - class achievement_respect_your_elders : AchievementCriteriaScript - { - public achievement_respect_your_elders() : base("achievement_respect_your_elders") { } - - public override bool OnCheck(Player player, Unit target) - { - return target && target.GetAI().GetData(Misc.DataRespectYourElders) != 0; - } - } -} diff --git a/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/BossHeraldVolazj.cs b/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/BossHeraldVolazj.cs deleted file mode 100644 index f45b17f0e..000000000 --- a/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/BossHeraldVolazj.cs +++ /dev/null @@ -1,289 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using Game.Spells; -using System.Collections.Generic; -using System.Linq; -using Game; - -namespace Scripts.Northrend.AzjolNerub.Ahnkahet.HeraldVolazj -{ - struct SpellIds - { - public const uint Insanity = 57496; //Dummy - public const uint InsanityVisual = 57561; - public const uint InsanityTarget = 57508; - public const uint MindFlay = 57941; - public const uint ShadowBoltVolley = 57942; - public const uint Shiver = 57949; - public const uint ClonePlayer = 57507; //Cast On Player During Insanity - public const uint InsanityPhasing1 = 57508; - public const uint InsanityPhasing2 = 57509; - public const uint InsanityPhasing3 = 57510; - public const uint InsanityPhasing4 = 57511; - public const uint InsanityPhasing5 = 57512; - } - - struct TextIds - { - public const uint SayAggro = 0; - public const uint SaySlay = 1; - public const uint SayDeath = 2; - public const uint SayPhase = 3; - } - - struct Misc - { - public const uint AchievQuickDemiseStartEvent = 20382; - } - - [Script] - class boss_volazj : ScriptedAI - { - public boss_volazj(Creature creature) : base(creature) - { - Summons = new SummonList(me); - - Initialize(); - instance = creature.GetInstanceScript(); - } - - void Initialize() - { - uiMindFlayTimer = 8 * Time.InMilliseconds; - uiShadowBoltVolleyTimer = 5 * Time.InMilliseconds; - uiShiverTimer = 15 * Time.InMilliseconds; - // Used for Insanity handling - insanityHandled = 0; - } - - // returns the percentage of health after taking the given damage. - uint GetHealthPct(uint damage) - { - if (damage > me.GetHealth()) - return 0; - return (uint)(100 * (me.GetHealth() - damage) / me.GetMaxHealth()); - } - - public override void DamageTaken(Unit pAttacker, ref uint damage) - { - if (me.HasUnitFlag(UnitFlags.NotSelectable)) - damage = 0; - - if ((GetHealthPct(0) >= 66 && GetHealthPct(damage) < 66) || - (GetHealthPct(0) >= 33 && GetHealthPct(damage) < 33)) - { - me.InterruptNonMeleeSpells(false); - DoCast(me, SpellIds.Insanity, false); - } - } - - public override void SpellHitTarget(Unit target, SpellInfo spell) - { - if (spell.Id == SpellIds.Insanity) - { - // Not good target or too many players - if (target.GetTypeId() != TypeId.Player || insanityHandled > 4) - return; - // First target - start channel visual and set self as unnattackable - if (insanityHandled == 0) - { - // Channel visual - DoCast(me, SpellIds.InsanityVisual, true); - // Unattackable - me.AddUnitFlag(UnitFlags.NotSelectable); - me.SetControlled(true, UnitState.Stunned); - } - - // phase the player - target.CastSpell(target, SpellIds.InsanityTarget + insanityHandled, true); - - SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.InsanityTarget + insanityHandled, GetDifficulty()); - if (spellInfo == null) - return; - - // summon twisted party members for this target - var players = me.GetMap().GetPlayers(); - foreach (var player in players) - { - if (!player || !player.IsAlive()) - continue; - // Summon clone - Unit summon = me.SummonCreature(AKCreatureIds.TwistedVisage, me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), me.GetOrientation(), TempSummonType.CorpseDespawn, 0); - if (summon) - { - // clone - player.CastSpell(summon, SpellIds.ClonePlayer, true); - // phase the summon - PhasingHandler.AddPhase(summon, (uint)spellInfo.GetEffect(0).MiscValueB, true); - } - } - ++insanityHandled; - } - } - - void ResetPlayersPhase() - { - var players = me.GetMap().GetPlayers(); - foreach (var player in players) - { - for (uint index = 0; index <= 4; ++index) - player.RemoveAurasDueToSpell(SpellIds.InsanityTarget + index); - } - } - - public override void Reset() - { - Initialize(); - - instance.SetBossState(DataTypes.HeraldVolazj, EncounterState.NotStarted); - instance.DoStopCriteriaTimer(CriteriaTimedTypes.Event, Misc.AchievQuickDemiseStartEvent); - - // Visible for all players in insanity - for (uint i = 173; i <= 177; ++i) - PhasingHandler.AddPhase(me, i, false); - PhasingHandler.AddPhase(me, 169, true); - - ResetPlayersPhase(); - - // Cleanup - Summons.DespawnAll(); - me.RemoveUnitFlag(UnitFlags.NotSelectable); - me.SetControlled(false, UnitState.Stunned); - } - - public override void EnterCombat(Unit who) - { - Talk(TextIds.SayAggro); - - instance.SetBossState(DataTypes.HeraldVolazj, EncounterState.InProgress); - instance.DoStartCriteriaTimer(CriteriaTimedTypes.Event, Misc.AchievQuickDemiseStartEvent); - } - - public override void JustSummoned(Creature summon) - { - Summons.Summon(summon); - } - - public override void SummonedCreatureDespawn(Creature summon) - { - uint nextPhase = 0; - Summons.Despawn(summon); - - // Check if all summons in this phase killed - foreach (var guid in Summons) - { - Creature visage = ObjectAccessor.GetCreature(me, guid); - if (visage) - { - // Not all are dead - if (visage.IsInPhase(summon)) - return; - else - { - nextPhase = visage.GetPhaseShift().GetPhases().First().Key; - break; - } - } - } - - // Roll Insanity - var players = me.GetMap().GetPlayers(); - foreach (var player in players) - { - if (player) - { - for (uint index = 0; index <= 4; ++index) - player.RemoveAurasDueToSpell(SpellIds.InsanityTarget + index); - player.CastSpell(player, SpellIds.InsanityTarget + nextPhase - 173, true); - } - } - } - - public override void UpdateAI(uint diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (insanityHandled != 0) - { - if (!Summons.Empty()) - return; - - insanityHandled = 0; - me.RemoveUnitFlag(UnitFlags.NotSelectable); - me.SetControlled(false, UnitState.Stunned); - me.RemoveAurasDueToSpell(SpellIds.InsanityVisual); - } - - if (uiMindFlayTimer <= diff) - { - DoCastVictim(SpellIds.MindFlay); - uiMindFlayTimer = 20 * Time.InMilliseconds; - } - else uiMindFlayTimer -= diff; - - if (uiShadowBoltVolleyTimer <= diff) - { - DoCastVictim(SpellIds.ShadowBoltVolley); - uiShadowBoltVolleyTimer = 5 * Time.InMilliseconds; - } - else uiShadowBoltVolleyTimer -= diff; - - if (uiShiverTimer <= diff) - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0); - if (target) - DoCast(target, SpellIds.Shiver); - uiShiverTimer = 15 * Time.InMilliseconds; - } - else uiShiverTimer -= diff; - - DoMeleeAttackIfReady(); - } - - public override void JustDied(Unit killer) - { - Talk(TextIds.SayDeath); - - instance.SetBossState(DataTypes.HeraldVolazj, EncounterState.Done); - - Summons.DespawnAll(); - ResetPlayersPhase(); - } - - public override void KilledUnit(Unit who) - { - if (who.IsTypeId(TypeId.Player)) - Talk(TextIds.SaySlay); - } - - InstanceScript instance; - - uint uiMindFlayTimer; - uint uiShadowBoltVolleyTimer; - uint uiShiverTimer; - uint insanityHandled; - SummonList Summons; - } -} diff --git a/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/BossJedogaShadowseeker.cs b/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/BossJedogaShadowseeker.cs deleted file mode 100644 index f74c3fa14..000000000 --- a/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/BossJedogaShadowseeker.cs +++ /dev/null @@ -1,569 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; - -namespace Scripts.Northrend.AzjolNerub.Ahnkahet.JedogaShadowseeker -{ - struct SpellIds - { - public const uint SphereVisual = 56075; - public const uint GiftOfTheHerald = 56219; - public const uint CycloneStrike = 56855; // Self - public const uint LightningBolt = 56891; // 40y - public const uint Thundershock = 56926; // 30y - - public const uint BeamVisualJedogasAufseher1 = 60342; - public const uint BeamVisualJedogasAufseher2 = 56312; - } - - struct TextIds - { - public const uint SayAggro = 0; - public const uint SaySacrifice1 = 1; - public const uint SaySacrifice2 = 2; - public const uint SaySlay = 3; - public const uint SayDeath = 4; - public const uint SayPreaching = 5; - } - struct Misc - { - public const int ActionInitiateKilled = 1; - public const uint DataVolunteerWork = 2; - - public static Position[] JedogaPosition = - { - new Position(372.330994f, -705.278015f, -0.624178f, 5.427970f), - new Position(372.330994f, -705.278015f, -16.179716f, 5.427970f) - }; - } - - [Script] - public class boss_jedoga_shadowseeker : ScriptedAI - { - public boss_jedoga_shadowseeker(Creature creature) : base(creature) - { - Initialize(); - instance = creature.GetInstanceScript(); - bFirstTime = true; - bPreDone = false; - } - - void Initialize() - { - uiOpFerTimer = RandomHelper.URand(15 * Time.InMilliseconds, 20 * Time.InMilliseconds); - - uiCycloneTimer = 3 * Time.InMilliseconds; - uiBoltTimer = 7 * Time.InMilliseconds; - uiThunderTimer = 12 * Time.InMilliseconds; - - bOpFerok = false; - bOpFerokFail = false; - bOnGround = false; - bCanDown = false; - volunteerWork = true; - } - - public override void Reset() - { - Initialize(); - - if (!bFirstTime) - instance.SetBossState(DataTypes.JedogaShadowseeker, EncounterState.Fail); - - instance.SetGuidData(DataTypes.PlJedogaTarget, ObjectGuid.Empty); - instance.SetGuidData(DataTypes.AddJedogaVictim, ObjectGuid.Empty); - instance.SetData(DataTypes.JedogaResetInitiands, 0); - MoveUp(); - - bFirstTime = false; - } - - public override void EnterCombat(Unit who) - { - if (instance == null || (who.GetTypeId() == TypeId.Unit && who.GetEntry() == AKCreatureIds.JedogaController)) - return; - - Talk(TextIds.SayAggro); - me.SetInCombatWithZone(); - instance.SetBossState(DataTypes.JedogaShadowseeker, EncounterState.InProgress); - } - - public override void AttackStart(Unit who) - { - if (!who || (who.GetTypeId() == TypeId.Unit && who.GetEntry() == AKCreatureIds.JedogaController)) - return; - - base.AttackStart(who); - } - - public override void KilledUnit(Unit Victim) - { - if (!Victim || !Victim.IsTypeId(TypeId.Player)) - return; - - Talk(TextIds.SaySlay); - } - - public override void JustDied(Unit killer) - { - Talk(TextIds.SayDeath); - instance.SetBossState(DataTypes.JedogaShadowseeker, EncounterState.Done); - } - - public override void DoAction(int action) - { - if (action == Misc.ActionInitiateKilled) - volunteerWork = false; - } - - public override uint GetData(uint type) - { - if (type == Misc.DataVolunteerWork) - return volunteerWork ? 1 : 0u; - - return 0; - } - - public override void MoveInLineOfSight(Unit who) - { - if (instance == null || !who || (who.IsTypeId(TypeId.Unit) && who.GetEntry() == AKCreatureIds.JedogaController)) - return; - - if (!bPreDone && who.IsTypeId(TypeId.Player) && me.GetDistance(who) < 100.0f) - { - Talk(TextIds.SayPreaching); - bPreDone = true; - } - - if (instance.GetBossState(DataTypes.JedogaShadowseeker) != EncounterState.InProgress || !bOnGround) - return; - - if (!me.GetVictim() && me.CanCreatureAttack(who)) - { - float attackRadius = me.GetAttackDistance(who); - if (me.IsWithinDistInMap(who, attackRadius) && me.IsWithinLOSInMap(who)) - { - if (!me.GetVictim()) - { - who.RemoveAurasByType(AuraType.ModStealth); - AttackStart(who); - } - else - { - who.SetInCombatWith(me); - AddThreat(who, 0.0f); - } - } - } - } - - void MoveDown() - { - bOpFerokFail = false; - - instance.SetData(DataTypes.JedogaTriggerSwitch, 0); - me.GetMotionMaster().MovePoint(1, Misc.JedogaPosition[1]); - me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Normal, false); - me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, false); - me.RemoveUnitFlag(UnitFlags.NotSelectable | UnitFlags.NonAttackable); - - me.RemoveAurasDueToSpell(SpellIds.SphereVisual); - - bOnGround = true; - - if (UpdateVictim()) - { - AttackStart(me.GetVictim()); - me.GetMotionMaster().MoveChase(me.GetVictim()); - } - else - { - Unit target = Global.ObjAccessor.GetUnit(me, instance.GetGuidData(DataTypes.PlJedogaTarget)); - if (target) - { - AttackStart(target); - instance.SetData(DataTypes.JedogaResetInitiands, 0); - if (instance.GetBossState(DataTypes.JedogaShadowseeker) != EncounterState.InProgress) - EnterCombat(target); - } - else if (!me.IsInCombat()) - EnterEvadeMode(); - } - } - - void MoveUp() - { - me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Normal, true); - me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, true); - me.AddUnitFlag(UnitFlags.NotSelectable | UnitFlags.NonAttackable); - - me.AttackStop(); - me.RemoveAllAuras(); - me.LoadCreaturesAddon(); - me.GetMotionMaster().MovePoint(0, Misc.JedogaPosition[0]); - - instance.SetData(DataTypes.JedogaTriggerSwitch, 1); - if (instance.GetBossState(DataTypes.JedogaShadowseeker) == EncounterState.InProgress) - GetVictimForSacrifice(); - - bOnGround = false; - uiOpFerTimer = RandomHelper.URand(15 * Time.InMilliseconds, 30 * Time.InMilliseconds); - } - - void GetVictimForSacrifice() - { - ObjectGuid victim = instance.GetGuidData(DataTypes.AddJedogaInitiand); - if (!victim.IsEmpty()) - { - Talk(TextIds.SaySacrifice1); - instance.SetGuidData(DataTypes.AddJedogaVictim, victim); - } - else - bCanDown = true; - } - - void Sacrifice() - { - Talk(TextIds.SaySacrifice2); - - me.InterruptNonMeleeSpells(false); - DoCast(me, SpellIds.GiftOfTheHerald, false); - - bOpFerok = false; - bCanDown = true; - } - - public override void UpdateAI(uint diff) - { - if (instance.GetBossState(DataTypes.JedogaShadowseeker) != EncounterState.InProgress && instance.GetData(DataTypes.AllInitiandDead) != 0) - MoveDown(); - - if (bOpFerok && !bOnGround && !bCanDown) - Sacrifice(); - - if (bOpFerokFail && !bOnGround && !bCanDown) - bCanDown = true; - - if (bCanDown) - { - MoveDown(); - bCanDown = false; - } - - if (bOnGround) - { - if (!UpdateVictim()) - return; - - if (uiCycloneTimer <= diff) - { - DoCast(me, SpellIds.CycloneStrike, false); - uiCycloneTimer = RandomHelper.URand(15 * Time.InMilliseconds, 30 * Time.InMilliseconds); - } - else uiCycloneTimer -= diff; - - if (uiBoltTimer <= diff) - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100, true); - if (target) - me.CastSpell(target, SpellIds.LightningBolt, false); - - uiBoltTimer = RandomHelper.URand(15 * Time.InMilliseconds, 30 * Time.InMilliseconds); - } - else uiBoltTimer -= diff; - - if (uiThunderTimer <= diff) - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100, true); - if (target) - me.CastSpell(target, SpellIds.Thundershock, false); - - uiThunderTimer = RandomHelper.URand(15 * Time.InMilliseconds, 30 * Time.InMilliseconds); - } - else uiThunderTimer -= diff; - - if (uiOpFerTimer <= diff) - MoveUp(); - else - uiOpFerTimer -= diff; - - DoMeleeAttackIfReady(); - } - } - - InstanceScript instance; - - uint uiOpFerTimer; - uint uiCycloneTimer; - uint uiBoltTimer; - uint uiThunderTimer; - - bool bPreDone; - public bool bOpFerok; - bool bOnGround; - public bool bOpFerokFail; - bool bCanDown; - bool volunteerWork; - bool bFirstTime; - } - - [Script] - class npc_jedoga_initiand : ScriptedAI - { - public npc_jedoga_initiand(Creature creature) : base(creature) - { - Initialize(); - instance = creature.GetInstanceScript(); - } - - void Initialize() - { - bWalking = false; - bCheckTimer = 2 * Time.InMilliseconds; - } - - public override void Reset() - { - Initialize(); - - if (instance.GetBossState(DataTypes.JedogaShadowseeker) != EncounterState.InProgress) - { - me.RemoveAurasDueToSpell(SpellIds.SphereVisual); - me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Normal, false); - me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, false); - me.RemoveUnitFlag(UnitFlags.NotSelectable | UnitFlags.NonAttackable); - } - else - { - DoCast(me, SpellIds.SphereVisual, false); - me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Normal, true); - me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, true); - me.AddUnitFlag(UnitFlags.NotSelectable | UnitFlags.NonAttackable); - } - } - - public override void JustDied(Unit killer) - { - if (!killer || instance == null) - return; - - if (bWalking) - { - Creature boss = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.JedogaShadowseeker)); - if (boss) - { - if (!boss.GetAI().bOpFerok) - boss.GetAI().bOpFerokFail = true; - - if (killer.IsTypeId(TypeId.Player)) - boss.GetAI().DoAction(Misc.ActionInitiateKilled); - } - - instance.SetGuidData(DataTypes.AddJedogaVictim, ObjectGuid.Empty); - - bWalking = false; - } - if (killer.IsTypeId(TypeId.Player)) - instance.SetGuidData(DataTypes.PlJedogaTarget, killer.GetGUID()); - } - - public override void EnterCombat(Unit who) { } - - public override void AttackStart(Unit victim) - { - if ((instance.GetBossState(DataTypes.JedogaShadowseeker) == EncounterState.InProgress) || !victim) - return; - - base.AttackStart(victim); - } - - public override void MoveInLineOfSight(Unit who) - { - if ((instance.GetBossState(DataTypes.JedogaShadowseeker) == EncounterState.InProgress) || !who) - return; - - base.MoveInLineOfSight(who); - } - - public override void MovementInform(MovementGeneratorType uiType, uint uiPointId) - { - if (uiType != MovementGeneratorType.Point || instance == null) - return; - - switch (uiPointId) - { - case 1: - { - Creature boss = me.GetMap().GetCreature(instance.GetGuidData(DataTypes.JedogaShadowseeker)); - if (boss) - { - boss.GetAI().bOpFerok = true; - boss.GetAI().bOpFerokFail = false; - me.KillSelf(); - } - } - break; - } - } - - public override void UpdateAI(uint diff) - { - if (bCheckTimer <= diff) - { - if (me.GetGUID() == instance.GetGuidData(DataTypes.AddJedogaVictim) && !bWalking) - { - me.RemoveAurasDueToSpell(SpellIds.SphereVisual); - me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Normal, false); - me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, false); - me.RemoveUnitFlag(UnitFlags.NotSelectable | UnitFlags.NonAttackable); - - float distance = me.GetDistance(Misc.JedogaPosition[1]); - - if (distance < 9.0f) - me.SetSpeedRate(UnitMoveType.Walk, 0.5f); - else if (distance < 15.0f) - me.SetSpeedRate(UnitMoveType.Walk, 0.75f); - else if (distance < 20.0f) - me.SetSpeedRate(UnitMoveType.Walk, 1.0f); - - me.GetMotionMaster().Clear(false); - me.GetMotionMaster().MovePoint(1, Misc.JedogaPosition[1]); - bWalking = true; - } - if (!bWalking) - { - if (instance.GetBossState(DataTypes.JedogaShadowseeker) != EncounterState.InProgress && me.HasAura(SpellIds.SphereVisual)) - { - me.RemoveAurasDueToSpell(SpellIds.SphereVisual); - me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Normal, false); - me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, false); - me.RemoveUnitFlag(UnitFlags.NotSelectable | UnitFlags.NonAttackable); - } - if (instance.GetBossState(DataTypes.JedogaShadowseeker) == EncounterState.InProgress && !me.HasAura(SpellIds.SphereVisual)) - { - DoCast(me, SpellIds.SphereVisual, false); - me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Normal, true); - me.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, true); - me.AddUnitFlag(UnitFlags.NotSelectable | UnitFlags.NonAttackable); - } - } - bCheckTimer = 2 * Time.InMilliseconds; - } - else bCheckTimer -= diff; - - //Return since we have no target - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); - } - - InstanceScript instance; - - uint bCheckTimer; - bool bWalking; - } - - - [Script] - class npc_jedogas_aufseher_trigger : ScriptedAI - { - public npc_jedogas_aufseher_trigger(Creature creature) : base(creature) - { - instance = creature.GetInstanceScript(); - bRemoved = false; - bRemoved2 = false; - bCast = false; - bCast2 = false; - - SetCombatMovement(false); - } - - public override void Reset() { } - public override void EnterCombat(Unit who) { } - public override void AttackStart(Unit victim) { } - public override void MoveInLineOfSight(Unit who) { } - - - public override void UpdateAI(uint diff) - { - if (!bRemoved && me.GetPositionX() > 440.0f) - { - if (instance.GetBossState(DataTypes.PrinceTaldaram) == EncounterState.Done) - { - me.InterruptNonMeleeSpells(true); - bRemoved = true; - return; - } - if (!bCast) - { - DoCast(me, SpellIds.BeamVisualJedogasAufseher1, false); - bCast = true; - } - } - if (!bRemoved2 && me.GetPositionX() < 440.0f) - { - if (!bCast2 && instance.GetData(DataTypes.JedogaTriggerSwitch) != 0) - { - DoCast(me, SpellIds.BeamVisualJedogasAufseher2, false); - bCast2 = true; - } - if (bCast2 && instance.GetData(DataTypes.JedogaTriggerSwitch) == 0) - { - me.InterruptNonMeleeSpells(true); - bCast2 = false; - } - if (!bRemoved2 && instance.GetBossState(DataTypes.JedogaShadowseeker) == EncounterState.Done) - { - me.InterruptNonMeleeSpells(true); - bRemoved2 = true; - } - } - } - - InstanceScript instance; - - bool bRemoved; - bool bRemoved2; - bool bCast; - bool bCast2; - } - - [Script] - class achievement_volunteer_work : AchievementCriteriaScript - { - public achievement_volunteer_work() : base("achievement_volunteer_work") { } - - public override bool OnCheck(Player player, Unit target) - { - if (!target) - return false; - - Creature Jedoga = target.ToCreature(); - if (Jedoga) - if (Jedoga.GetAI().GetData(Misc.DataVolunteerWork) != 0) - return true; - - return false; - } - } -} diff --git a/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/BossPrinceTaldaram.cs b/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/BossPrinceTaldaram.cs deleted file mode 100644 index 2cdf567b7..000000000 --- a/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/BossPrinceTaldaram.cs +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using Game.Spells; -using System; - -namespace Scripts.Northrend.AzjolNerub.Ahnkahet.PrinceTaldaram -{ - struct SpellIds - { - public const uint Bloodthirst = 55968; // Trigger Spell + Add Aura - public const uint ConjureFlameSphere = 55931; - public const uint FlameSphereSummon1 = 55895; // 1x 30106 - public const uint FlameSphereSummon2 = 59511; // 1x 31686 - public const uint FlameSphereSummon3 = 59512; // 1x 31687 - public const uint FlameSphereSpawnEffect = 55891; - public const uint FlameSphereVisual = 55928; - public const uint FlameSpherePeriodic = 55926; - public const uint FlameSphereDeathEffect = 55947; - public const uint EmbraceOfTheVampyr = 55959; - public const uint Vanish = 55964; - - public const uint BeamVisual = 60342; - public const uint HoverFall = 60425; - } - - struct CreatureIds - { - public const uint FlameSphere1 = 30106; - public const uint FlameSphere2 = 31686; - public const uint FlameSphere3 = 31687; - } - - struct TextIds - { - public const uint Say1 = 0; - public const uint SayWarning = 1; - public const uint SayAggro = 2; - public const uint SaySlay = 3; - public const uint SayDeath = 4; - public const uint SayFeed = 5; - public const uint SayVanish = 6; - } - - struct Misc - { - public const uint EventConjureFlameSpheres = 1; - public const uint EventBloodthirst = 2; - public const uint EventVanish = 3; - public const uint EventJustVanished = 4; - public const uint EventVanished = 5; - public const uint EventFeeding = 6; - - // Flame Sphere - public const uint EventStartMove = 7; - public const uint EventDespawn = 8; - - public const uint DataEmbraceDmg = 20000; - public const uint DataEmbraceDmgH = 40000; - public const float DataSphereDistance = 25.0f; - public const float DataSphereAngleOffset = MathFunctions.PI / 2; - public const float DataGroundPositionZ = 11.30809f; - } - - [Script] - public class boss_prince_taldaram : BossAI - { - public boss_prince_taldaram(Creature creature) : base(creature, DataTypes.PrinceTaldaram) - { - me.SetDisableGravity(true); - _embraceTakenDamage = 0; - } - - public override void Reset() - { - _Reset(); - _flameSphereTargetGUID.Clear(); - _embraceTargetGUID.Clear(); - _embraceTakenDamage = 0; - } - - public override void EnterCombat(Unit who) - { - _EnterCombat(); - Talk(TextIds.SayAggro); - _events.ScheduleEvent(Misc.EventBloodthirst, 10000); - _events.ScheduleEvent(Misc.EventVanish, RandomHelper.URand(25000, 35000)); - _events.ScheduleEvent(Misc.EventConjureFlameSpheres, 5000); - } - - public override void JustSummoned(Creature summon) - { - base.JustSummoned(summon); - - switch (summon.GetEntry()) - { - case CreatureIds.FlameSphere1: - case CreatureIds.FlameSphere2: - case CreatureIds.FlameSphere3: - summon.GetAI().SetGUID(_flameSphereTargetGUID); - break; - } - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case Misc.EventBloodthirst: - DoCast(me, SpellIds.Bloodthirst); - _events.ScheduleEvent(Misc.EventBloodthirst, 10000); - break; - case Misc.EventConjureFlameSpheres: - // random target? - Unit victim = me.GetVictim(); - if (victim) - { - _flameSphereTargetGUID = victim.GetGUID(); - DoCast(victim, SpellIds.ConjureFlameSphere); - } - _events.ScheduleEvent(Misc.EventConjureFlameSpheres, 15000); - break; - case Misc.EventVanish: - { - var players = me.GetMap().GetPlayers(); - uint targets = 0; - foreach (var player in players) - { - if (player && player.IsAlive()) - ++targets; - } - - if (targets > 2) - { - Talk(TextIds.SayVanish); - DoCast(me, SpellIds.Vanish); - me.SetInCombatState(true); // Prevents the boss from resetting - _events.DelayEvents(500); - _events.ScheduleEvent(Misc.EventJustVanished, 500); - Unit embraceTarget = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true); - if (embraceTarget) - _embraceTargetGUID = embraceTarget.GetGUID(); - } - _events.ScheduleEvent(Misc.EventVanish, RandomHelper.URand(25000, 35000)); - break; - } - case Misc.EventJustVanished: - { - Unit embraceTarget = GetEmbraceTarget(); - if (embraceTarget) - { - me.GetMotionMaster().Clear(); - me.SetSpeedRate(UnitMoveType.Walk, 2.0f); - me.GetMotionMaster().MoveChase(embraceTarget); - } - _events.ScheduleEvent(Misc.EventVanished, 1300); - } - break; - case Misc.EventVanished: - { - Unit embraceTarget = GetEmbraceTarget(); - if (embraceTarget) - DoCast(embraceTarget, SpellIds.EmbraceOfTheVampyr); - Talk(TextIds.SayFeed); - me.GetMotionMaster().Clear(); - me.SetSpeedRate(UnitMoveType.Walk, 1.0f); - me.GetMotionMaster().MoveChase(me.GetVictim()); - _events.ScheduleEvent(Misc.EventFeeding, 20000); - } - break; - case Misc.EventFeeding: - _embraceTargetGUID.Clear(); - break; - default: - break; - } - }); - - DoMeleeAttackIfReady(); - } - - public override void DamageTaken(Unit doneBy, ref uint damage) - { - Unit embraceTarget = GetEmbraceTarget(); - - if (embraceTarget && embraceTarget.IsAlive()) - { - _embraceTakenDamage += damage; - if (_embraceTakenDamage > DungeonMode(Misc.DataEmbraceDmg, Misc.DataEmbraceDmgH)) - { - _embraceTargetGUID.Clear(); - me.CastStop(); - } - } - } - - public override void JustDied(Unit killer) - { - Talk(TextIds.SayDeath); - _JustDied(); - } - - public override void KilledUnit(Unit victim) - { - if (!victim.IsTypeId(TypeId.Player)) - return; - - if (victim.GetGUID() == _embraceTargetGUID) - _embraceTargetGUID.Clear(); - - Talk(TextIds.SaySlay); - } - - public bool CheckSpheres() - { - for (byte i = 0; i < 2; ++i) - { - if (instance.GetData(DataTypes.Sphere1 + i) == 0) - return false; - } - - RemovePrison(); - return true; - } - - Unit GetEmbraceTarget() - { - if (!_embraceTargetGUID.IsEmpty()) - return Global.ObjAccessor.GetUnit(me, _embraceTargetGUID); - - return null; - } - - void RemovePrison() - { - me.RemoveUnitFlag(UnitFlags.NotSelectable); - me.RemoveAurasDueToSpell(SpellIds.BeamVisual); - me.SetHomePosition(me.GetPositionX(), me.GetPositionY(), Misc.DataGroundPositionZ, me.GetOrientation()); - DoCast(SpellIds.HoverFall); - me.SetDisableGravity(false); - me.GetMotionMaster().MoveLand(0, me.GetHomePosition()); - Talk(TextIds.SayWarning); - instance.HandleGameObject(instance.GetGuidData(DataTypes.PrinceTaldaramPlatform), true); - } - - ObjectGuid _flameSphereTargetGUID; - ObjectGuid _embraceTargetGUID; - uint _embraceTakenDamage; - } - - [Script] // 30106, 31686, 31687 - Flame Sphere - class npc_prince_taldaram_flame_sphere : ScriptedAI - { - public npc_prince_taldaram_flame_sphere(Creature creature) : base(creature) - { - } - - public override void Reset() - { - DoCast(me, SpellIds.FlameSphereSpawnEffect, true); - DoCast(me, SpellIds.FlameSphereVisual, true); - - _flameSphereTargetGUID.Clear(); - _events.Reset(); - _events.ScheduleEvent(Misc.EventStartMove, 3 * Time.InMilliseconds); - _events.ScheduleEvent(Misc.EventDespawn, 13 * Time.InMilliseconds); - } - - public override void SetGUID(ObjectGuid guid, int id = 0) - { - _flameSphereTargetGUID = guid; - } - - public override void EnterCombat(Unit who) { } - - public override void MoveInLineOfSight(Unit who) { } - - public override void UpdateAI(uint diff) - { - _events.Update(diff); - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case Misc.EventStartMove: - { - DoCast(me, SpellIds.FlameSpherePeriodic, true); - - // @todo: find correct values - float angleOffset = 0.0f; - float distOffset = Misc.DataSphereDistance; - - switch (me.GetEntry()) - { - case CreatureIds.FlameSphere1: - break; - case CreatureIds.FlameSphere2: - angleOffset = Misc.DataSphereAngleOffset; - break; - case CreatureIds.FlameSphere3: - angleOffset = -Misc.DataSphereAngleOffset; - break; - default: - return; - } - - Unit sphereTarget = Global.ObjAccessor.GetUnit(me, _flameSphereTargetGUID); - if (!sphereTarget) - return; - - float angle = me.GetAngle(sphereTarget) + angleOffset; - float x = me.GetPositionX() + distOffset * (float)Math.Cos(angle); - float y = me.GetPositionY() + distOffset * (float)Math.Sin(angle); - - // @todo: correct speed - me.GetMotionMaster().MovePoint(0, x, y, me.GetPositionZ()); - break; - } - case Misc.EventDespawn: - DoCast(me, SpellIds.FlameSphereDeathEffect, true); - me.DespawnOrUnsummon(1000); - break; - default: - break; - } - }); - } - - ObjectGuid _flameSphereTargetGUID; - } - - [Script] // 193093, 193094 - Ancient Nerubian Device - class go_prince_taldaram_sphere : GameObjectScript - { - public go_prince_taldaram_sphere() : base("go_prince_taldaram_sphere") { } - - class go_prince_taldaram_sphereAI : GameObjectAI - { - public go_prince_taldaram_sphereAI(GameObject go) : base(go) - { - instance = go.GetInstanceScript(); - } - - public override bool GossipHello(Player player) - { - Creature PrinceTaldaram = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.PrinceTaldaram)); - if (PrinceTaldaram && PrinceTaldaram.IsAlive()) - { - me.AddFlag(GameObjectFlags.NotSelectable); - me.SetGoState(GameObjectState.Active); - - switch (me.GetEntry()) - { - case GameObjectIds.Sphere1: - instance.SetData(DataTypes.Sphere1, (uint)EncounterState.InProgress); - PrinceTaldaram.GetAI().Talk(TextIds.Say1); - break; - case GameObjectIds.Sphere2: - instance.SetData(DataTypes.Sphere2, (uint)EncounterState.InProgress); - PrinceTaldaram.GetAI().Talk(TextIds.Say1); - break; - } - - PrinceTaldaram.GetAI().CheckSpheres(); - } - return true; - } - - InstanceScript instance; - } - - public override GameObjectAI GetAI(GameObject go) - { - return GetInstanceAI(go); - } - } - - [Script] // 55931 - Conjure Flame Sphere - class spell_prince_taldaram_conjure_flame_sphere : SpellScript - { - public override bool Validate(SpellInfo spellInfo) - { - return ValidateSpellInfo(SpellIds.FlameSphereSummon1, SpellIds.FlameSphereSummon2, SpellIds.FlameSphereSummon3); - } - - void HandleScript(uint effIndex) - { - Unit caster = GetCaster(); - caster.CastSpell(caster, SpellIds.FlameSphereSummon1, true); - - if (caster.GetMap().IsHeroic()) - { - caster.CastSpell(caster, SpellIds.FlameSphereSummon2, true); - caster.CastSpell(caster, SpellIds.FlameSphereSummon3, true); - } - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.Dummy)); - } - } - - [Script] // 55895, 59511, 59512 - Flame Sphere Summon - class spell_prince_taldaram_flame_sphere_summon : SpellScript - { - void SetDest(ref SpellDestination dest) - { - dest.RelocateOffset(new Position(0.0f, 0.0f, 5.5f, 0.0f)); - } - - public override void Register() - { - OnDestinationTargetSelect.Add(new DestinationTargetSelectHandler(SetDest, 0, Targets.DestCaster)); - } - } -} diff --git a/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/InstanceAhnahet.cs b/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/InstanceAhnahet.cs deleted file mode 100644 index d64f1c28e..000000000 --- a/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/InstanceAhnahet.cs +++ /dev/null @@ -1,334 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using System.Collections.Generic; - -namespace Scripts.Northrend.AzjolNerub.Ahnkahet -{ - struct DataTypes - { - // Encounter States/Boss GUIDs - public const uint ElderNadox = 0; - public const uint PrinceTaldaram = 1; - public const uint JedogaShadowseeker = 2; - public const uint Amanitar = 3; - public const uint HeraldVolazj = 4; - - // Additional Data - public const uint Sphere1 = 5; - public const uint Sphere2 = 6; - public const uint PrinceTaldaramPlatform = 7; - public const uint PlJedogaTarget = 8; - public const uint AddJedogaVictim = 9; - public const uint AddJedogaInitiand = 10; - public const uint JedogaTriggerSwitch = 11; - public const uint JedogaResetInitiands = 12; - public const uint AllInitiandDead = 13; - } - - struct AKCreatureIds - { - public const uint ElderNadox = 29309; - public const uint PrinceTaldaram = 29308; - public const uint JedogaShadowseeker = 29310; - public const uint Amanitar = 30258; - public const uint HeraldVolazj = 29311; - - // Elder Nadox - public const uint AhnkaharGuardian = 30176; - public const uint AhnkaharSwarmer = 30178; - - // Jedoga Shadowseeker - public const uint Initiand = 30114; - public const uint JedogaController = 30181; - - // Herald Volazj - //public const uint TwistedVisage1 = 30621, - //public const uint TwistedVisage2 = 30622, - //public const uint TwistedVisage3 = 30623, - //public const uint TwistedVisage4 = 30624, - public const uint TwistedVisage = 30625; - } - - struct GameObjectIds - { - public const uint PrinceTaldaramGate = 192236; - public const uint PrinceTaldaramPlatform = 193564; - public const uint Sphere1 = 193093; - public const uint Sphere2 = 193094; - } - - [Script] - class instance_ahnkahet : InstanceMapScript - { - public instance_ahnkahet() : base("instance_ahnkahet", 619) { } - - class instance_ahnkahet_InstanceScript : InstanceScript - { - public instance_ahnkahet_InstanceScript(InstanceMap map) : base(map) - { - SetHeaders("AK"); - SetBossNumber(DataTypes.HeraldVolazj + 1); - LoadDoorData(new DoorData(GameObjectIds.PrinceTaldaramGate, DataTypes.PrinceTaldaram, DoorType.Passage)); - - SwitchTrigger = 0; - - SpheresState[0] = 0; - SpheresState[1] = 0; - } - - public override void OnCreatureCreate(Creature creature) - { - switch (creature.GetEntry()) - { - case AKCreatureIds.ElderNadox: - ElderNadoxGUID = creature.GetGUID(); - break; - case AKCreatureIds.PrinceTaldaram: - PrinceTaldaramGUID = creature.GetGUID(); - break; - case AKCreatureIds.JedogaShadowseeker: - JedogaShadowseekerGUID = creature.GetGUID(); - break; - case AKCreatureIds.Amanitar: - AmanitarGUID = creature.GetGUID(); - break; - case AKCreatureIds.HeraldVolazj: - HeraldVolazjGUID = creature.GetGUID(); - break; - case AKCreatureIds.Initiand: - InitiandGUIDs.Add(creature.GetGUID()); - break; - default: - break; - } - } - - public override void OnGameObjectCreate(GameObject go) - { - switch (go.GetEntry()) - { - case GameObjectIds.PrinceTaldaramPlatform: - PrinceTaldaramPlatformGUID = go.GetGUID(); - if (GetBossState(DataTypes.PrinceTaldaram) == EncounterState.Done) - HandleGameObject(ObjectGuid.Empty, true, go); - break; - case GameObjectIds.Sphere1: - if (SpheresState[0] != 0) - { - go.SetGoState(GameObjectState.Active); - go.AddFlag(GameObjectFlags.NotSelectable); - } - else - go.RemoveFlag(GameObjectFlags.NotSelectable); - break; - case GameObjectIds.Sphere2: - if (SpheresState[1] != 0) - { - go.SetGoState(GameObjectState.Active); - go.AddFlag(GameObjectFlags.NotSelectable); - } - else - go.RemoveFlag(GameObjectFlags.NotSelectable); - break; - case GameObjectIds.PrinceTaldaramGate: - AddDoor(go, true); - break; - default: - break; - } - } - - public override void OnGameObjectRemove(GameObject go) - { - switch (go.GetEntry()) - { - case GameObjectIds.PrinceTaldaramGate: - AddDoor(go, false); - break; - default: - break; - } - } - - public override void SetData(uint type, uint data) - { - switch (type) - { - case DataTypes.Sphere1: - case DataTypes.Sphere2: - SpheresState[type - DataTypes.Sphere1] = data; - break; - case DataTypes.JedogaTriggerSwitch: - SwitchTrigger = (byte)data; - break; - case DataTypes.JedogaResetInitiands: - foreach (ObjectGuid guid in InitiandGUIDs) - { - Creature creature = instance.GetCreature(guid); - if (creature) - { - creature.Respawn(); - if (!creature.IsInEvadeMode()) - creature.GetAI().EnterEvadeMode(); - } - } - break; - default: - break; - } - } - - public override uint GetData(uint type) - { - switch (type) - { - case DataTypes.Sphere1: - case DataTypes.Sphere2: - return SpheresState[type - DataTypes.Sphere1]; - case DataTypes.AllInitiandDead: - foreach (ObjectGuid guid in InitiandGUIDs) - { - Creature cr = instance.GetCreature(guid); - if (!cr || cr.IsAlive()) - return 0; - } - return 1; - case DataTypes.JedogaTriggerSwitch: - return SwitchTrigger; - default: - break; - } - return 0; - } - - public override void SetGuidData(uint type, ObjectGuid data) - { - switch (type) - { - case DataTypes.AddJedogaVictim: - JedogaSacrifices = data; - break; - case DataTypes.PlJedogaTarget: - JedogaTarget = data; - break; - default: - break; - } - } - - public override ObjectGuid GetGuidData(uint type) - { - switch (type) - { - case DataTypes.ElderNadox: - return ElderNadoxGUID; - case DataTypes.PrinceTaldaram: - return PrinceTaldaramGUID; - case DataTypes.JedogaShadowseeker: - return JedogaShadowseekerGUID; - case DataTypes.Amanitar: - return AmanitarGUID; - case DataTypes.HeraldVolazj: - return HeraldVolazjGUID; - case DataTypes.PrinceTaldaramPlatform: - return PrinceTaldaramPlatformGUID; - case DataTypes.AddJedogaInitiand: - { - List vInitiands = new List(); - foreach (ObjectGuid guid in InitiandGUIDs) - { - Creature cr = instance.GetCreature(guid); - if (cr && cr.IsAlive()) - vInitiands.Add(guid); - } - if (vInitiands.Empty()) - return ObjectGuid.Empty; - - return vInitiands.SelectRandom(); - } - case DataTypes.AddJedogaVictim: - return JedogaSacrifices; - case DataTypes.PlJedogaTarget: - return JedogaTarget; - default: - break; - } - return ObjectGuid.Empty; - } - - public override bool SetBossState(uint type, EncounterState state) - { - if (!base.SetBossState(type, state)) - return false; - - switch (type) - { - case DataTypes.JedogaShadowseeker: - if (state == EncounterState.Done) - { - foreach (ObjectGuid guid in InitiandGUIDs) - { - Creature cr = instance.GetCreature(guid); - if (cr) - cr.DespawnOrUnsummon(); - } - } - break; - default: - break; - } - return true; - } - - void WriteSaveDataMore(string data) - { - data += SpheresState[0] + ' ' + SpheresState[1]; - } - - void ReadSaveDataMore(string data) - { - data += SpheresState[0]; - data += SpheresState[1]; - } - - ObjectGuid ElderNadoxGUID; - ObjectGuid PrinceTaldaramGUID; - ObjectGuid JedogaShadowseekerGUID; - ObjectGuid AmanitarGUID; - ObjectGuid HeraldVolazjGUID; - - ObjectGuid PrinceTaldaramPlatformGUID; - ObjectGuid JedogaSacrifices; - ObjectGuid JedogaTarget; - - List InitiandGUIDs = new List(); - - uint[] SpheresState = new uint[2]; - byte SwitchTrigger; - } - - public override InstanceScript GetInstanceScript(InstanceMap map) - { - return new instance_ahnkahet_InstanceScript(map); - } - } -} diff --git a/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossAnubarak.cs b/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossAnubarak.cs deleted file mode 100644 index d85cd419c..000000000 --- a/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossAnubarak.cs +++ /dev/null @@ -1,639 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using Game.Spells; -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Scripts.Northrend.AzjolNerub.AzjolNerub.Anubarak -{ - struct SpellIds - { - public const uint Emerge = 53500; - public const uint Submerge = 53421; - public const uint ImpaleAura = 53456; - public const uint ImpaleVisual = 53455; - public const uint ImpaleDamage = 53454; - public const uint LeechingSwarm = 53467; - public const uint Pound = 59433; - public const uint PoundDamage = 59432; - public const uint CarrionBeetles = 53520; - public const uint CarrionBeetle = 53521; - - public const uint SummonDarter = 53599; - public const uint SummonAssassin = 53609; - public const uint SummonGuardian = 53614; - public const uint SummonVenomancer = 53615; - - public const uint Dart = 59349; - public const uint Backstab = 52540; - public const uint AssassinVisual = 53611; - public const uint SunderArmor = 53618; - public const uint PoisonBolt = 53617; - } - - struct CreatureIds - { - public const uint WorldTrigger = 22515; - } - - struct TextIds - { - public const uint SayAggro = 0; - public const uint SaySlay = 1; - public const uint SayDeath = 2; - public const uint SayLocust = 3; - public const uint SaySubmerge = 4; - public const uint SayIntro = 5; - } - - struct EventIds - { - public const uint Pound = 1; - public const uint Impale = 2; - public const uint LeechingSwarm = 3; - public const uint CarrionBeetles = 4; - public const uint Submerge = 5; // Use Event For This So We Don'T Submerge Mid-Cast - public const uint Darter = 6; - public const uint Assassin = 7; - public const uint Guardian = 8; - public const uint Venomancer = 9; - public const uint CloseDoor = 10; - } - - struct Misc - { - public const uint AchievGottaGoStartEvent = 20381; - - public const byte PhaseEmerge = 1; - public const byte PhaseSubmerge = 2; - - public const int GuidTypePet = 0; - public const int GuidTypeImpale = 1; - - public const byte SummonGroupWorldTriggerGuardian = 1; - - public const int ActionPetDied = 1; - public const int ActionPetEvade = 2; - } - - [Script] - class boss_anub_arak : BossAI - { - public boss_anub_arak(Creature creature) : base(creature, ANDataTypes.Anubarak) { } - - public override void Reset() - { - base.Reset(); - me.RemoveUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - instance.DoStopCriteriaTimer(CriteriaTimedTypes.Event, Misc.AchievGottaGoStartEvent); - _nextSubmerge = 75; - _petCount = 0; - } - - public override bool CanAIAttack(Unit victim) { return true; } // do not check boundary here - - public override void EnterCombat(Unit who) - { - base.EnterCombat(who); - - GameObject door = instance.GetGameObject(ANDataTypes.AnubarakWall); - if (door) - door.SetGoState(GameObjectState.Active); // open door for now - GameObject door2 = instance.GetGameObject(ANDataTypes.AnubarakWall2); - if (door2) - door2.SetGoState(GameObjectState.Active); - - Talk(TextIds.SayAggro); - instance.DoStartCriteriaTimer(CriteriaTimedTypes.Event, Misc.AchievGottaGoStartEvent); - - _events.SetPhase(Misc.PhaseEmerge); - _events.ScheduleEvent(EventIds.CloseDoor, TimeSpan.FromSeconds(5)); - _events.ScheduleEvent(EventIds.Pound, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(4), 0, Misc.PhaseEmerge); - _events.ScheduleEvent(EventIds.LeechingSwarm, TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(7), 0, Misc.PhaseEmerge); - _events.ScheduleEvent(EventIds.CarrionBeetles, TimeSpan.FromSeconds(14), TimeSpan.FromSeconds(17), 0, Misc.PhaseEmerge); - - // set up world triggers - List summoned; - me.SummonCreatureGroup(Misc.SummonGroupWorldTriggerGuardian, out summoned); - if (summoned.Empty()) // something went wrong - { - EnterEvadeMode(EvadeReason.Other); - return; - } - _guardianTrigger = summoned.First().GetGUID(); - - Creature trigger = DoSummon(CreatureIds.WorldTrigger, me.GetPosition(), 0u, TempSummonType.ManualDespawn); - if (trigger) - _assassinTrigger = trigger.GetGUID(); - else - { - EnterEvadeMode(EvadeReason.Other); - return; - } - } - - public override void EnterEvadeMode(EvadeReason why) - { - summons.DespawnAll(); - _DespawnAtEvade(); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case EventIds.CloseDoor: - GameObject door = instance.GetGameObject(ANDataTypes.AnubarakWall); - if (door) - door.SetGoState(GameObjectState.Ready); - GameObject door2 = instance.GetGameObject(ANDataTypes.AnubarakWall2); - if (door2) - door2.SetGoState(GameObjectState.Ready); - break; - case EventIds.Pound: - DoCastVictim(SpellIds.Pound); - _events.Repeat(TimeSpan.FromSeconds(26), TimeSpan.FromSeconds(32)); - break; - case EventIds.LeechingSwarm: - Talk(TextIds.SayLocust); - DoCastAOE(SpellIds.LeechingSwarm); - _events.Repeat(TimeSpan.FromSeconds(25), TimeSpan.FromSeconds(28)); - break; - case EventIds.CarrionBeetles: - DoCastAOE(SpellIds.CarrionBeetles); - _events.Repeat(TimeSpan.FromSeconds(24), TimeSpan.FromSeconds(27)); - break; - case EventIds.Impale: - Creature impaleTarget = ObjectAccessor.GetCreature(me, _impaleTarget); - if (impaleTarget) - DoCast(impaleTarget, SpellIds.ImpaleDamage, true); - break; - case EventIds.Submerge: - Talk(TextIds.SaySubmerge); - DoCastSelf(SpellIds.Submerge); - break; - case EventIds.Darter: - { - List triggers = new List(); - me.GetCreatureListWithEntryInGrid(triggers, CreatureIds.WorldTrigger); - if (!triggers.Empty()) - { - var it = triggers.SelectRandom(); - it.CastSpell(it, SpellIds.SummonDarter, true); - _events.Repeat(TimeSpan.FromSeconds(11)); - } - else - EnterEvadeMode(EvadeReason.Other); - break; - } - case EventIds.Assassin: - { - Creature trigger = ObjectAccessor.GetCreature(me, _assassinTrigger); - if (trigger) - { - trigger.CastSpell(trigger, SpellIds.SummonAssassin, true); - trigger.CastSpell(trigger, SpellIds.SummonAssassin, true); - if (_assassinCount > 2) - { - _assassinCount -= 2; - _events.Repeat(TimeSpan.FromSeconds(20)); - } - else - _assassinCount = 0; - } - else // something went wrong - EnterEvadeMode(EvadeReason.Other); - break; - } - case EventIds.Guardian: - { - Creature trigger = ObjectAccessor.GetCreature(me, _guardianTrigger); - if (trigger) - { - trigger.CastSpell(trigger, SpellIds.SummonGuardian, true); - trigger.CastSpell(trigger, SpellIds.SummonGuardian, true); - if (_guardianCount > 2) - { - _guardianCount -= 2; - _events.Repeat(TimeSpan.FromSeconds(20)); - } - else - _guardianCount = 0; - } - else - EnterEvadeMode(EvadeReason.Other); - } - break; - case EventIds.Venomancer: - { - Creature trigger = ObjectAccessor.GetCreature(me, _guardianTrigger); - if (trigger) - { - trigger.CastSpell(trigger, SpellIds.SummonVenomancer, true); - trigger.CastSpell(trigger, SpellIds.SummonVenomancer, true); - if (_venomancerCount > 2) - { - _venomancerCount -= 2; - _events.Repeat(TimeSpan.FromSeconds(20)); - } - else - _venomancerCount = 0; - } - else - EnterEvadeMode(EvadeReason.Other); - } - break; - default: - break; - } - - if (me.HasUnitState(UnitState.Casting)) - return; - }); - - - DoMeleeAttackIfReady(); - } - - public override void JustDied(Unit killer) - { - _JustDied(); - Talk(TextIds.SayDeath); - } - - public override void KilledUnit(Unit victim) - { - if (victim.IsTypeId(TypeId.Player)) - Talk(TextIds.SaySlay); - } - - public override void SetGUID(ObjectGuid guid, int type) - { - switch (type) - { - case Misc.GuidTypePet: - { - Creature creature = ObjectAccessor.GetCreature(me, guid); - if (creature) - JustSummoned(creature); - else // something has gone horribly wrong - EnterEvadeMode(EvadeReason.Other); - break; - } - case Misc.GuidTypeImpale: - _impaleTarget = guid; - _events.ScheduleEvent(EventIds.Impale, TimeSpan.FromSeconds(4)); - break; - } - } - - public override void DoAction(int action) - { - switch (action) - { - case Misc.ActionPetDied: - if (_petCount == 0) // underflow check - something has gone horribly wrong - { - EnterEvadeMode(EvadeReason.Other); - return; - } - if (--_petCount == 0) // last pet died, emerge - { - me.RemoveAurasDueToSpell(SpellIds.Submerge); - me.RemoveAurasDueToSpell(SpellIds.ImpaleAura); - me.RemoveUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - DoCastSelf(SpellIds.Emerge); - _events.SetPhase(Misc.PhaseEmerge); - _events.ScheduleEvent(EventIds.Pound, TimeSpan.FromSeconds(13), TimeSpan.FromSeconds(18), 0, Misc.PhaseEmerge); - _events.ScheduleEvent(EventIds.LeechingSwarm, TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(7), 0, Misc.PhaseEmerge); - _events.ScheduleEvent(EventIds.CarrionBeetles, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15), 0, Misc.PhaseEmerge); - } - break; - case Misc.ActionPetEvade: - EnterEvadeMode(EvadeReason.Other); - break; - } - } - - public override void DamageTaken(Unit source, ref uint damage) - { - if (me.HasAura(SpellIds.Submerge)) - damage = 0; - else - if (_nextSubmerge != 0 && me.HealthBelowPctDamaged((int)_nextSubmerge, damage)) - { - _events.CancelEvent(EventIds.Submerge); - _events.ScheduleEvent(EventIds.Submerge, 0, 0, Misc.PhaseEmerge); - _nextSubmerge = _nextSubmerge - 25; - } - } - - public override void SpellHit(Unit whose, SpellInfo spell) - { - if (spell.Id == SpellIds.Submerge) - { - me.AddUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - me.RemoveAurasDueToSpell(SpellIds.LeechingSwarm); - DoCastSelf(SpellIds.ImpaleAura, true); - - _events.SetPhase(Misc.PhaseSubmerge); - switch (_nextSubmerge) - { - case 50: // first submerge phase - _assassinCount = 4; - _guardianCount = 2; - _venomancerCount = 0; - break; - case 25: // second submerge phase - _assassinCount = 6; - _guardianCount = 2; - _venomancerCount = 2; - break; - case 0: // third submerge phase - _assassinCount = 6; - _guardianCount = 2; - _venomancerCount = 2; - _events.ScheduleEvent(EventIds.Darter, TimeSpan.FromSeconds(0), 0, Misc.PhaseSubmerge); - break; - } - _petCount = (uint)(_guardianCount + _venomancerCount); - if (_assassinCount != 0) - _events.ScheduleEvent(EventIds.Assassin, TimeSpan.FromSeconds(0), 0, Misc.PhaseSubmerge); - if (_guardianCount != 0) - _events.ScheduleEvent(EventIds.Guardian, TimeSpan.FromSeconds(4), 0, Misc.PhaseSubmerge); - if (_venomancerCount != 0) - _events.ScheduleEvent(EventIds.Venomancer, TimeSpan.FromSeconds(20), 0, Misc.PhaseSubmerge); - } - } - - ObjectGuid _impaleTarget; - uint _nextSubmerge; - uint _petCount; - ObjectGuid _guardianTrigger; - ObjectGuid _assassinTrigger; - byte _assassinCount; - byte _guardianCount; - byte _venomancerCount; - } - - class npc_anubarak_pet_template : ScriptedAI - { - public npc_anubarak_pet_template(Creature creature, bool isLarge) : base(creature) - { - _instance = creature.GetInstanceScript(); - _isLarge = isLarge; - } - - public override void InitializeAI() - { - base.InitializeAI(); - - Creature anubarak = _instance.GetCreature(ANDataTypes.Anubarak); - if (anubarak) - anubarak.GetAI().SetGUID(me.GetGUID(), Misc.GuidTypePet); - else - me.DespawnOrUnsummon(); - } - - public override void JustDied(Unit killer) - { - base.JustDied(killer); - if (_isLarge) - { - Creature anubarak = _instance.GetCreature(ANDataTypes.Anubarak); - if (anubarak) - anubarak.GetAI().DoAction(Misc.ActionPetDied); - } - } - - public override void EnterEvadeMode(EvadeReason why) - { - Creature anubarak = _instance.GetCreature(ANDataTypes.Anubarak); - if (anubarak) - anubarak.GetAI().DoAction(Misc.ActionPetEvade); - else - me.DespawnOrUnsummon(); - } - - protected InstanceScript _instance; - bool _isLarge; - } - - [Script] - class npc_anubarak_anub_ar_darter : npc_anubarak_pet_template - { - public npc_anubarak_anub_ar_darter(Creature creature) : base(creature, false) { } - - public override void InitializeAI() - { - base.InitializeAI(); - DoCastAOE(SpellIds.Dart); - } - } - - [Script] - class npc_anubarak_anub_ar_assassin : npc_anubarak_pet_template - { - public npc_anubarak_anub_ar_assassin(Creature creature) : base(creature, false) - { - _backstabTimer = 6 * Time.InMilliseconds; - } - - Position GetRandomPositionAround(Creature anubarak) - { - float DISTANCE_MIN = 10.0f; - float DISTANCE_MAX = 30.0f; - double angle = RandomHelper.NextDouble() * 2.0 * Math.PI; - return new Position(anubarak.GetPositionX() + (float)(RandomHelper.FRand(DISTANCE_MIN, DISTANCE_MAX) * Math.Sin(angle)), anubarak.GetPositionY() + (float)(RandomHelper.FRand(DISTANCE_MIN, DISTANCE_MAX) * Math.Cos(angle)), anubarak.GetPositionZ()); - } - - public override void InitializeAI() - { - base.InitializeAI(); - var boundary = _instance.GetBossBoundary(ANDataTypes.Anubarak); - Creature anubarak = _instance.GetCreature(ANDataTypes.Anubarak); - if (anubarak) - { - Position jumpTo; - do - jumpTo = GetRandomPositionAround(anubarak); - while (!IsInBounds(boundary, jumpTo)); - me.GetMotionMaster().MoveJump(jumpTo, 40.0f, 40.0f); - DoCastSelf(SpellIds.AssassinVisual, true); - } - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - if (diff >= _backstabTimer) - { - if (me.GetVictim() && me.GetVictim().IsInBack(me)) - DoCastVictim(SpellIds.Backstab); - _backstabTimer = 6 * Time.InMilliseconds; - } - else - _backstabTimer -= diff; - - DoMeleeAttackIfReady(); - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - if (id == EventId.Jump) - { - me.RemoveAurasDueToSpell(SpellIds.AssassinVisual); - DoZoneInCombat(); - } - } - - uint _backstabTimer; - } - - [Script] - class npc_anubarak_anub_ar_guardian : npc_anubarak_pet_template - { - public npc_anubarak_anub_ar_guardian(Creature creature) : base(creature, true) - { - _sunderTimer = 6 * Time.InMilliseconds; - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - if (diff >= _sunderTimer) - { - DoCastVictim(SpellIds.SunderArmor); - _sunderTimer = 12 * Time.InMilliseconds; - } - else - _sunderTimer -= diff; - - DoMeleeAttackIfReady(); - } - - uint _sunderTimer; - } - - [Script] - class npc_anubarak_anub_ar_venomancer : npc_anubarak_pet_template - { - public npc_anubarak_anub_ar_venomancer(Creature creature) : base(creature, true) - { - _boltTimer = 5 * Time.InMilliseconds; - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - if (diff >= _boltTimer) - { - DoCastVictim(SpellIds.PoisonBolt); - _boltTimer = RandomHelper.URand(2, 3) * Time.InMilliseconds; - } - else - _boltTimer -= diff; - - DoMeleeAttackIfReady(); - } - - uint _boltTimer; - } - - [Script] - class npc_anubarak_impale_target : NullCreatureAI - { - public npc_anubarak_impale_target(Creature creature) : base(creature) { } - - public override void InitializeAI() - { - Creature anubarak = me.GetInstanceScript().GetCreature(ANDataTypes.Anubarak); - if (anubarak) - { - DoCastSelf(SpellIds.ImpaleVisual); - me.DespawnOrUnsummon(TimeSpan.FromSeconds(6)); - anubarak.GetAI().SetGUID(me.GetGUID(), Misc.GuidTypeImpale); - } - else - me.DespawnOrUnsummon(); - } - } - - [Script] - class spell_anubarak_pound : SpellScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(SpellIds.PoundDamage); - } - - void HandleDummy(uint effIndex) - { - Unit target = GetHitUnit(); - if (target) - GetCaster().CastSpell(target, SpellIds.PoundDamage, true); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.ApplyAura)); - } - } - - [Script] - class spell_anubarak_carrion_beetles : AuraScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(SpellIds.CarrionBeetle); - } - - void HandlePeriodic(AuraEffect eff) - { - GetCaster().CastSpell(GetCaster(), SpellIds.CarrionBeetle, true); - GetCaster().CastSpell(GetCaster(), SpellIds.CarrionBeetle, true); - } - - public override void Register() - { - OnEffectPeriodic.Add(new EffectPeriodicHandler(HandlePeriodic, 0, AuraType.PeriodicDummy)); - } - } -} diff --git a/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossKrikthirTheGatewatcher.cs b/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossKrikthirTheGatewatcher.cs deleted file mode 100644 index 5e544b145..000000000 --- a/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossKrikthirTheGatewatcher.cs +++ /dev/null @@ -1,864 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using Game.Spells; -using System; -using System.Collections.Generic; - -namespace Scripts.Northrend.AzjolNerub.AzjolNerub.KrikthirTheGatewatcher -{ - struct SpellIds - { - // Krik'Thir The Gatewatcher - public const uint SubbossAggroTrigger = 52343; - public const uint Swarm = 52440; - public const uint MindFlay = 52586; - public const uint CurseOfFatigue = 52592; - public const uint Frenzy = 28747; - - // Watchers - Shared - public const uint WebWrap = 52086; - public const uint WebWrapWrapped = 52087; - public const uint InfectedBite = 52469; - - // Watcher Gashra - public const uint Enrage = 52470; - // Watcher Narjil - public const uint BlindingWebs = 52524; - // Watcher Silthik - public const uint PoisonSpray = 52493; - - // Anub'Ar Warrior - public const uint Cleave = 49806; - public const uint Strike = 52532; - - // Anub'Ar Skirmisher - public const uint Charge = 52538; - public const uint Backstab = 52540; - public const uint FixtateTrigger = 52536; - public const uint FixtateTriggered = 52537; - - // Anub'Ar Shadowcaster - public const uint ShadowBolt = 52534; - public const uint ShadowNova = 52535; - - // Skittering Infector - public const uint AcidSplash = 52446; - } - - struct Misc - { - public const uint DataPetGroup = 0; - - // Krik'thir the Gatewatcher - public const uint EventSendGroup = 1; - public const uint EventSwarm = 2; - public const uint EventMindFlay = 3; - public const uint EventFrenzy = 4; - } - - struct ActionIds - { - public const int GashraDied = 0; - public const int NarjilDied = 1; - public const int SilthikDied = 2; - public const int WatcherEngaged = 3; - public const int PetEngaged = 4; - public const int PetEvade = 5; - } - - struct TextIds - { - public const uint SayAggro = 0; - public const uint SaySlay = 1; - public const uint SayDeath = 2; - public const uint SaySwarm = 3; - public const uint SayPrefight = 4; - public const uint SaySendGroup = 5; - } - - [Script] - class boss_krik_thir : BossAI - { - public boss_krik_thir(Creature creature) : base(creature, ANDataTypes.KrikthirTheGatewatcher) { } - - void SummonAdds() - { - if (instance.GetBossState(ANDataTypes.KrikthirTheGatewatcher) == EncounterState.Done) - return; - - for (byte i = 1; i <= 3; ++i) - { - List summons; - me.SummonCreatureGroup(i, out summons); - - foreach (TempSummon summon in summons) - summon.GetAI().SetData(Misc.DataPetGroup, i); - } - } - - public override void Reset() - { - base.Reset(); - _hadFrenzy = false; - _petsInCombat = false; - _watchersActive = 0; - me.SetReactState(ReactStates.Passive); - } - - public override void InitializeAI() - { - base.InitializeAI(); - SummonAdds(); - } - - public override void JustAppeared() - { - base.JustAppeared(); - SummonAdds(); - } - - public override void KilledUnit(Unit victim) - { - if (victim.IsTypeId(TypeId.Player)) - Talk(TextIds.SaySlay); - } - - public override void JustDied(Unit killer) - { - summons.Clear(); - base.JustDied(killer); - Talk(TextIds.SayDeath); - } - - public override void EnterCombat(Unit who) - { - _petsInCombat = false; - me.SetReactState(ReactStates.Aggressive); - summons.DoZoneInCombat(); - - _events.CancelEvent(Misc.EventSendGroup); - _events.ScheduleEvent(Misc.EventSwarm, TimeSpan.FromSeconds(5)); - _events.ScheduleEvent(Misc.EventMindFlay, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(3)); - - base.EnterCombat(who); - } - - public override void MoveInLineOfSight(Unit who) - { - if (!me.HasReactState(ReactStates.Passive)) - { - base.MoveInLineOfSight(who); - return; - } - - if (me.CanStartAttack(who, false) && me.IsWithinDistInMap(who, me.GetAttackDistance(who) + me.m_CombatDistance)) - EnterCombat(who); - } - - public override void EnterEvadeMode(EvadeReason why) - { - summons.DespawnAll(); - _DespawnAtEvade(); - } - - public override void DoAction(int action) - { - switch (action) - { - case -ANInstanceMisc.ActionGatewatcherGreet: - if (instance.GetData(ANDataTypes.GatewatcherGreet) == 0 && me.IsAlive() && !me.IsInCombat() && !_petsInCombat) - { - instance.SetData(ANDataTypes.GatewatcherGreet, 1); - Talk(TextIds.SayPrefight); - } - break; - case ActionIds.GashraDied: - case ActionIds.NarjilDied: - case ActionIds.SilthikDied: - if (_watchersActive == 0) // something is wrong - { - EnterEvadeMode(EvadeReason.Other); - return; - } - if ((--_watchersActive) == 0) // if there are no watchers currently in combat... - _events.RescheduleEvent(Misc.EventSendGroup, TimeSpan.FromSeconds(5)); // ...send the next watcher after the targets sooner - break; - case ActionIds.WatcherEngaged: - ++_watchersActive; - break; - case ActionIds.PetEngaged: - if (_petsInCombat || me.IsInCombat()) - break; - _petsInCombat = true; - Talk(TextIds.SayAggro); - _events.ScheduleEvent(Misc.EventSendGroup, TimeSpan.FromSeconds(70)); - break; - case ActionIds.PetEvade: - EnterEvadeMode(EvadeReason.Other); - break; - } - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim() && !_petsInCombat) - return; - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - if (me.HealthBelowPct(10) && !_hadFrenzy) - { - _hadFrenzy = true; - _events.ScheduleEvent(Misc.EventFrenzy, TimeSpan.FromSeconds(1)); - } - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case Misc.EventSendGroup: - DoCastAOE(SpellIds.SubbossAggroTrigger, true); - _events.Repeat(TimeSpan.FromSeconds(70)); - break; - case Misc.EventSwarm: - DoCastAOE(SpellIds.Swarm); - Talk(TextIds.SaySwarm); - break; - case Misc.EventMindFlay: - DoCastVictim(SpellIds.MindFlay); - _events.Repeat(TimeSpan.FromSeconds(9), TimeSpan.FromSeconds(11)); - break; - case Misc.EventFrenzy: - DoCastSelf(SpellIds.Frenzy); - DoCastAOE(SpellIds.CurseOfFatigue); - _events.Repeat(TimeSpan.FromSeconds(15)); - break; - } - - if (me.HasUnitState(UnitState.Casting)) - return; - }); - - DoMeleeAttackIfReady(); - } - - public override void SpellHit(Unit whose, SpellInfo spell) - { - if (spell.Id == SpellIds.SubbossAggroTrigger) - DoZoneInCombat(); - } - - public override void SpellHitTarget(Unit who, SpellInfo spell) - { - if (spell.Id == SpellIds.SubbossAggroTrigger) - Talk(TextIds.SaySendGroup); - } - - bool _hadFrenzy; - bool _petsInCombat; - byte _watchersActive; - } - - class npc_gatewatcher_petAI : ScriptedAI - { - public npc_gatewatcher_petAI(Creature creature, bool isWatcher) : base(creature) - { - _instance = creature.GetInstanceScript(); - _isWatcher = isWatcher; - } - - public virtual void _EnterCombat() { } - - public override void EnterCombat(Unit who) - { - if (_isWatcher) - { - _isWatcher = false; - - TempSummon meSummon = me.ToTempSummon(); - if (meSummon) - { - Creature summoner = meSummon.GetSummonerCreatureBase(); - if (summoner) - summoner.GetAI().DoAction(ActionIds.WatcherEngaged); - } - } - - if (me.HasReactState(ReactStates.Passive)) - { - List others = new List(); - me.GetCreatureListWithEntryInGrid(others, 0, 40.0f); - foreach (Creature other in others) - { - if (other.GetAI().GetData(Misc.DataPetGroup) == _petGroup) - { - other.SetReactState(ReactStates.Aggressive); - other.GetAI().AttackStart(who); - } - } - - TempSummon meSummon = me.ToTempSummon(); - if (meSummon) - { - Creature summoner = meSummon.GetSummonerCreatureBase(); - if (summoner) - summoner.GetAI().DoAction(ActionIds.PetEngaged); - } - } - _EnterCombat(); - base.EnterCombat(who); - } - - public override void SetData(uint data, uint value) - { - if (data == Misc.DataPetGroup) - { - _petGroup = value; - me.SetReactState(_petGroup != 0 ? ReactStates.Passive : ReactStates.Aggressive); - } - } - - public override uint GetData(uint data) - { - if (data == Misc.DataPetGroup) - return _petGroup; - return 0; - } - - public override void MoveInLineOfSight(Unit who) - { - if (!me.HasReactState(ReactStates.Passive)) - { - base.MoveInLineOfSight(who); - return; - } - - if (me.CanStartAttack(who, false) && me.IsWithinDistInMap(who, me.GetAttackDistance(who) + me.m_CombatDistance)) - EnterCombat(who); - } - - public override void SpellHit(Unit whose, SpellInfo spell) - { - if (spell.Id == SpellIds.SubbossAggroTrigger) - DoZoneInCombat(); - } - - public override void EnterEvadeMode(EvadeReason why) - { - TempSummon meSummon = me.ToTempSummon(); - if (meSummon) - { - Creature summoner = meSummon.GetSummonerCreatureBase(); - if (summoner) - summoner.GetAI().DoAction(ActionIds.PetEvade); - else - me.DespawnOrUnsummon(); - return; - } - base.EnterEvadeMode(why); - } - - protected InstanceScript _instance; - uint _petGroup; - bool _isWatcher; - } - - [Script] - class npc_watcher_gashra : npc_gatewatcher_petAI - { - public npc_watcher_gashra(Creature creature) : base(creature, true) - { - me.SetReactState(ReactStates.Passive); - } - - public override void Reset() - { - _scheduler.CancelAll(); - } - - public override void _EnterCombat() - { - _scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting)); - - _scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(5), task => - { - DoCastSelf(SpellIds.Enrage); - task.Repeat(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(20)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(16), TimeSpan.FromSeconds(19), task => - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f); - if (target) - DoCast(target, SpellIds.WebWrap); - task.Repeat(TimeSpan.FromSeconds(13), TimeSpan.FromSeconds(19)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(11), task => - { - DoCastVictim(SpellIds.InfectedBite); - task.Repeat(TimeSpan.FromSeconds(23), TimeSpan.FromSeconds(27)); - }); - } - - public override void JustDied(Unit killer) - { - Creature krikthir = _instance.GetCreature(ANDataTypes.KrikthirTheGatewatcher); - if (krikthir && krikthir.IsAlive()) - krikthir.GetAI().DoAction(ActionIds.GashraDied); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - DoMeleeAttackIfReady(); - } - } - - [Script] - class npc_watcher_narjil : npc_gatewatcher_petAI - { - public npc_watcher_narjil(Creature creature) : base(creature, true) { } - - public override void Reset() - { - _scheduler.CancelAll(); - } - - public override void _EnterCombat() - { - _scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting)); - - _scheduler.Schedule(TimeSpan.FromSeconds(13), TimeSpan.FromSeconds(18), task => - { - DoCastVictim(SpellIds.BlindingWebs); - task.Repeat(TimeSpan.FromSeconds(23), TimeSpan.FromSeconds(27)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(5), task => - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100, true); - if (target) - DoCast(target, SpellIds.WebWrap); - task.Repeat(TimeSpan.FromSeconds(13), TimeSpan.FromSeconds(19)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(11), task => - { - DoCastVictim(SpellIds.InfectedBite); - task.Repeat(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(25)); - }); - } - - public override void JustDied(Unit killer) - { - Creature krikthir = _instance.GetCreature(ANDataTypes.KrikthirTheGatewatcher); - if (krikthir && krikthir.IsAlive()) - krikthir.GetAI().DoAction(ActionIds.NarjilDied); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - DoMeleeAttackIfReady(); - } - } - - [Script] - class npc_watcher_silthik : npc_gatewatcher_petAI - { - public npc_watcher_silthik(Creature creature) : base(creature, true) { } - - public override void Reset() - { - _scheduler.CancelAll(); - } - - public override void _EnterCombat() - { - _scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting)); - - _scheduler.Schedule(TimeSpan.FromSeconds(16), TimeSpan.FromSeconds(19), task => - { - DoCastVictim(SpellIds.PoisonSpray); - task.Repeat(TimeSpan.FromSeconds(13), TimeSpan.FromSeconds(19)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(11), task => - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100, true); - if (target) - DoCast(target, SpellIds.WebWrap); - task.Repeat(TimeSpan.FromSeconds(13), TimeSpan.FromSeconds(17)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(5), task => - { - DoCastVictim(SpellIds.InfectedBite); - task.Repeat(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(24)); - }); - } - - public override void JustDied(Unit killer) - { - Creature krikthir = _instance.GetCreature(ANDataTypes.KrikthirTheGatewatcher); - if (krikthir && krikthir.IsAlive()) - krikthir.GetAI().DoAction(ActionIds.SilthikDied); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - DoMeleeAttackIfReady(); - } - } - - [Script] - class npc_anub_ar_warrior : npc_gatewatcher_petAI - { - public npc_anub_ar_warrior(Creature creature) : base(creature, false) { } - - public override void Reset() - { - _scheduler.CancelAll(); - } - - public override void _EnterCombat() - { - _scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting)); - - _scheduler.Schedule(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(9), task => - { - DoCastVictim(SpellIds.Cleave); - task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(16)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10), task => - { - DoCastVictim(SpellIds.Strike); - task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(19)); - }); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - DoMeleeAttackIfReady(); - } - } - - [Script] - class npc_anub_ar_skirmisher : npc_gatewatcher_petAI - { - public npc_anub_ar_skirmisher(Creature creature) : base(creature, false) { } - - public override void Reset() - { - _scheduler.CancelAll(); - } - - public override void _EnterCombat() - { - _scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting)); - - _scheduler.Schedule(TimeSpan.FromSeconds(6), TimeSpan.FromSeconds(8), task => - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true); - if (target) - DoCast(target, SpellIds.Charge); - task.Repeat(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(25)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(9), task => - { - if (me.GetVictim() && me.GetVictim().IsInBack(me)) - DoCastVictim(SpellIds.Backstab); - task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(13)); - }); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - DoMeleeAttackIfReady(); - } - - public override void SpellHitTarget(Unit target, SpellInfo spell) - { - if (spell.Id == SpellIds.Charge && target) - DoCast(target, SpellIds.FixtateTrigger); - } - } - - [Script] - class npc_anub_ar_shadowcaster : npc_gatewatcher_petAI - { - public npc_anub_ar_shadowcaster(Creature creature) : base(creature, false) { } - - public override void Reset() - { - _scheduler.CancelAll(); - } - - public override void _EnterCombat() - { - _scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting)); - - _scheduler.Schedule(TimeSpan.FromSeconds(4), task => - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true); - if (target) - DoCast(target, SpellIds.ShadowBolt); - task.Repeat(TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(4)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(14), task => - { - DoCastVictim(SpellIds.ShadowNova); - task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(16)); - }); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - DoMeleeAttackIfReady(); - } - } - - [Script] - class npc_skittering_swarmer : ScriptedAI - { - public npc_skittering_swarmer(Creature creature) : base(creature) { } - - public override void InitializeAI() - { - base.InitializeAI(); - Creature gatewatcher = me.GetInstanceScript().GetCreature(ANDataTypes.KrikthirTheGatewatcher); - if (gatewatcher) - { - Unit target = gatewatcher.GetAttackerForHelper(); - if (target) - AttackStart(target); - gatewatcher.GetAI().JustSummoned(me); - } - } - } - - [Script] - class npc_skittering_infector : ScriptedAI - { - public npc_skittering_infector(Creature creature) : base(creature) { } - - public override void InitializeAI() - { - base.InitializeAI(); - Creature gatewatcher = me.GetInstanceScript().GetCreature(ANDataTypes.KrikthirTheGatewatcher); - if (gatewatcher) - { - Unit target = gatewatcher.GetAttackerForHelper(); - if (target) - AttackStart(target); - gatewatcher.GetAI().JustSummoned(me); - } - } - - public override void JustDied(Unit killer) - { - DoCastAOE(SpellIds.AcidSplash); - base.JustDied(killer); - } - } - - [Script] - class npc_gatewatcher_web_wrap : NullCreatureAI - { - public npc_gatewatcher_web_wrap(Creature creature) : base(creature) { } - - public override void JustDied(Unit killer) - { - TempSummon meSummon = me.ToTempSummon(); - if (meSummon) - { - Unit summoner = meSummon.GetSummoner(); - if (summoner) - summoner.RemoveAurasDueToSpell(SpellIds.WebWrapWrapped); - } - } - } - - [Script] - class spell_gatewatcher_subboss_trigger : SpellScript - { - void HandleTargets(List targetList) - { - // Remove any Watchers that are already in combat - for (var i = 0; i < targetList.Count; ++i) - { - Creature creature = targetList[i].ToCreature(); - if (creature) - if (creature.IsAlive() && !creature.IsInCombat()) - continue; - - targetList.RemoveAt(i); - } - - // Default to Krik'thir himself if he isn't engaged - WorldObject target = null; - if (GetCaster() && !GetCaster().IsInCombat()) - target = GetCaster(); - // Unless there are Watchers that aren't engaged yet - if (!targetList.Empty()) - { - // If there are, pick one of them at random - target = targetList.SelectRandom(); - } - // And hit only that one - targetList.Clear(); - if (target) - targetList.Add(target); - } - - public override void Register() - { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(HandleTargets, 0, Targets.UnitSrcAreaEntry)); - } - } - - [Script] - class spell_anub_ar_skirmisher_fixtate : SpellScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(SpellIds.FixtateTriggered); - } - - void HandleScript(uint effIndex) - { - Unit target = GetHitUnit(); - if (target) - target.CastSpell(GetCaster(), SpellIds.FixtateTriggered, true); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); - } - } - - [Script] - class spell_gatewatcher_web_wrap : AuraScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(SpellIds.WebWrapWrapped); - } - - void HandleEffectRemove(AuraEffect aurEff, AuraEffectHandleModes mode) - { - if (GetTargetApplication().GetRemoveMode() != AuraRemoveMode.Expire) - return; - - Unit target = GetTarget(); - if (target) - target.CastSpell(target, SpellIds.WebWrapWrapped, true); - } - - public override void Register() - { - OnEffectRemove.Add(new EffectApplyHandler(HandleEffectRemove, 0, AuraType.ModRoot, AuraEffectHandleModes.Real)); - } - } - - [Script] - class achievement_watch_him_die : AchievementCriteriaScript - { - public achievement_watch_him_die() : base("achievement_watch_him_die") { } - - public override bool OnCheck(Player player, Unit target) - { - if (!target) - return false; - - InstanceScript instance = target.GetInstanceScript(); - if (instance == null) - return false; - - foreach (uint watcherData in new[] { ANDataTypes.WatcherGashra, ANDataTypes.WatcherNarjil, ANDataTypes.WatcherSilthik }) - { - Creature watcher = instance.GetCreature(watcherData); - if (watcher) - if (watcher.IsAlive()) - continue; - return false; - } - - return true; - } - } -} diff --git a/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossNadronox.cs b/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossNadronox.cs deleted file mode 100644 index 360f6a383..000000000 --- a/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/BossNadronox.cs +++ /dev/null @@ -1,943 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Combat; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using Game.Spells; -using System; -using System.Collections.Generic; - -namespace Scripts.Northrend.AzjolNerub.AzjolNerub.Nadronox -{ - struct SpellIds - { - // Hadronox - public const uint WebFrontDoors = 53177; - public const uint WebSideDoors = 53185; - public const uint LeechPoison = 53030; - public const uint LeechPoisonHeal = 53800; - public const uint AcidCloud = 53400; - public const uint WebGrab = 57731; - public const uint PierceArmor = 53418; - - // Anub'Ar Opponent Summoning Spells - public const uint SummonChampionPeriodic = 53035; - public const uint SummonCryptFiendPeriodic = 53037; - public const uint SummonNecromancerPeriodic = 53036; - public const uint SummonChampionTop = 53064; - public const uint SummonCryptFiendTop = 53065; - public const uint SummonNecromancerTop = 53066; - public const uint SummonChampionBottom = 53090; - public const uint SummonCryptFiendBottom = 53091; - public const uint SummonNecromancerBottom = 53092; - - // Anub'Ar Crusher - public const uint Smash = 53318; - public const uint Frenzy = 53801; - - // Anub'Ar Foes - Shared - public const uint Taunt = 53798; - - // Anub'Ar Champion - public const uint Rend = 59343; - public const uint Pummel = 59344; - - // Anub'Ar Crypt Guard - public const uint CrushingWebs = 59347; - public const uint InfectedWound = 59348; - - // Anub'Ar Necromancer - public const uint ShadowBolt = 53333; - public const uint AnimateBones1 = 53334; - public const uint AnimateBones2 = 53336; - } - - enum SummonGroups - { - Crusher1 = 1, - Crusher2 = 2, - Crusher3 = 3 - } - - struct ActionIds - { - public const int HadronoxMove = 1; - public const int CrusherEngaged = 2; - public const int PackWalk = 3; - } - - struct Data - { - public const uint CrusherPackId = 1; - public const uint HadronoxEnteredCombat = 2; - public const uint HadronoxWebbedDoors = 3; - } - - struct CreatureIds - { - public const uint Crusher = 28922; - public const uint WorldtriggerLarge = 23472; - } - - struct TextIds - { - public const uint SayCrusherAggro = 1; - public const uint EmoteCrusherFrenzy = 2; - public const uint EmoteHadronoxMove = 1; - } - - // Movement IDs used by the permanently spawning Anub'ar opponents - they are done in sequence, as one finishes, the next one starts - enum MovementIds - { - None = 0, - Outside, - Downstairs, - Downstairs2, - Hadronox, // this one might have us take a detour to avoid pathfinding "through" the floor... - HadronoxReal // while this one will always make us movechase - } - - struct Misc - { - public static Position[] hadronoxStep = - { - new Position(515.5848f, 544.2007f, 673.6272f), - new Position(562.191f , 514.068f , 696.4448f), - new Position(610.3828f, 518.6407f, 695.9385f), - new Position(530.42f , 560.003f, 733.0308f) - }; - - public static Position[] crusherWaypoints = - { - new Position(529.6913f, 547.1257f, 731.9155f, 4.799650f), - new Position(517.51f , 561.439f , 734.0306f, 4.520403f), - new Position(543.414f , 551.728f , 732.0522f, 3.996804f) - }; - - public static Position[] championWaypoints = - { - new Position(539.2076f, 549.7539f, 732.8668f, 4.55531f), - new Position(527.3098f, 559.5197f, 732.9407f, 4.742493f), - new Position() - }; - - public static Position[] cryptFiendWaypoints = - { - new Position(520.3911f, 548.7895f, 732.0118f, 5.0091f), - new Position(), - new Position(550.9611f, 545.1674f, 731.9031f, 3.996804f) - }; - - public static Position[] necromancerWaypoints = - { - new Position(), - new Position(507.6937f, 563.3471f, 734.8986f, 4.520403f), - new Position(535.1049f, 552.8961f, 732.8441f, 3.996804f), - }; - - public static Position[] initialMoves = - { - new Position(485.314606f, 611.418640f, 771.428406f), - new Position(575.760437f, 611.516418f, 771.427368f), - new Position(588.930725f, 598.233276f, 739.142151f) - }; - - public static Position[] downstairsMoves = - { - new Position(513.574341f, 587.022156f, 736.229065f), - new Position(537.920410f, 580.436157f, 732.796692f), - new Position(601.289246f, 583.259644f, 725.443054f), - }; - - public static Position[] downstairsMoves2 = - { - new Position(571.498718f, 576.978333f, 727.582947f), - new Position(571.498718f, 576.978333f, 727.582947f), - new Position() - }; - } - - [Script] - class boss_hadronox : BossAI - { - public boss_hadronox(Creature creature) : base(creature, ANDataTypes.Hadronox) { } - - bool IsInCombatWithPlayer() - { - List refs = me.GetThreatManager().GetThreatList(); - foreach (HostileReference hostileRef in refs) - { - Unit target = hostileRef.GetTarget(); - if (target) - if (target.IsControlledByPlayer()) - return true; - } - return false; - } - - void SetStep(byte step) - { - if (_lastPlayerCombatState) - return; - - _step = step; - me.SetHomePosition(Misc.hadronoxStep[step]); - me.GetMotionMaster().Clear(); - me.AttackStop(); - SetCombatMovement(false); - me.GetMotionMaster().MovePoint(0, Misc.hadronoxStep[step]); - } - - void SummonCrusherPack(SummonGroups group) - { - List summoned; - me.SummonCreatureGroup((byte)group, out summoned); - foreach (TempSummon summon in summoned) - { - summon.GetAI().SetData(Data.CrusherPackId, (uint)group); - summon.GetAI().DoAction(ActionIds.PackWalk); - } - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - if (type != MovementGeneratorType.Point) - return; - SetCombatMovement(true); - AttackStart(me.GetVictim()); - if (_step < Misc.hadronoxStep.Length - 1) - return; - DoCastAOE(SpellIds.WebFrontDoors); - DoCastAOE(SpellIds.WebSideDoors); - _doorsWebbed = true; - DoZoneInCombat(); - } - - public override uint GetData(uint data) - { - if (data == Data.HadronoxEnteredCombat) - return _enteredCombat ? 1 : 0u; - if (data == Data.HadronoxWebbedDoors) - return _doorsWebbed ? 1 : 0u; - return 0; - } - - public override bool CanAIAttack(Unit target) - { - // Prevent Hadronox from going too far from her current home position - if (!target.IsControlledByPlayer() && target.GetDistance(me.GetHomePosition()) > 20.0f) - return false; - return base.CanAIAttack(target); - } - - public override void EnterCombat(Unit who) - { - _scheduler.CancelAll(); - _scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting)); - - _scheduler.Schedule(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(7), task => - { - DoCastAOE(SpellIds.LeechPoison); - task.Repeat(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(9)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(13), task => - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f); - if (target) - DoCast(target, SpellIds.AcidCloud); - task.Repeat(TimeSpan.FromSeconds(16), TimeSpan.FromSeconds(23)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(13), TimeSpan.FromSeconds(19), task => - { - DoCastAOE(SpellIds.WebGrab); - task.Repeat(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(25)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(7), task => - { - DoCastVictim(SpellIds.PierceArmor); - task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(1), task => - { - if (IsInCombatWithPlayer() != _lastPlayerCombatState) - { - _lastPlayerCombatState = !_lastPlayerCombatState; - if (_lastPlayerCombatState) // we are now in combat with players - { - if (!instance.CheckRequiredBosses(ANDataTypes.Hadronox)) - { - EnterEvadeMode(EvadeReason.SequenceBreak); - return; - } - // cancel current point movement if engaged by players - if (me.GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Point) - { - me.GetMotionMaster().Clear(); - SetCombatMovement(true); - AttackStart(me.GetVictim()); - } - } - else // we are no longer in combat with players - reset the encounter - EnterEvadeMode(EvadeReason.NoHostiles); - } - task.Repeat(TimeSpan.FromSeconds(1)); - }); - - me.SetActive(true); - } - - public override void DoAction(int action) - { - switch (action) - { - case ActionIds.CrusherEngaged: - if (_enteredCombat) - break; - instance.SetBossState(ANDataTypes.Hadronox, EncounterState.InProgress); - _enteredCombat = true; - SummonCrusherPack(SummonGroups.Crusher2); - SummonCrusherPack(SummonGroups.Crusher3); - break; - case ActionIds.HadronoxMove: - if (_step < Misc.hadronoxStep.Length - 1) - { - SetStep((byte)(_step + 1)); - Talk(TextIds.EmoteHadronoxMove); - } - break; - } - } - - public override void EnterEvadeMode(EvadeReason why) - { - List triggers = new List(); - me.GetCreatureListWithEntryInGrid(triggers, CreatureIds.WorldtriggerLarge); - foreach (Creature trigger in triggers) - { - if (trigger.HasAura(SpellIds.SummonChampionPeriodic) || trigger.HasAura(SpellIds.WebFrontDoors) || trigger.HasAura(SpellIds.WebSideDoors)) - _DespawnAtEvade(25, trigger); - } - _DespawnAtEvade(25); - summons.DespawnAll(); - foreach (ObjectGuid gNerubian in _anubar) - { - Creature nerubian = ObjectAccessor.GetCreature(me, gNerubian); - if (nerubian) - nerubian.DespawnOrUnsummon(); - } - } - - public override void SetGUID(ObjectGuid guid, int what) - { - _anubar.Add(guid); - } - - public void Initialize() - { - me.SetBoundingRadius(9.0f); - me.SetCombatReach(9.0f); - _enteredCombat = false; - _doorsWebbed = false; - _lastPlayerCombatState = false; - SetStep(0); - SetCombatMovement(true); - SummonCrusherPack(SummonGroups.Crusher1); - } - - public override void InitializeAI() - { - base.InitializeAI(); - if (me.IsAlive()) - Initialize(); - } - - public override void JustAppeared() - { - base.JustAppeared(); - Initialize(); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - DoMeleeAttackIfReady(); - } - - // Safeguard to prevent Hadronox dying to NPCs - public override void DamageTaken(Unit who, ref uint damage) - { - if (!who.IsControlledByPlayer() && me.HealthBelowPct(70)) - { - if (me.HealthBelowPctDamaged(5, damage)) - damage = 0; - else - damage *= (uint)((me.GetHealthPct() - 5.0f) / 65.0f); - } - } - - public override void JustSummoned(Creature summon) - { - summons.Summon(summon); - // Do not enter combat with zone - } - - bool _enteredCombat; // has a player entered combat with the first crusher pack? (talk and spawn two more packs) - bool _doorsWebbed; // obvious - have we reached the top and webbed the doors shut? (trigger for hadronox denied achievement) - bool _lastPlayerCombatState; // was there a player in our threat list the last time we checked (we check every second) - byte _step; - List _anubar = new List(); - } - - class npc_hadronox_crusherPackAI : ScriptedAI - { - public npc_hadronox_crusherPackAI(Creature creature, Position[] positions) : base(creature) - { - _instance = creature.GetInstanceScript(); - _positions = positions; - _myPack = 0; - _doFacing = false; - } - - public override void DoAction(int action) - { - if (action == ActionIds.PackWalk) - { - switch (_myPack) - { - case SummonGroups.Crusher1: - case SummonGroups.Crusher2: - case SummonGroups.Crusher3: - me.GetMotionMaster().MovePoint(ActionIds.PackWalk, _positions[_myPack - SummonGroups.Crusher1]); - break; - default: - break; - } - } - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - if (type == MovementGeneratorType.Point && id == ActionIds.PackWalk) - _doFacing = true; - } - - public override void EnterEvadeMode(EvadeReason why) - { - Creature hadronox = _instance.GetCreature(ANDataTypes.Hadronox); - if (hadronox) - hadronox.GetAI().EnterEvadeMode(EvadeReason.Other); - } - - public override uint GetData(uint data) - { - if (data == Data.CrusherPackId) - return (uint)_myPack; - return 0; - } - - public override void SetData(uint data, uint value) - { - if (data == Data.CrusherPackId) - { - _myPack = (SummonGroups)value; - me.SetReactState(_myPack != 0 ? ReactStates.Passive : ReactStates.Aggressive); - } - } - - public override void EnterCombat(Unit who) - { - if (me.HasReactState(ReactStates.Passive)) - { - List others = new List(); - me.GetCreatureListWithEntryInGrid(others, 0, 40.0f); - foreach (Creature other in others) - { - if (other.GetAI().GetData(Data.CrusherPackId) == (uint)_myPack) - { - other.SetReactState(ReactStates.Aggressive); - other.GetAI().AttackStart(who); - } - } - } - _EnterCombat(); - base.EnterCombat(who); - } - - public virtual void _EnterCombat() { } - - public override void MoveInLineOfSight(Unit who) - { - if (!me.HasReactState(ReactStates.Passive)) - { - base.MoveInLineOfSight(who); - return; - } - - if (me.CanStartAttack(who, false) && me.IsWithinDistInMap(who, me.GetAttackDistance(who) + me.m_CombatDistance)) - EnterCombat(who); - } - - public override void UpdateAI(uint diff) - { - if (_doFacing) - { - _doFacing = false; - me.SetFacingTo(_positions[_myPack - SummonGroups.Crusher1].GetOrientation()); - } - - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - DoMeleeAttackIfReady(); - } - - protected InstanceScript _instance; - Position[] _positions; - protected SummonGroups _myPack; - bool _doFacing; - } - - [Script] - class npc_anub_ar_crusher : npc_hadronox_crusherPackAI - { - public npc_anub_ar_crusher(Creature creature) : base(creature, Misc.crusherWaypoints) { } - - public override void _EnterCombat() - { - _scheduler.Schedule(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(12), task => - { - DoCastVictim(SpellIds.Smash); - task.Repeat(TimeSpan.FromSeconds(13), TimeSpan.FromSeconds(21)); - }); - - if (_myPack != SummonGroups.Crusher1) - return; - - Creature hadronox = _instance.GetCreature(ANDataTypes.Hadronox); - if (hadronox) - { - if (hadronox.GetAI().GetData(Data.HadronoxEnteredCombat) != 0) - return; - hadronox.GetAI().DoAction(ActionIds.CrusherEngaged); - } - - Talk(TextIds.SayCrusherAggro); - } - - public override void DamageTaken(Unit source, ref uint damage) - { - if (_hadFrenzy || !me.HealthBelowPctDamaged(25, damage)) - return; - _hadFrenzy = true; - Talk(TextIds.EmoteCrusherFrenzy); - DoCastSelf(SpellIds.Frenzy); - } - - public override void JustDied(Unit killer) - { - Creature hadronox = _instance.GetCreature(ANDataTypes.Hadronox); - if (hadronox) - hadronox.GetAI().DoAction(ActionIds.HadronoxMove); - base.JustDied(killer); - } - - bool _hadFrenzy; - } - - [Script] - class npc_anub_ar_crusher_champion : npc_hadronox_crusherPackAI - { - public npc_anub_ar_crusher_champion(Creature creature) : base(creature, Misc.championWaypoints) { } - - public override void _EnterCombat() - { - _scheduler.Schedule(TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(8), task => - { - DoCastVictim(SpellIds.Rend); - task.Repeat(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(16)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(19), task => - { - DoCastVictim(SpellIds.Pummel); - task.Repeat(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(17)); - }); - } - } - - [Script] - class npc_anub_ar_crusher_crypt_fiend : npc_hadronox_crusherPackAI - { - public npc_anub_ar_crusher_crypt_fiend(Creature creature) : base(creature, Misc.cryptFiendWaypoints) { } - - public override void _EnterCombat() - { - _scheduler.Schedule(TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(8), task => - { - DoCastVictim(SpellIds.CrushingWebs); - task.Repeat(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(16)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(19), task => - { - DoCastVictim(SpellIds.InfectedWound); - task.Repeat(TimeSpan.FromSeconds(16), TimeSpan.FromSeconds(25)); - }); - } - } - - [Script] - class npc_anub_ar_crusher_necromancer : npc_hadronox_crusherPackAI - { - public npc_anub_ar_crusher_necromancer(Creature creature) : base(creature, Misc.necromancerWaypoints) { } - - public override void _EnterCombat() - { - _scheduler.Schedule(TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(4), task => - { - DoCastVictim(SpellIds.ShadowBolt); - task.Repeat(TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(5)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(37), TimeSpan.FromSeconds(45), task => - { - DoCastVictim(RandomHelper.URand(0, 1) != 0 ? SpellIds.AnimateBones2 : SpellIds.AnimateBones1); - task.Repeat(TimeSpan.FromSeconds(35), TimeSpan.FromSeconds(50)); - }); - } - } - - class npc_hadronox_foeAI : ScriptedAI - { - public npc_hadronox_foeAI(Creature creature) : base(creature) - { - _instance = creature.GetInstanceScript(); - _nextMovement = MovementIds.Outside; - _mySpawn = 0; - } - - public override void InitializeAI() - { - base.InitializeAI(); - Creature hadronox = _instance.GetCreature(ANDataTypes.Hadronox); - if (hadronox) - hadronox.GetAI().SetGUID(me.GetGUID()); - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - if (type == MovementGeneratorType.Point) - _nextMovement = (MovementIds)(id + 1); - } - - public override void EnterEvadeMode(EvadeReason why) - { - me.DespawnOrUnsummon(); - } - - public override void UpdateAI(uint diff) - { - if (_nextMovement != 0) - { - switch (_nextMovement) - { - case MovementIds.Outside: - { - float dist = float.PositiveInfinity; - for (byte spawn = 0; spawn < Misc.initialMoves.Length; ++spawn) - { - float thisDist = Misc.initialMoves[spawn].GetExactDistSq(me); - if (thisDist < dist) - { - _mySpawn = spawn; - dist = thisDist; - } - } - me.GetMotionMaster().MovePoint((uint)MovementIds.Outside, Misc.initialMoves[_mySpawn], false); // do not pathfind here, we have to pass through a "wall" of webbing - break; - } - case MovementIds.Downstairs: - me.GetMotionMaster().MovePoint((uint)MovementIds.Downstairs, Misc.downstairsMoves[_mySpawn]); - break; - case MovementIds.Downstairs2: - if (Misc.downstairsMoves2[_mySpawn].GetPositionX() > 0.0f) // might be unset for this spawn - if yes, skip - { - me.GetMotionMaster().MovePoint((uint)MovementIds.Downstairs2, Misc.downstairsMoves2[_mySpawn]); - break; - } - goto case MovementIds.Hadronox; - // intentional missing break - case MovementIds.Hadronox: - case MovementIds.HadronoxReal: - { - float zCutoff = 702.0f; - Creature hadronox = _instance.GetCreature(ANDataTypes.Hadronox); - if (hadronox && hadronox.IsAlive()) - { - if (_nextMovement != MovementIds.HadronoxReal) - { - if (hadronox.GetPositionZ() < zCutoff) - { - me.GetMotionMaster().MovePoint((uint)MovementIds.Hadronox, Misc.hadronoxStep[2]); - break; - } - } - AttackStart(hadronox); - } - break; - } - default: - break; - } - _nextMovement = MovementIds.None; - } - - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - DoMeleeAttackIfReady(); - } - - InstanceScript _instance; - - MovementIds _nextMovement; - byte _mySpawn; - } - - [Script] - class npc_anub_ar_champion : npc_hadronox_foeAI - { - public npc_anub_ar_champion(Creature creature) : base(creature) { } - - public override void EnterCombat(Unit who) - { - _scheduler.Schedule(TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(8), task => - { - DoCastVictim(SpellIds.Rend); - task.Repeat(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(16)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(19), task => - { - DoCastVictim(SpellIds.Pummel); - task.Repeat(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(17)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(50), task => - { - DoCastVictim(SpellIds.Taunt); - task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(50)); - }); - } - } - - [Script] - class npc_anub_ar_crypt_fiend : npc_hadronox_foeAI - { - public npc_anub_ar_crypt_fiend(Creature creature) : base(creature) { } - - public override void EnterCombat(Unit who) - { - _scheduler.Schedule(TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(8), task => - { - DoCastVictim(SpellIds.CrushingWebs); - task.Repeat(TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(16)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(19), task => - { - DoCastVictim(SpellIds.InfectedWound); - task.Repeat(TimeSpan.FromSeconds(16), TimeSpan.FromSeconds(25)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(50), task => - { - DoCastVictim(SpellIds.Taunt); - task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(50)); - }); - } - } - - [Script] - class npc_anub_ar_necromancer : npc_hadronox_foeAI - { - public npc_anub_ar_necromancer(Creature creature) : base(creature) { } - - public override void EnterCombat(Unit who) - { - _scheduler.Schedule(TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(4), task => - { - DoCastVictim(SpellIds.ShadowBolt); - task.Repeat(TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(5)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(37), TimeSpan.FromSeconds(45), task => - { - DoCastVictim(RandomHelper.URand(0, 1) != 0 ? SpellIds.AnimateBones2 : SpellIds.AnimateBones1); - task.Repeat(TimeSpan.FromSeconds(35), TimeSpan.FromSeconds(50)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(50), task => - { - DoCastVictim(SpellIds.Taunt); - task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(50)); - }); - } - } - - [Script("spell_hadronox_periodic_summon_champion", SpellIds.SummonChampionTop, SpellIds.SummonChampionBottom)] - [Script("spell_hadronox_periodic_summon_crypt_fiend", SpellIds.SummonCryptFiendTop, SpellIds.SummonCryptFiendBottom)] - [Script("spell_hadronox_periodic_summon_necromancer", SpellIds.SummonNecromancerTop, SpellIds.SummonNecromancerBottom)] - class spell_hadronox_periodic_summon_template : AuraScript - { - public spell_hadronox_periodic_summon_template(uint topSpellId, uint bottomSpellId) - { - _topSpellId = topSpellId; - _bottomSpellId = bottomSpellId; - } - - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(_topSpellId, _bottomSpellId); - } - - void HandleApply(AuraEffect eff, AuraEffectHandleModes mode) - { - AuraEffect effect = GetAura().GetEffect(0); - if (effect != null) - effect.SetPeriodicTimer(RandomHelper.IRand(2, 17) * Time.InMilliseconds); - } - - void HandlePeriodic(AuraEffect eff) - { - Unit caster = GetCaster(); - if (!caster) - return; - InstanceScript instance = caster.GetInstanceScript(); - if (instance == null) - return; - if (instance.GetBossState(ANDataTypes.Hadronox) == EncounterState.Done) - GetAura().Remove(); - else - { - if (caster.GetPositionZ() >= 750.0f) - caster.CastSpell(caster, _topSpellId, true); - else - caster.CastSpell(caster, _bottomSpellId, true); - } - } - - public override void Register() - { - AfterEffectApply.Add(new EffectApplyHandler(HandleApply, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.Real)); - OnEffectPeriodic.Add(new EffectPeriodicHandler(HandlePeriodic, 0, AuraType.PeriodicDummy)); - } - - uint _topSpellId; - uint _bottomSpellId; - } - - [Script] - class spell_hadronox_leeching_poison : AuraScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(SpellIds.LeechPoisonHeal); - } - - void HandleEffectRemove(AuraEffect aurEff, AuraEffectHandleModes mode) - { - if (GetTargetApplication().GetRemoveMode() != AuraRemoveMode.Death) - return; - - if (GetTarget().IsGuardian()) - return; - - Unit caster = GetCaster(); - if (caster) - caster.CastSpell(caster, SpellIds.LeechPoisonHeal, true); - } - - public override void Register() - { - OnEffectRemove.Add(new EffectApplyHandler(HandleEffectRemove, 0, AuraType.PeriodicLeech, AuraEffectHandleModes.Real)); - } - } - - [Script] - class spell_hadronox_web_doors : SpellScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(SpellIds.SummonChampionPeriodic, SpellIds.SummonCryptFiendPeriodic, SpellIds.SummonNecromancerPeriodic); - } - - void HandleDummy(uint effIndex) - { - Unit target = GetHitUnit(); - if (target) - { - target.RemoveAurasDueToSpell(SpellIds.SummonChampionPeriodic); - target.RemoveAurasDueToSpell(SpellIds.SummonCryptFiendPeriodic); - target.RemoveAurasDueToSpell(SpellIds.SummonNecromancerPeriodic); - } - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.ApplyAura)); - } - } - - [Script] - class achievement_hadronox_denied : AchievementCriteriaScript - { - public achievement_hadronox_denied() : base("achievement_hadronox_denied") { } - - public override bool OnCheck(Player player, Unit target) - { - if (!target) - return false; - - Creature cTarget = target.ToCreature(); - if (cTarget) - if (cTarget.GetAI().GetData(Data.HadronoxWebbedDoors) == 0) - return true; - - return false; - } - } -} \ No newline at end of file diff --git a/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/InstanceAzjolNerub.cs b/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/InstanceAzjolNerub.cs deleted file mode 100644 index 2a3324b03..000000000 --- a/Source/Scripts/Northrend/AzjolNerub/AzjolNerub/InstanceAzjolNerub.cs +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.Entities; -using Game.Maps; -using Game.Scripting; - -namespace Scripts.Northrend.AzjolNerub.AzjolNerub -{ - struct ANDataTypes - { - // Encounter States/Boss Guids - public const uint KrikthirTheGatewatcher = 0; - public const uint Hadronox = 1; - public const uint Anubarak = 2; - - // Additional Data - public const uint WatcherNarjil = 3; - public const uint WatcherGashra = 4; - public const uint WatcherSilthik = 5; - public const uint AnubarakWall = 6; - public const uint AnubarakWall2 = 7; - public const uint GatewatcherGreet = 8; - } - - struct ANCreatureIds - { - public const uint Krikthir = 28684; - public const uint Hadronox = 28921; - public const uint Anubarak = 29120; - - public const uint WatcherNarjil = 28729; - public const uint WatcherGashra = 28730; - public const uint WatcherSilthik = 28731; - } - - struct ANGameObjectIds - { - public const uint KrikthirDoor = 192395; - public const uint AnubarakDoor1 = 192396; - public const uint AnubarakDoor2 = 192397; - public const uint AnubarakDoor3 = 192398; - } - - // These are passed as -action to AI's DoAction to differentiate between them and boss scripts' own actions - struct ANInstanceMisc - { - public const string DataHeader = "AN"; - public const uint EncounterCount = 3; - - public const int ActionGatewatcherGreet = 1; - - public static DoorData[] doorData = - { - new DoorData(ANGameObjectIds.KrikthirDoor, ANDataTypes.KrikthirTheGatewatcher, DoorType.Passage), - new DoorData(ANGameObjectIds.AnubarakDoor1, ANDataTypes.Anubarak, DoorType.Room ), - new DoorData(ANGameObjectIds.AnubarakDoor2, ANDataTypes.Anubarak, DoorType.Room ), - new DoorData(ANGameObjectIds.AnubarakDoor3, ANDataTypes.Anubarak, DoorType.Room ) - }; - - public static ObjectData[] creatureData = - { - new ObjectData(ANCreatureIds.Krikthir, ANDataTypes.KrikthirTheGatewatcher ), - new ObjectData(ANCreatureIds.Hadronox, ANDataTypes.Hadronox ), - new ObjectData(ANCreatureIds.Anubarak, ANDataTypes.Anubarak ), - new ObjectData(ANCreatureIds.WatcherNarjil, ANDataTypes.WatcherGashra ), - new ObjectData(ANCreatureIds.WatcherGashra, ANDataTypes.WatcherSilthik ), - new ObjectData(ANCreatureIds.WatcherSilthik, ANDataTypes.WatcherNarjil ) - }; - - public static ObjectData[] gameobjectData = - { - new ObjectData(ANGameObjectIds.AnubarakDoor1, ANDataTypes.AnubarakWall), - new ObjectData(ANGameObjectIds.AnubarakDoor3, ANDataTypes.AnubarakWall2) - }; - - public static BossBoundaryEntry[] boundaries = - { - new BossBoundaryEntry(ANDataTypes.KrikthirTheGatewatcher, new RectangleBoundary(400.0f, 580.0f, 623.5f, 810.0f)), - new BossBoundaryEntry(ANDataTypes.Hadronox, new ZRangeBoundary(666.0f, 776.0f)), - new BossBoundaryEntry(ANDataTypes.Anubarak, new CircleBoundary(new Position(550.6178f, 253.5917f), 26.0f)) - }; - } - - [Script] - class instance_azjol_nerub : InstanceMapScript - { - public instance_azjol_nerub() : base(nameof(instance_azjol_nerub), 601) { } - - class instance_azjol_nerub_InstanceScript : InstanceScript - { - uint _gateWatcherGreet; - - public instance_azjol_nerub_InstanceScript(InstanceMap map) : base(map) - { - SetHeaders(ANInstanceMisc.DataHeader); - SetBossNumber(ANInstanceMisc.EncounterCount); - LoadBossBoundaries(ANInstanceMisc.boundaries); - LoadDoorData(ANInstanceMisc.doorData); - LoadObjectData(ANInstanceMisc.creatureData, ANInstanceMisc.gameobjectData); - } - - public override void OnUnitDeath(Unit who) - { - base.OnUnitDeath(who); - Creature creature = who.ToCreature(); - if (!creature || creature.IsCritter() || creature.IsControlledByPlayer()) - return; - - Creature gatewatcher = GetCreature(ANDataTypes.KrikthirTheGatewatcher); - if (gatewatcher) - gatewatcher.GetAI().DoAction(-ANInstanceMisc.ActionGatewatcherGreet); - } - - public override bool CheckRequiredBosses(uint bossId, Player player) - { - if (_SkipCheckRequiredBosses(player)) - return true; - - if (bossId > ANDataTypes.KrikthirTheGatewatcher && GetBossState(ANDataTypes.KrikthirTheGatewatcher) != EncounterState.Done) - return false; - - return true; - } - - public override uint GetData(uint dataId) - { - switch (dataId) - { - case ANDataTypes.GatewatcherGreet: - return _gateWatcherGreet; - default: - return 0; - } - } - - public override void SetData(uint dataId, uint value) - { - switch (dataId) - { - case ANDataTypes.GatewatcherGreet: - _gateWatcherGreet = value; - break; - default: - break; - } - } - } - - public override InstanceScript GetInstanceScript(InstanceMap map) - { - return new instance_azjol_nerub_InstanceScript(map); - } - } -} diff --git a/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/GrandChampions.cs b/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/GrandChampions.cs deleted file mode 100644 index 776b2889b..000000000 --- a/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/GrandChampions.cs +++ /dev/null @@ -1,650 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Framework.Dynamic; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using System; -using System.Collections.Generic; - -namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheChampion -{ - struct TrialOfChampionSpells - { - //Vehicle - public const uint CHARGE = 63010; - public const uint SHIELD_BREAKER = 68504; - public const uint SHIELD = 66482; - - // Marshal Jacob Alerius && Mokra the Skullcrusher || Warrior - public const uint MORTAL_STRIKE = 68783; - public const uint MORTAL_STRIKE_H = 68784; - public const uint BLADESTORM = 63784; - public const uint INTERCEPT = 67540; - public const uint ROLLING_THROW = 47115; //not implemented in the AI yet... - - // Ambrose Boltspark && Eressea Dawnsinger || Mage - public const uint FIREBALL = 66042; - public const uint FIREBALL_H = 68310; - public const uint BLAST_WAVE = 66044; - public const uint BLAST_WAVE_H = 68312; - public const uint HASTE = 66045; - public const uint POLYMORPH = 66043; - public const uint POLYMORPH_H = 68311; - - // Colosos && Runok Wildmane || Shaman - public const uint CHAIN_LIGHTNING = 67529; - public const uint CHAIN_LIGHTNING_H = 68319; - public const uint EARTH_SHIELD = 67530; - public const uint HEALING_WAVE = 67528; - public const uint HEALING_WAVE_H = 68318; - public const uint HEX_OF_MENDING = 67534; - - // Jaelyne Evensong && Zul'tore || Hunter - public const uint DISENGAGE = 68340; //not implemented in the AI yet... - public const uint LIGHTNING_ARROWS = 66083; - public const uint MULTI_SHOT = 66081; - public const uint SHOOT = 65868; - public const uint SHOOT_H = 67988; - - // Lana Stouthammer Evensong && Deathstalker Visceri || Rouge - public const uint EVISCERATE = 67709; - public const uint EVISCERATE_H = 68317; - public const uint FAN_OF_KNIVES = 67706; - public const uint POISON_BOTTLE = 67701; - } - - [Script] - class generic_vehicleAI_toc5 : EscortAI - { - public generic_vehicleAI_toc5(Creature creature) : base(creature) - { - Initialize(); - SetDespawnAtEnd(false); - uiWaypointPath = 0; - - instance = creature.GetInstanceScript(); - } - - void Initialize() - { - uiChargeTimer = 5000; - uiShieldBreakerTimer = 8000; - uiBuffTimer = RandomHelper.URand(30000, 60000); - } - - public override void Reset() - { - Initialize(); - } - - public override void SetData(uint uiType, uint uiData) - { - switch (uiType) - { - case 1: - AddWaypoint(0, 747.36f, 634.07f, 411.572f); - AddWaypoint(1, 780.43f, 607.15f, 411.82f); - AddWaypoint(2, 785.99f, 599.41f, 411.92f); - AddWaypoint(3, 778.44f, 601.64f, 411.79f); - uiWaypointPath = 1; - break; - case 2: - AddWaypoint(0, 747.35f, 634.07f, 411.57f); - AddWaypoint(1, 768.72f, 581.01f, 411.92f); - AddWaypoint(2, 763.55f, 590.52f, 411.71f); - uiWaypointPath = 2; - break; - case 3: - AddWaypoint(0, 747.35f, 634.07f, 411.57f); - AddWaypoint(1, 784.02f, 645.33f, 412.39f); - AddWaypoint(2, 775.67f, 641.91f, 411.91f); - uiWaypointPath = 3; - break; - } - - if (uiType <= 3) - Start(false, true); - } - - public override void WaypointReached(uint waypointId, uint pathId) - { - switch (waypointId) - { - case 2: - if (uiWaypointPath == 3 || uiWaypointPath == 2) - instance.SetData((uint)Data.DATA_MOVEMENT_DONE, instance.GetData((uint)Data.DATA_MOVEMENT_DONE) + 1); - break; - case 3: - instance.SetData((uint)Data.DATA_MOVEMENT_DONE, instance.GetData((uint)Data.DATA_MOVEMENT_DONE) + 1); - break; - } - } - - public override void EnterCombat(Unit who) - { - DoCastSpellShield(); - } - - void DoCastSpellShield() - { - for (byte i = 0; i < 3; ++i) - DoCast(me, TrialOfChampionSpells.SHIELD, true); - } - - public override void UpdateAI(uint uiDiff) - { - base.UpdateAI(uiDiff); - - if (!UpdateVictim()) - return; - - if (uiBuffTimer <= uiDiff) - { - if (!me.HasAura(TrialOfChampionSpells.SHIELD)) - DoCastSpellShield(); - - uiBuffTimer = RandomHelper.URand(30000, 45000); - } - else - uiBuffTimer -= uiDiff; - - if (uiChargeTimer <= uiDiff) - { - var players = me.GetMap().GetPlayers(); - if (!players.Empty()) - { - foreach (var player in players) - { - if (player && !player.IsGameMaster() && me.IsInRange(player, 8.0f, 25.0f, false)) - { - ResetThreatList(); - AddThreat(player, 1.0f); - DoCast(player, TrialOfChampionSpells.CHARGE); - break; - } - } - } - uiChargeTimer = 5000; - } - else - uiChargeTimer -= uiDiff; - - //dosen't work at all - if (uiShieldBreakerTimer <= uiDiff) - { - Vehicle pVehicle = me.GetVehicleKit(); - if (!pVehicle) - return; - - Unit pPassenger = pVehicle.GetPassenger(0); - if (pPassenger) - { - var players = me.GetMap().GetPlayers(); - if (!players.Empty()) - { - foreach (var player in players) - { - if (player && !player.IsGameMaster() && me.IsInRange(player, 10.0f, 30.0f, false)) - { - pPassenger.CastSpell(player, TrialOfChampionSpells.SHIELD_BREAKER, true); - break; - } - } - } - } - uiShieldBreakerTimer = 7000; - } - else - uiShieldBreakerTimer -= uiDiff; - - DoMeleeAttackIfReady(); - } - - InstanceScript instance; - - uint uiChargeTimer; - uint uiShieldBreakerTimer; - uint uiBuffTimer; - - uint uiWaypointPath; - } - - abstract class boss_basic_toc5AI : ScriptedAI - { - protected boss_basic_toc5AI(Creature creature) : base(creature) - { - Initialize(); - instance = creature.GetInstanceScript(); - - bDone = false; - bHome = false; - - uiPhase = 0; - uiPhaseTimer = 0; - - me.SetReactState(ReactStates.Passive); - // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED - me.AddUnitFlag(UnitFlags.NonAttackable | UnitFlags.ImmuneToPc); - } - - public abstract void Initialize(); - - public override void Reset() - { - Initialize(); - } - - public override void JustReachedHome() - { - base.JustReachedHome(); - - if (!bHome) - return; - - uiPhaseTimer = 15000; - uiPhase = 1; - - bHome = false; - } - - public override void JustDied(Unit killer) - { - instance.SetData((uint)Data.BOSS_GRAND_CHAMPIONS, (uint)EncounterState.Done); - } - - public override void UpdateAI(uint diff) - { - if (!bDone && GrandChampionsOutVehicle(me)) - { - bDone = true; - - if (me.GetGUID() == instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_1)) - me.SetHomePosition(739.678f, 662.541f, 412.393f, 4.49f); - else if (me.GetGUID() == instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_2)) - me.SetHomePosition(746.71f, 661.02f, 411.69f, 4.6f); - else if (me.GetGUID() == instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_3)) - me.SetHomePosition(754.34f, 660.70f, 412.39f, 4.79f); - - EnterEvadeMode(); - bHome = true; - } - - if (uiPhaseTimer <= diff) - { - if (uiPhase == 1) - { - AggroAllPlayers(me); - uiPhase = 0; - } - } - else - uiPhaseTimer -= diff; - } - - public bool InVehicle() - { - return !me.m_movementInfo.transport.guid.IsEmpty(); - } - - void AggroAllPlayers(Creature temp) - { - var PlList = temp.GetMap().GetPlayers(); - - if (PlList.Empty()) - return; - - foreach (var player in PlList) - { - if (player) - { - if (player.IsGameMaster()) - continue; - - if (player.IsAlive()) - { - temp.RemoveUnitFlag(UnitFlags.NonAttackable | UnitFlags.ImmuneToPc); - temp.SetReactState(ReactStates.Aggressive); - temp.SetInCombatWith(player); - player.SetInCombatWith(temp); - temp.GetThreatManager().AddThreat(player, 0.0f); - } - } - } - } - - bool GrandChampionsOutVehicle(Creature creature) - { - InstanceScript instance = creature.GetInstanceScript(); - - if (instance == null) - return false; - - Creature pGrandChampion1 = ObjectAccessor.GetCreature(creature, instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_1)); - Creature pGrandChampion2 = ObjectAccessor.GetCreature(creature, instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_2)); - Creature pGrandChampion3 = ObjectAccessor.GetCreature(creature, instance.GetGuidData((uint)Data64.DATA_GRAND_CHAMPION_3)); - - if (pGrandChampion1 && pGrandChampion2 && pGrandChampion3) - { - if (pGrandChampion1.m_movementInfo.transport.guid.IsEmpty() && - pGrandChampion2.m_movementInfo.transport.guid.IsEmpty() && - pGrandChampion3.m_movementInfo.transport.guid.IsEmpty()) - return true; - } - - return false; - } - - public TaskScheduler NonCombatEvents = new TaskScheduler(); - - public InstanceScript instance; - - public byte uiPhase; - public uint uiPhaseTimer; - - bool bDone; - public bool bHome; - } - - [Script] - // Marshal Jacob Alerius && Mokra the Skullcrusher || Warrior - class boss_warrior_toc5 : boss_basic_toc5AI - { - public boss_warrior_toc5(Creature creature) : base(creature) { } - - public override void Initialize() - { - _scheduler.Schedule(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(20), task => - { - DoCastVictim(TrialOfChampionSpells.BLADESTORM); - task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(20)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(7), task => - { - var players = me.GetMap().GetPlayers(); - if (!players.Empty()) - { - foreach (var player in players) - { - if (player && !player.IsGameMaster() && me.IsInRange(player, 8.0f, 25.0f, false)) - { - ResetThreatList(); - AddThreat(player, 5.0f); - DoCast(player, TrialOfChampionSpells.INTERCEPT); - break; - } - } - } - task.Repeat(TimeSpan.FromSeconds(7)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(12), task => - { - DoCastVictim(TrialOfChampionSpells.MORTAL_STRIKE); - task.Repeat(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(12)); - }); - } - - public override void UpdateAI(uint diff) - { - base.UpdateAI(diff); - - if (!UpdateVictim() || InVehicle()) - return; - - _scheduler.Update(diff); - - DoMeleeAttackIfReady(); - } - - } - - [Script] - // Ambrose Boltspark && Eressea Dawnsinger || Mage - class boss_mage_toc5 : boss_basic_toc5AI - { - public boss_mage_toc5(Creature creature) : base(creature) { } - - public override void Initialize() - { - _scheduler.Schedule(TimeSpan.FromSeconds(5), task => - { - DoCastVictim(TrialOfChampionSpells.FIREBALL); - task.Repeat(TimeSpan.FromSeconds(5)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(8), task => - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0); - if (target) - DoCast(target, TrialOfChampionSpells.POLYMORPH); - task.Repeat(TimeSpan.FromSeconds(8)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(12), task => - { - DoCastAOE(TrialOfChampionSpells.BLAST_WAVE, false); - task.Repeat(TimeSpan.FromSeconds(13)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(22), task => - { - me.InterruptNonMeleeSpells(true); - - DoCast(me, TrialOfChampionSpells.HASTE); - task.Repeat(TimeSpan.FromSeconds(22)); - }); - } - - public override void UpdateAI(uint diff) - { - base.UpdateAI(diff); - - if (!UpdateVictim() || InVehicle()) - return; - - _scheduler.Update(diff); - - DoMeleeAttackIfReady(); - } - } - - [Script] - // Colosos && Runok Wildmane || Shaman - class boss_shaman_toc5 : boss_basic_toc5AI - { - public boss_shaman_toc5(Creature creature) : base(creature) { } - - public override void Initialize() - { - _scheduler.Schedule(TimeSpan.FromSeconds(16), task => - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0); - if (target) - DoCast(target, TrialOfChampionSpells.CHAIN_LIGHTNING); - - task.Repeat(TimeSpan.FromSeconds(16)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(12), task => - { - bool bChance = RandomHelper.randChance(50); - - if (!bChance) - { - Unit pFriend = DoSelectLowestHpFriendly(40); - if (pFriend) - DoCast(pFriend, TrialOfChampionSpells.HEALING_WAVE); - } - else - DoCast(me, TrialOfChampionSpells.HEALING_WAVE); - - task.Repeat(TimeSpan.FromSeconds(12)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35), task => - { - DoCast(me, TrialOfChampionSpells.EARTH_SHIELD); - task.Repeat(TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(25), task => - { - DoCastVictim(TrialOfChampionSpells.HEX_OF_MENDING, true); - task.Repeat(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(25)); - }); - } - - public override void EnterCombat(Unit who) - { - DoCast(me, TrialOfChampionSpells.EARTH_SHIELD); - DoCast(who, TrialOfChampionSpells.HEX_OF_MENDING); - } - - public override void UpdateAI(uint diff) - { - base.UpdateAI(diff); - - if (!UpdateVictim() || InVehicle()) - return; - - _scheduler.Update(diff); - - DoMeleeAttackIfReady(); - } - } - - [Script] - // Jaelyne Evensong && Zul'tore || Hunter - class boss_hunter_toc5 : boss_basic_toc5AI - { - public boss_hunter_toc5(Creature creature) : base(creature) { } - - public override void Initialize() - { - _scheduler.Schedule(TimeSpan.FromSeconds(7), task => - { - DoCastAOE(TrialOfChampionSpells.LIGHTNING_ARROWS, false); - task.Repeat(TimeSpan.FromSeconds(7)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(12), task => - { - ObjectGuid uiTargetGUID = ObjectGuid.Empty; - Unit target = SelectTarget(SelectAggroTarget.MaxDistance, 0, 30.0f); - if (target) - { - uiTargetGUID = target.GetGUID(); - DoCast(target, TrialOfChampionSpells.SHOOT); - } - - bool bShoot = true; - task.Repeat(TimeSpan.FromSeconds(12)); - task.Schedule(TimeSpan.FromSeconds(3), task1 => - { - if (bShoot) - { - me.InterruptNonMeleeSpells(true); - - Unit uiTarget = Global.ObjAccessor.GetUnit(me, uiTargetGUID); - if (uiTarget && me.IsInRange(uiTarget, 5.0f, 30.0f, false)) - { - DoCast(uiTarget, TrialOfChampionSpells.MULTI_SHOT); - } - else - { - var players = me.GetMap().GetPlayers(); - if (!players.Empty()) - { - foreach (var player in players) - { - if (player && !player.IsGameMaster() && me.IsInRange(player, 5.0f, 30.0f, false)) - { - DoCast(player, TrialOfChampionSpells.MULTI_SHOT); - break; - } - } - } - } - bShoot = false; - } - }); - }); - } - - public override void UpdateAI(uint diff) - { - base.UpdateAI(diff); - - if (!UpdateVictim() || InVehicle()) - return; - - _scheduler.Update(diff); - - DoMeleeAttackIfReady(); - } - } - - [Script] - // Lana Stouthammer Evensong && Deathstalker Visceri || Rouge - class boss_rouge_toc5 : boss_basic_toc5AI - { - public boss_rouge_toc5(Creature creature) : base(creature) { } - - public override void Initialize() - { - _scheduler.Schedule(TimeSpan.FromSeconds(8), task => - { - DoCastVictim(TrialOfChampionSpells.EVISCERATE); - - task.Repeat(TimeSpan.FromSeconds(8)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(14), task => - { - DoCastAOE(TrialOfChampionSpells.FAN_OF_KNIVES, false); - - task.Repeat(TimeSpan.FromSeconds(14)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(19), task => - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0); - if (target) - DoCast(target, TrialOfChampionSpells.POISON_BOTTLE); - - task.Repeat(TimeSpan.FromSeconds(19)); - }); - } - - public override void UpdateAI(uint diff) - { - base.UpdateAI(diff); - - if (!UpdateVictim() || !me.m_movementInfo.transport.guid.IsEmpty()) - return; - - _scheduler.Update(diff); - - DoMeleeAttackIfReady(); - } - } -} \ No newline at end of file diff --git a/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/InstanceTrialOfTheChampion.cs b/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/InstanceTrialOfTheChampion.cs deleted file mode 100644 index 6afa4e482..000000000 --- a/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/InstanceTrialOfTheChampion.cs +++ /dev/null @@ -1,334 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Framework.GameMath; -using Framework.IO; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheChampion -{ - [Script] - class instance_trial_of_the_champion : InstanceMapScript - { - public instance_trial_of_the_champion() : base("instance_trial_of_the_champion", 650) { } - - class instance_trial_of_the_champion_InstanceMapScript : InstanceScript - { - public instance_trial_of_the_champion_InstanceMapScript(InstanceMap map) : base(map) - { - SetHeaders("TC"); - uiMovementDone = 0; - uiGrandChampionsDeaths = 0; - uiArgentSoldierDeaths = 0; - - //bDone = false; - } - - public override bool IsEncounterInProgress() - { - for (byte i = 0; i < 4; ++i) - { - if (m_auiEncounter[i] == EncounterState.InProgress) - return true; - } - - return false; - } - - public override void OnCreatureCreate(Creature creature) - { - var players = instance.GetPlayers(); - Team TeamInInstance = 0; - - if (!players.Empty()) - { - Player player = players.First(); - if (player) - TeamInInstance = player.GetTeam(); - } - - switch (creature.GetEntry()) - { - // Champions - case VehicleIds.MOKRA_SKILLCRUSHER_MOUNT: - if (TeamInInstance == Team.Horde) - creature.UpdateEntry(VehicleIds.MARSHAL_JACOB_ALERIUS_MOUNT); - break; - case VehicleIds.ERESSEA_DAWNSINGER_MOUNT: - if (TeamInInstance == Team.Horde) - creature.UpdateEntry(VehicleIds.AMBROSE_BOLTSPARK_MOUNT); - break; - case VehicleIds.RUNOK_WILDMANE_MOUNT: - if (TeamInInstance == Team.Horde) - creature.UpdateEntry(VehicleIds.COLOSOS_MOUNT); - break; - case VehicleIds.ZUL_TORE_MOUNT: - if (TeamInInstance == Team.Horde) - creature.UpdateEntry(VehicleIds.EVENSONG_MOUNT); - break; - case VehicleIds.DEATHSTALKER_VESCERI_MOUNT: - if (TeamInInstance == Team.Horde) - creature.UpdateEntry(VehicleIds.LANA_STOUTHAMMER_MOUNT); - break; - // Coliseum Announcer || Just NPC_JAEREN must be spawned. - case CreatureIds.JAEREN: - uiAnnouncerGUID = creature.GetGUID(); - if (TeamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.ARELAS); - break; - case VehicleIds.ARGENT_WARHORSE: - case VehicleIds.ARGENT_BATTLEWORG: - VehicleList.Add(creature.GetGUID()); - break; - case CreatureIds.EADRIC: - case CreatureIds.PALETRESS: - uiArgentChampionGUID = creature.GetGUID(); - break; - } - } - - public override void OnGameObjectCreate(GameObject go) - { - switch (go.GetEntry()) - { - case GameObjectIds.MAIN_GATE: - uiMainGateGUID = go.GetGUID(); - break; - case GameObjectIds.CHAMPIONS_LOOT: - case GameObjectIds.CHAMPIONS_LOOT_H: - uiChampionLootGUID = go.GetGUID(); - break; - } - } - - public override void SetData(uint uiType, uint uiData) - { - switch (uiType) - { - case (uint)Data.DATA_MOVEMENT_DONE: - uiMovementDone = (ushort)uiData; - if (uiMovementDone == 3) - { - Creature pAnnouncer = instance.GetCreature(uiAnnouncerGUID); - if (pAnnouncer) - pAnnouncer.GetAI().SetData((uint)Data.DATA_IN_POSITION, 0); - } - break; - case (uint)Data.BOSS_GRAND_CHAMPIONS: - m_auiEncounter[0] = (EncounterState)uiData; - if (uiData == (uint)EncounterState.InProgress) - { - foreach (var guid in VehicleList) - { - Creature summon = instance.GetCreature(guid); - if (summon) - summon.RemoveFromWorld(); - } - } - else if (uiData == (uint)EncounterState.Done) - { - ++uiGrandChampionsDeaths; - if (uiGrandChampionsDeaths == 3) - { - Creature pAnnouncer = instance.GetCreature(uiAnnouncerGUID); - if (pAnnouncer) - { - pAnnouncer.GetMotionMaster().MovePoint(0, 748.309f, 619.487f, 411.171f); - pAnnouncer.AddNpcFlag(NPCFlags.Gossip); - pAnnouncer.SummonGameObject(instance.IsHeroic() ? GameObjectIds.CHAMPIONS_LOOT_H : GameObjectIds.CHAMPIONS_LOOT, 746.59f, 618.49f, 411.09f, 1.42f, Quaternion.fromEulerAnglesZYX(1.42f, 0.0f, 0.0f), 90000); - } - } - } - break; - case (uint)Data.DATA_ARGENT_SOLDIER_DEFEATED: - uiArgentSoldierDeaths = (byte)uiData; - if (uiArgentSoldierDeaths == 9) - { - Creature pBoss = instance.GetCreature(uiArgentChampionGUID); - if (pBoss) - { - pBoss.GetMotionMaster().MovePoint(0, 746.88f, 618.74f, 411.06f); - pBoss.RemoveUnitFlag(UnitFlags.NonAttackable); - pBoss.SetReactState(ReactStates.Aggressive); - } - } - break; - case (uint)Data.BOSS_ARGENT_CHALLENGE_E: - { - m_auiEncounter[1] = (EncounterState)uiData; - Creature pAnnouncer = instance.GetCreature(uiAnnouncerGUID); - if (pAnnouncer) - { - pAnnouncer.GetMotionMaster().MovePoint(0, 748.309f, 619.487f, 411.171f); - pAnnouncer.AddNpcFlag(NPCFlags.Gossip); - pAnnouncer.SummonGameObject(instance.IsHeroic() ? GameObjectIds.EADRIC_LOOT_H : GameObjectIds.EADRIC_LOOT, 746.59f, 618.49f, 411.09f, 1.42f, Quaternion.fromEulerAnglesZYX(1.42f, 0.0f, 0.0f), 90000); - } - } - break; - case (uint)Data.BOSS_ARGENT_CHALLENGE_P: - { - m_auiEncounter[2] = (EncounterState)uiData; - Creature pAnnouncer = instance.GetCreature(uiAnnouncerGUID); - if (pAnnouncer) - { - pAnnouncer.GetMotionMaster().MovePoint(0, 748.309f, 619.487f, 411.171f); - pAnnouncer.AddNpcFlag(NPCFlags.Gossip); - pAnnouncer.SummonGameObject(instance.IsHeroic() ? GameObjectIds.PALETRESS_LOOT_H : GameObjectIds.PALETRESS_LOOT, 746.59f, 618.49f, 411.09f, 1.42f, Quaternion.fromEulerAnglesZYX(1.42f, 0.0f, 0.0f), 90000); - } - } - break; - } - - if (uiData == (uint)EncounterState.Done) - SaveToDB(); - } - - public override uint GetData(uint uiData) - { - switch (uiData) - { - case (uint)Data.BOSS_GRAND_CHAMPIONS: - return (uint)m_auiEncounter[0]; - case (uint)Data.BOSS_ARGENT_CHALLENGE_E: - return (uint)m_auiEncounter[1]; - case (uint)Data.BOSS_ARGENT_CHALLENGE_P: - return (uint)m_auiEncounter[2]; - case (uint)Data.BOSS_BLACK_KNIGHT: - return (uint)m_auiEncounter[3]; - - case (uint)Data.DATA_MOVEMENT_DONE: - return uiMovementDone; - case (uint)Data.DATA_ARGENT_SOLDIER_DEFEATED: - return uiArgentSoldierDeaths; - } - - return 0; - } - - public override ObjectGuid GetGuidData(uint uiData) - { - switch (uiData) - { - case (uint)Data64.DATA_ANNOUNCER: - return uiAnnouncerGUID; - case (uint)Data64.DATA_MAIN_GATE: - return uiMainGateGUID; - - case (uint)Data64.DATA_GRAND_CHAMPION_1: - return uiGrandChampion1GUID; - case (uint)Data64.DATA_GRAND_CHAMPION_2: - return uiGrandChampion2GUID; - case (uint)Data64.DATA_GRAND_CHAMPION_3: - return uiGrandChampion3GUID; - } - - return ObjectGuid.Empty; - } - - public override void SetGuidData(uint uiType, ObjectGuid uiData) - { - switch (uiType) - { - case (uint)Data64.DATA_GRAND_CHAMPION_1: - uiGrandChampion1GUID = uiData; - break; - case (uint)Data64.DATA_GRAND_CHAMPION_2: - uiGrandChampion2GUID = uiData; - break; - case (uint)Data64.DATA_GRAND_CHAMPION_3: - uiGrandChampion3GUID = uiData; - break; - } - } - - public override string GetSaveData() - { - OUT_SAVE_INST_DATA(); - - string str_data = - $"T C {m_auiEncounter[0]} {m_auiEncounter[1]} {m_auiEncounter[2]} {m_auiEncounter[3]} {uiGrandChampionsDeaths} {uiMovementDone}"; - - OUT_SAVE_INST_DATA_COMPLETE(); - return str_data; - } - - public override void Load(string str) - { - if (str.IsEmpty()) - { - OUT_LOAD_INST_DATA_FAIL(); - return; - } - - OUT_LOAD_INST_DATA(str); - - StringArguments loadStream = new StringArguments(str); - string dataHead = loadStream.NextString(); - - if (dataHead[0] == 'T' && dataHead[1] == 'C') - { - for (byte i = 0; i < 4; ++i) - { - m_auiEncounter[i] = (EncounterState)loadStream.NextUInt32(); - if (m_auiEncounter[i] == EncounterState.InProgress) - m_auiEncounter[i] = EncounterState.NotStarted; - - } - - uiGrandChampionsDeaths = loadStream.NextUInt16(); - uiMovementDone = loadStream.NextUInt16(); - } - else - OUT_LOAD_INST_DATA_FAIL(); - - OUT_LOAD_INST_DATA_COMPLETE(); - } - - EncounterState[] m_auiEncounter = new EncounterState[4]; - - ushort uiMovementDone; - ushort uiGrandChampionsDeaths; - byte uiArgentSoldierDeaths; - - ObjectGuid uiAnnouncerGUID; - ObjectGuid uiMainGateGUID; - //ObjectGuid uiGrandChampionVehicle1GUID; - //ObjectGuid uiGrandChampionVehicle2GUID; - //ObjectGuid uiGrandChampionVehicle3GUID; - ObjectGuid uiGrandChampion1GUID; - ObjectGuid uiGrandChampion2GUID; - ObjectGuid uiGrandChampion3GUID; - ObjectGuid uiChampionLootGUID; - ObjectGuid uiArgentChampionGUID; - - List VehicleList = new List(); - - //bool bDone; - } - - public override InstanceScript GetInstanceScript(InstanceMap map) - { - return new instance_trial_of_the_champion_InstanceMapScript(map); - } - } -} diff --git a/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/TrialOfTheChampion.cs b/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/TrialOfTheChampion.cs deleted file mode 100644 index 3602d7ba0..000000000 --- a/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/TrialOfTheChampion.cs +++ /dev/null @@ -1,585 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using System.Collections.Generic; - - -namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheChampion -{ - struct TrialOfTheChampionConst - { - public const uint SAY_INTRO_1 = 0; - public const uint SAY_INTRO_2 = 1; - public const uint SAY_INTRO_3 = 2; - public const uint SAY_AGGRO = 3; - public const uint SAY_PHASE_2 = 4; - public const uint SAY_PHASE_3 = 5; - public const uint SAY_KILL_PLAYER = 6; - public const uint SAY_DEATH = 7; - - public const string GOSSIP_START_EVENT1 = "I'm ready to start challenge."; - public const string GOSSIP_START_EVENT2 = "I'm ready for the next challenge."; - } - - enum Data - { - BOSS_GRAND_CHAMPIONS, - BOSS_ARGENT_CHALLENGE_E, - BOSS_ARGENT_CHALLENGE_P, - BOSS_BLACK_KNIGHT, - DATA_MOVEMENT_DONE, - DATA_LESSER_CHAMPIONS_DEFEATED, - DATA_START, - DATA_IN_POSITION, - DATA_ARGENT_SOLDIER_DEFEATED - }; - - enum Data64 - { - DATA_ANNOUNCER, - DATA_MAIN_GATE, - - DATA_GRAND_CHAMPION_VEHICLE_1, - DATA_GRAND_CHAMPION_VEHICLE_2, - DATA_GRAND_CHAMPION_VEHICLE_3, - - DATA_GRAND_CHAMPION_1, - DATA_GRAND_CHAMPION_2, - DATA_GRAND_CHAMPION_3 - }; - - struct CreatureIds - { - // Horde Champions - public const uint MOKRA = 35572; - public const uint ERESSEA = 35569; - public const uint RUNOK = 35571; - public const uint ZULTORE = 35570; - public const uint VISCERI = 35617; - - // Alliance Champions - public const uint JACOB = 34705; - public const uint AMBROSE = 34702; - public const uint COLOSOS = 34701; - public const uint JAELYNE = 34657; - public const uint LANA = 34703; - - public const uint EADRIC = 35119; - public const uint PALETRESS = 34928; - - public const uint ARGENT_LIGHWIELDER = 35309; - public const uint ARGENT_MONK = 35305; - public const uint PRIESTESS = 35307; - - public const uint BLACK_KNIGHT = 35451; - - public const uint RISEN_JAEREN = 35545; - public const uint RISEN_ARELAS = 35564; - - public const uint JAEREN = 35004; - public const uint ARELAS = 35005; - } - - struct GameObjectIds - { - public const uint MAIN_GATE = 195647; - - public const uint CHAMPIONS_LOOT = 195709; - public const uint CHAMPIONS_LOOT_H = 195710; - - public const uint EADRIC_LOOT = 195374; - public const uint EADRIC_LOOT_H = 195375; - - public const uint PALETRESS_LOOT = 195323; - public const uint PALETRESS_LOOT_H = 195324; - } - - struct VehicleIds - { - //Grand Champions Alliance Vehicles - public const uint MARSHAL_JACOB_ALERIUS_MOUNT = 35637; - public const uint AMBROSE_BOLTSPARK_MOUNT = 35633; - public const uint COLOSOS_MOUNT = 35768; - public const uint EVENSONG_MOUNT = 34658; - public const uint LANA_STOUTHAMMER_MOUNT = 35636; - //Faction Champions (ALLIANCE) - public const uint DARNASSIA_NIGHTSABER = 33319; - public const uint EXODAR_ELEKK = 33318; - public const uint STORMWIND_STEED = 33217; - public const uint GNOMEREGAN_MECHANOSTRIDER = 33317; - public const uint IRONFORGE_RAM = 33316; - //Grand Champions Horde Vehicles - public const uint MOKRA_SKILLCRUSHER_MOUNT = 35638; - public const uint ERESSEA_DAWNSINGER_MOUNT = 35635; - public const uint RUNOK_WILDMANE_MOUNT = 35640; - public const uint ZUL_TORE_MOUNT = 35641; - public const uint DEATHSTALKER_VESCERI_MOUNT = 35634; - //Faction Champions (HORDE) - public const uint FORSAKE_WARHORSE = 33324; - public const uint THUNDER_BLUFF_KODO = 33322; - public const uint ORGRIMMAR_WOLF = 33320; - public const uint SILVERMOON_HAWKSTRIDER = 33323; - public const uint DARKSPEAR_RAPTOR = 33321; - - public const uint ARGENT_WARHORSE = 35644; - public const uint ARGENT_BATTLEWORG = 36558; - - public const uint BLACK_KNIGHT = 35491; - } - - [Script] - class npc_announcer_toc5 : CreatureScript - { - public npc_announcer_toc5() : base("npc_announcer_toc5") { } - - class npc_announcer_toc5AI : ScriptedAI - { - public npc_announcer_toc5AI(Creature creature) : base(creature) - { - instance = creature.GetInstanceScript(); - - uiSummonTimes = 0; - uiLesserChampions = 0; - - uiFirstBoss = 0; - uiSecondBoss = 0; - uiThirdBoss = 0; - - uiArgentChampion = 0; - - uiPhase = 0; - uiTimer = 0; - - me.SetReactState(ReactStates.Passive); - me.AddUnitFlag(UnitFlags.NonAttackable); - me.AddNpcFlag(NPCFlags.Gossip); - - SetGrandChampionsForEncounter(); - SetArgentChampion(); - } - - void NextStep(uint uiTimerStep, bool bNextStep = true, byte uiPhaseStep = 0) - { - uiTimer = uiTimerStep; - if (bNextStep) - ++uiPhase; - else - uiPhase = uiPhaseStep; - } - - public override void SetData(uint uiType, uint uiData) - { - switch (uiType) - { - case (uint)Data.DATA_START: - DoSummonGrandChampion(uiFirstBoss); - NextStep(10000, false, 1); - break; - case (uint)Data.DATA_IN_POSITION: //movement EncounterState.Done. - me.GetMotionMaster().MovePoint(1, 735.81f, 661.92f, 412.39f); - GameObject go = ObjectAccessor.GetGameObject(me, instance.GetGuidData((uint)Data64.DATA_MAIN_GATE)); - if (go) - instance.HandleGameObject(go.GetGUID(), false); - NextStep(10000, false, 3); - break; - case (uint)Data.DATA_LESSER_CHAMPIONS_DEFEATED: - { - ++uiLesserChampions; - List TempList = new List(); - if (uiLesserChampions == 3 || uiLesserChampions == 6) - { - switch (uiLesserChampions) - { - case 3: - TempList = Champion2List; - break; - case 6: - TempList = Champion3List; - break; - } - - foreach (var guid in TempList) - { - Creature summon = ObjectAccessor.GetCreature(me, guid); - if (summon) - AggroAllPlayers(summon); - } - } - else if (uiLesserChampions == 9) - StartGrandChampionsAttack(); - - break; - } - } - } - - void StartGrandChampionsAttack() - { - Creature pGrandChampion1 = ObjectAccessor.GetCreature(me, uiVehicle1GUID); - Creature pGrandChampion2 = ObjectAccessor.GetCreature(me, uiVehicle2GUID); - Creature pGrandChampion3 = ObjectAccessor.GetCreature(me, uiVehicle3GUID); - - if (pGrandChampion1 && pGrandChampion2 && pGrandChampion3) - { - AggroAllPlayers(pGrandChampion1); - AggroAllPlayers(pGrandChampion2); - AggroAllPlayers(pGrandChampion3); - } - } - - public override void MovementInform(MovementGeneratorType uiType, uint uiPointId) - { - if (uiType != MovementGeneratorType.Point) - return; - - if (uiPointId == 1) - me.SetFacingTo(4.714f); - } - - void DoSummonGrandChampion(uint uiBoss) - { - ++uiSummonTimes; - uint VEHICLE_TO_SUMMON1 = 0; - uint VEHICLE_TO_SUMMON2 = 0; - switch (uiBoss) - { - case 0: - VEHICLE_TO_SUMMON1 = VehicleIds.MOKRA_SKILLCRUSHER_MOUNT; - VEHICLE_TO_SUMMON2 = VehicleIds.ORGRIMMAR_WOLF; - break; - case 1: - VEHICLE_TO_SUMMON1 = VehicleIds.ERESSEA_DAWNSINGER_MOUNT; - VEHICLE_TO_SUMMON2 = VehicleIds.SILVERMOON_HAWKSTRIDER; - break; - case 2: - VEHICLE_TO_SUMMON1 = VehicleIds.RUNOK_WILDMANE_MOUNT; - VEHICLE_TO_SUMMON2 = VehicleIds.THUNDER_BLUFF_KODO; - break; - case 3: - VEHICLE_TO_SUMMON1 = VehicleIds.ZUL_TORE_MOUNT; - VEHICLE_TO_SUMMON2 = VehicleIds.DARKSPEAR_RAPTOR; - break; - case 4: - VEHICLE_TO_SUMMON1 = VehicleIds.DEATHSTALKER_VESCERI_MOUNT; - VEHICLE_TO_SUMMON2 = VehicleIds.FORSAKE_WARHORSE; - break; - default: - return; - } - - Creature pBoss = me.SummonCreature(VEHICLE_TO_SUMMON1, SpawnPosition); - if (pBoss) - { - ObjectGuid uiGrandChampionBoss = ObjectGuid.Empty; - Vehicle pVehicle = pBoss.GetVehicleKit(); - if (pVehicle) - { - Unit unit = pVehicle.GetPassenger(0); - if (unit) - uiGrandChampionBoss = unit.GetGUID(); - } - - switch (uiSummonTimes) - { - case 1: - uiVehicle1GUID = pBoss.GetGUID(); - instance.SetGuidData((uint)Data64.DATA_GRAND_CHAMPION_VEHICLE_1, uiVehicle1GUID); - instance.SetGuidData((uint)Data64.DATA_GRAND_CHAMPION_1, uiGrandChampionBoss); - break; - case 2: - - uiVehicle2GUID = pBoss.GetGUID(); - instance.SetGuidData((uint)Data64.DATA_GRAND_CHAMPION_VEHICLE_2, uiVehicle2GUID); - instance.SetGuidData((uint)Data64.DATA_GRAND_CHAMPION_2, uiGrandChampionBoss); - break; - case 3: - uiVehicle3GUID = pBoss.GetGUID(); - instance.SetGuidData((uint)Data64.DATA_GRAND_CHAMPION_VEHICLE_3, uiVehicle3GUID); - instance.SetGuidData((uint)Data64.DATA_GRAND_CHAMPION_3, uiGrandChampionBoss); - break; - - default: - return; - } - pBoss.GetAI().SetData(uiSummonTimes, 0); - - for (byte i = 0; i < 3; ++i) - { - Creature pAdd = me.SummonCreature(VEHICLE_TO_SUMMON2, SpawnPosition, TempSummonType.CorpseDespawn); - if (pAdd) - { - switch (uiSummonTimes) - { - case 1: - Champion1List.Add(pAdd.GetGUID()); - break; - case 2: - Champion2List.Add(pAdd.GetGUID()); - break; - case 3: - Champion3List.Add(pAdd.GetGUID()); - break; - } - - switch (i) - { - case 0: - pAdd.GetMotionMaster().MoveFollow(pBoss, 2.0f, MathFunctions.PI); - break; - case 1: - pAdd.GetMotionMaster().MoveFollow(pBoss, 2.0f, MathFunctions.PI / 2); - break; - case 2: - pAdd.GetMotionMaster().MoveFollow(pBoss, 2.0f, MathFunctions.PI / 2 + MathFunctions.PI); - break; - } - } - - } - } - } - - void DoStartArgentChampionEncounter() - { - me.GetMotionMaster().MovePoint(1, 735.81f, 661.92f, 412.39f); - - if (me.SummonCreature(uiArgentChampion, SpawnPosition)) - { - for (byte i = 0; i < 3; ++i) - { - Creature lightwielderTrash = me.SummonCreature(CreatureIds.ARGENT_LIGHWIELDER, SpawnPosition); - if (lightwielderTrash) - lightwielderTrash.GetAI().SetData(i, 0); - - Creature monkTrash = me.SummonCreature(CreatureIds.ARGENT_MONK, SpawnPosition); - if (monkTrash) - monkTrash.GetAI().SetData(i, 0); - - Creature priestessTrash = me.SummonCreature(CreatureIds.PRIESTESS, SpawnPosition); - if (priestessTrash) - priestessTrash.GetAI().SetData(i, 0); - } - } - } - - void SetGrandChampionsForEncounter() - { - uiFirstBoss = RandomHelper.URand(0, 4); - - while (uiSecondBoss == uiFirstBoss || uiThirdBoss == uiFirstBoss || uiThirdBoss == uiSecondBoss) - { - uiSecondBoss = RandomHelper.URand(0, 4); - uiThirdBoss = RandomHelper.URand(0, 4); - } - } - - void SetArgentChampion() - { - byte uiTempBoss = (byte)RandomHelper.URand(0, 1); - - switch (uiTempBoss) - { - case 0: - uiArgentChampion = CreatureIds.EADRIC; - break; - case 1: - uiArgentChampion = CreatureIds.PALETRESS; - break; - } - } - - public void StartEncounter() - { - me.RemoveNpcFlag(NPCFlags.Gossip); - - if (instance.GetData((uint)Data.BOSS_BLACK_KNIGHT) == (uint)EncounterState.NotStarted) - { - if (instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_E) == (uint)EncounterState.NotStarted && instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_P) == (uint)EncounterState.NotStarted) - { - if (instance.GetData((uint)Data.BOSS_GRAND_CHAMPIONS) == (uint)EncounterState.NotStarted) - SetData((uint)Data.DATA_START, 0); - - if (instance.GetData((uint)Data.BOSS_GRAND_CHAMPIONS) == (uint)EncounterState.Done) - DoStartArgentChampionEncounter(); - } - - if ((instance.GetData((uint)Data.BOSS_GRAND_CHAMPIONS) == (uint)EncounterState.Done && - instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_E) == (uint)EncounterState.Done) || - instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_P) == (uint)EncounterState.Done) - me.SummonCreature(VehicleIds.BLACK_KNIGHT, 769.834f, 651.915f, 447.035f, 0); - } - } - - void AggroAllPlayers(Creature temp) - { - var PlList = me.GetMap().GetPlayers(); - - if (PlList.Empty()) - return; - - foreach (var player in PlList) - { - if (player.IsGameMaster()) - continue; - - if (player.IsAlive()) - { - temp.SetHomePosition(me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), me.GetOrientation()); - temp.RemoveUnitFlag(UnitFlags.NonAttackable); - temp.SetReactState(ReactStates.Aggressive); - temp.SetInCombatWith(player); - player.SetInCombatWith(temp); - AddThreat(player, 0.0f, temp); - } - } - } - - public override void UpdateAI(uint diff) - { - base.UpdateAI(diff); - - if (uiTimer <= diff) - { - switch (uiPhase) - { - case 1: - DoSummonGrandChampion(uiSecondBoss); - NextStep(10000, true); - break; - case 2: - DoSummonGrandChampion(uiThirdBoss); - NextStep(0, false); - break; - case 3: - if (!Champion1List.Empty()) - { - foreach (var guid in Champion1List) - { - Creature summon = ObjectAccessor.GetCreature(me, guid); - if (summon) - AggroAllPlayers(summon); - } - NextStep(0, false); - } - break; - } - } - else - uiTimer -= diff; - - if (!UpdateVictim()) - return; - } - - public override void JustSummoned(Creature summon) - { - if (instance.GetData((uint)Data.BOSS_GRAND_CHAMPIONS) == (uint)EncounterState.NotStarted) - { - summon.AddUnitFlag(UnitFlags.NonAttackable); - summon.SetReactState(ReactStates.Passive); - } - } - - public override void SummonedCreatureDespawn(Creature summon) - { - switch (summon.GetEntry()) - { - case VehicleIds.DARNASSIA_NIGHTSABER: - case VehicleIds.EXODAR_ELEKK: - case VehicleIds.STORMWIND_STEED: - case VehicleIds.GNOMEREGAN_MECHANOSTRIDER: - case VehicleIds.IRONFORGE_RAM: - case VehicleIds.FORSAKE_WARHORSE: - case VehicleIds.THUNDER_BLUFF_KODO: - case VehicleIds.ORGRIMMAR_WOLF: - case VehicleIds.SILVERMOON_HAWKSTRIDER: - case VehicleIds.DARKSPEAR_RAPTOR: - SetData((uint)Data.DATA_LESSER_CHAMPIONS_DEFEATED, 0); - break; - } - } - - public override bool GossipHello(Player player) - { - if (((instance.GetData((uint)Data.BOSS_GRAND_CHAMPIONS) == (uint)EncounterState.Done && - instance.GetData((uint)Data.BOSS_BLACK_KNIGHT) == (uint)EncounterState.Done && - instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_E) == (uint)EncounterState.Done) || - instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_P) == (uint)EncounterState.Done)) - return false; - - if (instance.GetData((uint)Data.BOSS_GRAND_CHAMPIONS) == (uint)EncounterState.NotStarted && - instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_E) == (uint)EncounterState.NotStarted && - instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_P) == (uint)EncounterState.NotStarted && - instance.GetData((uint)Data.BOSS_BLACK_KNIGHT) == (uint)EncounterState.NotStarted) - player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, TrialOfTheChampionConst.GOSSIP_START_EVENT1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1); - else if (instance != null) - player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, TrialOfTheChampionConst.GOSSIP_START_EVENT2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1); - - SendGossipMenuFor(player, player.GetGossipTextId(me), me.GetGUID()); - - return true; - } - - public override bool GossipSelect(Player player, uint menuId, uint gossipListId) - { - uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId); - ClearGossipMenuFor(player); - if (action == eTradeskill.GossipActionInfoDef + 1) - { - CloseGossipMenuFor(player); - StartEncounter(); - } - - return true; - } - - InstanceScript instance; - - byte uiSummonTimes; - byte uiLesserChampions; - - uint uiArgentChampion; - - uint uiFirstBoss; - uint uiSecondBoss; - uint uiThirdBoss; - - uint uiPhase; - uint uiTimer; - - ObjectGuid uiVehicle1GUID; - ObjectGuid uiVehicle2GUID; - ObjectGuid uiVehicle3GUID; - - List Champion1List = new List(); - List Champion2List = new List(); - List Champion3List = new List(); - - Position SpawnPosition = new Position(746.261f, 657.401f, 411.681f, 4.65f); - } - - public override CreatureAI GetAI(Creature creature) - { - return GetInstanceAI(creature); - } - } -} diff --git a/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/LordJaraxxus.cs b/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/LordJaraxxus.cs deleted file mode 100644 index 0097beb41..000000000 --- a/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/LordJaraxxus.cs +++ /dev/null @@ -1,487 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using Game.Spells; -using System.Collections.Generic; - -namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheCrusader -{ - struct Jaraxxus - { - public const uint SayIntro = 0; - public const uint SayAggro = 1; - public const uint EmoteLegionFlame = 2; - public const uint EmoteNetherPortal = 3; - public const uint SayMistressOfPain = 4; - public const uint EmoteIncinerate = 5; - public const uint SayIncinerate = 6; - public const uint EmoteInfernalEruption = 7; - public const uint SayInfernalEruption = 8; - public const uint SayKillPlayer = 9; - public const uint SayDeath = 10; - public const uint SayBerserk = 11; - - public const uint NpcLegionFlame = 34784; - public const uint NpcInfernalVolcano = 34813; - public const uint NpcFelInfernal = 34815; // Immune To All Cc On Heroic (Stuns; Banish; Interrupt; Etc) - public const uint NpcNetherPortal = 34825; - public const uint NpcMistressOfPain = 34826; - - public const uint SpellLegionFlame = 66197; // Player Should Run Away From Raid Because He Triggers Legion Flame - public const uint SpellLegionFlameEffect = 66201; // Used By Trigger Npc - public const uint SpellNetherPower = 66228; // +20% Of Spell Damage Per Stack; Stackable Up To 5/10 Times; Must Be Dispelled/Stealed - public const uint SpellFelLighting = 66528; // Jumps To Nearby Targets - public const uint SpellFelFireball = 66532; // Does Heavy Damage To The Tank; Interruptable - public const uint SpellIncinerateFlesh = 66237; // Target Must Be Healed Or Will Trigger Burning Inferno - public const uint SpellBurningInferno = 66242; // Triggered By Incinerate Flesh - public const uint SpellInfernalEruption = 66258; // Summons Infernal Volcano - public const uint SpellInfernalEruptionEffect = 66252; // Summons Felflame Infernal (3 At Normal And Inifinity At Heroic) - public const uint SpellNetherPortal = 66269; // Summons Nether Portal - public const uint SpellNetherPortalEffect = 66263; // Summons Mistress Of Pain (1 At Normal And Infinity At Heroic) - - public const uint SpellBerserk = 64238; // Unused - - // Mistress Of Pain Spells - public const uint SpellShivanSlash = 67098; - public const uint SpellSpinningStrike = 66283; - public const uint SpellMistressKiss = 66336; - public const uint SpellFelInferno = 67047; - public const uint SpellFelStreak = 66494; - public const int SpellLordHittin = 66326; // Special Effect Preventing More Specific Spells Be Cast On The Same Player Within 10 Seconds - public const uint SpellMistressKissDamageSilence = 66359; - - // Lord Jaraxxus - public const uint EventFelFireball = 1; - public const uint EventFelLightning = 2; - public const uint EventIncinerateFlesh = 3; - public const uint EventNetherPower = 4; - public const uint EventLegionFlame = 5; - public const uint EventSummonoNetherPortal = 6; - public const uint EventSummonInfernalEruption = 7; - - // Mistress Of Pain - public const uint EventShivanSlash = 8; - public const uint EventSpinningStrike = 9; - public const uint EventMistressKiss = 10; - } - - [Script] - class boss_jaraxxus : BossAI - { - public boss_jaraxxus(Creature creature) : base(creature, DataTypes.BossJaraxxus) { } - - public override void Reset() - { - _Reset(); - _events.ScheduleEvent(Jaraxxus.EventFelFireball, 5 * Time.InMilliseconds); - _events.ScheduleEvent(Jaraxxus.EventFelLightning, RandomHelper.URand(10 * Time.InMilliseconds, 15 * Time.InMilliseconds)); - _events.ScheduleEvent(Jaraxxus.EventIncinerateFlesh, RandomHelper.URand(20 * Time.InMilliseconds, 25 * Time.InMilliseconds)); - _events.ScheduleEvent(Jaraxxus.EventNetherPower, 40 * Time.InMilliseconds); - _events.ScheduleEvent(Jaraxxus.EventLegionFlame, 30 * Time.InMilliseconds); - _events.ScheduleEvent(Jaraxxus.EventSummonoNetherPortal, 20 * Time.InMilliseconds); - _events.ScheduleEvent(Jaraxxus.EventSummonInfernalEruption, 80 * Time.InMilliseconds); - } - - public override void JustReachedHome() - { - _JustReachedHome(); - instance.SetBossState(DataTypes.BossJaraxxus, EncounterState.Fail); - DoCast(me, Spells.JaraxxusChains); - me.AddUnitFlag(UnitFlags.NonAttackable); - } - - public override void KilledUnit(Unit who) - { - if (who.IsTypeId(TypeId.Player)) - { - Talk(Jaraxxus.SayKillPlayer); - instance.SetData(DataTypes.TributeToImmortalityEligible, 0); - } - } - - public override void JustDied(Unit killer) - { - _JustDied(); - Talk(Jaraxxus.SayDeath); - } - - public override void JustSummoned(Creature summoned) - { - summons.Summon(summoned); - } - - public override void EnterCombat(Unit who) - { - _EnterCombat(); - Talk(Jaraxxus.SayAggro); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case Jaraxxus.EventFelFireball: - DoCastVictim(Jaraxxus.SpellFelFireball); - _events.ScheduleEvent(Jaraxxus.EventFelFireball, RandomHelper.URand(10 * Time.InMilliseconds, 15 * Time.InMilliseconds)); - return; - case Jaraxxus.EventFelLightning: - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true, true, -Jaraxxus.SpellLordHittin); - if (target) - DoCast(target, Jaraxxus.SpellFelLighting); - _events.ScheduleEvent(Jaraxxus.EventFelLightning, RandomHelper.URand(10 * Time.InMilliseconds, 15 * Time.InMilliseconds)); - return; - } - case Jaraxxus.EventIncinerateFlesh: - { - Unit target = SelectTarget(SelectAggroTarget.Random, 1, 0.0f, true, true, -Jaraxxus.SpellLordHittin); - if (target) - { - Talk(Jaraxxus.EmoteIncinerate, target); - Talk(Jaraxxus.SayIncinerate); - DoCast(target, Jaraxxus.SpellInfernalEruption); - } - _events.ScheduleEvent(Jaraxxus.EventIncinerateFlesh, RandomHelper.URand(20 * Time.InMilliseconds, 25 * Time.InMilliseconds)); - return; - } - case Jaraxxus.EventNetherPower: - me.CastCustomSpell(Jaraxxus.SpellNetherPower, SpellValueMod.AuraStack, RaidMode(5, 10, 5, 10), me, true); - _events.ScheduleEvent(Jaraxxus.EventNetherPower, 40 * Time.InMilliseconds); - return; - case Jaraxxus.EventLegionFlame: - { - Unit target = SelectTarget(SelectAggroTarget.Random, 1, 0.0f, true, true, -Jaraxxus.SpellLordHittin); - if (target) - { - Talk(Jaraxxus.EmoteLegionFlame, target); - DoCast(target, Jaraxxus.SpellLegionFlame); - } - _events.ScheduleEvent(Jaraxxus.EventLegionFlame, 30 * Time.InMilliseconds); - return; - } - case Jaraxxus.EventSummonoNetherPortal: - Talk(Jaraxxus.EmoteNetherPortal); - Talk(Jaraxxus.SayMistressOfPain); - DoCast(Jaraxxus.SpellNetherPortal); - _events.ScheduleEvent(Jaraxxus.EventSummonoNetherPortal, 2 * Time.Minute * Time.InMilliseconds); - return; - case Jaraxxus.EventSummonInfernalEruption: - Talk(Jaraxxus.EmoteInfernalEruption); - Talk(Jaraxxus.SayInfernalEruption); - DoCast(Jaraxxus.SpellInfernalEruption); - _events.ScheduleEvent(Jaraxxus.EventSummonInfernalEruption, 2 * Time.Minute * Time.InMilliseconds); - return; - } - }); - - DoMeleeAttackIfReady(); - } - } - - [Script] - class npc_legion_flame : ScriptedAI - { - public npc_legion_flame(Creature creature) : base(creature) - { - SetCombatMovement(false); - _instance = creature.GetInstanceScript(); - } - - public override void Reset() - { - me.AddUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - me.SetInCombatWithZone(); - DoCast(Jaraxxus.SpellLegionFlameEffect); - } - - public override void UpdateAI(uint diff) - { - UpdateVictim(); - if (_instance.GetBossState(DataTypes.BossJaraxxus) != EncounterState.InProgress) - me.DespawnOrUnsummon(); - } - - InstanceScript _instance; - } - - [Script] - class npc_infernal_volcano : ScriptedAI - { - public npc_infernal_volcano(Creature creature) : base(creature) - { - _summons = new SummonList(me); - SetCombatMovement(false); - } - - public override void Reset() - { - me.SetReactState(ReactStates.Passive); - - if (!IsHeroic()) - me.AddUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable | UnitFlags.Pacified); - else - me.RemoveUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable | UnitFlags.Pacified); - - _summons.DespawnAll(); - } - - public override void IsSummonedBy(Unit summoner) - { - DoCast(Jaraxxus.SpellInfernalEruptionEffect); - } - - public override void JustSummoned(Creature summoned) - { - _summons.Summon(summoned); - // makes immediate corpse despawn of summoned Felflame Infernals - summoned.SetCorpseDelay(0); - } - - public override void JustDied(Unit killer) - { - // used to despawn corpse immediately - me.DespawnOrUnsummon(); - } - - public override void UpdateAI(uint diff) { } - - SummonList _summons; - } - - [Script] - class npc_fel_infernal : ScriptedAI - { - public npc_fel_infernal(Creature creature) : base(creature) - { - _instance = creature.GetInstanceScript(); - } - - public override void Reset() - { - _felStreakTimer = 30 * Time.InMilliseconds; - me.SetInCombatWithZone(); - } - - public override void UpdateAI(uint diff) - { - if (_instance.GetBossState(DataTypes.BossJaraxxus) != EncounterState.InProgress) - { - me.DespawnOrUnsummon(); - return; - } - - if (!UpdateVictim()) - return; - - if (_felStreakTimer <= diff) - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true); - if (target) - DoCast(target, Jaraxxus.SpellFelStreak); - _felStreakTimer = 30 * Time.InMilliseconds; - } - else - _felStreakTimer -= diff; - - DoMeleeAttackIfReady(); - } - - uint _felStreakTimer; - InstanceScript _instance; - } - - [Script] - class npc_nether_portal : ScriptedAI - { - public npc_nether_portal(Creature creature) : base(creature) - { - _summons = new SummonList(me); - } - - public override void Reset() - { - me.SetReactState(ReactStates.Passive); - - if (!IsHeroic()) - me.AddUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable | UnitFlags.Pacified); - else - me.RemoveUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable | UnitFlags.Pacified); - - _summons.DespawnAll(); - } - - public override void IsSummonedBy(Unit summoner) - { - DoCast(Jaraxxus.SpellNetherPortalEffect); - } - - public override void JustSummoned(Creature summoned) - { - _summons.Summon(summoned); - // makes immediate corpse despawn of summoned Mistress of Pain - summoned.SetCorpseDelay(0); - } - - public override void JustDied(Unit killer) - { - // used to despawn corpse immediately - me.DespawnOrUnsummon(); - } - - public override void UpdateAI(uint diff) { } - - SummonList _summons; - } - - [Script] - class npc_mistress_of_pain : ScriptedAI - { - public npc_mistress_of_pain(Creature creature) : base(creature) - { - _instance = creature.GetInstanceScript(); - _instance.SetData(DataTypes.MistressOfPainCount, DataTypes.Increase); - } - - public override void Reset() - { - _events.ScheduleEvent(Jaraxxus.EventShivanSlash, 30 * Time.InMilliseconds); - _events.ScheduleEvent(Jaraxxus.EventSpinningStrike, 30 * Time.InMilliseconds); - if (IsHeroic()) - _events.ScheduleEvent(Jaraxxus.EventMistressKiss, 15 * Time.InMilliseconds); - me.SetInCombatWithZone(); - } - - public override void JustDied(Unit killer) - { - _instance.SetData(DataTypes.MistressOfPainCount, DataTypes.Decrease); - } - - public override void UpdateAI(uint diff) - { - if (_instance.GetBossState(DataTypes.BossJaraxxus) != EncounterState.InProgress) - { - me.DespawnOrUnsummon(); - return; - } - - if (!UpdateVictim()) - return; - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case Jaraxxus.EventShivanSlash: - DoCastVictim(Jaraxxus.SpellShivanSlash); - _events.ScheduleEvent(Jaraxxus.EventShivanSlash, 30 * Time.InMilliseconds); - return; - case Jaraxxus.EventSpinningStrike: - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true); - if (target) - DoCast(target, Jaraxxus.SpellSpinningStrike); - _events.ScheduleEvent(Jaraxxus.EventSpinningStrike, 30 * Time.InMilliseconds); - return; - case Jaraxxus.EventMistressKiss: - DoCast(me, Jaraxxus.SpellMistressKiss); - _events.ScheduleEvent(Jaraxxus.EventMistressKiss, 30 * Time.InMilliseconds); - return; - default: - break; - } - }); - - DoMeleeAttackIfReady(); - } - - InstanceScript _instance; - } - - [Script] - class spell_mistress_kiss : AuraScript - { - public override bool Load() - { - return ValidateSpellInfo(Jaraxxus.SpellMistressKissDamageSilence); - } - - void HandleDummyTick(AuraEffect aurEff) - { - Unit caster = GetCaster(); - Unit target = GetTarget(); - if (caster && target) - { - if (target.HasUnitState(UnitState.Casting)) - { - caster.CastSpell(target, Jaraxxus.SpellMistressKissDamageSilence, true); - target.RemoveAurasDueToSpell(GetSpellInfo().Id); - } - } - } - - public override void Register() - { - OnEffectPeriodic.Add(new EffectPeriodicHandler(HandleDummyTick, 0, AuraType.PeriodicDummy)); - } - } - - [Script] - class spell_mistress_kiss_area : SpellScript - { - void FilterTargets(List targets) - { - // get a list of players with mana - targets.RemoveAll(unit => unit.IsTypeId(TypeId.Player) && unit.ToPlayer().GetPowerType() == PowerType.Mana); - if (targets.Empty()) - return; - - WorldObject target = targets.SelectRandom(); - targets.Clear(); - targets.Add(target); - } - - void HandleScript(uint effIndex) - { - GetCaster().CastSpell(GetHitUnit(), (uint)GetEffectValue(), true); - } - - public override void Register() - { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEnemy)); - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); - } - } -} \ No newline at end of file diff --git a/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/NorthrendBeasts.cs b/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/NorthrendBeasts.cs deleted file mode 100644 index fc2b0356f..000000000 --- a/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/NorthrendBeasts.cs +++ /dev/null @@ -1,1262 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using Game.Spells; -using System; - -namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheCrusader -{ - struct TextIds - { - // Gormok - public const uint EmoteSnobolled = 0; - - // Acidmaw & Dreadscale - public const uint EmoteEnrage = 0; - public const uint SaySpecial = 1; - - // Icehowl - public const uint EmoteTrampleStart = 0; - public const uint EmoteTrampleCrash = 1; - public const uint EmoteTrampleFail = 2; - } - - struct SpellIds - { - //Gormok - public const uint Impale = 66331; - public const uint StaggeringStomp = 67648; - - //Snobold - public const uint RisingAnger = 66636; - public const uint Snobolled = 66406; - public const uint Batter = 66408; - public const uint FireBomb = 66313; - public const uint FireBomb1 = 66317; - public const uint FireBombDot = 66318; - public const uint HeadCrack = 66407; - public const uint JumpToHand = 66342; - public const uint RidePlayer = 66245; - - //Acidmaw & Dreadscale - public const uint Sweep = 66794; - public const uint SummonSlimepool = 66883; - public const uint Emerge = 66947; - public const uint Submerge = 66948; - public const uint Enrage = 68335; - public const uint SlimePoolEffect = 66882; //In 60s It Diameter Grows From 10y To 40y (R=R+0.25 Per Second) - public const uint GroundVisual0 = 66969; - public const uint GroundVisual1 = 68302; - public const uint HateToZero = 63984; - //Acidmaw - public const uint AcidSpit = 66880; - public const uint ParalyticSpray = 66901; - public const uint ParalyticBite = 66824; - public const uint AcidSpew = 66819; - public const uint Paralysis = 66830; - public const uint ParalyticToxin = 66823; - //Dreadscale - public const uint BurningBite = 66879; - public const uint MoltenSpew = 66821; - public const uint FireSpit = 66796; - public const uint BurningSpray = 66902; - public const uint BurningBile = 66869; - - //Icehowl - public const uint FerociousButt = 66770; - public const uint MassiveCrash = 66683; - public const uint Whirl = 67345; - public const uint ArcticBreath = 66689; - public const uint Trample = 66734; - public const uint FrothingRage = 66759; - public const uint StaggeredDaze = 66758; - } - - struct Actions - { - public const int EnableFireBomb = 1; - public const int DisableFireBomb = 2; - public const int ActiveSnobold = 3; - } - - struct Events - { - // Snobold - public const uint FireBomb = 1; - public const uint Batter = 2; - public const uint HeadCrack = 3; - public const uint Snobolled = 4; - public const uint CheckMount = 5; - - // Acidmaw & Dreadscale - public const uint Bite = 6; - public const uint Spew = 7; - public const uint SlimePool = 8; - public const uint Spit = 9; - public const uint Spray = 10; - public const uint Sweep = 11; - public const uint Submerge = 12; - public const uint Emerge = 13; - public const uint SummonAcidmaw = 14; - - // Icehowl - public const uint FerociousButt = 15; - public const uint MassiveCrash = 16; - public const uint Whirl = 17; - public const uint ArcticBreath = 18; - public const uint Trample = 19; - } - - public struct Misc - { - public const uint EquipMain = 50760; - public const uint EquipOffhand = 48040; - public const uint EquipRanged = 47267; - public const int EquipDone = -1; - - public const uint ModelAcidmawStationary = 29815; - public const uint ModelAcidmawMobile = 29816; - public const uint ModelDreadscaleStationary = 26935; - public const uint ModelDreadscaleMobile = 24564; - - public const uint MaxSnobolds = 4; - - public const byte PhaseMobile = 1; - public const byte PhaseStationary = 2; - public const byte PhaseSubmerged = 3; - - public const int DataNewTarget = 1; - public const uint GormokHandSeat = 4; - public const uint PlayerVehicleId = 444; - - public const uint NpcSnoboldVassal = 34800; - public const uint NpcFireBomb = 34854; - public const uint NpcSlimePool = 35176; - } - - [Script] - class boss_gormok : BossAI - { - public boss_gormok(Creature creature) : base(creature, DataTypes.BossBeasts) { } - - public override void Reset() - { - _scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting)); - - _scheduler.Schedule(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(10), task => - { - DoCastVictim(SpellIds.Impale); - task.Repeat(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(10)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(15), task => - { - DoCastVictim(SpellIds.StaggeringStomp); - task.Repeat(TimeSpan.FromSeconds(15)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30), task => - { - for (sbyte i = 0; i < Misc.MaxSnobolds; ++i) - { - Unit snobold = me.GetVehicleKit().GetPassenger(i); - if (snobold) - { - snobold.ExitVehicle(); - snobold.RemoveUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - snobold.ToCreature().GetAI().DoAction(Actions.DisableFireBomb); - snobold.CastSpell(me, SpellIds.JumpToHand, true); - break; - } - } - task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30)); - }); - - summons.DespawnAll(); - } - - public override void EnterEvadeMode(EvadeReason why) - { - instance.DoUseDoorOrButton(instance.GetGuidData(GameObjectIds.MainGateDoor)); - base.EnterEvadeMode(why); - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - if (type != MovementGeneratorType.Point) - return; - - switch (id) - { - case 0: - instance.DoUseDoorOrButton(instance.GetGuidData(GameObjectIds.MainGateDoor)); - me.RemoveUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - me.SetReactState(ReactStates.Aggressive); - me.SetInCombatWithZone(); - break; - default: - break; - } - } - - public override void JustDied(Unit killer) - { - instance.SetData(DataTypes.NorthrendBeasts, NorthrendBeasts.GormokDone); - } - - public override void JustReachedHome() - { - instance.DoUseDoorOrButton(instance.GetGuidData(GameObjectIds.MainGateDoor)); - instance.SetData(DataTypes.NorthrendBeasts, (uint)EncounterState.Fail); - - me.DespawnOrUnsummon(); - } - - public override void EnterCombat(Unit who) - { - _EnterCombat(); - instance.SetData(DataTypes.NorthrendBeasts, NorthrendBeasts.GormokInProgress); - } - - public override void DamageTaken(Unit who, ref uint damage) - { - // despawn the remaining passengers on death - if (damage >= me.GetHealth()) - { - for (sbyte i = 0; i < Misc.MaxSnobolds; ++i) - { - Unit snobold = me.GetVehicleKit().GetPassenger(i); - if (snobold) - snobold.ToCreature().DespawnOrUnsummon(); - } - } - } - - public override void PassengerBoarded(Unit passenger, sbyte seatId, bool apply) - { - if (apply && seatId == Misc.GormokHandSeat) - passenger.CastSpell(me, SpellIds.RisingAnger, true); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - DoMeleeAttackIfReady(); - } - } - - class SnobolledTargetSelector : ISelector - { - public SnobolledTargetSelector(Unit unit) { } - - public bool Check(Unit unit) - { - if (unit.GetTypeId() != TypeId.Player) - return false; - - if (unit.HasAura(SpellIds.RidePlayer) || unit.HasAura(SpellIds.Snobolled)) - return false; - - return true; - } - } - - [Script] - class npc_snobold_vassal : ScriptedAI - { - public npc_snobold_vassal(Creature creature) : base(creature) - { - _instance = creature.GetInstanceScript(); - _isActive = false; - _instance.SetData(DataTypes.SnoboldCount, DataTypes.Increase); - SetCombatMovement(false); - } - - public override void Reset() - { - me.AddUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - me.SetInCombatWithZone(); - _events.ScheduleEvent(Events.CheckMount, TimeSpan.FromSeconds(1)); - _events.ScheduleEvent(Events.FireBomb, TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(30)); - } - - public override void JustDied(Unit killer) - { - Unit target = Global.ObjAccessor.GetPlayer(me, _targetGUID); - if (target) - target.RemoveAurasDueToSpell(SpellIds.Snobolled); - _instance.SetData(DataTypes.SnoboldCount, DataTypes.Decrease); - } - - public override void DoAction(int action) - { - switch (action) - { - case Actions.EnableFireBomb: - _events.ScheduleEvent(Events.FireBomb, TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(30)); - break; - case Actions.DisableFireBomb: - _events.CancelEvent(Events.FireBomb); - break; - case Actions.ActiveSnobold: - _isActive = true; - break; - default: - break; - } - } - - public override void SetGUID(ObjectGuid guid, int id = 0) - { - if (id == Misc.DataNewTarget) - { - Unit target = Global.ObjAccessor.GetPlayer(me, guid); - if (target) - { - _targetGUID = guid; - AttackStart(target); - _events.ScheduleEvent(Events.Batter, TimeSpan.FromSeconds(5)); - _events.ScheduleEvent(Events.HeadCrack, TimeSpan.FromSeconds(25)); - _events.ScheduleEvent(Events.Snobolled, TimeSpan.FromMilliseconds(500)); - } - } - } - - public override void AttackStart(Unit target) - { - //Snobold only melee attack players that is your vehicle - if (!_isActive || target.GetGUID() != _targetGUID) - return; - - base.AttackStart(target); - } - - void MountOnBoss() - { - Unit gormok = ObjectAccessor.GetCreature(me, _instance.GetGuidData(CreatureIds.Gormok)); - if (gormok && gormok.IsAlive()) - { - me.AttackStop(); - _targetGUID.Clear(); - _isActive = false; - _events.CancelEvent(Events.Batter); - _events.CancelEvent(Events.HeadCrack); - - for (sbyte i = 0; i < Misc.MaxSnobolds; i++) - { - if (!gormok.GetVehicleKit().GetPassenger(i)) - { - me.EnterVehicle(gormok, i); - DoAction(Actions.EnableFireBomb); - break; - } - } - } - //Without Boss, snobolds should jump in another players - else - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, new SnobolledTargetSelector(me)); - if (target) - me.CastSpell(target, SpellIds.RidePlayer, true); - } - } - - public override void UpdateAI(uint diff) - { - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case Events.FireBomb: - if (me.GetVehicleBase()) - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, -me.GetVehicleBase().GetCombatReach(), true); - if (target) - me.CastSpell(target, SpellIds.FireBomb); - } - _events.Repeat(TimeSpan.FromSeconds(20)); - break; - case Events.HeadCrack: - DoCast(me.GetVehicleBase(), SpellIds.HeadCrack); - _events.Repeat(TimeSpan.FromSeconds(30)); - break; - case Events.Batter: - DoCast(me.GetVehicleBase(), SpellIds.Batter); - _events.Repeat(TimeSpan.FromSeconds(10)); - break; - case Events.Snobolled: - DoCastAOE(SpellIds.Snobolled); - break; - case Events.CheckMount: - if (!me.GetVehicleBase()) - MountOnBoss(); - _events.Repeat(TimeSpan.FromSeconds(1)); - break; - default: - break; - } - - if (me.HasUnitState(UnitState.Casting)) - return; - }); - - - if (!UpdateVictim()) - return; - - // do melee attack only when not on Gormoks back - if (_isActive) - DoMeleeAttackIfReady(); - } - - InstanceScript _instance; - ObjectGuid _targetGUID; - bool _isActive; - } - - [Script] - class npc_firebomb : ScriptedAI - { - public npc_firebomb(Creature creature) : base(creature) - { - _instance = creature.GetInstanceScript(); - } - - public override void Reset() - { - DoCast(me, SpellIds.FireBombDot, true); - SetCombatMovement(false); - me.SetReactState(ReactStates.Passive); - me.SetDisplayFromModel(1); - } - - public override void UpdateAI(uint diff) - { - if (_instance.GetData(DataTypes.NorthrendBeasts) != NorthrendBeasts.GormokInProgress) - me.DespawnOrUnsummon(); - } - - InstanceScript _instance; - } - - class boss_jormungarAI : BossAI - { - public boss_jormungarAI(Creature creature) : base(creature, DataTypes.BossBeasts) - { - Phase = Misc.PhaseMobile; - } - - public override void Reset() - { - Enraged = false; - - _events.ScheduleEvent(Events.Spit, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30), 0, Misc.PhaseStationary); - _events.ScheduleEvent(Events.Spray, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30), 0, Misc.PhaseStationary); - _events.ScheduleEvent(Events.Sweep, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30), 0, Misc.PhaseStationary); - _events.ScheduleEvent(Events.Bite, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30), 0, Misc.PhaseMobile); - _events.ScheduleEvent(Events.Spew, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30), 0, Misc.PhaseMobile); - _events.ScheduleEvent(Events.SlimePool, TimeSpan.FromSeconds(15), 0, Misc.PhaseMobile); - } - - public override void JustDied(Unit killer) - { - Creature otherWorm = ObjectAccessor.GetCreature(me, instance.GetGuidData(OtherWormEntry)); - if (otherWorm) - { - if (!otherWorm.IsAlive()) - { - instance.SetData(DataTypes.NorthrendBeasts, NorthrendBeasts.SnakesDone); - - me.DespawnOrUnsummon(); - otherWorm.DespawnOrUnsummon(); - } - else - instance.SetData(DataTypes.NorthrendBeasts, NorthrendBeasts.SnakesSpecial); - } - } - - public override void JustReachedHome() - { - // prevent losing 2 attempts at once on heroics - if (instance.GetData(DataTypes.NorthrendBeasts) != (uint)EncounterState.Fail) - instance.SetData(DataTypes.NorthrendBeasts, (uint)EncounterState.Fail); - - me.DespawnOrUnsummon(); - } - - public override void EnterCombat(Unit who) - { - _EnterCombat(); - me.SetInCombatWithZone(); - instance.SetData(DataTypes.NorthrendBeasts, NorthrendBeasts.SnakesInProgress); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - if (!Enraged && instance.GetData(DataTypes.NorthrendBeasts) == NorthrendBeasts.SnakesSpecial) - { - me.RemoveAurasDueToSpell(SpellIds.Submerge); - me.RemoveUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - DoCast(SpellIds.Enrage); - Enraged = true; - Talk(TextIds.EmoteEnrage); - } - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case Events.Emerge: - Emerge(); - return; - case Events.Submerge: - Submerge(); - return; - case Events.Bite: - DoCastVictim(BiteSpell); - _events.ScheduleEvent(Events.Bite, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30), 0, Misc.PhaseMobile); - return; - case Events.Spew: - DoCastAOE(SpewSpell); - _events.ScheduleEvent(Events.Spew, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30), 0, Misc.PhaseMobile); - return; - case Events.SlimePool: - DoCast(me, SpellIds.SummonSlimepool); - _events.ScheduleEvent(Events.SlimePool, TimeSpan.FromSeconds(30), 0, Misc.PhaseMobile); - return; - case Events.SummonAcidmaw: - Creature acidmaw = me.SummonCreature(CreatureIds.Acidmaw, MiscData.ToCCommonLoc[9].GetPositionX(), MiscData.ToCCommonLoc[9].GetPositionY(), MiscData.ToCCommonLoc[9].GetPositionZ(), 5, TempSummonType.ManualDespawn); - if (acidmaw) - { - acidmaw.RemoveUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - acidmaw.SetReactState(ReactStates.Aggressive); - acidmaw.SetInCombatWithZone(); - acidmaw.CastSpell(acidmaw, SpellIds.Emerge); - acidmaw.CastSpell(acidmaw, SpellIds.GroundVisual1, true); - } - return; - case Events.Spray: - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true); - if (target) - DoCast(target, SpraySpell); - _events.ScheduleEvent(Events.Spray, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30), 0, Misc.PhaseStationary); - return; - case Events.Sweep: - DoCastAOE(SpellIds.Sweep); - _events.ScheduleEvent(Events.Sweep, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30), 0, Misc.PhaseStationary); - return; - default: - return; - } - }); - - if (_events.IsInPhase(Misc.PhaseMobile)) - DoMeleeAttackIfReady(); - if (_events.IsInPhase(Misc.PhaseStationary)) - DoCastVictim(SpitSpell); - } - - void Submerge() - { - DoCast(me, SpellIds.Submerge); - DoCast(me, SpellIds.GroundVisual0, true); - me.RemoveAurasDueToSpell(SpellIds.Emerge); - me.SetInCombatWithZone(); - _events.SetPhase(Misc.PhaseSubmerged); - _events.ScheduleEvent(Events.Emerge, TimeSpan.FromSeconds(5), 0, Misc.PhaseSubmerged); - me.AddUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - me.GetMotionMaster().MovePoint(0, MiscData.ToCCommonLoc[1].GetPositionX() + RandomHelper.FRand(-40.0f, 40.0f), MiscData.ToCCommonLoc[1].GetPositionY() + RandomHelper.FRand(-40.0f, 40.0f), MiscData.ToCCommonLoc[1].GetPositionZ()); - WasMobile = !WasMobile; - } - - public void Emerge() - { - DoCast(me, SpellIds.Emerge); - DoCastAOE(SpellIds.HateToZero, true); - me.SetDisplayId(ModelMobile); - me.RemoveAurasDueToSpell(SpellIds.Submerge); - me.RemoveAurasDueToSpell(SpellIds.GroundVisual0); - me.RemoveUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - - // if the worm was mobile before submerging, make him stationary now - if (WasMobile) - { - me.SetControlled(true, UnitState.Root); - SetCombatMovement(false); - me.SetDisplayId(ModelStationary); - me.CastSpell(me, SpellIds.GroundVisual1, true); - _events.SetPhase(Misc.PhaseStationary); - _events.ScheduleEvent(Events.Submerge, TimeSpan.FromSeconds(45), 0, Misc.PhaseStationary); - _events.ScheduleEvent(Events.Spit, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30), 0, Misc.PhaseStationary); - _events.ScheduleEvent(Events.Spray, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30), 0, Misc.PhaseStationary); - _events.ScheduleEvent(Events.Sweep, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30), 0, Misc.PhaseStationary); - } - else - { - me.SetControlled(false, UnitState.Root); - SetCombatMovement(true); - me.GetMotionMaster().MoveChase(me.GetVictim()); - me.SetDisplayId(ModelMobile); - _events.SetPhase(Misc.PhaseMobile); - _events.ScheduleEvent(Events.Submerge, TimeSpan.FromSeconds(45), 0, Misc.PhaseMobile); - _events.ScheduleEvent(Events.Bite, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30), 0, Misc.PhaseMobile); - _events.ScheduleEvent(Events.Spew, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30), 0, Misc.PhaseMobile); - _events.ScheduleEvent(Events.SlimePool, TimeSpan.FromSeconds(15), 0, Misc.PhaseMobile); - } - } - - protected uint OtherWormEntry; - protected uint ModelStationary; - protected uint ModelMobile; - - protected uint BiteSpell; - protected uint SpewSpell; - protected uint SpitSpell; - protected uint SpraySpell; - - protected uint Phase; - protected bool Enraged; - protected bool WasMobile; - } - - [Script] - class boss_acidmaw : boss_jormungarAI - { - public boss_acidmaw(Creature creature) : base(creature) { } - - public override void Reset() - { - base.Reset(); - BiteSpell = SpellIds.ParalyticBite; - SpewSpell = SpellIds.AcidSpew; - SpitSpell = SpellIds.AcidSpit; - SpraySpell = SpellIds.ParalyticSpray; - ModelStationary = Misc.ModelAcidmawStationary; - ModelMobile = Misc.ModelAcidmawMobile; - OtherWormEntry = CreatureIds.Dreadscale; - - WasMobile = true; - Emerge(); - } - } - - [Script] - class boss_dreadscale : boss_jormungarAI - { - public boss_dreadscale(Creature creature) : base(creature) { } - - public override void Reset() - { - base.Reset(); - BiteSpell = SpellIds.BurningBite; - SpewSpell = SpellIds.MoltenSpew; - SpitSpell = SpellIds.FireSpit; - SpraySpell = SpellIds.BurningSpray; - ModelStationary = Misc.ModelDreadscaleStationary; - ModelMobile = Misc.ModelDreadscaleMobile; - OtherWormEntry = CreatureIds.Acidmaw; - - _events.SetPhase(Misc.PhaseMobile); - _events.ScheduleEvent(Events.SummonAcidmaw, TimeSpan.FromSeconds(3)); - _events.ScheduleEvent(Events.Submerge, TimeSpan.FromSeconds(45), 0, Misc.PhaseMobile); - WasMobile = false; - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - if (type != MovementGeneratorType.Point) - return; - - switch (id) - { - case 0: - instance.DoUseDoorOrButton(instance.GetGuidData(GameObjectIds.MainGateDoor)); - me.RemoveUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - me.SetReactState(ReactStates.Aggressive); - me.SetInCombatWithZone(); - break; - default: - break; - } - } - - public override void EnterEvadeMode(EvadeReason why) - { - instance.DoUseDoorOrButton(instance.GetGuidData(GameObjectIds.MainGateDoor)); - base.EnterEvadeMode(why); - } - - public override void JustReachedHome() - { - instance.DoUseDoorOrButton(instance.GetGuidData(GameObjectIds.MainGateDoor)); - - base.JustReachedHome(); - } - } - - [Script] - class npc_slime_pool : ScriptedAI - { - public npc_slime_pool(Creature creature) : base(creature) - { - _instance = creature.GetInstanceScript(); - } - - public override void Reset() - { - _cast = false; - me.SetReactState(ReactStates.Passive); - } - - public override void UpdateAI(uint diff) - { - if (!_cast) - { - _cast = true; - DoCast(me, SpellIds.SlimePoolEffect); - } - - if (_instance.GetData(DataTypes.NorthrendBeasts) != NorthrendBeasts.SnakesInProgress && _instance.GetData(DataTypes.NorthrendBeasts) != NorthrendBeasts.SnakesSpecial) - me.DespawnOrUnsummon(); - } - - InstanceScript _instance; - bool _cast; - - } - - [Script] - class spell_gormok_fire_bomb : SpellScript - { - void TriggerFireBomb(uint effIndex) - { - Position pos = GetExplTargetDest(); - if (pos != null) - { - Unit caster = GetCaster(); - if (caster) - caster.SummonCreature(Misc.NpcFireBomb, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), 0, TempSummonType.TimedDespawn, 30 * Time.InMilliseconds); - } - } - - public override void Register() - { - OnEffectHit.Add(new EffectHandler(TriggerFireBomb, 0, SpellEffectName.TriggerMissile)); - } - } - - [Script] - class boss_icehowl : BossAI - { - public boss_icehowl(Creature creature) : base(creature, DataTypes.BossBeasts) { } - - public override void Reset() - { - _movementStarted = false; - _movementFinish = false; - _trampleCast = false; - _trampleTargetGUID.Clear(); - _trampleTargetX = 0; - _trampleTargetY = 0; - _trampleTargetZ = 0; - _stage = 0; - - _events.ScheduleEvent(Events.FerociousButt, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30)); - _events.ScheduleEvent(Events.ArcticBreath, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(25)); - _events.ScheduleEvent(Events.Whirl, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30)); - _events.ScheduleEvent(Events.MassiveCrash, TimeSpan.FromSeconds(30)); - } - - public override void JustDied(Unit killer) - { - _JustDied(); - instance.SetData(DataTypes.NorthrendBeasts, NorthrendBeasts.IcehowlDone); - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - if (type != MovementGeneratorType.Point && type != MovementGeneratorType.Effect) - return; - - switch (id) - { - case 0: - if (_stage != 0) - { - if (me.GetDistance2d(MiscData.ToCCommonLoc[1].GetPositionX(), MiscData.ToCCommonLoc[1].GetPositionY()) < 6.0f) - // Middle of the room - _stage = 1; - else - { - // Landed from Hop backwards (start trample) - if (Global.ObjAccessor.GetPlayer(me, _trampleTargetGUID)) - _stage = 4; - else - _stage = 6; - } - } - break; - case 1: // Finish trample - _movementFinish = true; - break; - case 2: - instance.DoUseDoorOrButton(instance.GetGuidData(GameObjectIds.MainGateDoor)); - me.RemoveUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - me.SetReactState(ReactStates.Aggressive); - me.SetInCombatWithZone(); - break; - default: - break; - } - } - - public override void EnterEvadeMode(EvadeReason why) - { - instance.DoUseDoorOrButton(instance.GetGuidData(GameObjectIds.MainGateDoor)); - base.EnterEvadeMode(why); - } - - public override void JustReachedHome() - { - instance.DoUseDoorOrButton(instance.GetGuidData(GameObjectIds.MainGateDoor)); - instance.SetData(DataTypes.NorthrendBeasts, (uint)EncounterState.Fail); - me.DespawnOrUnsummon(); - } - - public override void EnterCombat(Unit who) - { - _EnterCombat(); - instance.SetData(DataTypes.NorthrendBeasts, NorthrendBeasts.IcehowlInProgress); - } - - public override void SpellHitTarget(Unit target, SpellInfo spell) - { - if (spell.Id == SpellIds.Trample && target.IsTypeId(TypeId.Player)) - { - if (!_trampleCast) - { - DoCast(me, SpellIds.FrothingRage, true); - _trampleCast = true; - } - } - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - switch (_stage) - { - case 0: - { - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case Events.FerociousButt: - DoCastVictim(SpellIds.FerociousButt); - _events.ScheduleEvent(Events.FerociousButt, RandomHelper.URand(15 * Time.InMilliseconds, 30 * Time.InMilliseconds)); - return; - case Events.ArcticBreath: - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true); - if (target) - DoCast(target, SpellIds.ArcticBreath); - return; - case Events.Whirl: - DoCastAOE(SpellIds.Whirl); - _events.ScheduleEvent(Events.Whirl, RandomHelper.URand(15 * Time.InMilliseconds, 30 * Time.InMilliseconds)); - return; - case Events.MassiveCrash: - me.GetMotionMaster().MoveJump(MiscData.ToCCommonLoc[1], 20.0f, 20.0f, 0); // 1: Middle of the room - SetCombatMovement(false); - me.AttackStop(); - _stage = 7; //Invalid (Do nothing more than move) - return; - default: - break; - } - - if (me.HasUnitState(UnitState.Casting)) - return; - }); - DoMeleeAttackIfReady(); - break; - } - case 1: - DoCastAOE(SpellIds.MassiveCrash); - me.StopMoving(); - me.AttackStop(); - _stage = 2; - break; - case 2: - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true); - if (target) - { - me.StopMoving(); - me.AttackStop(); - _trampleTargetGUID = target.GetGUID(); - me.SetTarget(_trampleTargetGUID); - _trampleCast = false; - SetCombatMovement(false); - me.AddUnitFlag(UnitFlags.NonAttackable); - me.SetControlled(true, UnitState.Root); - me.GetMotionMaster().Clear(); - me.GetMotionMaster().MoveIdle(); - _events.ScheduleEvent(Events.Trample, TimeSpan.FromSeconds(4)); - _stage = 3; - } - else - _stage = 6; - break; - } - case 3: - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case Events.Trample: - { - Unit target = Global.ObjAccessor.GetPlayer(me, _trampleTargetGUID); - if (target) - { - me.StopMoving(); - me.AttackStop(); - _trampleCast = false; - _trampleTargetX = target.GetPositionX(); - _trampleTargetY = target.GetPositionY(); - _trampleTargetZ = target.GetPositionZ(); - // 2: Hop Backwards - me.GetMotionMaster().MoveJump(2 * me.GetPositionX() - _trampleTargetX, 2 * me.GetPositionY() - _trampleTargetY, me.GetPositionZ(), me.GetOrientation(), 30.0f, 20.0f, 0); - me.SetControlled(false, UnitState.Root); - _stage = 7; //Invalid (Do nothing more than move) - } - else - _stage = 6; - break; - } - default: - break; - } - }); - break; - case 4: - { - me.StopMoving(); - me.AttackStop(); - - Player target = Global.ObjAccessor.GetPlayer(me, _trampleTargetGUID); - if (target) - Talk(TextIds.EmoteTrampleStart, target); - - me.GetMotionMaster().MoveCharge(_trampleTargetX, _trampleTargetY, _trampleTargetZ, 42, 1); - me.SetTarget(ObjectGuid.Empty); - _stage = 5; - break; - } - case 5: - if (_movementFinish) - { - DoCastAOE(SpellIds.Trample); - _movementFinish = false; - _stage = 6; - return; - } - if (_events.ExecuteEvent() == Events.Trample) - { - var lPlayers = me.GetMap().GetPlayers(); - foreach (var player in lPlayers) - { - if (player.IsAlive() && player.IsWithinDistInMap(me, 6.0f)) - { - DoCastAOE(SpellIds.Trample); - _events.ScheduleEvent(Events.Trample, TimeSpan.FromSeconds(4)); - break; - } - } - } - break; - case 6: - if (!_trampleCast) - { - DoCast(me, SpellIds.StaggeredDaze); - Talk(TextIds.EmoteTrampleCrash); - } - else - { - DoCast(me, SpellIds.FrothingRage, true); - Talk(TextIds.EmoteTrampleFail); - } - _movementStarted = false; - me.RemoveUnitFlag(UnitFlags.NonAttackable); - SetCombatMovement(true); - me.GetMotionMaster().MovementExpired(); - me.GetMotionMaster().Clear(); - me.GetMotionMaster().MoveChase(me.GetVictim()); - AttackStart(me.GetVictim()); - _events.ScheduleEvent(Events.MassiveCrash, TimeSpan.FromSeconds(40)); - _events.ScheduleEvent(Events.ArcticBreath, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(25)); - _stage = 0; - break; - default: - break; - } - } - - float _trampleTargetX, _trampleTargetY, _trampleTargetZ; - ObjectGuid _trampleTargetGUID; - bool _movementStarted; - bool _movementFinish; - bool _trampleCast; - byte _stage; - } - - [Script] - class spell_gormok_jump_to_hand : AuraScript - { - public override bool Validate(SpellInfo spellInfo) - { - return ValidateSpellInfo(SpellIds.RidePlayer); - } - - public override bool Load() - { - if (GetCaster() && GetCaster().GetEntry() == Misc.NpcSnoboldVassal) - return true; - return false; - } - - void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Unit caster = GetCaster(); - if (caster) - { - CreatureAI gormokAI = GetTarget().ToCreature().GetAI(); - if (gormokAI != null) - { - Unit target = gormokAI.SelectTarget(SelectAggroTarget.Random, 0, new SnobolledTargetSelector(GetTarget())); - if (target) - { - gormokAI.Talk(TextIds.EmoteSnobolled); - caster.GetAI().DoAction(Actions.ActiveSnobold); - caster.CastSpell(target, SpellIds.RidePlayer, true); - } - } - } - } - - public override void Register() - { - AfterEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.ControlVehicle, AuraEffectHandleModes.Real)); - } - } - - [Script] - class spell_gormok_ride_player : AuraScript - { - public override bool Load() - { - if (GetCaster() && GetCaster().GetEntry() == Misc.NpcSnoboldVassal) - return true; - return false; - } - - void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Unit target = GetTarget(); - if (target.GetTypeId() != TypeId.Player || !target.IsInWorld) - return; - - if (!target.CreateVehicleKit(Misc.PlayerVehicleId, 0)) - return; - - Unit caster = GetCaster(); - if (caster) - caster.GetAI().SetGUID(target.GetGUID(), Misc.DataNewTarget); - } - - void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode) - { - GetTarget().RemoveVehicleKit(); - } - - public override void Register() - { - OnEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.ControlVehicle, AuraEffectHandleModes.Real)); - AfterEffectRemove.Add(new EffectApplyHandler(AfterRemove, 0, AuraType.ControlVehicle, AuraEffectHandleModes.Real)); - } - } - - [Script] - class spell_gormok_snobolled : AuraScript - { - public override bool Validate(SpellInfo spellInfo) - { - return ValidateSpellInfo(SpellIds.RidePlayer); - } - - void OnPeriodic(AuraEffect aurEff) - { - if (!GetTarget().HasAura(SpellIds.RidePlayer)) - Remove(); - } - - public override void Register() - { - OnEffectPeriodic.Add(new EffectPeriodicHandler(OnPeriodic, 0, AuraType.PeriodicDummy)); - } - } - - [Script] - class spell_jormungars_paralytic_toxin : AuraScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(SpellIds.Paralysis); - } - - void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Unit caster = GetCaster(); - if (caster && caster.GetEntry() == CreatureIds.Acidmaw) - { - Creature acidMaw = caster.ToCreature(); - if (acidMaw) - acidMaw.GetAI().Talk(TextIds.SaySpecial, GetTarget()); - } - } - - void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode) - { - GetTarget().RemoveAurasDueToSpell(SpellIds.Paralysis); - } - - void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated) - { - if (!canBeRecalculated) - amount = aurEff.GetAmount(); - - canBeRecalculated = false; - } - - void HandleDummy(AuraEffect aurEff) - { - AuraEffect slowEff = GetEffect(0); - if (slowEff != null) - { - int newAmount = slowEff.GetAmount() - 10; - if (newAmount < -100) - newAmount = -100; - slowEff.ChangeAmount(newAmount); - - if (newAmount <= -100 && !GetTarget().HasAura(SpellIds.Paralysis)) - GetTarget().CastSpell(GetTarget(), SpellIds.Paralysis, true, null, slowEff, GetCasterGUID()); - } - } - - public override void Register() - { - AfterEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.ModDecreaseSpeed, AuraEffectHandleModes.Real)); - AfterEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.ModDecreaseSpeed, AuraEffectHandleModes.Real)); - DoEffectCalcAmount.Add(new EffectCalcAmountHandler(CalculateAmount, 0, AuraType.ModDecreaseSpeed)); - OnEffectPeriodic.Add(new EffectPeriodicHandler(HandleDummy, 2, AuraType.PeriodicDummy)); - } - } - - [Script("spell_jormungars_burning_spray", SpellIds.BurningBile)] - [Script("spell_jormungars_paralytic_spray", SpellIds.ParalyticToxin)] - class spell_jormungars_snakes_spray : SpellScript - { - public spell_jormungars_snakes_spray(uint spellId) - { - _spellId = spellId; - } - - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(_spellId); - } - - void HandleScript(uint effIndex) - { - Player target = GetHitPlayer(); - if (target) - GetCaster().CastSpell(target, _spellId, true); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.SchoolDamage)); - } - - uint _spellId; - } - - [Script] - class spell_jormungars_paralysis : AuraScript - { - void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Unit caster = GetCaster(); - if (caster) - { - InstanceScript instance = caster.GetInstanceScript(); - if (instance != null) - if (instance.GetData(DataTypes.NorthrendBeasts) == NorthrendBeasts.SnakesInProgress || instance.GetData(DataTypes.NorthrendBeasts) == NorthrendBeasts.SnakesSpecial) - return; - } - - Remove(); - } - - public override void Register() - { - AfterEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.ModStun, AuraEffectHandleModes.Real)); - } - } -} diff --git a/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/TrialOfTheCrusader.cs b/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/TrialOfTheCrusader.cs deleted file mode 100644 index 8f9e55e79..000000000 --- a/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/TrialOfTheCrusader.cs +++ /dev/null @@ -1,1655 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Framework.GameMath; -using Framework.IO; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using System.Linq; - -namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheCrusader -{ - [Script] - class instance_trial_of_the_crusader : InstanceMapScript - { - public instance_trial_of_the_crusader() : base("instance_trial_of_the_crusader", 649) { } - - class instance_trial_of_the_crusader_InstanceMapScript : InstanceScript - { - public instance_trial_of_the_crusader_InstanceMapScript(InstanceMap map) : base(map) - { - SetHeaders("TCR"); - SetBossNumber(DataTypes.MaxEncounters); - LoadBossBoundaries(MiscData.boundaries); - TrialCounter = 50; - EventStage = 0; - northrendBeasts = EncounterState.NotStarted; - EventTimer = 1000; - NotOneButTwoJormungarsTimer = 0; - ResilienceWillFixItTimer = 0; - SnoboldCount = 0; - MistressOfPainCount = 0; - TributeToImmortalityEligible = true; - NeedSave = false; - } - - public override bool IsEncounterInProgress() - { - for (byte i = 0; i < DataTypes.MaxEncounters; ++i) - if (GetBossState(i) == EncounterState.InProgress) - return true; - - // Special state is set at Faction Champions after first champ dead, encounter is still in combat - if (GetBossState(DataTypes.BossCrusaders) == EncounterState.Special) - return true; - - return false; - } - - public override void OnPlayerEnter(Player player) - { - if (instance.IsHeroic()) - { - player.SendUpdateWorldState(WorldStateIds.Show, 1); - player.SendUpdateWorldState(WorldStateIds.Count, GetData(DataTypes.Counter)); - } - else - player.SendUpdateWorldState(WorldStateIds.Show, 0); - - // make sure Anub'arak isnt missing and floor is destroyed after a crash - if (GetBossState(DataTypes.BossLichKing) == EncounterState.Done && TrialCounter != 0 && GetBossState(DataTypes.BossAnubarak) != EncounterState.Done) - { - Creature anubArak = ObjectAccessor.GetCreature(player, GetGuidData(CreatureIds.Anubarak)); - if (!anubArak) - anubArak = player.SummonCreature(CreatureIds.Anubarak, MiscData.AnubarakLoc[0].GetPositionX(), MiscData.AnubarakLoc[0].GetPositionY(), MiscData.AnubarakLoc[0].GetPositionZ(), 3, TempSummonType.CorpseTimedDespawn, MiscData.DespawnTime); - - GameObject floor = ObjectAccessor.GetGameObject(player, GetGuidData(GameObjectIds.ArgentColiseumFloor)); - if (floor) - floor.SetDestructibleState(GameObjectDestructibleState.Damaged); - } - } - - void OpenDoor(ObjectGuid guid) - { - if (guid.IsEmpty()) - return; - - GameObject go = instance.GetGameObject(guid); - if (go) - go.SetGoState(GameObjectState.ActiveAlternative); - } - - void CloseDoor(ObjectGuid guid) - { - if (guid.IsEmpty()) - return; - - GameObject go = instance.GetGameObject(guid); - if (go) - go.SetGoState(GameObjectState.Ready); - } - - public override void OnCreatureCreate(Creature creature) - { - switch (creature.GetEntry()) - { - case CreatureIds.Barrent: - BarrentGUID = creature.GetGUID(); - if (TrialCounter == 0) - creature.DespawnOrUnsummon(); - break; - case CreatureIds.Tirion: - TirionGUID = creature.GetGUID(); - break; - case CreatureIds.TirionFordring: - TirionFordringGUID = creature.GetGUID(); - break; - case CreatureIds.Fizzlebang: - FizzlebangGUID = creature.GetGUID(); - break; - case CreatureIds.Garrosh: - GarroshGUID = creature.GetGUID(); - break; - case CreatureIds.Varian: - VarianGUID = creature.GetGUID(); - break; - case CreatureIds.Gormok: - GormokGUID = creature.GetGUID(); - break; - case CreatureIds.Acidmaw: - AcidmawGUID = creature.GetGUID(); - break; - case CreatureIds.Dreadscale: - DreadscaleGUID = creature.GetGUID(); - break; - case CreatureIds.Icehowl: - IcehowlGUID = creature.GetGUID(); - break; - case CreatureIds.Jaraxxus: - JaraxxusGUID = creature.GetGUID(); - break; - case CreatureIds.ChampionsController: - ChampionsControllerGUID = creature.GetGUID(); - break; - case CreatureIds.Darkbane: - DarkbaneGUID = creature.GetGUID(); - break; - case CreatureIds.Lightbane: - LightbaneGUID = creature.GetGUID(); - break; - case CreatureIds.Anubarak: - AnubarakGUID = creature.GetGUID(); - break; - default: - break; - } - } - - public override void OnGameObjectCreate(GameObject go) - { - switch (go.GetEntry()) - { - case GameObjectIds.CrusadersCache10: - if (instance.GetDifficultyID() == Difficulty.Raid10N) - CrusadersCacheGUID = go.GetGUID(); - break; - case GameObjectIds.CrusadersCache25: - if (instance.GetDifficultyID() == Difficulty.Raid25N) - CrusadersCacheGUID = go.GetGUID(); - break; - case GameObjectIds.CrusadersCache10H: - if (instance.GetDifficultyID() == Difficulty.Raid10HC) - CrusadersCacheGUID = go.GetGUID(); - break; - case GameObjectIds.CrusadersCache25H: - if (instance.GetDifficultyID() == Difficulty.Raid25HC) - CrusadersCacheGUID = go.GetGUID(); - break; - case GameObjectIds.ArgentColiseumFloor: - FloorGUID = go.GetGUID(); - break; - case GameObjectIds.MainGateDoor: - MainGateDoorGUID = go.GetGUID(); - break; - case GameObjectIds.EastPortcullis: - EastPortcullisGUID = go.GetGUID(); - break; - case GameObjectIds.WebDoor: - WebDoorGUID = go.GetGUID(); - break; - - case GameObjectIds.TributeChest10h25: - case GameObjectIds.TributeChest10h45: - case GameObjectIds.TributeChest10h50: - case GameObjectIds.TributeChest10h99: - case GameObjectIds.TributeChest25h25: - case GameObjectIds.TributeChest25h45: - case GameObjectIds.TributeChest25h50: - case GameObjectIds.TributeChest25h99: - TributeChestGUID = go.GetGUID(); - break; - default: - break; - } - } - - public override bool SetBossState(uint type, EncounterState state) - { - if (!base.SetBossState(type, state)) - return false; - - switch (type) - { - case DataTypes.BossBeasts: - break; - case DataTypes.BossJaraxxus: - // Cleanup Icehowl - Creature icehowl = instance.GetCreature(IcehowlGUID); - if (icehowl) - icehowl.DespawnOrUnsummon(); - if (state == EncounterState.Done) - EventStage = 2000; - break; - case DataTypes.BossCrusaders: - { - // Cleanup Jaraxxus - Creature jaraxxus = instance.GetCreature(JaraxxusGUID); - if (jaraxxus) - jaraxxus.DespawnOrUnsummon(); - - Creature fizzlebang = instance.GetCreature(FizzlebangGUID); - if (fizzlebang) - fizzlebang.DespawnOrUnsummon(); - - switch (state) - { - case EncounterState.InProgress: - ResilienceWillFixItTimer = 0; - break; - case EncounterState.Special: //Means the first blood - ResilienceWillFixItTimer = 60 * Time.InMilliseconds; - state = EncounterState.InProgress; - break; - case EncounterState.Done: - DoUpdateCriteria(CriteriaTypes.BeSpellTarget, AchievementData.SpellDefeatFactionChampions); - if (ResilienceWillFixItTimer > 0) - DoUpdateCriteria(CriteriaTypes.BeSpellTarget, AchievementData.SpellChampionsKilledInMinute); - DoRespawnGameObject(CrusadersCacheGUID, 7 * Time.Day); - - GameObject cache = instance.GetGameObject(CrusadersCacheGUID); - if (cache) - cache.RemoveFlag(GameObjectFlags.NotSelectable); - EventStage = 3100; - break; - default: - break; - } - break; - } - case DataTypes.BossValkiries: - { - // Cleanup chest - GameObject cache = instance.GetGameObject(CrusadersCacheGUID); - if (cache) - cache.Delete(); - switch (state) - { - case EncounterState.Fail: - if (GetBossState(DataTypes.BossValkiries) == EncounterState.NotStarted) - state = EncounterState.NotStarted; - break; - case EncounterState.Special: - if (GetBossState(DataTypes.BossValkiries) == EncounterState.Special) - state = EncounterState.Done; - break; - case EncounterState.Done: - if (instance.GetPlayers()[0].GetTeam() == Team.Alliance) - EventStage = 4020; - else - EventStage = 4030; - break; - default: - break; - } - break; - } - case DataTypes.BossLichKing: - break; - case DataTypes.BossAnubarak: - switch (state) - { - case EncounterState.Done: - { - EventStage = 6000; - uint tributeChest = 0; - if (instance.GetDifficultyID() == Difficulty.Raid10HC) - { - if (TrialCounter >= 50) - tributeChest = GameObjectIds.TributeChest10h99; - else - { - if (TrialCounter >= 45) - tributeChest = GameObjectIds.TributeChest10h50; - else - { - if (TrialCounter >= 25) - tributeChest = GameObjectIds.TributeChest10h45; - else - tributeChest = GameObjectIds.TributeChest10h25; - } - } - } - else if (instance.GetDifficultyID() == Difficulty.Raid25HC) - { - if (TrialCounter >= 50) - tributeChest = GameObjectIds.TributeChest25h99; - else - { - if (TrialCounter >= 45) - tributeChest = GameObjectIds.TributeChest25h50; - else - { - if (TrialCounter >= 25) - tributeChest = GameObjectIds.TributeChest25h45; - else - tributeChest = GameObjectIds.TributeChest25h25; - } - } - } - - if (tributeChest != 0) - { - Creature tirion = instance.GetCreature(TirionGUID); - if (tirion) - { - GameObject chest = tirion.SummonGameObject(tributeChest, 805.62f, 134.87f, 142.16f, 3.27f, Quaternion.fromEulerAnglesZYX(3.27f, 0.0f, 0.0f), Time.Week); - if (chest) - chest.SetRespawnTime((int)chest.GetRespawnDelay()); - } - } - break; - } - default: - break; - } - break; - default: - break; - } - - if (IsEncounterInProgress()) - { - CloseDoor(GetGuidData(GameObjectIds.EastPortcullis)); - CloseDoor(GetGuidData(GameObjectIds.WebDoor)); - } - else - { - OpenDoor(GetGuidData(GameObjectIds.EastPortcullis)); - OpenDoor(GetGuidData(GameObjectIds.WebDoor)); - } - - if (type < DataTypes.MaxEncounters) - { - Log.outInfo(LogFilter.Scripts, "[ToCr] BossState(type {0}) {1} = state {2};", type, GetBossState(type), state); - if (state == EncounterState.Fail) - { - if (instance.IsHeroic()) - { - --TrialCounter; - // decrease attempt counter at wipe - var PlayerList = instance.GetPlayers(); - foreach (var player in PlayerList) - player.SendUpdateWorldState(WorldStateIds.Count, TrialCounter); - - // if theres no more attemps allowed - if (TrialCounter == 0) - { - Unit announcer = instance.GetCreature(GetGuidData(CreatureIds.Barrent)); - if (announcer) - announcer.ToCreature().DespawnOrUnsummon(); - - Creature anubArak = instance.GetCreature(GetGuidData(CreatureIds.Anubarak)); - if (anubArak) - anubArak.DespawnOrUnsummon(); - } - } - NeedSave = true; - EventStage = (uint)(type == DataTypes.BossBeasts ? 666 : 0); - state = EncounterState.NotStarted; - } - - if (state == EncounterState.Done || NeedSave) - { - Unit announcer = instance.GetCreature(GetGuidData(CreatureIds.Barrent)); - if (announcer) - announcer.AddNpcFlag(NPCFlags.Gossip); - Save(); - } - } - return true; - } - - public override void SetData(uint type, uint data) - { - switch (type) - { - case DataTypes.Counter: - TrialCounter = data; - data = (uint)EncounterState.Done; - break; - case DataTypes.Event: - EventStage = data; - data = (uint)EncounterState.NotStarted; - break; - case DataTypes.EventTimer: - EventTimer = data; - data = (uint)EncounterState.NotStarted; - break; - case DataTypes.NorthrendBeasts: - northrendBeasts = (EncounterState)data; - switch (data) - { - case NorthrendBeasts.GormokDone: - EventStage = 200; - SetData(DataTypes.NorthrendBeasts, (uint)EncounterState.InProgress); - break; - case NorthrendBeasts.SnakesInProgress: - NotOneButTwoJormungarsTimer = 0; - break; - case NorthrendBeasts.SnakesSpecial: - NotOneButTwoJormungarsTimer = 10 * Time.InMilliseconds; - break; - case NorthrendBeasts.SnakesDone: - if (NotOneButTwoJormungarsTimer > 0) - DoUpdateCriteria(CriteriaTypes.BeSpellTarget, AchievementData.SpellWormsKilledIn10Seconds); - EventStage = 300; - SetData(DataTypes.NorthrendBeasts, (uint)EncounterState.InProgress); - break; - case NorthrendBeasts.IcehowlDone: - EventStage = 400; - SetData(DataTypes.NorthrendBeasts, (uint)EncounterState.Done); - SetBossState(DataTypes.BossBeasts, EncounterState.Done); - break; - case (uint)EncounterState.Fail: - SetBossState(DataTypes.BossBeasts, EncounterState.Fail); - break; - default: - break; - } - break; - //Achievements - case DataTypes.SnoboldCount: - if (data == DataTypes.Increase) - ++SnoboldCount; - else if (data == DataTypes.Decrease) - --SnoboldCount; - break; - case DataTypes.MistressOfPainCount: - if (data == DataTypes.Increase) - ++MistressOfPainCount; - else if (data == DataTypes.Decrease) - --MistressOfPainCount; - break; - case DataTypes.TributeToImmortalityEligible: - TributeToImmortalityEligible = false; - break; - default: - break; - } - } - - public override ObjectGuid GetGuidData(uint type) - { - switch (type) - { - case CreatureIds.Barrent: - return BarrentGUID; - case CreatureIds.Tirion: - return TirionGUID; - case CreatureIds.TirionFordring: - return TirionFordringGUID; - case CreatureIds.Fizzlebang: - return FizzlebangGUID; - case CreatureIds.Garrosh: - return GarroshGUID; - case CreatureIds.Varian: - return VarianGUID; - case CreatureIds.Gormok: - return GormokGUID; - case CreatureIds.Acidmaw: - return AcidmawGUID; - case CreatureIds.Dreadscale: - return DreadscaleGUID; - case CreatureIds.Icehowl: - return IcehowlGUID; - case CreatureIds.Jaraxxus: - return JaraxxusGUID; - case CreatureIds.ChampionsController: - return ChampionsControllerGUID; - case CreatureIds.Darkbane: - return DarkbaneGUID; - case CreatureIds.Lightbane: - return LightbaneGUID; - case CreatureIds.Anubarak: - return AnubarakGUID; - case GameObjectIds.ArgentColiseumFloor: - return FloorGUID; - case GameObjectIds.MainGateDoor: - return MainGateDoorGUID; - case GameObjectIds.EastPortcullis: - return EastPortcullisGUID; - case GameObjectIds.WebDoor: - return WebDoorGUID; - default: - break; - } - - return ObjectGuid.Empty; - } - - public override uint GetData(uint type) - { - switch (type) - { - case DataTypes.Counter: - return TrialCounter; - case DataTypes.Event: - return EventStage; - case DataTypes.NorthrendBeasts: - return (uint)northrendBeasts; - case DataTypes.EventTimer: - return EventTimer; - case DataTypes.EventNpc: - switch (EventStage) - { - case 110: - case 140: - case 150: - case 155: - case 200: - case 205: - case 210: - case 220: - case 300: - case 305: - case 310: - case 315: - case 400: - case 666: - case 1010: - case 1180: - case 2000: - case 2030: - case 3000: - case 3001: - case 3060: - case 3061: - case 3090: - case 3091: - case 3092: - case 3100: - case 3110: - case 4000: - case 4010: - case 4015: - case 4016: - case 4040: - case 4050: - case 5000: - case 5005: - case 5020: - case 6000: - case 6005: - case 6010: - return CreatureIds.Tirion; - case 5010: - case 5030: - case 5040: - case 5050: - case 5060: - case 5070: - case 5080: - return CreatureIds.LichKing; - case 120: - case 122: - case 2020: - case 3080: - case 3051: - case 3071: - case 4020: - return CreatureIds.Varian; - case 130: - case 132: - case 2010: - case 3050: - case 3070: - case 3081: - case 4030: - return CreatureIds.Garrosh; - case 1110: - case 1120: - case 1130: - case 1132: - case 1134: - case 1135: - case 1140: - case 1142: - case 1144: - case 1150: - return CreatureIds.Fizzlebang; - default: - return CreatureIds.Tirion; - } - default: - break; - } - - return 0; - } - - public override void Update(uint diff) - { - if (GetData(DataTypes.NorthrendBeasts) == NorthrendBeasts.SnakesSpecial && NotOneButTwoJormungarsTimer != 0) - { - if (NotOneButTwoJormungarsTimer <= diff) - NotOneButTwoJormungarsTimer = 0; - else - NotOneButTwoJormungarsTimer -= diff; - } - - if (GetBossState(DataTypes.BossCrusaders) == EncounterState.Special && ResilienceWillFixItTimer != 0) - { - if (ResilienceWillFixItTimer <= diff) - ResilienceWillFixItTimer = 0; - else - ResilienceWillFixItTimer -= diff; - } - } - - void Save() - { - OUT_SAVE_INST_DATA(); - - string saveStream = ""; - - for (byte i = 0; i < DataTypes.MaxEncounters; ++i) - saveStream += GetBossState(i) + ' '; - - saveStream += TrialCounter; - SaveDataBuffer = saveStream; - - SaveToDB(); - OUT_SAVE_INST_DATA_COMPLETE(); - NeedSave = false; - } - - public override string GetSaveData() - { - return SaveDataBuffer; - } - - public override void Load(string strIn) - { - if (string.IsNullOrEmpty(strIn)) - { - OUT_LOAD_INST_DATA_FAIL(); - return; - } - - OUT_LOAD_INST_DATA(strIn); - - StringArguments loadStream = new StringArguments(strIn); - - for (byte i = 0; i < DataTypes.MaxEncounters; ++i) - { - EncounterState tmpState = (EncounterState)loadStream.NextUInt32(); - if (tmpState == EncounterState.InProgress || tmpState > EncounterState.Special) - tmpState = EncounterState.NotStarted; - SetBossState(i, tmpState); - } - - TrialCounter = loadStream.NextUInt32(); - EventStage = 0; - - OUT_LOAD_INST_DATA_COMPLETE(); - } - - public override bool CheckAchievementCriteriaMeet(uint criteria_id, Player source, Unit target, uint miscvalue1) - { - switch (criteria_id) - { - case AchievementData.UpperBackPain10Player: - case AchievementData.UpperBackPain10PlayerHeroic: - return SnoboldCount >= 2; - case AchievementData.UpperBackPain25Player: - case AchievementData.UpperBackPain25PlayerHeroic: - return SnoboldCount >= 4; - case AchievementData.ThreeSixtyPainSpike10Player: - case AchievementData.ThreeSixtyPainSpike10PlayerHeroic: - case AchievementData.ThreeSixtyPainSpike25Player: - case AchievementData.ThreeSixtyPainSpike25PlayerHeroic: - return MistressOfPainCount >= 2; - case AchievementData.ATributeToSkill10Player: - case AchievementData.ATributeToSkill25Player: - return TrialCounter >= 25; - case AchievementData.ATributeToMadSkill10Player: - case AchievementData.ATributeToMadSkill25Player: - return TrialCounter >= 45; - case AchievementData.ATributeToInsanity10Player: - case AchievementData.ATributeToInsanity25Player: - case AchievementData.RealmFirstGrandCrusader: - return TrialCounter == 50; - case AchievementData.ATributeToImmortalityAlliance: - case AchievementData.ATributeToImmortalityHorde: - return TrialCounter == 50 && TributeToImmortalityEligible; - case AchievementData.ATributeToDedicatedInsanity: - return false/*uiGrandCrusaderAttemptsLeft == 50 && !bHasAtAnyStagePlayerEquippedTooGoodItem*/; - default: - break; - } - - return false; - } - - uint TrialCounter; - uint EventStage; - uint EventTimer; - EncounterState northrendBeasts; - bool NeedSave; - string SaveDataBuffer; - - ObjectGuid BarrentGUID; - ObjectGuid TirionGUID; - ObjectGuid TirionFordringGUID; - ObjectGuid FizzlebangGUID; - ObjectGuid GarroshGUID; - ObjectGuid VarianGUID; - - ObjectGuid GormokGUID; - ObjectGuid AcidmawGUID; - ObjectGuid DreadscaleGUID; - ObjectGuid IcehowlGUID; - ObjectGuid JaraxxusGUID; - ObjectGuid ChampionsControllerGUID; - ObjectGuid DarkbaneGUID; - ObjectGuid LightbaneGUID; - ObjectGuid AnubarakGUID; - - ObjectGuid CrusadersCacheGUID; - ObjectGuid FloorGUID; - ObjectGuid TributeChestGUID; - ObjectGuid MainGateDoorGUID; - ObjectGuid EastPortcullisGUID; - ObjectGuid WebDoorGUID; - - // Achievement stuff - uint NotOneButTwoJormungarsTimer; - uint ResilienceWillFixItTimer; - byte SnoboldCount; - byte MistressOfPainCount; - bool TributeToImmortalityEligible; - } - - public override InstanceScript GetInstanceScript(InstanceMap map) - { - return new instance_trial_of_the_crusader_InstanceMapScript(map); - } - } - - [Script] - class npc_announcer_toc10 : CreatureScript - { - public npc_announcer_toc10() : base("npc_announcer_toc10") { } - - class npc_announcer_toc10AI : ScriptedAI - { - public npc_announcer_toc10AI(Creature creature) : base(creature) - { - instance = creature.GetInstanceScript(); - } - - public override void Reset() - { - me.AddUnitFlag(UnitFlags.NonAttackable); - Creature pAlly = GetClosestCreatureWithEntry(me, CreatureIds.Thrall, 300.0f); - if (pAlly) - pAlly.AddUnitFlag(UnitFlags.NonAttackable); - - pAlly = GetClosestCreatureWithEntry(me, CreatureIds.Proudmoore, 300.0f); - if (pAlly) - pAlly.AddUnitFlag(UnitFlags.NonAttackable); - } - - public override void AttackStart(Unit who) { } - - public override bool GossipHello(Player player) - { - string _message = "We are ready!"; - - if (player.IsInCombat() || instance.IsEncounterInProgress() || instance.GetData(DataTypes.Event) != 0) - return true; - - byte i = 0; - for (; i < MiscData._GossipMessage.Length; ++i) - { - if ((!MiscData._GossipMessage[i].state && instance.GetBossState(MiscData._GossipMessage[i].encounter) != EncounterState.Done) - || (MiscData._GossipMessage[i].state && instance.GetBossState(MiscData._GossipMessage[i].encounter) == EncounterState.Done)) - { - AddGossipItemFor(player, GossipOptionIcon.Chat, _message, eTradeskill.GossipSenderMain, MiscData._GossipMessage[i].id); - break; - } - } - - if (i >= MiscData._GossipMessage.Length) - return false; - - SendGossipMenuFor(player, (uint)MiscData._GossipMessage[i].msgnum, me.GetGUID()); - return true; - } - - public override bool GossipSelect(Player player, uint menuId, uint gossipListId) - { - ClearGossipMenuFor(player); - CloseGossipMenuFor(player); - - if (instance.GetBossState(DataTypes.BossBeasts) != EncounterState.Done) - { - instance.SetData(DataTypes.Event, 110); - instance.SetData(DataTypes.NorthrendBeasts, (uint)EncounterState.NotStarted); - instance.SetBossState(DataTypes.BossBeasts, EncounterState.NotStarted); - } - else if (instance.GetBossState(DataTypes.BossJaraxxus) != EncounterState.Done) - { - // if Jaraxxus is spawned, but the raid wiped - Creature jaraxxus = ObjectAccessor.GetCreature(player, instance.GetGuidData(CreatureIds.Jaraxxus)); - if (jaraxxus) - { - jaraxxus.RemoveAurasDueToSpell(Spells.JaraxxusChains); - jaraxxus.RemoveUnitFlag(UnitFlags.NonAttackable); - jaraxxus.SetReactState(ReactStates.Defensive); - jaraxxus.SetInCombatWithZone(); - } - else - { - instance.SetData(DataTypes.Event, 1010); - instance.SetBossState(DataTypes.BossJaraxxus, EncounterState.NotStarted); - } - } - else if (instance.GetBossState(DataTypes.BossCrusaders) != EncounterState.Done) - { - if (player.GetTeam() == Team.Alliance) - instance.SetData(DataTypes.Event, 3000); - else - instance.SetData(DataTypes.Event, 3001); - instance.SetBossState(DataTypes.BossCrusaders, EncounterState.NotStarted); - } - else if (instance.GetBossState(DataTypes.BossValkiries) != EncounterState.Done) - { - instance.SetData(DataTypes.Event, 4000); - instance.SetBossState(DataTypes.BossValkiries, EncounterState.NotStarted); - } - else if (instance.GetBossState(DataTypes.BossLichKing) != EncounterState.Done) - { - if (me.GetMap().GetPlayers().First().GetTeam() == Team.Alliance) - instance.SetData(DataTypes.Event, 4020); - else - instance.SetData(DataTypes.Event, 4030); - instance.SetBossState(DataTypes.BossLichKing, EncounterState.NotStarted); - } - me.RemoveNpcFlag(NPCFlags.Gossip); - return true; - } - - InstanceScript instance; - } - - public override CreatureAI GetAI(Creature creature) - { - return GetInstanceAI(creature); - } - } - - [Script] - class boss_lich_king_toc : ScriptedAI - { - public boss_lich_king_toc(Creature creature) : base(creature) - { - _instance = creature.GetInstanceScript(); - } - - public override void Reset() - { - _updateTimer = 0; - me.SetReactState(ReactStates.Passive); - Creature summoned = me.SummonCreature(CreatureIds.Trigger, MiscData.ToCCommonLoc[2].GetPositionX(), MiscData.ToCCommonLoc[2].GetPositionY(), MiscData.ToCCommonLoc[2].GetPositionZ(), 5, TempSummonType.TimedDespawn, 1 * Time.Minute * Time.InMilliseconds); - if (summoned) - { - summoned.CastSpell(summoned, 51807, false); - summoned.SetDisplayFromModel(1); - } - - _instance.SetBossState(DataTypes.BossLichKing, EncounterState.InProgress); - me.SetWalk(true); - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - if (type != MovementGeneratorType.Point || _instance == null) - return; - - switch (id) - { - case 0: - _instance.SetData(DataTypes.Event, 5030); - break; - case 1: - _instance.SetData(DataTypes.Event, 5050); - break; - default: - break; - } - } - - public override void UpdateAI(uint uiDiff) - { - if (_instance == null) - return; - - if (_instance.GetData(DataTypes.EventNpc) != CreatureIds.LichKing) - return; - - _updateTimer = _instance.GetData(DataTypes.EventTimer); - if (_updateTimer <= uiDiff) - { - switch (_instance.GetData(DataTypes.Event)) - { - case 5010: - Talk(Texts.Stage_4_02); - _updateTimer = 3 * Time.InMilliseconds; - me.GetMotionMaster().MovePoint(0, MiscData.LichKingLoc[0]); - _instance.SetData(DataTypes.Event, 5020); - break; - case 5030: - Talk(Texts.Stage_4_04); - me.SetEmoteState(Emote.StateTalk); - _updateTimer = 10 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 5040); - break; - case 5040: - me.SetEmoteState(Emote.OneshotNone); - me.GetMotionMaster().MovePoint(1, MiscData.LichKingLoc[1]); - _updateTimer = 1 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 0); - break; - case 5050: - me.HandleEmoteCommand(Emote.OneshotExclamation); - _updateTimer = 3 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 5060); - break; - case 5060: - Talk(Texts.Stage_4_05); - me.HandleEmoteCommand(Emote.OneshotKneel); - _updateTimer = (uint)(2.5 * Time.InMilliseconds); - _instance.SetData(DataTypes.Event, 5070); - break; - case 5070: - me.CastSpell(me, 68198, false); - _updateTimer = (uint)(1.5 * Time.InMilliseconds); - _instance.SetData(DataTypes.Event, 5080); - break; - case 5080: - { - GameObject go = ObjectAccessor.GetGameObject(me, _instance.GetGuidData(GameObjectIds.ArgentColiseumFloor)); - if (go) - { - go.SetDisplayId(MiscData.DisplayIdDestroyedFloor); - go.AddFlag(GameObjectFlags.Damaged | GameObjectFlags.NoDespawn); - go.SetGoState(GameObjectState.Active); - } - - me.CastSpell(me, Spells.CorpseTeleport, false); - me.CastSpell(me, Spells.DestroyFloorKnockup, false); - - _instance.SetBossState(DataTypes.BossLichKing, EncounterState.Done); - Creature temp = ObjectAccessor.GetCreature(me, _instance.GetGuidData(CreatureIds.Anubarak)); - if (!temp || !temp.IsAlive()) - temp = me.SummonCreature(CreatureIds.Anubarak, MiscData.AnubarakLoc[0].GetPositionX(), MiscData.AnubarakLoc[0].GetPositionY(), MiscData.AnubarakLoc[0].GetPositionZ(), 3, TempSummonType.CorpseTimedDespawn, MiscData.DespawnTime); - - _instance.SetData(DataTypes.Event, 0); - - me.DespawnOrUnsummon(); - _updateTimer = 20 * Time.InMilliseconds; - break; - } - default: - break; - } - } - else - _updateTimer -= uiDiff; - - _instance.SetData(DataTypes.EventTimer, _updateTimer); - } - - InstanceScript _instance; - uint _updateTimer; - } - - [Script] - class npc_fizzlebang_toc : ScriptedAI - { - public npc_fizzlebang_toc(Creature creature) : base(creature) - { - _summons = new SummonList(me); - _instance = me.GetInstanceScript(); - } - - public override void JustDied(Unit killer) - { - Talk(Texts.Stage_1_06, killer); - _instance.SetData(DataTypes.Event, 1180); - Creature temp = ObjectAccessor.GetCreature(me, _instance.GetGuidData(CreatureIds.Jaraxxus)); - if (temp) - { - temp.RemoveUnitFlag(UnitFlags.NonAttackable); - temp.SetReactState(ReactStates.Aggressive); - temp.SetInCombatWithZone(); - } - } - - public override void Reset() - { - me.SetWalk(true); - _portalGUID.Clear(); - me.GetMotionMaster().MovePoint(1, MiscData.ToCCommonLoc[10].GetPositionX(), MiscData.ToCCommonLoc[10].GetPositionY() - 60, MiscData.ToCCommonLoc[10].GetPositionZ()); - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - if (type != MovementGeneratorType.Point) - return; - - switch (id) - { - case 1: - me.SetWalk(false); - _instance.DoUseDoorOrButton(_instance.GetGuidData(GameObjectIds.MainGateDoor)); - _instance.SetData(DataTypes.Event, 1120); - _instance.SetData(DataTypes.EventTimer, 1 * Time.InMilliseconds); - break; - default: - break; - } - } - - public override void JustSummoned(Creature summoned) - { - _summons.Summon(summoned); - } - - public override void UpdateAI(uint uiDiff) - { - if (_instance == null) - return; - - if (_instance.GetData(DataTypes.EventNpc) != CreatureIds.Fizzlebang) - return; - - _updateTimer = _instance.GetData(DataTypes.EventTimer); - if (_updateTimer <= uiDiff) - { - switch (_instance.GetData(DataTypes.Event)) - { - case 1110: - _instance.SetData(DataTypes.Event, 1120); - _updateTimer = 4 * Time.InMilliseconds; - break; - case 1120: - Talk(Texts.Stage_1_02); - _instance.SetData(DataTypes.Event, 1130); - _updateTimer = 12 * Time.InMilliseconds; - break; - case 1130: - { - me.GetMotionMaster().MovementExpired(); - Talk(Texts.Stage_1_03); - me.HandleEmoteCommand(Emote.OneshotSpellCastOmni); - Creature pTrigger = me.SummonCreature(CreatureIds.Trigger, MiscData.ToCCommonLoc[1].GetPositionX(), MiscData.ToCCommonLoc[1].GetPositionY(), MiscData.ToCCommonLoc[1].GetPositionZ(), 4.69494f, TempSummonType.ManualDespawn); - if (pTrigger) - { - _triggerGUID = pTrigger.GetGUID(); - pTrigger.SetObjectScale(2.0f); - pTrigger.SetDisplayFromModel(0); - pTrigger.CastSpell(pTrigger, Spells.WilfredPortal, false); - } - _instance.SetData(DataTypes.Event, 1132); - _updateTimer = 4 * Time.InMilliseconds; - break; - } - case 1132: - me.GetMotionMaster().MovementExpired(); - _instance.SetData(DataTypes.Event, 1134); - _updateTimer = 4 * Time.InMilliseconds; - break; - case 1134: - { - me.HandleEmoteCommand(Emote.OneshotSpellCastOmni); - Creature pPortal = me.SummonCreature(CreatureIds.WilfredPortal, MiscData.ToCCommonLoc[1].GetPositionX(), MiscData.ToCCommonLoc[1].GetPositionY(), MiscData.ToCCommonLoc[1].GetPositionZ(), 4.71239f, TempSummonType.ManualDespawn); - if (pPortal) - { - pPortal.SetReactState(ReactStates.Passive); - pPortal.SetObjectScale(2.0f); - pPortal.CastSpell(pPortal, Spells.WilfredPortal, false); - _portalGUID = pPortal.GetGUID(); - } - _updateTimer = 4 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 1135); - break; - } - case 1135: - _instance.SetData(DataTypes.Event, 1140); - _updateTimer = 3 * Time.InMilliseconds; - break; - case 1140: - { - Talk(Texts.Stage_1_04); - Creature temp = me.SummonCreature(CreatureIds.Jaraxxus, MiscData.ToCCommonLoc[1].GetPositionX(), MiscData.ToCCommonLoc[1].GetPositionY(), MiscData.ToCCommonLoc[1].GetPositionZ(), 5.0f, TempSummonType.CorpseTimedDespawn, MiscData.DespawnTime); - if (temp) - { - temp.AddUnitFlag(UnitFlags.NonAttackable); - temp.SetReactState(ReactStates.Passive); - temp.GetMotionMaster().MovePoint(0, MiscData.ToCCommonLoc[1].GetPositionX(), MiscData.ToCCommonLoc[1].GetPositionY() - 10, MiscData.ToCCommonLoc[1].GetPositionZ()); - } - _instance.SetData(DataTypes.Event, 1142); - _updateTimer = 5 * Time.InMilliseconds; - break; - } - case 1142: - { - Creature temp = ObjectAccessor.GetCreature(me, _instance.GetGuidData(CreatureIds.Jaraxxus)); - if (temp) - temp.SetTarget(me.GetGUID()); - - Creature pTrigger = ObjectAccessor.GetCreature(me, _triggerGUID); - if (pTrigger) - pTrigger.DespawnOrUnsummon(); - - Creature pPortal = ObjectAccessor.GetCreature(me, _portalGUID); - if (pPortal) - pPortal.DespawnOrUnsummon(); - _instance.SetData(DataTypes.Event, 1144); - _updateTimer = 10 * Time.InMilliseconds; - break; - } - case 1144: - { - Creature temp = ObjectAccessor.GetCreature(me, _instance.GetGuidData(CreatureIds.Jaraxxus)); - if (temp) - temp.GetAI().Talk(Texts.Stage_1_05); - _instance.SetData(DataTypes.Event, 1150); - _updateTimer = 5 * Time.InMilliseconds; - break; - } - case 1150: - { - Creature temp = ObjectAccessor.GetCreature(me, _instance.GetGuidData(CreatureIds.Jaraxxus)); - if (temp) - { - //1-shot Fizzlebang - temp.CastSpell(me, 67888, false); - AddThreat(me, 1000.0f, temp); - temp.GetAI().AttackStart(me); - } - _instance.SetData(DataTypes.Event, 1160); - _updateTimer = 3 * Time.InMilliseconds; - break; - } - } - } - else - _updateTimer -= uiDiff; - _instance.SetData(DataTypes.EventTimer, _updateTimer); - } - - InstanceScript _instance; - SummonList _summons; - uint _updateTimer; - ObjectGuid _portalGUID; - ObjectGuid _triggerGUID; - } - - [Script] - class npc_tirion_toc : ScriptedAI - { - public npc_tirion_toc(Creature creature) : base(creature) - { - _instance = me.GetInstanceScript(); - } - - public override void Reset() { } - - public override void AttackStart(Unit who) { } - - public override void UpdateAI(uint uiDiff) - { - if (_instance == null) - return; - - if (_instance.GetData(DataTypes.EventNpc) != CreatureIds.Tirion) - return; - - _updateTimer = _instance.GetData(DataTypes.EventTimer); - if (_updateTimer <= uiDiff) - { - switch (_instance.GetData(DataTypes.Event)) - { - case 110: - me.SetEmoteState(Emote.OneshotTalk); - Talk(Texts.Stage_0_01); - _updateTimer = 22 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 120); - break; - case 140: - me.SetEmoteState(Emote.OneshotTalk); - Talk(Texts.Stage_0_02); - _updateTimer = 5 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 150); - break; - case 150: - { - me.SetEmoteState(Emote.OneshotNone); - if (_instance.GetBossState(DataTypes.BossBeasts) != EncounterState.Done) - { - _instance.DoUseDoorOrButton(_instance.GetGuidData(GameObjectIds.MainGateDoor)); - - Creature temp = me.SummonCreature(CreatureIds.Gormok, MiscData.ToCSpawnLoc[0].GetPositionX(), MiscData.ToCSpawnLoc[0].GetPositionY(), MiscData.ToCSpawnLoc[0].GetPositionZ(), 5, TempSummonType.CorpseTimedDespawn, 30 * Time.InMilliseconds); - if (temp) - { - temp.GetMotionMaster().MovePoint(0, MiscData.ToCCommonLoc[5].GetPositionX(), MiscData.ToCCommonLoc[5].GetPositionY(), MiscData.ToCCommonLoc[5].GetPositionZ()); - temp.AddUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - temp.SetReactState(ReactStates.Passive); - } - } - _updateTimer = 3 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 155); - break; - } - case 155: - // keep the raid in combat for the whole encounter, pauses included - me.SetInCombatWithZone(); - _updateTimer = 5 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 160); - break; - case 200: - { - Talk(Texts.Stage_0_04); - if (_instance.GetBossState(DataTypes.BossBeasts) != EncounterState.Done) - { - _instance.DoUseDoorOrButton(_instance.GetGuidData(GameObjectIds.MainGateDoor)); - Creature temp = me.SummonCreature(CreatureIds.Dreadscale, MiscData.ToCSpawnLoc[1].GetPositionX(), MiscData.ToCSpawnLoc[1].GetPositionY(), MiscData.ToCSpawnLoc[1].GetPositionZ(), 5, TempSummonType.ManualDespawn); - if (temp) - { - temp.GetMotionMaster().MovePoint(0, MiscData.ToCCommonLoc[5].GetPositionX(), MiscData.ToCCommonLoc[5].GetPositionY(), MiscData.ToCCommonLoc[5].GetPositionZ()); - temp.AddUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - temp.SetReactState(ReactStates.Passive); - } - } - _updateTimer = 5 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 220); - break; - } - case 220: - _instance.SetData(DataTypes.Event, 230); - break; - case 300: - { - Talk(Texts.Stage_0_05); - if (_instance.GetBossState(DataTypes.BossBeasts) != EncounterState.Done) - { - _instance.DoUseDoorOrButton(_instance.GetGuidData(GameObjectIds.MainGateDoor)); - Creature temp = me.SummonCreature(CreatureIds.Icehowl, MiscData.ToCSpawnLoc[0].GetPositionX(), MiscData.ToCSpawnLoc[0].GetPositionY(), MiscData.ToCSpawnLoc[0].GetPositionZ(), 5, TempSummonType.DeadDespawn); - if (temp) - { - temp.GetMotionMaster().MovePoint(2, MiscData.ToCCommonLoc[5].GetPositionX(), MiscData.ToCCommonLoc[5].GetPositionY(), MiscData.ToCCommonLoc[5].GetPositionZ()); - me.AddUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - me.SetReactState(ReactStates.Passive); - } - } - _updateTimer = 5 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 315); - break; - } - case 315: - _instance.SetData(DataTypes.Event, 320); - break; - case 400: - Talk(Texts.Stage_0_06); - me.GetThreatManager().ClearReferences(); - _updateTimer = 5 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 0); - break; - case 666: - Talk(Texts.Stage_0_Wipe); - _updateTimer = 5 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 0); - break; - case 1010: - Talk(Texts.Stage_1_01); - _updateTimer = 7 * Time.InMilliseconds; - _instance.DoUseDoorOrButton(_instance.GetGuidData(GameObjectIds.MainGateDoor)); - me.SummonCreature(CreatureIds.Fizzlebang, MiscData.ToCSpawnLoc[0].GetPositionX(), MiscData.ToCSpawnLoc[0].GetPositionY(), MiscData.ToCSpawnLoc[0].GetPositionZ(), 2, TempSummonType.CorpseTimedDespawn, MiscData.DespawnTime); - _instance.SetData(DataTypes.Event, 0); - break; - case 1180: - Talk(Texts.Stage_1_07); - _updateTimer = 3 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 0); - break; - case 2000: - Talk(Texts.Stage_1_08); - _updateTimer = 18 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 2010); - break; - case 2030: - Talk(Texts.Stage_1_11); - _updateTimer = 5 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 0); - break; - case 3000: - Talk(Texts.Stage_2_01); - _updateTimer = 12 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 3050); - break; - case 3001: - Talk(Texts.Stage_2_01); - _updateTimer = 10 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 3051); - break; - case 3060: - Talk(Texts.Stage_2_03); - _updateTimer = 5 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 3070); - break; - case 3061: - Talk(Texts.Stage_2_03); - _updateTimer = 5 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 3071); - break; - //Summoning crusaders - case 3091: - { - Creature pChampionController = me.SummonCreature(CreatureIds.ChampionsController, MiscData.ToCCommonLoc[1]); - if (pChampionController) - pChampionController.GetAI().SetData(0, (uint)Team.Horde); - _updateTimer = 3 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 3092); - break; - } - //Summoning crusaders - case 3090: - { - Creature pChampionController = me.SummonCreature(CreatureIds.ChampionsController, MiscData.ToCCommonLoc[1]); - if (pChampionController) - pChampionController.GetAI().SetData(0, (uint)Team.Alliance); - _updateTimer = 3 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 3092); - break; - } - case 3092: - { - Creature pChampionController = ObjectAccessor.GetCreature(me, _instance.GetGuidData(CreatureIds.ChampionsController)); - if (pChampionController) - pChampionController.GetAI().SetData(1, (uint)EncounterState.NotStarted); - _instance.SetData(DataTypes.Event, 3095); - break; - } - //Crusaders battle end - case 3100: - Talk(Texts.Stage_2_06); - _updateTimer = 5 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 0); - break; - case 4000: - Talk(Texts.Stage_3_01); - _updateTimer = 13 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 4010); - break; - case 4010: - { - Talk(Texts.Stage_3_02); - Creature temp = me.SummonCreature(CreatureIds.Lightbane, MiscData.ToCSpawnLoc[1].GetPositionX(), MiscData.ToCSpawnLoc[1].GetPositionY(), MiscData.ToCSpawnLoc[1].GetPositionZ(), 5, TempSummonType.CorpseTimedDespawn, MiscData.DespawnTime); - if (temp) - { - temp.SetVisible(false); - temp.SetReactState(ReactStates.Passive); - temp.SummonCreature(CreatureIds.LightEssence, MiscData.TwinValkyrsLoc[0].GetPositionX(), MiscData.TwinValkyrsLoc[0].GetPositionY(), MiscData.TwinValkyrsLoc[0].GetPositionZ()); - temp.SummonCreature(CreatureIds.LightEssence, MiscData.TwinValkyrsLoc[1].GetPositionX(), MiscData.TwinValkyrsLoc[1].GetPositionY(), MiscData.TwinValkyrsLoc[1].GetPositionZ()); - } - - temp = me.SummonCreature(CreatureIds.Darkbane, MiscData.ToCSpawnLoc[2].GetPositionX(), MiscData.ToCSpawnLoc[2].GetPositionY(), MiscData.ToCSpawnLoc[2].GetPositionZ(), 5, TempSummonType.CorpseTimedDespawn, MiscData.DespawnTime); - if (temp) - { - temp.SetVisible(false); - temp.SetReactState(ReactStates.Passive); - temp.SummonCreature(CreatureIds.DarkEssence, MiscData.TwinValkyrsLoc[2].GetPositionX(), MiscData.TwinValkyrsLoc[2].GetPositionY(), MiscData.TwinValkyrsLoc[2].GetPositionZ()); - temp.SummonCreature(CreatureIds.DarkEssence, MiscData.TwinValkyrsLoc[3].GetPositionX(), MiscData.TwinValkyrsLoc[3].GetPositionY(), MiscData.TwinValkyrsLoc[3].GetPositionZ()); - } - _updateTimer = 3 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 4015); - break; - } - case 4015: - { - _instance.DoUseDoorOrButton(_instance.GetGuidData(GameObjectIds.MainGateDoor)); - Creature temp = ObjectAccessor.GetCreature(me, _instance.GetGuidData(CreatureIds.Lightbane)); - if (temp) - { - temp.GetMotionMaster().MovePoint(1, MiscData.ToCCommonLoc[8].GetPositionX(), MiscData.ToCCommonLoc[8].GetPositionY(), MiscData.ToCCommonLoc[8].GetPositionZ()); - temp.SetVisible(true); - } - - temp = ObjectAccessor.GetCreature(me, _instance.GetGuidData(CreatureIds.Darkbane)); - if (temp) - { - temp.GetMotionMaster().MovePoint(1, MiscData.ToCCommonLoc[9].GetPositionX(), MiscData.ToCCommonLoc[9].GetPositionY(), MiscData.ToCCommonLoc[9].GetPositionZ()); - temp.SetVisible(true); - } - _updateTimer = 10 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 4016); - break; - } - case 4016: - _instance.DoUseDoorOrButton(_instance.GetGuidData(GameObjectIds.MainGateDoor)); - _instance.SetData(DataTypes.Event, 4017); - break; - case 4040: - _updateTimer = 1 * Time.Minute * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 5000); - break; - case 5000: - Talk(Texts.Stage_4_01); - _updateTimer = 10 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 5005); - break; - case 5005: - _updateTimer = 8 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 5010); - me.SummonCreature(CreatureIds.LichKing, MiscData.ToCCommonLoc[2].GetPositionX(), MiscData.ToCCommonLoc[2].GetPositionY(), MiscData.ToCCommonLoc[2].GetPositionZ(), 5); - break; - case 5020: - Talk(Texts.Stage_4_03); - _updateTimer = 1 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 0); - break; - case 6000: - me.SummonCreature(CreatureIds.TirionFordring, MiscData.EndSpawnLoc[0]); - me.SummonCreature(CreatureIds.ArgentMage, MiscData.EndSpawnLoc[1]); - me.SummonGameObject(GameObjectIds.PortalToDalaran, MiscData.EndSpawnLoc[2], Quaternion.fromEulerAnglesZYX(MiscData.EndSpawnLoc[2].GetOrientation(), 0.0f, 0.0f), 0); - _updateTimer = 20 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 6005); - break; - case 6005: - { - Creature tirionFordring = ObjectAccessor.GetCreature(me, _instance.GetGuidData(CreatureIds.TirionFordring)); - if (tirionFordring) - tirionFordring.GetAI().Talk(Texts.Stage_4_06); - _updateTimer = 20 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 6010); - break; - } - case 6010: - if (IsHeroic()) - { - Creature tirionFordring = ObjectAccessor.GetCreature(me, _instance.GetGuidData(CreatureIds.TirionFordring)); - if (tirionFordring) - tirionFordring.GetAI().Talk(Texts.Stage_4_07); - _updateTimer = 1 * Time.Minute * Time.InMilliseconds; - _instance.SetBossState(DataTypes.BossAnubarak, EncounterState.Special); - _instance.SetData(DataTypes.Event, 6020); - } - else - _instance.SetData(DataTypes.Event, 6030); - break; - case 6020: - me.DespawnOrUnsummon(); - _updateTimer = 5 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 6030); - break; - default: - break; - } - } - else - _updateTimer -= uiDiff; - _instance.SetData(DataTypes.EventTimer, _updateTimer); - } - - InstanceScript _instance; - uint _updateTimer; - } - - [Script] - class npc_garrosh_toc : ScriptedAI - { - public npc_garrosh_toc(Creature creature) : base(creature) - { - _instance = me.GetInstanceScript(); - } - - public override void Reset() { } - - public override void AttackStart(Unit who) { } - - public override void UpdateAI(uint uiDiff) - { - if (_instance == null) - return; - - if (_instance.GetData(DataTypes.EventNpc) != CreatureIds.Garrosh) - return; - - _updateTimer = _instance.GetData(DataTypes.EventTimer); - if (_updateTimer <= uiDiff) - { - switch (_instance.GetData(DataTypes.Event)) - { - case 130: - me.SetEmoteState(Emote.OneshotTalk); - Talk(Texts.Stage_0_03h); - _updateTimer = 3 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 132); - break; - case 132: - me.SetEmoteState(Emote.OneshotNone); - _updateTimer = 5 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 140); - break; - case 2010: - Talk(Texts.Stage_1_09); - _updateTimer = 9 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 2020); - break; - case 3050: - Talk(Texts.Stage_2_02h); - _updateTimer = 15 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 3060); - break; - case 3070: - Talk(Texts.Stage_2_04h); - _updateTimer = 6 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 3080); - break; - case 3081: - Talk(Texts.Stage_2_05h); - _updateTimer = 3 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 3091); - break; - case 4030: - Talk(Texts.Stage_3_03h); - _updateTimer = 5 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 4040); - break; - default: - break; - } - } - else - _updateTimer -= uiDiff; - _instance.SetData(DataTypes.EventTimer, _updateTimer); - } - - InstanceScript _instance; - uint _updateTimer; - } - - [Script] - class npc_varian_toc : ScriptedAI - { - public npc_varian_toc(Creature creature) : base(creature) - { - _instance = me.GetInstanceScript(); - } - - public override void Reset() { } - - public override void AttackStart(Unit who) { } - - public override void UpdateAI(uint uiDiff) - { - if (_instance == null) - return; - - if (_instance.GetData(DataTypes.EventNpc) != CreatureIds.Varian) - return; - - _updateTimer = _instance.GetData(DataTypes.EventTimer); - if (_updateTimer <= uiDiff) - { - switch (_instance.GetData(DataTypes.Event)) - { - case 120: - me.SetEmoteState(Emote.OneshotTalk); - Talk(Texts.Stage_0_03a); - _updateTimer = 2 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 122); - break; - case 122: - me.SetEmoteState(Emote.OneshotNone); - _updateTimer = 3 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 130); - break; - case 2020: - Talk(Texts.Stage_1_10); - _updateTimer = 5 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 2030); - break; - case 3051: - Talk(Texts.Stage_2_02a); - _updateTimer = 17 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 3061); - break; - case 3071: - Talk(Texts.Stage_2_04a); - _updateTimer = 5 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 3081); - break; - case 3080: - Talk(Texts.Stage_2_05a); - _updateTimer = 3 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 3090); - break; - case 4020: - Talk(Texts.Stage_3_03a); - _updateTimer = 5 * Time.InMilliseconds; - _instance.SetData(DataTypes.Event, 4040); - break; - default: - break; - } - } - else - _updateTimer -= uiDiff; - _instance.SetData(DataTypes.EventTimer, _updateTimer); - } - - InstanceScript _instance; - uint _updateTimer; - } -} diff --git a/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/TrialOfTheCrusaderConst.cs b/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/TrialOfTheCrusaderConst.cs deleted file mode 100644 index dc5921bda..000000000 --- a/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/TrialOfTheCrusaderConst.cs +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.Entities; -using Game.Maps; - -namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheCrusader -{ - struct DataTypes - { - public const uint BossBeasts = 0; - public const uint BossJaraxxus = 1; - public const uint BossCrusaders = 2; - public const uint BossValkiries = 3; - public const uint BossLichKing = 4; // Not Really A Boss But Oh Well - public const uint BossAnubarak = 5; - public const uint MaxEncounters = 6; - - public const uint Counter = 8; - public const uint Event = 9; - - public const uint EventTimer = 101; - public const uint EventNpc = 102; - public const uint NorthrendBeasts = 103; - - public const uint SnoboldCount = 301; - public const uint MistressOfPainCount = 302; - public const uint TributeToImmortalityEligible = 303; - - public const uint Increase = 501; - public const uint Decrease = 502; - } - - struct Spells - { - public const uint WilfredPortal = 68424; - public const uint JaraxxusChains = 67924; - public const uint CorpseTeleport = 69016; - public const uint DestroyFloorKnockup = 68193; - } - - struct WorldStateIds - { - public const uint Show = 4390; - public const uint Count = 4389; - } - - enum AnnouncerMessages - { - Beasts = 724001, - Jaraxxus = 724002, - Crusaders = 724003, - Valkiries = 724004, - LichKing = 724005, - Anubarak = 724006 - } - - public struct CreatureIds - { - public const uint Barrent = 34816; - public const uint Tirion = 34996; - public const uint TirionFordring = 36095; - public const uint ArgentMage = 36097; - public const uint Fizzlebang = 35458; - public const uint Garrosh = 34995; - public const uint Varian = 34990; - public const uint LichKing = 35877; - - public const uint Thrall = 34994; - public const uint Proudmoore = 34992; - public const uint WilfredPortal = 17965; - public const uint Trigger = 35651; - - public const uint Icehowl = 34797; - public const uint Gormok = 34796; - public const uint Dreadscale = 34799; - public const uint Acidmaw = 35144; - - public const uint Jaraxxus = 34780; - - public const uint ChampionsController = 34781; - - public const uint AllianceDeathKnight = 34461; - public const uint AllianceDruidBalance = 34460; - public const uint AllianceDruidRestoration = 34469; - public const uint AllianceHunter = 34467; - public const uint AllianceMage = 34468; - public const uint AlliancePaladinHoly = 34465; - public const uint AlliancePaladinRetribution = 34471; - public const uint AlliancePriestDiscipline = 34466; - public const uint AlliancePriestShadow = 34473; - public const uint AllianceRogue = 34472; - public const uint AllianceShamanEnhancement = 34463; - public const uint AllianceShamanRestoration = 34470; - public const uint AllianceWarlock = 34474; - public const uint AllianceWarrior = 34475; - - public const uint HordeDeathKnight = 34458; - public const uint HordeDruidBalance = 34451; - public const uint HordeDruidRestoration = 34459; - public const uint HordeHunter = 34448; - public const uint HordeMage = 34449; - public const uint HordePaladinHoly = 34445; - public const uint HordePaladinRetribution = 34456; - public const uint HordePriestDiscipline = 34447; - public const uint HordePriestShadow = 34441; - public const uint HordeRogue = 34454; - public const uint HordeShamanEnhancement = 34455; - public const uint HordeShamanRestoration = 34444; - public const uint HordeWarlock = 34450; - public const uint HordeWarrior = 34453; - - public const uint Lightbane = 34497; - public const uint Darkbane = 34496; - - public const uint DarkEssence = 34567; - public const uint LightEssence = 34568; - - public const uint Anubarak = 34564; - } - - struct GameObjectIds - { - public const uint CrusadersCache10 = 195631; - public const uint CrusadersCache25 = 195632; - public const uint CrusadersCache10H = 195633; - public const uint CrusadersCache25H = 195635; - - // Tribute Chest (Heroic) - // 10-Man Modes - public const uint TributeChest10h25 = 195668; // 10man 01-24 Attempts - public const uint TributeChest10h45 = 195667; // 10man 25-44 Attempts - public const uint TributeChest10h50 = 195666; // 10man 45-49 Attempts - public const uint TributeChest10h99 = 195665; // 10man 50 Attempts - // 25-Man Modes - public const uint TributeChest25h25 = 195672; // 25man 01-24 Attempts - public const uint TributeChest25h45 = 195671; // 25man 25-44 Attempts - public const uint TributeChest25h50 = 195670; // 25man 45-49 Attempts - public const uint TributeChest25h99 = 195669; // 25man 50 Attempts - - public const uint ArgentColiseumFloor = 195527; //20943 - public const uint MainGateDoor = 195647; - public const uint EastPortcullis = 195648; - public const uint WebDoor = 195485; - public const uint PortalToDalaran = 195682; - } - - struct AchievementData - { - // Northrend Beasts - public const uint UpperBackPain10Player = 11779; - public const uint UpperBackPain10PlayerHeroic = 11802; - public const uint UpperBackPain25Player = 11780; - public const uint UpperBackPain25PlayerHeroic = 11801; - // Lord Jaraxxus - public const uint ThreeSixtyPainSpike10Player = 11838; - public const uint ThreeSixtyPainSpike10PlayerHeroic = 11861; - public const uint ThreeSixtyPainSpike25Player = 11839; - public const uint ThreeSixtyPainSpike25PlayerHeroic = 11862; - // Tribute - public const uint ATributeToSkill10Player = 12344; - public const uint ATributeToSkill25Player = 12338; - public const uint ATributeToMadSkill10Player = 12347; - public const uint ATributeToMadSkill25Player = 12341; - public const uint ATributeToInsanity10Player = 12349; - public const uint ATributeToInsanity25Player = 12343; - public const uint ATributeToImmortalityHorde = 12358; - public const uint ATributeToImmortalityAlliance = 12359; - public const uint ATributeToDedicatedInsanity = 12360; - public const uint RealmFirstGrandCrusader = 12350; - - // Dummy Spells - Not Existing In Dbc But We Don'T Need That - public const uint SpellWormsKilledIn10Seconds = 68523; - public const uint SpellChampionsKilledInMinute = 68620; - public const uint SpellDefeatFactionChampions = 68184; - public const uint SpellTraitorKing10 = 68186; - public const uint SpellTraitorKing25 = 68515; - - // Timed Events - public const uint EventStartTwinsFight = 21853; - } - - struct NorthrendBeasts - { - public const uint GormokInProgress = 1000; - public const uint GormokDone = 1001; - public const uint SnakesInProgress = 2000; - public const uint DreadscaleSubmerged = 2001; - public const uint AcidmawSubmerged = 2002; - public const uint SnakesSpecial = 2003; - public const uint SnakesDone = 2004; - public const uint IcehowlInProgress = 3000; - public const uint IcehowlDone = 3001; - } - - struct Texts - { - // Highlord Tirion Fordring - 34996 - public const uint Stage_0_01 = 0; - public const uint Stage_0_02 = 1; - public const uint Stage_0_04 = 2; - public const uint Stage_0_05 = 3; - public const uint Stage_0_06 = 4; - public const uint Stage_0_Wipe = 5; - public const uint Stage_1_01 = 6; - public const uint Stage_1_07 = 7; - public const uint Stage_1_08 = 8; - public const uint Stage_1_11 = 9; - public const uint Stage_2_01 = 10; - public const uint Stage_2_03 = 11; - public const uint Stage_2_06 = 12; - public const uint Stage_3_01 = 13; - public const uint Stage_3_02 = 14; - public const uint Stage_4_01 = 15; - public const uint Stage_4_03 = 16; - - // Varian Wrynn - public const uint Stage_0_03a = 0; - public const uint Stage_1_10 = 1; - public const uint Stage_2_02a = 2; - public const uint Stage_2_04a = 3; - public const uint Stage_2_05a = 4; - public const uint Stage_3_03a = 5; - - // Garrosh - public const uint Stage_0_03h = 0; - public const uint Stage_1_09 = 1; - public const uint Stage_2_02h = 2; - public const uint Stage_2_04h = 3; - public const uint Stage_2_05h = 4; - public const uint Stage_3_03h = 5; - - // Wilfred Fizzlebang - public const uint Stage_1_02 = 0; - public const uint Stage_1_03 = 1; - public const uint Stage_1_04 = 2; - public const uint Stage_1_06 = 3; - - // Lord Jaraxxus - public const uint Stage_1_05 = 0; - - // The Lich King - public const uint Stage_4_02 = 0; - public const uint Stage_4_05 = 1; - public const uint Stage_4_04 = 2; - - // Highlord Tirion Fordring - 36095 - public const uint Stage_4_06 = 0; - public const uint Stage_4_07 = 1; - } - - struct MiscData - { - public const uint DespawnTime = 300000; - - public const uint DisplayIdDestroyedFloor = 9060; - - public static BossBoundaryEntry[] boundaries = - { - new BossBoundaryEntry(DataTypes.BossBeasts, new CircleBoundary(new Position(563.26f, 139.6f), 75.0)), - new BossBoundaryEntry(DataTypes.BossJaraxxus, new CircleBoundary(new Position(563.26f, 139.6f), 75.0)), - new BossBoundaryEntry(DataTypes.BossCrusaders, new CircleBoundary(new Position(563.26f, 139.6f), 75.0)), - new BossBoundaryEntry(DataTypes.BossValkiries, new CircleBoundary(new Position(563.26f, 139.6f), 75.0)), - new BossBoundaryEntry(DataTypes.BossAnubarak, new EllipseBoundary(new Position(746.0f, 135.0f), 100.0, 75.0)) - }; - - public static _Messages[] _GossipMessage = - { - new _Messages(AnnouncerMessages.Beasts, eTradeskill.GossipActionInfoDef + 1, false, DataTypes.BossBeasts), - new _Messages(AnnouncerMessages.Jaraxxus, eTradeskill.GossipActionInfoDef + 2, false, DataTypes.BossJaraxxus), - new _Messages(AnnouncerMessages.Crusaders, eTradeskill.GossipActionInfoDef + 3, false, DataTypes.BossCrusaders), - new _Messages(AnnouncerMessages.Valkiries, eTradeskill.GossipActionInfoDef + 4, false, DataTypes.BossValkiries), - new _Messages(AnnouncerMessages.LichKing, eTradeskill.GossipActionInfoDef + 5, false, DataTypes.BossAnubarak), - new _Messages(AnnouncerMessages.Anubarak, eTradeskill.GossipActionInfoDef + 6, true, DataTypes.BossAnubarak) - }; - - public static Position[] ToCSpawnLoc = - { - new Position(563.912f, 261.625f, 394.73f, 4.70437f), // 0 Center - new Position( 575.451f, 261.496f, 394.73f, 4.6541f), // 1 Left - new Position( 549.951f, 261.55f, 394.73f, 4.74835f) // 2 Right - }; - - public static Position[] ToCCommonLoc = - { - new Position(559.257996f, 90.266197f, 395.122986f, 0), // 0 Barrent - - new Position(563.672974f, 139.571f, 393.837006f, 0), // 1 Center - new Position(563.833008f, 187.244995f, 394.5f, 0), // 2 Backdoor - new Position(577.347839f, 195.338888f, 395.14f, 0), // 3 - Right - new Position(550.955933f, 195.338888f, 395.14f, 0), // 4 - Left - new Position(563.833008f, 195.244995f, 394.585561f, 0), // 5 - Center - new Position(573.5f, 180.5f, 395.14f, 0), // 6 Move 0 Right - new Position(553.5f, 180.5f, 395.14f, 0), // 7 Move 0 Left - new Position(573.0f, 170.0f, 395.14f, 0), // 8 Move 1 Right - new Position(555.5f, 170.0f, 395.14f, 0), // 9 Move 1 Left - new Position(563.8f, 216.1f, 395.1f, 0), // 10 Behind the door - - new Position(575.042358f, 195.260727f, 395.137146f, 0), // 5 - new Position(552.248901f, 195.331955f, 395.132658f, 0), // 6 - new Position(573.342285f, 195.515823f, 395.135956f, 0), // 7 - new Position(554.239929f, 195.825577f, 395.137909f, 0), // 8 - new Position(571.042358f, 195.260727f, 395.137146f, 0), // 9 - new Position(556.720581f, 195.015472f, 395.132658f, 0), // 10 - new Position(569.534119f, 195.214478f, 395.139526f, 0), // 11 - new Position(569.231201f, 195.941071f, 395.139526f, 0), // 12 - new Position(558.811610f, 195.985779f, 394.671661f, 0), // 13 - new Position(567.641724f, 195.351501f, 394.659943f, 0), // 14 - new Position(560.633972f, 195.391708f, 395.137543f, 0), // 15 - new Position(565.816956f, 195.477921f, 395.136810f, 0) // 16 - }; - - public static Position[] JaraxxusLoc = - { - new Position(508.104767f, 138.247345f, 395.128052f, 0), // 0 - Fizzlebang start location - new Position(548.610596f, 139.807800f, 394.321838f, 0), // 1 - fizzlebang end - new Position(581.854187f, 138.0f, 394.319f, 0), // 2 - Portal Right - new Position(550.558838f, 138.0f, 394.319f, 0) // 3 - Portal Left - }; - - public static Position[] FactionChampionLoc = - { - new Position(514.231f, 105.569f, 418.234f, 0), // 0 - Horde Initial Pos 0 - new Position(508.334f, 115.377f, 418.234f, 0), // 1 - Horde Initial Pos 1 - new Position(506.454f, 126.291f, 418.234f, 0), // 2 - Horde Initial Pos 2 - new Position(506.243f, 106.596f, 421.592f, 0), // 3 - Horde Initial Pos 3 - new Position(499.885f, 117.717f, 421.557f, 0), // 4 - Horde Initial Pos 4 - - new Position(613.127f, 100.443f, 419.74f, 0), // 5 - Ally Initial Pos 0 - new Position(621.126f, 128.042f, 418.231f, 0), // 6 - Ally Initial Pos 1 - new Position(618.829f, 113.606f, 418.232f, 0), // 7 - Ally Initial Pos 2 - new Position(625.845f, 112.914f, 421.575f, 0), // 8 - Ally Initial Pos 3 - new Position(615.566f, 109.653f, 418.234f, 0), // 9 - Ally Initial Pos 4 - - new Position(535.469f, 113.012f, 394.66f, 0), // 10 - Horde Final Pos 0 - new Position(526.417f, 137.465f, 394.749f, 0), // 11 - Horde Final Pos 1 - new Position(528.108f, 111.057f, 395.289f, 0), // 12 - Horde Final Pos 2 - new Position(519.92f, 134.285f, 395.289f, 0), // 13 - Horde Final Pos 3 - new Position(533.648f, 119.148f, 394.646f, 0), // 14 - Horde Final Pos 4 - new Position(531.399f, 125.63f, 394.708f, 0), // 15 - Horde Final Pos 5 - new Position(528.958f, 131.47f, 394.73f, 0), // 16 - Horde Final Pos 6 - new Position(526.309f, 116.667f, 394.833f, 0), // 17 - Horde Final Pos 7 - new Position(524.238f, 122.411f, 394.819f, 0), // 18 - Horde Final Pos 8 - new Position(521.901f, 128.488f, 394.832f, 0) // 19 - Horde Final Pos 9 - }; - - public static Position[] TwinValkyrsLoc = - { - new Position(586.060242f, 117.514809f, 394.41f, 0), // 0 - Dark essence 1 - new Position(541.602112f, 161.879837f, 394.41f, 0), // 1 - Dark essence 2 - new Position(541.021118f, 117.262932f, 394.41f, 0), // 2 - Light essence 1 - new Position(586.200562f, 162.145523f, 394.41f, 0) // 3 - Light essence 2 - }; - - public static Position[] LichKingLoc = - { - new Position(563.549f, 152.474f, 394.393f, 0), // 0 - Lich king start - new Position(563.547f, 141.613f, 393.908f, 0) // 1 - Lich king end - }; - - public static Position[] AnubarakLoc = - { - new Position(787.932556f, 133.289780f, 142.612152f, 0), // 0 - Anub'arak start location - new Position(695.240051f, 137.834824f, 142.200000f, 0), // 1 - Anub'arak move point location - new Position(694.886353f, 102.484665f, 142.119614f, 0), // 3 - Nerub Spawn - new Position(694.500671f, 185.363968f, 142.117905f, 0), // 5 - Nerub Spawn - new Position(731.987244f, 83.3824690f, 142.119614f, 0), // 2 - Nerub Spawn - new Position(740.184509f, 193.443390f, 142.117584f, 0) // 4 - Nerub Spawn - }; - - public static Position[] EndSpawnLoc = - { - new Position(648.9167f, 131.0208f, 141.6161f, 0), // 0 - Highlord Tirion Fordring - new Position(649.1614f, 142.0399f, 141.3057f, 0), // 1 - Argent Mage - new Position(644.6250f, 149.2743f, 140.6015f, 0) // 2 - Portal to Dalaran - }; - } - - struct _Messages - { - public _Messages(AnnouncerMessages _msg, uint _id, bool _state, uint _encounter) - { - msgnum = _msg; - id = _id; - state = _state; - encounter = _encounter; - } - - public AnnouncerMessages msgnum; - public uint id; - public bool state; - public uint encounter; - } -} diff --git a/Source/Scripts/Northrend/Dalaran.cs b/Source/Scripts/Northrend/Dalaran.cs deleted file mode 100644 index d94229ae7..000000000 --- a/Source/Scripts/Northrend/Dalaran.cs +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Framework.Database; -using Game.AI; -using Game.Entities; -using Game.Mails; -using Game.Scripting; -using System.Collections.Generic; - -namespace Scripts.Northrend -{ - struct DalaranConst - { - //Mageguard - public const uint SpellTrespasserA = 54028; - public const uint SpellTrespasserH = 54029; - - public const uint SpellSunreaverDisguiseFemale = 70973; - public const uint SpellSunreaverDisguiseMale = 70974; - public const uint SpellSilverConenantDisguiseFemale = 70971; - public const uint SpellSilverConenantDisguiseMale = 70972; - - public const int NpcAplleboughA = 29547; - public const int NpcSweetberryH = 29715; - - //Minigob - public const int SpellManabonked = 61834; - public const int SpellTeleportVisual = 51347; - public const int SpellImprovedBlink = 61995; - - public const int EventSelectTarget = 1; - public const int EventBlink = 2; - public const int EventDespawnVisual = 3; - public const int EventDespawn = 4; - - public const int MailMinigobEntry = 264; - public const int MailDeliverDelayMin = 5 * Time.Minute; - public const int MailDeliverDelayMax = 15 * Time.Minute; - } - - [Script] - class npc_mageguard_dalaran : ScriptedAI - { - public npc_mageguard_dalaran(Creature creature) : base(creature) - { - creature.AddUnitFlag(UnitFlags.NonAttackable); - creature.ApplySpellImmune(0, SpellImmunity.Damage, (uint)SpellSchools.Normal, true); - creature.ApplySpellImmune(0, SpellImmunity.Damage, SpellSchoolMask.Magic, true); - } - - public override void Reset() { } - - public override void EnterCombat(Unit who) { } - - public override void AttackStart(Unit who) { } - - public override void MoveInLineOfSight(Unit who) - { - if (!who || !who.IsInWorld || who.GetZoneId() != 4395) - return; - - if (!me.IsWithinDist(who, 65.0f, false)) - return; - - Player player = who.GetCharmerOrOwnerPlayerOrPlayerItself(); - - if (!player || player.IsGameMaster() || player.IsBeingTeleported() || - // If player has Disguise aura for quest A Meeting With The Magister or An Audience With The Arcanist, do not teleport it away but let it pass - player.HasAura(DalaranConst.SpellSunreaverDisguiseFemale) || player.HasAura(DalaranConst.SpellSunreaverDisguiseMale) || - player.HasAura(DalaranConst.SpellSilverConenantDisguiseFemale) || player.HasAura(DalaranConst.SpellSilverConenantDisguiseMale)) - return; - - switch (me.GetEntry()) - { - case 29254: - if (player.GetTeam() == Team.Horde) // Horde unit found in Alliance area - { - if (GetClosestCreatureWithEntry(me, DalaranConst.NpcAplleboughA, 32.0f)) - { - if (me.IsInBackInMap(who, 12.0f)) // In my line of sight, "outdoors", and behind me - DoCast(who, DalaranConst.SpellTrespasserA); // Teleport the Horde unit out - } - else // In my line of sight, and "indoors" - DoCast(who, DalaranConst.SpellTrespasserA); // Teleport the Horde unit out - } - break; - case 29255: - if (player.GetTeam() == Team.Alliance) // Alliance unit found in Horde area - { - if (GetClosestCreatureWithEntry(me, DalaranConst.NpcSweetberryH, 32.0f)) - { - if (me.IsInBackInMap(who, 12.0f)) // In my line of sight, "outdoors", and behind me - DoCast(who, DalaranConst.SpellTrespasserH); // Teleport the Alliance unit out - } - else // In my line of sight, and "indoors" - DoCast(who, DalaranConst.SpellTrespasserH); // Teleport the Alliance unit out - } - break; - } - me.SetOrientation(me.GetHomePosition().GetOrientation()); - return; - } - - public override void UpdateAI(uint diff) { } - } - - [Script] - class npc_minigob_manabonk : ScriptedAI - { - public npc_minigob_manabonk(Creature creature) : base(creature) - { - me.SetActive(true); - } - - public override void Reset() - { - me.SetVisible(false); - _events.ScheduleEvent(DalaranConst.EventSelectTarget, Time.InMilliseconds); - } - - Player SelectTargetInDalaran() - { - List PlayerInDalaranList = new List(); - - var players = me.GetMap().GetPlayers(); - foreach (var player in players) - { - if (player.GetZoneId() == me.GetZoneId() && !player.IsFlying() && !player.IsMounted() && !player.IsGameMaster()) - PlayerInDalaranList.Add(player); - } - - if (PlayerInDalaranList.Empty()) - return null; - - return PlayerInDalaranList.SelectRandom(); - } - - void SendMailToPlayer(Player player) - { - SQLTransaction trans = new SQLTransaction(); - uint deliverDelay = RandomHelper.URand(DalaranConst.MailDeliverDelayMin, DalaranConst.MailDeliverDelayMax); - new MailDraft(DalaranConst.MailMinigobEntry, true).SendMailTo(trans, new MailReceiver(player), new MailSender(MailMessageType.Creature, me.GetEntry()), MailCheckMask.None, deliverDelay); - DB.Characters.CommitTransaction(trans); - } - - public override void UpdateAI(uint diff) - { - _events.Update(diff); - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case DalaranConst.EventSelectTarget: - me.SetVisible(true); - DoCast(me, DalaranConst.SpellTeleportVisual); - Player player = SelectTargetInDalaran(); - if (player) - { - me.NearTeleportTo(player.GetPositionX(), player.GetPositionY(), player.GetPositionZ(), 0.0f); - DoCast(player, DalaranConst.SpellManabonked); - SendMailToPlayer(player); - } - _events.ScheduleEvent(DalaranConst.EventBlink, 3 * Time.InMilliseconds); - break; - case DalaranConst.EventBlink: - { - DoCast(me, DalaranConst.SpellImprovedBlink); - Position pos = me.GetRandomNearPosition(RandomHelper.FRand(15, 40)); - me.GetMotionMaster().MovePoint(0, pos.posX, pos.posY, pos.posZ); - _events.ScheduleEvent(DalaranConst.EventDespawn, 3 * Time.InMilliseconds); - _events.ScheduleEvent(DalaranConst.EventDespawnVisual, (uint)(2.5 * Time.InMilliseconds)); - break; - } - case DalaranConst.EventDespawnVisual: - DoCast(me, DalaranConst.SpellTeleportVisual); - break; - case DalaranConst.EventDespawn: - me.DespawnOrUnsummon(); - break; - default: - break; - } - }); - } - } -} diff --git a/Source/Scripts/Northrend/DraktharonKeep/BossKingDred.cs b/Source/Scripts/Northrend/DraktharonKeep/BossKingDred.cs deleted file mode 100644 index c50dd4a67..000000000 --- a/Source/Scripts/Northrend/DraktharonKeep/BossKingDred.cs +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using System; - -namespace Scripts.Northrend.DraktharonKeep.KingDred -{ - struct SpellIds - { - public const uint BellowingRoar = 22686; // Fears The Group; Can Be Resisted/Dispelled - public const uint GrievousBite = 48920; - public const uint ManglingSlash = 48873; // Cast On The Current Tank; Adds Debuf - public const uint FearsomeRoar = 48849; - public const uint PiercingSlash = 48878; // Debuff -. Armor Reduced By 75% - public const uint RaptorCall = 59416; // Dummy - public const uint GutRip = 49710; - public const uint Rend = 13738; - } - - struct Misc - { - public const int ActionRaptorKilled = 1; - public const uint DataRaptorsKilled = 2; - } - - [Script] - class boss_king_dred : BossAI - { - public boss_king_dred(Creature creature) : base(creature, DTKDataTypes.KingDred) - { - Initialize(); - } - - void Initialize() - { - raptorsKilled = 0; - } - - public override void Reset() - { - Initialize(); - _Reset(); - } - - public override void EnterCombat(Unit who) - { - _EnterCombat(); - - _scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting)); - - _scheduler.Schedule(TimeSpan.FromSeconds(33), task => - { - DoCastAOE(SpellIds.BellowingRoar); - task.Repeat(); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(20), task => - { - DoCastVictim(SpellIds.GrievousBite); - task.Repeat(); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(18.5), task => - { - DoCastVictim(SpellIds.ManglingSlash); - task.Repeat(); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(20), task => - { - DoCastAOE(SpellIds.FearsomeRoar); - task.Repeat(); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(17), task => - { - DoCastVictim(SpellIds.PiercingSlash); - task.Repeat(); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(25), task => - { - DoCastVictim(SpellIds.RaptorCall); - - float x, y, z; - me.GetClosePoint(out x, out y, out z, me.GetCombatReach() / 3, 10.0f); - me.SummonCreature(RandomHelper.RAND(DTKCreatureIds.DrakkariGutripper, DTKCreatureIds.DrakkariScytheclaw), x, y, z, 0, TempSummonType.DeadDespawn, 1000); - task.Repeat(); - }); - } - - public override void DoAction(int action) - { - if (action == Misc.ActionRaptorKilled) - ++raptorsKilled; - } - - public override uint GetData(uint type) - { - if (type == Misc.DataRaptorsKilled) - return raptorsKilled; - - return 0; - } - - public override void JustDied(Unit killer) - { - _JustDied(); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - DoMeleeAttackIfReady(); - } - - byte raptorsKilled; - } - - [Script] - class npc_drakkari_gutripper : ScriptedAI - { - public npc_drakkari_gutripper(Creature creature) : base(creature) - { - Initialize(); - instance = me.GetInstanceScript(); - } - - void Initialize() - { - _scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15), task => - { - DoCastVictim(SpellIds.GutRip, false); - task.Repeat(); - }); - } - - public override void Reset() - { - Initialize(); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - DoMeleeAttackIfReady(); - } - - public override void JustDied(Unit killer) - { - Creature dred = ObjectAccessor.GetCreature(me, instance.GetGuidData(DTKDataTypes.KingDred)); - if (dred) - dred.GetAI().DoAction(Misc.ActionRaptorKilled); - } - - InstanceScript instance; - } - - [Script] - class npc_drakkari_scytheclaw : ScriptedAI - { - public npc_drakkari_scytheclaw(Creature creature) : base(creature) - { - Initialize(); - instance = me.GetInstanceScript(); - } - - void Initialize() - { - _scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15), task => - { - DoCastVictim(SpellIds.Rend, false); - task.Repeat(); - }); - } - - public override void Reset() - { - _scheduler.CancelAll(); - Initialize(); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - DoMeleeAttackIfReady(); - } - - public override void JustDied(Unit killer) - { - Creature dred = ObjectAccessor.GetCreature(me, instance.GetGuidData(DTKDataTypes.KingDred)); - if (dred) - dred.GetAI().DoAction(Misc.ActionRaptorKilled); - } - - InstanceScript instance; - } - - [Script] - class achievement_king_dred : AchievementCriteriaScript - { - public achievement_king_dred() : base("achievement_king_dred") { } - - public override bool OnCheck(Player player, Unit target) - { - if (!target) - return false; - - Creature dred = target.ToCreature(); - if (dred) - if (dred.GetAI().GetData(Misc.DataRaptorsKilled) >= 6) - return true; - - return false; - } - } -} diff --git a/Source/Scripts/Northrend/DraktharonKeep/BossNovos.cs b/Source/Scripts/Northrend/DraktharonKeep/BossNovos.cs deleted file mode 100644 index e64eb359d..000000000 --- a/Source/Scripts/Northrend/DraktharonKeep/BossNovos.cs +++ /dev/null @@ -1,410 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using Game.Spells; -using System; - -namespace Scripts.Northrend.DraktharonKeep.Novos -{ - struct TextIds - { - public const uint SayAggro = 0; - public const uint SayKill = 1; - public const uint SayDeath = 2; - public const uint SaySummoningAdds = 3; // Unused - public const uint SayArcaneField = 4; - public const uint EmoteSummoningAdds = 5; // Unused - } - - struct SpellIds - { - public const uint BeamChannel = 52106; - public const uint ArcaneField = 47346; - - public const uint SummonRisenShadowcaster = 49105; - public const uint SummonFetidTrollCorpse = 49103; - public const uint SummonHulkingCorpse = 49104; - public const uint SummonCrystalHandler = 49179; //not used - public const uint SummonCopyOfMinions = 59933; //not used - - public const uint ArcaneBlast = 49198; - public const uint Blizzard = 49034; - public const uint Frostbolt = 49037; - public const uint WrathOfMisery = 50089; - public const uint SummonMinions = 59910; - } - - struct Misc - { - public const int ActionResetCrystals = 0; - public const int ActionActivateCrystal = 1; - public const int ActionDeactivate = 2; - public const uint EventAttack = 3; - public const uint EventSummonMinions = 4; - public const uint EventSummonRisenShadowcaster = 5; - public const uint EventSummonFetidTrollCorpse = 6; - public const uint EventSummonHulkingCorpse = 7; - public const uint EventSummonCrystalHandler = 8; - public const uint DataNovosAchiev = 9; - - public static SummonerInfo[] summoners = - { - new SummonerInfo(EventSummonRisenShadowcaster, 7), - new SummonerInfo(EventSummonFetidTrollCorpse, 3), - new SummonerInfo(EventSummonHulkingCorpse, 30), - new SummonerInfo(EventSummonCrystalHandler, 15) - }; - - public struct SummonerInfo - { - public SummonerInfo(uint _eventid, uint _timer) - { - eventId = _eventid; - timer = _timer; - } - - public uint eventId; - public uint timer; - } - - public static Position[] SummonPositions = - { - new Position(-306.8209f, -703.7687f, 27.2919f, 3.401838f), - new Position(-421.395f, -705.7863f, 28.57594f, 4.830696f), - new Position(-308.1955f, -704.8419f, 27.2919f, 3.010279f), - new Position(-424.1306f, -705.7354f, 28.57594f, 5.325676f) - }; - - public const float MaxYCoordOhNovosMAX = -771.95f; - } - - [Script] - class boss_novos : BossAI - { - public boss_novos(Creature creature) : base(creature, DTKDataTypes.Novos) - { - Initialize(); - _bubbled = false; - } - - void Initialize() - { - _ohNovos = true; - } - - public override void Reset() - { - _Reset(); - - Initialize(); - SetCrystalsStatus(false); - SetSummonerStatus(false); - SetBubbled(false); - } - - public override void EnterCombat(Unit victim) - { - _EnterCombat(); - Talk(TextIds.SayAggro); - - SetCrystalsStatus(true); - SetSummonerStatus(true); - SetBubbled(true); - } - - public override void AttackStart(Unit target) - { - if (!target) - return; - - if (me.Attack(target, true)) - DoStartNoMovement(target); - } - - public override void KilledUnit(Unit who) - { - if (who.IsTypeId(TypeId.Player)) - Talk(TextIds.SayKill); - } - - public override void JustDied(Unit killer) - { - _JustDied(); - Talk(TextIds.SayDeath); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim() || _bubbled) - return; - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case Misc.EventSummonMinions: - DoCast(SpellIds.SummonMinions); - _events.ScheduleEvent(Misc.EventSummonMinions, 15000); - break; - case Misc.EventAttack: - Unit victim = SelectTarget(SelectAggroTarget.Random); - if (victim) - DoCast(victim, RandomHelper.RAND(SpellIds.ArcaneBlast, SpellIds.Blizzard, SpellIds.Frostbolt, SpellIds.WrathOfMisery)); - _events.ScheduleEvent(Misc.EventAttack, 3000); - break; - default: - break; - } - - if (me.HasUnitState(UnitState.Casting)) - return; - }); - } - - public override void DoAction(int action) - { - if (action == DTKDataTypes.ActionCrystalHandlerDied) - { - Talk(TextIds.SayArcaneField); - SetSummonerStatus(false); - SetBubbled(false); - _events.ScheduleEvent(Misc.EventAttack, 3000); - if (IsHeroic()) - _events.ScheduleEvent(Misc.EventSummonMinions, 15000); - } - } - - public override void MoveInLineOfSight(Unit who) - { - base.MoveInLineOfSight(who); - - if (!_ohNovos || !who || !who.IsTypeId(TypeId.Player) || who.GetPositionY() > Misc.MaxYCoordOhNovosMAX) - return; - - uint entry = who.GetEntry(); - if (entry == DTKCreatureIds.HulkingCorpse || entry == DTKCreatureIds.RisenShadowcaster || entry == DTKCreatureIds.FetidTrollCorpse) - _ohNovos = false; - } - - public override uint GetData(uint type) - { - return type == Misc.DataNovosAchiev && _ohNovos ? 1 : 0u; - } - - public override void JustSummoned(Creature summon) - { - me.Yell(TextIds.SaySummoningAdds, summon); - me.TextEmote(TextIds.EmoteSummoningAdds, summon); - - summon.SelectNearestTargetInAttackDistance(50f); - summons.Summon(summon); - } - - void SetBubbled(bool state) - { - _bubbled = state; - if (!state) - { - if (me.HasUnitFlag(UnitFlags.NonAttackable)) - me.RemoveUnitFlag(UnitFlags.NonAttackable); - if (me.HasUnitState(UnitState.Casting)) - me.CastStop(); - } - else - { - if (!me.HasUnitFlag(UnitFlags.NonAttackable)) - me.AddUnitFlag(UnitFlags.NonAttackable); - DoCast(SpellIds.ArcaneField); - } - } - - void SetSummonerStatus(bool active) - { - for (byte i = 0; i < 4; i++) - { - ObjectGuid guid = instance.GetGuidData(DTKDataTypes.NovosSummoner1 + i); - if (!guid.IsEmpty()) - { - Creature crystalChannelTarget = ObjectAccessor.GetCreature(me, guid); - if (crystalChannelTarget) - { - if (active) - crystalChannelTarget.GetAI().SetData(Misc.summoners[i].eventId, Misc.summoners[i].timer); - else - crystalChannelTarget.GetAI().Reset(); - } - } - } - } - - void SetCrystalsStatus(bool active) - { - for (byte i = 0; i < 4; i++) - { - ObjectGuid guid = instance.GetGuidData(DTKDataTypes.NovosCrystal1 + i); - if (!guid.IsEmpty()) - { - GameObject crystal = ObjectAccessor.GetGameObject(me, guid); - if (crystal) - SetCrystalStatus(crystal, active); - } - } - } - - void SetCrystalStatus(GameObject crystal, bool active) - { - crystal.SetGoState(active ? GameObjectState.Active : GameObjectState.Ready); - - Creature crystalChannelTarget = crystal.FindNearestCreature(DTKCreatureIds.CrystalChannelTarget, 5.0f); - if (crystalChannelTarget) - { - if (active) - crystalChannelTarget.CastSpell(null, SpellIds.BeamChannel); - else if (crystalChannelTarget.HasUnitState(UnitState.Casting)) - crystalChannelTarget.CastStop(); - } - } - - bool _ohNovos; - bool _bubbled; - } - - [Script] - class npc_crystal_channel_target : ScriptedAI - { - public npc_crystal_channel_target(Creature creature) : base(creature) { } - - public override void Reset() - { - _events.Reset(); - _crystalHandlerCount = 0; - } - - public override void UpdateAI(uint diff) - { - _events.Update(diff); - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case Misc.EventSummonCrystalHandler: - me.SummonCreature(DTKCreatureIds.CrystalHandler, Misc.SummonPositions[_crystalHandlerCount++]); - if (_crystalHandlerCount < 4) - _events.Repeat(TimeSpan.FromSeconds(15)); - break; - case Misc.EventSummonRisenShadowcaster: - DoCast(SpellIds.SummonRisenShadowcaster); - _events.Repeat(TimeSpan.FromSeconds(7)); - break; - case Misc.EventSummonFetidTrollCorpse: - DoCast(SpellIds.SummonFetidTrollCorpse); - _events.Repeat(TimeSpan.FromSeconds(3)); - break; - case Misc.EventSummonHulkingCorpse: - DoCast(SpellIds.SummonHulkingCorpse); - _events.Repeat(TimeSpan.FromSeconds(30)); - break; - } - }); - } - - public override void SetData(uint id, uint value) - { - _events.ScheduleEvent(id, TimeSpan.FromSeconds(value)); - } - - public override void SummonedCreatureDies(Creature summon, Unit killer) - { - if (_crystalHandlerCount < 4) - return; - - InstanceScript instance = me.GetInstanceScript(); - if (instance != null) - { - ObjectGuid guid = instance.GetGuidData(DTKDataTypes.Novos); - if (!guid.IsEmpty()) - { - Creature novos = ObjectAccessor.GetCreature(me, guid); - if (novos) - novos.GetAI().DoAction(DTKDataTypes.ActionCrystalHandlerDied); - } - } - } - - public override void JustSummoned(Creature summon) - { - InstanceScript instance = me.GetInstanceScript(); - if (instance != null) - { - ObjectGuid guid = instance.GetGuidData(DTKDataTypes.Novos); - if (!guid.IsEmpty()) - { - Creature novos = ObjectAccessor.GetCreature(me, guid); - if (novos) - novos.GetAI().JustSummoned(summon); - } - } - - if (summon) - summon.GetMotionMaster().MovePath(summon.GetEntry() * 100, false); - } - - uint _crystalHandlerCount; - } - - [Script] - class achievement_oh_novos : AchievementCriteriaScript - { - public achievement_oh_novos() : base("achievement_oh_novos") { } - - public override bool OnCheck(Player player, Unit target) - { - return target && target.IsTypeId(TypeId.Unit) && target.ToCreature().GetAI().GetData(Misc.DataNovosAchiev) != 0; - } - } - - [Script] - class spell_novos_summon_minions : SpellScript - { - public override bool Validate(SpellInfo spellInfo) - { - return ValidateSpellInfo(SpellIds.SummonCopyOfMinions); - } - - void HandleScript(uint effIndex) - { - for (byte i = 0; i < 2; ++i) - GetCaster().CastSpell((Unit)null, SpellIds.SummonCopyOfMinions, true); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); - } - } -} diff --git a/Source/Scripts/Northrend/DraktharonKeep/BossTharonJa.cs b/Source/Scripts/Northrend/DraktharonKeep/BossTharonJa.cs deleted file mode 100644 index 4af0ab0ad..000000000 --- a/Source/Scripts/Northrend/DraktharonKeep/BossTharonJa.cs +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Scripting; -using Game.Spells; -using System; - -namespace Scripts.Northrend.DraktharonKeep.TharonJa -{ - struct SpellIds - { - // Skeletal Spells (Phase 1) - public const uint CurseOfLife = 49527; - public const uint RainOfFire = 49518; - public const uint ShadowVolley = 49528; - public const uint DecayFlesh = 49356; // Cast At End Of Phase 1; Starts Phase 2 - // Flesh Spells (Phase 2) - public const uint GiftOfTharonJa = 52509; - public const uint ClearGiftOfTharonJa = 53242; - public const uint EyeBeam = 49544; - public const uint LightningBreath = 49537; - public const uint PoisonCloud = 49548; - public const uint ReturnFlesh = 53463; // Channeled Spell Ending Phase Two And Returning To Phase 1. This Ability Will Stun The Party For 6 Seconds. - public const uint AchievementCheck = 61863; - public const uint FleshVisual = 52582; - public const uint Dummy = 49551; - } - - struct EventIds - { - public const uint CurseOfLife = 1; - public const uint RainOfFire = 2; - public const uint ShadowVolley = 3; - - public const uint EyeBeam = 4; - public const uint LightningBreath = 5; - public const uint PoisonCloud = 6; - - public const uint DecayFlesh = 7; - public const uint GoingFlesh = 8; - public const uint ReturnFlesh = 9; - public const uint GoingSkeletal = 10; - } - - struct TextIds - { - public const uint SayAggro = 0; - public const uint SayKill = 1; - public const uint SayFlesh = 2; - public const uint SaySkeleton = 3; - public const uint SayDeath = 4; - } - - struct Misc - { - public const uint ModelFlesh = 27073; - } - - [Script] - class boss_tharon_ja : BossAI - { - public boss_tharon_ja(Creature creature) : base(creature, DTKDataTypes.TharonJa) { } - - public override void Reset() - { - _Reset(); - me.RestoreDisplayId(); - } - - public override void EnterCombat(Unit who) - { - Talk(TextIds.SayAggro); - _EnterCombat(); - - _events.ScheduleEvent(EventIds.DecayFlesh, TimeSpan.FromSeconds(20)); - _events.ScheduleEvent(EventIds.CurseOfLife, TimeSpan.FromSeconds(1)); - _events.ScheduleEvent(EventIds.RainOfFire, TimeSpan.FromSeconds(14), TimeSpan.FromSeconds(18)); - _events.ScheduleEvent(EventIds.ShadowVolley, TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(10)); - } - - public override void KilledUnit(Unit who) - { - if (who.IsTypeId(TypeId.Player)) - Talk(TextIds.SayKill); - } - - public override void JustDied(Unit killer) - { - _JustDied(); - - Talk(TextIds.SayDeath); - DoCastAOE(SpellIds.ClearGiftOfTharonJa, true); - DoCastAOE(SpellIds.AchievementCheck, true); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case EventIds.CurseOfLife: - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true); - if (target) - DoCast(target, SpellIds.CurseOfLife); - _events.ScheduleEvent(EventIds.CurseOfLife, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15)); - } - return; - case EventIds.ShadowVolley: - DoCastVictim(SpellIds.ShadowVolley); - _events.ScheduleEvent(EventIds.ShadowVolley, TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(10)); - return; - case EventIds.RainOfFire: - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true); - if (target) - DoCast(target, SpellIds.RainOfFire); - _events.ScheduleEvent(EventIds.RainOfFire, TimeSpan.FromSeconds(14), TimeSpan.FromSeconds(18)); - } - return; - case EventIds.LightningBreath: - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true); - if (target) - DoCast(target, SpellIds.LightningBreath); - _events.ScheduleEvent(EventIds.LightningBreath, TimeSpan.FromSeconds(6), TimeSpan.FromSeconds(7)); - } - return; - case EventIds.EyeBeam: - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true); - if (target) - DoCast(target, SpellIds.EyeBeam); - _events.ScheduleEvent(EventIds.EyeBeam, TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(6)); - } - return; - case EventIds.PoisonCloud: - DoCastAOE(SpellIds.PoisonCloud); - _events.ScheduleEvent(EventIds.PoisonCloud, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12)); - return; - case EventIds.DecayFlesh: - DoCastAOE(SpellIds.DecayFlesh); - _events.ScheduleEvent(EventIds.GoingFlesh, TimeSpan.FromSeconds(6)); - return; - case EventIds.GoingFlesh: - Talk(TextIds.SayFlesh); - me.SetDisplayId(Misc.ModelFlesh); - DoCastAOE(SpellIds.GiftOfTharonJa, true); - DoCast(me, SpellIds.FleshVisual, true); - DoCast(me, SpellIds.Dummy, true); - - _events.Reset(); - _events.ScheduleEvent(EventIds.ReturnFlesh, TimeSpan.FromSeconds(20)); - _events.ScheduleEvent(EventIds.LightningBreath, TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(4)); - _events.ScheduleEvent(EventIds.EyeBeam, TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(8)); - _events.ScheduleEvent(EventIds.PoisonCloud, TimeSpan.FromSeconds(6), TimeSpan.FromSeconds(7)); - break; - case EventIds.ReturnFlesh: - DoCastAOE(SpellIds.ReturnFlesh); - _events.ScheduleEvent(EventIds.GoingSkeletal, 6000); - return; - case EventIds.GoingSkeletal: - Talk(TextIds.SaySkeleton); - me.RestoreDisplayId(); - DoCastAOE(SpellIds.ClearGiftOfTharonJa, true); - - _events.Reset(); - _events.ScheduleEvent(EventIds.DecayFlesh, TimeSpan.FromSeconds(20)); - _events.ScheduleEvent(EventIds.CurseOfLife, TimeSpan.FromSeconds(1)); - _events.ScheduleEvent(EventIds.RainOfFire, TimeSpan.FromSeconds(14), TimeSpan.FromSeconds(18)); - _events.ScheduleEvent(EventIds.ShadowVolley, TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(10)); - break; - default: - break; - } - - if (me.HasUnitState(UnitState.Casting)) - return; - }); - - DoMeleeAttackIfReady(); - } - } - - [Script] - class spell_tharon_ja_clear_gift_of_tharon_ja : SpellScript - { - public override bool Validate(SpellInfo spellInfo) - { - return ValidateSpellInfo(SpellIds.GiftOfTharonJa); - } - - void HandleScript(uint effIndex) - { - Unit target = GetHitUnit(); - if (target) - target.RemoveAura(SpellIds.GiftOfTharonJa); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); - } - } -} diff --git a/Source/Scripts/Northrend/DraktharonKeep/BossTrollgore.cs b/Source/Scripts/Northrend/DraktharonKeep/BossTrollgore.cs deleted file mode 100644 index 47c8b2cf9..000000000 --- a/Source/Scripts/Northrend/DraktharonKeep/BossTrollgore.cs +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Scripting; -using Game.Spells; -using System; - -namespace Scripts.Northrend.DraktharonKeep.Trollgore -{ - struct SpellIds - { - public const uint InfectedWound = 49637; - public const uint Crush = 49639; - public const uint CorpseExplode = 49555; - public const uint CorpseExplodeDamage = 49618; - public const uint Consume = 49380; - public const uint ConsumeBuff = 49381; - public const uint ConsumeBuffH = 59805; - - public const uint SummonInvaderA = 49456; - public const uint SummonInvaderB = 49457; - public const uint SummonInvaderC = 49458; // Can'T Find Any Sniffs - - public const uint InvaderTaunt = 49405; - } - - struct TextIds - { - public const uint SayAggro = 0; - public const uint SayKill = 1; - public const uint SayConsume = 2; - public const uint SayExplode = 3; - public const uint SayDeath = 4; - } - - struct Misc - { - public const uint DataConsumptionJunction = 1; - public const uint PointLanding = 1; - - public static Position Landing = new Position(-263.0534f, -660.8658f, 26.50903f, 0.0f); - } - - [Script] - class boss_trollgore : BossAI - { - public boss_trollgore(Creature creature) : base(creature, DTKDataTypes.Trollgore) - { - Initialize(); - } - - void Initialize() - { - _consumptionJunction = true; - } - - public override void Reset() - { - _Reset(); - Initialize(); - } - - public override void EnterCombat(Unit who) - { - _EnterCombat(); - Talk(TextIds.SayAggro); - - _scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting)); - - _scheduler.Schedule(TimeSpan.FromSeconds(15), task => - { - Talk(TextIds.SayConsume); - DoCastAOE(SpellIds.Consume); - task.Repeat(); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(5), task => - { - DoCastVictim(SpellIds.Crush); - task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(15)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(60), task => - { - DoCastVictim(SpellIds.InfectedWound); - task.Repeat(TimeSpan.FromSeconds(25), TimeSpan.FromSeconds(35)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(3), task => - { - Talk(TextIds.SayExplode); - DoCastAOE(SpellIds.CorpseExplode); - task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(19)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(40), task => - { - for (byte i = 0; i < 3; ++i) - { - Creature trigger = ObjectAccessor.GetCreature(me, instance.GetGuidData(DTKDataTypes.TrollgoreInvaderSummoner1 + i)); - if (trigger) - trigger.CastSpell(trigger, RandomHelper.RAND(SpellIds.SummonInvaderA, SpellIds.SummonInvaderB, SpellIds.SummonInvaderC), true, null, null, me.GetGUID()); - } - - task.Repeat(); - }); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - if (_consumptionJunction) - { - Aura ConsumeAura = me.GetAura(DungeonMode(SpellIds.ConsumeBuff, SpellIds.ConsumeBuffH)); - if (ConsumeAura != null && ConsumeAura.GetStackAmount() > 9) - _consumptionJunction = false; - } - - DoMeleeAttackIfReady(); - } - - public override void JustDied(Unit killer) - { - _JustDied(); - Talk(TextIds.SayDeath); - } - - public override uint GetData(uint type) - { - if (type == Misc.DataConsumptionJunction) - return _consumptionJunction ? 1 : 0u; - - return 0; - } - - public override void KilledUnit(Unit victim) - { - if (victim.IsTypeId(TypeId.Player)) - Talk(TextIds.SayKill); - } - - public override void JustSummoned(Creature summon) - { - summon.GetMotionMaster().MovePoint(Misc.PointLanding, Misc.Landing); - summons.Summon(summon); - } - - bool _consumptionJunction; - } - - [Script] - class npc_drakkari_invader : ScriptedAI - { - public npc_drakkari_invader(Creature creature) : base(creature) { } - - public override void MovementInform(MovementGeneratorType type, uint pointId) - { - if (type == MovementGeneratorType.Point && pointId == Misc.PointLanding) - { - me.Dismount(); - me.RemoveUnitFlag(UnitFlags.ImmuneToPc | UnitFlags.ImmuneToNpc); - DoCastAOE(SpellIds.InvaderTaunt); - } - } - } - - [Script] // 49380, 59803 - Consume - class spell_trollgore_consume : SpellScript - { - public override bool Validate(SpellInfo spellInfo) - { - return ValidateSpellInfo(SpellIds.ConsumeBuff); - } - - void HandleConsume(uint effIndex) - { - Unit target = GetHitUnit(); - if (target) - target.CastSpell(GetCaster(), SpellIds.ConsumeBuff, true); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleConsume, 1, SpellEffectName.ScriptEffect)); - } - } - - [Script] // 49555, 59807 - Corpse Explode - class spell_trollgore_corpse_explode : AuraScript - { - public override bool Validate(SpellInfo spellInfo) - { - return ValidateSpellInfo(SpellIds.CorpseExplodeDamage); - } - - void PeriodicTick(AuraEffect aurEff) - { - if (aurEff.GetTickNumber() == 2) - { - Unit caster = GetCaster(); - if (caster) - caster.CastSpell(GetTarget(), SpellIds.CorpseExplodeDamage, true, null, aurEff); - } - } - - void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Creature target = GetTarget().ToCreature(); - if (target) - target.DespawnOrUnsummon(); - } - - public override void Register() - { - OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 0, AuraType.Dummy)); - AfterEffectRemove.Add(new EffectApplyHandler(HandleRemove, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.Real)); - } - } - - [Script] // 49405 - Invader Taunt Trigger - class spell_trollgore_invader_taunt : SpellScript - { - public override bool Validate(SpellInfo spellInfo) - { - return ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue()); - } - - void HandleTaunt(uint effIndex) - { - Unit target = GetHitUnit(); - if (target) - target.CastSpell(GetCaster(), (uint)GetEffectValue(), true); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleTaunt, 0, SpellEffectName.ScriptEffect)); - } - } - - [Script] - class achievement_consumption_junction : AchievementCriteriaScript - { - public achievement_consumption_junction() : base("achievement_consumption_junction") { } - - public override bool OnCheck(Player source, Unit target) - { - if (!target) - return false; - - Creature Trollgore = target.ToCreature(); - if (Trollgore) - if (Trollgore.GetAI().GetData(Misc.DataConsumptionJunction) != 0) - return true; - - return false; - } - } -} diff --git a/Source/Scripts/Northrend/DraktharonKeep/InstanceDrakTharonKeep.cs b/Source/Scripts/Northrend/DraktharonKeep/InstanceDrakTharonKeep.cs deleted file mode 100644 index 1c777a37a..000000000 --- a/Source/Scripts/Northrend/DraktharonKeep/InstanceDrakTharonKeep.cs +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Game.Entities; -using Game.Maps; -using Game.Scripting; - -namespace Scripts.Northrend.DraktharonKeep -{ - struct DTKDataTypes - { - // Encounter States/Boss Guids - public const uint Trollgore = 0; - public const uint Novos = 1; - public const uint KingDred = 2; - public const uint TharonJa = 3; - - // Additional Data - //public const uint KingDredAchiev; - - public const uint TrollgoreInvaderSummoner1 = 4; - public const uint TrollgoreInvaderSummoner2 = 5; - public const uint TrollgoreInvaderSummoner3 = 6; - - public const uint NovosCrystal1 = 7; - public const uint NovosCrystal2 = 8; - public const uint NovosCrystal3 = 9; - public const uint NovosCrystal4 = 10; - public const uint NovosSummoner1 = 11; - public const uint NovosSummoner2 = 12; - public const uint NovosSummoner3 = 13; - public const uint NovosSummoner4 = 14; - - public const int ActionCrystalHandlerDied = 15; - } - - struct DTKCreatureIds - { - public const uint Trollgore = 26630; - public const uint Novos = 26631; - public const uint KingDred = 27483; - public const uint TharonJa = 26632; - - // Trollgore - public const uint DrakkariInvaderA = 27709; - public const uint DrakkariInvaderB = 27753; - public const uint DrakkariInvaderC = 27754; - - // Novos - public const uint CrystalChannelTarget = 26712; - public const uint CrystalHandler = 26627; - public const uint HulkingCorpse = 27597; - public const uint FetidTrollCorpse = 27598; - public const uint RisenShadowcaster = 27600; - - // King Dred - public const uint DrakkariGutripper = 26641; - public const uint DrakkariScytheclaw = 26628; - - public const uint WorldTrigger = 22515; - } - - struct DTKGameObjectIds - { - public const uint NovosCrystal1 = 189299; - public const uint NovosCrystal2 = 189300; - public const uint NovosCrystal3 = 189301; - public const uint NovosCrystal4 = 189302; - } - - [Script] - class instance_drak_tharon_keep : InstanceMapScript - { - public instance_drak_tharon_keep() : base(nameof(instance_drak_tharon_keep), 600) { } - - class instance_drak_tharon_keep_InstanceScript : InstanceScript - { - public instance_drak_tharon_keep_InstanceScript(InstanceMap map) : base(map) - { - SetHeaders("DTK"); - SetBossNumber(4); - } - - public override void OnCreatureCreate(Creature creature) - { - switch (creature.GetEntry()) - { - case DTKCreatureIds.Trollgore: - TrollgoreGUID = creature.GetGUID(); - break; - case DTKCreatureIds.Novos: - NovosGUID = creature.GetGUID(); - break; - case DTKCreatureIds.KingDred: - KingDredGUID = creature.GetGUID(); - break; - case DTKCreatureIds.TharonJa: - TharonJaGUID = creature.GetGUID(); - break; - case DTKCreatureIds.WorldTrigger: - InitializeTrollgoreInvaderSummoner(creature); - break; - case DTKCreatureIds.CrystalChannelTarget: - InitializeNovosSummoner(creature); - break; - default: - break; - } - } - - public override void OnGameObjectCreate(GameObject go) - { - switch (go.GetEntry()) - { - case DTKGameObjectIds.NovosCrystal1: - NovosCrystalGUIDs[0] = go.GetGUID(); - break; - case DTKGameObjectIds.NovosCrystal2: - NovosCrystalGUIDs[1] = go.GetGUID(); - break; - case DTKGameObjectIds.NovosCrystal3: - NovosCrystalGUIDs[2] = go.GetGUID(); - break; - case DTKGameObjectIds.NovosCrystal4: - NovosCrystalGUIDs[3] = go.GetGUID(); - break; - default: - break; - } - } - - void InitializeTrollgoreInvaderSummoner(Creature creature) - { - float y = creature.GetPositionY(); - float z = creature.GetPositionZ(); - - if (z < 50.0f) - return; - - if (y < -650.0f && y > -660.0f) - TrollgoreInvaderSummonerGuids[0] = creature.GetGUID(); - else if (y < -660.0f && y > -670.0f) - TrollgoreInvaderSummonerGuids[1] = creature.GetGUID(); - else if (y < -675.0f && y > -685.0f) - TrollgoreInvaderSummonerGuids[2] = creature.GetGUID(); - } - - void InitializeNovosSummoner(Creature creature) - { - float x = creature.GetPositionX(); - float y = creature.GetPositionY(); - float z = creature.GetPositionZ(); - - if (x < -374.0f && x > -379.0f && y > -820.0f && y < -815.0f && z < 60.0f && z > 58.0f) - NovosSummonerGUIDs[0] = creature.GetGUID(); - else if (x < -379.0f && x > -385.0f && y > -820.0f && y < -815.0f && z < 60.0f && z > 58.0f) - NovosSummonerGUIDs[1] = creature.GetGUID(); - else if (x < -374.0f && x > -385.0f && y > -827.0f && y < -820.0f && z < 60.0f && z > 58.0f) - NovosSummonerGUIDs[2] = creature.GetGUID(); - else if (x < -338.0f && x > -380.0f && y > -727.0f && y < 721.0f && z < 30.0f && z > 26.0f) - NovosSummonerGUIDs[3] = creature.GetGUID(); - } - - public override ObjectGuid GetGuidData(uint type) - { - switch (type) - { - case DTKDataTypes.Trollgore: - return TrollgoreGUID; - case DTKDataTypes.Novos: - return NovosGUID; - case DTKDataTypes.KingDred: - return KingDredGUID; - case DTKDataTypes.TharonJa: - return TharonJaGUID; - case DTKDataTypes.TrollgoreInvaderSummoner1: - case DTKDataTypes.TrollgoreInvaderSummoner2: - case DTKDataTypes.TrollgoreInvaderSummoner3: - return TrollgoreInvaderSummonerGuids[type - DTKDataTypes.TrollgoreInvaderSummoner1]; - case DTKDataTypes.NovosCrystal1: - case DTKDataTypes.NovosCrystal2: - case DTKDataTypes.NovosCrystal3: - case DTKDataTypes.NovosCrystal4: - return NovosCrystalGUIDs[type - DTKDataTypes.NovosCrystal1]; - case DTKDataTypes.NovosSummoner1: - case DTKDataTypes.NovosSummoner2: - case DTKDataTypes.NovosSummoner3: - case DTKDataTypes.NovosSummoner4: - return NovosSummonerGUIDs[type - DTKDataTypes.NovosSummoner1]; - } - - return ObjectGuid.Empty; - } - - ObjectGuid TrollgoreGUID; - ObjectGuid NovosGUID; - ObjectGuid KingDredGUID; - ObjectGuid TharonJaGUID; - - ObjectGuid[] TrollgoreInvaderSummonerGuids = new ObjectGuid[3]; - ObjectGuid[] NovosCrystalGUIDs = new ObjectGuid[4]; - ObjectGuid[] NovosSummonerGUIDs = new ObjectGuid[4]; - } - - public override InstanceScript GetInstanceScript(InstanceMap map) - { - return new instance_drak_tharon_keep_InstanceScript(map); - } - } -} diff --git a/Source/Scripts/Northrend/FrozenHalls/ForgeOfSouls/BossBronjahm.cs b/Source/Scripts/Northrend/FrozenHalls/ForgeOfSouls/BossBronjahm.cs deleted file mode 100644 index 258aba6c3..000000000 --- a/Source/Scripts/Northrend/FrozenHalls/ForgeOfSouls/BossBronjahm.cs +++ /dev/null @@ -1,331 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using Game.Spells; -using System; -using System.Collections.Generic; - -namespace Scripts.Northrend.FrozenHalls.ForgeOfSouls.Bronjahm -{ - struct TextIds - { - public const uint SayAggro = 0; - public const uint SaySlay = 1; - public const uint SayDeath = 2; - public const uint SaySoulStorm = 3; - public const uint SayCorruptSoul = 4; - } - - struct SpellIds - { - public const uint MagicSBane = 68793; - public const uint ShadowBolt = 70043; - public const uint CorruptSoul = 68839; - public const uint ConsumeSoul = 68861; - public const uint Teleport = 68988; - public const uint Fear = 68950; - public const uint Soulstorm = 68872; - public const uint SoulstormChannel = 69008; // Pre-Fight - public const uint SoulstormVisual = 68870; // Pre-Cast Soulstorm - public const uint PurpleBanishVisual = 68862; // Used By Soul Fragment (Aura) - } - - struct EventIds - { - public const uint MagicBane = 1; - public const uint ShadowBolt = 2; - public const uint CorruptSoul = 3; - public const uint Soulstorm = 4; - public const uint Fear = 5; - } - - struct Misc - { - public const uint DataSoulPower = 1; - - public const byte Phase1 = 1; - public const byte Phase2 = 2; - - public static uint[] SoulstormVisualSpells = - { - 68904, - 68886, - 68905, - 68896, - 68906, - 68897, - 68907, - 68898 - }; - } - - [Script] - class boss_bronjahm : BossAI - { - public boss_bronjahm(Creature creature) : base(creature, DataType.Bronjahm) - { - DoCast(me, SpellIds.SoulstormChannel, true); - } - - public override void Reset() - { - _Reset(); - _events.SetPhase(Misc.Phase1); - _events.ScheduleEvent(EventIds.ShadowBolt, 2000); - _events.ScheduleEvent(EventIds.MagicBane, TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(20)); - _events.ScheduleEvent(EventIds.CorruptSoul, TimeSpan.FromSeconds(25), TimeSpan.FromSeconds(35), 0, Misc.Phase1); - } - - public override void JustReachedHome() - { - _JustReachedHome(); - DoCast(me, SpellIds.SoulstormChannel, true); - } - - public override void EnterCombat(Unit who) - { - _EnterCombat(); - Talk(TextIds.SayAggro); - me.RemoveAurasDueToSpell(SpellIds.SoulstormChannel); - } - - public override void JustDied(Unit killer) - { - _JustDied(); - Talk(TextIds.SayDeath); - } - - public override void KilledUnit(Unit who) - { - if (who.GetTypeId() == TypeId.Player) - Talk(TextIds.SaySlay); - } - - public override void DamageTaken(Unit attacker, ref uint damage) - { - if (_events.IsInPhase(Misc.Phase1) && !HealthAbovePct(30)) - { - _events.SetPhase(Misc.Phase2); - DoCast(me, SpellIds.Teleport); - _events.ScheduleEvent(EventIds.Fear, TimeSpan.FromSeconds(12), TimeSpan.FromSeconds(16), 0, Misc.Phase2); - _events.ScheduleEvent(EventIds.Soulstorm, 100, 0, Misc.Phase2); - } - } - - public override void JustSummoned(Creature summon) - { - if (summon.GetEntry() == CreatureIds.CorruptedSoulFragment) - { - summons.Summon(summon); - summon.SetReactState(ReactStates.Passive); - summon.GetMotionMaster().MoveFollow(me, me.GetCombatReach(), 0.0f); - summon.CastSpell(summon, SpellIds.PurpleBanishVisual, true); - } - } - - public override uint GetData(uint type) - { - if (type == Misc.DataSoulPower) - { - uint count = 0; - foreach (ObjectGuid guid in summons) - { - Creature summon = ObjectAccessor.GetCreature(me, guid); - if (summon) - if (summon.GetEntry() == CreatureIds.CorruptedSoulFragment && summon.IsAlive()) - ++count; - } - - return count; - } - - return 0; - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case EventIds.MagicBane: - DoCastAOE(SpellIds.MagicSBane); - _events.ScheduleEvent(EventIds.MagicBane, TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(20)); - break; - case EventIds.ShadowBolt: - if (_events.IsInPhase(Misc.Phase2)) - { - DoCastVictim(SpellIds.ShadowBolt); - _events.ScheduleEvent(EventIds.ShadowBolt, TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(2)); - } - else - { - if (!me.IsWithinMeleeRange(me.GetVictim())) - DoCastVictim(SpellIds.ShadowBolt); - _events.ScheduleEvent(EventIds.ShadowBolt, TimeSpan.FromMilliseconds(2)); - } - break; - case EventIds.CorruptSoul: - Unit target = SelectTarget(SelectAggroTarget.Random, 1, 0.0f, true); - if (target) - { - Talk(TextIds.SayCorruptSoul); - DoCast(target, SpellIds.CorruptSoul); - } - _events.ScheduleEvent(EventIds.CorruptSoul, TimeSpan.FromSeconds(25), TimeSpan.FromSeconds(35), 0, Misc.Phase1); - break; - case EventIds.Soulstorm: - Talk(TextIds.SaySoulStorm); - me.CastSpell(me, SpellIds.SoulstormVisual, true); - me.CastSpell(me, SpellIds.Soulstorm, false); - break; - case EventIds.Fear: - me.CastCustomSpell(SpellIds.Fear, SpellValueMod.MaxTargets, 1, null, false); - _events.ScheduleEvent(EventIds.Fear, TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(12), 0, Misc.Phase2); - break; - default: - break; - } - - if (me.HasUnitState(UnitState.Casting)) - return; - }); - - if (!_events.IsInPhase(Misc.Phase2)) - DoMeleeAttackIfReady(); - } - } - - [Script] - class npc_corrupted_soul_fragment : ScriptedAI - { - public npc_corrupted_soul_fragment(Creature creature) : base(creature) - { - instance = me.GetInstanceScript(); - } - - public override void IsSummonedBy(Unit summoner) - { - Creature bronjahm = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataType.Bronjahm)); - if (bronjahm) - bronjahm.GetAI().JustSummoned(me); - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - if (type != MovementGeneratorType.Follow) - return; - - if (instance.GetGuidData(DataType.Bronjahm).GetCounter() != id) - return; - - me.CastSpell((Unit)null, SpellIds.ConsumeSoul, true); - me.DespawnOrUnsummon(); - } - - InstanceScript instance; - } - - [Script] - class spell_bronjahm_magic_bane : SpellScript - { - void RecalculateDamage() - { - if (GetHitUnit().GetPowerType() != PowerType.Mana) - return; - - int maxDamage = GetCaster().GetMap().IsHeroic() ? 15000 : 10000; - int newDamage = GetHitDamage() + (GetHitUnit().GetMaxPower(PowerType.Mana) / 2); - - SetHitDamage(Math.Min(maxDamage, newDamage)); - } - - public override void Register() - { - OnHit.Add(new HitHandler(RecalculateDamage)); - } - } - - [Script] - class spell_bronjahm_consume_soul : SpellScript - { - void HandleScript(uint effIndex) - { - PreventHitDefaultEffect(effIndex); - GetHitUnit().CastSpell(GetHitUnit(), (uint)GetEffectValue(), true); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); - } - } - - [Script] - class spell_bronjahm_soulstorm_visual : AuraScript - { - void HandlePeriodicTick(AuraEffect aurEff) - { - PreventDefaultAction(); - GetTarget().CastSpell(GetTarget(), Misc.SoulstormVisualSpells[aurEff.GetTickNumber() % 8], true); - } - - public override void Register() - { - OnEffectPeriodic.Add(new EffectPeriodicHandler(HandlePeriodicTick, 0, AuraType.PeriodicDummy)); - } - } - - [Script] - class spell_bronjahm_soulstorm_targeting : SpellScript - { - void FilterTargets(List targets) - { - Unit caster = GetCaster(); - targets.RemoveAll(target => caster.GetExactDist2d(target) <= 10.0f); - } - - public override void Register() - { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, SpellConst.EffectAll, Targets.UnitDestAreaEnemy)); - } - } - - [Script] - class achievement_bronjahm_soul_power : AchievementCriteriaScript - { - public achievement_bronjahm_soul_power() : base("achievement_bronjahm_soul_power") { } - - public override bool OnCheck(Player source, Unit target) - { - return target && target.GetAI().GetData(Misc.DataSoulPower) >= 4; - } - } -} diff --git a/Source/Scripts/Northrend/FrozenHalls/ForgeOfSouls/BossDevourerOfSouls.cs b/Source/Scripts/Northrend/FrozenHalls/ForgeOfSouls/BossDevourerOfSouls.cs deleted file mode 100644 index 269c10d5e..000000000 --- a/Source/Scripts/Northrend/FrozenHalls/ForgeOfSouls/BossDevourerOfSouls.cs +++ /dev/null @@ -1,414 +0,0 @@ -using System; -using System.Collections.Generic; -using Game.Entities; -using Framework.Constants; -using Game.Scripting; -using Game.AI; -using Game.Spells; - -namespace Scripts.Northrend.FrozenHalls.ForgeOfSouls.DevourerOfSouls -{ - struct TextIds - { - public const uint SayFaceAggro = 0; - public const byte SayFaceAngerSlay = 1; - public const byte SayFaceSorrowSlay = 2; - public const byte SayFaceDesireSlay = 3; - public const uint SayFaceDeath = 4; - public const uint EmoteMirroredSoul = 5; - public const uint EmoteUnleashSoul = 6; - public const uint SayFaceUnleashSoul = 7; - public const uint EmoteWailingSoul = 8; - public const uint SayFaceWailingSoul = 9; - - public const uint SayJainaOutro = 0; - public const uint SaySylvanasOutro = 0; - } - - struct SpellIds - { - public const uint PhantomBlast = 68982; - public const uint MirroredSoulProcAura = 69023; - public const uint MirroredSoulDamage = 69034; - public const uint MirroredSoulTargetSelector = 69048; - public const uint MirroredSoulBuff = 69051; - public const uint WellOfSouls = 68820; - public const uint UnleashedSouls = 68939; - public const uint WailingSoulsStarting = 68912; // Initial Spell Cast At Begining Of Wailing Souls Phase - public const uint WailingSoulsBeam = 68875; // The Beam Visual - public const uint WailingSouls = 68873; // The Actual Spell - // 68871; 68873; 68875; 68876; 68899; 68912; 70324; - // 68899 Trigger 68871 - } - - struct ModelIds - { - public const uint Anger = 30148; - public const uint Sorrow = 30149; - public const uint Desire = 30150; - } - - struct Misc - { - public const uint DataThreeFaced = 1; - - public static outroPosition[] outroPositions = - { - new outroPosition(CreatureIds.Champion1Alliance, CreatureIds.Champion1Horde, new Position(5590.47f, 2427.79f, 705.935f, 0.802851f)), - new outroPosition(CreatureIds.Champion1Alliance, CreatureIds.Champion1Horde, new Position(5593.59f, 2428.34f, 705.935f, 0.977384f)), - new outroPosition(CreatureIds.Champion1Alliance, CreatureIds.Champion1Horde, new Position(5600.81f, 2429.31f, 705.935f, 0.890118f)), - new outroPosition(CreatureIds.Champion1Alliance, CreatureIds.Champion1Horde, new Position(5600.81f, 2421.12f, 705.935f, 0.890118f)), - new outroPosition(CreatureIds.Champion1Alliance, CreatureIds.Champion1Horde, new Position(5601.43f, 2426.53f, 705.935f, 0.890118f)), - new outroPosition(CreatureIds.Champion1Alliance, CreatureIds.Champion1Horde, new Position(5601.55f, 2418.36f, 705.935f, 1.15192f)), - new outroPosition(CreatureIds.Champion1Alliance, CreatureIds.Champion1Horde, new Position(5598, 2429.14f, 705.935f, 1.0472f)), - new outroPosition(CreatureIds.Champion1Alliance, CreatureIds.Champion1Horde, new Position(5594.04f, 2424.87f, 705.935f, 1.15192f)), - new outroPosition(CreatureIds.Champion1Alliance, CreatureIds.Champion1Horde, new Position(5597.89f, 2421.54f, 705.935f, 0.610865f)), - new outroPosition(CreatureIds.Champion2Alliance, CreatureIds.Champion2Horde, new Position(5598.57f, 2434.62f, 705.935f, 1.13446f)), - new outroPosition(CreatureIds.Champion2Alliance, CreatureIds.Champion2Horde, new Position(5585.46f, 2417.99f, 705.935f, 1.06465f)), - new outroPosition(CreatureIds.Champion2Alliance, CreatureIds.Champion2Horde, new Position(5605.81f, 2428.42f, 705.935f, 0.820305f)), - new outroPosition(CreatureIds.Champion2Alliance, CreatureIds.Champion2Horde, new Position(5591.61f, 2412.66f, 705.935f, 0.925025f)), - new outroPosition(CreatureIds.Champion2Alliance, CreatureIds.Champion2Horde, new Position(5593.9f, 2410.64f, 705.935f, 0.872665f)), - new outroPosition(CreatureIds.Champion2Alliance, CreatureIds.Champion2Horde, new Position(5586.76f, 2416.73f, 705.935f, 0.942478f)), - new outroPosition(CreatureIds.Champion2Alliance, CreatureIds.Champion3Horde, new Position(5592.23f, 2419.14f, 705.935f, 0.855211f)), - new outroPosition(CreatureIds.Champion2Alliance, CreatureIds.Champion3Horde, new Position(5594.61f, 2416.87f, 705.935f, 0.907571f)), - new outroPosition(CreatureIds.Champion2Alliance, CreatureIds.Champion3Horde, new Position(5589.77f, 2421.03f, 705.935f, 0.855211f)), - - new outroPosition(CreatureIds.Koreln, CreatureIds.Loralen, new Position(5602.58f, 2435.95f, 705.935f, 0.959931f)), - new outroPosition(CreatureIds.Elandra, CreatureIds.Kalira, new Position(5606.13f, 2433.16f, 705.935f, 0.785398f)), - new outroPosition(CreatureIds.JainaPart2, CreatureIds.SylvanasPart2, new Position(5606.12f, 2436.6f, 705.935f, 0.890118f)), - }; - - public static Position CrucibleSummonPos = new Position(5672.294f, 2520.686f, 713.4386f, 0.9599311f); - } - - struct outroPosition - { - public outroPosition(uint allianceEntry, uint hordeEntry, Position movePosition) - { - Entry = new uint[2]; - Entry[0] = allianceEntry; - Entry[1] = hordeEntry; - - MovePosition = movePosition; - } - - public uint[] Entry; - public Position MovePosition; - } - - [Script] - class boss_devourer_of_souls : BossAI - { - public boss_devourer_of_souls(Creature creature) : base(creature, DataType.DevourerOfSouls) - { - Initialize(); - beamAngle = 0.0f; - beamAngleDiff = 0.0f; - wailingSoulTick = 0; - } - - void Initialize() - { - threeFaced = true; - } - - public override void Reset() - { - _Reset(); - me.SetControlled(false, UnitState.Root); - me.SetDisplayId(ModelIds.Anger); - me.SetReactState(ReactStates.Aggressive); - - Initialize(); - } - - public override void EnterCombat(Unit who) - { - _EnterCombat(); - Talk(TextIds.SayFaceAggro); - - if (!me.FindNearestCreature(CreatureIds.CrucibleOfSouls, 60)) // Prevent double spawn - me.GetMap().SummonCreature(CreatureIds.CrucibleOfSouls, Misc.CrucibleSummonPos); - - _scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting)); - - _scheduler.Schedule(TimeSpan.FromSeconds(5), task => - { - DoCastVictim(SpellIds.PhantomBlast); - task.Repeat(TimeSpan.FromSeconds(5)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(8), task => - { - DoCastAOE(SpellIds.MirroredSoulTargetSelector); - Talk(TextIds.EmoteMirroredSoul); - task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(30), task => - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0); - if (target) - DoCast(target, SpellIds.WellOfSouls); - task.Repeat(TimeSpan.FromSeconds(20)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(20), task => - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0); - if (target) - DoCast(target, SpellIds.UnleashedSouls); - me.SetDisplayId(ModelIds.Sorrow); - Talk(TextIds.SayFaceUnleashSoul); - Talk(TextIds.EmoteUnleashSoul); - task.Repeat(TimeSpan.FromSeconds(30)); - task.Schedule(TimeSpan.FromSeconds(5), () => me.SetDisplayId(ModelIds.Anger)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(60), TimeSpan.FromSeconds(70), task => - { - me.SetDisplayId(ModelIds.Desire); - Talk(TextIds.SayFaceWailingSoul); - Talk(TextIds.EmoteWailingSoul); - DoCast(me, SpellIds.WailingSoulsStarting); - Unit target = SelectTarget(SelectAggroTarget.Random, 0); - if (target) - { - me.SetFacingToObject(target); - DoCast(me, SpellIds.WailingSoulsBeam); - } - - beamAngle = me.GetOrientation(); - - beamAngleDiff = (float)Math.PI / 30.0f; // PI/2 in 15 sec = PI/30 per tick - if (RandomHelper.RAND(true, false)) - beamAngleDiff = -beamAngleDiff; - - me.InterruptNonMeleeSpells(false); - me.SetReactState(ReactStates.Passive); - - //Remove any target - me.SetTarget(ObjectGuid.Empty); - - me.GetMotionMaster().Clear(); - me.SetControlled(true, UnitState.Root); - - wailingSoulTick = 15; - - _scheduler.DelayAll(TimeSpan.FromSeconds(18)); // no other events during wailing souls - - // first one after 3 secs. - _scheduler.Schedule(TimeSpan.FromSeconds(3), tickTask => - { - beamAngle += beamAngleDiff; - me.SetFacingTo(beamAngle); - me.StopMoving(); - - DoCast(me, SpellIds.WailingSouls); - - if (--wailingSoulTick != 0) - tickTask.Repeat(TimeSpan.FromSeconds(1)); - else - { - me.SetReactState(ReactStates.Aggressive); - me.SetDisplayId(ModelIds.Anger); - me.SetControlled(false, UnitState.Root); - me.GetMotionMaster().MoveChase(me.GetVictim()); - task.Repeat(TimeSpan.FromSeconds(60), TimeSpan.FromSeconds(70)); - } - }); - }); - } - - public override void KilledUnit(Unit victim) - { - if (victim.GetTypeId() != TypeId.Player) - return; - - byte textId = 0; - switch (me.GetDisplayId()) - { - case ModelIds.Anger: - textId = TextIds.SayFaceAngerSlay; - break; - case ModelIds.Sorrow: - textId = TextIds.SayFaceSorrowSlay; - break; - case ModelIds.Desire: - textId = TextIds.SayFaceDesireSlay; - break; - default: - break; - } - - if (textId != 0) - Talk(textId); - } - - public override void JustDied(Unit killer) - { - _JustDied(); - - Position spawnPoint = new Position(5618.139f, 2451.873f, 705.854f, 0); - - Talk(TextIds.SayFaceDeath); - - int entryIndex; - if (instance.GetData(DataType.TeamInInstance) == (uint)Team.Alliance) - entryIndex = 0; - else - entryIndex = 1; - - for (var i = 0; Misc.outroPositions[i].Entry[entryIndex] != 0; ++i) - { - Creature summon = me.SummonCreature(Misc.outroPositions[i].Entry[entryIndex], spawnPoint, TempSummonType.DeadDespawn); - if (summon) - { - summon.GetMotionMaster().MovePoint(0, Misc.outroPositions[i].MovePosition); - if (summon.GetEntry() == CreatureIds.JainaPart2) - summon.GetAI().Talk(TextIds.SayJainaOutro); - else if (summon.GetEntry() == CreatureIds.SylvanasPart2) - summon.GetAI().Talk(TextIds.SaySylvanasOutro); - } - } - } - - public override void SpellHitTarget(Unit target, SpellInfo spell) - { - if (spell.Id == SpellIds.PhantomBlast) - threeFaced = false; - } - - public override uint GetData(uint type) - { - if (type == Misc.DataThreeFaced) - return threeFaced ? 1 : 0u; - - return 0; - } - - public override void UpdateAI(uint diff) - { - // Return since we have no target - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - DoMeleeAttackIfReady(); - } - - bool threeFaced; - - // wailing soul event - float beamAngle; - float beamAngleDiff; - sbyte wailingSoulTick; - } - - [Script] // 69051 - Mirrored Soul - class spell_devourer_of_souls_mirrored_soul : SpellScript - { - public override bool Validate(SpellInfo spellInfo) - { - return ValidateSpellInfo(SpellIds.MirroredSoulProcAura); - } - - void HandleScript(uint effIndex) - { - Unit target = GetHitUnit(); - if (target) - target.CastSpell(GetCaster(), SpellIds.MirroredSoulProcAura, true); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); - } - } - - [Script] // 69023 - Mirrored Soul (Proc) - class spell_devourer_of_souls_mirrored_soul_proc : AuraScript - { - public override bool Validate(SpellInfo spellInfo) - { - return ValidateSpellInfo(SpellIds.MirroredSoulDamage); - } - - bool CheckProc(ProcEventInfo eventInfo) - { - return GetCaster() && GetCaster().IsAlive(); - } - - void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo) - { - PreventDefaultAction(); - DamageInfo damageInfo = eventInfo.GetDamageInfo(); - if (damageInfo == null || damageInfo.GetDamage() == 0) - return; - - int damage = (int)MathFunctions.CalculatePct(damageInfo.GetDamage(), 45); - GetTarget().CastCustomSpell(SpellIds.MirroredSoulDamage, SpellValueMod.BasePoint0, damage, GetCaster(), true); - } - - public override void Register() - { - DoCheckProc.Add(new CheckProcHandler(CheckProc)); - OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.ProcTriggerSpell)); - } - } - - [Script] // 69048 - Mirrored Soul (Target Selector) - class spell_devourer_of_souls_mirrored_soul_target_selector : SpellScript - { - public override bool Validate(SpellInfo spellInfo) - { - return ValidateSpellInfo(SpellIds.MirroredSoulBuff); - } - - void FilterTargets(List targets) - { - if (targets.Empty()) - return; - - WorldObject target = targets.SelectRandom(); - targets.Clear(); - targets.Add(target); - } - - void HandleScript(uint effIndex) - { - Unit target = GetHitUnit(); - if (target) - GetCaster().CastSpell(target, SpellIds.MirroredSoulBuff, false); - } - - public override void Register() - { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEntry)); - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); - } - } - - [Script] - class achievement_three_faced : AchievementCriteriaScript - { - public achievement_three_faced() : base("achievement_three_faced") { } - - public override bool OnCheck(Player player, Unit target) - { - if (!target) - return false; - - Creature devourer = target.ToCreature(); - if (devourer) - if (devourer.GetAI().GetData(Misc.DataThreeFaced) != 0) - return true; - - return false; - } - } -} diff --git a/Source/Scripts/Northrend/FrozenHalls/ForgeOfSouls/InstanceForgeOfSouls.cs b/Source/Scripts/Northrend/FrozenHalls/ForgeOfSouls/InstanceForgeOfSouls.cs deleted file mode 100644 index c88e1dac6..000000000 --- a/Source/Scripts/Northrend/FrozenHalls/ForgeOfSouls/InstanceForgeOfSouls.cs +++ /dev/null @@ -1,382 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using System.Collections.Generic; - -namespace Scripts.Northrend.FrozenHalls.ForgeOfSouls -{ - struct DataType - { - // Encounter states and GUIDs - public const uint Bronjahm = 0; - public const uint DevourerOfSouls = 1; - - // Additional Data - public const uint TeamInInstance = 2; - } - - struct CreatureIds - { - public const uint Bronjahm = 36497; - public const uint Devourer = 36502; - public const uint CorruptedSoulFragment = 36535; - - public const uint SylvanasPart1 = 37596; - public const uint SylvanasPart2 = 38161; - public const uint JainaPart1 = 37597; - public const uint JainaPart2 = 38160; - public const uint Kalira = 37583; - public const uint Elandra = 37774; - public const uint Loralen = 37779; - public const uint Koreln = 37582; - public const uint Champion1Horde = 37584; - public const uint Champion2Horde = 37587; - public const uint Champion3Horde = 37588; - public const uint Champion1Alliance = 37496; - public const uint Champion2Alliance = 37497; - public const uint CrucibleOfSouls = 37094; - } - - struct EventIds - { - public const uint None = 0; - - // Jaina/Sylvanas Intro - public const uint Intro1 = 1; - public const uint Intro2 = 2; - public const uint Intro3 = 3; - public const uint Intro4 = 4; - public const uint Intro5 = 5; - public const uint Intro6 = 6; - public const uint Intro7 = 7; - public const uint Intro8 = 8; - } - - struct TextIds - { - public const uint SayJainaIntro1 = 0; - public const uint SayJainaIntro2 = 1; - public const uint SayJainaIntro3 = 2; - public const uint SayJainaIntro4 = 3; - public const uint SayJainaIntro5 = 4; - public const uint SayJainaIntro6 = 5; - public const uint SayJainaIntro7 = 6; - public const uint SayJainaIntro8 = 7; - - public const uint SaySylvanasIntro1 = 0; - public const uint SaySylvanasIntro2 = 1; - public const uint SaySylvanasIntro3 = 2; - public const uint SaySylvanasIntro4 = 3; - public const uint SaySylvanasIntro5 = 4; - public const uint SaySylvanasIntro6 = 5; - } - - struct Misc - { - public const uint MenuIdJaina = 10943; - public const uint MenuIdSylvanas = 10971; - public const uint GossipOptionId = 0; - } - - enum Phase - { - Normal, - Intro, - } - - [Script] - class instance_forge_of_souls : InstanceMapScript - { - public instance_forge_of_souls() : base(nameof(instance_forge_of_souls), 632) { } - - class instance_forge_of_souls_InstanceScript : InstanceScript - { - public instance_forge_of_souls_InstanceScript(InstanceMap map) : base(map) - { - SetHeaders("FOS"); - SetBossNumber(2); - - teamInInstance = 0; - } - - public override void OnPlayerEnter(Player player) - { - if (teamInInstance == 0) - teamInInstance = player.GetTeam(); - } - - public override void OnCreatureCreate(Creature creature) - { - if (teamInInstance == 0) - { - var players = instance.GetPlayers(); - if (!players.Empty()) - { - Player player = players[0]; - if (player) - teamInInstance = player.GetTeam(); - } - } - - switch (creature.GetEntry()) - { - case CreatureIds.Bronjahm: - bronjahm = creature.GetGUID(); - break; - case CreatureIds.Devourer: - devourerOfSouls = creature.GetGUID(); - break; - case CreatureIds.SylvanasPart1: - if (teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.JainaPart1); - break; - case CreatureIds.Loralen: - if (teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.Elandra); - break; - case CreatureIds.Kalira: - if (teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.Koreln); - break; - } - } - - public override uint GetData(uint type) - { - switch (type) - { - case DataType.TeamInInstance: - return (uint)teamInInstance; - default: - break; - } - - return 0; - } - - public override ObjectGuid GetGuidData(uint type) - { - switch (type) - { - case DataType.Bronjahm: - return bronjahm; - case DataType.DevourerOfSouls: - return devourerOfSouls; - default: - break; - } - - return ObjectGuid.Empty; - } - - ObjectGuid bronjahm; - ObjectGuid devourerOfSouls; - - Team teamInInstance; - } - - public override InstanceScript GetInstanceScript(InstanceMap map) - { - return new instance_forge_of_souls_InstanceScript(map); - } - } - - [Script] - class npc_sylvanas_fos : ScriptedAI - { - public npc_sylvanas_fos(Creature creature) : base(creature) - { - Initialize(); - me.AddNpcFlag(NPCFlags.Gossip); - } - - void Initialize() - { - phase = Phase.Normal; - } - - public override void Reset() - { - _events.Reset(); - Initialize(); - } - - public override bool GossipSelect(Player player, uint menuId, uint gossipListId) - { - if (menuId == Misc.MenuIdSylvanas && gossipListId == Misc.GossipOptionId) - { - player.CLOSE_GOSSIP_MENU(); - phase = Phase.Intro; - me.RemoveNpcFlag(NPCFlags.Gossip); - - _events.Reset(); - _events.ScheduleEvent(EventIds.Intro1, 1000); - } - return false; - } - - public override void UpdateAI(uint diff) - { - if (phase == Phase.Intro) - { - _events.Update(diff); - switch (_events.ExecuteEvent()) - { - case EventIds.Intro1: - Talk(TextIds.SaySylvanasIntro1); - _events.ScheduleEvent(EventIds.Intro2, 11500); - break; - - case EventIds.Intro2: - Talk(TextIds.SaySylvanasIntro2); - _events.ScheduleEvent(EventIds.Intro3, 10500); - break; - - case EventIds.Intro3: - Talk(TextIds.SaySylvanasIntro3); - _events.ScheduleEvent(EventIds.Intro4, 9500); - break; - - case EventIds.Intro4: - Talk(TextIds.SaySylvanasIntro4); - _events.ScheduleEvent(EventIds.Intro5, 10500); - break; - - case EventIds.Intro5: - Talk(TextIds.SaySylvanasIntro5); - _events.ScheduleEvent(EventIds.Intro6, 9500); - break; - - case EventIds.Intro6: - Talk(TextIds.SaySylvanasIntro6); - // End of Intro - phase = Phase.Normal; - break; - } - } - - //Return since we have no target - if (!UpdateVictim()) - return; - - _events.Update(diff); - DoMeleeAttackIfReady(); - } - - Phase phase; - } - - [Script] - class npc_jaina_fos : ScriptedAI - { - public npc_jaina_fos(Creature creature) : base(creature) - { - Initialize(); - me.AddNpcFlag(NPCFlags.Gossip); - } - - void Initialize() - { - phase = Phase.Normal; - } - - public override void Reset() - { - _events.Reset(); - Initialize(); - } - - public override bool GossipSelect(Player player, uint menuId, uint gossipListId) - { - if (menuId == Misc.MenuIdJaina && gossipListId == Misc.GossipOptionId) - { - player.CLOSE_GOSSIP_MENU(); - phase = Phase.Intro; - me.RemoveNpcFlag(NPCFlags.Gossip); - _events.Reset(); - _events.ScheduleEvent(EventIds.Intro1, 1000); - } - return false; - } - - public override void UpdateAI(uint diff) - { - if (phase == Phase.Intro) - { - _events.Update(diff); - switch (_events.ExecuteEvent()) - { - case EventIds.Intro1: - Talk(TextIds.SayJainaIntro1); - _events.ScheduleEvent(EventIds.Intro2, 8000); - break; - - case EventIds.Intro2: - Talk(TextIds.SayJainaIntro2); - _events.ScheduleEvent(EventIds.Intro3, 8500); - break; - - case EventIds.Intro3: - Talk(TextIds.SayJainaIntro3); - _events.ScheduleEvent(EventIds.Intro4, 8000); - break; - - case EventIds.Intro4: - Talk(TextIds.SayJainaIntro4); - _events.ScheduleEvent(EventIds.Intro5, 10000); - break; - - case EventIds.Intro5: - Talk(TextIds.SayJainaIntro5); - _events.ScheduleEvent(EventIds.Intro6, 8000); - break; - - case EventIds.Intro6: - Talk(TextIds.SayJainaIntro6); - _events.ScheduleEvent(EventIds.Intro7, 12000); - break; - - case EventIds.Intro7: - Talk(TextIds.SayJainaIntro7); - _events.ScheduleEvent(EventIds.Intro8, 8000); - break; - - case EventIds.Intro8: - Talk(TextIds.SayJainaIntro8); - // End of Intro - phase = Phase.Normal; - break; - } - } - - //Return since we have no target - if (!UpdateVictim()) - return; - - _events.Update(diff); - - DoMeleeAttackIfReady(); - } - - Phase phase; - } -} diff --git a/Source/Scripts/Northrend/FrozenHalls/PitOfSaron/BossForgemasterGarfrost.cs b/Source/Scripts/Northrend/FrozenHalls/PitOfSaron/BossForgemasterGarfrost.cs deleted file mode 100644 index 9f91f36fd..000000000 --- a/Source/Scripts/Northrend/FrozenHalls/PitOfSaron/BossForgemasterGarfrost.cs +++ /dev/null @@ -1,305 +0,0 @@ -using System; -using System.Collections.Generic; -using Game.AI; -using Game.Entities; -using Framework.Constants; -using Game.Spells; -using Game.Scripting; - -namespace Scripts.Northrend.FrozenHalls.PitOfSaron.BossForgemasterGarfrost -{ - struct TextIds - { - public const uint SayAggro = 0; - public const uint SayPhase2 = 1; - public const uint SayPhase3 = 2; - public const uint SayDeath = 3; - public const uint SaySlay = 4; - public const uint SayThrowSaronite = 5; - public const uint SayCastDeepFreeze = 6; - - public const uint SayTyrannusDeath = 0; - } - - struct SpellIds - { - public const uint Permafrost = 70326; - public const uint ThrowSaronite = 68788; - public const uint ThunderingStomp = 68771; - public const uint ChillingWave = 68778; - public const uint DeepFreeze = 70381; - public const uint ForgeMace = 68785; - public const uint ForgeBlade = 68774; - - public const uint PermafrostAura = 68786; - } - - struct Misc - { - public const byte PhaseOne = 1; - public const byte PhaseTwo = 2; - public const byte PhaseThree = 3; - - public const int EquipIdSword = 49345; - public const int EquipIdMace = 49344; - public const uint AchievDoesntGoToEleven = 0; - public const uint PointForge = 0; - - public static Position northForgePos = new Position(722.5643f, -234.1615f, 527.182f, 2.16421f); - public static Position southForgePos = new Position(639.257f, -210.1198f, 529.015f, 0.523599f); - } - - struct Events - { - public const uint ThrowSaronite = 1; - public const uint ChillingWave = 2; - public const uint DeepFreeze = 3; - public const uint ForgeJump = 4; - public const uint ResumeAttack = 5; - } - - [Script] - class boss_garfrost : BossAI - { - public boss_garfrost(Creature creature) : base(creature, DataTypes.Garfrost) { } - - public override void Reset() - { - _Reset(); - _events.SetPhase(Misc.PhaseOne); - SetEquipmentSlots(true); - _permafrostStack = 0; - } - - public override void EnterCombat(Unit who) - { - _EnterCombat(); - Talk(TextIds.SayAggro); - DoCast(me, SpellIds.Permafrost); - me.CallForHelp(70.0f); - _events.ScheduleEvent(Events.ThrowSaronite, 7000); - } - - public override void KilledUnit(Unit victim) - { - if (victim.IsPlayer()) - Talk(TextIds.SaySlay); - } - - public override void JustDied(Unit killer) - { - _JustDied(); - Talk(TextIds.SayDeath); - me.RemoveAllGameObjects(); - - Creature tyrannus = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.Tyrannus)); - if (tyrannus) - tyrannus.GetAI().Talk(TextIds.SayTyrannusDeath); - } - - public override void DamageTaken(Unit attacker, ref uint damage) - { - if (_events.IsInPhase(Misc.PhaseOne) && !HealthAbovePct(66)) - { - _events.SetPhase(Misc.PhaseTwo); - Talk(TextIds.SayPhase2); - _events.DelayEvents(8000); - DoCast(me, SpellIds.ThunderingStomp); - _events.ScheduleEvent(Events.ForgeJump, 1500); - return; - } - - if (_events.IsInPhase(Misc.PhaseTwo) && !HealthAbovePct(33)) - { - _events.SetPhase(Misc.PhaseThree); - Talk(TextIds.SayPhase3); - _events.DelayEvents(8000); - DoCast(me, SpellIds.ThunderingStomp); - _events.ScheduleEvent(Events.ForgeJump, 1500); - return; - } - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - if (type != MovementGeneratorType.Effect || id != Misc.PointForge) - return; - - if (_events.IsInPhase(Misc.PhaseTwo)) - { - DoCast(me, SpellIds.ForgeBlade); - SetEquipmentSlots(false, Misc.EquipIdSword); - } - if (_events.IsInPhase(Misc.PhaseThree)) - { - me.RemoveAurasDueToSpell(SpellIds.ForgeBlade); - DoCast(me, SpellIds.ForgeMace); - SetEquipmentSlots(false, Misc.EquipIdMace); - } - _events.ScheduleEvent(Events.ResumeAttack, 5000); - } - - public override void SpellHitTarget(Unit target, SpellInfo spell) - { - if (spell.Id == SpellIds.PermafrostAura) - { - Aura aura = target.GetAura(SpellIds.PermafrostAura); - if (aura != null) - _permafrostStack = Math.Max(_permafrostStack, aura.GetStackAmount()); - } - } - - public override uint GetData(uint type) - { - return _permafrostStack; - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case Events.ThrowSaronite: - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true); - if (target) - { - Talk(TextIds.SayThrowSaronite, target); - DoCast(target, SpellIds.ThrowSaronite); - } - _events.ScheduleEvent(Events.ThrowSaronite, TimeSpan.FromSeconds(12.5), TimeSpan.FromSeconds(20)); - } - break; - case Events.ChillingWave: - DoCast(me, SpellIds.ChillingWave); - _events.ScheduleEvent(Events.ChillingWave, 40000, 0, Misc.PhaseTwo); - break; - case Events.DeepFreeze: - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true); - if (target) - { - Talk(TextIds.SayCastDeepFreeze, target); - DoCast(target, SpellIds.DeepFreeze); - } - _events.ScheduleEvent(Events.DeepFreeze, 35000, 0, Misc.PhaseThree); - } - break; - case Events.ForgeJump: - me.AttackStop(); - if (_events.IsInPhase(Misc.PhaseTwo)) - me.GetMotionMaster().MoveJump(Misc.northForgePos, 25.0f, 15.0f, Misc.PointForge); - else if (_events.IsInPhase(Misc.PhaseThree)) - me.GetMotionMaster().MoveJump(Misc.southForgePos, 25.0f, 15.0f, Misc.PointForge); - break; - case Events.ResumeAttack: - if (_events.IsInPhase(Misc.PhaseTwo)) - _events.ScheduleEvent(Events.ChillingWave, 5000, 0, Misc.PhaseTwo); - else if (_events.IsInPhase(Misc.PhaseThree)) - _events.ScheduleEvent(Events.DeepFreeze, 10000, 0, Misc.PhaseThree); - AttackStart(me.GetVictim()); - break; - default: - break; - } - - if (me.HasUnitState(UnitState.Casting)) - return; - }); - - DoMeleeAttackIfReady(); - } - - uint _permafrostStack; - } - - [Script] - class spell_garfrost_permafrost : SpellScript - { - public spell_garfrost_permafrost() - { - prevented = false; - } - - void PreventHitByLoS(SpellMissInfo missInfo) - { - if (missInfo != SpellMissInfo.None) - return; - - Unit target = GetHitUnit(); - if (target) - { - Unit caster = GetCaster(); - //Temporary Line of Sight Check - List blockList = new List(); - caster.GetGameObjectListWithEntryInGrid(blockList, GameObjectIds.SaroniteRock, 100.0f); - if (!blockList.Empty()) - { - foreach (var obj in blockList) - { - if (!obj.IsInvisibleDueToDespawn()) - { - if (obj.IsInBetween(caster, target, 4.0f)) - { - prevented = true; - target.ApplySpellImmune(GetSpellInfo().Id, SpellImmunity.Id, GetSpellInfo().Id, true); - PreventHitDefaultEffect(0); - PreventHitDefaultEffect(1); - PreventHitDefaultEffect(2); - PreventHitDamage(); - break; - } - } - } - } - } - } - - void RestoreImmunity() - { - Unit target = GetHitUnit(); - if (target) - { - target.ApplySpellImmune(GetSpellInfo().Id, SpellImmunity.Id, GetSpellInfo().Id, false); - if (prevented) - PreventHitAura(); - } - } - - public override void Register() - { - BeforeHit.Add(new BeforeHitHandler(PreventHitByLoS)); - AfterHit.Add(new HitHandler(RestoreImmunity)); - } - - bool prevented; - } - - [Script] - class achievement_doesnt_go_to_eleven : AchievementCriteriaScript - { - public achievement_doesnt_go_to_eleven() : base("achievement_doesnt_go_to_eleven") { } - - public override bool OnCheck(Player source, Unit target) - { - if (target) - { - Creature garfrost = target.ToCreature(); - if (garfrost) - if (garfrost.GetAI().GetData(Misc.AchievDoesntGoToEleven) <= 10) - return true; - } - - return false; - } - } -} diff --git a/Source/Scripts/Northrend/FrozenHalls/PitOfSaron/BossKrickAndIck.cs b/Source/Scripts/Northrend/FrozenHalls/PitOfSaron/BossKrickAndIck.cs deleted file mode 100644 index 69d27ecc3..000000000 --- a/Source/Scripts/Northrend/FrozenHalls/PitOfSaron/BossKrickAndIck.cs +++ /dev/null @@ -1,674 +0,0 @@ -using System; -using Game.Entities; -using Game.Scripting; -using Game.AI; -using Framework.Constants; -using Game.Maps; -using Game.Spells; - -namespace Scripts.Northrend.FrozenHalls.PitOfSaron.BossKrickAndIck -{ - struct SpellIds - { - public const uint MightyKick = 69021; //Ick'S Spell - public const uint ShadowBolt = 69028; //Krick'S Spell - public const uint ToxicWaste = 69024; //Krick'S Spell - public const uint ExplosiveBarrageKrick = 69012; //Special Spell 1 - public const uint ExplosiveBarrageIck = 69263; //Special Spell 1 - public const uint PoisonNova = 68989; //Special Spell 2 - public const uint Pursuit = 68987; //Special Spell 3 - - public const uint ExplosiveBarrageSummon = 69015; - public const uint ExplodingOrb = 69017; //Visual On Exploding Orb - public const uint AutoGrow = 69020; //Grow Effect On Exploding Orb - public const uint HastyGrow = 44851; //Need To Check Growing Stacks - public const uint ExplosiveBarrageDamage = 69019; //Damage Done By Orb While Exploding - - public const uint Strangulating = 69413; //Krick'S Selfcast In Intro - public const uint Suicide = 7; - public const uint KrickKillCredit = 71308; - public const uint NecromanticPower = 69753; - } - - struct TextIds - { - // Krick - public const uint SayKrickAggro = 0; - public const uint SayKrickSlay = 1; - public const uint SayKrickBarrage1 = 2; - public const uint SayKrickBarrage2 = 3; - public const uint SayKrickPoisonNova = 4; - public const uint SayKrickChase = 5; - public const uint SayKrickOutro1 = 6; - public const uint SayKrickOutro3 = 7; - public const uint SayKrickOutro5 = 8; - public const uint SayKrickOutro8 = 9; - - // Ick - public const uint SayIckPoisonNova = 0; - public const uint SayIckChase1 = 1; - - // Outro - public const uint SayJaynaOutro2 = 0; - public const uint SayJaynaOutro4 = 1; - public const uint SayJaynaOutro10 = 2; - public const uint SaySylvanasOutro2 = 0; - public const uint SaySylvanasOutro4 = 1; - public const uint SaySylvanasOutro10 = 2; - public const uint SayTyrannusOutro7 = 1; - public const uint SayTyrannusOutro9 = 2; - } - - struct Events - { - public const uint MightyKick = 1; - public const uint ShadowBolt = 2; - public const uint ToxicWaste = 3; - public const uint Special = 4; //Special Spell Selection (One Of Event 5; 6 Or 7) - public const uint Pursuit = 5; - public const uint PoisonNova = 6; - public const uint ExplosiveBarrage = 7; - - // Krick Outro - public const uint Outro1 = 8; - public const uint Outro2 = 9; - public const uint Outro3 = 10; - public const uint Outro4 = 11; - public const uint Outro5 = 12; - public const uint Outro6 = 13; - public const uint Outro7 = 14; - public const uint Outro8 = 15; - public const uint Outro9 = 16; - public const uint Outro10 = 17; - public const uint Outro11 = 18; - public const uint Outro12 = 19; - public const uint Outro13 = 20; - public const uint OutroEnd = 21; - } - - enum KrickPhase - { - Combat = 1, - Outro = 2 - } - - struct Misc - { - public const int ActionOutro = 1; - - public const uint PointKrickIntro = 364770; - public const uint PointKrickDeath = 364771; - - public static Position[] outroPos = - { - new Position(828.9342f, 118.6247f, 509.5190f, 0.0000000f), // Krick's Outro Position - new Position( 841.0100f, 196.2450f, 573.9640f, 0.2046099f), // Scourgelord Tyrannus Outro Position (Tele to...) - new Position( 777.2274f, 119.5521f, 510.0363f, 6.0562930f), // Sylvanas / Jaine Outro Spawn Position (NPC_SYLVANAS_PART1) - new Position(823.3984f, 114.4907f, 509.4899f, 0.0000000f), // Sylvanas / Jaine Outro Move Position (1) - new Position( 835.5887f, 139.4345f, 530.9526f, 0.0000000f), // Tyrannus fly down Position (not sniffed) - new Position( 828.9342f, 118.6247f, 514.5190f, 0.0000000f), // Krick's Choke Position - new Position(828.9342f, 118.6247f, 509.4958f, 0.0000000f), // Kirck's Death Position - new Position(914.4820f, 143.1602f, 633.3624f, 0.0000000f) // Tyrannus fly up (not sniffed) - }; - } - - - [Script] - class boss_ick : BossAI - { - public boss_ick(Creature creature) : base(creature, DataTypes.Ick) - { - _tempThreat = 0; - } - - public override void Reset() - { - _events.Reset(); - instance.SetBossState(DataTypes.Ick, EncounterState.NotStarted); - } - - Creature GetKrick() - { - return ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.Krick)); - } - - public override void EnterCombat(Unit who) - { - _EnterCombat(); - - Creature krick = GetKrick(); - if (krick) - krick.GetAI().Talk(TextIds.SayKrickAggro); - - _events.ScheduleEvent(Events.MightyKick, 20000); - _events.ScheduleEvent(Events.ToxicWaste, 5000); - _events.ScheduleEvent(Events.ShadowBolt, 10000); - _events.ScheduleEvent(Events.Special, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(35)); - } - - public override void EnterEvadeMode(EvadeReason why) - { - me.GetMotionMaster().Clear(); - base.EnterEvadeMode(why); - } - - public override void JustDied(Unit killer) - { - Creature krick = GetKrick(); - if (krick) - { - Vehicle vehicle = me.GetVehicleKit(); - if (vehicle) - vehicle.RemoveAllPassengers(); - if (krick.IsAIEnabled) - krick.GetAI().DoAction(Misc.ActionOutro); - } - - instance.SetBossState(DataTypes.Ick, EncounterState.Done); - } - - public void SetTempThreat(float threat) - { - _tempThreat = threat; - } - - public void _ResetThreat(Unit target) - { - ModifyThreatByPercent(target, -100); - AddThreat(target, _tempThreat); - } - - public override void UpdateAI(uint diff) - { - if (!me.IsInCombat()) - return; - - if (!me.GetVictim() && me.GetThreatManager().IsThreatListEmpty()) - { - EnterEvadeMode(EvadeReason.NoHostiles); - return; - } - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case Events.ToxicWaste: - { - Creature krick = GetKrick(); - if (krick) - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0); - if (target) - krick.CastSpell(target, SpellIds.ToxicWaste); - _events.ScheduleEvent(Events.ToxicWaste, TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(10)); - } - } - break; - case Events.ShadowBolt: - { - Creature krick = GetKrick(); - if (krick) - { - Unit target = SelectTarget(SelectAggroTarget.Random, 1); - if (target) - krick.CastSpell(target, SpellIds.ShadowBolt); - _events.ScheduleEvent(Events.ShadowBolt, 15000); - } - } - return; - case Events.MightyKick: - DoCastVictim(SpellIds.MightyKick); - _events.ScheduleEvent(Events.MightyKick, 25000); - return; - case Events.Special: - //select one of these three special _events - _events.ScheduleEvent(RandomHelper.RAND(Events.ExplosiveBarrage, Events.PoisonNova, Events.Pursuit), 1000); - _events.ScheduleEvent(Events.Special, TimeSpan.FromSeconds(23), TimeSpan.FromSeconds(28)); - break; - case Events.ExplosiveBarrage: - { - Creature krick = GetKrick(); - if (krick) - { - krick.GetAI().Talk(TextIds.SayKrickBarrage1); - krick.GetAI().Talk(TextIds.SayKrickBarrage2); - krick.CastSpell(krick, SpellIds.ExplosiveBarrageKrick, true); - DoCast(me, SpellIds.ExplosiveBarrageIck); - } - _events.DelayEvents(20000); - } - break; - case Events.PoisonNova: - { - Creature krick = GetKrick(); - if (krick) - krick.GetAI().Talk(TextIds.SayKrickPoisonNova); - - Talk(TextIds.SayIckPoisonNova); - DoCast(me, SpellIds.PoisonNova); - } - break; - case Events.Pursuit: - { - Creature krick = GetKrick(); - if (krick) - krick.GetAI().Talk(TextIds.SayKrickChase); - DoCast(me, SpellIds.Pursuit); - } - break; - default: - break; - } - - if (me.HasUnitState(UnitState.Casting)) - return; - }); - - DoMeleeAttackIfReady(); - } - - float _tempThreat; - } - - [Script] - class boss_krick : ScriptedAI - { - public boss_krick(Creature creature) : base(creature) - { - _instanceScript = creature.GetInstanceScript(); - _summons = new SummonList(creature); - Initialize(); - } - - void Initialize() - { - _phase = KrickPhase.Combat; - _outroNpcGUID.Clear(); - _tyrannusGUID.Clear(); - } - - public override void Reset() - { - _events.Reset(); - Initialize(); - - me.SetReactState(ReactStates.Passive); - me.AddUnitFlag(UnitFlags.NonAttackable); - } - - Creature GetIck() - { - return ObjectAccessor.GetCreature(me, _instanceScript.GetGuidData(DataTypes.Ick)); - } - - public override void KilledUnit(Unit victim) - { - if (victim.IsPlayer()) - Talk(TextIds.SayKrickSlay); - } - - public override void JustSummoned(Creature summon) - { - _summons.Summon(summon); - if (summon.GetEntry() == CreatureIds.ExplodingOrb) - { - summon.CastSpell(summon, SpellIds.ExplodingOrb, true); - summon.CastSpell(summon, SpellIds.AutoGrow, true); - } - } - - public override void DoAction(int actionId) - { - if (actionId == Misc.ActionOutro) - { - Creature tyrannusPtr = ObjectAccessor.GetCreature(me, _instanceScript.GetGuidData(DataTypes.TyrannusEvent)); - if (tyrannusPtr) - tyrannusPtr.NearTeleportTo(Misc.outroPos[1].GetPositionX(), Misc.outroPos[1].GetPositionY(), Misc.outroPos[1].GetPositionZ(), Misc.outroPos[1].GetOrientation()); - else - tyrannusPtr = me.SummonCreature(CreatureIds.TyrannusEvents, Misc.outroPos[1], TempSummonType.ManualDespawn); - - tyrannusPtr.SetCanFly(true); - me.GetMotionMaster().MovePoint(Misc.PointKrickIntro, Misc.outroPos[0].GetPositionX(), Misc.outroPos[0].GetPositionY(), Misc.outroPos[0].GetPositionZ()); - tyrannusPtr.SetFacingToObject(me); - } - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - if (type != MovementGeneratorType.Point || id != Misc.PointKrickIntro) - return; - - Talk(TextIds.SayKrickOutro1); - _phase = KrickPhase.Outro; - _events.Reset(); - _events.ScheduleEvent(Events.Outro1, 1000); - } - - public override void UpdateAI(uint diff) - { - if (_phase != KrickPhase.Outro) - return; - - _events.Update(diff); - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case Events.Outro1: - { - Creature temp = ObjectAccessor.GetCreature(me, _instanceScript.GetGuidData(DataTypes.JainaSylvanas1)); - if (temp) - temp.DespawnOrUnsummon(); - - Creature jainaOrSylvanas = null; - if (_instanceScript.GetData(DataTypes.TeamInInstance) == (uint)Team.Alliance) - jainaOrSylvanas = me.SummonCreature(CreatureIds.JainaPart1, Misc.outroPos[2], TempSummonType.ManualDespawn); - else - jainaOrSylvanas = me.SummonCreature(CreatureIds.SylvanasPart1, Misc.outroPos[2], TempSummonType.ManualDespawn); - - if (jainaOrSylvanas) - { - jainaOrSylvanas.GetMotionMaster().MovePoint(0, Misc.outroPos[3]); - _outroNpcGUID = jainaOrSylvanas.GetGUID(); - } - _events.ScheduleEvent(Events.Outro2, 6000); - break; - } - case Events.Outro2: - { - Creature jainaOrSylvanas = ObjectAccessor.GetCreature(me, _outroNpcGUID); - if (jainaOrSylvanas) - { - jainaOrSylvanas.SetFacingToObject(me); - me.SetFacingToObject(jainaOrSylvanas); - if (_instanceScript.GetData(DataTypes.TeamInInstance) == (uint)Team.Alliance) - jainaOrSylvanas.GetAI().Talk(TextIds.SayJaynaOutro2); - else - jainaOrSylvanas.GetAI().Talk(TextIds.SaySylvanasOutro2); - } - _events.ScheduleEvent(Events.Outro3, 5000); - } - break; - case Events.Outro3: - Talk(TextIds.SayKrickOutro3); - _events.ScheduleEvent(Events.Outro4, 18000); - break; - case Events.Outro4: - { - Creature jainaOrSylvanas = ObjectAccessor.GetCreature(me, _outroNpcGUID); - if (jainaOrSylvanas) - { - if (_instanceScript.GetData(DataTypes.TeamInInstance) == (uint)Team.Alliance) - jainaOrSylvanas.GetAI().Talk(TextIds.SayJaynaOutro4); - else - jainaOrSylvanas.GetAI().Talk(TextIds.SaySylvanasOutro4); - } - _events.ScheduleEvent(Events.Outro5, 5000); - } - break; - case Events.Outro5: - Talk(TextIds.SayKrickOutro5); - _events.ScheduleEvent(Events.Outro6, 1000); - break; - case Events.Outro6: - { - Creature tyrannus = ObjectAccessor.GetCreature(me, _instanceScript.GetGuidData(DataTypes.TyrannusEvent)); - if (tyrannus) - { - tyrannus.SetSpeedRate(UnitMoveType.Flight, 3.5f); - tyrannus.GetMotionMaster().MovePoint(1, Misc.outroPos[4]); - _tyrannusGUID = tyrannus.GetGUID(); - } - _events.ScheduleEvent(Events.Outro7, 5000); - } - break; - case Events.Outro7: - { - Creature tyrannus = ObjectAccessor.GetCreature(me, _tyrannusGUID); - if (tyrannus) - tyrannus.GetAI().Talk(TextIds.SayTyrannusOutro7); - _events.ScheduleEvent(Events.Outro8, 5000); - } - break; - case Events.Outro8: - //! HACK: Creature's can't have MOVEMENTFLAG_FLYING - me.AddUnitMovementFlag(MovementFlag.Flying); - me.GetMotionMaster().MovePoint(0, Misc.outroPos[5]); - DoCast(me, SpellIds.Strangulating); - _events.ScheduleEvent(Events.Outro9, 2000); - break; - case Events.Outro9: - { - Talk(TextIds.SayKrickOutro8); - // @todo Tyrannus starts killing Krick. - // there shall be some visual spell effect - Creature tyrannus = ObjectAccessor.GetCreature(me, _tyrannusGUID); - if (tyrannus) - tyrannus.CastSpell(me, SpellIds.NecromanticPower, true); //not sure if it's the right spell :/ - _events.ScheduleEvent(Events.Outro10, 1000); - } - break; - case Events.Outro10: - //! HACK: Creature's can't have MOVEMENTFLAG_FLYING - me.RemoveUnitMovementFlag(MovementFlag.Flying); - me.AddUnitMovementFlag(MovementFlag.FallingFar); - me.GetMotionMaster().MovePoint(0, Misc.outroPos[6]); - _events.ScheduleEvent(Events.Outro11, 2000); - break; - case Events.Outro11: - DoCast(me, SpellIds.KrickKillCredit); // don't really know if we need it - me.SetStandState(UnitStandStateType.Dead); - me.SetHealth(0); - _events.ScheduleEvent(Events.Outro12, 3000); - break; - case Events.Outro12: - { - Creature tyrannus = ObjectAccessor.GetCreature(me, _tyrannusGUID); - if (tyrannus) - tyrannus.GetAI().Talk(TextIds.SayTyrannusOutro9); - _events.ScheduleEvent(Events.Outro13, 2000); - } - break; - case Events.Outro13: - { - Creature jainaOrSylvanas = ObjectAccessor.GetCreature(me, _outroNpcGUID); - if (jainaOrSylvanas) - { - if (_instanceScript.GetData(DataTypes.TeamInInstance) == (uint)Team.Alliance) - jainaOrSylvanas.GetAI().Talk(TextIds.SayJaynaOutro10); - else - jainaOrSylvanas.GetAI().Talk(TextIds.SaySylvanasOutro10); - } - // End of OUTRO. for now... - _events.ScheduleEvent(Events.OutroEnd, 3000); - - Creature tyrannus = ObjectAccessor.GetCreature(me, _tyrannusGUID); - if (tyrannus) - tyrannus.GetMotionMaster().MovePoint(0, Misc.outroPos[7]); - } - break; - case Events.OutroEnd: - { - Creature tyrannus = ObjectAccessor.GetCreature(me, _tyrannusGUID); - if (tyrannus) - tyrannus.DespawnOrUnsummon(); - - me.DisappearAndDie(); - } - break; - default: - break; - } - }); - } - - InstanceScript _instanceScript; - SummonList _summons; - - KrickPhase _phase; - ObjectGuid _outroNpcGUID; - ObjectGuid _tyrannusGUID; - } - - [Script] - class spell_krick_explosive_barrage : AuraScript - { - void HandlePeriodicTick(AuraEffect aurEff) - { - PreventDefaultAction(); - Unit caster = GetCaster(); - if (caster) - { - if (caster.IsCreature()) - { - var players = caster.GetMap().GetPlayers(); - foreach (var player in players) - { - if (player) - if (player.IsWithinDist(caster, 60.0f)) // don't know correct range - caster.CastSpell(player, SpellIds.ExplosiveBarrageSummon, true); - } - } - } - } - - public override void Register() - { - OnEffectPeriodic.Add(new EffectPeriodicHandler(HandlePeriodicTick, 0, AuraType.PeriodicTriggerSpell)); - } - } - - [Script] - class spell_ick_explosive_barrage : AuraScript - { - void HandleEffectApply(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Unit caster = GetCaster(); - if (caster) - if (caster.IsCreature()) - caster.GetMotionMaster().MoveIdle(); - } - - void HandleEffectRemove(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Unit caster = GetCaster(); - if (caster) - { - if (caster.IsCreature()) - { - caster.GetMotionMaster().Clear(); - caster.GetMotionMaster().MoveChase(caster.GetVictim()); - } - } - } - - public override void Register() - { - AfterEffectApply.Add(new EffectApplyHandler(HandleEffectApply, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); - AfterEffectRemove.Add(new EffectApplyHandler(HandleEffectRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); - } - } - - [Script] - class spell_exploding_orb_hasty_grow : AuraScript - { - void OnStackChange(AuraEffect aurEff, AuraEffectHandleModes mode) - { - if (GetStackAmount() == 15) - { - Unit target = GetTarget(); // store target because aura gets removed - target.CastSpell(target, SpellIds.ExplosiveBarrageDamage, false); - target.RemoveAurasDueToSpell(SpellIds.HastyGrow); - target.RemoveAurasDueToSpell(SpellIds.AutoGrow); - target.RemoveAurasDueToSpell(SpellIds.ExplodingOrb); - - Creature creature = target.ToCreature(); - if (creature) - creature.DespawnOrUnsummon(); - } - } - - public override void Register() - { - AfterEffectApply.Add(new EffectApplyHandler(OnStackChange, 0, AuraType.ModScale, AuraEffectHandleModes.Reapply)); - } - } - - [Script] - class spell_krick_pursuit : SpellScript - { - void HandleScriptEffect(uint effIndex) - { - if (GetCaster()) - { - Creature ick = GetCaster().ToCreature(); - if (ick) - { - Unit target = ick.GetAI().SelectTarget(SelectAggroTarget.Random, 0, 200.0f, true); - if (target) - { - ick.GetAI().Talk(TextIds.SayIckChase1, target); - ick.AddAura(GetSpellInfo().Id, target); - ick.GetAI().SetTempThreat(ick.GetThreatManager().GetThreat(target)); - ick.GetThreatManager().AddThreat(target, GetEffectValue(), GetSpellInfo(), true, true); - target.GetThreatManager().AddThreat(ick, GetEffectValue(), GetSpellInfo(), true, true); - } - } - } - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, 1, SpellEffectName.ScriptEffect)); - } - } - - [Script] - class spell_krick_pursuit_AuraScript : AuraScript - { - void HandleExtraEffect(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Unit caster = GetCaster(); - if (caster) - { - Creature creCaster = caster.ToCreature(); - if (creCaster) - creCaster.GetAI()._ResetThreat(GetTarget()); - } - } - - public override void Register() - { - AfterEffectRemove.Add(new EffectApplyHandler(HandleExtraEffect, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); - } - } - - [Script] - class spell_krick_pursuit_confusion : AuraScript - { - void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode) - { - GetTarget().ApplySpellImmune(0, SpellImmunity.State, AuraType.ModTaunt, true); - GetTarget().ApplySpellImmune(0, SpellImmunity.Effect, SpellEffectName.AttackMe, true); - } - - void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode) - { - GetTarget().ApplySpellImmune(0, SpellImmunity.State, AuraType.ModTaunt, false); - GetTarget().ApplySpellImmune(0, SpellImmunity.Effect, SpellEffectName.AttackMe, false); - } - - public override void Register() - { - OnEffectApply.Add(new EffectApplyHandler(OnApply, 2, AuraType.Linked, AuraEffectHandleModes.Real)); - OnEffectRemove.Add(new EffectApplyHandler(OnRemove, 2, AuraType.Linked, AuraEffectHandleModes.Real)); - } - } -} diff --git a/Source/Scripts/Northrend/FrozenHalls/PitOfSaron/InstancePitOfSaron.cs b/Source/Scripts/Northrend/FrozenHalls/PitOfSaron/InstancePitOfSaron.cs deleted file mode 100644 index 203400ec5..000000000 --- a/Source/Scripts/Northrend/FrozenHalls/PitOfSaron/InstancePitOfSaron.cs +++ /dev/null @@ -1,345 +0,0 @@ -using System.Collections.Generic; -using Game.Entities; -using Game.Scripting; -using Game.Maps; -using Framework.Constants; -using Framework.Dynamic; - -namespace Scripts.Northrend.FrozenHalls.PitOfSaron -{ - struct Misc - { - // positions for Martin Victus (37591) and Gorkun Ironskull (37592) - public static Position SlaveLeaderPos = new Position(689.7158f, -104.8736f, 513.7360f, 0.0f); - // position for Jaina and Sylvanas - public static Position EventLeaderPos2 = new Position(1054.368f, 107.14620f, 628.4467f, 0.0f); - - public static DoorData[] Doors = - { - new DoorData(GameObjectIds.IceWall, DataTypes.Garfrost, DoorType.Passage), - new DoorData(GameObjectIds.IceWall, DataTypes.Ick, DoorType.Passage), - new DoorData(GameObjectIds.HallsOfReflectionPortcullis, DataTypes.Tyrannus, DoorType.Passage), - }; - } - - [Script] - class instance_pit_of_saron : InstanceMapScript - { - public instance_pit_of_saron() : base(nameof(instance_pit_of_saron), 658) { } - - class instance_pit_of_saron_InstanceScript : InstanceScript - { - public instance_pit_of_saron_InstanceScript(InstanceMap map) : base(map) - { - SetHeaders("POS"); - SetBossNumber(3); - LoadDoorData(Misc.Doors); - _teamInInstance = 0; - _cavernActive = 0; - _shardsHit = 0; - } - - public override void OnPlayerEnter(Player player) - { - if (_teamInInstance == 0) - _teamInInstance = player.GetTeam(); - } - - public override void OnCreatureCreate(Creature creature) - { - if (_teamInInstance == 0) - { - var players = instance.GetPlayers(); - if (!players.Empty()) - { - Player player = players[0]; - if (player) - _teamInInstance = player.GetTeam(); - } - } - - switch (creature.GetEntry()) - { - case CreatureIds.Garfrost: - _garfrostGUID = creature.GetGUID(); - break; - case CreatureIds.Krick: - _krickGUID = creature.GetGUID(); - break; - case CreatureIds.Ick: - _ickGUID = creature.GetGUID(); - break; - case CreatureIds.Tyrannus: - _tyrannusGUID = creature.GetGUID(); - break; - case CreatureIds.Rimefang: - _rimefangGUID = creature.GetGUID(); - break; - case CreatureIds.TyrannusEvents: - _tyrannusEventGUID = creature.GetGUID(); - break; - case CreatureIds.SylvanasPart1: - if (_teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.JainaPart1); - _jainaOrSylvanas1GUID = creature.GetGUID(); - break; - case CreatureIds.SylvanasPart2: - if (_teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.JainaPart2); - _jainaOrSylvanas2GUID = creature.GetGUID(); - break; - case CreatureIds.Kilara: - if (_teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.Elandra); - break; - case CreatureIds.Koralen: - if (_teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.Korlaen); - break; - case CreatureIds.Champion1Horde: - if (_teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.Champion1Alliance); - break; - case CreatureIds.Champion2Horde: - if (_teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.Champion2Alliance); - break; - case CreatureIds.Champion3Horde: // No 3rd set for Alliance? - if (_teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.Champion2Alliance); - break; - case CreatureIds.HordeSlave1: - if (_teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.AllianceSlave1); - break; - case CreatureIds.HordeSlave2: - if (_teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.AllianceSlave2); - break; - case CreatureIds.HordeSlave3: - if (_teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.AllianceSlave3); - break; - case CreatureIds.HordeSlave4: - if (_teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.AllianceSlave4); - break; - case CreatureIds.FreedSlave1Horde: - if (_teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.FreedSlave1Alliance); - break; - case CreatureIds.FreedSlave2Horde: - if (_teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.FreedSlave2Alliance); - break; - case CreatureIds.FreedSlave3Horde: - if (_teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.FreedSlave3Alliance); - break; - case CreatureIds.RescuedSlaveHorde: - if (_teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.RescuedSlaveAlliance); - break; - case CreatureIds.MartinVictus1: - if (_teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.MartinVictus1); - break; - case CreatureIds.MartinVictus2: - if (_teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.MartinVictus2); - break; - case CreatureIds.CavernEventTrigger: - _cavernstriggersVector.Add(creature.GetGUID()); - break; - default: - break; - } - } - - public override void OnGameObjectCreate(GameObject go) - { - switch (go.GetEntry()) - { - case GameObjectIds.IceWall: - case GameObjectIds.HallsOfReflectionPortcullis: - AddDoor(go, true); - break; - } - } - - public override void OnGameObjectRemove(GameObject go) - { - switch (go.GetEntry()) - { - case GameObjectIds.IceWall: - case GameObjectIds.HallsOfReflectionPortcullis: - AddDoor(go, false); - break; - } - } - - public override bool SetBossState(uint type, EncounterState state) - { - if (!base.SetBossState(type, state)) - return false; - - switch (type) - { - case DataTypes.Garfrost: - if (state == EncounterState.Done) - { - Creature summoner = instance.GetCreature(_garfrostGUID); - if (summoner) - { - if (_teamInInstance == Team.Alliance) - summoner.SummonCreature(CreatureIds.MartinVictus1, Misc.SlaveLeaderPos, TempSummonType.ManualDespawn); - else - summoner.SummonCreature(CreatureIds.GorkunIronskull2, Misc.SlaveLeaderPos, TempSummonType.ManualDespawn); - } - } - break; - case DataTypes.Tyrannus: - if (state == EncounterState.Done) - { - Creature summoner = instance.GetCreature(_tyrannusGUID); - if (summoner) - { - if (_teamInInstance == Team.Alliance) - summoner.SummonCreature(CreatureIds.JainaPart2, Misc.EventLeaderPos2, TempSummonType.ManualDespawn); - else - summoner.SummonCreature(CreatureIds.SylvanasPart2, Misc.EventLeaderPos2, TempSummonType.ManualDespawn); - } - } - break; - default: - break; - } - - return true; - } - - public override uint GetData(uint type) - { - switch (type) - { - case DataTypes.TeamInInstance: - return (uint)_teamInInstance; - case DataTypes.IceShardsHit: - return _shardsHit; - case DataTypes.CavernActive: - return _cavernActive; - default: - break; - } - - return 0; - } - - public override void SetData(uint type, uint data) - { - switch (type) - { - case DataTypes.IceShardsHit: - _shardsHit = (byte)data; - break; - case DataTypes.CavernActive: - if (data != 0) - { - _cavernActive = (byte)data; - HandleCavernEventTrigger(true); - } - else - HandleCavernEventTrigger(false); - break; - default: - break; - } - } - - public override ObjectGuid GetGuidData(uint type) - { - switch (type) - { - case DataTypes.Garfrost: - return _garfrostGUID; - case DataTypes.Krick: - return _krickGUID; - case DataTypes.Ick: - return _ickGUID; - case DataTypes.Tyrannus: - return _tyrannusGUID; - case DataTypes.Rimefang: - return _rimefangGUID; - case DataTypes.TyrannusEvent: - return _tyrannusEventGUID; - case DataTypes.JainaSylvanas1: - return _jainaOrSylvanas1GUID; - case DataTypes.JainaSylvanas2: - return _jainaOrSylvanas2GUID; - default: - break; - } - - return ObjectGuid.Empty; - } - - void HandleCavernEventTrigger(bool activate) - { - foreach (ObjectGuid guid in _cavernstriggersVector) - { - Creature trigger = instance.GetCreature(guid); - if (trigger) - { - if (activate) - trigger.m_Events.AddEvent(new ScheduledIcicleSummons(trigger), trigger.m_Events.CalculateTime(1000)); - else - trigger.m_Events.KillAllEvents(false); - } - } - } - - ObjectGuid _garfrostGUID; - ObjectGuid _krickGUID; - ObjectGuid _ickGUID; - ObjectGuid _tyrannusGUID; - ObjectGuid _rimefangGUID; - - ObjectGuid _tyrannusEventGUID; - ObjectGuid _jainaOrSylvanas1GUID; - ObjectGuid _jainaOrSylvanas2GUID; - List _cavernstriggersVector = new List(); - - Team _teamInInstance; - byte _shardsHit; - byte _cavernActive; - } - - public override InstanceScript GetInstanceScript(InstanceMap map) - { - return new instance_pit_of_saron_InstanceScript(map); - } - } - - class ScheduledIcicleSummons : BasicEvent - { - public ScheduledIcicleSummons(Creature trigger) - { - _trigger = trigger; - } - - public override bool Execute(ulong time, uint diff) - { - if (RandomHelper.randChance(12)) - { - _trigger.CastSpell(_trigger, SpellIds.IcicleSummon, true); - _trigger.m_Events.AddEvent(new ScheduledIcicleSummons(_trigger), _trigger.m_Events.CalculateTime(RandomHelper.URand(20000, 35000))); - } - else - _trigger.m_Events.AddEvent(new ScheduledIcicleSummons(_trigger), _trigger.m_Events.CalculateTime(RandomHelper.URand(1000, 20000))); - - return true; - } - - Creature _trigger; - } -} diff --git a/Source/Scripts/Northrend/FrozenHalls/PitOfSaron/PitOfSaron.cs b/Source/Scripts/Northrend/FrozenHalls/PitOfSaron/PitOfSaron.cs deleted file mode 100644 index e5e02c1ed..000000000 --- a/Source/Scripts/Northrend/FrozenHalls/PitOfSaron/PitOfSaron.cs +++ /dev/null @@ -1,330 +0,0 @@ -using System; -using Game.Entities; -using Game.AI; -using Game.Spells; -using Game.DataStorage; -using Game.Scripting; -using Framework.Constants; -using Game.Maps; - -namespace Scripts.Northrend.FrozenHalls.PitOfSaron -{ - struct TextIds - { - public const uint SayTyrannusCavernEntrance = 3; - } - - struct DataTypes - { - // Encounter States And Guids - public const uint Garfrost = 0; - public const uint Ick = 1; - public const uint Tyrannus = 2; - - // Guids - public const uint Rimefang = 3; - public const uint Krick = 4; - public const uint JainaSylvanas1 = 5; // Guid Of Either Jaina Or Sylvanas Part 1; Depending On Team; As It'S The Same Spawn. - public const uint JainaSylvanas2 = 6; // Guid Of Either Jaina Or Sylvanas Part 2; Depending On Team; As It'S The Same Spawn. - public const uint TyrannusEvent = 7; - public const uint TeamInInstance = 8; - public const uint IceShardsHit = 9; - public const uint CavernActive = 10; - } - - struct CreatureIds - { - public const uint Garfrost = 36494; - public const uint Krick = 36477; - public const uint Ick = 36476; - public const uint Tyrannus = 36658; - public const uint Rimefang = 36661; - - public const uint TyrannusEvents = 36794; - public const uint SylvanasPart1 = 36990; - public const uint SylvanasPart2 = 38189; - public const uint JainaPart1 = 36993; - public const uint JainaPart2 = 38188; - public const uint Kilara = 37583; - public const uint Elandra = 37774; - public const uint Koralen = 37779; - public const uint Korlaen = 37582; - public const uint Champion1Horde = 37584; - public const uint Champion2Horde = 37587; - public const uint Champion3Horde = 37588; - public const uint Champion1Alliance = 37496; - public const uint Champion2Alliance = 37497; - - public const uint HordeSlave1 = 36770; - public const uint HordeSlave2 = 36771; - public const uint HordeSlave3 = 36772; - public const uint HordeSlave4 = 36773; - public const uint AllianceSlave1 = 36764; - public const uint AllianceSlave2 = 36765; - public const uint AllianceSlave3 = 36766; - public const uint AllianceSlave4 = 36767; - public const uint FreedSlave1Alliance = 37575; - public const uint FreedSlave2Alliance = 37572; - public const uint FreedSlave3Alliance = 37576; - public const uint FreedSlave1Horde = 37579; - public const uint FreedSlave2Horde = 37578; - public const uint FreedSlave3Horde = 37577; - public const uint RescuedSlaveAlliance = 36888; - public const uint RescuedSlaveHorde = 36889; - public const uint MartinVictus1 = 37591; - public const uint MartinVictus2 = 37580; - public const uint GorkunIronskull1 = 37581; - public const uint GorkunIronskull2 = 37592; - - public const uint ForgemasterStalker = 36495; - public const uint ExplodingOrb = 36610; - public const uint YmirjarDeathbringer = 36892; - public const uint IcyBlast = 36731; - public const uint CavernEventTrigger = 32780; - } - - struct GameObjectIds - { - public const uint SaroniteRock = 196485; - public const uint IceWall = 201885; - public const uint HallsOfReflectionPortcullis = 201848; - } - - struct SpellIds - { - public const uint IcicleSummon = 69424; - public const uint IcicleFallTrigger = 69426; - public const uint IcicleFallVisual = 69428; - public const uint AchievDontLookUpCredit = 72845; - - public const uint Fireball = 69583; //Ymirjar Flamebearer - public const uint Hellfire = 69586; - public const uint TacticalBlink = 69584; - public const uint FrostBreath = 69527; //Iceborn Proto-Drake - public const uint LeapingFaceMaul = 69504; // Geist Ambusher - } - - [Script] - class npc_ymirjar_flamebearer : ScriptedAI - { - public npc_ymirjar_flamebearer(Creature creature) : base(creature) - { - } - - public override void Reset() - { - _scheduler.CancelAll(); - } - - public override void EnterCombat(Unit who) - { - _scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting)); - _scheduler.Schedule(TimeSpan.FromSeconds(4), task => - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0); - if (target) - DoCast(target, SpellIds.Fireball); - task.Repeat(TimeSpan.FromSeconds(5)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(15), task => - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0); - if (target) - DoCast(target, SpellIds.TacticalBlink); - DoCast(me, SpellIds.Hellfire); - task.Repeat(TimeSpan.FromSeconds(12)); - }); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - DoMeleeAttackIfReady(); - } - } - - [Script] - class npc_iceborn_protodrake : ScriptedAI - { - public npc_iceborn_protodrake(Creature creature) : base(creature) { } - - public override void EnterCombat(Unit who) - { - Vehicle vehicle = me.GetVehicleKit(); - if (vehicle) - vehicle.RemoveAllPassengers(); - - _scheduler.Schedule(TimeSpan.FromSeconds(5), task => - { - DoCastVictim(SpellIds.FrostBreath); - task.Repeat(TimeSpan.FromSeconds(10)); - }); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - DoMeleeAttackIfReady(); - } - } - - [Script] - class npc_geist_ambusher : ScriptedAI - { - public npc_geist_ambusher(Creature creature) : base(creature) { } - - public override void EnterCombat(Unit who) - { - if (who.GetTypeId() != TypeId.Player) - return; - - // the max range is determined by aggro range - if (me.GetDistance(who) > 5.0f) - DoCast(who, SpellIds.LeapingFaceMaul); - - _scheduler.Schedule(TimeSpan.FromSeconds(9), task => - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 5.0f, true); - if (target) - DoCast(target, SpellIds.LeapingFaceMaul); - - task.Repeat(TimeSpan.FromSeconds(9), TimeSpan.FromSeconds(14)); - }); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - DoMeleeAttackIfReady(); - } - } - - [Script] - class spell_trash_npc_glacial_strike : AuraScript - { - void PeriodicTick(AuraEffect aurEff) - { - if (GetTarget().IsFullHealth()) - { - GetTarget().RemoveAura(GetId(), ObjectGuid.Empty, 0, AuraRemoveMode.EnemySpell); - PreventDefaultAction(); - } - } - - public override void Register() - { - OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 2, AuraType.PeriodicDamagePercent)); - } - } - - [Script] - class npc_pit_of_saron_icicle : PassiveAI - { - public npc_pit_of_saron_icicle(Creature creature) : base(creature) - { - me.SetDisplayFromModel(0); - } - - public override void IsSummonedBy(Unit summoner) - { - _summonerGUID = summoner.GetGUID(); - - _scheduler.Schedule(TimeSpan.FromMilliseconds(3650), task => - { - DoCastSelf(SpellIds.IcicleFallTrigger, true); - DoCastSelf(SpellIds.IcicleFallVisual); - - Unit caster = Global.ObjAccessor.GetUnit(me, _summonerGUID); - if (caster) - caster.RemoveDynObject(SpellIds.IcicleSummon); - }); - } - - public override void UpdateAI(uint diff) - { - _scheduler.Update(diff); - } - - ObjectGuid _summonerGUID; - } - - [Script] - class spell_pos_ice_shards : SpellScript - { - void HandleScriptEffect(uint effIndex) - { - if (GetHitPlayer()) - GetCaster().GetInstanceScript().SetData(DataTypes.CavernActive, 1); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, 0, SpellEffectName.SchoolDamage)); - } - } - - [Script] - class at_pit_cavern_entrance : AreaTriggerScript - { - public at_pit_cavern_entrance() : base("at_pit_cavern_entrance") { } - - public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger, bool entered) - { - if (!entered) - return true; - - InstanceScript instance = player.GetInstanceScript(); - if (instance != null) - { - if (instance.GetData(DataTypes.CavernActive) != 0) - return true; - - instance.SetData(DataTypes.CavernActive, 1); - - Creature tyrannus = ObjectAccessor.GetCreature(player, instance.GetGuidData(DataTypes.TyrannusEvent)); - if (tyrannus) - tyrannus.GetAI().Talk(TextIds.SayTyrannusCavernEntrance); - } - return true; - } - } - - [Script] - class at_pit_cavern_end : AreaTriggerScript - { - public at_pit_cavern_end() : base("at_pit_cavern_end") { } - - public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger, bool entered) - { - if (!entered) - return true; - - InstanceScript instance = player.GetInstanceScript(); - if (instance != null) - { - instance.SetData(DataTypes.CavernActive, 0); - - if (instance.GetData(DataTypes.IceShardsHit) == 0) - instance.DoUpdateCriteria(CriteriaTypes.BeSpellTarget, SpellIds.AchievDontLookUpCredit, 0, player); - } - - return true; - } - } -} diff --git a/Source/Scripts/Northrend/Gundrak/BossDrakkariColossus.cs b/Source/Scripts/Northrend/Gundrak/BossDrakkariColossus.cs deleted file mode 100644 index 9861cd669..000000000 --- a/Source/Scripts/Northrend/Gundrak/BossDrakkariColossus.cs +++ /dev/null @@ -1,414 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using Game.Spells; -using System; -using System.Collections.Generic; - -namespace Scripts.Northrend.Gundrak.DrakkariColossus -{ - struct TextIds - { - // Drakkari Elemental - public const uint EmoteMojo = 0; - public const uint EmoteActivateAltar = 1; - } - - struct SpellIds - { - public const uint Emerge = 54850; - public const uint ElementalSpawnEffect = 54888; - public const uint MojoVolley = 54849; - public const uint SurgeVisual = 54827; - public const uint Merge = 54878; - public const uint MightyBlow = 54719; - public const uint Surge = 54801; - public const uint FreezeAnim = 16245; - public const uint MojoPuddle = 55627; - public const uint MojoWave = 55626; - } - - struct Misc - { - public const uint EventMightyBlow = 1; - public const uint EventSurge = 1; - - public const int ActionSummonElemental = 1; - public const int ActionFreezeColossus = 2; - public const int ActionUnfreezeColossus = 3; - public const int ActionReturnToColossus = 1; - - public const byte ColossusPhaseNormal = 1; - public const byte ColossusPhaseFirstElementalSummon = 2; - public const byte ColossusPhaseSecondElementalSummon = 3; - - public const uint DataColossusPhase = 1; - public const uint DataIntroDone = 2; - } - - [Script] - class boss_drakkari_colossus : BossAI - { - public boss_drakkari_colossus(Creature creature) : base(creature, GDDataTypes.DrakkariColossus) - { - Initialize(); - me.SetReactState(ReactStates.Passive); - introDone = false; - } - - void Initialize() - { - phase = Misc.ColossusPhaseNormal; - } - - public override void Reset() - { - _Reset(); - - if (GetData(Misc.DataIntroDone) != 0) - { - me.SetReactState(ReactStates.Aggressive); - me.RemoveUnitFlag(UnitFlags.ImmuneToPc); - me.RemoveAura(SpellIds.FreezeAnim); - } - - _scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting)); - - _scheduler.Schedule(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(30), task => - { - DoCastVictim(SpellIds.MightyBlow); - task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(15)); - }); - - Initialize(); - } - - public override void EnterCombat(Unit who) - { - _EnterCombat(); - me.RemoveAura(SpellIds.FreezeAnim); - } - - public override void JustDied(Unit killer) - { - _JustDied(); - } - - public override void DoAction(int action) - { - switch (action) - { - case Misc.ActionSummonElemental: - DoCast(SpellIds.Emerge); - break; - case Misc.ActionFreezeColossus: - me.GetMotionMaster().Clear(); - me.GetMotionMaster().MoveIdle(); - - me.SetReactState(ReactStates.Passive); - me.AddUnitFlag(UnitFlags.ImmuneToPc); - DoCast(me, SpellIds.FreezeAnim); - break; - case Misc.ActionUnfreezeColossus: - if (me.GetReactState() == ReactStates.Aggressive) - return; - - me.SetReactState(ReactStates.Aggressive); - me.RemoveUnitFlag(UnitFlags.ImmuneToPc); - me.RemoveAura(SpellIds.FreezeAnim); - - me.SetInCombatWithZone(); - - if (me.GetVictim()) - me.GetMotionMaster().MoveChase(me.GetVictim(), 0, 0); - break; - } - } - - public override void DamageTaken(Unit attacker, ref uint damage) - { - if (me.HasUnitFlag(UnitFlags.ImmuneToPc)) - damage = 0; - - if (phase == Misc.ColossusPhaseNormal || - phase == Misc.ColossusPhaseFirstElementalSummon) - { - if (HealthBelowPct(phase == Misc.ColossusPhaseNormal ? 50 : 5)) - { - damage = 0; - phase = (phase == Misc.ColossusPhaseNormal ? Misc.ColossusPhaseFirstElementalSummon : Misc.ColossusPhaseSecondElementalSummon); - DoAction(Misc.ActionFreezeColossus); - DoAction(Misc.ActionSummonElemental); - } - } - } - - public override uint GetData(uint data) - { - if (data == Misc.DataColossusPhase) - return phase; - else if (data == Misc.DataIntroDone) - return introDone ? 1 : 0u; - - return 0; - } - - public override void SetData(uint type, uint data) - { - if (type == Misc.DataIntroDone) - introDone = data != 0; - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - if (me.GetReactState() == ReactStates.Aggressive) - DoMeleeAttackIfReady(); - } - - public override void JustSummoned(Creature summon) - { - summon.SetInCombatWithZone(); - - if (phase == Misc.ColossusPhaseSecondElementalSummon) - summon.SetHealth(summon.GetMaxHealth() / 2); - } - - byte phase; - bool introDone; - } - - [Script] - class boss_drakkari_elemental : ScriptedAI - { - public boss_drakkari_elemental(Creature creature) : base(creature) - { - DoCast(me, SpellIds.ElementalSpawnEffect); - instance = creature.GetInstanceScript(); - } - - public override void Reset() - { - _scheduler.CancelAll(); - _scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting)); - - _scheduler.Schedule(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(15), task => - { - DoCast(SpellIds.SurgeVisual); - Unit target = SelectTarget(SelectAggroTarget.Random, 1, 0.0f, true); - if (target) - DoCast(target, SpellIds.Surge); - task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(15)); - }); - - me.AddAura(SpellIds.MojoVolley, me); - } - - public override void JustDied(Unit killer) - { - Talk(TextIds.EmoteActivateAltar); - - Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus); - if (colossus) - killer.Kill(colossus); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - DoMeleeAttackIfReady(); - } - - public override void DoAction(int action) - { - switch (action) - { - case Misc.ActionReturnToColossus: - Talk(TextIds.EmoteMojo); - DoCast(SpellIds.SurgeVisual); - Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus); - if (colossus) - // what if the elemental is more than 80 yards from drakkari colossus ? - DoCast(colossus, SpellIds.Merge, true); - break; - } - } - - public override void DamageTaken(Unit attacker, ref uint damage) - { - if (HealthBelowPct(50)) - { - Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus); - if (colossus) - { - if (colossus.GetAI().GetData(Misc.DataColossusPhase) == Misc.ColossusPhaseFirstElementalSummon) - { - damage = 0; - - // to prevent spell spaming - if (me.HasUnitState(UnitState.Charging)) - return; - - // not sure about this, the idea of this code is to prevent bug the elemental - // if it is not in a acceptable distance to cast the charge spell. - if (me.GetDistance(colossus) > 80.0f) - { - if (me.GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Point) - return; - - me.GetMotionMaster().MovePoint(0, colossus.GetPositionX(), colossus.GetPositionY(), colossus.GetPositionZ()); - return; - } - DoAction(Misc.ActionReturnToColossus); - } - } - } - } - - public override void EnterEvadeMode(EvadeReason why) - { - me.DespawnOrUnsummon(); - } - - public override void SpellHitTarget(Unit target, SpellInfo spell) - { - if (spell.Id == SpellIds.Merge) - { - Creature colossus = target.ToCreature(); - if (colossus) - { - colossus.GetAI().DoAction(Misc.ActionUnfreezeColossus); - me.DespawnOrUnsummon(); - } - } - } - - InstanceScript instance; - } - - [Script] - class npc_living_mojo : ScriptedAI - { - public npc_living_mojo(Creature creature) : base(creature) - { - instance = creature.GetInstanceScript(); - } - - public override void Reset() - { - _scheduler.Schedule(TimeSpan.FromSeconds(2), task => - { - DoCastVictim(SpellIds.MojoWave); - task.Repeat(TimeSpan.FromSeconds(15)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(7), task => - { - DoCastVictim(SpellIds.MojoPuddle); - task.Repeat(TimeSpan.FromSeconds(18)); - }); - } - - void MoveMojos(Creature boss) - { - List mojosList = new List(); - boss.GetCreatureListWithEntryInGrid(mojosList, me.GetEntry(), 12.0f); - if (!mojosList.Empty()) - { - foreach (var mojo in mojosList) - { - if (mojo) - mojo.GetMotionMaster().MovePoint(1, boss.GetHomePosition()); - } - } - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - if (type != MovementGeneratorType.Point) - return; - - if (id == 1) - { - Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus); - if (colossus) - { - colossus.GetAI().DoAction(Misc.ActionUnfreezeColossus); - if (colossus.GetAI().GetData(Misc.DataIntroDone) == 0) - colossus.GetAI().SetData(Misc.DataIntroDone, 1); - colossus.SetInCombatWithZone(); - me.DespawnOrUnsummon(); - } - } - } - - public override void AttackStart(Unit attacker) - { - if (me.GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Point) - return; - - // we do this checks to see if the creature is one of the creatures that sorround the boss - Creature colossus = instance.GetCreature(GDDataTypes.DrakkariColossus); - if (colossus) - { - Position homePosition = me.GetHomePosition(); - - float distance = homePosition.GetExactDist(colossus.GetHomePosition()); - - if (distance < 12.0f) - { - MoveMojos(colossus); - me.SetReactState(ReactStates.Passive); - } - else - base.AttackStart(attacker); - } - } - - public override void UpdateAI(uint diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - DoMeleeAttackIfReady(); - } - - InstanceScript instance; - } -} diff --git a/Source/Scripts/Northrend/Gundrak/BossEck.cs b/Source/Scripts/Northrend/Gundrak/BossEck.cs deleted file mode 100644 index f8b730d30..000000000 --- a/Source/Scripts/Northrend/Gundrak/BossEck.cs +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Scripting; -using System; - -namespace Scripts.Northrend.Gundrak.EckTheFerocious -{ - struct TextIds - { - public const uint EmoteSpawn = 0; - } - - struct SpellIds - { - public const uint Berserk = 55816; // Eck goes berserk, increasing his attack speed by 150% and all damage he deals by 500%. - public const uint Bite = 55813; // Eck bites down hard, inflicting 150% of his normal damage to an enemy. - public const uint Spit = 55814; // Eck spits toxic bile at enemies in a cone in front of him, inflicting 2970 Nature damage and draining 220 mana every 1 sec for 3 sec. - public const uint Spring1 = 55815; // Eck leaps at a distant target. -. Drops aggro and charges a random player. Tank can simply taunt him back. - public const uint Spring2 = 55837; // Eck leaps at a distant target. - } - - [Script] - class boss_eck : BossAI - { - public boss_eck(Creature creature) : base(creature, GDDataTypes.EckTheFerocious) - { - Initialize(); - Talk(TextIds.EmoteSpawn); - } - - void Initialize() - { - _berserk = false; - } - - public override void Reset() - { - _Reset(); - Initialize(); - } - - public override void EnterCombat(Unit who) - { - _EnterCombat(); - - _scheduler.SetValidator(() => !me.HasUnitState(UnitState.Casting)); - - _scheduler.Schedule(TimeSpan.FromSeconds(5), task => - { - DoCastVictim(SpellIds.Bite); - task.Repeat(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(12)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(10), task => - { - DoCastVictim(SpellIds.Spit); - task.Repeat(TimeSpan.FromSeconds(6), TimeSpan.FromSeconds(14)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(8), task => - { - Unit target = SelectTarget(SelectAggroTarget.Random, 1, 35.0f, true); - if (target) - DoCast(target, RandomHelper.RAND(SpellIds.Spring1, SpellIds.Spring2)); - task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10)); - }); - - // 60-90 secs according to wowwiki - _scheduler.Schedule(TimeSpan.FromSeconds(60), TimeSpan.FromSeconds(90), 1, task => - { - DoCast(me, SpellIds.Berserk); - _berserk = true; - }); - } - - public override void DamageTaken(Unit attacker, ref uint damage) - { - if (!_berserk && me.HealthBelowPctDamaged(20, damage)) - { - _scheduler.RescheduleGroup(1, TimeSpan.FromSeconds(1)); - _berserk = true; - } - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - DoMeleeAttackIfReady(); - } - - bool _berserk; - } -} \ No newline at end of file diff --git a/Source/Scripts/Northrend/Gundrak/InstanceGundrak.cs b/Source/Scripts/Northrend/Gundrak/InstanceGundrak.cs deleted file mode 100644 index 9d32fd479..000000000 --- a/Source/Scripts/Northrend/Gundrak/InstanceGundrak.cs +++ /dev/null @@ -1,449 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Framework.IO; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using System.Collections.Generic; -using System.Text; - -namespace Scripts.Northrend.Gundrak -{ - struct GDInstanceMisc - { - public const uint TimerStatueActivation = 3500; - - public static DoorData[] doorData = - { - new DoorData(GDGameObjectIds.GalDarahDoor1, GDDataTypes.GalDarah, DoorType.Passage), - new DoorData(GDGameObjectIds.GalDarahDoor2, GDDataTypes.GalDarah, DoorType.Passage), - new DoorData(GDGameObjectIds.GalDarahDoor3, GDDataTypes.GalDarah, DoorType.Room), - new DoorData(GDGameObjectIds.EckTheFerociousDoor, GDDataTypes.Moorabi, DoorType.Passage), - new DoorData(GDGameObjectIds.EckTheFerociousDoorBehind, GDDataTypes.EckTheFerocious, DoorType.Passage), - }; - - public static ObjectData[] creatureData = - { - new ObjectData(GDCreatureIds.DrakkariColossus, GDDataTypes.DrakkariColossus), - }; - - public static ObjectData[] gameObjectData = - { - new ObjectData(GDGameObjectIds.SladRanAltar, GDDataTypes.SladRanAltar), - new ObjectData(GDGameObjectIds.MoorabiAltar, GDDataTypes.MoorabiAltar), - new ObjectData(GDGameObjectIds.DrakkariColossusAltar, GDDataTypes.DrakkariColossusAltar), - new ObjectData(GDGameObjectIds.SladRanStatue, GDDataTypes.SladRanStatue), - new ObjectData(GDGameObjectIds.MoorabiStatue, GDDataTypes.MoorabiStatue), - new ObjectData(GDGameObjectIds.DrakkariColossusStatue, GDDataTypes.DrakkariColossusStatue), - new ObjectData(GDGameObjectIds.GalDarahStatue, GDDataTypes.GalDarahStatue), - new ObjectData(GDGameObjectIds.Trapdoor, GDDataTypes.Trapdoor), - new ObjectData(GDGameObjectIds.Collision, GDDataTypes.Collision) - }; - - public static Position EckSpawnPoint = new Position(1643.877930f, 936.278015f, 107.204948f, 0.668432f); - } - - struct GDDataTypes - { - // Encounter Ids // Encounter States // Boss Guids - public const uint SladRan = 0; - public const uint DrakkariColossus = 1; - public const uint Moorabi = 2; - public const uint GalDarah = 3; - public const uint EckTheFerocious = 4; - - // Additional Objects - public const uint SladRanAltar = 5; - public const uint DrakkariColossusAltar = 6; - public const uint MoorabiAltar = 7; - - public const uint SladRanStatue = 8; - public const uint DrakkariColossusStatue = 9; - public const uint MoorabiStatue = 10; - public const uint GalDarahStatue = 11; - - public const uint Trapdoor = 12; - public const uint Collision = 13; - public const uint Bridge = 14; - - public const uint StatueActivate = 15; - } - - struct GDCreatureIds - { - public const uint SladRan = 29304; - public const uint Moorabi = 29305; - public const uint GalDarah = 29306; - public const uint DrakkariColossus = 29307; - public const uint RuinDweller = 29920; - public const uint EckTheFerocious = 29932; - public const uint AltarTrigger = 30298; - } - - struct GDGameObjectIds - { - public const uint SladRanAltar = 192518; - public const uint MoorabiAltar = 192519; - public const uint DrakkariColossusAltar = 192520; - public const uint SladRanStatue = 192564; - public const uint MoorabiStatue = 192565; - public const uint GalDarahStatue = 192566; - public const uint DrakkariColossusStatue = 192567; - public const uint EckTheFerociousDoor = 192632; - public const uint EckTheFerociousDoorBehind = 192569; - public const uint GalDarahDoor1 = 193208; - public const uint GalDarahDoor2 = 193209; - public const uint GalDarahDoor3 = 192568; - public const uint Trapdoor = 193188; - public const uint Collision = 192633; - } - - struct GDSpellIds - { - public const uint FireBeamMammoth = 57068; - public const uint FireBeamSnake = 57071; - public const uint FireBeamElemental = 57072; - } - - [Script] - class instance_gundrak : InstanceMapScript - { - public instance_gundrak() : base(nameof(instance_gundrak), 604) { } - - class instance_gundrak_InstanceMapScript : InstanceScript - { - public instance_gundrak_InstanceMapScript(InstanceMap map) : base(map) - { - SetHeaders("GD"); - SetBossNumber(5); - LoadDoorData(GDInstanceMisc.doorData); - LoadObjectData(GDInstanceMisc.creatureData, GDInstanceMisc.gameObjectData); - - SladRanStatueState = GameObjectState.Active; - DrakkariColossusStatueState = GameObjectState.Active; - MoorabiStatueState = GameObjectState.Active; - } - - public override void OnCreatureCreate(Creature creature) - { - switch (creature.GetEntry()) - { - case GDCreatureIds.RuinDweller: - if (creature.IsAlive()) - DwellerGUIDs.Add(creature.GetGUID()); - break; - default: - break; - } - - base.OnCreatureCreate(creature); - } - - public override void OnGameObjectCreate(GameObject go) - { - switch (go.GetEntry()) - { - case GDGameObjectIds.SladRanAltar: - if (GetBossState(GDDataTypes.SladRan) == EncounterState.Done) - { - if (SladRanStatueState == GameObjectState.Active) - go.RemoveFlag(GameObjectFlags.NotSelectable); - else - go.SetGoState(GameObjectState.Active); - } - break; - case GDGameObjectIds.MoorabiAltar: - if (GetBossState(GDDataTypes.Moorabi) == EncounterState.Done) - { - if (MoorabiStatueState == GameObjectState.Active) - go.RemoveFlag(GameObjectFlags.NotSelectable); - else - go.SetGoState(GameObjectState.Active); - } - break; - case GDGameObjectIds.DrakkariColossusAltar: - if (GetBossState(GDDataTypes.DrakkariColossus) == EncounterState.Done) - { - if (DrakkariColossusStatueState == GameObjectState.Active) - go.RemoveFlag(GameObjectFlags.NotSelectable); - else - go.SetGoState(GameObjectState.Active); - } - break; - case GDGameObjectIds.SladRanStatue: - go.SetGoState(SladRanStatueState); - break; - case GDGameObjectIds.MoorabiStatue: - go.SetGoState(MoorabiStatueState); - break; - case GDGameObjectIds.GalDarahStatue: - go.SetGoState(CheckRequiredBosses(GDDataTypes.GalDarah) ? GameObjectState.ActiveAlternative : GameObjectState.Ready); - break; - case GDGameObjectIds.DrakkariColossusStatue: - go.SetGoState(DrakkariColossusStatueState); - break; - case GDGameObjectIds.EckTheFerociousDoor: - // Don't store door on non-heroic - if (!instance.IsHeroic()) - return; - break; - case GDGameObjectIds.Trapdoor: - go.SetGoState(CheckRequiredBosses(GDDataTypes.GalDarah) ? GameObjectState.Ready : GameObjectState.Active); - break; - case GDGameObjectIds.Collision: - go.SetGoState(CheckRequiredBosses(GDDataTypes.GalDarah) ? GameObjectState.Active : GameObjectState.Ready); - break; - default: - break; - } - - base.OnGameObjectCreate(go); - } - - public override void OnUnitDeath(Unit unit) - { - if (unit.GetEntry() == GDCreatureIds.RuinDweller) - { - DwellerGUIDs.Remove(unit.GetGUID()); - - if (DwellerGUIDs.Empty()) - unit.SummonCreature(GDCreatureIds.EckTheFerocious, GDInstanceMisc.EckSpawnPoint, TempSummonType.CorpseTimedDespawn, 300 * Time.InMilliseconds); - } - } - - public override bool SetBossState(uint type, EncounterState state) - { - if (!base.SetBossState(type, state)) - return false; - - switch (type) - { - case GDDataTypes.SladRan: - if (state == EncounterState.Done) - { - GameObject go = GetGameObject(GDDataTypes.SladRanAltar); - if (go) - go.RemoveFlag(GameObjectFlags.NotSelectable); - } - break; - case GDDataTypes.DrakkariColossus: - if (state == EncounterState.Done) - { - GameObject go = GetGameObject(GDDataTypes.DrakkariColossusAltar); - if (go) - go.RemoveFlag(GameObjectFlags.NotSelectable); - } - break; - case GDDataTypes.Moorabi: - if (state == EncounterState.Done) - { - GameObject go = GetGameObject(GDDataTypes.MoorabiAltar); - if (go) - go.RemoveFlag(GameObjectFlags.NotSelectable); - } - break; - default: - break; - } - - return true; - } - - public override bool CheckRequiredBosses(uint bossId, Player player = null) - { - if (_SkipCheckRequiredBosses(player)) - return true; - - switch (bossId) - { - case GDDataTypes.EckTheFerocious: - if (!instance.IsHeroic() || GetBossState(GDDataTypes.Moorabi) != EncounterState.Done) - return false; - break; - case GDDataTypes.GalDarah: - if (SladRanStatueState != GameObjectState.ActiveAlternative - || DrakkariColossusStatueState != GameObjectState.ActiveAlternative - || MoorabiStatueState != GameObjectState.ActiveAlternative) - return false; - break; - default: - break; - } - - return true; - } - - bool IsBridgeReady() - { - return SladRanStatueState == GameObjectState.Ready && DrakkariColossusStatueState == GameObjectState.Ready && MoorabiStatueState == GameObjectState.Ready; - } - - public override void SetData(uint type, uint data) - { - if (type == GDDataTypes.StatueActivate) - { - switch (data) - { - case GDGameObjectIds.SladRanAltar: - _events.ScheduleEvent(GDDataTypes.SladRanStatue, GDInstanceMisc.TimerStatueActivation); - break; - case GDGameObjectIds.DrakkariColossusAltar: - _events.ScheduleEvent(GDDataTypes.DrakkariColossusStatue, GDInstanceMisc.TimerStatueActivation); - break; - case GDGameObjectIds.MoorabiAltar: - _events.ScheduleEvent(GDDataTypes.MoorabiStatue, GDInstanceMisc.TimerStatueActivation); - break; - default: - break; - } - } - } - - public override void WriteSaveDataMore(StringBuilder data) - { - data.AppendFormat("{0} {1} {2} ", (uint)SladRanStatueState, (uint)DrakkariColossusStatueState, (uint)MoorabiStatueState); - } - - public override void ReadSaveDataMore(StringArguments data) - { - SladRanStatueState = (GameObjectState)data.NextUInt32(); - DrakkariColossusStatueState = (GameObjectState)data.NextUInt32(); - MoorabiStatueState = (GameObjectState)data.NextUInt32(); - - if (IsBridgeReady()) - _events.ScheduleEvent(GDDataTypes.Bridge, GDInstanceMisc.TimerStatueActivation); - } - - void ToggleGameObject(uint type, GameObjectState state) - { - GameObject go = GetGameObject(type); - if (go) - go.SetGoState(state); - - switch (type) - { - case GDDataTypes.SladRanStatue: - SladRanStatueState = state; - break; - case GDDataTypes.DrakkariColossusStatue: - DrakkariColossusStatueState = state; - break; - case GDDataTypes.MoorabiStatue: - MoorabiStatueState = state; - break; - default: - break; - } - } - - public override void Update(uint diff) - { - _events.Update(diff); - - _events.ExecuteEvents(eventId => - { - uint spellId = 0; - uint altarId = 0; - switch (eventId) - { - case GDDataTypes.SladRanStatue: - spellId = GDSpellIds.FireBeamSnake; - altarId = GDDataTypes.SladRanAltar; - break; - case GDDataTypes.DrakkariColossusStatue: - spellId = GDSpellIds.FireBeamElemental; - altarId = GDDataTypes.DrakkariColossusAltar; - break; - case GDDataTypes.MoorabiStatue: - spellId = GDSpellIds.FireBeamMammoth; - altarId = GDDataTypes.MoorabiAltar; - break; - case GDDataTypes.Bridge: - for (uint type = GDDataTypes.SladRanStatue; type <= GDDataTypes.GalDarahStatue; ++type) - ToggleGameObject(type, GameObjectState.ActiveAlternative); - ToggleGameObject(GDDataTypes.Trapdoor, GameObjectState.Ready); - ToggleGameObject(GDDataTypes.Collision, GameObjectState.Active); - SaveToDB(); - return; - default: - return; - } - - GameObject altar = GetGameObject(altarId); - if (altar) - { - Creature trigger = altar.FindNearestCreature(GDCreatureIds.AltarTrigger, 10.0f); - if (trigger) - trigger.CastSpell((Unit)null, spellId, true); - } - - // eventId equals statueId - ToggleGameObject(eventId, GameObjectState.Ready); - - if (IsBridgeReady()) - _events.ScheduleEvent(GDDataTypes.Bridge, GDInstanceMisc.TimerStatueActivation); - - SaveToDB(); - }); - } - - List DwellerGUIDs = new List(); - - GameObjectState SladRanStatueState; - GameObjectState DrakkariColossusStatueState; - GameObjectState MoorabiStatueState; - } - - public override InstanceScript GetInstanceScript(InstanceMap map) - { - return new instance_gundrak_InstanceMapScript(map); - } - } - - [Script] - class go_gundrak_altar : GameObjectScript - { - public go_gundrak_altar() : base("go_gundrak_altar") { } - - class go_gundrak_altarAI : GameObjectAI - { - public go_gundrak_altarAI(GameObject go) : base(go) - { - instance = go.GetInstanceScript(); - } - - public override bool GossipHello(Player player) - { - me.AddFlag(GameObjectFlags.NotSelectable); - me.SetGoState(GameObjectState.Active); - - instance.SetData(GDDataTypes.StatueActivate, me.GetEntry()); - return true; - } - - InstanceScript instance; - } - - public override GameObjectAI GetAI(GameObject go) - { - return GetInstanceAI(go); - } - } -} diff --git a/Source/Scripts/Northrend/IcecrownCitadel/GunshipBattle.cs b/Source/Scripts/Northrend/IcecrownCitadel/GunshipBattle.cs deleted file mode 100644 index b4790af69..000000000 --- a/Source/Scripts/Northrend/IcecrownCitadel/GunshipBattle.cs +++ /dev/null @@ -1,2180 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Framework.Dynamic; -using Framework.GameMath; -using Game; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Movement; -using Game.Networking.Packets; -using Game.Scripting; -using Game.Spells; -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Scripts.Northrend.IcecrownCitadel -{ - struct GunshipTexts - { - // High Overlord Saurfang - public const uint SaySaurfangIntro1 = 0; - public const uint SaySaurfangIntro2 = 1; - public const uint SaySaurfangIntro3 = 2; - public const uint SaySaurfangIntro4 = 3; - public const uint SaySaurfangIntro5 = 4; - public const uint SaySaurfangIntro6 = 5; - public const uint SaySaurfangIntroA = 6; - public const uint SaySaurfangBoard = 7; - public const uint SaySaurfangEnterSkybreaker = 8; - public const uint SaySaurfangAxethrowers = 9; - public const uint SaySaurfangRocketeers = 10; - public const uint SaySaurfangMages = 11; - public const byte SaySaurfangVictory = 12; - public const byte SaySaurfangWipe = 13; - - // Muradin Bronzebeard - public const uint SayMuradinIntro1 = 0; - public const uint SayMuradinIntro2 = 1; - public const uint SayMuradinIntro3 = 2; - public const uint SayMuradinIntro4 = 3; - public const uint SayMuradinIntro5 = 4; - public const uint SayMuradinIntro6 = 5; - public const uint SayMuradinIntro7 = 6; - public const uint SayMuradinIntroH = 7; - public const uint SayMuradinBoard = 8; - public const uint SayMuradinEnterOrgrimmsHammer = 9; - public const uint SayMuradinRifleman = 10; - public const uint SayMuradinMortar = 11; - public const uint SayMuradinSorcerers = 12; - public const byte SayMuradinVictory = 13; - public const byte SayMuradinWipe = 14; - - public const byte SayZafodRocketPackActive = 0; - public const byte SayZafodRocketPackDisabled = 1; - - public const byte SayOverheat = 0; - } - - struct GunshipEvents - { - // High Overlord Saurfang - public const uint IntroH1 = 1; - public const uint IntroH2 = 2; - public const uint IntroSummonSkybreaker = 3; - public const uint IntroH3 = 4; - public const uint IntroH4 = 5; - public const uint IntroH5 = 6; - public const uint IntroH6 = 7; - - // Muradin Bronzebeard - public const uint IntroA1 = 1; - public const uint IntroA2 = 2; - public const uint IntroSummonOrgrimsHammer = 3; - public const uint IntroA3 = 4; - public const uint IntroA4 = 5; - public const uint IntroA5 = 6; - public const uint IntroA6 = 7; - public const uint IntroA7 = 8; - - public const uint KeepPlayerInCombat = 9; - public const uint SummonMage = 10; - public const uint Adds = 11; - public const uint AddsBoardYell = 12; - public const uint CheckRifleman = 13; - public const uint CheckMortar = 14; - public const uint Cleave = 15; - - public const uint Bladestorm = 16; - public const uint WoundingStrike = 17; - } - - struct GunshipSpells - { - // Applied On Friendly Transport Npcs - public const uint FriendlyBossDamageMod = 70339; - public const uint CheckForPlayers = 70332; - public const uint GunshipFallTeleport = 67335; - public const uint TeleportPlayersOnResetA = 70446; - public const uint TeleportPlayersOnResetH = 71284; - public const uint TeleportPlayersOnVictory = 72340; - public const uint Achievement = 72959; - public const uint AwardReputationBossKill = 73843; - - // Murading Bronzebeard - // High Overlord Saurfang - public const uint BattleFury = 69637; - public const uint RendingThrow = 70309; - public const uint Cleave = 15284; - public const uint TasteOfBlood = 69634; - - // Applied On Enemy Npcs - public const uint MeleeTargetingOnSkybreaker = 70219; - public const uint MeleeTargetingOnOrgrimsHammer = 70294; - - // Gunship Hull - public const uint ExplosionWipe = 72134; - public const uint ExplosionVictory = 72137; - - // Hostile Npcs - public const uint TeleportToEnemyShip = 70104; - public const uint BattleExperience = 71201; - public const uint Experienced = 71188; - public const uint Veteran = 71193; - public const uint Elite = 71195; - public const uint AddsBerserk = 72525; - - // Skybreaker Sorcerer - // Kor'Kron Battle-Mage - public const uint ShadowChanneling = 43897; - public const uint BelowZero = 69705; - - // Skybreaker Rifleman - // Kor'Kron Axethrower - public const uint Shoot = 70162; - public const uint HurlAxe = 70161; - public const uint BurningPitchA = 70403; - public const uint BurningPitchH = 70397; - public const uint BurningPitch = 69660; - - // Skybreaker Mortar Soldier - // Kor'Kron Rocketeer - public const uint RocketArtilleryA = 70609; - public const uint RocketArtilleryH = 69678; - public const uint BurningPitchDamageA = 70383; - public const uint BurningPitchDamageH = 70374; - - // Skybreaker Marine - // Kor'Kron Reaver - public const uint DesperateResolve = 69647; - - // Skybreaker Sergeant - // Kor'Kron Sergeant - public const uint Bladestorm = 69652; - public const uint WoundingStrike = 69651; - - // - public const uint LockPlayersAndTapChest = 72347; - public const uint OnSkybreakerDeck = 70120; - public const uint OnOrgrimsHammerDeck = 70121; - - // Rocket Pack - public const uint RocketPackDamage = 69193; - public const uint RocketBurst = 69192; - public const uint RocketPackUseable = 70348; - - // Alliance Gunship Cannon - // Team.Horde Gunship Cannon - public const uint Overheat = 69487; - public const uint EjectAllPassengersBelowZero = 68576; - public const uint EjectAllPassengersWipe = 50630; - } - - struct GunshipMiscData - { - public const uint ItemGoblinRocketPack = 49278; - - public const byte PhaseCombat = 0; - public const byte PhaseIntro = 1; - - public const uint MusicEncounter = 17289; - - public static Position SkybreakerAddsSpawnPos = new Position(15.91131f, 0.0f, 20.4628f, MathFunctions.PI); - public static Position OrgrimsHammerAddsSpawnPos = new Position(60.728395f, 0.0f, 38.93467f, MathFunctions.PI); - - // Team.Horde encounter - public static Position SkybreakerTeleportPortal = new Position(6.666975f, 0.013001f, 20.87888f, 0.0f); - public static Position OrgrimsHammerTeleportExit = new Position(7.461699f, 0.158853f, 35.72989f, 0.0f); - - // Alliance encounter - public static Position OrgrimsHammerTeleportPortal = new Position(47.550990f, -0.101778f, 37.61111f, 0.0f); - public static Position SkybreakerTeleportExit = new Position(-17.55738f, -0.090421f, 21.18366f, 0.0f); - - public static SlotInfo[] SkybreakerSlotInfo = - { - new SlotInfo(CreatureIds.SkybreakerSorcerer, -9.479858f, 0.05663967f, 20.77026f, 4.729842f, 0 ), - - new SlotInfo(CreatureIds.SkybreakerSorcerer, 6.385986f, 4.978760f, 20.55417f, 4.694936f, 0 ), - new SlotInfo(CreatureIds.SkybreakerSorcerer, 6.579102f, -4.674561f, 20.55060f, 1.553343f, 0 ), - - new SlotInfo(CreatureIds.SkybreakerRifleman, -29.563900f, -17.95801f, 20.73837f, 4.747295f, 30 ), - new SlotInfo(CreatureIds.SkybreakerRifleman, -18.017210f, -18.82056f, 20.79150f, 4.747295f, 30 ), - new SlotInfo(CreatureIds.SkybreakerRifleman, -9.1193850f, -18.79102f, 20.58887f, 4.712389f, 30 ), - new SlotInfo(CreatureIds.SkybreakerRifleman, -0.3364258f, -18.87183f, 20.56824f, 4.712389f, 30 ), - - new SlotInfo(CreatureIds.SkybreakerRifleman, -34.705810f, -17.67261f, 20.51523f, 4.729842f, 30 ), - new SlotInfo(CreatureIds.SkybreakerRifleman, -23.562010f, -18.28564f, 20.67859f, 4.729842f, 30 ), - new SlotInfo(CreatureIds.SkybreakerRifleman, -13.602780f, -18.74268f, 20.59622f, 4.712389f, 30 ), - new SlotInfo(CreatureIds.SkybreakerRifleman, -4.3350220f, -18.84619f, 20.58234f, 4.712389f, 30 ), - - new SlotInfo(CreatureIds.SkybreakerMortarSoldier, -31.70142f, 18.02783f, 20.77197f, 4.712389f, 30 ), - new SlotInfo(CreatureIds.SkybreakerMortarSoldier, -9.368652f, 18.75806f, 20.65335f, 4.712389f, 30 ), - - new SlotInfo(CreatureIds.SkybreakerMortarSoldier, -20.40851f, 18.40381f, 20.50647f, 4.694936f, 30 ), - new SlotInfo(CreatureIds.SkybreakerMortarSoldier, 0.1585693f, 18.11523f, 20.41949f, 4.729842f, 30 ), - - new SlotInfo(CreatureIds.SkybreakerMarine, SkybreakerTeleportPortal, 0 ), - new SlotInfo(CreatureIds.SkybreakerMarine, SkybreakerTeleportPortal, 0 ), - - new SlotInfo(CreatureIds.SkybreakerMarine, SkybreakerTeleportPortal, 0 ), - new SlotInfo(CreatureIds.SkybreakerMarine, SkybreakerTeleportPortal, 0 ), - - new SlotInfo(CreatureIds.SkybreakerSergeant, SkybreakerTeleportPortal, 0 ), - - new SlotInfo(CreatureIds.SkybreakerSergeant, SkybreakerTeleportPortal, 0 ) - }; - public static SlotInfo[] OrgrimsHammerSlotInfo = - { - new SlotInfo(CreatureIds.KorKronBattleMage, 13.58548f, 0.3867192f, 34.99243f, 1.53589f, 0 ), - - new SlotInfo(CreatureIds.KorKronBattleMage, 47.29290f, -4.308941f, 37.55550f, 1.570796f, 0 ), - new SlotInfo(CreatureIds.KorKronBattleMage, 47.34621f, 4.032004f, 37.70952f, 4.817109f, 0 ), - - new SlotInfo(CreatureIds.KorKronAxeThrower, -12.09280f, 27.65942f, 33.58557f, 1.53589f, 30 ), - new SlotInfo(CreatureIds.KorKronAxeThrower, -3.170555f, 28.30652f, 34.21082f, 1.53589f, 30 ), - new SlotInfo(CreatureIds.KorKronAxeThrower, 14.928040f, 26.18018f, 35.47803f, 1.53589f, 30 ), - new SlotInfo(CreatureIds.KorKronAxeThrower, 24.703310f, 25.36584f, 35.97845f, 1.53589f, 30 ), - - new SlotInfo(CreatureIds.KorKronAxeThrower, -16.65302f, 27.59668f, 33.18726f, 1.53589f, 30 ), - new SlotInfo(CreatureIds.KorKronAxeThrower, -8.084572f, 28.21448f, 33.93805f, 1.53589f, 30 ), - new SlotInfo(CreatureIds.KorKronAxeThrower, 7.594765f, 27.41968f, 35.00775f, 1.53589f, 30 ), - new SlotInfo(CreatureIds.KorKronAxeThrower, 20.763390f, 25.58215f, 35.75287f, 1.53589f, 30 ), - - new SlotInfo(CreatureIds.KorKronRocketeer, -11.44849f, -25.71838f, 33.64343f, 1.518436f, 30 ), - new SlotInfo(CreatureIds.KorKronRocketeer, 12.30336f, -25.69653f, 35.32373f, 1.518436f, 30 ), - - new SlotInfo(CreatureIds.KorKronRocketeer, -0.05931854f, -25.46399f, 34.50592f, 1.518436f, 30 ), - new SlotInfo(CreatureIds.KorKronRocketeer, 27.62149000f, -23.48108f, 36.12708f, 1.518436f, 30 ), - - new SlotInfo(CreatureIds.KorKronReaver, OrgrimsHammerTeleportPortal, 0 ), - new SlotInfo(CreatureIds.KorKronReaver, OrgrimsHammerTeleportPortal, 0 ), - - new SlotInfo(CreatureIds.KorKronReaver, OrgrimsHammerTeleportPortal, 0 ), - new SlotInfo(CreatureIds.KorKronReaver, OrgrimsHammerTeleportPortal, 0 ), - - new SlotInfo(CreatureIds.KorKronSergeant, OrgrimsHammerTeleportPortal, 0 ), - - new SlotInfo(CreatureIds.KorKronSergeant, OrgrimsHammerTeleportPortal, 0 ) - }; - - public const uint MuradinExitPathSize = 10; - public static Vector3[] MuradinExitPath = - { - new Vector3(8.130936f, -0.2699585f, 20.31728f ), - new Vector3(6.380936f, -0.2699585f, 20.31728f ), - new Vector3(3.507703f, 0.02986573f, 20.78463f ), - new Vector3(-2.767633f, 3.743143f, 20.37663f ), - new Vector3(-4.017633f, 4.493143f, 20.12663f ), - new Vector3(-7.242224f, 6.856013f, 20.03468f ), - new Vector3(-7.742224f, 8.606013f, 20.78468f ), - new Vector3(-7.992224f, 9.856013f, 21.28468f ), - new Vector3(-12.24222f, 23.10601f, 21.28468f ), - new Vector3(-14.88477f, 25.20844f, 21.59985f ) - }; - - public const uint SaurfangExitPathSize = 13; - public static Vector3[] SaurfangExitPath = - { - new Vector3(30.43987f, 0.1475817f, 36.10674f ), - new Vector3(21.36141f, -3.056458f, 35.42970f ), - new Vector3(19.11141f, -3.806458f, 35.42970f ), - new Vector3(19.01736f, -3.299440f, 35.39428f ), - new Vector3(18.6747f, -5.862823f, 35.66611f ), - new Vector3(18.6747f, -7.862823f, 35.66611f ), - new Vector3(18.1747f, -17.36282f, 35.66611f ), - new Vector3(18.1747f, -22.61282f, 35.66611f ), - new Vector3(17.9247f, -24.36282f, 35.41611f ), - new Vector3(17.9247f, -26.61282f, 35.66611f ), - new Vector3(17.9247f, -27.86282f, 35.66611f ), - new Vector3(17.9247f, -29.36282f, 35.66611f ), - new Vector3(15.33203f, -30.42621f, 35.93796f ) - }; - } - - struct EncounterActions - { - public const int SpawnMage = 1; - public const int SpawnAllAdds = 2; - public const int ClearSlot = 3; - public const int SetSlot = 4; - public const int ShipVisits = 5; - } - - enum PassengerSlots - { - // Freezing The Cannons - FreezeMage = 0, - - // Channeling The Portal, Refilled With Adds That Board Player'S Ship - Mage1 = 1, - Mage2 = 2, - - // Rifleman - Rifleman1 = 3, - Rifleman2 = 4, - Rifleman3 = 5, - Rifleman4 = 6, - - // Additional Rifleman On 25 Man - Rifleman5 = 7, - Rifleman6 = 8, - Rifleman7 = 9, - Rifleman8 = 10, - - // Mortar - Mortar1 = 11, - Mortar2 = 12, - - // Additional Spawns On 25 Man - Mortar3 = 13, - Mortar4 = 14, - - // Marines - Marine1 = 15, - Marine2 = 16, - - // Additional Spawns On 25 Man - Marine3 = 17, - Marine4 = 18, - - // Sergeants - Sergeant1 = 19, - - // Additional Spawns On 25 Man - Sergeant2 = 20, - - Max - } - - class SlotInfo - { - public SlotInfo(uint _entry, float x, float y, float z, float o, uint _cooldown) - { - Entry = _entry; - TargetPosition = new Position(x, y, z, o); - Cooldown = _cooldown; - } - public SlotInfo(uint _entry, Position pos, uint _cooldown) - { - Entry = _entry; - TargetPosition = pos; - Cooldown = _cooldown; - } - - public uint Entry; - public Position TargetPosition; - public uint Cooldown; - } - - class PassengerController - { - public PassengerController() - { - ResetSlots(Team.Horde); - } - - public void SetTransport(Transport transport) { _transport = transport; } - - public void ResetSlots(Team team) - { - _transport = null; - _spawnPoint = team == Team.Horde ? GunshipMiscData.OrgrimsHammerAddsSpawnPos : GunshipMiscData.SkybreakerAddsSpawnPos; - _slotInfo = team == Team.Horde ? GunshipMiscData.OrgrimsHammerSlotInfo : GunshipMiscData.SkybreakerSlotInfo; - } - - public bool SummonCreatures(PassengerSlots first, PassengerSlots last) - { - if (!_transport) - return false; - - bool summoned = false; - long now = Time.UnixTime; - for (int i = (int)first; i <= (int)last; ++i) - { - if (_respawnCooldowns[i] > now) - continue; - - if (!_controlledSlots[i].IsEmpty()) - { - Creature current = ObjectAccessor.GetCreature(_transport, _controlledSlots[i]); - if (current && current.IsAlive()) - continue; - } - Creature passenger = _transport.SummonPassenger(_slotInfo[i].Entry, SelectSpawnPoint(), TempSummonType.CorpseTimedDespawn, null, 15000); - if (passenger) - { - _controlledSlots[i] = passenger.GetGUID(); - _respawnCooldowns[i] = 0L; - passenger.GetAI().SetData(EncounterActions.SetSlot, (uint)i); - summoned = true; - } - } - - return summoned; - } - - public void ClearSlot(PassengerSlots slot) - { - _controlledSlots[(int)slot].Clear(); - _respawnCooldowns[(int)slot] = Time.UnixTime + _slotInfo[(int)slot].Cooldown; - } - - public bool SlotsNeedRefill(PassengerSlots first, PassengerSlots last) - { - for (int i = (int)first; i <= (int)last; ++i) - if (_controlledSlots[i].IsEmpty()) - return true; - - return false; - } - - Position SelectSpawnPoint() - { - float angle = RandomHelper.FRand(-MathFunctions.PI * 0.5f, MathFunctions.PI * 0.5f); - return new Position(_spawnPoint.GetPositionX() + 2.0f * (float)Math.Cos(angle), _spawnPoint.GetPositionY() + 2.0f * (float)Math.Sin(angle), - _spawnPoint.GetPositionZ(), _spawnPoint.GetOrientation()); - } - - Transport _transport; - ObjectGuid[] _controlledSlots = new ObjectGuid[(int)PassengerSlots.Max]; - long[] _respawnCooldowns = new long[(int)PassengerSlots.Max]; - Position _spawnPoint; - SlotInfo[] _slotInfo; - } - - class DelayedMovementEvent : BasicEvent - { - public DelayedMovementEvent(Creature owner, Position dest) - { - _owner = owner; - _dest = dest; - } - - public override bool Execute(ulong e_time, uint p_time) - { - if (!_owner.IsAlive()) - return true; - - _owner.GetMotionMaster().MovePoint(EventId.ChargePrepath, _owner, false); - - MoveSplineInit init = new MoveSplineInit(_owner); - init.DisableTransportPathTransformations(); - init.MoveTo(_dest.GetPositionX(), _dest.GetPositionY(), _dest.GetPositionZ(), false); - init.Launch(); - - return true; - } - - Creature _owner; - Position _dest; - } - - class ResetEncounterEvent : BasicEvent - { - public ResetEncounterEvent(Unit caster, uint spellId, ObjectGuid otherTransport) - { - _caster = caster; - _spellId = spellId; - _otherTransport = otherTransport; - } - - public override bool Execute(ulong e_time, uint p_time) - { - _caster.CastSpell(_caster, _spellId, true); - _caster.GetTransport().AddObjectToRemoveList(); - - Transport go = Global.ObjAccessor.FindTransport(_otherTransport); - if (go) - go.AddObjectToRemoveList(); - - return true; - } - - Unit _caster; - uint _spellId; - ObjectGuid _otherTransport; - } - - class BattleExperienceEvent : BasicEvent - { - public BattleExperienceEvent(Creature creature) - { - _creature = creature; - _level = 0; - } - - public override bool Execute(ulong e_time, uint p_time) - { - if (!_creature.IsAlive()) - return true; - - _creature.RemoveAurasDueToSpell(ExperiencedSpells[_level]); - ++_level; - - _creature.CastSpell(_creature, ExperiencedSpells[_level], TriggerCastFlags.FullMask); - if (_level < (_creature.GetMap().IsHeroic() ? 4 : 3)) - { - _creature.m_Events.AddEvent(this, e_time + ExperiencedTimes[_level]); - return false; - } - - return true; - } - - Creature _creature; - int _level; - - public static uint[] ExperiencedSpells = { 0, GunshipSpells.Experienced, GunshipSpells.Veteran, GunshipSpells.Elite, GunshipSpells.AddsBerserk }; - public static uint[] ExperiencedTimes = { 100000, 70000, 60000, 90000, 0 }; - } - - class gunship_npc_AI : ScriptedAI - { - public gunship_npc_AI(Creature creature) : base(creature) - { - Instance = creature.GetInstanceScript(); - Slot = null; - Index = 0xFFFFFFFF; - - BurningPitchId = Instance.GetData(DataTypes.TeamInInstance) == (uint)Team.Horde ? GunshipSpells.BurningPitchA : GunshipSpells.BurningPitchH; - me.SetRegenerateHealth(false); - } - - public override void SetData(uint type, uint data) - { - if (type == EncounterActions.SetSlot && data < (int)PassengerSlots.Max) - { - SetSlotInfo(data); - - me.SetReactState(ReactStates.Passive); - - float x, y, z, o; - Slot.TargetPosition.GetPosition(out x, out y, out z, out o); - - me.SetTransportHomePosition(Slot.TargetPosition); - float hx = x, hy = y, hz = z, ho = o; - me.GetTransport().CalculatePassengerPosition(ref hx, ref hy, ref hz, ref ho); - me.SetHomePosition(hx, hy, hz, ho); - - me.GetMotionMaster().MovePoint(EventId.ChargePrepath, Slot.TargetPosition, false); - - MoveSplineInit init = new MoveSplineInit(me); - init.DisableTransportPathTransformations(); - init.MoveTo(x, y, z, false); - init.Launch(); - } - } - - public override void EnterEvadeMode(EvadeReason why) - { - if (!me.IsAlive() || !me.IsInCombat()) - return; - - me.GetThreatManager().ClearAllThreat(); - me.CombatStop(true); - me.GetMotionMaster().MoveTargetedHome(); - } - - public override void JustDied(Unit killer) - { - if (Slot != null) - { - Creature captain = me.FindNearestCreature(Instance.GetData(DataTypes.TeamInInstance) == (uint)Team.Horde ? CreatureIds.IGBMuradinBrozebeard : CreatureIds.IGBHighOverlordSaurfang, 200.0f); - if (captain) - captain.GetAI().SetData(EncounterActions.ClearSlot, Index); - } - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - if (type != MovementGeneratorType.Point) - return; - - if (id == EventId.ChargePrepath && Slot != null) - { - me.SetFacingTo(Slot.TargetPosition.GetOrientation()); - me.m_Events.AddEvent(new BattleExperienceEvent(me), me.m_Events.CalculateTime(BattleExperienceEvent.ExperiencedTimes[0])); - DoCast(me, GunshipSpells.BattleExperience, true); - me.SetReactState(ReactStates.Aggressive); - } - } - - public override bool CanAIAttack(Unit target) - { - if (Instance.GetBossState(Bosses.GunshipBattle) != EncounterState.InProgress) - return false; - - return target.HasAura(Instance.GetData(DataTypes.TeamInInstance) == (uint)Team.Horde ? GunshipSpells.OnOrgrimsHammerDeck : GunshipSpells.OnSkybreakerDeck); - } - - public void SetSlotInfo(uint index) - { - Index = index; - Slot = ((Instance.GetData(DataTypes.TeamInInstance) == (uint)Team.Horde ? GunshipMiscData.SkybreakerSlotInfo : GunshipMiscData.OrgrimsHammerSlotInfo)[Index]); - } - - public bool SelectVictim() - { - if (Instance.GetBossState(Bosses.GunshipBattle) != EncounterState.InProgress) - { - EnterEvadeMode(EvadeReason.Other); - return false; - } - - if (!me.HasReactState(ReactStates.Passive)) - { - Unit victim = me.SelectVictim(); - if (victim) - AttackStart(victim); - return me.GetVictim(); - } - else if (me.GetThreatManager().IsThreatListEmpty()) - { - EnterEvadeMode(EvadeReason.Other); - return false; - } - - return true; - } - - public void TriggerBurningPitch() - { - if (Instance.GetBossState(Bosses.GunshipBattle) == EncounterState.InProgress && - !me.HasUnitState(UnitState.Casting) && !me.HasReactState(ReactStates.Passive) && - !me.GetSpellHistory().HasCooldown(BurningPitchId)) - { - DoCastAOE(BurningPitchId, true); - me.GetSpellHistory().AddCooldown(BurningPitchId, 0, TimeSpan.FromMilliseconds(RandomHelper.URand(3000, 4000))); - } - } - - public InstanceScript Instance; - public SlotInfo Slot; - public uint Index; - public uint BurningPitchId; - } - - [Script] - class npc_gunship : NullCreatureAI - { - public npc_gunship(Creature creature) : base(creature) - { - _teamInInstance = (Team)creature.GetInstanceScript().GetData(DataTypes.TeamInInstance); - _summonedFirstMage = false; - _died = false; - - me.SetRegenerateHealth(false); - } - - public override void DamageTaken(Unit source, ref uint damage) - { - if (damage >= me.GetHealth()) - { - JustDied(null); - damage = (uint)me.GetHealth() - 1; - return; - } - - if (_summonedFirstMage) - return; - - if (me.GetTransport().GetEntry() != (_teamInInstance == Team.Horde ? GameObjectIds.TheSkybreaker_H : GameObjectIds.OrgrimsHammer_A)) - return; - - if (!me.HealthBelowPctDamaged(90, damage)) - return; - - _summonedFirstMage = true; - Creature captain = me.FindNearestCreature(_teamInInstance == Team.Horde ? CreatureIds.IGBMuradinBrozebeard : CreatureIds.IGBHighOverlordSaurfang, 100.0f); - if (captain) - captain.GetAI().DoAction(EncounterActions.SpawnMage); - } - - public override void JustDied(Unit killer) - { - if (_died) - return; - - _died = true; - - bool isVictory = me.GetTransport().GetEntry() == GameObjectIds.TheSkybreaker_H || me.GetTransport().GetEntry() == GameObjectIds.OrgrimsHammer_A; - InstanceScript instance = me.GetInstanceScript(); - instance.SetBossState(Bosses.GunshipBattle, isVictory ? EncounterState.Done : EncounterState.Fail); - Creature creature = me.FindNearestCreature(me.GetEntry() == CreatureIds.OrgrimsHammer ? CreatureIds.TheSkybreaker : CreatureIds.OrgrimsHammer, 200.0f); - if (creature) - { - instance.SendEncounterUnit(EncounterFrameType.Disengage, creature); - creature.RemoveAurasDueToSpell(GunshipSpells.CheckForPlayers); - } - - instance.SendEncounterUnit(EncounterFrameType.Disengage, me); - me.RemoveAurasDueToSpell(GunshipSpells.CheckForPlayers); - - me.GetMap().SetZoneMusic(AreaIds.IcecrownCitadel, 0); - List creatures = new List(); - me.GetCreatureListWithEntryInGrid(creatures, CreatureIds.MartyrStalkerIGBSaurfang, MapConst.SizeofGrids); - foreach (var stalker in creatures) - { - stalker.RemoveAllAuras(); - stalker.GetThreatManager().ClearAllThreat(); - stalker.CombatStop(true); - } - - uint explosionSpell = isVictory ? GunshipSpells.ExplosionVictory : GunshipSpells.ExplosionWipe; - creatures.Clear(); - me.GetCreatureListWithEntryInGrid(creatures, CreatureIds.GunshipHull, 200.0f); - foreach (var hull in creatures) - { - if (hull.GetTransport() != me.GetTransport()) - continue; - - hull.CastSpell(hull, explosionSpell, TriggerCastFlags.FullMask); - } - - creatures.Clear(); - me.GetCreatureListWithEntryInGrid(creatures, _teamInInstance == Team.Horde ? CreatureIds.HordeGunshipCannon : CreatureIds.AllianceGunshipCannon, 200.0f); - foreach (var cannon in creatures) - { - if (isVictory) - { - cannon.CastSpell(cannon, GunshipSpells.EjectAllPassengersBelowZero, TriggerCastFlags.FullMask); - cannon.RemoveVehicleKit(); - } - else - cannon.CastSpell(cannon, GunshipSpells.EjectAllPassengersWipe, TriggerCastFlags.FullMask); - } - - uint creatureEntry = CreatureIds.IGBMuradinBrozebeard; - byte textId = isVictory ? GunshipTexts.SayMuradinVictory : GunshipTexts.SayMuradinWipe; - if (_teamInInstance == Team.Horde) - { - creatureEntry = CreatureIds.IGBHighOverlordSaurfang; - textId = isVictory ? GunshipTexts.SaySaurfangVictory : GunshipTexts.SaySaurfangWipe; - } - creature = me.FindNearestCreature(creatureEntry, 100.0f); - if (creature) - creature.GetAI().Talk(textId); - - if (isVictory) - { - Transport go = Global.ObjAccessor.FindTransport(instance.GetGuidData(Bosses.GunshipBattle)); - if (go) - go.EnableMovement(true); - - me.GetTransport().EnableMovement(true); - Creature ship = me.FindNearestCreature(_teamInInstance == Team.Horde ? CreatureIds.OrgrimsHammer : CreatureIds.TheSkybreaker, 200.0f); - if (ship) - { - ship.CastSpell(ship, GunshipSpells.TeleportPlayersOnVictory, TriggerCastFlags.FullMask); - ship.CastSpell(ship, GunshipSpells.Achievement, TriggerCastFlags.FullMask); - ship.CastSpell(ship, GunshipSpells.AwardReputationBossKill, TriggerCastFlags.FullMask); - } - - creatures.Clear(); - me.GetCreatureListWithEntryInGrid(creatures, CreatureIds.SkybreakerMarine, 200.0f); - me.GetCreatureListWithEntryInGrid(creatures, CreatureIds.SkybreakerSergeant, 200.0f); - me.GetCreatureListWithEntryInGrid(creatures, CreatureIds.KorKronReaver, 200.0f); - me.GetCreatureListWithEntryInGrid(creatures, CreatureIds.KorKronSergeant, 200.0f); - foreach (var obj in creatures) - obj.DespawnOrUnsummon(1); - } - else - { - uint teleportSpellId = _teamInInstance == Team.Horde ? GunshipSpells.TeleportPlayersOnResetH : GunshipSpells.TeleportPlayersOnResetA; - me.m_Events.AddEvent(new ResetEncounterEvent(me, teleportSpellId, me.GetInstanceScript().GetGuidData(DataTypes.EnemyGunship)), - me.m_Events.CalculateTime(8000)); - } - - instance.SetBossState(Bosses.GunshipBattle, isVictory ? EncounterState.Done : EncounterState.Fail); - } - - public override void SetGUID(ObjectGuid guid, int id = 0) - { - if (id != EncounterActions.ShipVisits) - return; - - if (!_shipVisits.ContainsKey(guid)) - _shipVisits[guid] = 1; - else - ++_shipVisits[guid]; - } - - public override uint GetData(uint id) - { - if (id != EncounterActions.ShipVisits) - return 0; - - uint max = 0; - foreach (var count in _shipVisits.Values) - max = Math.Max(max, count); - - return max; - } - - Team _teamInInstance; - Dictionary _shipVisits = new Dictionary(); - bool _summonedFirstMage; - bool _died; - } - - [Script] - class npc_high_overlord_saurfang_igb : ScriptedAI - { - public npc_high_overlord_saurfang_igb(Creature creature) - : base(creature) - { - _instance = creature.GetInstanceScript(); - - _controller.ResetSlots(Team.Horde); - _controller.SetTransport(creature.GetTransport()); - me.SetRegenerateHealth(false); - me.m_CombatDistance = 70.0f; - } - - public override void InitializeAI() - { - base.InitializeAI(); - - _events.Reset(); - _firstMageCooldown = Time.UnixTime + 60; - _axethrowersYellCooldown = 0L; - _rocketeersYellCooldown = 0L; - } - - public override void EnterCombat(Unit target) - { - _events.SetPhase(GunshipMiscData.PhaseCombat); - DoCast(me, _instance.GetData(DataTypes.TeamInInstance) == (uint)Team.Horde ? GunshipSpells.FriendlyBossDamageMod : GunshipSpells.MeleeTargetingOnOrgrimsHammer, true); - DoCast(me, GunshipSpells.BattleFury, true); - _events.ScheduleEvent(GunshipEvents.Cleave, RandomHelper.URand(2000, 10000)); - } - - public override void EnterEvadeMode(EvadeReason why) - { - if (!me.IsAlive()) - return; - - me.GetThreatManager().ClearAllThreat(); - me.CombatStop(true); - me.GetMotionMaster().MoveTargetedHome(); - - Reset(); - } - - public override void DoAction(int action) - { - if (action == Actions.EnemyGunshipTalk) - { - Creature muradin = me.FindNearestCreature(CreatureIds.IGBMuradinBrozebeard, 100.0f); - if (muradin) - muradin.GetAI().DoAction(EncounterActions.SpawnAllAdds); - - Talk(GunshipTexts.SaySaurfangIntro5); - _events.ScheduleEvent(GunshipEvents.IntroH5, 4000); - _events.ScheduleEvent(GunshipEvents.IntroH6, 11000); - _events.ScheduleEvent(GunshipEvents.KeepPlayerInCombat, 1); - - _instance.SetBossState(Bosses.GunshipBattle, EncounterState.InProgress); - // Combat starts now - Creature skybreaker = me.FindNearestCreature(CreatureIds.TheSkybreaker, 100.0f); - if (skybreaker) - _instance.SendEncounterUnit(EncounterFrameType.Engage, skybreaker, 1); - - Creature orgrimsHammer = me.FindNearestCreature(CreatureIds.OrgrimsHammer, 100.0f); - if (orgrimsHammer) - { - _instance.SendEncounterUnit(EncounterFrameType.Engage, orgrimsHammer, 2); - orgrimsHammer.CastSpell(orgrimsHammer, GunshipSpells.CheckForPlayers, TriggerCastFlags.FullMask); - } - - me.GetMap().SetZoneMusic(AreaIds.IcecrownCitadel, GunshipMiscData.MusicEncounter); - } - else if (action == EncounterActions.SpawnMage) - { - long now = Time.UnixTime; - if (_firstMageCooldown > now) - _events.ScheduleEvent(GunshipEvents.SummonMage, (uint)(_firstMageCooldown - now) * Time.InMilliseconds); - else - _events.ScheduleEvent(GunshipEvents.SummonMage, 1); - } - else if (action == EncounterActions.SpawnAllAdds) - { - _events.ScheduleEvent(GunshipEvents.Adds, 12000); - _events.ScheduleEvent(GunshipEvents.CheckRifleman, 13000); - _events.ScheduleEvent(GunshipEvents.CheckMortar, 13000); - if (Is25ManRaid()) - _controller.SummonCreatures(PassengerSlots.Mage1, PassengerSlots.Mortar4); - else - { - _controller.SummonCreatures(PassengerSlots.Mage1, PassengerSlots.Mage2); - _controller.SummonCreatures(PassengerSlots.Mortar1, PassengerSlots.Mortar2); - _controller.SummonCreatures(PassengerSlots.Rifleman1, PassengerSlots.Rifleman4); - } - } - else if (action == Actions.ExitShip) - { - Position pos = new Position(GunshipMiscData.SaurfangExitPath[GunshipMiscData.SaurfangExitPathSize - 1].X, GunshipMiscData.SaurfangExitPath[GunshipMiscData.SaurfangExitPathSize - 1].Y, GunshipMiscData.SaurfangExitPath[GunshipMiscData.SaurfangExitPathSize - 1].Z); - me.GetMotionMaster().MovePoint(EventId.ChargePrepath, pos, false); - - var path = GunshipMiscData.SaurfangExitPath;//, SaurfangExitPath + SaurfangExitPathSize); - - MoveSplineInit init = new MoveSplineInit(me); - init.DisableTransportPathTransformations(); - init.MovebyPath(path, 0); - init.Launch(); - - me.DespawnOrUnsummon(18000); - } - } - - public override void SetData(uint type, uint data) - { - if (type == EncounterActions.ClearSlot) - { - _controller.ClearSlot((PassengerSlots)data); - if (data == (uint)PassengerSlots.FreezeMage) - _events.ScheduleEvent(GunshipEvents.SummonMage, RandomHelper.URand(30000, 33500)); - } - } - - public override bool GossipSelect(Player player, uint menuId, uint gossipListId) - { - me.RemoveNpcFlag(NPCFlags.Gossip); - me.GetTransport().EnableMovement(true); - _events.SetPhase(GunshipMiscData.PhaseIntro); - _events.ScheduleEvent(GunshipEvents.IntroH1, 5000, 0, GunshipMiscData.PhaseIntro); - _events.ScheduleEvent(GunshipEvents.IntroH2, 16000, 0, GunshipMiscData.PhaseIntro); - _events.ScheduleEvent(GunshipEvents.IntroSummonSkybreaker, 24600, 0, GunshipMiscData.PhaseIntro); - _events.ScheduleEvent(GunshipEvents.IntroH3, 29600, 0, GunshipMiscData.PhaseIntro); - _events.ScheduleEvent(GunshipEvents.IntroH4, 39200, 0, GunshipMiscData.PhaseIntro); - return false; - } - - public override void DamageTaken(Unit u, ref uint damage) - { - if (me.HealthBelowPctDamaged(65, damage) && !me.HasAura(GunshipSpells.TasteOfBlood)) - DoCast(me, GunshipSpells.TasteOfBlood, true); - - if (damage > me.GetHealth()) - damage = (uint)me.GetHealth() - 1; - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim() && !_events.IsInPhase(GunshipMiscData.PhaseIntro) && _instance.GetBossState(Bosses.GunshipBattle) != EncounterState.InProgress) - return; - - _events.Update(diff); - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case GunshipEvents.IntroH1: - Talk(GunshipTexts.SaySaurfangIntro1); - break; - case GunshipEvents.IntroH2: - Talk(GunshipTexts.SaySaurfangIntro2); - break; - case GunshipEvents.IntroSummonSkybreaker: - Global.TransportMgr.CreateTransport(GameObjectIds.TheSkybreaker_H, 0, me.GetMap()); - break; - case GunshipEvents.IntroH3: - Talk(GunshipTexts.SaySaurfangIntro3); - break; - case GunshipEvents.IntroH4: - Talk(GunshipTexts.SaySaurfangIntro4); - break; - case GunshipEvents.IntroH5: - Creature muradin = me.FindNearestCreature(CreatureIds.IGBMuradinBrozebeard, 100.0f); - if (muradin) - muradin.GetAI().Talk(GunshipTexts.SayMuradinIntroH); - break; - case GunshipEvents.IntroH6: - Talk(GunshipTexts.SaySaurfangIntro6); - break; - case GunshipEvents.KeepPlayerInCombat: - if (_instance.GetBossState(Bosses.GunshipBattle) == EncounterState.InProgress) - { - _instance.DoCastSpellOnPlayers(GunshipSpells.LockPlayersAndTapChest); - _events.ScheduleEvent(GunshipEvents.KeepPlayerInCombat, RandomHelper.URand(5000, 8000)); - } - break; - case GunshipEvents.SummonMage: - Talk(GunshipTexts.SaySaurfangMages); - _controller.SummonCreatures(PassengerSlots.FreezeMage, PassengerSlots.FreezeMage); - break; - case GunshipEvents.Adds: - Talk(GunshipTexts.SaySaurfangEnterSkybreaker); - _controller.SummonCreatures(PassengerSlots.Mage1, PassengerSlots.Mage2); - _controller.SummonCreatures(PassengerSlots.Marine1, Is25ManRaid() ? PassengerSlots.Marine4 : PassengerSlots.Marine2); - _controller.SummonCreatures(PassengerSlots.Sergeant1, Is25ManRaid() ? PassengerSlots.Sergeant2 : PassengerSlots.Sergeant1); - Transport orgrimsHammer = me.GetTransport(); - if (orgrimsHammer) - orgrimsHammer.SummonPassenger(CreatureIds.TeleportPortal, GunshipMiscData.OrgrimsHammerTeleportPortal, TempSummonType.TimedDespawn, null, 21000); - - Transport skybreaker = Global.ObjAccessor.FindTransport(_instance.GetGuidData(Bosses.GunshipBattle)); - if (skybreaker) - skybreaker.SummonPassenger(CreatureIds.TeleportExit, GunshipMiscData.SkybreakerTeleportExit, TempSummonType.TimedDespawn, null, 23000); - - _events.ScheduleEvent(GunshipEvents.AddsBoardYell, 6000); - _events.ScheduleEvent(GunshipEvents.Adds, 60000); - break; - case GunshipEvents.AddsBoardYell: - muradin = me.FindNearestCreature(CreatureIds.IGBMuradinBrozebeard, 200.0f); - if (muradin) - muradin.GetAI().Talk(GunshipTexts.SayMuradinBoard); - break; - case GunshipEvents.CheckRifleman: - if (_controller.SummonCreatures(PassengerSlots.Rifleman1, Is25ManRaid() ? PassengerSlots.Rifleman8 : PassengerSlots.Rifleman4)) - { - if (_axethrowersYellCooldown < Time.UnixTime) - { - Talk(GunshipTexts.SaySaurfangAxethrowers); - _axethrowersYellCooldown = Time.UnixTime + 5; - } - } - _events.ScheduleEvent(GunshipEvents.CheckRifleman, 1000); - break; - case GunshipEvents.CheckMortar: - if (_controller.SummonCreatures(PassengerSlots.Mortar1, Is25ManRaid() ? PassengerSlots.Mortar4 : PassengerSlots.Mortar2)) - { - if (_rocketeersYellCooldown < Time.UnixTime) - { - Talk(GunshipTexts.SaySaurfangRocketeers); - _rocketeersYellCooldown = Time.UnixTime + 5; - } - } - _events.ScheduleEvent(GunshipEvents.CheckMortar, 1000); - break; - case GunshipEvents.Cleave: - DoCastVictim(GunshipSpells.Cleave); - _events.ScheduleEvent(GunshipEvents.Cleave, RandomHelper.URand(2000, 10000)); - break; - default: - break; - } - }); - - if (me.IsWithinMeleeRange(me.GetVictim())) - DoMeleeAttackIfReady(); - else if (me.IsAttackReady()) - { - DoCastVictim(GunshipSpells.RendingThrow); - me.ResetAttackTimer(); - } - } - - public override bool CanAIAttack(Unit target) - { - return target.HasAura(GunshipSpells.OnOrgrimsHammerDeck) || !target.IsControlledByPlayer(); - } - - PassengerController _controller = new PassengerController(); - InstanceScript _instance; - long _firstMageCooldown; - long _axethrowersYellCooldown; - long _rocketeersYellCooldown; - } - - [Script] - class npc_muradin_bronzebeard_igb : ScriptedAI - { - public npc_muradin_bronzebeard_igb(Creature creature) - : base(creature) - { - _instance = creature.GetInstanceScript(); - - _controller.ResetSlots(Team.Alliance); - _controller.SetTransport(creature.GetTransport()); - me.SetRegenerateHealth(false); - me.m_CombatDistance = 70.0f; - } - - public override void InitializeAI() - { - base.InitializeAI(); - - _events.Reset(); - _firstMageCooldown = Time.UnixTime + 60; - _riflemanYellCooldown = 0L; - _mortarYellCooldown = 0L; - } - - public override void EnterCombat(Unit target) - { - _events.SetPhase(GunshipMiscData.PhaseCombat); - DoCast(me, _instance.GetData(DataTypes.TeamInInstance) == (uint)Team.Alliance ? GunshipSpells.FriendlyBossDamageMod : GunshipSpells.MeleeTargetingOnSkybreaker, true); - DoCast(me, GunshipSpells.BattleFury, true); - _events.ScheduleEvent(GunshipEvents.Cleave, RandomHelper.URand(2000, 10000)); - } - - public override void EnterEvadeMode(EvadeReason why) - { - if (!me.IsAlive()) - return; - - me.GetThreatManager().ClearAllThreat(); - me.CombatStop(true); - me.GetMotionMaster().MoveTargetedHome(); - - Reset(); - } - - public override void DoAction(int action) - { - if (action == Actions.EnemyGunshipTalk) - { - Creature muradin = me.FindNearestCreature(CreatureIds.IGBHighOverlordSaurfang, 100.0f); - if (muradin) - muradin.GetAI().DoAction(EncounterActions.SpawnAllAdds); - - Talk(GunshipTexts.SayMuradinIntro6); - _events.ScheduleEvent(GunshipEvents.IntroA6, 5000); - _events.ScheduleEvent(GunshipEvents.IntroA7, 11000); - _events.ScheduleEvent(GunshipEvents.KeepPlayerInCombat, 1); - - _instance.SetBossState(Bosses.GunshipBattle, EncounterState.InProgress); - // Combat starts now - Creature orgrimsHammer = me.FindNearestCreature(CreatureIds.OrgrimsHammer, 100.0f); - if (orgrimsHammer) - _instance.SendEncounterUnit(EncounterFrameType.Engage, orgrimsHammer, 1); - - Creature skybreaker = me.FindNearestCreature(CreatureIds.TheSkybreaker, 100.0f); - if (skybreaker) - { - _instance.SendEncounterUnit(EncounterFrameType.Engage, skybreaker, 2); - skybreaker.CastSpell(skybreaker, GunshipSpells.CheckForPlayers, TriggerCastFlags.FullMask); - } - - me.GetMap().SetZoneMusic(AreaIds.IcecrownCitadel, GunshipMiscData.MusicEncounter); - } - else if (action == EncounterActions.SpawnMage) - { - long now = Time.UnixTime; - if (_firstMageCooldown < now) - _events.ScheduleEvent(GunshipEvents.SummonMage, (uint)(now - _firstMageCooldown) * Time.InMilliseconds); - else - _events.ScheduleEvent(GunshipEvents.SummonMage, 1); - } - else if (action == EncounterActions.SpawnAllAdds) - { - _events.ScheduleEvent(GunshipEvents.Adds, 12000); - _events.ScheduleEvent(GunshipEvents.CheckRifleman, 13000); - _events.ScheduleEvent(GunshipEvents.CheckMortar, 13000); - if (Is25ManRaid()) - _controller.SummonCreatures(PassengerSlots.Mage1, PassengerSlots.Mortar4); - else - { - _controller.SummonCreatures(PassengerSlots.Mage1, PassengerSlots.Mage2); - _controller.SummonCreatures(PassengerSlots.Mortar1, PassengerSlots.Mortar2); - _controller.SummonCreatures(PassengerSlots.Rifleman1, PassengerSlots.Rifleman4); - } - } - } - - public override void SetData(uint type, uint data) - { - if (type == EncounterActions.ClearSlot) - { - _controller.ClearSlot((PassengerSlots)data); - if (data == (uint)PassengerSlots.FreezeMage) - _events.ScheduleEvent(GunshipEvents.SummonMage, RandomHelper.URand(30000, 33500)); - } - } - - public override bool GossipSelect(Player player, uint menuId, uint gossipListId) - { - me.RemoveNpcFlag(NPCFlags.Gossip); - me.GetTransport().EnableMovement(true); - _events.SetPhase(GunshipMiscData.PhaseIntro); - _events.ScheduleEvent(GunshipEvents.IntroA1, 5000); - _events.ScheduleEvent(GunshipEvents.IntroA2, 10000, 0, GunshipMiscData.PhaseIntro); - _events.ScheduleEvent(GunshipEvents.IntroSummonOrgrimsHammer, 28000, 0, GunshipMiscData.PhaseIntro); - _events.ScheduleEvent(GunshipEvents.IntroA3, 33000, 0, GunshipMiscData.PhaseIntro); - _events.ScheduleEvent(GunshipEvents.IntroA4, 39000, 0, GunshipMiscData.PhaseIntro); - _events.ScheduleEvent(GunshipEvents.IntroA5, 45000, 0, GunshipMiscData.PhaseIntro); - return false; - } - - public override void DamageTaken(Unit u, ref uint damage) - { - if (me.HealthBelowPctDamaged(65, damage) && me.HasAura(GunshipSpells.TasteOfBlood)) - DoCast(me, GunshipSpells.TasteOfBlood, true); - - if (damage >= me.GetHealth()) - damage = (uint)me.GetHealth() - 1; - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim() && !_events.IsInPhase(GunshipMiscData.PhaseIntro) && _instance.GetBossState(Bosses.GunshipBattle) != EncounterState.InProgress) - return; - - _events.Update(diff); - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case GunshipEvents.IntroA1: - Talk(GunshipTexts.SayMuradinIntro1); - break; - case GunshipEvents.IntroA2: - Talk(GunshipTexts.SayMuradinIntro2); - break; - case GunshipEvents.IntroSummonOrgrimsHammer: - Global.TransportMgr.CreateTransport(GameObjectIds.OrgrimsHammer_A, 0, me.GetMap()); - break; - case GunshipEvents.IntroA3: - Talk(GunshipTexts.SayMuradinIntro3); - break; - case GunshipEvents.IntroA4: - Talk(GunshipTexts.SayMuradinIntro4); - break; - case GunshipEvents.IntroA5: - Talk(GunshipTexts.SayMuradinIntro5); - break; - case GunshipEvents.IntroA6: - Creature saurfang = me.FindNearestCreature(CreatureIds.IGBHighOverlordSaurfang, 100.0f); - if (saurfang) - saurfang.GetAI().Talk(GunshipTexts.SaySaurfangIntroA); - break; - case GunshipEvents.IntroA7: - Talk(GunshipTexts.SayMuradinIntro7); - break; - case GunshipEvents.KeepPlayerInCombat: - if (_instance.GetBossState(Bosses.GunshipBattle) == EncounterState.InProgress) - { - _instance.DoCastSpellOnPlayers(GunshipSpells.LockPlayersAndTapChest); - _events.ScheduleEvent(GunshipEvents.KeepPlayerInCombat, RandomHelper.URand(5000, 8000)); - } - break; - case GunshipEvents.SummonMage: - Talk(GunshipTexts.SayMuradinSorcerers); - _controller.SummonCreatures(PassengerSlots.FreezeMage, PassengerSlots.FreezeMage); - break; - case GunshipEvents.Adds: - Talk(GunshipTexts.SayMuradinEnterOrgrimmsHammer); - _controller.SummonCreatures(PassengerSlots.Mage1, PassengerSlots.Mage2); - _controller.SummonCreatures(PassengerSlots.Marine1, Is25ManRaid() ? PassengerSlots.Marine4 : PassengerSlots.Marine2); - _controller.SummonCreatures(PassengerSlots.Sergeant1, Is25ManRaid() ? PassengerSlots.Sergeant2 : PassengerSlots.Sergeant1); - - Transport skybreaker = me.GetTransport(); - if (skybreaker) - skybreaker.SummonPassenger(CreatureIds.TeleportPortal, GunshipMiscData.SkybreakerTeleportPortal, TempSummonType.TimedDespawn, null, 21000); - - Transport go = Global.ObjAccessor.FindTransport(_instance.GetGuidData(Bosses.GunshipBattle)); - if (go) - go.SummonPassenger(CreatureIds.TeleportExit, GunshipMiscData.OrgrimsHammerTeleportExit, TempSummonType.TimedDespawn, null, 23000); - - _events.ScheduleEvent(GunshipEvents.AddsBoardYell, 6000); - _events.ScheduleEvent(GunshipEvents.Adds, 60000); - break; - case GunshipEvents.AddsBoardYell: - saurfang = me.FindNearestCreature(CreatureIds.IGBHighOverlordSaurfang, 200.0f); - if (saurfang) - saurfang.GetAI().Talk(GunshipTexts.SaySaurfangBoard); - break; - case GunshipEvents.CheckRifleman: - if (_controller.SummonCreatures(PassengerSlots.Rifleman1, Is25ManRaid() ? PassengerSlots.Rifleman8 : PassengerSlots.Rifleman4)) - { - if (_riflemanYellCooldown < Time.UnixTime) - { - Talk(GunshipTexts.SayMuradinRifleman); - _riflemanYellCooldown = Time.UnixTime + 5; - } - } - _events.ScheduleEvent(GunshipEvents.CheckRifleman, 1000); - break; - case GunshipEvents.CheckMortar: - if (_controller.SummonCreatures(PassengerSlots.Mortar1, Is25ManRaid() ? PassengerSlots.Mortar4 : PassengerSlots.Mortar2)) - { - if (_mortarYellCooldown < Time.UnixTime) - { - Talk(GunshipTexts.SayMuradinMortar); - _mortarYellCooldown = Time.UnixTime + 5; - } - } - _events.ScheduleEvent(GunshipEvents.CheckMortar, 1000); - break; - case GunshipEvents.Cleave: - DoCastVictim(GunshipSpells.Cleave); - _events.ScheduleEvent(GunshipEvents.Cleave, RandomHelper.URand(2000, 10000)); - break; - default: - break; - } - }); - - if (me.IsWithinMeleeRange(me.GetVictim())) - DoMeleeAttackIfReady(); - else if (me.IsAttackReady()) - { - DoCastVictim(GunshipSpells.RendingThrow); - me.ResetAttackTimer(); - } - } - - public override bool CanAIAttack(Unit target) - { - if (_instance.GetBossState(Bosses.GunshipBattle) != EncounterState.InProgress) - return false; - - return target.HasAura(GunshipSpells.OnSkybreakerDeck) || !target.IsControlledByPlayer(); - } - - PassengerController _controller = new PassengerController(); - InstanceScript _instance; - long _firstMageCooldown; - long _riflemanYellCooldown; - long _mortarYellCooldown; - } - - [Script] - class npc_zafod_boombox : gunship_npc_AI - { - public npc_zafod_boombox(Creature creature) - : base(creature) { } - - public override void Reset() - { - me.SetReactState(ReactStates.Passive); - } - - public override bool GossipSelect(Player player, uint menuId, uint gossipListId) - { - player.AddItem(GunshipMiscData.ItemGoblinRocketPack, 1); - player.PlayerTalkClass.SendCloseGossip(); - return false; - } - - public override void UpdateAI(uint diff) - { - UpdateVictim(); - } - } - - class npc_gunship_boarding_addAI : gunship_npc_AI - { - public npc_gunship_boarding_addAI(Creature creature) : base(creature) - { - me.m_CombatDistance = 80.0f; - _usedDesperateResolve = false; - } - - public override void SetData(uint type, uint data) - { - // detach from captain - if (type == EncounterActions.SetSlot) - { - SetSlotInfo(data); - - me.SetReactState(ReactStates.Passive); - - me.m_Events.AddEvent(new DelayedMovementEvent(me, Slot.TargetPosition), me.m_Events.CalculateTime(3000 * (Index - (int)PassengerSlots.Marine1))); - - Creature captain = me.FindNearestCreature(Instance.GetData(DataTypes.TeamInInstance) == (uint)Team.Horde ? CreatureIds.IGBMuradinBrozebeard : CreatureIds.IGBHighOverlordSaurfang, 200.0f); - if (captain) - captain.GetAI().SetData(EncounterActions.ClearSlot, Index); - } - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - if (type != MovementGeneratorType.Point) - return; - - if (id == EventId.ChargePrepath && Slot != null) - { - Position otherTransportPos = Instance.GetData(DataTypes.TeamInInstance) == (uint)Team.Horde ? GunshipMiscData.OrgrimsHammerTeleportExit : GunshipMiscData.SkybreakerTeleportExit; - float x, y, z, o; - otherTransportPos.GetPosition(out x, out y, out z, out o); - - Transport myTransport = me.GetTransport(); - if (!myTransport) - return; - - Transport destTransport = Global.ObjAccessor.FindTransport(Instance.GetGuidData(Bosses.GunshipBattle)); - if (destTransport) - destTransport.CalculatePassengerPosition(ref x, ref y, ref z, ref o); - - float angle = RandomHelper.URand(0, MathFunctions.PI * 2.0f); - x += 2.0f * (float)Math.Cos(angle); - y += 2.0f * (float)Math.Sin(angle); - - me.SetHomePosition(x, y, z, o); - myTransport.CalculatePassengerOffset(ref x, ref y, ref z, ref o); - me.SetTransportHomePosition(x, y, z, o); - - me.m_Events.AddEvent(new BattleExperienceEvent(me), me.m_Events.CalculateTime(BattleExperienceEvent.ExperiencedTimes[0])); - DoCast(me, GunshipSpells.BattleExperience, true); - DoCast(me, GunshipSpells.TeleportToEnemyShip, true); - DoCast(me, Instance.GetData(DataTypes.TeamInInstance) == (uint)Team.Horde ? GunshipSpells.MeleeTargetingOnOrgrimsHammer : GunshipSpells.MeleeTargetingOnSkybreaker, true); - me.GetSpellHistory().AddCooldown(BurningPitchId, 0, TimeSpan.FromSeconds(3)); - - List players = new List(); - var check = new UnitAuraCheck(true, Instance.GetData(DataTypes.TeamInInstance) == (uint)Team.Horde ? GunshipSpells.OnOrgrimsHammerDeck : GunshipSpells.OnSkybreakerDeck); - var searcher = new PlayerListSearcher(me, players, check); - Cell.VisitWorldObjects(me, searcher, 200.0f); - - players.RemoveAll(player => me._IsTargetAcceptable(player) || !me.CanStartAttack(player, true)); - - if (!players.Empty()) - { - players.Sort(new ObjectDistanceOrderPred(me)); - foreach (var pl in players) - AddThreat(pl, 1.0f); - - AttackStart(players.First()); - } - - me.SetReactState(ReactStates.Aggressive); - } - } - public override void DamageTaken(Unit attacker, ref uint damage) - { - if (_usedDesperateResolve) - return; - - if (!me.HealthBelowPctDamaged(25, damage)) - return; - - _usedDesperateResolve = true; - DoCast(me, GunshipSpells.DesperateResolve, true); - } - - public override void UpdateAI(uint diff) - { - if (!SelectVictim()) - { - TriggerBurningPitch(); - return; - } - - if (!HasAttackablePlayerNearby()) - TriggerBurningPitch(); - - DoMeleeAttackIfReady(); - } - - public override bool CanAIAttack(Unit target) - { - uint spellId = GunshipSpells.OnSkybreakerDeck; - uint creatureEntry = CreatureIds.IGBMuradinBrozebeard; - if (Instance.GetData(DataTypes.TeamInInstance) == (uint)Team.Horde) - { - spellId = GunshipSpells.OnOrgrimsHammerDeck; - creatureEntry = CreatureIds.IGBHighOverlordSaurfang; - } - - return target.HasAura(spellId) || target.GetEntry() == creatureEntry; - } - - public bool HasAttackablePlayerNearby() - { - List players = new List(); - var check = new UnitAuraCheck(true, Instance.GetData(DataTypes.TeamInInstance) == (uint)Team.Horde ? GunshipSpells.OnOrgrimsHammerDeck : GunshipSpells.OnSkybreakerDeck); - var searcher = new PlayerListSearcher(me, players, check); - Cell.VisitWorldObjects(me, searcher, 200.0f); - - players.RemoveAll(player => !me._IsTargetAcceptable(player) || !me.CanStartAttack(player, true)); - - return !players.Empty(); - } - - bool _usedDesperateResolve; - } - - [Script] - class npc_gunship_boarding_leader : npc_gunship_boarding_addAI - { - public npc_gunship_boarding_leader(Creature creature) - : base(creature) { } - - public override void EnterCombat(Unit target) - { - base.EnterCombat(target); - _events.ScheduleEvent(GunshipEvents.Bladestorm, RandomHelper.URand(13000, 18000)); - _events.ScheduleEvent(GunshipEvents.WoundingStrike, RandomHelper.URand(8000, 10000)); - } - - public override void UpdateAI(uint diff) - { - if (!SelectVictim()) - { - TriggerBurningPitch(); - return; - } - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting) || me.HasAura(GunshipSpells.Bladestorm)) - return; - - if (!HasAttackablePlayerNearby()) - TriggerBurningPitch(); - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case GunshipEvents.Bladestorm: - DoCastAOE(GunshipSpells.Bladestorm); - _events.ScheduleEvent(GunshipEvents.Bladestorm, RandomHelper.URand(25000, 30000)); - break; - case GunshipEvents.WoundingStrike: - DoCastVictim(GunshipSpells.WoundingStrike); - _events.ScheduleEvent(GunshipEvents.WoundingStrike, RandomHelper.URand(9000, 13000)); - break; - default: - break; - } - }); - - DoMeleeAttackIfReady(); - } - } - - [Script] - class npc_gunship_gunner : gunship_npc_AI - { - public npc_gunship_gunner(Creature creature) - : base(creature) - { - creature.m_CombatDistance = 200.0f; - } - - public override void AttackStart(Unit target) - { - me.Attack(target, false); - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - base.MovementInform(type, id); - if (type == MovementGeneratorType.Point && id == EventId.ChargePrepath) - me.SetControlled(true, UnitState.Root); - } - - public override void UpdateAI(uint diff) - { - if (!SelectVictim()) - { - TriggerBurningPitch(); - return; - } - - DoSpellAttackIfReady(me.GetEntry() == CreatureIds.SkybreakerRifleman ? GunshipSpells.Shoot : GunshipSpells.HurlAxe); - } - } - - [Script] - class npc_gunship_rocketeer : gunship_npc_AI - { - public npc_gunship_rocketeer(Creature creature) : base(creature) - { - creature.m_CombatDistance = 200.0f; - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - base.MovementInform(type, id); - if (type == MovementGeneratorType.Point && id == EventId.ChargePrepath) - me.SetControlled(true, UnitState.Root); - } - - public override void UpdateAI(uint diff) - { - if (!SelectVictim()) - return; - - if (me.HasUnitState(UnitState.Casting)) - return; - - uint spellId = me.GetEntry() == CreatureIds.SkybreakerMortarSoldier ? GunshipSpells.RocketArtilleryA : GunshipSpells.RocketArtilleryH; - if (me.GetSpellHistory().HasCooldown(spellId)) - return; - - DoCastAOE(spellId, true); - me.GetSpellHistory().AddCooldown(spellId, 0, TimeSpan.FromSeconds(9)); - } - } - - [Script] - class npc_gunship_mage : gunship_npc_AI - { - public npc_gunship_mage(Creature creature) : base(creature) - { - me.SetReactState(ReactStates.Passive); - } - - public override void EnterEvadeMode(EvadeReason why) { } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - if (type != MovementGeneratorType.Point) - return; - - if (id == EventId.ChargePrepath && Slot != null) - { - SlotInfo[] slots = Instance.GetData(DataTypes.TeamInInstance) == (uint)Team.Horde ? GunshipMiscData.SkybreakerSlotInfo : GunshipMiscData.OrgrimsHammerSlotInfo; - me.SetFacingTo(slots[Index].TargetPosition.GetOrientation()); - switch ((PassengerSlots)Index) - { - case PassengerSlots.FreezeMage: - DoCastAOE(GunshipSpells.BelowZero); - break; - case PassengerSlots.Mage1: - case PassengerSlots.Mage2: - DoCastAOE(GunshipSpells.ShadowChanneling); - break; - default: - break; - } - - me.SetControlled(true, UnitState.Root); - } - } - - public override void UpdateAI(uint diff) - { - UpdateVictim(); - } - - public override bool CanAIAttack(Unit target) - { - return true; - } - } - - /** @HACK This AI only resets MOVEMENTFLAG_ROOT on the vehicle. - Currently the core always removes MOVEMENTFLAG_ROOT sent from client packets to prevent cheaters from freezing clients of other players - but it actually is a valid flag - needs more research to fix both freezes and keep the flag as is (see WorldSession.ReadMovementInfo) - -Example packet: -ClientToServer: CMSG_FORCE_MOVE_ROOT_ACK (0x00E9) Length: 67 ConnectionIndex: 0 Time: 03/04/2010 03:57:55.000 Number: 471326 -Guid: -Movement Counter: 80 -Movement Flags: OnTransport, Root (2560) -Extra Movement Flags: None (0) -Time: 52291611 -Position: X: -396.0302 Y: 2482.906 Z: 249.86 -Orientation: 1.468665 -Transport GUID: Full: 0x1FC0000000000460 Type: MOTransport Low: 1120 -Transport Position: X: -6.152398 Y: -23.49037 Z: 21.64464 O: 4.827727 -Transport Time: 9926 -Transport Seat: 255 -Fall Time: 824 -*/ - [Script] - class npc_gunship_cannon : PassiveAI - { - public npc_gunship_cannon(Creature creature) - : base(creature) { } - - public override void OnCharmed(bool apply) { } - - public override void PassengerBoarded(Unit passenger, sbyte seat, bool apply) - { - if (!apply) - { - me.SetControlled(false, UnitState.Root); - me.SetControlled(true, UnitState.Root); - } - } - } - - [Script] - class spell_igb_rocket_pack : AuraScript - { - public override bool Validate(SpellInfo spellInfo) - { - return ValidateSpellInfo(GunshipSpells.RocketPackDamage, GunshipSpells.RocketBurst); - } - - void HandlePeriodic(AuraEffect aurEff) - { - if (GetTarget().MoveSpline.Finalized()) - Remove(AuraRemoveMode.Expire); - } - - void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode) - { - SpellInfo damageInfo = Global.SpellMgr.GetSpellInfo(GunshipSpells.RocketPackDamage, GetCastDifficulty()); - GetTarget().CastCustomSpell(GunshipSpells.RocketPackDamage, SpellValueMod.BasePoint0, (int)(2 * (damageInfo.GetEffect(0).CalcValue() + aurEff.GetTickNumber() * aurEff.GetPeriod())), null, TriggerCastFlags.FullMask); - GetTarget().CastSpell(null, GunshipSpells.RocketBurst, TriggerCastFlags.FullMask); - } - - public override void Register() - { - OnEffectPeriodic.Add(new EffectPeriodicHandler(HandlePeriodic, 0, AuraType.PeriodicDummy)); - OnEffectRemove.Add(new EffectApplyHandler(HandleRemove, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.Real)); - } - } - - [Script] - class spell_igb_rocket_pack_useable : AuraScript - { - public override bool Load() - { - return GetOwner().GetInstanceScript() != null; - } - - bool CheckAreaTarget(Unit target) - { - return target.IsTypeId(TypeId.Player) && GetOwner().GetInstanceScript().GetBossState(Bosses.GunshipBattle) != EncounterState.Done; - } - - void HandleApply(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Creature owner = GetOwner().ToCreature(); - if (owner) - { - Player target = GetTarget().ToPlayer(); - if (target) - if (target.HasItemCount(GunshipMiscData.ItemGoblinRocketPack, 1)) - Global.CreatureTextMgr.SendChat(owner, GunshipTexts.SayZafodRocketPackActive, target, ChatMsg.Addon, Language.Addon, CreatureTextRange.Normal, 0, Team.Other, false, target); - } - } - - void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Creature owner = GetOwner().ToCreature(); - if (owner) - { - Player target = GetTarget().ToPlayer(); - if (target) - if (target.HasItemCount(GunshipMiscData.ItemGoblinRocketPack, 1)) - Global.CreatureTextMgr.SendChat(owner, GunshipTexts.SayZafodRocketPackDisabled, target, ChatMsg.Addon, Language.Addon, CreatureTextRange.Normal, 0, Team.Other, false, target); - } - } - - public override void Register() - { - DoCheckAreaTarget.Add(new CheckAreaTargetHandler(CheckAreaTarget)); - AfterEffectApply.Add(new EffectApplyHandler(HandleApply, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); - AfterEffectRemove.Add(new EffectApplyHandler(HandleRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); - } - } - - [Script] - class spell_igb_on_gunship_deck : AuraScript - { - public override bool Load() - { - InstanceScript instance = GetOwner().GetInstanceScript(); - if (instance != null) - _teamInInstance = (Team)instance.GetData(DataTypes.TeamInInstance); - else - _teamInInstance = 0; - return true; - } - - bool CheckAreaTarget(Unit unit) - { - return unit.IsTypeId(TypeId.Player); - } - - void HandleApply(AuraEffect aurEff, AuraEffectHandleModes mode) - { - if (GetSpellInfo().Id == (_teamInInstance == Team.Horde ? GunshipSpells.OnSkybreakerDeck : GunshipSpells.OnOrgrimsHammerDeck)) - { - Creature gunship = GetOwner().FindNearestCreature(_teamInInstance == Team.Horde ? CreatureIds.OrgrimsHammer : CreatureIds.TheSkybreaker, 200.0f); - if (gunship) - gunship.GetAI().SetGUID(GetTarget().GetGUID(), EncounterActions.ShipVisits); - } - } - - public override void Register() - { - DoCheckAreaTarget.Add(new CheckAreaTargetHandler(CheckAreaTarget)); - AfterEffectApply.Add(new EffectApplyHandler(HandleApply, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); - } - - Team _teamInInstance; - } - - [Script] - class spell_igb_periodic_trigger_with_power_cost : AuraScript - { - void HandlePeriodicTick(AuraEffect aurEff) - { - PreventDefaultAction(); - GetTarget().CastSpell(GetTarget(), GetSpellInfo().GetEffect(0).TriggerSpell, (TriggerCastFlags.FullMask & ~TriggerCastFlags.IgnorePowerAndReagentCost)); - } - - public override void Register() - { - OnEffectPeriodic.Add(new EffectPeriodicHandler(HandlePeriodicTick, 0, AuraType.PeriodicTriggerSpell)); - } - } - - [Script] - class spell_igb_cannon_blast : SpellScript - { - public override bool Load() - { - return GetCaster().IsTypeId(TypeId.Unit); - } - - void CheckEnergy() - { - if (GetCaster().GetPower(PowerType.Energy) >= 100) - { - GetCaster().CastSpell(GetCaster(), GunshipSpells.Overheat, TriggerCastFlags.FullMask); - Vehicle vehicle = GetCaster().GetVehicleKit(); - if (vehicle) - { - Unit passenger = vehicle.GetPassenger(0); - if (passenger) - Global.CreatureTextMgr.SendChat(GetCaster().ToCreature(), GunshipTexts.SayOverheat, passenger); - } - } - } - - public override void Register() - { - AfterHit.Add(new HitHandler(CheckEnergy)); - } - } - - [Script] - class spell_igb_incinerating_blast : SpellScript - { - void StoreEnergy() - { - _energyLeft = (uint)GetCaster().GetPower(PowerType.Energy) - 10; - } - - void RemoveEnergy() - { - GetCaster().SetPower(PowerType.Energy, 0); - } - - void CalculateDamage(uint effIndex) - { - SetEffectValue((int)(GetEffectValue() + _energyLeft * _energyLeft * 8)); - } - - public override void Register() - { - OnCast.Add(new CastHandler(StoreEnergy)); - AfterCast.Add(new CastHandler(RemoveEnergy)); - OnEffectLaunchTarget.Add(new EffectHandler(CalculateDamage, 1, SpellEffectName.SchoolDamage)); - } - - uint _energyLeft; - } - - [Script] - class spell_igb_overheat : AuraScript - { - public override bool Load() - { - if (GetAura().GetAuraType() != AuraObjectType.Unit) - return false; - return GetUnitOwner().IsVehicle(); - } - - void SendClientControl(bool value) - { - Vehicle vehicle = GetUnitOwner().GetVehicleKit(); - if (vehicle) - { - Unit passenger = vehicle.GetPassenger(0); - if (passenger) - { - Player player = passenger.ToPlayer(); - if (player) - { - ControlUpdate data = new ControlUpdate(); - data.Guid = GetUnitOwner().GetGUID(); - data.On = value; - player.SendPacket(data); - } - } - } - } - - void HandleApply(AuraEffect aurEff, AuraEffectHandleModes mode) - { - SendClientControl(false); - } - - void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode) - { - SendClientControl(true); - } - - public override void Register() - { - AfterEffectApply.Add(new EffectApplyHandler(HandleApply, 0, AuraType.PeriodicTriggerSpell, AuraEffectHandleModes.Real)); - AfterEffectRemove.Add(new EffectApplyHandler(HandleRemove, 0, AuraType.PeriodicTriggerSpell, AuraEffectHandleModes.Real)); - } - } - - [Script] - class spell_igb_below_zero : SpellScript - { - void RemovePassengers(SpellMissInfo missInfo) - { - if (missInfo != SpellMissInfo.None) - return; - - GetHitUnit().CastSpell(GetHitUnit(), GunshipSpells.EjectAllPassengersBelowZero, TriggerCastFlags.FullMask); - } - - public override void Register() - { - BeforeHit.Add(new BeforeHitHandler(RemovePassengers)); - } - } - - [Script] - class spell_igb_teleport_to_enemy_ship : SpellScript - { - void RelocateTransportOffset(uint effIndex) - { - Position dest = GetHitDest(); - Unit target = GetHitUnit(); - if (dest == null || !target || !target.GetTransport()) - return; - - float x, y, z, o; - dest.GetPosition(out x, out y, out z, out o); - target.GetTransport().CalculatePassengerOffset(ref x, ref y, ref z, ref o); - target.m_movementInfo.transport.pos.Relocate(x, y, z, o); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(RelocateTransportOffset, 0, SpellEffectName.TeleportUnitsOld)); - } - } - - [Script] - class spell_igb_burning_pitch_selector : SpellScript - { - void FilterTargets(List targets) - { - Team team = Team.Horde; - InstanceScript instance = GetCaster().GetInstanceScript(); - if (instance != null) - team = (Team)instance.GetData(DataTypes.TeamInInstance); - - targets.RemoveAll(target => - { - Transport transport = target.GetTransport(); - if (transport) - return transport.GetEntry() != (team == Team.Horde ? GameObjectIds.OrgrimsHammer_H : GameObjectIds.TheSkybreaker_A); - return true; - }); - - if (!targets.Empty()) - { - WorldObject target = targets.SelectRandom(); - targets.Clear(); - targets.Add(target); - } - } - - void HandleDummy(uint effIndex) - { - PreventHitDefaultEffect(effIndex); - GetCaster().CastSpell(GetHitUnit(), (uint)GetEffectValue(), TriggerCastFlags.None); - } - - public override void Register() - { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEntry)); - OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); - } - } - - [Script] - class spell_igb_burning_pitch : SpellScript - { - void HandleDummy(uint effIndex) - { - PreventHitDefaultEffect(effIndex); - GetCaster().CastCustomSpell((uint)GetEffectValue(), SpellValueMod.BasePoint0, 8000, null, TriggerCastFlags.FullMask); - GetHitUnit().CastSpell(GetHitUnit(), GunshipSpells.BurningPitch, TriggerCastFlags.FullMask); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); - } - } - - [Script] - class spell_igb_rocket_artillery : SpellScript - { - void SelectRandomTarget(List targets) - { - if (!targets.Empty()) - { - WorldObject target = targets.SelectRandom(); - targets.Clear(); - targets.Add(target); - } - } - - void HandleScript(uint effIndex) - { - PreventHitDefaultEffect(effIndex); - GetCaster().CastSpell(GetHitUnit(), (uint)GetEffectValue(), TriggerCastFlags.None); - } - - public override void Register() - { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(SelectRandomTarget, 0, Targets.UnitSrcAreaEntry)); - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); - } - } - - [Script] - class spell_igb_rocket_artillery_explosion : SpellScript - { - void DamageGunship(uint effIndex) - { - InstanceScript instance = GetCaster().GetInstanceScript(); - if (instance != null) - GetCaster().CastCustomSpell(instance.GetData(DataTypes.TeamInInstance) == (uint)Team.Horde ? GunshipSpells.BurningPitchDamageH : GunshipSpells.BurningPitchDamageA, SpellValueMod.BasePoint0, 5000, null, TriggerCastFlags.FullMask); - } - - public override void Register() - { - OnEffectHit.Add(new EffectHandler(DamageGunship, 0, SpellEffectName.TriggerMissile)); - } - } - - [Script] - class spell_igb_gunship_fall_teleport : SpellScript - { - public override bool Load() - { - return GetCaster().GetInstanceScript() != null; - } - - void SelectTransport(ref WorldObject target) - { - InstanceScript instance = target.GetInstanceScript(); - if (instance != null) - target = Global.ObjAccessor.FindTransport(instance.GetGuidData(Bosses.GunshipBattle)); - } - - void RelocateDest(uint effIndex) - { - if (GetCaster().GetInstanceScript().GetData(DataTypes.TeamInInstance) == (uint)Team.Horde) - GetHitDest().RelocateOffset(new Position(0.0f, 0.0f, 36.0f, 0.0f)); - else - GetHitDest().RelocateOffset(new Position(0.0f, 0.0f, 21.0f, 0.0f)); - } - - public override void Register() - { - OnObjectTargetSelect.Add(new ObjectTargetSelectHandler(SelectTransport, 0, Targets.DestNearbyEntry)); - OnEffectLaunch.Add(new EffectHandler(RelocateDest, 0, SpellEffectName.TeleportUnitsOld)); - } - } - - [Script] - class spell_igb_check_for_players : SpellScript - { - public override bool Load() - { - _playerCount = 0; - return GetCaster().IsTypeId(TypeId.Unit); - } - - void CountTargets(List targets) - { - _playerCount = (uint)targets.Count; - } - - void TriggerWipe() - { - if (_playerCount == 0) - GetCaster().ToCreature().GetAI().JustDied(null); - } - - void TeleportPlayer(uint effIndex) - { - if (GetHitUnit().GetPositionZ() < GetCaster().GetPositionZ() - 10.0f) - GetHitUnit().CastSpell(GetHitUnit(), GunshipSpells.GunshipFallTeleport, TriggerCastFlags.FullMask); - } - - public override void Register() - { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(CountTargets, 0, Targets.UnitSrcAreaEntry)); - AfterCast.Add(new CastHandler(TriggerWipe)); - OnEffectHitTarget.Add(new EffectHandler(TeleportPlayer, 0, SpellEffectName.Dummy)); - } - - uint _playerCount; - } - - [Script] - class spell_igb_teleport_players_on_victory : SpellScript - { - public override bool Load() - { - return GetCaster().GetInstanceScript() != null; - } - - void FilterTargets(List targets) - { - InstanceScript instance = GetCaster().GetInstanceScript(); - targets.RemoveAll(target => target.GetTransGUID() != instance.GetGuidData(DataTypes.EnemyGunship)); - } - - public override void Register() - { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 1, Targets.UnitDestAreaEntry)); - } - } - - [Script] // 71201 - Battle Experience - proc should never happen, handled in script - class spell_igb_battle_experience_check : AuraScript - { - bool CheckProc(ProcEventInfo eventInfo) - { - return false; - } - - public override void Register() - { - DoCheckProc.Add(new CheckProcHandler(CheckProc)); - } - } - - [Script] - class achievement_im_on_a_boat : AchievementCriteriaScript - { - public achievement_im_on_a_boat() : base("achievement_im_on_a_boat") { } - - public override bool OnCheck(Player source, Unit target) - { - return target.GetAI() != null && target.GetAI().GetData(EncounterActions.ShipVisits) <= 2; - } - } -} diff --git a/Source/Scripts/Northrend/IcecrownCitadel/IcecrownCitadel.cs b/Source/Scripts/Northrend/IcecrownCitadel/IcecrownCitadel.cs deleted file mode 100644 index ae1b9dee4..000000000 --- a/Source/Scripts/Northrend/IcecrownCitadel/IcecrownCitadel.cs +++ /dev/null @@ -1,1754 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Framework.Dynamic; -using Game.AI; -using Game.DataStorage; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using Game.Spells; -using System.Collections.Generic; - -namespace Scripts.Northrend.IcecrownCitadel -{ - class FrostwingVrykulSearcher : ICheck where T : Unit - { - public FrostwingVrykulSearcher(Creature source, float range) - { - _source = source; - _range = range; - } - - public bool Invoke(T u) - { - if (!u.IsAlive()) - return false; - - switch (u.GetEntry()) - { - case CreatureIds.YmirjarBattleMaiden: - case CreatureIds.YmirjarDeathbringer: - case CreatureIds.YmirjarFrostbinder: - case CreatureIds.YmirjarHuntress: - case CreatureIds.YmirjarWarlord: - break; - default: - return false; - } - - if (!u.IsWithinDist(_source, _range, false)) - return false; - - return true; - } - - Creature _source; - float _range; - } - - class FrostwingGauntletRespawner : IDoWork - { - public void Invoke(Creature creature) - { - switch (creature.GetOriginalEntry()) - { - case CreatureIds.YmirjarBattleMaiden: - case CreatureIds.YmirjarDeathbringer: - case CreatureIds.YmirjarFrostbinder: - case CreatureIds.YmirjarHuntress: - case CreatureIds.YmirjarWarlord: - break; - case CreatureIds.CrokScourgebane: - case CreatureIds.CaptainArnath: - case CreatureIds.CaptainBrandon: - case CreatureIds.CaptainGrondel: - case CreatureIds.CaptainRupert: - creature.GetAI().DoAction(Actions.ResetEvent); - break; - case CreatureIds.SisterSvalna: - creature.GetAI().DoAction(Actions.ResetEvent); - // return, this creature is never dead if event is reset - return; - default: - return; - } - - uint corpseDelay = creature.GetCorpseDelay(); - uint respawnDelay = creature.GetRespawnDelay(); - creature.SetCorpseDelay(1); - creature.SetRespawnDelay(2); - - CreatureData data = creature.GetCreatureData(); - if (data != null) - creature.UpdatePosition(data.spawnPoint); - creature.DespawnOrUnsummon(); - - creature.SetCorpseDelay(corpseDelay); - creature.SetRespawnDelay(respawnDelay); - } - } - - class CaptainSurviveTalk : BasicEvent - { - public CaptainSurviveTalk(Creature owner) - { - _owner = owner; - } - - public override bool Execute(ulong currTime, uint diff) - { - _owner.GetAI().Talk(Texts.SayCaptainSurviveTalk); - return true; - } - - Creature _owner; - } - - // at Light's Hammer - [Script] - class npc_highlord_tirion_fordring_lh : ScriptedAI - { - public npc_highlord_tirion_fordring_lh(Creature creature) - : base(creature) - { - _instance = creature.GetInstanceScript(); - } - - public override void Reset() - { - _events.Reset(); - _theLichKing.Clear(); - _bolvarFordragon.Clear(); - _factionNPC.Clear(); - _damnedKills = 0; - } - - // IMPORTANT NOTE: This is triggered from per-GUID scripts - // of The Damned SAI - public override void SetData(uint type, uint data) - { - if (type == 1 && data == 1) - { - if (++_damnedKills == 2) - { - Creature theLichKing = me.FindNearestCreature(CreatureIds.TheLichKingLh, 150.0f); - if (theLichKing) - { - Creature bolvarFordragon = me.FindNearestCreature(CreatureIds.HighlordBolvarFordragonLh, 150.0f); - if (bolvarFordragon) - { - Creature factionNPC = me.FindNearestCreature(_instance.GetData(DataTypes.TeamInInstance) == (uint)Team.Horde ? CreatureIds.SeHighOverlordSaurfang : CreatureIds.SeMuradinBronzebeard, 50.0f); - if (factionNPC) - { - me.SetActive(true); - _theLichKing = theLichKing.GetGUID(); - theLichKing.SetActive(true); - _bolvarFordragon = bolvarFordragon.GetGUID(); - bolvarFordragon.SetActive(true); - _factionNPC = factionNPC.GetGUID(); - factionNPC.SetActive(true); - } - } - } - - if (_bolvarFordragon.IsEmpty() || _theLichKing.IsEmpty() || _factionNPC.IsEmpty()) - return; - - Talk(Texts.SayTirionIntro1); - _events.ScheduleEvent(EventTypes.TirionIntro2, 4000); - _events.ScheduleEvent(EventTypes.TirionIntro3, 14000); - _events.ScheduleEvent(EventTypes.TirionIntro4, 18000); - _events.ScheduleEvent(EventTypes.TirionIntro5, 31000); - _events.ScheduleEvent(EventTypes.LkIntro1, 35000); - _events.ScheduleEvent(EventTypes.TirionIntro6, 51000); - _events.ScheduleEvent(EventTypes.LkIntro2, 58000); - _events.ScheduleEvent(EventTypes.LkIntro3, 74000); - _events.ScheduleEvent(EventTypes.LkIntro4, 86000); - _events.ScheduleEvent(EventTypes.BolvarIntro1, 100000); - _events.ScheduleEvent(EventTypes.LkIntro5, 108000); - - if (_instance.GetData(DataTypes.TeamInInstance) == (uint)Team.Horde) - { - _events.ScheduleEvent(EventTypes.SaurfangIntro1, 120000); - _events.ScheduleEvent(EventTypes.TirionIntroH7, 129000); - _events.ScheduleEvent(EventTypes.SaurfangIntro2, 139000); - _events.ScheduleEvent(EventTypes.SaurfangIntro3, 150000); - _events.ScheduleEvent(EventTypes.SaurfangIntro4, 162000); - _events.ScheduleEvent(EventTypes.SaurfangRun, 170000); - } - else - { - _events.ScheduleEvent(EventTypes.MuradinIntro1, 120000); - _events.ScheduleEvent(EventTypes.MuradinIntro2, 124000); - _events.ScheduleEvent(EventTypes.MuradinIntro3, 127000); - _events.ScheduleEvent(EventTypes.TirionIntroA7, 136000); - _events.ScheduleEvent(EventTypes.MuradinIntro4, 144000); - _events.ScheduleEvent(EventTypes.MuradinIntro5, 151000); - _events.ScheduleEvent(EventTypes.MuradinRun, 157000); - } - } - } - } - - public override void UpdateAI(uint diff) - { - if (_damnedKills != 2) - return; - - _events.Update(diff); - - _events.ExecuteEvents(eventId => - { - Creature temp; - - switch (eventId) - { - case EventTypes.TirionIntro2: - me.HandleEmoteCommand(Emote.OneshotExclamation); - break; - case EventTypes.TirionIntro3: - Talk(Texts.SayTirionIntro2); - break; - case EventTypes.TirionIntro4: - me.HandleEmoteCommand(Emote.OneshotExclamation); - break; - case EventTypes.TirionIntro5: - Talk(Texts.SayTirionIntro3); - break; - case EventTypes.LkIntro1: - me.HandleEmoteCommand(Emote.StateDanceNosheathe); - temp = ObjectAccessor.GetCreature(me, _theLichKing); - if (temp) - temp.GetAI().Talk(Texts.SayLkIntro1); - break; - case EventTypes.TirionIntro6: - Talk(Texts.SayTirionIntro4); - break; - case EventTypes.LkIntro2: - temp = ObjectAccessor.GetCreature(me, _theLichKing); - if (temp) - temp.GetAI().Talk(Texts.SayLkIntro2); - break; - case EventTypes.LkIntro3: - temp = ObjectAccessor.GetCreature(me, _theLichKing); - if (temp) - temp.GetAI().Talk(Texts.SayLkIntro3); - break; - case EventTypes.LkIntro4: - temp = ObjectAccessor.GetCreature(me, _theLichKing); - if (temp) - temp.GetAI().Talk(Texts.SayLkIntro4); - break; - case EventTypes.BolvarIntro1: - temp = ObjectAccessor.GetCreature(me, _bolvarFordragon); - if (temp) - { - temp.GetAI().Talk(Texts.SayBolvarIntro1); - temp.SetActive(false); - } - break; - case EventTypes.LkIntro5: - temp = ObjectAccessor.GetCreature(me, _theLichKing); - if (temp) - { - temp.GetAI().Talk(Texts.SayLkIntro5); - temp.SetActive(false); - } - break; - case EventTypes.SaurfangIntro1: - temp = ObjectAccessor.GetCreature(me, _factionNPC); - if (temp) - temp.GetAI().Talk(Texts.SaySaurfangIntro1); - break; - case EventTypes.TirionIntroH7: - Talk(Texts.SayTirionIntroH5); - break; - case EventTypes.SaurfangIntro2: - temp = ObjectAccessor.GetCreature(me, _factionNPC); - if (temp) - temp.GetAI().Talk(Texts.SaySaurfangIntro2); - break; - case EventTypes.SaurfangIntro3: - temp = ObjectAccessor.GetCreature(me, _factionNPC); - if (temp) - temp.GetAI().Talk(Texts.SaySaurfangIntro3); - break; - case EventTypes.SaurfangIntro4: - temp = ObjectAccessor.GetCreature(me, _factionNPC); - if (temp) - temp.GetAI().Talk(Texts.SaySaurfangIntro4); - break; - case EventTypes.MuradinRun: - case EventTypes.SaurfangRun: - Creature factionNPC = ObjectAccessor.GetCreature(me, _factionNPC); - if (factionNPC) - factionNPC.GetMotionMaster().MovePath((uint)(factionNPC.GetSpawnId() * 10), false); - me.SetActive(false); - _damnedKills = 3; - break; - case EventTypes.MuradinIntro1: - temp = ObjectAccessor.GetCreature(me, _factionNPC); - if (temp) - temp.GetAI().Talk(Texts.SayMuradinIntro1); - break; - case EventTypes.MuradinIntro2: - temp = ObjectAccessor.GetCreature(me, _factionNPC); - if (temp) - temp.HandleEmoteCommand(Emote.OneshotTalk); - break; - case EventTypes.MuradinIntro3: - temp = ObjectAccessor.GetCreature(me, _factionNPC); - if (temp) - temp.HandleEmoteCommand(Emote.OneshotExclamation); - break; - case EventTypes.TirionIntroA7: - Talk(Texts.SayTirionIntroA5); - break; - case EventTypes.MuradinIntro4: - temp = ObjectAccessor.GetCreature(me, _factionNPC); - if (temp) - temp.GetAI().Talk(Texts.SayMuradinIntro2); - break; - case EventTypes.MuradinIntro5: - temp = ObjectAccessor.GetCreature(me, _factionNPC); - if (temp) - temp.GetAI().Talk(Texts.SayMuradinIntro3); - break; - default: - break; - } - }); - } - - InstanceScript _instance; - ObjectGuid _theLichKing; - ObjectGuid _bolvarFordragon; - ObjectGuid _factionNPC; - ushort _damnedKills; - } - - [Script] - class npc_rotting_frost_giant : ScriptedAI - { - public npc_rotting_frost_giant(Creature creature) - : base(creature) { } - - public override void Reset() - { - _events.Reset(); - _events.ScheduleEvent(EventTypes.DeathPlague, 15000); - _events.ScheduleEvent(EventTypes.Stomp, RandomHelper.URand(5000, 8000)); - _events.ScheduleEvent(EventTypes.ArcticBreath, RandomHelper.URand(10000, 15000)); - } - - public override void JustDied(Unit killer) - { - _events.Reset(); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case EventTypes.DeathPlague: - Unit target = SelectTarget(SelectAggroTarget.Random, 1, 0.0f, true); - if (target) - { - Talk(Texts.EmoteDeathPlagueWarning, target); - DoCast(target, InstanceSpells.DeathPlague); - } - _events.ScheduleEvent(EventTypes.DeathPlague, 15000); - break; - case EventTypes.Stomp: - DoCastVictim(InstanceSpells.Stomp); - _events.ScheduleEvent(EventTypes.Stomp, RandomHelper.URand(15000, 18000)); - break; - case EventTypes.ArcticBreath: - DoCastVictim(InstanceSpells.ArcticBreath); - _events.ScheduleEvent(EventTypes.ArcticBreath, RandomHelper.URand(26000, 33000)); - break; - default: - break; - } - }); - - DoMeleeAttackIfReady(); - } - } - - [Script] - class npc_frost_freeze_trap : ScriptedAI - { - public npc_frost_freeze_trap(Creature creature) - : base(creature) - { - SetCombatMovement(false); - } - - public override void DoAction(int action) - { - switch (action) - { - case 1000: - case 11000: - _events.ScheduleEvent(EventTypes.ActivateTrap, (uint)action); - break; - default: - break; - } - } - - public override void UpdateAI(uint diff) - { - _events.Update(diff); - - if (_events.ExecuteEvent() == EventTypes.ActivateTrap) - { - DoCast(me, InstanceSpells.ColdflameJets); - _events.ScheduleEvent(EventTypes.ActivateTrap, 22000); - } - } - } - - [Script] - class npc_alchemist_adrianna : CreatureScript - { - public npc_alchemist_adrianna() : base("npc_alchemist_adrianna") { } - - class npc_alchemist_adriannaAI : ScriptedAI - { - public npc_alchemist_adriannaAI(Creature creature) : base(creature) { } - - public override bool GossipHello(Player player) - { - if (!me.FindCurrentSpellBySpellId(InstanceSpells.HarvestBlightSpecimen) && !me.FindCurrentSpellBySpellId(InstanceSpells.HarvestBlightSpecimen25)) - if (player.HasAura(InstanceSpells.OrangeBlightResidue) && player.HasAura(InstanceSpells.GreenBlightResidue)) - DoCastSelf(InstanceSpells.HarvestBlightSpecimen, false); - return false; - } - } - - public override CreatureAI GetAI(Creature creature) - { - return new npc_alchemist_adriannaAI(creature); - } - } - - [Script] - class boss_sister_svalna : BossAI - { - public boss_sister_svalna(Creature creature) - : base(creature, Bosses.SisterSvalna) - { - _isEventInProgress = false; - - } - - public override void InitializeAI() - { - if (!me.IsDead()) - Reset(); - - me.SetReactState(ReactStates.Passive); - } - - public override void Reset() - { - _Reset(); - me.SetReactState(ReactStates.Defensive); - _isEventInProgress = false; - } - - public override void JustDied(Unit killer) - { - _JustDied(); - Talk(Texts.SaySvalnaDeath); - - ulong delay = 1; - for (uint i = 0; i < 4; ++i) - { - Creature crusader = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.CaptainArnath + i)); - if (crusader) - { - if (crusader.IsAlive() && crusader.GetEntry() == crusader.GetCreatureData().Id) - { - crusader.m_Events.AddEvent(new CaptainSurviveTalk(crusader), crusader.m_Events.CalculateTime(delay)); - delay += 6000; - } - } - } - } - - public override void EnterCombat(Unit attacker) - { - _EnterCombat(); - Creature crok = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.CrokScourgebane)); - if (crok) - crok.GetAI().Talk(Texts.SayCrokCombatSvalna); - DoCastSelf(InstanceSpells.DivineSurge, true); - _events.ScheduleEvent(EventTypes.SvalnaCombat, 9000); - _events.ScheduleEvent(EventTypes.ImpalingSpear, RandomHelper.URand(40000, 50000)); - _events.ScheduleEvent(EventTypes.AetherShield, RandomHelper.URand(100000, 110000)); - } - - public override void KilledUnit(Unit victim) - { - switch (victim.GetTypeId()) - { - case TypeId.Player: - Talk(Texts.SaySvalnaKill); - break; - case TypeId.Unit: - switch (victim.GetEntry()) - { - case CreatureIds.CaptainArnath: - case CreatureIds.CaptainBrandon: - case CreatureIds.CaptainGrondel: - case CreatureIds.CaptainRupert: - Talk(Texts.SaySvalnaKillCaptain); - break; - default: - break; - } - break; - default: - break; - } - } - - public override void JustReachedHome() - { - _JustReachedHome(); - me.SetReactState(ReactStates.Passive); - me.SetDisableGravity(false); - me.SetHover(false); - } - - public override void DoAction(int action) - { - switch (action) - { - case Actions.KillCaptain: - me.CastCustomSpell(InstanceSpells.CaressOfDeath, SpellValueMod.MaxTargets, 1, me, true); - break; - case Actions.StartGauntlet: - me.SetActive(true); - _isEventInProgress = true; - me.AddUnitFlag(UnitFlags.ImmuneToPc | UnitFlags.ImmuneToNpc); - _events.ScheduleEvent(EventTypes.SvalnaStart, 25000); - break; - case Actions.ResurrectCaptains: - _events.ScheduleEvent(EventTypes.SvalnaResurrect, 7000); - break; - case Actions.CaptainDies: - Talk(Texts.SaySvalnaCaptainDeath); - break; - case Actions.ResetEvent: - me.SetActive(false); - Reset(); - break; - default: - break; - } - } - - public override void SpellHit(Unit caster, SpellInfo spell) - { - if (spell.Id == InstanceSpells.HurlSpear && me.HasAura(InstanceSpells.AetherShield)) - { - me.RemoveAurasDueToSpell(InstanceSpells.AetherShield); - Talk(Texts.EmoteSvalnaBrokenShield, caster); - } - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - if (type != MovementGeneratorType.Effect || id != 1) - return; - - _isEventInProgress = false; - me.SetActive(false); - me.RemoveUnitFlag(UnitFlags.ImmuneToPc | UnitFlags.ImmuneToNpc); - me.SetDisableGravity(false); - me.SetHover(false); - } - - public override void SpellHitTarget(Unit target, SpellInfo spell) - { - switch (spell.Id) - { - case InstanceSpells.ImpalingSpearKill: - me.Kill(target); - break; - case InstanceSpells.ImpalingSpear: - TempSummon summon = target.SummonCreature(CreatureIds.ImpalingSpear, target); - if (summon) - { - Talk(Texts.EmoteSvalnaImpale, target); - summon.CastCustomSpell(SharedConst.VehicleSpellRideHardcoded, SpellValueMod.BasePoint0, 1, target, false); - summon.AddUnitFlag2(UnitFlags2.Unk1 | UnitFlags2.AllowEnemyInteract); - } - break; - default: - break; - } - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim() && !_isEventInProgress) - return; - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case EventTypes.SvalnaStart: - Talk(Texts.SaySvalnaEventStart); - break; - case EventTypes.SvalnaResurrect: - Talk(Texts.SaySvalnaResurrectCaptains); - me.CastSpell(me, InstanceSpells.ReviveChampion, false); - break; - case EventTypes.SvalnaCombat: - me.SetReactState(ReactStates.Defensive); - Talk(Texts.SaySvalnaAggro); - break; - case EventTypes.ImpalingSpear: - Unit target = SelectTarget(SelectAggroTarget.Random, 1, 0.0f, true, true, -(int)InstanceSpells.ImpalingSpear); - if (target) - { - DoCast(me, InstanceSpells.AetherShield); - DoCast(target, InstanceSpells.ImpalingSpear); - } - _events.ScheduleEvent(EventTypes.ImpalingSpear, RandomHelper.URand(20000, 25000)); - break; - default: - break; - } - }); - - DoMeleeAttackIfReady(); - } - - bool _isEventInProgress; - } - - [Script] - class npc_crok_scourgebane : EscortAI - { - public npc_crok_scourgebane(Creature creature) : base(creature) - { - _instance = creature.GetInstanceScript(); - _respawnTime = creature.GetRespawnDelay(); - _corpseDelay = creature.GetCorpseDelay(); - - SetDespawnAtEnd(false); - SetDespawnAtFar(false); - _isEventActive = false; - _isEventDone = _instance.GetBossState(Bosses.SisterSvalna) == EncounterState.Done; - _didUnderTenPercentText = false; - } - - public override void Reset() - { - _events.Reset(); - _events.ScheduleEvent(EventTypes.ScourgeStrike, RandomHelper.URand(7500, 12500)); - _events.ScheduleEvent(EventTypes.DeathStrike, RandomHelper.URand(25000, 30000)); - me.SetReactState(ReactStates.Defensive); - _didUnderTenPercentText = false; - _wipeCheckTimer = 1000; - } - - public override void DoAction(int action) - { - if (action == Actions.StartGauntlet) - { - if (_isEventDone || !me.IsAlive()) - return; - - _isEventActive = true; - _isEventDone = true; - // Load Grid with Sister Svalna - me.GetMap().LoadGrid(4356.71f, 2484.33f); - Creature svalna = ObjectAccessor.GetCreature(me, _instance.GetGuidData(Bosses.SisterSvalna)); - if (svalna) - svalna.GetAI().DoAction(Actions.StartGauntlet); - Talk(Texts.SayCrokIntro1); - _events.ScheduleEvent(EventTypes.ArnathIntro2, 7000); - _events.ScheduleEvent(EventTypes.CrokIntro3, 14000); - _events.ScheduleEvent(EventTypes.StartPathing, 37000); - me.SetActive(true); - for (uint i = 0; i < 4; ++i) - { - Creature crusader = ObjectAccessor.GetCreature(me, _instance.GetGuidData(DataTypes.CaptainArnath + i)); - if (crusader) - crusader.GetAI().DoAction(Actions.StartGauntlet); - } - } - else if (action == Actions.ResetEvent) - { - _isEventActive = false; - _isEventDone = _instance.GetBossState(Bosses.SisterSvalna) == EncounterState.Done; - me.SetActive(false); - _aliveTrash.Clear(); - _currentWPid = 0; - } - } - - public override void SetGUID(ObjectGuid guid, int type = 0) - { - if (type == Actions.VrykulDeath) - { - _aliveTrash.Remove(guid); - if (_aliveTrash.Empty()) - { - SetEscortPaused(false); - if (_currentWPid == 4 && _isEventActive) - { - _isEventActive = false; - me.SetActive(false); - Talk(Texts.SayCrokFinalWp); - Creature svalna = ObjectAccessor.GetCreature(me, _instance.GetGuidData(Bosses.SisterSvalna)); - if (svalna) - svalna.GetAI().DoAction(Actions.ResurrectCaptains); - } - } - } - } - - public override void WaypointReached(uint waypointId, uint pathId) - { - switch (waypointId) - { - // pause pathing until trash pack is cleared - case 0: - me.RemoveUnitFlag(UnitFlags.ImmuneToNpc); - Talk(Texts.SayCrokCombatWp0); - if (!_aliveTrash.Empty()) - SetEscortPaused(true); - break; - case 1: - Talk(Texts.SayCrokCombatWp1); - if (!_aliveTrash.Empty()) - SetEscortPaused(true); - break; - case 4: - if (_aliveTrash.Empty() && _isEventActive) - { - _isEventActive = false; - me.SetActive(false); - Talk(Texts.SayCrokFinalWp); - Creature svalna = ObjectAccessor.GetCreature(me, _instance.GetGuidData(Bosses.SisterSvalna)); - if (svalna) - svalna.GetAI().DoAction(Actions.ResurrectCaptains); - } - break; - default: - break; - } - } - - public override void WaypointStarted(uint waypointId, uint pathId) - { - _currentWPid = waypointId; - switch (waypointId) - { - case 0: - case 1: - case 4: - { - // get spawns by home position - float minY = 2600.0f; - float maxY = 2650.0f; - if (waypointId == 1) - { - minY -= 50.0f; - maxY -= 50.0f; - // at waypoints 1 and 2 she kills one captain - Creature svalna = ObjectAccessor.GetCreature(me, _instance.GetGuidData(Bosses.SisterSvalna)); - if (svalna) - svalna.GetAI().DoAction(Actions.KillCaptain); - } - else if (waypointId == 4) - { - minY -= 100.0f; - maxY -= 100.0f; - } - - // get all nearby vrykul - List temp = new List(); - var check = new FrostwingVrykulSearcher(me, 80.0f); - var searcher = new CreatureListSearcher(me, temp, check); - Cell.VisitGridObjects(me, searcher, 80.0f); - - _aliveTrash.Clear(); - foreach (var creature in temp) - if (creature.GetHomePosition().GetPositionY() < maxY && creature.GetHomePosition().GetPositionY() > minY) - _aliveTrash.Add(creature.GetGUID()); - break; - } - // at waypoints 1 and 2 she kills one captain - case 2: - Creature svalna1 = ObjectAccessor.GetCreature(me, _instance.GetGuidData(Bosses.SisterSvalna)); - if (svalna1) - svalna1.GetAI().DoAction(Actions.KillCaptain); - break; - default: - break; - } - } - - public override void DamageTaken(Unit attacker, ref uint damage) - { - // check wipe - if (_wipeCheckTimer == 0) - { - _wipeCheckTimer = 1000; - var check = new AnyPlayerInObjectRangeCheck(me, 60.0f); - var searcher = new PlayerSearcher(me, check); - Cell.VisitWorldObjects(me, searcher, 60.0f); - // wipe - if (!searcher.GetTarget()) - { - damage *= 100; - if (damage >= me.GetHealth()) - { - FrostwingGauntletRespawner respawner = new FrostwingGauntletRespawner(); - var worker = new CreatureWorker(me, respawner); - Cell.VisitGridObjects(me, worker, 333.0f); - Talk(Texts.SayCrokDeath); - } - return; - } - } - - if (HealthBelowPct(10)) - { - if (!_didUnderTenPercentText) - { - _didUnderTenPercentText = true; - if (_isEventActive) - Talk(Texts.SayCrokWeakeningGauntlet); - else - Talk(Texts.SayCrokWeakeningSvalna); - } - - damage = 0; - DoCast(me, InstanceSpells.IceboundArmor); - _events.ScheduleEvent(EventTypes.HealthCheck, 1000); - } - } - - public override void UpdateEscortAI(uint diff) - { - if (_wipeCheckTimer <= diff) - _wipeCheckTimer = 0; - else - _wipeCheckTimer -= diff; - - if (!UpdateVictim() && !_isEventActive) - return; - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case EventTypes.ArnathIntro2: - Creature arnath = ObjectAccessor.GetCreature(me, _instance.GetGuidData(DataTypes.CaptainArnath)); - if (arnath) - arnath.GetAI().Talk(Texts.SayArnathIntro2); - break; - case EventTypes.CrokIntro3: - Talk(Texts.SayCrokIntro3); - break; - case EventTypes.StartPathing: - Start(true, true); - break; - case EventTypes.ScourgeStrike: - DoCastVictim(InstanceSpells.ScourgeStrike); - _events.ScheduleEvent(EventTypes.ScourgeStrike, RandomHelper.URand(10000, 14000)); - break; - case EventTypes.DeathStrike: - if (HealthBelowPct(20)) - DoCastVictim(InstanceSpells.DeathStrike); - _events.ScheduleEvent(EventTypes.DeathStrike, RandomHelper.URand(5000, 10000)); - break; - case EventTypes.HealthCheck: - if (HealthAbovePct(15)) - { - me.RemoveAurasDueToSpell(InstanceSpells.IceboundArmor); - _didUnderTenPercentText = false; - } - else - { - // looks totally hacky to me - me.ModifyHealth((long)me.CountPctFromMaxHealth(5)); - _events.ScheduleEvent(EventTypes.HealthCheck, 1000); - } - break; - default: - break; - } - }); - - DoMeleeAttackIfReady(); - } - - public override bool CanAIAttack(Unit target) - { - // do not see targets inside Frostwing Halls when we are not there - return (me.GetPositionY() > 2660.0f) == (target.GetPositionY() > 2660.0f); - } - - List _aliveTrash = new List(); - InstanceScript _instance; - uint _currentWPid; - uint _wipeCheckTimer; - uint _respawnTime; - uint _corpseDelay; - bool _isEventActive; - bool _isEventDone; - bool _didUnderTenPercentText; - } - - class npc_argent_captainAI : ScriptedAI - { - public npc_argent_captainAI(Creature creature) : base(creature) - { - instance = creature.GetInstanceScript(); - _firstDeath = true; - FollowAngle = SharedConst.PetFollowAngle; - FollowDist = SharedConst.PetFollowDist; - IsUndead = false; - } - - public override void JustDied(Unit killer) - { - if (_firstDeath) - { - _firstDeath = false; - Talk(Texts.SayCaptainDeath); - } - else - Talk(Texts.SayCaptainSecondDeath); - } - - public override void KilledUnit(Unit victim) - { - if (victim.IsTypeId(TypeId.Player)) - Talk(Texts.SayCaptainKill); - } - - public override void DoAction(int action) - { - if (action == Actions.StartGauntlet) - { - Creature crok = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.CrokScourgebane)); - if (crok) - { - me.SetReactState(ReactStates.Defensive); - FollowAngle = me.GetAngle(crok) + me.GetOrientation(); - FollowDist = me.GetDistance2d(crok); - me.GetMotionMaster().MoveFollow(crok, FollowDist, FollowAngle, MovementSlot.Idle); - } - - me.SetActive(true); - } - else if (action == Actions.ResetEvent) - { - _firstDeath = true; - } - } - - public override void EnterCombat(Unit target) - { - me.SetHomePosition(me); - if (IsUndead) - DoZoneInCombat(); - } - - public override bool CanAIAttack(Unit target) - { - // do not see targets inside Frostwing Halls when we are not there - return (me.GetPositionY() > 2660.0f) == (target.GetPositionY() > 2660.0f); - } - - public override void EnterEvadeMode(EvadeReason why) - { - // not yet following - if (me.GetMotionMaster().GetMotionSlotType((int)MovementSlot.Idle) != MovementGeneratorType.Chase || IsUndead) - { - base.EnterEvadeMode(why); - return; - } - - if (!_EnterEvadeMode(why)) - return; - - if (!me.GetVehicle()) - { - me.GetMotionMaster().Clear(false); - Creature crok = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.CrokScourgebane)); - if (crok) - me.GetMotionMaster().MoveFollow(crok, FollowDist, FollowAngle, MovementSlot.Idle); - } - - Reset(); - } - - public override void SpellHit(Unit caster, SpellInfo spell) - { - if (spell.Id == InstanceSpells.ReviveChampion && !IsUndead) - { - IsUndead = true; - me.SetDeathState(DeathState.JustRespawned); - uint newEntry; - switch (me.GetEntry()) - { - case CreatureIds.CaptainArnath: - newEntry = CreatureIds.CaptainArnathUndead; - break; - case CreatureIds.CaptainBrandon: - newEntry = CreatureIds.CaptainBrandonUndead; - break; - case CreatureIds.CaptainGrondel: - newEntry = CreatureIds.CaptainGrondelUndead; - break; - case CreatureIds.CaptainRupert: - newEntry = CreatureIds.CaptainRupertUndead; - break; - default: - return; - } - - Talk(Texts.SayCaptainResurrected); - me.UpdateEntry(newEntry, me.GetCreatureData()); - DoCast(me, InstanceSpells.Undeath, true); - } - } - - InstanceScript instance; - float FollowAngle; - float FollowDist; - public bool IsUndead; - bool _firstDeath; - } - - [Script] - class npc_captain_arnath : npc_argent_captainAI - { - public npc_captain_arnath(Creature creature) - : base(creature) { } - - public override void Reset() - { - _events.Reset(); - _events.ScheduleEvent(EventTypes.ArnathFlashHeal, RandomHelper.URand(4000, 7000)); - _events.ScheduleEvent(EventTypes.ArnathPwShield, RandomHelper.URand(8000, 14000)); - _events.ScheduleEvent(EventTypes.ArnathSmite, RandomHelper.URand(3000, 6000)); - if (Is25ManRaid() && IsUndead) - _events.ScheduleEvent(EventTypes.ArnathDominateMind, RandomHelper.URand(22000, 27000)); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case EventTypes.ArnathFlashHeal: - { - Creature target = FindFriendlyCreature(); - if (target) - DoCast(target, InstanceSpells.SpellFlashHeal(IsUndead)); - _events.ScheduleEvent(EventTypes.ArnathFlashHeal, RandomHelper.URand(6000, 9000)); - } - break; - case EventTypes.ArnathPwShield: - { - List targets = DoFindFriendlyMissingBuff(40.0f, InstanceSpells.SpellPowerWordShield(IsUndead)); - DoCast(targets.SelectRandom(), InstanceSpells.SpellPowerWordShield(IsUndead)); - _events.ScheduleEvent(EventTypes.ArnathPwShield, RandomHelper.URand(15000, 20000)); - break; - } - case EventTypes.ArnathSmite: - DoCastVictim(InstanceSpells.SpellSmite(IsUndead)); - _events.ScheduleEvent(EventTypes.ArnathSmite, RandomHelper.URand(4000, 7000)); - break; - case EventTypes.ArnathDominateMind: - { - Unit target = SelectTarget(SelectAggroTarget.Random, 1, 0.0f, true); - if (target) - DoCast(target, InstanceSpells.DominateMind); - _events.ScheduleEvent(EventTypes.ArnathDominateMind, RandomHelper.URand(28000, 37000)); - } - break; - default: - break; - } - }); - - DoMeleeAttackIfReady(); - } - - Creature FindFriendlyCreature() - { - var u_check = new MostHPMissingInRange(me, 60.0f, 0); - var searcher = new CreatureLastSearcher(me, u_check); - Cell.VisitGridObjects(me, searcher, 60.0f); - return searcher.GetTarget(); - } - } - - [Script] - class npc_captain_brandon : npc_argent_captainAI - { - public npc_captain_brandon(Creature creature) - : base(creature) { } - - public override void Reset() - { - _events.Reset(); - _events.ScheduleEvent(EventTypes.BrandonCrusaderStrike, RandomHelper.URand(6000, 10000)); - _events.ScheduleEvent(EventTypes.BrandonDivineShield, 500); - _events.ScheduleEvent(EventTypes.BrandonJudgementOfCommand, RandomHelper.URand(8000, 13000)); - if (IsUndead) - _events.ScheduleEvent(EventTypes.BrandonHammerOfBetrayal, RandomHelper.URand(25000, 30000)); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case EventTypes.BrandonCrusaderStrike: - DoCastVictim(InstanceSpells.CrusaderStrike); - _events.ScheduleEvent(EventTypes.BrandonCrusaderStrike, RandomHelper.URand(6000, 12000)); - break; - case EventTypes.BrandonDivineShield: - if (HealthBelowPct(20)) - DoCast(me, InstanceSpells.DivineShield); - _events.ScheduleEvent(EventTypes.BrandonDivineShield, 500); - break; - case EventTypes.BrandonJudgementOfCommand: - DoCastVictim(InstanceSpells.JudgementOfCommand); - _events.ScheduleEvent(EventTypes.BrandonJudgementOfCommand, RandomHelper.URand(8000, 13000)); - break; - case EventTypes.BrandonHammerOfBetrayal: - Unit target = SelectTarget(SelectAggroTarget.Random, 1, 0.0f, true); - if (target) - DoCast(target, InstanceSpells.HammerOfBetrayal); - _events.ScheduleEvent(EventTypes.BrandonHammerOfBetrayal, RandomHelper.URand(45000, 60000)); - break; - default: - break; - } - }); - - DoMeleeAttackIfReady(); - } - } - - [Script] - class npc_captain_grondel : npc_argent_captainAI - { - public npc_captain_grondel(Creature creature) : base(creature) { } - - public override void Reset() - { - _events.Reset(); - _events.ScheduleEvent(EventTypes.GrondelChargeCheck, 500); - _events.ScheduleEvent(EventTypes.GrondelMortalStrike, RandomHelper.URand(8000, 14000)); - _events.ScheduleEvent(EventTypes.GrondelSunderArmor, RandomHelper.URand(3000, 12000)); - if (IsUndead) - _events.ScheduleEvent(EventTypes.GrondelConflagration, RandomHelper.URand(12000, 17000)); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case EventTypes.GrondelChargeCheck: - DoCastVictim(InstanceSpells.Charge); - _events.ScheduleEvent(EventTypes.GrondelChargeCheck, 500); - break; - case EventTypes.GrondelMortalStrike: - DoCastVictim(InstanceSpells.MortalStrike); - _events.ScheduleEvent(EventTypes.GrondelMortalStrike, RandomHelper.URand(10000, 15000)); - break; - case EventTypes.GrondelSunderArmor: - DoCastVictim(InstanceSpells.SunderArmor); - _events.ScheduleEvent(EventTypes.GrondelSunderArmor, RandomHelper.URand(5000, 17000)); - break; - case EventTypes.GrondelConflagration: - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true); - if (target) - DoCast(target, InstanceSpells.Conflagration); - _events.ScheduleEvent(EventTypes.GrondelConflagration, RandomHelper.URand(10000, 15000)); - break; - default: - break; - } - }); - - DoMeleeAttackIfReady(); - } - } - - [Script] - class npc_captain_rupert : npc_argent_captainAI - { - public npc_captain_rupert(Creature creature) - : base(creature) - { - } - - public override void Reset() - { - _events.Reset(); - _events.ScheduleEvent(EventTypes.RupertFelIronBomb, RandomHelper.URand(15000, 20000)); - _events.ScheduleEvent(EventTypes.RupertMachineGun, RandomHelper.URand(25000, 30000)); - _events.ScheduleEvent(EventTypes.RupertRocketLaunch, RandomHelper.URand(10000, 15000)); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - _events.ExecuteEvents(eventId => - { - Unit target; - switch (eventId) - { - case EventTypes.RupertFelIronBomb: - target = SelectTarget(SelectAggroTarget.Random, 0); - if (target) - DoCast(target, InstanceSpells.SpellFelIronBomb(IsUndead)); - _events.ScheduleEvent(EventTypes.RupertFelIronBomb, RandomHelper.URand(15000, 20000)); - break; - case EventTypes.RupertMachineGun: - target = SelectTarget(SelectAggroTarget.Random, 1); - if (target) - DoCast(target, InstanceSpells.SpellMachineGun(IsUndead)); - _events.ScheduleEvent(EventTypes.RupertMachineGun, RandomHelper.URand(25000, 30000)); - break; - case EventTypes.RupertRocketLaunch: - target = SelectTarget(SelectAggroTarget.Random, 1); - if (target) - DoCast(target, InstanceSpells.SpellRocketLaunch(IsUndead)); - _events.ScheduleEvent(EventTypes.RupertRocketLaunch, RandomHelper.URand(10000, 15000)); - break; - default: - break; - } - }); - - DoMeleeAttackIfReady(); - } - } - - [Script] - class npc_frostwing_vrykul : SmartAI - { - public npc_frostwing_vrykul(Creature creature) - : base(creature) { } - - public override bool CanAIAttack(Unit target) - { - // do not see targets inside Frostwing Halls when we are not there - return (me.GetPositionY() > 2660.0f) == (target.GetPositionY() > 2660.0f) && base.CanAIAttack(target); - } - } - - [Script] - class npc_impaling_spear : CreatureAI - { - public npc_impaling_spear(Creature creature) - : base(creature) - { - } - - public override void Reset() - { - me.SetReactState(ReactStates.Passive); - _vehicleCheckTimer = 500; - } - - public override void UpdateAI(uint diff) - { - if (_vehicleCheckTimer <= diff) - { - _vehicleCheckTimer = 500; - if (!me.GetVehicle()) - me.DespawnOrUnsummon(100); - } - else - _vehicleCheckTimer -= diff; - } - - uint _vehicleCheckTimer; - } - - [Script] - class npc_arthas_teleport_visual : NullCreatureAI - { - public npc_arthas_teleport_visual(Creature creature) - : base(creature) - { - _instance = creature.GetInstanceScript(); - } - - public override void Reset() - { - _events.Reset(); - if (_instance.GetBossState(Bosses.ProfessorPutricide) == EncounterState.Done && - _instance.GetBossState(Bosses.BloodQueenLanaThel) == EncounterState.Done && - _instance.GetBossState(Bosses.Sindragosa) == EncounterState.Done) - _events.ScheduleEvent(EventTypes.SoulMissile, RandomHelper.URand(1000, 6000)); - } - - public override void UpdateAI(uint diff) - { - if (_events.Empty()) - return; - - _events.Update(diff); - - if (_events.ExecuteEvent() == EventTypes.SoulMissile) - { - DoCastAOE(InstanceSpells.SoulMissile); - _events.ScheduleEvent(EventTypes.SoulMissile, RandomHelper.URand(5000, 7000)); - } - } - - InstanceScript _instance; - } - - [Script] - class spell_icc_stoneform : AuraScript - { - void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Creature target = GetTarget().ToCreature(); - if (target) - { - target.SetReactState(ReactStates.Passive); - target.AddUnitFlag(UnitFlags.NotSelectable | UnitFlags.ImmuneToPc); - target.SetEmoteState(Emote.OneshotCustomSpell02); - } - } - - void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Creature target = GetTarget().ToCreature(); - if (target) - { - target.SetReactState(ReactStates.Aggressive); - target.RemoveUnitFlag(UnitFlags.NotSelectable | UnitFlags.ImmuneToPc); - target.SetEmoteState(Emote.StateCustomSpell02); - } - } - - public override void Register() - { - OnEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); - OnEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); - } - } - - [Script] - class spell_icc_sprit_alarm : SpellScript - { - public const int AwakenWard1 = 22900; - public const int AwakenWard2 = 22907; - public const int AwakenWard3 = 22908; - public const int AwakenWard4 = 22909; - - void HandleEvent(uint effIndex) - { - PreventHitDefaultEffect(effIndex); - uint trapId; - switch (GetSpellInfo().GetEffect(effIndex).MiscValue) - { - case AwakenWard1: - trapId = GameObjectIds.SpiritAlarm1; - break; - case AwakenWard2: - trapId = GameObjectIds.SpiritAlarm2; - break; - case AwakenWard3: - trapId = GameObjectIds.SpiritAlarm3; - break; - case AwakenWard4: - trapId = GameObjectIds.SpiritAlarm4; - break; - default: - return; - } - - GameObject trap = GetCaster().FindNearestGameObject(trapId, 5.0f); - if (trap) - trap.SetRespawnTime((int)trap.GetGoInfo().GetAutoCloseTime() / Time.InMilliseconds); - - List wards = new List(); - GetCaster().GetCreatureListWithEntryInGrid(wards, CreatureIds.DeathboundWard, 150.0f); - wards.Sort(new ObjectDistanceOrderPred(GetCaster())); - foreach (var creature in wards) - { - if (creature.IsAlive() && creature.HasAura(InstanceSpells.StoneForm)) - { - creature.GetAI().Talk(Texts.SayTrapActivate); - creature.RemoveAurasDueToSpell(InstanceSpells.StoneForm); - Unit target = creature.SelectNearestTarget(150.0f); - if (target) - creature.GetAI().AttackStart(target); - - break; - } - } - } - - public override void Register() - { - OnEffectHit.Add(new EffectHandler(HandleEvent, 2, SpellEffectName.SendEvent)); - } - } - - [Script] - class spell_frost_giant_death_plague : SpellScript - { - public override bool Load() - { - _failed = false; - return true; - } - - // First effect - void CountTargets(List targets) - { - targets.Remove(GetCaster()); - _failed = targets.Empty(); - } - - // Second effect - void FilterTargets(List targets) - { - // Select valid targets for jump - targets.RemoveAll(obj => - { - if (obj == GetCaster()) - return true; - - if (!obj.IsTypeId(TypeId.Player)) - return true; - - if (obj.ToUnit().HasAura(InstanceSpells.RecentlyInfected) || obj.ToUnit().HasAura(InstanceSpells.DeathPlagueAura)) - return true; - - return false; - }); - - if (!targets.Empty()) - { - WorldObject target = targets.SelectRandom(); - targets.Clear(); - targets.Add(target); - } - - targets.Add(GetCaster()); - } - - void HandleScript(uint effIndex) - { - PreventHitDefaultEffect(effIndex); - if (GetHitUnit() != GetCaster()) - GetCaster().CastSpell(GetHitUnit(), InstanceSpells.DeathPlagueAura, true); - else if (_failed) - GetCaster().CastSpell(GetCaster(), InstanceSpells.DeathPlagueKill, true); - } - - public override void Register() - { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(CountTargets, 0, Targets.UnitSrcAreaAlly)); - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 1, Targets.UnitSrcAreaAlly)); - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 1, SpellEffectName.ScriptEffect)); - } - - bool _failed; - } - - [Script] - class spell_icc_harvest_blight_specimen : SpellScript - { - void HandleScript(uint effIndex) - { - PreventHitDefaultEffect(effIndex); - GetHitUnit().RemoveAurasDueToSpell((uint)GetEffectValue()); - } - - void HandleQuestComplete(uint effIndex) - { - GetHitUnit().RemoveAurasDueToSpell((uint)GetEffectValue()); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); - OnEffectHitTarget.Add(new EffectHandler(HandleQuestComplete, 1, SpellEffectName.QuestComplete)); - } - } - - [Script] - class spell_svalna_revive_champion : SpellScript - { - void RemoveAliveTarget(List targets) - { - targets.RemoveAll(obj => - { - Unit unit = obj.ToUnit(); - if (unit) - return unit.IsAlive(); - - return true; - }); - - var newTargets = targets.SelectRandom(2); - targets.Clear(); - - targets.AddRange(newTargets); - } - - void Land(uint effIndex) - { - Creature caster = GetCaster().ToCreature(); - if (!caster) - return; - - Position pos = caster.GetNearPosition(5.0f, 0.0f); - caster.SetHomePosition(pos); - caster.GetMotionMaster().MoveLand(1, pos); - } - - public override void Register() - { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(RemoveAliveTarget, 0, Targets.UnitDestAreaEntry)); - OnEffectHit.Add(new EffectHandler(Land, 0, SpellEffectName.ScriptEffect)); - } - } - - [Script] - class spell_svalna_remove_spear : SpellScript - { - void HandleScript(uint effIndex) - { - PreventHitDefaultEffect(effIndex); - Creature target = GetHitCreature(); - if (target) - { - Unit vehicle = target.GetVehicleBase(); - if (vehicle) - vehicle.RemoveAurasDueToSpell(InstanceSpells.ImpalingSpear); - target.DespawnOrUnsummon(1); - } - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); - } - } - - // 72585 - Soul Missile - [Script] - class spell_icc_soul_missile : SpellScript - { - void RelocateDest(ref SpellDestination dest) - { - Position offset = new Position(0.0f, 0.0f, 200.0f, 0.0f); - dest.RelocateOffset(offset); - } - - public override void Register() - { - OnDestinationTargetSelect.Add(new DestinationTargetSelectHandler(RelocateDest, 0, Targets.DestCaster)); - } - } - - [Script] - class at_icc_saurfang_portal : AreaTriggerScript - { - public at_icc_saurfang_portal() : base("at_icc_saurfang_portal") { } - - public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger, bool entered) - { - InstanceScript instance = player.GetInstanceScript(); - if (instance == null || instance.GetBossState(Bosses.DeathbringerSaurfang) != EncounterState.Done) - return true; - - player.TeleportTo(631, 4126.35f, 2769.23f, 350.963f, 0.0f); - - if (instance.GetData(DataTypes.ColdflameJets) == (uint)EncounterState.NotStarted) - { - // Process relocation now, to preload the grid and initialize traps - player.GetMap().PlayerRelocation(player, 4126.35f, 2769.23f, 350.963f, 0.0f); - - instance.SetData(DataTypes.ColdflameJets, (uint)EncounterState.InProgress); - List traps = new List(); - player.GetCreatureListWithEntryInGrid(traps, CreatureIds.FrostFreezeTrap, 120.0f); - traps.Sort(new ObjectDistanceOrderPred(player)); - bool instant = false; - foreach (var creature in traps) - { - creature.GetAI().DoAction(instant ? 1000 : 11000); - instant = !instant; - } - } - - return true; - } - } - - [Script] - class at_icc_shutdown_traps : AreaTriggerScript - { - public at_icc_shutdown_traps() : base("at_icc_shutdown_traps") { } - - public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger, bool entered) - { - InstanceScript instance = player.GetInstanceScript(); - if (instance != null) - instance.SetData(DataTypes.UpperSpireTeleAct, (uint)EncounterState.Done); - - return true; - } - } - - [Script] - class at_icc_start_blood_quickening : AreaTriggerScript - { - public at_icc_start_blood_quickening() : base("at_icc_start_blood_quickening") { } - - public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger, bool entered) - { - InstanceScript instance = player.GetInstanceScript(); - if (instance != null) - if (instance.GetData(DataTypes.BloodQuickeningState) == (uint)EncounterState.NotStarted) - instance.SetData(DataTypes.BloodQuickeningState, (uint)EncounterState.InProgress); - return true; - } - } - - [Script] - class at_icc_start_frostwing_gauntlet : AreaTriggerScript - { - public at_icc_start_frostwing_gauntlet() : base("at_icc_start_frostwing_gauntlet") { } - - public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger, bool entered) - { - InstanceScript instance = player.GetInstanceScript(); - if (instance != null) - { - Creature crok = ObjectAccessor.GetCreature(player, instance.GetGuidData(DataTypes.CrokScourgebane)); - if (crok) - crok.GetAI().DoAction(Actions.StartGauntlet); - } - return true; - } - } - - [Script("spell_svalna_caress_of_death", 70196u)] - class spell_trigger_spell_from_caster : SpellScript - { - public spell_trigger_spell_from_caster(uint triggerId) - { - _triggerId = triggerId; - } - - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(_triggerId); - } - - void HandleTrigger() - { - GetCaster().CastSpell(GetHitUnit(), _triggerId, true); - } - - public override void Register() - { - AfterHit.Add(new HitHandler(HandleTrigger)); - } - - uint _triggerId; - } -} diff --git a/Source/Scripts/Northrend/IcecrownCitadel/IcecrownCitadelConst.cs b/Source/Scripts/Northrend/IcecrownCitadel/IcecrownCitadelConst.cs deleted file mode 100644 index 977e9cfb1..000000000 --- a/Source/Scripts/Northrend/IcecrownCitadel/IcecrownCitadelConst.cs +++ /dev/null @@ -1,734 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -namespace Scripts.Northrend.IcecrownCitadel -{ - struct IccConst - { - public const uint WeeklyNPCs = 9; - } - - struct Bosses - { - public const uint LordMarrowgar = 0; - public const uint LadyDeathwhisper = 1; - public const uint GunshipBattle = 2; - public const uint DeathbringerSaurfang = 3; - public const uint Festergut = 4; - public const uint Rotface = 5; - public const uint ProfessorPutricide = 6; - public const uint BloodPrinceCouncil = 7; - public const uint BloodQueenLanaThel = 8; - public const uint SisterSvalna = 9; - public const uint ValithriaDreamwalker = 10; - public const uint Sindragosa = 11; - public const uint TheLichKing = 12; - - public const uint MaxEncounters = 13; - } - - struct Texts - { - // Highlord Tirion Fordring (At Light'S Hammer) - public const uint SayTirionIntro1 = 0; - public const uint SayTirionIntro2 = 1; - public const uint SayTirionIntro3 = 2; - public const uint SayTirionIntro4 = 3; - public const uint SayTirionIntroH5 = 4; - public const uint SayTirionIntroA5 = 5; - - // The Lich King (At Light'S Hammer) - public const uint SayLkIntro1 = 0; - public const uint SayLkIntro2 = 1; - public const uint SayLkIntro3 = 2; - public const uint SayLkIntro4 = 3; - public const uint SayLkIntro5 = 4; - - // Highlord Bolvar Fordragon (At Light'S Hammer) - public const uint SayBolvarIntro1 = 0; - - // High Overlord Saurfang (At Light'S Hammer) - public const uint SaySaurfangIntro1 = 15; - public const uint SaySaurfangIntro2 = 16; - public const uint SaySaurfangIntro3 = 17; - public const uint SaySaurfangIntro4 = 18; - - // Muradin Bronzebeard (At Light'S Hammer) - public const uint SayMuradinIntro1 = 13; - public const uint SayMuradinIntro2 = 14; - public const uint SayMuradinIntro3 = 15; - - // Deathbound Ward - public const uint SayTrapActivate = 0; - - // Rotting Frost Giant - public const uint EmoteDeathPlagueWarning = 0; - - // Sister Svalna - public const uint SaySvalnaKillCaptain = 1; // Happens When She Kills A Captain - public const uint SaySvalnaKill = 4; - public const uint SaySvalnaCaptainDeath = 5; // Happens When A Captain Resurrected By Her Dies - public const uint SaySvalnaDeath = 6; - public const uint EmoteSvalnaImpale = 7; - public const uint EmoteSvalnaBrokenShield = 8; - - public const uint SayCrokIntro1 = 0; // Ready Your Arms; My Argent Brothers. The Vrykul Will Protect The Frost Queen With Their Lives. - public const uint SayArnathIntro2 = 5; // Even Dying Here Beats Spending Another Day Collecting Reagents For That Madman; Finklestein. - public const uint SayCrokIntro3 = 1; // Enough Idle Banter! Our Champions Have Arrived - Support Them As We Push Our Way Through The Hall! - public const uint SaySvalnaEventStart = 0; // You May Have Once Fought Beside Me; Crok; But Now You Are Nothing More Than A Traitor. Come; Your Second Death Approaches! - public const uint SayCrokCombatWp0 = 2; // Draw Them Back To Us; And We'Ll Assist You. - public const uint SayCrokCombatWp1 = 3; // Quickly; Push On! - public const uint SayCrokFinalWp = 4; // Her Reinforcements Will Arrive Shortly; We Must Bring Her Down Quickly! - public const uint SaySvalnaResurrectCaptains = 2; // Foolish Crok. You Brought My Reinforcements With You. Arise; Argent Champions; And Serve The Lich King In Death! - public const uint SayCrokCombatSvalna = 5; // I'Ll Draw Her Attacks. Return Our Brothers To Their Graves; Then Help Me Bring Her Down! - public const uint SaySvalnaAggro = 3; // Come; Scourgebane. I'Ll Show The Master Which Of Us Is Truly Worthy Of The Title Of "Champion"! - public const uint SayCaptainDeath = 0; - public const uint SayCaptainResurrected = 1; - public const uint SayCaptainKill = 2; - public const uint SayCaptainSecondDeath = 3; - public const uint SayCaptainSurviveTalk = 4; - public const uint SayCrokWeakeningGauntlet = 6; - public const uint SayCrokWeakeningSvalna = 7; - public const uint SayCrokDeath = 8; - } - - struct InstanceSpells - { - // Rotting Frost Giant - public const uint DeathPlague = 72879; - public const uint DeathPlagueAura = 72865; - public const uint RecentlyInfected = 72884; - public const uint DeathPlagueKill = 72867; - public const uint Stomp = 64652; - public const uint ArcticBreath = 72848; - - // Frost Freeze Trap - public const uint ColdflameJets = 70460; - - // Alchemist Adrianna - public const uint HarvestBlightSpecimen = 72155; - public const uint HarvestBlightSpecimen25 = 72162; - - // Crok Scourgebane - public const uint IceboundArmor = 70714; - public const uint ScourgeStrike = 71488; - public const uint DeathStrike = 71489; - - // Sister Svalna - public const uint CaressOfDeath = 70078; - public const uint ImpalingSpearKill = 70196; - public const uint ReviveChampion = 70053; - public const uint Undeath = 70089; - public const uint ImpalingSpear = 71443; - public const uint AetherShield = 71463; - public const uint HurlSpear = 71466; - public const uint DivineSurge = 71465; - - // Captain Arnath - public const uint DominateMind = 14515; - public const uint FlashHealNormal = 71595; - public const uint PowerWordShieldNormal = 71548; - public const uint SmiteNormal = 71546; - public const uint FlashHealUndead = 71782; - public const uint PowerWordShieldUndead = 71780; - public const uint SmiteUndead = 71778; - public static uint SpellFlashHeal(bool isUndead) { return isUndead ? FlashHealUndead : FlashHealNormal; } - public static uint SpellPowerWordShield(bool isUndead) { return isUndead ? PowerWordShieldUndead : PowerWordShieldNormal; } - public static uint SpellSmite(bool isUndead) { return isUndead ? SmiteUndead : SmiteNormal; } - - // Captain Brandon - public const uint CrusaderStrike = 71549; - public const uint DivineShield = 71550; - public const uint JudgementOfCommand = 71551; - public const uint HammerOfBetrayal = 71784; - - // Captain Grondel - public const uint Charge = 71553; - public const uint MortalStrike = 71552; - public const uint SunderArmor = 71554; - public const uint Conflagration = 71785; - - // Captain Rupert - public const uint FelIronBombNormal = 71592; - public const uint MachineGunNormal = 71594; - public const uint RocketLaunchNormal = 71590; - public const uint FelIronBombUndead = 71787; - public const uint MachineGunUndead = 71788; - public const uint RocketLaunchUndead = 71786; - public static uint SpellFelIronBomb(bool isUndead) { return isUndead ? FelIronBombUndead : FelIronBombNormal; } - public static uint SpellMachineGun(bool isUndead) { return isUndead ? MachineGunUndead : MachineGunNormal; } - public static uint SpellRocketLaunch(bool isUndead) { return isUndead ? RocketLaunchUndead : RocketLaunchNormal; } - - // Invisible Stalker (Float; Uninteractible; Largeaoi) - public const uint SoulMissile = 72585; - - public const uint Berserk = 26662; - public const uint Berserk2 = 47008; - - // Deathbound Ward - public const uint StoneForm = 70733; - - // Residue Rendezvous - public const uint OrangeBlightResidue = 72144; - public const uint GreenBlightResidue = 72145; - - // The Lich King - public const uint ArthasTeleporterCeremony = 72915; - public const uint FrostmourneTeleportVisual = 73078; - - // Shadowmourne questline - public const uint UnsatedCraving = 71168; - public const uint ShadowsFate = 71169; - } - - struct EventTypes - { - // Highlord Tirion Fordring (At Light'S Hammer) - // The Lich King (At Light'S Hammer) - // Highlord Bolvar Fordragon (At Light'S Hammer) - // High Overlord Saurfang (At Light'S Hammer) - // Muradin Bronzebeard (At Light'S Hammer) - public const uint TirionIntro2 = 1; - public const uint TirionIntro3 = 2; - public const uint TirionIntro4 = 3; - public const uint TirionIntro5 = 4; - public const uint LkIntro1 = 5; - public const uint TirionIntro6 = 6; - public const uint LkIntro2 = 7; - public const uint LkIntro3 = 8; - public const uint LkIntro4 = 9; - public const uint BolvarIntro1 = 10; - public const uint LkIntro5 = 11; - public const uint SaurfangIntro1 = 12; - public const uint TirionIntroH7 = 13; - public const uint SaurfangIntro2 = 14; - public const uint SaurfangIntro3 = 15; - public const uint SaurfangIntro4 = 16; - public const uint SaurfangRun = 17; - public const uint MuradinIntro1 = 18; - public const uint MuradinIntro2 = 19; - public const uint MuradinIntro3 = 20; - public const uint TirionIntroA7 = 21; - public const uint MuradinIntro4 = 22; - public const uint MuradinIntro5 = 23; - public const uint MuradinRun = 24; - - // Rotting Frost Giant - public const uint DeathPlague = 25; - public const uint Stomp = 26; - public const uint ArcticBreath = 27; - - // Frost Freeze Trap - public const uint ActivateTrap = 28; - - // Crok Scourgebane - public const uint ScourgeStrike = 29; - public const uint DeathStrike = 30; - public const uint HealthCheck = 31; - public const uint CrokIntro3 = 32; - public const uint StartPathing = 33; - - // Sister Svalna - public const uint ArnathIntro2 = 34; - public const uint SvalnaStart = 35; - public const uint SvalnaResurrect = 36; - public const uint SvalnaCombat = 37; - public const uint ImpalingSpear = 38; - public const uint AetherShield = 39; - - // Captain Arnath - public const uint ArnathFlashHeal = 40; - public const uint ArnathPwShield = 41; - public const uint ArnathSmite = 42; - public const uint ArnathDominateMind = 43; - - // Captain Brandon - public const uint BrandonCrusaderStrike = 44; - public const uint BrandonDivineShield = 45; - public const uint BrandonJudgementOfCommand = 46; - public const uint BrandonHammerOfBetrayal = 47; - - // Captain Grondel - public const uint GrondelChargeCheck = 48; - public const uint GrondelMortalStrike = 49; - public const uint GrondelSunderArmor = 50; - public const uint GrondelConflagration = 51; - - // Captain Rupert - public const uint RupertFelIronBomb = 52; - public const uint RupertMachineGun = 53; - public const uint RupertRocketLaunch = 54; - - // Invisible Stalker (Float; Uninteractible; Largeaoi) - public const uint SoulMissile = 55; - } - - struct DataTypes - { - // Additional Data - public const uint SaurfangEventNpc = 13; - public const uint BonedAchievement = 14; - public const uint OozeDanceAchievement = 15; - public const uint PutricideTable = 16; - public const uint NauseaAchievement = 17; - public const uint OrbWhispererAchievement = 18; - public const uint PrinceKelesethGuid = 19; - public const uint PrinceTaldaramGuid = 20; - public const uint PrinceValanarGuid = 21; - public const uint BloodPrincesControl = 22; - public const uint SindragosaFrostwyrms = 23; - public const uint Spinestalker = 24; - public const uint Rimefang = 25; - public const uint ColdflameJets = 26; - public const uint TeamInInstance = 27; - public const uint BloodQuickeningState = 28; - public const uint HeroicAttempts = 29; - public const uint CrokScourgebane = 30; - public const uint CaptainArnath = 31; - public const uint CaptainBrandon = 32; - public const uint CaptainGrondel = 33; - public const uint CaptainRupert = 34; - public const uint ValithriaTrigger = 35; - public const uint ValithriaLichKing = 36; - public const uint HighlordTirionFordring = 37; - public const uint ArthasPlatform = 38; - public const uint TerenasMenethil = 39; - public const uint EnemyGunship = 40; - public const uint UpperSpireTeleAct = 41; - } - - struct WorldStates - { - public const uint ShowTimer = 4903; - public const uint ExecutionTime = 4904; - public const uint ShowAttempts = 4940; - public const uint AttemptsRemaining = 4941; - public const uint AttemptsMax = 4942; - } - - struct CreatureIds - { - // At Light'S Hammer - public const uint HighlordTirionFordringLh = 37119; - public const uint TheLichKingLh = 37181; - public const uint HighlordBolvarFordragonLh = 37183; - public const uint KorKronGeneral = 37189; - public const uint AllianceCommander = 37190; - public const uint Tortunok = 37992; // Druid Armor H - public const uint AlanaMoonstrike = 37999; // Druid Armor A - public const uint GerardoTheSuave = 37993; // Hunter Armor H - public const uint TalanMoonstrike = 37998; // Hunter Armor A - public const uint UvlusBanefire = 38284; // Mage Armor H - public const uint MalfusGrimfrost = 38283; // Mage Armor A - public const uint IkfirusTheVile = 37991; // Rogue Armor H - public const uint Yili = 37997; // Rogue Armor A - public const uint VolGuk = 38841; // Shaman Armor H - public const uint Jedebia = 38840; // Shaman Armor A - public const uint HaraggTheUnseen = 38181; // Warlock Armor H - public const uint NibyTheAlmighty = 38182; // Warlock Armor N - public const uint GarroshHellscream = 39372; - public const uint KingVarianWrynn = 39371; - public const uint DeathboundWard = 37007; - public const uint LadyJainaProudmooreQuest = 38606; - public const uint MuradinBronzaBeardQuest = 38607; - public const uint UtherTheLightBringerQuest = 38608; - public const uint LadySylvanasWindrunnerQuest = 38609; - - // Weekly Quests - public const uint InfiltratorMinchar = 38471; - public const uint KorKronLieutenant = 38491; - public const uint SkybreakerLieutenant = 38492; - public const uint RottingFrostGiant10 = 38490; - public const uint RottingFrostGiant25 = 38494; - public const uint AlchemistAdrianna = 38501; - public const uint AlrinTheAgile = 38551; - public const uint InfiltratorMincharBq = 38558; - public const uint MincharBeamStalker = 38557; - public const uint ValithriaDreamwalkerQuest = 38589; - - // Lord Marrowgar - public const uint LordMarrowgar = 36612; - public const uint Coldflame = 36672; - public const uint BoneSpike = 36619; - - // Lady Deathwhisper - public const uint LadyDeathwhisper = 36855; - public const uint CultFanatic = 37890; - public const uint DeformedFanatic = 38135; - public const uint ReanimatedFanatic = 38009; - public const uint CultAdherent = 37949; - public const uint EmpoweredAdherent = 38136; - public const uint ReanimatedAdherent = 38010; - public const uint VengefulShade = 38222; - - // Icecrown Gunship Battle - public const uint MartyrStalkerIGBSaurfang = 38569; - public const uint AllianceGunshipCannon = 36838; - public const uint HordeGunshipCannon = 36839; - public const uint SkybreakerDeckhand = 36970; - public const uint OrgrimsHammerCrew = 36971; - public const uint IGBHighOverlordSaurfang = 36939; - public const uint IGBMuradinBrozebeard = 36948; - public const uint TheSkybreaker = 37540; - public const uint OrgrimsHammer = 37215; - public const uint GunshipHull = 37547; - public const uint TeleportPortal = 37227; - public const uint TeleportExit = 37488; - public const uint SkybreakerSorcerer = 37116; - public const uint SkybreakerRifleman = 36969; - public const uint SkybreakerMortarSoldier = 36978; - public const uint SkybreakerMarine = 36950; - public const uint SkybreakerSergeant = 36961; - public const uint KorKronBattleMage = 37117; - public const uint KorKronAxeThrower = 36968; - public const uint KorKronRocketeer = 36982; - public const uint KorKronReaver = 36957; - public const uint KorKronSergeant = 36960; - public const uint ZafodBoombox = 37184; - public const uint HighCaptainJustinBartlett = 37182; - public const uint SkyReaverKormBlackscar = 37833; - - // Deathbringer Saurfang - public const uint DeathbringerSaurfang = 37813; - public const uint BloodBeast = 38508; - public const uint SeJainaProudmoore = 37188; // Se Means Saurfang Event - public const uint SeMuradinBronzebeard = 37200; - public const uint SeKingVarianWrynn = 37879; - public const uint SeHighOverlordSaurfang = 37187; - public const uint SeKorKronReaver = 37920; - public const uint SeSkybreakerMarine = 37830; - public const uint FrostFreezeTrap = 37744; - - // Festergut - public const uint Festergut = 36626; - public const uint GasDummy = 36659; - public const uint MalleableOozeStalker = 38556; - - // Rotface - public const uint Rotface = 36627; - public const uint OozeSprayStalker = 37986; - public const uint PuddleStalker = 37013; - public const uint UnstableExplosionStalker = 38107; - public const uint VileGasStalker = 38548; - - // Professor Putricide - public const uint ProfessorPutricide = 36678; - public const uint AbominationWingMadScientistStalker = 37824; - public const uint GrowingOozePuddle = 37690; - public const uint GasCloud = 37562; - public const uint VolatileOoze = 37697; - public const uint ChokingGasBomb = 38159; - public const uint TearGasTargetStalker = 38317; - public const uint MutatedAbomination10 = 37672; - public const uint MutatedAbomination25 = 38285; - - // Blood Prince Council - public const uint PrinceKeleseth = 37972; - public const uint PrinceTaldaram = 37973; - public const uint PrinceValanar = 37970; - public const uint BloodOrbController = 38008; - public const uint FloatingTrigger = 30298; - public const uint DarkNucleus = 38369; - public const uint BallOfFlame = 38332; - public const uint BallOfInfernoFlame = 38451; - public const uint KineticBombTarget = 38458; - public const uint KineticBomb = 38454; - public const uint ShockVortex = 38422; - - // Blood-Queen Lana'Thel - public const uint BloodQueenLanaThel = 37955; - - // Frostwing Halls Gauntlet Event - public const uint CrokScourgebane = 37129; - public const uint CaptainArnath = 37122; - public const uint CaptainBrandon = 37123; - public const uint CaptainGrondel = 37124; - public const uint CaptainRupert = 37125; - public const uint CaptainArnathUndead = 37491; - public const uint CaptainBrandonUndead = 37493; - public const uint CaptainGrondelUndead = 37494; - public const uint CaptainRupertUndead = 37495; - public const uint YmirjarBattleMaiden = 37132; - public const uint YmirjarDeathbringer = 38125; - public const uint YmirjarFrostbinder = 37127; - public const uint YmirjarHuntress = 37134; - public const uint YmirjarWarlord = 37133; - public const uint SisterSvalna = 37126; - public const uint ImpalingSpear = 38248; - - // Valithria Dreamwalker - public const uint ValithriaDreamwalker = 36789; - public const uint GreenDragonCombatTrigger = 38752; - public const uint RisenArchmage = 37868; - public const uint BlazingSkeleton = 36791; - public const uint Suppresser = 37863; - public const uint BlisteringZombie = 37934; - public const uint GluttonousAbomination = 37886; - public const uint ManaVoid = 38068; - public const uint ColumnOfFrost = 37918; - public const uint RotWorm = 37907; - public const uint TheLichKingValithria = 16980; - public const uint DreamPortalPreEffect = 38186; - public const uint NightmarePortalPreEffect = 38429; - public const uint DreamPortal = 37945; - public const uint NightmarePortal = 38430; - - // Sindragosa - public const uint Sindragosa = 36853; - public const uint Spinestalker = 37534; - public const uint Rimefang = 37533; - public const uint FrostwardenHandler = 37531; - public const uint FrostwingWhelp = 37532; - public const uint IcyBlast = 38223; - public const uint FrostBomb = 37186; - public const uint IceTomb = 36980; - - // The Lich King - public const uint TheLichKing = 36597; - public const uint HighlordTirionFordringLk = 38995; - public const uint TerenasMenethilFrostmourne = 36823; - public const uint SpiritWarden = 36824; - public const uint TerenasMenethilFrostmourneH = 39217; - public const uint ShamblingHorror = 37698; - public const uint DrudgeGhoul = 37695; - public const uint IceSphere = 36633; - public const uint RagingSpirit = 36701; - public const uint Defile = 38757; - public const uint ValkyrShadowguard = 36609; - public const uint VileSpirit = 37799; - public const uint WickedSpirit = 39190; - public const uint StrangulateVehicle = 36598; - public const uint WorldTrigger = 22515; - public const uint WorldTriggerInfiniteAoi = 36171; - public const uint SpiritBomb = 39189; - public const uint FrostmourneTrigger = 38584; - - // Generic - public const uint InvisibleStalker = 30298; - } - - struct GameObjectIds - { - // ICC Teleporters - public const uint TransporterLichKing = 202223; - public const uint TransporterUpperSpire = 202235; - public const uint TransporterLightsHammer = 202242; - public const uint TransporterRampart = 202243; - public const uint TransporterDeathBringer = 202244; - public const uint TransporterOratory = 202245; - public const uint TransporterSindragosa = 202246; - - // Lower Spire Trash - public const uint SpiritAlarm1 = 201814; - public const uint SpiritAlarm2 = 201815; - public const uint SpiritAlarm3 = 201816; - public const uint SpiritAlarm4 = 201817; - - // Lord Marrogar - public const uint DoodadIcecrownIcewall02 = 201910; - public const uint LordMarrowgarIcewall = 201911; - public const uint LordMarrowgarSEntrance = 201857; - - // Lady Deathwhisper - public const uint OratoryOfTheDamnedEntrance = 201563; - public const uint LadyDeathwhisperElevator = 202220; - - // Icecrown Gunship Battle - Horde raid - public const uint OrgrimsHammer_H = 201812; - public const uint TheSkybreaker_H = 201811; - public const uint GunshipArmory_H_10N = 202178; - public const uint GunshipArmory_H_25N = 202180; - public const uint GunshipArmory_H_10H = 202177; - public const uint GunshipArmory_H_25H = 202179; - - // Icecrown Gunship Battle - Alliance raid - public const uint OrgrimsHammer_A = 201581; - public const uint TheSkybreaker_A = 201580; - public const uint GunshipArmory_A_10N = 201873; - public const uint GunshipArmory_A_25N = 201874; - public const uint GunshipArmory_A_10H = 201872; - public const uint GunshipArmory_A_25H = 201875; - - // Deathbringer Saurfang - public const uint SaurfangSDoor = 201825; - public const uint DeathbringerSCache10n = 202239; - public const uint DeathbringerSCache25n = 202240; - public const uint DeathbringerSCache10h = 202238; - public const uint DeathbringerSCache25h = 202241; - - // Professor Putricide - public const uint OrangePlagueMonsterEntrance = 201371; - public const uint GreenPlagueMonsterEntrance = 201370; - public const uint ScientistAirlockDoorCollision = 201612; - public const uint ScientistAirlockDoorOrange = 201613; - public const uint ScientistAirlockDoorGreen = 201614; - public const uint DoodadIcecrownOrangetubes02 = 201617; - public const uint DoodadIcecrownGreentubes02 = 201618; - public const uint ScientistEntrance = 201372; - public const uint DrinkMe = 201584; - public const uint PlagueSigil = 202182; - - // Blood Prince Council - public const uint CrimsonHallDoor = 201376; - public const uint BloodElfCouncilDoor = 201378; - public const uint BloodElfCouncilDoorRight = 201377; - - // Blood-Queen Lana'Thel - public const uint DoodadIcecrownBloodprinceDoor01 = 201746; - public const uint DoodadIcecrownGrate01 = 201755; - public const uint BloodwingSigil = 202183; - - // Valithria Dreamwalker - public const uint GreenDragonBossEntrance = 201375; - public const uint GreenDragonBossExit = 201374; - public const uint DoodadIcecrownRoostportcullis01 = 201380; - public const uint DoodadIcecrownRoostportcullis02 = 201381; - public const uint DoodadIcecrownRoostportcullis03 = 201382; - public const uint DoodadIcecrownRoostportcullis04 = 201383; - public const uint CacheOfTheDreamwalker10n = 201959; - public const uint CacheOfTheDreamwalker25n = 202339; - public const uint CacheOfTheDreamwalker10h = 202338; - public const uint CacheOfTheDreamwalker25h = 202340; - - // Sindragosa - public const uint SindragosaEntranceDoor = 201373; - public const uint SindragosaShortcutEntranceDoor = 201369; - public const uint SindragosaShortcutExitDoor = 201379; - public const uint IceWall = 202396; - public const uint IceBlock = 201722; - public const uint SigilOfTheFrostwing = 202181; - - // The Lich King - public const uint ArthasPlatform = 202161; - public const uint ArthasPrecipice = 202078; - public const uint DoodadIcecrownThronefrostywind01 = 202188; - public const uint DoodadIcecrownThronefrostyedge01 = 202189; - public const uint DoodadIceshardStanding02 = 202141; - public const uint DoodadIceshardStanding01 = 202142; - public const uint DoodadIceshardStanding03 = 202143; - public const uint DoodadIceshardStanding04 = 202144; - public const uint DoodadIcecrownSnowedgewarning01 = 202190; - public const uint FrozenLavaman = 202436; - public const uint LavamanPillarsChained = 202437; - public const uint LavamanPillarsUnchained = 202438; - } - - struct AchievementCriteriaIds - { - // Lord Marrowgar - public const uint Boned10n = 12775; - public const uint Boned25n = 12962; - public const uint Boned10h = 13393; - public const uint Boned25h = 13394; - - // Rotface - public const uint DancesWithOozes10 = 12984; - public const uint DancesWithOozes25 = 12966; - public const uint DancesWithOozes10H = 12985; - public const uint DancesWithOozes25H = 12983; - - // Professor Putricide - public const uint Nausea10 = 12987; - public const uint Nausea25 = 12968; - public const uint Nausea10H = 12988; - public const uint Nausea25H = 12981; - - // Blood Prince Council - public const uint OrbWhisperer10 = 13033; - public const uint OrbWhisperer25 = 12969; - public const uint OrbWhisperer10H = 13034; - public const uint OrbWhisperer25H = 13032; - - // Blood-Queen Lana'Thel - public const uint KillLanaThel10m = 13340; - public const uint KillLanaThel25m = 13360; - public const uint OnceBittenTwiceShy10 = 12780; - public const uint OnceBittenTwiceShy25 = 13012; - public const uint OnceBittenTwiceShy10V = 13011; - public const uint OnceBittenTwiceShy25V = 13013; - } - - struct WeeklyQuestIds - { - public const uint Deprogramming10 = 24869; - public const uint Deprogramming25 = 24875; - public const uint SecuringTheRamparts10 = 24870; - public const uint SecuringTheRamparts25 = 24877; - public const uint ResidueRendezvous10 = 24873; - public const uint ResidueRendezvous25 = 24878; - public const uint BloodQuickening10 = 24874; - public const uint BloodQuickening25 = 24879; - public const uint RespiteForATornmentedSoul10 = 24872; - public const uint RespiteForATornmentedSoul25 = 24880; - } - - struct Actions - { - // Icecrown Gunship Battle - public const int EnemyGunshipTalk = -369390; - public const int ExitShip = -369391; - - // Festergut - public const int FestergutCombat = -366260; - public const int FestergutGas = -366261; - public const int FestergutDeath = -366262; - - // Rotface - public const int RotfaceCombat = -366270; - public const int RotfaceOoze = -366271; - public const int RotfaceDeath = -366272; - public const int ChangePhase = -366780; - - // Blood-Queen Lana'Thel - public const int KillMinchar = -379550; - - // Frostwing Halls Gauntlet Event - public const int VrykulDeath = 37129; - - // Sindragosa - public const int StartFrostwyrm = -368530; - public const int TriggerAsphyxiation = -368531; - - // The Lich King - public const int RestoreLight = -72262; - public const int FrostmourneIntro = -36823; - - // Sister Svalna - public const int KillCaptain = 1; - public const int StartGauntlet = 2; - public const int ResurrectCaptains = 3; - public const int CaptainDies = 4; - public const int ResetEvent = 5; - } - - struct TeleporterSpells - { - public const uint LIGHT_S_HAMMER_TELEPORT = 70781; - public const uint ORATORY_OF_THE_DAMNED_TELEPORT = 70856; - public const uint RAMPART_OF_SKULLS_TELEPORT = 70857; - public const uint DEATHBRINGER_S_RISE_TELEPORT = 7085; - public const uint UPPER_SPIRE_TELEPORT = 70859; - public const uint FROZEN_THRONE_TELEPORT = 70860; - public const uint SINDRAGOSA_S_LAIR_TELEPORT = 70861; - } - - struct AreaIds - { - public const uint IcecrownCitadel = 4812; - public const uint TheFrozenThrone = 4859; - } -} diff --git a/Source/Scripts/Northrend/IcecrownCitadel/IcecrownCitadelTeleport.cs b/Source/Scripts/Northrend/IcecrownCitadel/IcecrownCitadelTeleport.cs deleted file mode 100644 index 64fd8b703..000000000 --- a/Source/Scripts/Northrend/IcecrownCitadel/IcecrownCitadelTeleport.cs +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.DataStorage; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using Game.Spells; - -namespace Scripts.Northrend.IcecrownCitadel -{ - [Script] - class icecrown_citadel_teleport : GameObjectScript - { - public icecrown_citadel_teleport() : base("icecrown_citadel_teleport") { } - - public class icecrown_citadel_teleportAI : GameObjectAI - { - public icecrown_citadel_teleportAI(GameObject go) : base(go) { } - - public override bool GossipSelect(Player player, uint menuId, uint gossipListId) - { - if (gossipListId >= TeleportSpells.Length) - return false; - - player.PlayerTalkClass.ClearMenus(); - player.CLOSE_GOSSIP_MENU(); - SpellInfo spell = Global.SpellMgr.GetSpellInfo(TeleportSpells[gossipListId], Difficulty.None); - if (spell == null) - return false; - - if (player.IsInCombat()) - { - ObjectGuid castId = ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, player.GetMapId(), spell.Id, player.GetMap().GenerateLowGuid(HighGuid.Cast)); - Spell.SendCastResult(player, spell, 0, castId, SpellCastResult.AffectingCombat); - return true; - } - - return true; - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return GetInstanceAI(go); - } - - public const uint GOSSIP_SENDER_ICC_PORT = 631; - - static uint[] TeleportSpells = - { - TeleporterSpells.LIGHT_S_HAMMER_TELEPORT, // 0 - TeleporterSpells.ORATORY_OF_THE_DAMNED_TELEPORT, // 1 - 0, // 2 - TeleporterSpells.RAMPART_OF_SKULLS_TELEPORT, // 3 - TeleporterSpells.DEATHBRINGER_S_RISE_TELEPORT, // 4 - TeleporterSpells.UPPER_SPIRE_TELEPORT, // 5 - TeleporterSpells.SINDRAGOSA_S_LAIR_TELEPORT // 6 - }; - } - - [Script] - class at_frozen_throne_teleport : AreaTriggerScript - { - public at_frozen_throne_teleport() : base("at_frozen_throne_teleport") { } - - public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger, bool entered) - { - if (player.IsInCombat()) - { - SpellInfo spell = Global.SpellMgr.GetSpellInfo(TeleporterSpells.FROZEN_THRONE_TELEPORT, Difficulty.None); - if (spell != null) - { - ObjectGuid castId = ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, player.GetMapId(), spell.Id, player.GetMap().GenerateLowGuid(HighGuid.Cast)); - Spell.SendCastResult(player, spell, 0, castId, SpellCastResult.AffectingCombat); - } - return true; - } - InstanceScript instance = player.GetInstanceScript(); - if (instance != null) - if (instance.GetBossState(Bosses.ProfessorPutricide) == EncounterState.Done && - instance.GetBossState(Bosses.BloodQueenLanaThel) == EncounterState.Done && - instance.GetBossState(Bosses.Sindragosa) == EncounterState.Done && - instance.GetBossState(Bosses.TheLichKing) != EncounterState.InProgress) - player.CastSpell(player, TeleporterSpells.FROZEN_THRONE_TELEPORT, true); - - return true; - } - } -} diff --git a/Source/Scripts/Northrend/IcecrownCitadel/InstanceIcecrownCitadel.cs b/Source/Scripts/Northrend/IcecrownCitadel/InstanceIcecrownCitadel.cs deleted file mode 100644 index cf978a279..000000000 --- a/Source/Scripts/Northrend/IcecrownCitadel/InstanceIcecrownCitadel.cs +++ /dev/null @@ -1,1587 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Framework.IO; -using Game; -using Game.Entities; -using Game.Maps; -using Game.Networking.Packets; -using Game.Scripting; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Scripts.Northrend.IcecrownCitadel -{ - [Script] - public class InstanceIcecrownCitadel : InstanceMapScript - { - public struct EventIds - { - public const uint PlayersGunshipSpawn = 22663; - public const uint PlayersGunshipCombat = 22664; - public const uint PlayersGunshipSaurfang = 22665; - public const uint EnemyGunshipCombat = 22860; - public const uint EnemyGunshipDespawn = 22861; - public const uint Quake = 23437; - public const uint SeconsRemorselessWinter = 23507; - public const uint TeleportToFrostmourne = 23617; - } - - public struct TimedEvents - { - public const uint UpdateExecutionTime = 1; - public const uint QuakeShatter = 2; - public const uint RebuildPlatform = 3; - public const uint RespawnGunship = 4; - } - - public static BossBoundaryEntry[] boundaries = - { - new BossBoundaryEntry(Bosses.LordMarrowgar, new CircleBoundary(new Position(-428.0f, 2211.0f), 95.0)), - new BossBoundaryEntry(Bosses.LordMarrowgar, new RectangleBoundary(-430.0f, -330.0f, 2110.0f, 2310.0f) ), - new BossBoundaryEntry(Bosses.LadyDeathwhisper, new RectangleBoundary(-670.0f, -520.0f, 2145.0f, 2280.0f) ), - new BossBoundaryEntry(Bosses.DeathbringerSaurfang, new RectangleBoundary(-565.0f, -465.0f, 2160.0f, 2260.0f) ), - - new BossBoundaryEntry(Bosses.Rotface, new RectangleBoundary(4385.0f, 4505.0f, 3082.0f, 3195.0f) ), - new BossBoundaryEntry(Bosses.Festergut, new RectangleBoundary(4205.0f, 4325.0f, 3082.0f, 3195.0f) ), - new BossBoundaryEntry(Bosses.ProfessorPutricide, new ParallelogramBoundary(new Position(4356.0f, 3290.0f), new Position(4435.0f, 3194.0f), new Position(4280.0f, 3194.0f)) ), - new BossBoundaryEntry(Bosses.ProfessorPutricide, new RectangleBoundary(4280.0f, 4435.0f, 3150.0f, 4360.0f) ), - - new BossBoundaryEntry(Bosses.BloodPrinceCouncil, new EllipseBoundary(new Position(4660.95f, 2769.194f), 85.0, 60.0) ), - new BossBoundaryEntry(Bosses.BloodQueenLanaThel, new CircleBoundary(new Position(4595.93f, 2769.365f), 64.0) ), - - new BossBoundaryEntry(Bosses.SisterSvalna, new RectangleBoundary(4291.0f, 4423.0f, 2438.0f, 2653.0f) ), - new BossBoundaryEntry(Bosses.ValithriaDreamwalker, new RectangleBoundary(4112.5f, 4293.5f, 2385.0f, 2585.0f) ), - new BossBoundaryEntry(Bosses.Sindragosa, new EllipseBoundary(new Position(4408.6f, 2484.0f), 100.0, 75.0) ) - }; - - public static DoorData[] doorData = - { - new DoorData(GameObjectIds.LordMarrowgarSEntrance, Bosses.LordMarrowgar, DoorType.Room ), - new DoorData(GameObjectIds.LordMarrowgarIcewall, Bosses.LordMarrowgar, DoorType.Passage ), - new DoorData(GameObjectIds.DoodadIcecrownIcewall02, Bosses.LordMarrowgar, DoorType.Passage ), - new DoorData(GameObjectIds.OratoryOfTheDamnedEntrance, Bosses.LadyDeathwhisper, DoorType.Room ), - new DoorData(GameObjectIds.SaurfangSDoor, Bosses.DeathbringerSaurfang, DoorType.Passage ), - new DoorData(GameObjectIds.OrangePlagueMonsterEntrance, Bosses.Festergut, DoorType.Room ), - new DoorData(GameObjectIds.GreenPlagueMonsterEntrance, Bosses.Rotface, DoorType.Room ), - new DoorData(GameObjectIds.ScientistEntrance, Bosses.ProfessorPutricide, DoorType.Room ), - new DoorData(GameObjectIds.CrimsonHallDoor, Bosses.BloodPrinceCouncil, DoorType.Room ), - new DoorData(GameObjectIds.BloodElfCouncilDoor, Bosses.BloodPrinceCouncil, DoorType.Passage ), - new DoorData(GameObjectIds.BloodElfCouncilDoorRight, Bosses.BloodPrinceCouncil, DoorType.Passage ), - new DoorData(GameObjectIds.DoodadIcecrownBloodprinceDoor01, Bosses.BloodQueenLanaThel, DoorType.Room ), - new DoorData(GameObjectIds.DoodadIcecrownGrate01, Bosses.BloodQueenLanaThel, DoorType.Passage ), - new DoorData(GameObjectIds.GreenDragonBossEntrance, Bosses.SisterSvalna, DoorType.Passage ), - new DoorData(GameObjectIds.GreenDragonBossEntrance, Bosses.ValithriaDreamwalker, DoorType.Room ), - new DoorData(GameObjectIds.GreenDragonBossExit, Bosses.ValithriaDreamwalker, DoorType.Passage ), - new DoorData(GameObjectIds.DoodadIcecrownRoostportcullis01, Bosses.ValithriaDreamwalker, DoorType.SpawnHole), - new DoorData(GameObjectIds.DoodadIcecrownRoostportcullis02, Bosses.ValithriaDreamwalker, DoorType.SpawnHole), - new DoorData(GameObjectIds.DoodadIcecrownRoostportcullis03, Bosses.ValithriaDreamwalker, DoorType.SpawnHole), - new DoorData(GameObjectIds.DoodadIcecrownRoostportcullis04, Bosses.ValithriaDreamwalker, DoorType.SpawnHole), - new DoorData(GameObjectIds.SindragosaEntranceDoor, Bosses.Sindragosa, DoorType.Room ), - new DoorData(GameObjectIds.SindragosaShortcutEntranceDoor, Bosses.Sindragosa, DoorType.Passage ), - new DoorData(GameObjectIds.SindragosaShortcutExitDoor, Bosses.Sindragosa, DoorType.Passage ), - new DoorData(GameObjectIds.IceWall , Bosses.Sindragosa, DoorType.Room ), - new DoorData(GameObjectIds.IceWall, Bosses.Sindragosa, DoorType.Room ), - new DoorData(0, 0, DoorType.Room ), // END - }; - - public class WeeklyQuest - { - public WeeklyQuest(uint entry, uint id1, uint id2) - { - creatureEntry = entry; - questId[0] = id1; - questId[1] = id2; - } - - public uint creatureEntry; - public uint[] questId = new uint[2]; // 10 and 25 man versions - } - - public static WeeklyQuest[] WeeklyQuestData = - { - new WeeklyQuest(CreatureIds.InfiltratorMinchar, WeeklyQuestIds.Deprogramming10, WeeklyQuestIds.Deprogramming25 ), // Deprogramming - new WeeklyQuest(CreatureIds.KorKronLieutenant, WeeklyQuestIds.SecuringTheRamparts10, WeeklyQuestIds.SecuringTheRamparts25 ), // Securing the Ramparts - new WeeklyQuest(CreatureIds.RottingFrostGiant10, WeeklyQuestIds.SecuringTheRamparts10, WeeklyQuestIds.SecuringTheRamparts25 ), // Securing the Ramparts - new WeeklyQuest(CreatureIds.RottingFrostGiant25, WeeklyQuestIds.SecuringTheRamparts10, WeeklyQuestIds.SecuringTheRamparts25 ), // Securing the Ramparts - new WeeklyQuest(CreatureIds.AlchemistAdrianna, WeeklyQuestIds.ResidueRendezvous10, WeeklyQuestIds.ResidueRendezvous25 ), // Residue Rendezvous - new WeeklyQuest(CreatureIds.AlrinTheAgile, WeeklyQuestIds.BloodQuickening10, WeeklyQuestIds.BloodQuickening25 ), // Blood Quickening - new WeeklyQuest(CreatureIds.InfiltratorMincharBq, WeeklyQuestIds.BloodQuickening10, WeeklyQuestIds.BloodQuickening25 ), // Blood Quickening - new WeeklyQuest(CreatureIds.MincharBeamStalker, WeeklyQuestIds.BloodQuickening10, WeeklyQuestIds.BloodQuickening25 ), // Blood Quickening - new WeeklyQuest(CreatureIds.ValithriaDreamwalkerQuest, WeeklyQuestIds.RespiteForATornmentedSoul10, WeeklyQuestIds.RespiteForATornmentedSoul25), // Respite for a Tormented Soul - }; - - // NPCs spawned at Light's Hammer on Lich King dead - static Position JainaSpawnPos = new Position(-48.65278f, 2211.026f, 27.98586f, 3.124139f); - static Position MuradinSpawnPos = new Position(-47.34549f, 2208.087f, 27.98586f, 3.106686f); - static Position UtherSpawnPos = new Position(-26.58507f, 2211.524f, 30.19898f, 3.124139f); - static Position SylvanasSpawnPos = new Position(-41.45833f, 2222.891f, 27.98586f, 3.647738f); - - public InstanceIcecrownCitadel() : base("instance_icecrown_citadel", 631) { } - - class instance_icecrown_citadel_InstanceMapScript : InstanceScript - { - public instance_icecrown_citadel_InstanceMapScript(InstanceMap map) : base(map) - { - SetHeaders("IC"); - SetBossNumber(Bosses.MaxEncounters); - LoadBossBoundaries(boundaries); - LoadDoorData(doorData); - //HeroicAttempts = IccConst.MaxHeroicAttempts; - IsBonedEligible = true; - IsOozeDanceEligible = true; - IsNauseaEligible = true; - IsOrbWhispererEligible = true; - ColdflameJetsState = EncounterState.NotStarted; - UpperSpireTeleporterActiveState = EncounterState.NotStarted; - BloodQuickeningState = EncounterState.NotStarted; - } - - // A function to help reduce the number of lines for teleporter management. - void SetTeleporterState(GameObject go, bool usable) - { - if (usable) - { - go.RemoveFlag(GameObjectFlags.NotSelectable); - go.SetGoState(GameObjectState.Active); - } - else - { - go.AddFlag(GameObjectFlags.NotSelectable); - go.SetGoState(GameObjectState.Ready); - } - } - - public override void FillInitialWorldStates(InitWorldStates packet) - { - packet.AddState(WorldStates.ShowTimer, BloodQuickeningState == EncounterState.InProgress ? 1 : 0); - packet.AddState(WorldStates.ExecutionTime, BloodQuickeningMinutes); - //packet.AddState(WorldStates.ShowAttempts, instance.IsHeroic() ? 1 : 0); - //packet.AddState(WorldStates.AttemptsRemaining, (int)HeroicAttempts); - //packet.AddState(WorldStates.AttemptsMax, (int)IccConst.MaxHeroicAttempts); - } - - public override void OnPlayerEnter(Player player) - { - if (TeamInInstance == 0) - TeamInInstance = player.GetTeam(); - - if (GetBossState(Bosses.LadyDeathwhisper) == EncounterState.Done && GetBossState(Bosses.GunshipBattle) != EncounterState.Done) - SpawnGunship(); - } - - public override void OnCreatureCreate(Creature creature) - { - if (TeamInInstance == 0) - { - var players = instance.GetPlayers(); - if (!players.Empty()) - { - Player player = players.FirstOrDefault(); - if (player) - TeamInInstance = player.GetTeam(); - } - } - - switch (creature.GetEntry()) - { - case CreatureIds.KorKronGeneral: - if (TeamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.AllianceCommander); - break; - case CreatureIds.KorKronLieutenant: - if (TeamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.SkybreakerLieutenant); - break; - case CreatureIds.Tortunok: - if (TeamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.AlanaMoonstrike); - break; - case CreatureIds.GerardoTheSuave: - if (TeamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.TalanMoonstrike); - break; - case CreatureIds.UvlusBanefire: - if (TeamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.MalfusGrimfrost); - break; - case CreatureIds.IkfirusTheVile: - if (TeamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.Yili); - break; - case CreatureIds.VolGuk: - if (TeamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.Jedebia); - break; - case CreatureIds.HaraggTheUnseen: - if (TeamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.NibyTheAlmighty); - break; - case CreatureIds.GarroshHellscream: - if (TeamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.KingVarianWrynn); - break; - case CreatureIds.DeathbringerSaurfang: - DeathbringerSaurfangGUID = creature.GetGUID(); - break; - case CreatureIds.AllianceGunshipCannon: - case CreatureIds.HordeGunshipCannon: - creature.SetControlled(true, UnitState.Root); - break; - case CreatureIds.SeHighOverlordSaurfang: - if (TeamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.SeMuradinBronzebeard, creature.GetCreatureData()); - goto case CreatureIds.SeMuradinBronzebeard; - // no break; - case CreatureIds.SeMuradinBronzebeard: - DeathbringerSaurfangEventGUID = creature.GetGUID(); - creature.LastUsedScriptID = creature.GetScriptId(); - break; - case CreatureIds.SeKorKronReaver: - if (TeamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.SeSkybreakerMarine); - break; - case CreatureIds.Festergut: - FestergutGUID = creature.GetGUID(); - break; - case CreatureIds.Rotface: - RotfaceGUID = creature.GetGUID(); - break; - case CreatureIds.ProfessorPutricide: - ProfessorPutricideGUID = creature.GetGUID(); - break; - case CreatureIds.PrinceKeleseth: - BloodCouncilGUIDs[0] = creature.GetGUID(); - break; - case CreatureIds.PrinceTaldaram: - BloodCouncilGUIDs[1] = creature.GetGUID(); - break; - case CreatureIds.PrinceValanar: - BloodCouncilGUIDs[2] = creature.GetGUID(); - break; - case CreatureIds.BloodOrbController: - BloodCouncilControllerGUID = creature.GetGUID(); - break; - case CreatureIds.BloodQueenLanaThel: - BloodQueenLanaThelGUID = creature.GetGUID(); - break; - case CreatureIds.CrokScourgebane: - CrokScourgebaneGUID = creature.GetGUID(); - break; - // we can only do this because there are no gaps in their entries - case CreatureIds.CaptainArnath: - case CreatureIds.CaptainBrandon: - case CreatureIds.CaptainGrondel: - case CreatureIds.CaptainRupert: - CrokCaptainGUIDs[creature.GetEntry() - CreatureIds.CaptainArnath] = creature.GetGUID(); - break; - case CreatureIds.SisterSvalna: - SisterSvalnaGUID = creature.GetGUID(); - break; - case CreatureIds.ValithriaDreamwalker: - ValithriaDreamwalkerGUID = creature.GetGUID(); - break; - case CreatureIds.TheLichKingValithria: - ValithriaLichKingGUID = creature.GetGUID(); - break; - case CreatureIds.GreenDragonCombatTrigger: - ValithriaTriggerGUID = creature.GetGUID(); - break; - case CreatureIds.Sindragosa: - SindragosaGUID = creature.GetGUID(); - break; - case CreatureIds.Spinestalker: - SpinestalkerGUID = creature.GetGUID(); - break; - case CreatureIds.Rimefang: - RimefangGUID = creature.GetGUID(); - break; - case CreatureIds.InvisibleStalker: - // Teleporter visual at center - if (creature.GetExactDist2d(4357.052f, 2769.421f) < 10.0f) - creature.CastSpell(creature, InstanceSpells.ArthasTeleporterCeremony, false); - break; - case CreatureIds.TheLichKing: - TheLichKingGUID = creature.GetGUID(); - break; - case CreatureIds.HighlordTirionFordringLk: - HighlordTirionFordringGUID = creature.GetGUID(); - break; - case CreatureIds.TerenasMenethilFrostmourne: - case CreatureIds.TerenasMenethilFrostmourneH: - TerenasMenethilGUID = creature.GetGUID(); - break; - case CreatureIds.WickedSpirit: - // Remove corpse as soon as it dies (and respawn 10 seconds later) - creature.SetCorpseDelay(0); - creature.SetReactState(ReactStates.Passive); - break; - default: - break; - } - } - - public override void OnCreatureRemove(Creature creature) - { - if (creature.GetEntry() == CreatureIds.Sindragosa) - SindragosaGUID.Clear(); - } - - // Weekly quest spawn prevention - public override uint GetCreatureEntry(ulong guidLow, CreatureData data) - { - uint entry = data.Id; - switch (entry) - { - case CreatureIds.InfiltratorMinchar: - case CreatureIds.KorKronLieutenant: - case CreatureIds.AlchemistAdrianna: - case CreatureIds.AlrinTheAgile: - case CreatureIds.InfiltratorMincharBq: - case CreatureIds.MincharBeamStalker: - case CreatureIds.ValithriaDreamwalkerQuest: - { - for (byte questIndex = 0; questIndex < IccConst.WeeklyNPCs; ++questIndex) - { - if (WeeklyQuestData[questIndex].creatureEntry == entry) - { - byte diffIndex = (byte)((int)instance.GetDifficultyID() & 1); - if (!Global.PoolMgr.IsSpawnedObject(WeeklyQuestData[questIndex].questId[diffIndex])) - entry = 0; - break; - } - } - break; - } - case CreatureIds.HordeGunshipCannon: - case CreatureIds.OrgrimsHammerCrew: - case CreatureIds.SkyReaverKormBlackscar: - if (TeamInInstance == Team.Alliance) - return 0; - break; - case CreatureIds.AllianceGunshipCannon: - case CreatureIds.SkybreakerDeckhand: - case CreatureIds.HighCaptainJustinBartlett: - if (TeamInInstance == Team.Horde) - return 0; - break; - case CreatureIds.ZafodBoombox: - GameObjectTemplate go = Global.ObjectMgr.GetGameObjectTemplate(GameObjectIds.TheSkybreaker_A); - if (go != null) - if ((TeamInInstance == Team.Alliance && data.spawnPoint.GetMapId() == go.MoTransport.SpawnMap) || - (TeamInInstance == Team.Horde && data.spawnPoint.GetMapId() != go.MoTransport.SpawnMap)) - return entry; - return 0; - case CreatureIds.IGBMuradinBrozebeard: - if ((TeamInInstance == Team.Alliance && data.spawnPoint.GetPositionX() > 10.0f) || - (TeamInInstance == Team.Horde && data.spawnPoint.GetPositionX() < 10.0f)) - return entry; - return 0; - default: - break; - } - - return entry; - } - - public override uint GetGameObjectEntry(ulong spawnId, uint entry) - { - switch (entry) - { - case GameObjectIds.GunshipArmory_H_10N: - case GameObjectIds.GunshipArmory_H_25N: - case GameObjectIds.GunshipArmory_H_10H: - case GameObjectIds.GunshipArmory_H_25H: - if (TeamInInstance == Team.Alliance) - return 0; - break; - case GameObjectIds.GunshipArmory_A_10N: - case GameObjectIds.GunshipArmory_A_25N: - case GameObjectIds.GunshipArmory_A_10H: - case GameObjectIds.GunshipArmory_A_25H: - if (TeamInInstance == Team.Horde) - return 0; - break; - default: - break; - } - - return entry; - } - - public override void OnUnitDeath(Unit unit) - { - Creature creature = unit.ToCreature(); - if (!creature) - return; - - switch (creature.GetEntry()) - { - case CreatureIds.YmirjarBattleMaiden: - case CreatureIds.YmirjarDeathbringer: - case CreatureIds.YmirjarFrostbinder: - case CreatureIds.YmirjarHuntress: - case CreatureIds.YmirjarWarlord: - Creature crok = instance.GetCreature(CrokScourgebaneGUID); - if (crok) - crok.GetAI().SetGUID(creature.GetGUID(), Actions.VrykulDeath); - break; - case CreatureIds.FrostwingWhelp: - if (FrostwyrmGUIDs.Empty()) - return; - - if (creature.GetAI().GetData(1/*DATA_FROSTWYRM_OWNER*/) == DataTypes.Spinestalker) - { - SpinestalkerTrash.Remove(creature.GetSpawnId()); - if (SpinestalkerTrash.Empty()) - { - Creature spinestalk = instance.GetCreature(SpinestalkerGUID); - if (spinestalk) - spinestalk.GetAI().DoAction(Actions.StartFrostwyrm); - } - } - else - { - RimefangTrash.Remove(creature.GetSpawnId()); - if (RimefangTrash.Empty()) - { - Creature spinestalk = instance.GetCreature(RimefangGUID); - if (spinestalk) - spinestalk.GetAI().DoAction(Actions.StartFrostwyrm); - } - } - break; - case CreatureIds.Rimefang: - case CreatureIds.Spinestalker: - { - if (instance.IsHeroic() && HeroicAttempts == 0) - return; - - if (GetBossState(Bosses.Sindragosa) == EncounterState.Done) - return; - - FrostwyrmGUIDs.Remove(creature.GetSpawnId()); - if (FrostwyrmGUIDs.Empty()) - { - instance.LoadGrid(Sindragosa.SindragosaSpawnPos.GetPositionX(), Sindragosa.SindragosaSpawnPos.GetPositionY()); - Creature boss = instance.SummonCreature(CreatureIds.Sindragosa, Sindragosa.SindragosaSpawnPos); - if (boss) - boss.GetAI().DoAction(Actions.StartFrostwyrm); - } - break; - } - default: - break; - } - } - - public override void OnGameObjectCreate(GameObject go) - { - switch (go.GetEntry()) - { - case GameObjectIds.DoodadIcecrownIcewall02: - case GameObjectIds.LordMarrowgarIcewall: - case GameObjectIds.LordMarrowgarSEntrance: - case GameObjectIds.OratoryOfTheDamnedEntrance: - case GameObjectIds.OrangePlagueMonsterEntrance: - case GameObjectIds.GreenPlagueMonsterEntrance: - case GameObjectIds.ScientistEntrance: - case GameObjectIds.CrimsonHallDoor: - case GameObjectIds.BloodElfCouncilDoor: - case GameObjectIds.BloodElfCouncilDoorRight: - case GameObjectIds.DoodadIcecrownBloodprinceDoor01: - case GameObjectIds.DoodadIcecrownGrate01: - case GameObjectIds.GreenDragonBossEntrance: - case GameObjectIds.GreenDragonBossExit: - case GameObjectIds.DoodadIcecrownRoostportcullis02: - case GameObjectIds.DoodadIcecrownRoostportcullis03: - case GameObjectIds.SindragosaEntranceDoor: - case GameObjectIds.SindragosaShortcutEntranceDoor: - case GameObjectIds.SindragosaShortcutExitDoor: - case GameObjectIds.IceWall: - AddDoor(go, true); - break; - // these 2 gates are functional only on 25man modes - case GameObjectIds.DoodadIcecrownRoostportcullis01: - case GameObjectIds.DoodadIcecrownRoostportcullis04: - if (instance.Is25ManRaid()) - AddDoor(go, true); - break; - case GameObjectIds.LadyDeathwhisperElevator: - LadyDeathwisperElevatorGUID = go.GetGUID(); - if (GetBossState(Bosses.LadyDeathwhisper) == EncounterState.Done) - go.SetTransportState(GameObjectState.TransportActive); - break; - case GameObjectIds.TheSkybreaker_H: - case GameObjectIds.OrgrimsHammer_A: - EnemyGunshipGUID = go.GetGUID(); - break; - case GameObjectIds.GunshipArmory_H_10N: - case GameObjectIds.GunshipArmory_H_25N: - case GameObjectIds.GunshipArmory_H_10H: - case GameObjectIds.GunshipArmory_H_25H: - case GameObjectIds.GunshipArmory_A_10N: - case GameObjectIds.GunshipArmory_A_25N: - case GameObjectIds.GunshipArmory_A_10H: - case GameObjectIds.GunshipArmory_A_25H: - GunshipArmoryGUID = go.GetGUID(); - break; - case GameObjectIds.SaurfangSDoor: - DeathbringerSaurfangDoorGUID = go.GetGUID(); - AddDoor(go, true); - break; - case GameObjectIds.DeathbringerSCache10n: - case GameObjectIds.DeathbringerSCache25n: - case GameObjectIds.DeathbringerSCache10h: - case GameObjectIds.DeathbringerSCache25h: - DeathbringersCacheGUID = go.GetGUID(); - break; - case GameObjectIds.TransporterLichKing: - TeleporterLichKingGUID = go.GetGUID(); - if (GetBossState(Bosses.ProfessorPutricide) == EncounterState.Done && GetBossState(Bosses.BloodQueenLanaThel) == EncounterState.Done && GetBossState(Bosses.Sindragosa) == EncounterState.Done) - go.SetGoState(GameObjectState.Active); - break; - case GameObjectIds.TransporterUpperSpire: - TeleporterUpperSpireGUID = go.GetGUID(); - if (GetBossState(Bosses.DeathbringerSaurfang) != EncounterState.Done || GetData(DataTypes.UpperSpireTeleAct) != (uint)EncounterState.Done) - SetTeleporterState(go, false); - else - SetTeleporterState(go, true); - break; - case GameObjectIds.TransporterLightsHammer: - TeleporterLightsHammerGUID = go.GetGUID(); - SetTeleporterState(go, GetBossState(Bosses.LordMarrowgar) == EncounterState.Done); - break; - case GameObjectIds.TransporterRampart: - TeleporterRampartsGUID = go.GetGUID(); - SetTeleporterState(go, GetBossState(Bosses.LadyDeathwhisper) == EncounterState.Done); - break; - case GameObjectIds.TransporterDeathBringer: - TeleporterDeathBringerGUID = go.GetGUID(); - SetTeleporterState(go, GetBossState(Bosses.GunshipBattle) == EncounterState.Done); - break; - case GameObjectIds.TransporterOratory: - TeleporterOratoryGUID = go.GetGUID(); - SetTeleporterState(go, GetBossState(Bosses.LordMarrowgar) == EncounterState.Done); - break; - case GameObjectIds.TransporterSindragosa: - TeleporterSindragosaGUID = go.GetGUID(); - SetTeleporterState(go, GetBossState(Bosses.ValithriaDreamwalker) == EncounterState.Done); - break; - case GameObjectIds.PlagueSigil: - PlagueSigilGUID = go.GetGUID(); - if (GetBossState(Bosses.ProfessorPutricide) == EncounterState.Done) - HandleGameObject(PlagueSigilGUID, false, go); - break; - case GameObjectIds.BloodwingSigil: - BloodwingSigilGUID = go.GetGUID(); - if (GetBossState(Bosses.BloodQueenLanaThel) == EncounterState.Done) - HandleGameObject(BloodwingSigilGUID, false, go); - break; - case GameObjectIds.SigilOfTheFrostwing: - FrostwingSigilGUID = go.GetGUID(); - if (GetBossState(Bosses.Sindragosa) == EncounterState.Done) - HandleGameObject(FrostwingSigilGUID, false, go); - break; - case GameObjectIds.ScientistAirlockDoorCollision: - PutricideCollisionGUID = go.GetGUID(); - if (GetBossState(Bosses.Festergut) == EncounterState.Done && GetBossState(Bosses.Rotface) == EncounterState.Done) - HandleGameObject(PutricideCollisionGUID, true, go); - break; - case GameObjectIds.ScientistAirlockDoorOrange: - PutricideGateGUIDs[0] = go.GetGUID(); - if (GetBossState(Bosses.Festergut) == EncounterState.Done && GetBossState(Bosses.Rotface) == EncounterState.Done) - go.SetGoState(GameObjectState.ActiveAlternative); - else if (GetBossState(Bosses.Festergut) == EncounterState.Done) - HandleGameObject(PutricideGateGUIDs[1], false, go); - break; - case GameObjectIds.ScientistAirlockDoorGreen: - PutricideGateGUIDs[1] = go.GetGUID(); - if (GetBossState(Bosses.Rotface) == EncounterState.Done && GetBossState(Bosses.Festergut) == EncounterState.Done) - go.SetGoState(GameObjectState.ActiveAlternative); - else if (GetBossState(Bosses.Rotface) == EncounterState.Done) - HandleGameObject(PutricideGateGUIDs[1], false, go); - break; - case GameObjectIds.DoodadIcecrownOrangetubes02: - PutricidePipeGUIDs[0] = go.GetGUID(); - if (GetBossState(Bosses.Festergut) == EncounterState.Done) - HandleGameObject(PutricidePipeGUIDs[0], true, go); - break; - case GameObjectIds.DoodadIcecrownGreentubes02: - PutricidePipeGUIDs[1] = go.GetGUID(); - if (GetBossState(Bosses.Rotface) == EncounterState.Done) - HandleGameObject(PutricidePipeGUIDs[1], true, go); - break; - case GameObjectIds.DrinkMe: - PutricideTableGUID = go.GetGUID(); - break; - case GameObjectIds.CacheOfTheDreamwalker10n: - case GameObjectIds.CacheOfTheDreamwalker25n: - case GameObjectIds.CacheOfTheDreamwalker10h: - case GameObjectIds.CacheOfTheDreamwalker25h: - Creature valithria = instance.GetCreature(ValithriaDreamwalkerGUID); - if (valithria) - go.SetLootRecipient(valithria.GetLootRecipient(), valithria.GetLootRecipientGroup()); - go.RemoveFlag(GameObjectFlags.Locked | GameObjectFlags.NotSelectable | GameObjectFlags.NoDespawn); - break; - case GameObjectIds.ArthasPlatform: - ArthasPlatformGUID = go.GetGUID(); - break; - case GameObjectIds.ArthasPrecipice: - ArthasPrecipiceGUID = go.GetGUID(); - break; - case GameObjectIds.DoodadIcecrownThronefrostyedge01: - FrozenThroneEdgeGUID = go.GetGUID(); - break; - case GameObjectIds.DoodadIcecrownThronefrostywind01: - FrozenThroneWindGUID = go.GetGUID(); - break; - case GameObjectIds.DoodadIcecrownSnowedgewarning01: - FrozenThroneWarningGUID = go.GetGUID(); - break; - case GameObjectIds.FrozenLavaman: - FrozenBolvarGUID = go.GetGUID(); - if (GetBossState(Bosses.TheLichKing) == EncounterState.Done) - go.SetRespawnTime(7 * Time.Day); - break; - case GameObjectIds.LavamanPillarsChained: - PillarsChainedGUID = go.GetGUID(); - if (GetBossState(Bosses.TheLichKing) == EncounterState.Done) - go.SetRespawnTime(7 * Time.Day); - break; - case GameObjectIds.LavamanPillarsUnchained: - PillarsUnchainedGUID = go.GetGUID(); - if (GetBossState(Bosses.TheLichKing) == EncounterState.Done) - go.SetRespawnTime(7 * Time.Day); - break; - default: - break; - } - } - - public override void OnGameObjectRemove(GameObject go) - { - switch (go.GetEntry()) - { - case GameObjectIds.DoodadIcecrownIcewall02: - case GameObjectIds.LordMarrowgarIcewall: - case GameObjectIds.LordMarrowgarSEntrance: - case GameObjectIds.OratoryOfTheDamnedEntrance: - case GameObjectIds.SaurfangSDoor: - case GameObjectIds.OrangePlagueMonsterEntrance: - case GameObjectIds.GreenPlagueMonsterEntrance: - case GameObjectIds.ScientistEntrance: - case GameObjectIds.CrimsonHallDoor: - case GameObjectIds.BloodElfCouncilDoor: - case GameObjectIds.BloodElfCouncilDoorRight: - case GameObjectIds.DoodadIcecrownBloodprinceDoor01: - case GameObjectIds.DoodadIcecrownGrate01: - case GameObjectIds.GreenDragonBossEntrance: - case GameObjectIds.GreenDragonBossExit: - case GameObjectIds.DoodadIcecrownRoostportcullis01: - case GameObjectIds.DoodadIcecrownRoostportcullis02: - case GameObjectIds.DoodadIcecrownRoostportcullis03: - case GameObjectIds.DoodadIcecrownRoostportcullis04: - case GameObjectIds.SindragosaEntranceDoor: - case GameObjectIds.SindragosaShortcutEntranceDoor: - case GameObjectIds.SindragosaShortcutExitDoor: - case GameObjectIds.IceWall: - AddDoor(go, false); - break; - case GameObjectIds.TheSkybreaker_A: - case GameObjectIds.OrgrimsHammer_H: - GunshipGUID.Clear(); - break; - default: - break; - } - } - - public override uint GetData(uint type) - { - switch (type) - { - case DataTypes.SindragosaFrostwyrms: - return (uint)FrostwyrmGUIDs.Count; - case DataTypes.Spinestalker: - return (uint)SpinestalkerTrash.Count; - case DataTypes.Rimefang: - return (uint)RimefangTrash.Count; - case DataTypes.ColdflameJets: - return (uint)ColdflameJetsState; - case DataTypes.UpperSpireTeleAct: - return (uint)UpperSpireTeleporterActiveState; - case DataTypes.TeamInInstance: - return (uint)TeamInInstance; - case DataTypes.BloodQuickeningState: - return (uint)BloodQuickeningState; - case DataTypes.HeroicAttempts: - return HeroicAttempts; - default: - break; - } - - return 0; - } - - public override ObjectGuid GetGuidData(uint type) - { - switch (type) - { - case Bosses.GunshipBattle: - return GunshipGUID; - case DataTypes.EnemyGunship: - return EnemyGunshipGUID; - case Bosses.DeathbringerSaurfang: - return DeathbringerSaurfangGUID; - case DataTypes.SaurfangEventNpc: - return DeathbringerSaurfangEventGUID; - case GameObjectIds.SaurfangSDoor: - return DeathbringerSaurfangDoorGUID; - case Bosses.Festergut: - return FestergutGUID; - case Bosses.Rotface: - return RotfaceGUID; - case Bosses.ProfessorPutricide: - return ProfessorPutricideGUID; - case DataTypes.PutricideTable: - return PutricideTableGUID; - case DataTypes.PrinceKelesethGuid: - return BloodCouncilGUIDs[0]; - case DataTypes.PrinceTaldaramGuid: - return BloodCouncilGUIDs[1]; - case DataTypes.PrinceValanarGuid: - return BloodCouncilGUIDs[2]; - case DataTypes.BloodPrincesControl: - return BloodCouncilControllerGUID; - case Bosses.BloodQueenLanaThel: - return BloodQueenLanaThelGUID; - case DataTypes.CrokScourgebane: - return CrokScourgebaneGUID; - case DataTypes.CaptainArnath: - case DataTypes.CaptainBrandon: - case DataTypes.CaptainGrondel: - case DataTypes.CaptainRupert: - return CrokCaptainGUIDs[type - DataTypes.CaptainArnath]; - case Bosses.SisterSvalna: - return SisterSvalnaGUID; - case Bosses.ValithriaDreamwalker: - return ValithriaDreamwalkerGUID; - case DataTypes.ValithriaLichKing: - return ValithriaLichKingGUID; - case DataTypes.ValithriaTrigger: - return ValithriaTriggerGUID; - case Bosses.Sindragosa: - return SindragosaGUID; - case DataTypes.Spinestalker: - return SpinestalkerGUID; - case DataTypes.Rimefang: - return RimefangGUID; - case Bosses.TheLichKing: - return TheLichKingGUID; - case DataTypes.HighlordTirionFordring: - return HighlordTirionFordringGUID; - case DataTypes.ArthasPlatform: - return ArthasPlatformGUID; - case DataTypes.TerenasMenethil: - return TerenasMenethilGUID; - default: - break; - } - - return ObjectGuid.Empty; - } - - public override bool SetBossState(uint type, EncounterState state) - { - if (!base.SetBossState(type, state)) - return false; - - switch (type) - { - case Bosses.LordMarrowgar: - if (state == EncounterState.Done) - { - GameObject teleporter = instance.GetGameObject(TeleporterLightsHammerGUID); - if (teleporter) - SetTeleporterState(teleporter, true); - - teleporter = instance.GetGameObject(TeleporterOratoryGUID); - if (teleporter) - SetTeleporterState(teleporter, true); - } - break; - case Bosses.LadyDeathwhisper: - if (state == EncounterState.Done) - { - GameObject teleporter = instance.GetGameObject(TeleporterRampartsGUID); - if (teleporter) - SetTeleporterState(teleporter, true); - - GameObject elevator = instance.GetGameObject(LadyDeathwisperElevatorGUID); - if (elevator) - elevator.SetTransportState(GameObjectState.TransportActive); - - SpawnGunship(); - } - break; - case Bosses.GunshipBattle: - if (state == EncounterState.Done) - { - GameObject teleporter = instance.GetGameObject(TeleporterDeathBringerGUID); - if (teleporter) - SetTeleporterState(teleporter, true); - - GameObject loot = instance.GetGameObject(GunshipArmoryGUID); - if (loot) - loot.RemoveFlag(GameObjectFlags.Locked | GameObjectFlags.NotSelectable | GameObjectFlags.NoDespawn); - } - else if (state == EncounterState.Fail) - _events.ScheduleEvent(TimedEvents.RespawnGunship, 30000); - break; - case Bosses.DeathbringerSaurfang: - switch (state) - { - case EncounterState.Done: - { - GameObject loot = instance.GetGameObject(DeathbringersCacheGUID); - if (loot) - { - Creature deathbringer = instance.GetCreature(DeathbringerSaurfangGUID); - if (deathbringer) - loot.SetLootRecipient(deathbringer.GetLootRecipient(), deathbringer.GetLootRecipientGroup()); - loot.RemoveFlag(GameObjectFlags.Locked | GameObjectFlags.NotSelectable | GameObjectFlags.NoDespawn); - } - - GameObject teleporter = instance.GetGameObject(TeleporterUpperSpireGUID); - if (teleporter) - SetTeleporterState(teleporter, true); - - teleporter = instance.GetGameObject(TeleporterDeathBringerGUID); - if (teleporter) - SetTeleporterState(teleporter, true); - break; - } - case EncounterState.NotStarted: - { - GameObject teleporter = instance.GetGameObject(TeleporterDeathBringerGUID); - if (teleporter) - SetTeleporterState(teleporter, true); - break; - } - case EncounterState.InProgress: - { - GameObject teleporter = instance.GetGameObject(TeleporterDeathBringerGUID); - if (teleporter) - SetTeleporterState(teleporter, false); - break; - } - default: - break; - } - break; - case Bosses.Festergut: - if (state == EncounterState.Done) - { - if (GetBossState(Bosses.Rotface) == EncounterState.Done) - { - HandleGameObject(PutricideCollisionGUID, true); - GameObject go = instance.GetGameObject(PutricideGateGUIDs[0]); - if (go) - go.SetGoState(GameObjectState.ActiveAlternative); - - go = instance.GetGameObject(PutricideGateGUIDs[1]); - if (go) - go.SetGoState(GameObjectState.ActiveAlternative); - } - else - HandleGameObject(PutricideGateGUIDs[0], false); - HandleGameObject(PutricidePipeGUIDs[0], true); - } - break; - case Bosses.Rotface: - if (state == EncounterState.Done) - { - if (GetBossState(Bosses.Festergut) == EncounterState.Done) - { - HandleGameObject(PutricideCollisionGUID, true); - GameObject go = instance.GetGameObject(PutricideGateGUIDs[0]); - if (go) - go.SetGoState(GameObjectState.ActiveAlternative); - - go = instance.GetGameObject(PutricideGateGUIDs[1]); - if (go) - go.SetGoState(GameObjectState.ActiveAlternative); - } - else - HandleGameObject(PutricideGateGUIDs[1], false); - HandleGameObject(PutricidePipeGUIDs[1], true); - } - break; - case Bosses.ProfessorPutricide: - HandleGameObject(PlagueSigilGUID, state != EncounterState.Done); - if (state == EncounterState.Done) - CheckLichKingAvailability(); - if (instance.IsHeroic()) - { - if (state == EncounterState.Fail && HeroicAttempts != 0) - { - --HeroicAttempts; - DoUpdateWorldState(WorldStates.AttemptsRemaining, HeroicAttempts); - if (HeroicAttempts == 0) - { - Creature putricide = instance.GetCreature(ProfessorPutricideGUID); - if (putricide) - putricide.DespawnOrUnsummon(); - } - } - } - break; - case Bosses.BloodQueenLanaThel: - HandleGameObject(BloodwingSigilGUID, state != EncounterState.Done); - if (state == EncounterState.Done) - CheckLichKingAvailability(); - if (instance.IsHeroic()) - { - if (state == EncounterState.Fail && HeroicAttempts != 0) - { - --HeroicAttempts; - DoUpdateWorldState(WorldStates.AttemptsRemaining, HeroicAttempts); - if (HeroicAttempts == 0) - { - Creature bq = instance.GetCreature(BloodQueenLanaThelGUID); - if (bq) - bq.DespawnOrUnsummon(); - } - } - } - break; - case Bosses.ValithriaDreamwalker: - if (state == EncounterState.Done) - { - if (Global.PoolMgr.IsSpawnedObject(WeeklyQuestData[8].questId[(int)instance.GetDifficultyID() & 1])) - instance.SummonCreature(CreatureIds.ValithriaDreamwalkerQuest, ValithriaDreamwalker.ValithriaSpawnPos); - - GameObject teleporter = instance.GetGameObject(TeleporterSindragosaGUID); - if (teleporter) - SetTeleporterState(teleporter, true); - } - break; - case Bosses.Sindragosa: - HandleGameObject(FrostwingSigilGUID, state != EncounterState.Done); - if (state == EncounterState.Done) - CheckLichKingAvailability(); - if (instance.IsHeroic()) - { - if (state == EncounterState.Fail && HeroicAttempts != 0) - { - --HeroicAttempts; - DoUpdateWorldState(WorldStates.AttemptsRemaining, HeroicAttempts); - if (HeroicAttempts == 0) - { - Creature sindra = instance.GetCreature(SindragosaGUID); - if (sindra) - sindra.DespawnOrUnsummon(); - } - } - } - break; - case Bosses.TheLichKing: - { - // set the platform as active object to dramatically increase visibility range - // note: "active" gameobjects do not block grid unloading - GameObject precipice = instance.GetGameObject(ArthasPrecipiceGUID); - if (precipice) - precipice.SetActive(state == EncounterState.InProgress); - - GameObject platform = instance.GetGameObject(ArthasPlatformGUID); - if (platform) - platform.SetActive(state == EncounterState.InProgress); - - if (instance.IsHeroic()) - { - if (state == EncounterState.Fail && HeroicAttempts != 0) - { - --HeroicAttempts; - DoUpdateWorldState(WorldStates.AttemptsRemaining, HeroicAttempts); - if (HeroicAttempts == 0) - { - Creature theLichKing = instance.GetCreature(TheLichKingGUID); - if (theLichKing) - theLichKing.DespawnOrUnsummon(); - } - } - } - - if (state == EncounterState.Done) - { - GameObject bolvar = instance.GetGameObject(FrozenBolvarGUID); - if (bolvar) - bolvar.SetRespawnTime(7 * Time.Day); - - GameObject pillars = instance.GetGameObject(PillarsChainedGUID); - if (pillars) - pillars.SetRespawnTime(7 * Time.Day); - - pillars = instance.GetGameObject(PillarsUnchainedGUID); - if (pillars) - pillars.SetRespawnTime(7 * Time.Day); - - instance.SummonCreature(CreatureIds.LadyJainaProudmooreQuest, JainaSpawnPos); - instance.SummonCreature(CreatureIds.MuradinBronzaBeardQuest, MuradinSpawnPos); - instance.SummonCreature(CreatureIds.UtherTheLightBringerQuest, UtherSpawnPos); - instance.SummonCreature(CreatureIds.LadySylvanasWindrunnerQuest, SylvanasSpawnPos); - } - break; - } - default: - break; - } - return true; - } - - void SpawnGunship() - { - if (GunshipGUID.IsEmpty()) - { - SetBossState(Bosses.GunshipBattle, EncounterState.NotStarted); - uint gunshipEntry = TeamInInstance == Team.Horde ? GameObjectIds.OrgrimsHammer_H : GameObjectIds.TheSkybreaker_A; - Transport gunship = Global.TransportMgr.CreateTransport(gunshipEntry, 0, instance); - if (gunship) - GunshipGUID = gunship.GetGUID(); - } - } - - public override void SetData(uint type, uint data) - { - switch (type) - { - case DataTypes.BonedAchievement: - IsBonedEligible = data != 0 ? true : false; - break; - case DataTypes.OozeDanceAchievement: - IsOozeDanceEligible = data != 0 ? true : false; - break; - case DataTypes.NauseaAchievement: - IsNauseaEligible = data != 0 ? true : false; - break; - case DataTypes.OrbWhispererAchievement: - IsOrbWhispererEligible = data != 0 ? true : false; - break; - case DataTypes.SindragosaFrostwyrms: - FrostwyrmGUIDs.Add(data); - break; - case DataTypes.Spinestalker: - SpinestalkerTrash.Add(data); - break; - case DataTypes.Rimefang: - RimefangTrash.Add(data); - break; - case DataTypes.ColdflameJets: - ColdflameJetsState = (EncounterState)data; - if (ColdflameJetsState == EncounterState.Done) - SaveToDB(); - break; - case DataTypes.BloodQuickeningState: - { - // skip if nothing changes - if (BloodQuickeningState == (EncounterState)data) - break; - - // 5 is the index of Blood Quickening - if (!Global.PoolMgr.IsSpawnedObject(WeeklyQuestData[5].questId[(int)instance.GetDifficultyID() & 1])) - break; - - switch ((EncounterState)data) - { - case EncounterState.InProgress: - _events.ScheduleEvent(TimedEvents.UpdateExecutionTime, 60000); - BloodQuickeningMinutes = 30; - DoUpdateWorldState(WorldStates.ShowTimer, 1); - DoUpdateWorldState(WorldStates.ExecutionTime, BloodQuickeningMinutes); - break; - case EncounterState.Done: - _events.CancelEvent(TimedEvents.UpdateExecutionTime); - BloodQuickeningMinutes = 0; - DoUpdateWorldState(WorldStates.ShowTimer, 0); - break; - default: - break; - } - - BloodQuickeningState = (EncounterState)data; - SaveToDB(); - break; - } - case DataTypes.UpperSpireTeleAct: - UpperSpireTeleporterActiveState = (EncounterState)data; - if (UpperSpireTeleporterActiveState == EncounterState.Done) - { - GameObject go = instance.GetGameObject(TeleporterUpperSpireGUID); - if (go) - SetTeleporterState(go, true); - SaveToDB(); - } - break; - default: - break; - } - } - - public override bool CheckAchievementCriteriaMeet(uint criteria_id, Player source, Unit target, uint miscvalue1) - { - switch (criteria_id) - { - case AchievementCriteriaIds.Boned10n: - case AchievementCriteriaIds.Boned25n: - case AchievementCriteriaIds.Boned10h: - case AchievementCriteriaIds.Boned25h: - return IsBonedEligible; - case AchievementCriteriaIds.DancesWithOozes10: - case AchievementCriteriaIds.DancesWithOozes25: - case AchievementCriteriaIds.DancesWithOozes10H: - case AchievementCriteriaIds.DancesWithOozes25H: - return IsOozeDanceEligible; - case AchievementCriteriaIds.Nausea10: - case AchievementCriteriaIds.Nausea25: - case AchievementCriteriaIds.Nausea10H: - case AchievementCriteriaIds.Nausea25H: - return IsNauseaEligible; - case AchievementCriteriaIds.OrbWhisperer10: - case AchievementCriteriaIds.OrbWhisperer25: - case AchievementCriteriaIds.OrbWhisperer10H: - case AchievementCriteriaIds.OrbWhisperer25H: - return IsOrbWhispererEligible; - // Only one criteria for both modes, need to do it like this - case AchievementCriteriaIds.KillLanaThel10m: - case AchievementCriteriaIds.OnceBittenTwiceShy10: - case AchievementCriteriaIds.OnceBittenTwiceShy10V: - return instance.ToInstanceMap().GetMaxPlayers() == 10; - case AchievementCriteriaIds.KillLanaThel25m: - case AchievementCriteriaIds.OnceBittenTwiceShy25: - case AchievementCriteriaIds.OnceBittenTwiceShy25V: - return instance.ToInstanceMap().GetMaxPlayers() == 25; - default: - break; - } - - return false; - } - - public override bool CheckRequiredBosses(uint bossId, Player player = null) - { - if (player && player.GetSession().HasPermission(RBACPermissions.SkipCheckInstanceRequiredBosses)) - return true; - - switch (bossId) - { - case Bosses.TheLichKing: - if (!CheckPlagueworks(bossId)) - return false; - if (!CheckCrimsonHalls(bossId)) - return false; - if (!CheckFrostwingHalls(bossId)) - return false; - break; - case Bosses.Sindragosa: - case Bosses.ValithriaDreamwalker: - if (!CheckFrostwingHalls(bossId)) - return false; - break; - case Bosses.BloodQueenLanaThel: - case Bosses.BloodPrinceCouncil: - if (!CheckCrimsonHalls(bossId)) - return false; - break; - case Bosses.Festergut: - case Bosses.Rotface: - case Bosses.ProfessorPutricide: - if (!CheckPlagueworks(bossId)) - return false; - break; - default: - break; - } - - if (!CheckLowerSpire(bossId)) - return false; - - return true; - } - - bool CheckPlagueworks(uint bossId) - { - switch (bossId) - { - case Bosses.TheLichKing: - if (GetBossState(Bosses.ProfessorPutricide) != EncounterState.Done) - return false; - goto case Bosses.ProfessorPutricide; - // no break - case Bosses.ProfessorPutricide: - if (GetBossState(Bosses.Festergut) != EncounterState.Done || GetBossState(Bosses.Rotface) != EncounterState.Done) - return false; - break; - default: - break; - } - - return true; - } - - bool CheckCrimsonHalls(uint bossId) - { - switch (bossId) - { - case Bosses.TheLichKing: - if (GetBossState(Bosses.BloodQueenLanaThel) != EncounterState.Done) - return false; - goto case Bosses.BloodQueenLanaThel; - // no break - case Bosses.BloodQueenLanaThel: - if (GetBossState(Bosses.BloodPrinceCouncil) != EncounterState.Done) - return false; - break; - default: - break; - } - - return true; - } - - bool CheckFrostwingHalls(uint bossId) - { - switch (bossId) - { - case Bosses.TheLichKing: - if (GetBossState(Bosses.Sindragosa) != EncounterState.Done) - return false; - goto case Bosses.Sindragosa; - // no break - case Bosses.Sindragosa: - if (GetBossState(Bosses.ValithriaDreamwalker) != EncounterState.Done) - return false; - break; - default: - break; - } - - return true; - } - - bool CheckLowerSpire(uint bossId) - { - switch (bossId) - { - case Bosses.TheLichKing: - case Bosses.Sindragosa: - case Bosses.BloodQueenLanaThel: - case Bosses.ProfessorPutricide: - case Bosses.ValithriaDreamwalker: - case Bosses.BloodPrinceCouncil: - case Bosses.Rotface: - case Bosses.Festergut: - if (GetBossState(Bosses.DeathbringerSaurfang) != EncounterState.Done) - return false; - goto case Bosses.DeathbringerSaurfang; - // no break - case Bosses.DeathbringerSaurfang: - if (GetBossState(Bosses.GunshipBattle) != EncounterState.Done) - return false; - goto case Bosses.GunshipBattle; - // no break - case Bosses.GunshipBattle: - if (GetBossState(Bosses.LadyDeathwhisper) != EncounterState.Done) - return false; - goto case Bosses.LadyDeathwhisper; - // no break - case Bosses.LadyDeathwhisper: - if (GetBossState(Bosses.LordMarrowgar) != EncounterState.Done) - return false; - break; - } - - return true; - } - - void CheckLichKingAvailability() - { - if (GetBossState(Bosses.ProfessorPutricide) == EncounterState.Done && GetBossState(Bosses.BloodQueenLanaThel) == EncounterState.Done && GetBossState(Bosses.Sindragosa) == EncounterState.Done) - { - GameObject teleporter = instance.GetGameObject(TeleporterLichKingGUID); - if (teleporter) - { - teleporter.SetGoState(GameObjectState.Active); - - List stalkers = new List(); - teleporter.GetCreatureListWithEntryInGrid(stalkers, CreatureIds.InvisibleStalker, 100.0f); - if (stalkers.Empty()) - return; - - stalkers.Sort(new ObjectDistanceOrderPred(teleporter)); - stalkers.FirstOrDefault().CastSpell((Unit)null, InstanceSpells.ArthasTeleporterCeremony, false); - stalkers.RemoveAt(0); - foreach (var creature in stalkers) - creature.GetAI().Reset(); - } - } - } - - public override void WriteSaveDataMore(StringBuilder data) - { - data.AppendFormat("{0} {1} {2} {3} {4}", HeroicAttempts, ColdflameJetsState, BloodQuickeningState, BloodQuickeningMinutes, UpperSpireTeleporterActiveState); - } - - public override void ReadSaveDataMore(StringArguments data) - { - HeroicAttempts = data.NextUInt32(); - - EncounterState temp = (EncounterState)data.NextUInt32(); - if (temp == EncounterState.InProgress) - ColdflameJetsState = EncounterState.NotStarted; - else - ColdflameJetsState = temp != 0 ? EncounterState.Done : EncounterState.NotStarted; - - temp = (EncounterState)data.NextUInt32(); - BloodQuickeningState = temp != 0 ? EncounterState.Done : EncounterState.NotStarted; // DONE means finished (not success/fail) - BloodQuickeningMinutes = data.NextUInt16(); - - temp = (EncounterState)data.NextUInt32(); - UpperSpireTeleporterActiveState = temp != 0 ? EncounterState.Done : EncounterState.NotStarted; - } - - public override void Update(uint diff) - { - if (BloodQuickeningState != EncounterState.InProgress && GetBossState(Bosses.TheLichKing) != EncounterState.InProgress && GetBossState(Bosses.GunshipBattle) != EncounterState.Fail) - return; - - _events.Update(diff); - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case TimedEvents.UpdateExecutionTime: - { - --BloodQuickeningMinutes; - if (BloodQuickeningMinutes != 0) - { - _events.ScheduleEvent(TimedEvents.UpdateExecutionTime, 60000); - DoUpdateWorldState(WorldStates.ShowTimer, 1); - DoUpdateWorldState(WorldStates.ExecutionTime, BloodQuickeningMinutes); - } - else - { - BloodQuickeningState = EncounterState.Done; - DoUpdateWorldState(WorldStates.ShowTimer, 0); - Creature bq = instance.GetCreature(BloodQueenLanaThelGUID); - if (bq) - bq.GetAI().DoAction(Actions.KillMinchar); - } - SaveToDB(); - break; - } - case TimedEvents.QuakeShatter: - { - GameObject platform = instance.GetGameObject(ArthasPlatformGUID); - if (platform) - platform.SetDestructibleState(GameObjectDestructibleState.Damaged); - - GameObject edge = instance.GetGameObject(FrozenThroneEdgeGUID); - if (edge) - edge.SetGoState(GameObjectState.Active); - - GameObject wind = instance.GetGameObject(FrozenThroneWindGUID); - if (wind) - wind.SetGoState(GameObjectState.Ready); - - GameObject warning = instance.GetGameObject(FrozenThroneWarningGUID); - if (warning) - warning.SetGoState(GameObjectState.Ready); - - Creature theLichKing = instance.GetCreature(TheLichKingGUID); - if (theLichKing) - theLichKing.GetAI().DoAction(Actions.RestoreLight); - break; - } - case TimedEvents.RebuildPlatform: - GameObject platform1 = instance.GetGameObject(ArthasPlatformGUID); - if (platform1) - platform1.SetDestructibleState(GameObjectDestructibleState.Rebuilding); - - GameObject edge1 = instance.GetGameObject(FrozenThroneEdgeGUID); - if (edge1) - edge1.SetGoState(GameObjectState.Ready); - - GameObject wind1 = instance.GetGameObject(FrozenThroneWindGUID); - if (wind1) - wind1.SetGoState(GameObjectState.Active); - break; - case TimedEvents.RespawnGunship: - SpawnGunship(); - break; - default: - break; - } - }); - } - - public override void ProcessEvent(WorldObject source, uint eventId) - { - switch (eventId) - { - case EventIds.EnemyGunshipDespawn: - if (GetBossState(Bosses.GunshipBattle) == EncounterState.Done) - source.AddObjectToRemoveList(); - break; - case EventIds.EnemyGunshipCombat: - Creature captain = source.FindNearestCreature(TeamInInstance == Team.Horde ? CreatureIds.IGBHighOverlordSaurfang : CreatureIds.IGBMuradinBrozebeard, 100.0f); - if (captain) - captain.GetAI().DoAction(Actions.EnemyGunshipTalk); - goto case EventIds.PlayersGunshipSpawn; - // no break; - case EventIds.PlayersGunshipSpawn: - case EventIds.PlayersGunshipCombat: - GameObject go = source.ToGameObject(); - if (go) - { - Transport transport = go.ToTransport(); - if (transport) - transport.EnableMovement(false); - } - break; - case EventIds.PlayersGunshipSaurfang: - Creature _captain = source.FindNearestCreature(TeamInInstance == Team.Horde ? CreatureIds.IGBHighOverlordSaurfang : CreatureIds.IGBMuradinBrozebeard, 100.0f); - if (_captain) - _captain.GetAI().DoAction(Actions.ExitShip); - GameObject _go = source.ToGameObject(); - if (_go) - { - Transport transport = _go.ToTransport(); - if (transport) - transport.EnableMovement(false); - } - break; - case EventIds.Quake: - GameObject warning = instance.GetGameObject(FrozenThroneWarningGUID); - if (warning) - warning.SetGoState(GameObjectState.Active); - _events.ScheduleEvent(TimedEvents.QuakeShatter, 5000); - break; - case EventIds.SeconsRemorselessWinter: - GameObject platform = instance.GetGameObject(ArthasPlatformGUID); - if (platform) - { - platform.SetDestructibleState(GameObjectDestructibleState.Destroyed); - _events.ScheduleEvent(TimedEvents.RebuildPlatform, 1500); - } - break; - case EventIds.TeleportToFrostmourne: // Harvest Soul (normal mode) - Creature terenas = instance.SummonCreature(CreatureIds.TerenasMenethilFrostmourne, TheLichKing.TerenasSpawn, null, 63000); - if (terenas) - { - terenas.GetAI().DoAction(Actions.FrostmourneIntro); - List triggers = new List(); - terenas.GetCreatureListWithEntryInGrid(triggers, CreatureIds.WorldTriggerInfiniteAoi, 100.0f); - if (!triggers.Empty()) - { - triggers.Sort(new ObjectDistanceOrderPred(terenas, false)); - Unit visual = triggers.FirstOrDefault(); - visual.CastSpell(visual, InstanceSpells.FrostmourneTeleportVisual, true); - } - Creature warden = instance.SummonCreature(CreatureIds.SpiritWarden, TheLichKing.SpiritWardenSpawn, null, 63000); - if (warden) - { - terenas.GetAI().AttackStart(warden); - warden.GetThreatManager().AddThreat(terenas, 300000.0f); - } - } - break; - } - } - - ObjectGuid LadyDeathwisperElevatorGUID; - ObjectGuid GunshipGUID; - ObjectGuid EnemyGunshipGUID; - ObjectGuid GunshipArmoryGUID; - ObjectGuid DeathbringerSaurfangGUID; - ObjectGuid DeathbringerSaurfangDoorGUID; - ObjectGuid DeathbringerSaurfangEventGUID; // Muradin Bronzebeard or High Overlord Saurfang - ObjectGuid DeathbringersCacheGUID; - ObjectGuid TeleporterLichKingGUID; - ObjectGuid TeleporterUpperSpireGUID; - ObjectGuid TeleporterLightsHammerGUID; - ObjectGuid TeleporterRampartsGUID; - ObjectGuid TeleporterDeathBringerGUID; - ObjectGuid TeleporterOratoryGUID; - ObjectGuid TeleporterSindragosaGUID; - ObjectGuid PlagueSigilGUID; - ObjectGuid BloodwingSigilGUID; - ObjectGuid FrostwingSigilGUID; - ObjectGuid[] PutricidePipeGUIDs = new ObjectGuid[2]; - ObjectGuid[] PutricideGateGUIDs = new ObjectGuid[2]; - ObjectGuid PutricideCollisionGUID; - ObjectGuid FestergutGUID; - ObjectGuid RotfaceGUID; - ObjectGuid ProfessorPutricideGUID; - ObjectGuid PutricideTableGUID; - ObjectGuid[] BloodCouncilGUIDs = new ObjectGuid[3]; - ObjectGuid BloodCouncilControllerGUID; - ObjectGuid BloodQueenLanaThelGUID; - ObjectGuid CrokScourgebaneGUID; - ObjectGuid[] CrokCaptainGUIDs = new ObjectGuid[4]; - ObjectGuid SisterSvalnaGUID; - ObjectGuid ValithriaDreamwalkerGUID; - ObjectGuid ValithriaLichKingGUID; - ObjectGuid ValithriaTriggerGUID; - ObjectGuid SindragosaGUID; - ObjectGuid SpinestalkerGUID; - ObjectGuid RimefangGUID; - ObjectGuid TheLichKingGUID; - ObjectGuid HighlordTirionFordringGUID; - ObjectGuid TerenasMenethilGUID; - ObjectGuid ArthasPlatformGUID; - ObjectGuid ArthasPrecipiceGUID; - ObjectGuid FrozenThroneEdgeGUID; - ObjectGuid FrozenThroneWindGUID; - ObjectGuid FrozenThroneWarningGUID; - ObjectGuid FrozenBolvarGUID; - ObjectGuid PillarsChainedGUID; - ObjectGuid PillarsUnchainedGUID; - Team TeamInInstance; - EncounterState ColdflameJetsState; - EncounterState UpperSpireTeleporterActiveState; - List FrostwyrmGUIDs = new List(); - List SpinestalkerTrash = new List(); - List RimefangTrash = new List(); - EncounterState BloodQuickeningState; - uint HeroicAttempts; - ushort BloodQuickeningMinutes; - bool IsBonedEligible; - bool IsOozeDanceEligible; - bool IsNauseaEligible; - bool IsOrbWhispererEligible; - } - - public override InstanceScript GetInstanceScript(InstanceMap map) - { - return new instance_icecrown_citadel_InstanceMapScript(map); - } - } -} diff --git a/Source/Scripts/Northrend/IcecrownCitadel/LadyDeathwhisper.cs b/Source/Scripts/Northrend/IcecrownCitadel/LadyDeathwhisper.cs deleted file mode 100644 index 7f9943434..000000000 --- a/Source/Scripts/Northrend/IcecrownCitadel/LadyDeathwhisper.cs +++ /dev/null @@ -1,1033 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Framework.Dynamic; -using Game; -using Game.AI; -using Game.DataStorage; -using Game.Entities; -using Game.Groups; -using Game.Maps; -using Game.Scripting; -using Game.Spells; -using System.Collections.Generic; -using System.Linq; -using System; - -namespace Scripts.Northrend.IcecrownCitadel -{ - namespace LadyDeathwhisper - { - struct TextIds - { - // Lady Deathwhisper - public const uint SayIntro1 = 0; - public const uint SayIntro2 = 1; - public const uint SayIntro3 = 2; - public const uint SayIntro4 = 3; - public const uint SayIntro5 = 4; - public const uint SayIntro6 = 5; - public const uint SayIntro7 = 6; - public const uint SayAggro = 7; - public const uint SayPhase2 = 8; - public const uint EmotePhase2 = 9; - public const uint SayDominateMind = 10; - public const uint SayDarkEmpowerment = 11; - public const uint SayDarkTransformation = 12; - public const uint SayAnimateDead = 13; - public const uint SayKill = 14; - public const uint SayBerserk = 15; - public const uint SayDeath = 16; - - // Darnavan - public const uint SayDarnavanAggro = 0; - public const uint SayDarnavanRescued = 1; - } - - struct SpellIds - { - public const uint Berserk = 26662; - - // Lady Deathwhisper - public const uint ManaBarrier = 70842; - public const uint ShadowBolt = 71254; - public const uint DeathAndDecay = 71001; - public const uint DominateMind = 71289; - public const uint DominateMindScale = 71290; - public const uint Frostbolt = 71420; - public const uint FrostboltVolley = 72905; - public const uint TouchOfInsignificance = 71204; - public const uint SummonShade = 71363; - public const uint ShadowChanneling = 43897; - public const uint DarkTransformationT = 70895; - public const uint DarkEmpowermentT = 70896; - public const uint DarkMartyrdomT = 70897; - public const uint SummonSpirits = 72478; - - // Achievement - public const uint FullHouse = 72827; // Does Not Exist In Dbc But Still Can Be Used For Criteria Check - - // Both Adds - public const uint TeleportVisual = 41236; - public const uint ClearAllDebuffs = 34098; - public const uint FullHeal = 17683; - public const uint PermanentFeighDeath = 70628; - - // Fanatics - public const uint DarkTransformation = 70900; - public const uint NecroticStrike = 70659; - public const uint ShadowCleave = 70670; - public const uint VampiricMight = 70674; - public const uint FanaticSDetermination = 71235; - public const uint DarkMartyrdomFanatic = 71236; - - // Adherents - public const uint DarkEmpowerment = 70901; - public const uint FrostFever = 67767; - public const uint DeathchillBolt = 70594; - public const uint DeathchillBlast = 70906; - public const uint CurseOfTorpor = 71237; - public const uint ShorudOfTheOccult = 70768; - public const uint AdherentSDetermination = 71234; - public const uint DarkMartyrdomAdherent = 70903; - - // Vengeful Shade - public const uint VengefulBlast = 71544; - public const uint VengefulBlastPassive = 71494; - public const uint VengefulBlast25N = 72010; - public const uint VengefulBlast10H = 72011; - public const uint VengefulBlast25H = 72012; - - // Darnavan - public const uint Bladestorm = 65947; - public const uint Charge = 65927; - public const uint IntimidatingShout = 65930; - public const uint MortalStrike = 65926; - public const uint ShatteringThrow = 65940; - public const uint SunderArmor = 65936; - } - - struct LadyEventTypes - { - // Darnavan - public const uint DARNAVAN_BLADESTORM = 27; - public const uint DARNAVAN_CHARGE = 28; - public const uint DARNAVAN_INTIMIDATING_SHOUT = 29; - public const uint DARNAVAN_MORTAL_STRIKE = 30; - public const uint DARNAVAN_SHATTERING_THROW = 31; - public const uint DARNAVAN_SUNDER_ARMOR = 32; - } - - enum Phases - { - All, - Intro, - One, - Two - } - - struct GroupIds - { - public const uint Intro = 0; - public const uint One = 1; - public const uint Two = 2; - } - - struct DeprogrammingData - { - public const uint NpcDarnavan10 = 38472; - public const uint NpcDarnavan25 = 38485; - public const uint NpcDarnavanCredit10 = 39091; - public const uint NpcDarnavanCredit25 = 39092; - - public const int ACTION_COMPLETE_QUEST = -384720; - public const uint POINT_DESPAWN = 384721; - } - - struct LadyConst - { - public const uint GUIDCultist = 1; - - public static uint[] SummonEntries = { CreatureIds.CultFanatic, CreatureIds.CultAdherent }; - - public static Position[] SummonPositions = - { - new Position(-578.7066f, 2154.167f, 51.01529f, 1.692969f), // 1 Left Door 1 (Cult Fanatic) - new Position(-598.9028f, 2155.005f, 51.01530f, 1.692969f), // 2 Left Door 2 (Cult Adherent) - new Position(-619.2864f, 2154.460f, 51.01530f, 1.692969f), // 3 Left Door 3 (Cult Fanatic) - new Position(-578.6996f, 2269.856f, 51.01529f, 4.590216f), // 4 Right Door 1 (Cult Adherent) - new Position(-598.9688f, 2269.264f, 51.01529f, 4.590216f), // 5 Right Door 2 (Cult Fanatic) - new Position(-619.4323f, 2268.523f, 51.01530f, 4.590216f), // 6 Right Door 3 (Cult Adherent) - new Position(-524.2480f, 2211.920f, 62.90960f, 3.141592f), // 7 Upper (Random Cultist) - }; - } - - class DaranavanMoveEvent : BasicEvent - { - public DaranavanMoveEvent(Creature darnavan) - { - _darnavan = darnavan; - } - - public override bool Execute(ulong time, uint diff) - { - _darnavan.GetMotionMaster().MovePoint(DeprogrammingData.POINT_DESPAWN, LadyConst.SummonPositions[6]); - return true; - } - - Creature _darnavan; - } - - [Script] - public class boss_lady_deathwhisper : BossAI - { - public boss_lady_deathwhisper(Creature creature) : base(creature, Bosses.LadyDeathwhisper) - { - _dominateMindCount = RaidMode(0, 1, 1, 3); - _introDone = false; - Initialize(); - } - - void Initialize() - { - _waveCounter = 0; - _nextVengefulShadeTargetGUID.Clear(); - _cultistQueue.Clear(); - _darnavanGUID.Clear(); - _phase = Phases.All; - _scheduler.SetValidator(() => - { - return !(me.HasUnitState(UnitState.Casting) && _phase != Phases.Intro); - }); - } - - public override void Reset() - { - _Reset(); - Initialize(); - _phase = Phases.One; - DoCast(me, SpellIds.ShadowChanneling); - me.SetFullPower(PowerType.Mana); - me.ApplySpellImmune(0, SpellImmunity.State, AuraType.ModTaunt, false); - me.ApplySpellImmune(0, SpellImmunity.Effect, SpellEffectName.AttackMe, false); - } - - public override void DoAction(int action) - { - if (action != 0) - return; - - if (!_introDone) - { - _introDone = true; - Talk(TextIds.SayIntro1); - _phase = Phases.Intro; - _scheduler.Schedule(TimeSpan.FromSeconds(10), GroupIds.Intro, task => - { - switch (task.GetRepeatCounter()) - { - case 0: - Talk(TextIds.SayIntro2); - task.Repeat(TimeSpan.FromSeconds(21)); - break; - case 1: - Talk(TextIds.SayIntro3); - task.Repeat(TimeSpan.FromSeconds(11)); - break; - case 2: - Talk(TextIds.SayIntro4); - task.Repeat(TimeSpan.FromSeconds(9)); - break; - case 3: - Talk(TextIds.SayIntro5); - task.Repeat(TimeSpan.FromSeconds(21)); - break; - case 4: - Talk(TextIds.SayIntro6); - task.Repeat(TimeSpan.FromSeconds(10)); - break; - case 5: - Talk(TextIds.SayIntro7); - return; - default: - break; - } - }); - } - } - - public override void AttackStart(Unit victim) - { - if (me.HasUnitFlag(UnitFlags.NonAttackable)) - return; - - if (victim && me.Attack(victim, true) && _phase != Phases.One) - me.GetMotionMaster().MoveChase(victim); - } - - public override void EnterCombat(Unit who) - { - if (!instance.CheckRequiredBosses(Bosses.LadyDeathwhisper, who.ToPlayer())) - { - EnterEvadeMode(EvadeReason.SequenceBreak); - instance.DoCastSpellOnPlayers(TeleporterSpells.LIGHT_S_HAMMER_TELEPORT); - return; - } - - me.SetCombatPulseDelay(5); - me.SetActive(true); - DoZoneInCombat(); - _phase = Phases.One; - _scheduler.CancelGroup(GroupIds.Intro); - - // phase-independent events - _scheduler.Schedule(TimeSpan.FromMinutes(10), context => - { - DoCastSelf(SpellIds.Berserk); - Talk(TextIds.SayBerserk); - }).Schedule(TimeSpan.FromSeconds(17), death_and_decay => - { - Unit target = SelectTarget(SelectAggroTarget.Random); - if (target) - DoCast(target, SpellIds.DeathAndDecay); - death_and_decay.Repeat(TimeSpan.FromSeconds(22), TimeSpan.FromSeconds(30)); - }); - - if (GetDifficulty() != Difficulty.Raid10N) - { - _scheduler.Schedule(TimeSpan.FromSeconds(27), dominate_mind => - { - Talk(TextIds.SayDominateMind); - for (byte i = 0; i < _dominateMindCount; i++) - { - Unit target = SelectTarget(SelectAggroTarget.Random, 1, 0.0f, true, false, -(int)SpellIds.DominateMind); - if (target != null) - DoCast(target, SpellIds.DominateMind); - } - dominate_mind.Repeat(TimeSpan.FromSeconds(40), TimeSpan.FromSeconds(45)); - }); - } - - // phase one only - _scheduler.Schedule(TimeSpan.FromSeconds(5), GroupIds.One, wave => - { - SummonWaveP1(); - wave.Repeat(TimeSpan.FromSeconds(IsHeroic() ? 45 : 60)); - }).Schedule(TimeSpan.FromSeconds(2), GroupIds.One, shadow_bolt => - { - Unit target = SelectTarget(SelectAggroTarget.Random); - if (target != null) - DoCast(target, SpellIds.ShadowBolt); - shadow_bolt.Repeat(TimeSpan.FromMilliseconds(2450), TimeSpan.FromMilliseconds(3600)); - }).Schedule(TimeSpan.FromSeconds(15), GroupIds.One, context => - { - DoImproveCultist(); - context.Repeat(TimeSpan.FromSeconds(25)); - }); - - - Talk(TextIds.SayAggro); - DoStartNoMovement(who); - me.RemoveAurasDueToSpell(SpellIds.ShadowChanneling); - DoCast(me, SpellIds.ManaBarrier, true); - instance.SetBossState(Bosses.LadyDeathwhisper, EncounterState.InProgress); - } - - public override void JustDied(Unit killer) - { - Talk(TextIds.SayDeath); - - List livingAddEntries = new List(); - // Full House achievement - foreach (var guid in summons) - { - Unit unit = Global.ObjAccessor.GetUnit(me, guid); - if (unit) - if (unit.IsAlive() && unit.GetEntry() != CreatureIds.VengefulShade) - livingAddEntries.Add(unit.GetEntry()); - } - - if (livingAddEntries.Count >= 5) - instance.DoUpdateCriteria(CriteriaTypes.BeSpellTarget, SpellIds.FullHouse, 0, me); - - Creature darnavan = ObjectAccessor.GetCreature(me, _darnavanGUID); - if (darnavan) - { - if (darnavan.IsAlive()) - { - darnavan.SetFaction(35); - darnavan.CombatStop(true); - darnavan.GetMotionMaster().MoveIdle(); - darnavan.SetReactState(ReactStates.Passive); - darnavan.m_Events.AddEvent(new DaranavanMoveEvent(darnavan), darnavan.m_Events.CalculateTime(10000)); - darnavan.GetAI().Talk(TextIds.SayDarnavanRescued); - Player owner = killer.GetCharmerOrOwnerPlayerOrPlayerItself(); - if (owner) - { - Group group = owner.GetGroup(); - if (group) - { - for (GroupReference groupRefe = group.GetFirstMember(); groupRefe != null; groupRefe = groupRefe.Next()) - { - Player member = groupRefe.GetSource(); - if (member) - member.KilledMonsterCredit(NPC_DARNAVAN_CREDIT, ObjectGuid.Empty); - } - } - else - owner.KilledMonsterCredit(NPC_DARNAVAN_CREDIT, ObjectGuid.Empty); - } - } - } - - _JustDied(); - } - - public override void EnterEvadeMode(EvadeReason why = EvadeReason.Other) - { - _scheduler.CancelAll(); - summons.DespawnAll(); - - Creature darnavan = ObjectAccessor.GetCreature(me, _darnavanGUID); - if (darnavan != null) - darnavan.DespawnOrUnsummon(); - - _DespawnAtEvade(); - } - - public override void KilledUnit(Unit victim) - { - if (victim.IsTypeId(TypeId.Player)) - Talk(TextIds.SayKill); - } - - public override void DamageTaken(Unit damageDealer, ref uint damage) - { - // phase transition - if (_phase == Phases.One && damage > (uint)me.GetPower(PowerType.Mana)) - { - _phase = Phases.Two; - Talk(TextIds.SayPhase2); - Talk(TextIds.EmotePhase2); - DoStartMovement(me.GetVictim()); - ResetThreatList(); - - damage -= (uint)me.GetPower(PowerType.Mana); - me.SetPower(PowerType.Mana, 0); - me.RemoveAurasDueToSpell(SpellIds.ManaBarrier); - _scheduler.CancelGroup(GroupIds.One); - - _scheduler.Schedule(TimeSpan.FromSeconds(12), GroupIds.Two, frostbolt => - { - DoCastVictim(SpellIds.Frostbolt); - frostbolt.Repeat(); - }).Schedule(TimeSpan.FromSeconds(20), GroupIds.Two, frostboldVolley => - { - DoCastAOE(SpellIds.FrostboltVolley); - frostboldVolley.Repeat(); - }).Schedule(TimeSpan.FromSeconds(6), TimeSpan.FromSeconds(9), GroupIds.Two, touch => - { - if (me.GetVictim()) - me.AddAura(SpellIds.TouchOfInsignificance, me.GetVictim()); - touch.Repeat(); - }).Schedule(TimeSpan.FromSeconds(12), GroupIds.Two, summonShade => - { - me.CastCustomSpell(SpellIds.SummonSpirits, SpellValueMod.MaxTargets, Is25ManRaid() ? 2 : 1); - summonShade.Repeat(); - }); - - // on heroic mode Lady Deathwhisper is immune to taunt effects in phase 2 and continues summoning adds - if (IsHeroic()) - { - me.ApplySpellImmune(0, SpellImmunity.State, AuraType.ModTaunt, true); - me.ApplySpellImmune(0, SpellImmunity.Effect, SpellEffectName.AttackMe, true); - _scheduler.Schedule(TimeSpan.FromSeconds(0), GroupIds.Two, context => - { - SummonWaveP2(); - context.Repeat(TimeSpan.FromSeconds(45)); - }); - } - } - } - - public override void SpellHitTarget(Unit target, SpellInfo spell) - { - if (spell.Id == SpellIds.SummonSpirits) - _nextVengefulShadeTargetGUID.Add(target.GetGUID()); - } - - public override void JustSummoned(Creature summon) - { - switch (summon.GetEntry()) - { - case DeprogrammingData.NpcDarnavan10: - case DeprogrammingData.NpcDarnavan25: - _darnavanGUID = summon.GetGUID(); - summon.GetAI().AttackStart(SelectTarget(SelectAggroTarget.Random)); - return; - case CreatureIds.VengefulShade: - if (_nextVengefulShadeTargetGUID.Empty()) - break; - summon.GetAI().SetGUID(_nextVengefulShadeTargetGUID.First()); - _nextVengefulShadeTargetGUID.RemoveAt(0); - break; - case CreatureIds.CultAdherent: - case CreatureIds.CultFanatic: - _cultistQueue.Add(summon.GetGUID()); - summon.GetAI().AttackStart(SelectTarget(SelectAggroTarget.Random)); - break; - default: - break; - } - summons.Summon(summon); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim() && _phase != Phases.Intro) - return; - - _scheduler.Update(diff, () => - { - // We should not melee attack when barrier is up - if (!me.HasAura(SpellIds.ManaBarrier)) - DoMeleeAttackIfReady(); - }); - } - - // summoning function for first phase - void SummonWaveP1() - { - byte addIndex = (byte)(_waveCounter & 1); - byte addIndexOther = (byte)(addIndex ^ 1); - - // Summon first add, replace it with Darnavan if weekly quest is active - if (_waveCounter != 0 || !Global.PoolMgr.IsSpawnedObject(QUEST_DEPROGRAMMING)) - Summon(LadyConst.SummonEntries[addIndex], LadyConst.SummonPositions[addIndex * 3]); - else - Summon(NPC_DARNAVAN, LadyConst.SummonPositions[addIndex * 3]); - - Summon(LadyConst.SummonEntries[addIndexOther], LadyConst.SummonPositions[addIndex * 3 + 1]); - Summon(LadyConst.SummonEntries[addIndex], LadyConst.SummonPositions[addIndex * 3 + 2]); - if (Is25ManRaid()) - { - Summon(LadyConst.SummonEntries[addIndexOther], LadyConst.SummonPositions[addIndexOther * 3]); - Summon(LadyConst.SummonEntries[addIndex], LadyConst.SummonPositions[addIndexOther * 3 + 1]); - Summon(LadyConst.SummonEntries[addIndexOther], LadyConst.SummonPositions[addIndexOther * 3 + 2]); - Summon(LadyConst.SummonEntries[RandomHelper.IRand(0, 1)], LadyConst.SummonPositions[6]); - } - - ++_waveCounter; - } - - // summoning function for second phase - void SummonWaveP2() - { - if (Is25ManRaid()) - { - byte addIndex = (byte)(_waveCounter & 1); - Summon(LadyConst.SummonEntries[addIndex], LadyConst.SummonPositions[addIndex * 3]); - Summon(LadyConst.SummonEntries[addIndex ^ 1], LadyConst.SummonPositions[addIndex * 3 + 1]); - Summon(LadyConst.SummonEntries[addIndex], LadyConst.SummonPositions[addIndex * 3 + 2]); - } - else - Summon(LadyConst.SummonEntries[RandomHelper.IRand(0, 1)], LadyConst.SummonPositions[6]); - - ++_waveCounter; - } - - // helper for summoning wave mobs - void Summon(uint entry, Position pos) - { - TempSummon summon = me.SummonCreature(entry, pos, TempSummonType.CorpseTimedDespawn, 10000); - if (summon) - summon.CastSpell(summon, SpellIds.TeleportVisual); - } - - public override void SummonedCreatureDies(Creature summon, Unit killer) - { - if (summon.GetEntry() == CreatureIds.CultAdherent || summon.GetEntry() == CreatureIds.CultFanatic) - _cultistQueue.Remove(summon.GetGUID()); - } - - void DoImproveCultist() - { - if (_cultistQueue.Empty()) - return; - - _cultistGUID = _cultistQueue.SelectRandom(); - _cultistQueue.Remove(_cultistGUID); - Creature cultist = ObjectAccessor.GetCreature(me, _cultistGUID); - if (!cultist) - return; - - if (RandomHelper.RAND(0, 1) != 0) - me.CastSpell(cultist, SpellIds.DarkMartyrdomT); - else - { - me.CastSpell(cultist, cultist.GetEntry() == CreatureIds.CultFanatic ? SpellIds.DarkTransformationT : SpellIds.DarkEmpowermentT, true); - Talk(cultist.GetEntry() == CreatureIds.CultFanatic ? TextIds.SayDarkTransformation : TextIds.SayDarkEmpowerment); - } - } - - ObjectGuid _darnavanGUID; - ObjectGuid _cultistGUID; - List _cultistQueue = new List(); - List _nextVengefulShadeTargetGUID = new List(); - - uint _waveCounter; - byte _dominateMindCount; - Phases _phase; - bool _introDone; - - uint NPC_DARNAVAN { get { return RaidMode(DeprogrammingData.NpcDarnavan10, DeprogrammingData.NpcDarnavan25, DeprogrammingData.NpcDarnavan10, DeprogrammingData.NpcDarnavan25); } } - uint NPC_DARNAVAN_CREDIT { get { return RaidMode(DeprogrammingData.NpcDarnavanCredit10, DeprogrammingData.NpcDarnavanCredit25, DeprogrammingData.NpcDarnavanCredit10, DeprogrammingData.NpcDarnavanCredit25); } } - uint QUEST_DEPROGRAMMING { get { return RaidMode(WeeklyQuestIds.Deprogramming10, WeeklyQuestIds.Deprogramming25, WeeklyQuestIds.Deprogramming10, WeeklyQuestIds.Deprogramming25); } } - } - - [Script] - class npc_cult_fanatic : ScriptedAI - { - public npc_cult_fanatic(Creature creature) : base(creature) - { - _instance = creature.GetInstanceScript(); - } - - public override void Reset() - { - _scheduler.CancelAll(); - _scheduler.SetValidator(() => - { - return !me.HasUnitState(UnitState.Casting); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(17), vampiric_might => - { - DoCastSelf(SpellIds.VampiricMight); - vampiric_might.Repeat(TimeSpan.FromSeconds(25)); - }).Schedule(TimeSpan.FromSeconds(12), shadow_cleave => - { - DoCastVictim(SpellIds.ShadowCleave); - shadow_cleave.Repeat(TimeSpan.FromSeconds(14)); - }).Schedule(TimeSpan.FromSeconds(10), necrotic_strike => - { - DoCastVictim(SpellIds.NecroticStrike); - necrotic_strike.Repeat(TimeSpan.FromSeconds(17)); - }); - } - - public override void SpellHit(Unit caster, SpellInfo spell) - { - switch (spell.Id) - { - case SpellIds.DarkTransformationT: - me.InterruptNonMeleeSpells(true); - DoCastSelf(SpellIds.DarkTransformation); - break; - case SpellIds.DarkTransformation: - DoCastSelf(SpellIds.FullHeal); - me.UpdateEntry(CreatureIds.DeformedFanatic); - break; - case SpellIds.DarkMartyrdomT: - me.SetReactState(ReactStates.Passive); - me.InterruptNonMeleeSpells(true); - me.AttackStop(); - DoCastSelf(SpellIds.DarkMartyrdomFanatic); - break; - case SpellIds.DarkMartyrdomFanatic: - _scheduler.Schedule(TimeSpan.FromSeconds(2), context => - { - me.UpdateEntry(CreatureIds.ReanimatedFanatic); - DoCastSelf(SpellIds.PermanentFeighDeath); - DoCastSelf(SpellIds.ClearAllDebuffs); - DoCastSelf(SpellIds.FullHeal, true); - me.AddUnitFlag(UnitFlags.Stunned | UnitFlags.Unk29 | UnitFlags.NotSelectable); - }).Schedule(TimeSpan.FromSeconds(6), context => - { - me.RemoveAurasDueToSpell(SpellIds.PermanentFeighDeath); - me.RemoveUnitFlag(UnitFlags.Stunned | UnitFlags.Unk29 | UnitFlags.NotSelectable); - me.SetReactState(ReactStates.Aggressive); - DoZoneInCombat(me); - - Creature ladyDeathwhisper = ObjectAccessor.GetCreature(me, _instance.GetGuidData(Bosses.LadyDeathwhisper)); - if (ladyDeathwhisper != null) - ladyDeathwhisper.GetAI().Talk(TextIds.SayAnimateDead); - }); - break; - default: - break; - - } - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim() && !me.HasAura(SpellIds.PermanentFeighDeath)) - return; - - _scheduler.Update(diff, () => - { - DoMeleeAttackIfReady(); - }); - } - - InstanceScript _instance; - } - - [Script] - class npc_cult_adherent : ScriptedAI - { - public npc_cult_adherent(Creature creature) : base(creature) - { - _instance = creature.GetInstanceScript(); - } - - public override void Reset() - { - _scheduler.CancelAll(); - _scheduler.SetValidator(() => - { - return !me.HasUnitState(UnitState.Casting); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(5), deathchill => - { - if (me.GetEntry() == CreatureIds.EmpoweredAdherent) - DoCastVictim(SpellIds.DeathchillBlast); - else - DoCastVictim(SpellIds.DeathchillBolt); - deathchill.Repeat(TimeSpan.FromMilliseconds(2500)); - }).Schedule(TimeSpan.FromSeconds(15), shroud_of_the_occult => - { - DoCastSelf(SpellIds.ShorudOfTheOccult); - shroud_of_the_occult.Repeat(TimeSpan.FromSeconds(10)); - }).Schedule(TimeSpan.FromSeconds(15), curse_of_torpor => - { - Unit target = SelectTarget(SelectAggroTarget.Random, 1); - if (target != null) - DoCast(target, SpellIds.CurseOfTorpor); - curse_of_torpor.Repeat(TimeSpan.FromSeconds(18)); - }); - } - - public override void SpellHit(Unit caster, SpellInfo spell) - { - switch (spell.Id) - { - case SpellIds.DarkEmpowermentT: - me.UpdateEntry(CreatureIds.EmpoweredAdherent); - break; - case SpellIds.DarkMartyrdomT: - me.SetReactState(ReactStates.Passive); - me.InterruptNonMeleeSpells(true); - me.AttackStop(); - DoCastSelf(SpellIds.DarkMartyrdomAdherent); - break; - case SpellIds.DarkMartyrdomAdherent: - _scheduler.Schedule(TimeSpan.FromSeconds(2), context => - { - me.UpdateEntry(CreatureIds.ReanimatedAdherent); - DoCastSelf(SpellIds.PermanentFeighDeath); - DoCastSelf(SpellIds.ClearAllDebuffs); - DoCastSelf(SpellIds.FullHeal, true); - me.AddUnitFlag(UnitFlags.Stunned | UnitFlags.Unk29 | UnitFlags.NotSelectable); - }).Schedule(TimeSpan.FromSeconds(6), context => - { - me.RemoveAurasDueToSpell(SpellIds.PermanentFeighDeath); - me.RemoveUnitFlag(UnitFlags.Stunned | UnitFlags.Unk29 | UnitFlags.NotSelectable); - me.SetReactState(ReactStates.Aggressive); - DoCastSelf(SpellIds.ShorudOfTheOccult); - DoZoneInCombat(me); - - Creature ladyDeathwhisper = ObjectAccessor.GetCreature(me, _instance.GetGuidData(Bosses.LadyDeathwhisper)); - if (ladyDeathwhisper != null) - ladyDeathwhisper.GetAI().Talk(TextIds.SayAnimateDead); - }); - break; - default: - break; - } - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim() && !me.HasAura(SpellIds.PermanentFeighDeath)) - return; - - _scheduler.Update(diff); - } - - InstanceScript _instance; - } - - [Script] - class npc_vengeful_shade : ScriptedAI - { - public npc_vengeful_shade(Creature creature) : base(creature) { } - - public override void Reset() - { - me.SetReactState(ReactStates.Passive); - me.AddAura(SpellIds.VengefulBlastPassive, me); - - _scheduler.Schedule(TimeSpan.FromSeconds(2), context => - { - me.SetReactState(ReactStates.Aggressive); - me.GetAI().AttackStart(Global.ObjAccessor.GetUnit(me, _targetGUID)); - }).Schedule(TimeSpan.FromSeconds(7), context => - { - me.KillSelf(); - }); - } - - public override void SetGUID(ObjectGuid guid, int id = 0) - { - _targetGUID = guid; - } - - public override void SpellHitTarget(Unit target, SpellInfo spell) - { - switch (spell.Id) - { - case SpellIds.VengefulBlast: - case SpellIds.VengefulBlast25N: - case SpellIds.VengefulBlast10H: - case SpellIds.VengefulBlast25H: - me.KillSelf(); - break; - default: - break; - } - } - - public override void UpdateAI(uint diff) - { - _scheduler.Update(diff, () => - { - DoMeleeAttackIfReady(); - }); - } - - ObjectGuid _targetGUID; - } - - [Script] - class npc_darnavan : ScriptedAI - { - public npc_darnavan(Creature creature) : base(creature) - { - Initialize(); - } - - void Initialize() - { - _canCharge = true; - _canShatter = true; - } - - public override void Reset() - { - _events.Reset(); - _events.ScheduleEvent(LadyEventTypes.DARNAVAN_BLADESTORM, 10000); - _events.ScheduleEvent(LadyEventTypes.DARNAVAN_INTIMIDATING_SHOUT, RandomHelper.URand(20000, 25000)); - _events.ScheduleEvent(LadyEventTypes.DARNAVAN_MORTAL_STRIKE, RandomHelper.URand(25000, 30000)); - _events.ScheduleEvent(LadyEventTypes.DARNAVAN_SUNDER_ARMOR, RandomHelper.URand(5000, 8000)); - Initialize(); - } - - public override void JustDied(Unit killer) - { - _events.Reset(); - Player owner = killer.GetCharmerOrOwnerPlayerOrPlayerItself(); - if (owner) - { - Group group = owner.GetGroup(); - if (group) - { - for (GroupReference groupRefe = group.GetFirstMember(); groupRefe != null; groupRefe = groupRefe.Next()) - { - Player member = groupRefe.GetSource(); - if (member) - member.FailQuest(QUEST_DEPROGRAMMING); - } - } - else - owner.FailQuest(QUEST_DEPROGRAMMING); - } - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - if (type != MovementGeneratorType.Point || id != DeprogrammingData.POINT_DESPAWN) - return; - - me.DespawnOrUnsummon(); - } - - public override void EnterCombat(Unit victim) - { - Talk(TextIds.SayDarnavanAggro); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - if (_canShatter && me.GetVictim() && me.GetVictim().IsImmunedToDamage(SpellSchoolMask.Normal)) - { - DoCastVictim(SpellIds.ShatteringThrow); - _canShatter = false; - _events.ScheduleEvent(LadyEventTypes.DARNAVAN_SHATTERING_THROW, 30000); - return; - } - - if (_canCharge && !me.IsWithinMeleeRange(me.GetVictim())) - { - DoCastVictim(SpellIds.Charge); - _canCharge = false; - _events.ScheduleEvent(LadyEventTypes.DARNAVAN_CHARGE, 20000); - return; - } - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case LadyEventTypes.DARNAVAN_BLADESTORM: - DoCast(SpellIds.Bladestorm); - _events.ScheduleEvent(LadyEventTypes.DARNAVAN_BLADESTORM, RandomHelper.URand(90000, 100000)); - break; - case LadyEventTypes.DARNAVAN_CHARGE: - _canCharge = true; - break; - case LadyEventTypes.DARNAVAN_INTIMIDATING_SHOUT: - DoCast(SpellIds.IntimidatingShout); - _events.ScheduleEvent(LadyEventTypes.DARNAVAN_INTIMIDATING_SHOUT, RandomHelper.URand(90000, 120000)); - break; - case LadyEventTypes.DARNAVAN_MORTAL_STRIKE: - DoCastVictim(SpellIds.MortalStrike); - _events.ScheduleEvent(LadyEventTypes.DARNAVAN_MORTAL_STRIKE, RandomHelper.URand(15000, 30000)); - break; - case LadyEventTypes.DARNAVAN_SHATTERING_THROW: - _canShatter = true; - break; - case LadyEventTypes.DARNAVAN_SUNDER_ARMOR: - DoCastVictim(SpellIds.SunderArmor); - _events.ScheduleEvent(LadyEventTypes.DARNAVAN_SUNDER_ARMOR, RandomHelper.URand(3000, 7000)); - break; - } - }); - - DoMeleeAttackIfReady(); - } - - uint QUEST_DEPROGRAMMING { get { return RaidMode(WeeklyQuestIds.Deprogramming10, WeeklyQuestIds.Deprogramming25, WeeklyQuestIds.Deprogramming10, WeeklyQuestIds.Deprogramming25); } } - - bool _canCharge; - bool _canShatter; - } - - [Script] - class spell_deathwhisper_mana_barrier : AuraScript - { - void HandlePeriodicTick(AuraEffect aurEff) - { - PreventDefaultAction(); - Unit caster = GetCaster(); - if (caster) - { - int missingHealth = (int)(caster.GetMaxHealth() - caster.GetHealth()); - caster.ModifyHealth(missingHealth); - caster.ModifyPower(PowerType.Mana, -missingHealth); - } - } - - public override void Register() - { - OnEffectPeriodic.Add(new EffectPeriodicHandler(HandlePeriodicTick, 0, AuraType.PeriodicTriggerSpell)); - } - } - - [Script] - class at_lady_deathwhisper_entrance : AreaTriggerScript - { - public at_lady_deathwhisper_entrance() : base("at_lady_deathwhisper_entrance") { } - - public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger, bool entered) - { - InstanceScript instance = player.GetInstanceScript(); - if (instance != null) - { - if (instance.GetBossState(Bosses.LadyDeathwhisper) != EncounterState.Done) - { - Creature ladyDeathwhisper = ObjectAccessor.GetCreature(player, instance.GetGuidData(Bosses.LadyDeathwhisper)); - if (ladyDeathwhisper) - ladyDeathwhisper.GetAI().DoAction(0); - } - } - - return true; - } - } - - [Script] - class spell_deathwhisper_dominated_mind : AuraScript - { - public override bool Validate(SpellInfo spellInfo) - { - return ValidateSpellInfo(SpellIds.DominateMindScale); - } - - void HandleApply(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Unit target = GetTarget(); - target.CastSpell(target, SpellIds.DominateMindScale, true); - } - - public override void Register() - { - AfterEffectApply.Add(new EffectApplyHandler(HandleApply, 0, AuraType.AoeCharm, AuraEffectHandleModes.Real)); - } - } - - [Script] - class spell_deathwhisper_summon_spirits : SpellScript - { - public override bool Validate(SpellInfo spellInfo) - { - return ValidateSpellInfo(SpellIds.SummonShade); - } - - void HandleScriptEffect(uint effIndex) - { - GetCaster().CastSpell(GetHitUnit(), SpellIds.SummonShade, true); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, 0, SpellEffectName.Dummy)); - } - } - } -} diff --git a/Source/Scripts/Northrend/IcecrownCitadel/LordMarrowgar.cs b/Source/Scripts/Northrend/IcecrownCitadel/LordMarrowgar.cs deleted file mode 100644 index c36dd6aa6..000000000 --- a/Source/Scripts/Northrend/IcecrownCitadel/LordMarrowgar.cs +++ /dev/null @@ -1,656 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Movement; -using Game.Scripting; -using Game.Spells; -using System; -using System.Collections.Generic; - -namespace Scripts.Northrend.IcecrownCitadel -{ - namespace Marrorgar - { - struct Texts - { - public const int SayEnterZone = 0; - public const int SayAggro = 1; - public const int SayBoneStorm = 2; - public const int SayBonespike = 3; - public const int SayKill = 4; - public const int SayDeath = 5; - public const int SayBerserk = 6; - public const int EmoteBoneStorm = 7; - } - - struct SpellIds - { - // Lord Marrowgar - public const uint BoneSlice = 69055; - public const uint BoneStorm = 69076; - public const uint BoneSpikeGraveyard = 69057; - public const uint ColdflameNormal = 69140; - public const uint ColdflameBoneStorm = 72705; - - // Bone Spike - public const uint Impaled = 69065; - public const uint RideVehicle = 46598; - - // Coldflame - public const uint ColdflamePassive = 69145; - public const uint ColdflameSummon = 69147; - } - - struct Misc - { - public static uint[] BoneSpikeSummonId = { 69062, 72669, 72670 }; - - public const uint EventBoneSpikeGraveyard = 1; - public const uint EventColdflame = 2; - public const uint EventBoneStormBegin = 3; - public const uint EventBoneStormMove = 4; - public const uint EventBoneStormEnd = 5; - public const uint EventEnableBoneSlice = 6; - public const uint EventEnrage = 7; - public const uint EventWarnBoneStorm = 8; - - public const uint EventColdflameTrigger = 9; - public const uint EventFailBoned = 10; - - public const uint EventGroupSpecial = 1; - - public const uint PointTargetBonestormPlayer = 36612631; - public const uint PointTargetColdflame = 36672631; - - public const int DataColdflameGuid = 0; - - // Manual Marking For Targets Hit By Bone Slice As No Aura Exists For This Purpose - // These Units Are The Tanks In This Encounter - // And Should Be Immune To Bone Spike Graveyard - public const int DataSpikeImmune = 1; - //DataSpikeImmune1; = 2; // Reserved & Used - //DataSpikeImmune2; = 3; // Reserved & Used - - public const int ActionClearSpikeImmunities = 1; - - public const uint MaxBoneSpikeImmune = 3; - } - - class BoneSpikeTargetSelector : ISelector - { - public BoneSpikeTargetSelector(UnitAI ai) - { - _ai = ai; - } - - public bool Check(Unit unit) - { - if (!unit.IsTypeId(TypeId.Player)) - return false; - - if (unit.HasAura(SpellIds.Impaled)) - return false; - - // Check if it is one of the tanks soaking Bone Slice - for (int i = 0; i < Misc.MaxBoneSpikeImmune; ++i) - if (unit.GetGUID() == _ai.GetGUID(Misc.DataSpikeImmune + i)) - return false; - - return true; - } - - UnitAI _ai; - } - - [Script] - public class boss_lord_marrowgar : BossAI - { - public boss_lord_marrowgar(Creature creature) : base(creature, Bosses.LordMarrowgar) - { - _boneStormDuration = RaidMode(20000, 30000, 20000, 30000); - _baseSpeed = creature.GetSpeedRate(UnitMoveType.Run); - _coldflameLastPos.Relocate(creature); - _introDone = false; - _boneSlice = false; - } - - public override void Reset() - { - _Reset(); - me.SetSpeedRate(UnitMoveType.Run, _baseSpeed); - me.RemoveAurasDueToSpell(SpellIds.BoneStorm); - me.RemoveAurasDueToSpell(InstanceSpells.Berserk); - - _events.ScheduleEvent(Misc.EventEnableBoneSlice, 10000); - _events.ScheduleEvent(Misc.EventBoneSpikeGraveyard, 15000, Misc.EventGroupSpecial); - _events.ScheduleEvent(Misc.EventColdflame, 5000, Misc.EventGroupSpecial); - _events.ScheduleEvent(Misc.EventWarnBoneStorm, RandomHelper.URand(45000, 50000)); - _events.ScheduleEvent(Misc.EventEnrage, 600000); - _boneSlice = false; - _boneSpikeImmune.Clear(); - } - - public override void EnterCombat(Unit who) - { - Talk(Texts.SayAggro); - - me.SetActive(true); - DoZoneInCombat(); - instance.SetBossState(Bosses.LordMarrowgar, EncounterState.InProgress); - } - - public override void JustDied(Unit killer) - { - Talk(Texts.SayDeath); - - _JustDied(); - } - - public override void JustReachedHome() - { - _JustReachedHome(); - instance.SetBossState(Bosses.LordMarrowgar, EncounterState.Fail); - instance.SetData(DataTypes.BonedAchievement, 1); // reset - } - - public override void KilledUnit(Unit victim) - { - if (victim.IsTypeId(TypeId.Player)) - Talk(Texts.SayKill); - } - - public override void MoveInLineOfSight(Unit who) - { - if (!_introDone && me.IsWithinDistInMap(who, 70.0f)) - { - Talk(Texts.SayEnterZone); - _introDone = true; - } - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case Misc.EventBoneSpikeGraveyard: - if (IsHeroic() || !me.HasAura(SpellIds.BoneStorm)) - DoCast(me, SpellIds.BoneSpikeGraveyard); - _events.ScheduleEvent(Misc.EventBoneSpikeGraveyard, RandomHelper.URand(15000, 20000), Misc.EventGroupSpecial); - break; - case Misc.EventColdflame: - _coldflameLastPos.Relocate(me); - _coldflameTarget.Clear(); - if (!me.HasAura(SpellIds.BoneStorm)) - DoCastAOE(SpellIds.ColdflameNormal); - else - DoCast(me, SpellIds.ColdflameBoneStorm); - _events.ScheduleEvent(Misc.EventColdflame, 5000, Misc.EventGroupSpecial); - break; - case Misc.EventWarnBoneStorm: - _boneSlice = false; - Talk(Texts.SayBoneStorm); - me.FinishSpell(CurrentSpellTypes.Melee, false); - DoCast(me, SpellIds.BoneStorm); - _events.DelayEvents(3000, Misc.EventGroupSpecial); - _events.ScheduleEvent(Misc.EventBoneStormBegin, 3050); - _events.ScheduleEvent(Misc.EventWarnBoneStorm, RandomHelper.URand(90000, 95000)); - break; - case Misc.EventBoneStormBegin: - Aura pStorm = me.GetAura(SpellIds.BoneStorm); - if (pStorm != null) - pStorm.SetDuration((int)_boneStormDuration); - me.SetSpeedRate(UnitMoveType.Run, _baseSpeed * 3.0f); - Talk(Texts.SayBoneStorm); - _events.ScheduleEvent(Misc.EventBoneStormEnd, _boneStormDuration + 1); - goto case Misc.EventBoneStormMove; - // no break here - case Misc.EventBoneStormMove: - { - _events.ScheduleEvent(Misc.EventBoneStormMove, _boneStormDuration / 3); - Unit unit = SelectTarget(SelectAggroTarget.Random, 0, new NonTankTargetSelector(me)); - if (!unit) - unit = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true); - if (unit) - me.GetMotionMaster().MovePoint(Misc.PointTargetBonestormPlayer, unit); - break; - } - case Misc.EventBoneStormEnd: - if (me.GetMotionMaster().GetCurrentMovementGeneratorType() == MovementGeneratorType.Point) - me.GetMotionMaster().MovementExpired(); - me.GetMotionMaster().MoveChase(me.GetVictim()); - me.SetSpeedRate(UnitMoveType.Run, _baseSpeed); - _events.CancelEvent(Misc.EventBoneStormMove); - _events.ScheduleEvent(Misc.EventEnableBoneSlice, 10000); - if (!IsHeroic()) - _events.RescheduleEvent(Misc.EventBoneSpikeGraveyard, 15000, Misc.EventGroupSpecial); - break; - case Misc.EventEnableBoneSlice: - _boneSlice = true; - break; - case Misc.EventEnrage: - DoCast(me, Texts.SayBerserk, true); - Talk(Texts.SayBerserk); - break; - } - }); - - // We should not melee attack when storming - if (me.HasAura(SpellIds.BoneStorm)) - return; - - // 10 seconds since encounter start Bone Slice replaces melee attacks - if (_boneSlice && !me.GetCurrentSpell(CurrentSpellTypes.Melee)) - DoCastVictim(SpellIds.BoneSlice); - - DoMeleeAttackIfReady(); - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - if (type != MovementGeneratorType.Point || id != Misc.PointTargetBonestormPlayer) - return; - - // lock movement - me.GetMotionMaster().MoveIdle(); - } - - public Position GetLastColdflamePosition() - { - return _coldflameLastPos; - } - - public override ObjectGuid GetGUID(int type = 0) - { - switch (type) - { - case Misc.DataColdflameGuid: - return _coldflameTarget; - case Misc.DataSpikeImmune + 0: - case Misc.DataSpikeImmune + 1: - case Misc.DataSpikeImmune + 2: - { - int index = type - Misc.DataSpikeImmune; - if (index < _boneSpikeImmune.Count) - return _boneSpikeImmune[index]; - - break; - } - } - - return ObjectGuid.Empty; - } - - public override void SetGUID(ObjectGuid guid, int type = 0) - { - switch (type) - { - case Misc.DataColdflameGuid: - _coldflameTarget = guid; - break; - case Misc.DataSpikeImmune: - _boneSpikeImmune.Add(guid); - break; - } - } - - public override void DoAction(int action) - { - if (action != Misc.ActionClearSpikeImmunities) - return; - - _boneSpikeImmune.Clear(); - } - - Position _coldflameLastPos = new Position(); - List _boneSpikeImmune = new List(); - ObjectGuid _coldflameTarget; - uint _boneStormDuration; - float _baseSpeed; - bool _introDone; - bool _boneSlice; - } - - [Script] - class npc_coldflame : ScriptedAI - { - public npc_coldflame(Creature creature) : base(creature) { } - - public override void IsSummonedBy(Unit owner) - { - if (!owner.IsTypeId(TypeId.Player)) - return; - - Position pos = new Position(); - var marrowgarAI = (boss_lord_marrowgar)owner.GetAI(); - if (marrowgarAI != null) - pos.Relocate(marrowgarAI.GetLastColdflamePosition()); - else - pos.Relocate(owner); - - if (owner.HasAura(SpellIds.BoneStorm)) - { - float ang = Position.NormalizeOrientation(pos.GetAngle(me)); - me.SetOrientation(ang); - owner.GetNearPoint2D(out pos.posX, out pos.posY, 5.0f - owner.GetCombatReach(), ang); - } - else - { - Player target = Global.ObjAccessor.GetPlayer(owner, owner.GetAI().GetGUID(Misc.DataColdflameGuid)); - if (!target) - { - me.DespawnOrUnsummon(); - return; - } - - float ang = Position.NormalizeOrientation(pos.GetAngle(target)); - me.SetOrientation(ang); - owner.GetNearPoint2D(out pos.posX, out pos.posY, 15.0f - owner.GetCombatReach(), ang); - } - - me.NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), me.GetPositionZ(), me.GetOrientation()); - DoCast(SpellIds.ColdflameSummon); - _events.ScheduleEvent(Misc.EventColdflameTrigger, 500); - } - - public override void UpdateAI(uint diff) - { - _events.Update(diff); - - if (_events.ExecuteEvent() == Misc.EventColdflameTrigger) - { - Position newPos = me.GetNearPosition(5.0f, 0.0f); - me.NearTeleportTo(newPos.GetPositionX(), newPos.GetPositionY(), me.GetPositionZ(), me.GetOrientation()); - DoCast(SpellIds.ColdflameSummon); - _events.ScheduleEvent(Misc.EventColdflameTrigger, 500); - } - } - } - - [Script] - class npc_bone_spike : ScriptedAI - { - public npc_bone_spike(Creature creature) : base(creature) - { - _hasTrappedUnit = false; - Cypher.Assert(creature.GetVehicleKit()); - - SetCombatMovement(false); - } - - public override void JustDied(Unit killer) - { - TempSummon summ = me.ToTempSummon(); - if (summ) - { - Unit trapped = summ.GetSummoner(); - if (trapped) - trapped.RemoveAurasDueToSpell(SpellIds.Impaled); - } - - me.DespawnOrUnsummon(); - } - - public override void KilledUnit(Unit victim) - { - me.DespawnOrUnsummon(); - victim.RemoveAurasDueToSpell(SpellIds.Impaled); - } - - public override void IsSummonedBy(Unit summoner) - { - DoCast(summoner, SpellIds.Impaled); - summoner.CastSpell(me, SpellIds.RideVehicle, true); - _events.ScheduleEvent(Misc.EventFailBoned, 8000); - _hasTrappedUnit = true; - } - - public override void PassengerBoarded(Unit passenger, sbyte seat, bool apply) - { - if (!apply) - return; - - // @HACK - Change passenger offset to the one taken directly from sniffs - // Remove this when proper calculations are implemented. - // This fixes healing spiked people - MoveSplineInit init = new MoveSplineInit(passenger); - init.DisableTransportPathTransformations(); - init.MoveTo(-0.02206125f, -0.02132235f, 5.514783f, false); - init.Launch(); - } - - public override void UpdateAI(uint diff) - { - if (!_hasTrappedUnit) - return; - - _events.Update(diff); - - if (_events.ExecuteEvent() == Misc.EventFailBoned) - { - InstanceScript instance = me.GetInstanceScript(); - if (instance != null) - instance.SetData(DataTypes.BonedAchievement, 0); - } - } - - bool _hasTrappedUnit; - } - - [Script] - class spell_marrowgar_coldflame : SpellScript - { - void SelectTarget(List targets) - { - targets.Clear(); - // select any unit but not the tank - Unit target = GetCaster().GetAI().SelectTarget(SelectAggroTarget.Random, 1, -GetCaster().GetCombatReach(), true, false, -(int)SpellIds.Impaled); - if (!target) - target = GetCaster().GetAI().SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true); // or the tank if its solo - if (!target) - return; - - GetCaster().GetAI().SetGUID(target.GetGUID(), Misc.DataColdflameGuid); - - targets.Add(target); - } - - void HandleScriptEffect(uint effIndex) - { - PreventHitDefaultEffect(effIndex); - GetCaster().CastSpell(GetHitUnit(), (uint)GetEffectValue(), true); - } - - public override void Register() - { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(SelectTarget, 0, Targets.UnitDestAreaEnemy)); - OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, 0, SpellEffectName.ScriptEffect)); - } - } - - [Script] - class spell_marrowgar_coldflame_bonestorm : SpellScript - { - void HandleScriptEffect(uint effIndex) - { - PreventHitDefaultEffect(effIndex); - for (byte i = 0; i < 4; ++i) - GetCaster().CastSpell(GetHitUnit(), (uint)(GetEffectValue() + i), true); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, 0, SpellEffectName.ScriptEffect)); - } - } - - [Script] - class spell_marrowgar_coldflame_damage : AuraScript - { - bool CanBeAppliedOn(Unit target) - { - if (target.HasAura(SpellIds.Impaled)) - return false; - - SpellEffectInfo effect = GetSpellInfo().GetEffect(0); - if (effect != null) - if (target.GetExactDist2d(GetOwner()) > effect.CalcRadius()) - return false; - - Aura aur = target.GetAura(GetId()); - if (aur != null) - if (aur.GetOwner() != GetOwner()) - return false; - - return true; - } - - public override void Register() - { - DoCheckAreaTarget.Add(new CheckAreaTargetHandler(CanBeAppliedOn)); - } - } - - [Script] - class spell_marrowgar_bone_spike_graveyard : SpellScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(Misc.BoneSpikeSummonId); - } - - public override bool Load() - { - return GetCaster().IsTypeId(TypeId.Unit) && GetCaster().IsAIEnabled; - } - - SpellCastResult CheckCast() - { - return GetCaster().GetAI().SelectTarget(SelectAggroTarget.Random, 0, new BoneSpikeTargetSelector(GetCaster().GetAI())) ? SpellCastResult.SpellCastOk : SpellCastResult.NoValidTargets; - } - - void HandleSpikes(uint effIndex) - { - PreventHitDefaultEffect(effIndex); - Creature marrowgar = GetCaster().ToCreature(); - if (marrowgar) - { - CreatureAI marrowgarAI = marrowgar.GetAI(); - byte boneSpikeCount = (byte)(Convert.ToBoolean((int)GetCaster().GetMap().GetDifficultyID() & 1) ? 3 : 1); - - List targets = marrowgarAI.SelectTargetList(boneSpikeCount, SelectAggroTarget.Random, 1, new BoneSpikeTargetSelector(marrowgarAI)); - if (targets.Empty()) - return; - - uint i = 0; - foreach (var target in targets) - { - target.CastSpell(target, Misc.BoneSpikeSummonId[i], true); - if (!target.IsAlive()) // make sure we don't get any stuck spikes on dead targets - { - Aura aura = target.GetAura(SpellIds.Impaled); - if (aura != null) - { - Creature spike = ObjectAccessor.GetCreature(target, aura.GetCasterGUID()); - if (spike != null) - spike.DespawnOrUnsummon(); - aura.Remove(); - } - } - i++; - } - - marrowgarAI.Talk(Texts.SayBonespike); - } - } - - public override void Register() - { - OnCheckCast.Add(new CheckCastHandler(CheckCast)); - OnEffectHitTarget.Add(new EffectHandler(HandleSpikes, 1, SpellEffectName.ApplyAura)); - } - } - - [Script] - class spell_marrowgar_bone_storm : SpellScript - { - void RecalculateDamage() - { - SetHitDamage((int)(GetHitDamage() / Math.Max(Math.Sqrt(GetHitUnit().GetExactDist2d(GetCaster())), 1.0f))); - } - - public override void Register() - { - OnHit.Add(new HitHandler(RecalculateDamage)); - } - } - - [Script] - class spell_marrowgar_bone_slice : SpellScript - { - public override bool Load() - { - _targetCount = 0; - return true; - } - - void ClearSpikeImmunities() - { - GetCaster().GetAI().DoAction(Misc.ActionClearSpikeImmunities); - } - - void CountTargets(List targets) - { - _targetCount = (uint)Math.Min(targets.Count, GetSpellInfo().MaxAffectedTargets); - } - - void SplitDamage() - { - // Mark the unit as hit, even if the spell missed or was dodged/parried - GetCaster().GetAI().SetGUID(GetHitUnit().GetGUID(), Misc.DataSpikeImmune); - - if (_targetCount == 0) - return; // This spell can miss all targets - - SetHitDamage((int)(GetHitDamage() / _targetCount)); - } - - public override void Register() - { - BeforeCast.Add(new CastHandler(ClearSpikeImmunities)); - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(CountTargets, 0, Targets.UnitDestAreaEnemy)); - OnHit.Add(new HitHandler(SplitDamage)); - } - - uint _targetCount; - } - - } -} diff --git a/Source/Scripts/Northrend/IcecrownCitadel/Sindragosa.cs b/Source/Scripts/Northrend/IcecrownCitadel/Sindragosa.cs deleted file mode 100644 index 6d2f7bf1b..000000000 --- a/Source/Scripts/Northrend/IcecrownCitadel/Sindragosa.cs +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Game.Entities; - -namespace Scripts.Northrend.IcecrownCitadel -{ - public class Sindragosa - { - Position RimefangFlyPos = new Position(4413.309f, 2456.421f, 233.3795f, 2.890186f); - Position RimefangLandPos = new Position(4413.309f, 2456.421f, 203.3848f, 2.890186f); - Position SpinestalkerFlyPos = new Position(4418.895f, 2514.233f, 230.4864f, 3.396045f); - Position SpinestalkerLandPos = new Position(4418.895f, 2514.233f, 203.3848f, 3.396045f); - public static Position SindragosaSpawnPos = new Position(4818.700f, 2483.710f, 287.0650f, 3.089233f); - Position SindragosaFlyPos = new Position(4475.190f, 2484.570f, 234.8510f, 3.141593f); - Position SindragosaLandPos = new Position(4419.190f, 2484.570f, 203.3848f, 3.141593f); - Position SindragosaAirPos = new Position(4475.990f, 2484.430f, 247.9340f, 3.141593f); - Position SindragosaAirPosFar = new Position(4525.600f, 2485.150f, 245.0820f, 3.141593f); - Position SindragosaFlyInPos = new Position(4419.190f, 2484.360f, 232.5150f, 3.141593f); - } -} diff --git a/Source/Scripts/Northrend/IcecrownCitadel/TheLichKing.cs b/Source/Scripts/Northrend/IcecrownCitadel/TheLichKing.cs deleted file mode 100644 index 7ff7b38b3..000000000 --- a/Source/Scripts/Northrend/IcecrownCitadel/TheLichKing.cs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Game.Entities; - -namespace Scripts.Northrend.IcecrownCitadel -{ - public class TheLichKing - { - Position CenterPosition = new Position(503.6282f, -2124.655f, 840.8569f, 0.0f); - Position TirionIntro = new Position(489.2970f, -2124.840f, 840.8569f, 0.0f); - Position TirionCharge = new Position(482.9019f, -2124.479f, 840.8570f, 0.0f); - Position[] LichKingIntro = - { - new Position(432.0851f, -2123.673f, 864.6582f, 0.0f), - new Position(457.8351f, -2123.423f, 841.1582f, 0.0f), - new Position(465.0730f, -2123.470f, 840.8569f, 0.0f), - }; - Position OutroPosition1 = new Position(493.6286f, -2124.569f, 840.8569f, 0.0f); - Position OutroFlying = new Position(508.9897f, -2124.561f, 845.3565f, 0.0f); - public static Position TerenasSpawn = new Position(495.5542f, -2517.012f, 1050.000f, 4.6993f); - Position TerenasSpawnHeroic = new Position(495.7080f, -2523.760f, 1050.000f, 0.0f); - public static Position SpiritWardenSpawn = new Position(495.3406f, -2529.983f, 1050.000f, 1.5592f); - } -} diff --git a/Source/Scripts/Northrend/IcecrownCitadel/ValithriaDreamwalker.cs b/Source/Scripts/Northrend/IcecrownCitadel/ValithriaDreamwalker.cs deleted file mode 100644 index 4297352b3..000000000 --- a/Source/Scripts/Northrend/IcecrownCitadel/ValithriaDreamwalker.cs +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Game.Entities; - -namespace Scripts.Northrend.IcecrownCitadel -{ - public class ValithriaDreamwalker - { - public static Position ValithriaSpawnPos = new Position(4210.813f, 2484.443f, 364.9558f, 0.01745329f); - } -} diff --git a/Source/Scripts/Northrend/Naxxramas/BossAnubrekhan.cs b/Source/Scripts/Northrend/Naxxramas/BossAnubrekhan.cs deleted file mode 100644 index 7a1ce51ca..000000000 --- a/Source/Scripts/Northrend/Naxxramas/BossAnubrekhan.cs +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -namespace Scripts.Northrend.Naxxramas -{ - struct TextIds - { - public const uint SayAggro = 0; - public const uint SayGreet = 1; - public const uint SaySlay = 2; - - public const uint EmoteLocust = 3; - - public const uint EmoteFrenzy = 0; - public const uint EmoteSpawn = 1; - public const uint EmoteScarab = 2; - } - - struct EventIds - { - public const uint Impale = 1; // Cast Impale On A Random Target - public const uint Locust = 2; // Begin Channeling Locust Swarm - public const uint LocustEnds = 3; // Locust Swarm Dissipates - public const uint SpawnGuard = 4; // 10-Man Only - Crypt Guard Has Delayed Spawn; Also Used For The Locust Swarm Crypt Guard In Both Modes - public const uint Scarabs = 5; // Spawn Corpse Scarabs - public const uint Berserk = 6; // Berserk - } - - struct SpellIds - { - public const uint Impale = 28783; // 25-Man: 56090 - public const uint LocustSwarm = 28785; // 25-Man: 54021 - public const uint SummonCorpseScarabsPlr = 29105; // This Spawns 5 Corpse Scarabs On Top Of Player - public const uint SummonCorpseScarabsMob = 28864; // This Spawns 10 Corpse Scarabs On Top Of Dead Guards - public const uint Berserk = 27680; - } - - struct Misc - { - public const uint achievTimedStartEvent = 9891; - - public const uint PhaseNormal = 1; - public const uint PhaseSwarm = 2; - - public const uint SpawnGroupsInitial25M = 1; - public const uint SpawnGroupsSingleSpawn = 2; - } -} diff --git a/Source/Scripts/Northrend/Nexus/EyeOfEternity/BossMalygos.cs b/Source/Scripts/Northrend/Nexus/EyeOfEternity/BossMalygos.cs deleted file mode 100644 index 565772a6a..000000000 --- a/Source/Scripts/Northrend/Nexus/EyeOfEternity/BossMalygos.cs +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -namespace Scripts.Northrend.Nexus.EyeOfEternity -{ - class BossMalygos - { - } -} \ No newline at end of file diff --git a/Source/Scripts/Northrend/Nexus/EyeOfEternity/EyeOfEternity.cs b/Source/Scripts/Northrend/Nexus/EyeOfEternity/EyeOfEternity.cs deleted file mode 100644 index 3b6d1e985..000000000 --- a/Source/Scripts/Northrend/Nexus/EyeOfEternity/EyeOfEternity.cs +++ /dev/null @@ -1,351 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Framework.GameMath; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using System.Collections.Generic; -using System.Linq; - -namespace Scripts.Northrend.Nexus.EyeOfEternity -{ - struct EyeOfEternityConst - { - public const uint MaxEncounter = 1; - public const uint EventFocusingIris = 20711; - } - - struct InstanceData - { - public const uint MalygosEvent = 1; - public const uint VortexHandling = 2; - public const uint PowerSparksHandling = 3; - public const uint RespawnIris = 4; - } - - struct InstanceData64 - { - public const uint Trigger = 0; - public const uint Malygos = 1; - public const uint Platform = 2; - public const uint AlexstraszaBunnyGUID = 3; - public const uint HeartOfMagicGUID = 4; - public const uint FocusingIrisGUID = 5; - public const uint GiftBoxBunnyGUID = 6; - } - - struct InstanceNpcs - { - public const uint Malygos = 28859; - public const uint VortexTrigger = 30090; - public const uint PortalTrigger = 30118; - public const uint PowerSpark = 30084; - public const uint HoverDiskMelee = 30234; - public const uint HoverDiskCaster = 30248; - public const uint ArcaneOverload = 30282; - public const uint WyrmrestSkytalon = 30161; - public const uint Alexstrasza = 32295; - public const uint AlexstraszaBunny = 31253; - public const uint AlexstraszasGift = 32448; - public const uint SurgeOfPower = 30334; - } - - struct InstanceGameObjects - { - public const uint NexusRaidPlatform = 193070; - public const uint ExitPortal = 193908; - public const uint FocusingIris10 = 193958; - public const uint FocusingIris25 = 193960; - public const uint AlexstraszaSGift10 = 193905; - public const uint AlexstraszaSGift25 = 193967; - public const uint HeartOfMagic10 = 194158; - public const uint HeartOfMagic25 = 194159; - } - - struct InstanceSpells - { - public const uint Vortex4 = 55853; // Damage | Used To Enter To The Vehicle - public const uint Vortex5 = 56263; // Damage | Used To Enter To The Vehicle - public const uint PortalOpened = 61236; - public const uint RideRedDragonTriggered = 56072; - public const uint IrisOpened = 61012; // Visual When Starting Encounter - public const uint SummomRedDragonBuddy = 56070; - } - - [Script] - class instance_eye_of_eternity : InstanceMapScript - { - public instance_eye_of_eternity() : base("instance_eye_of_eternity", 616) { } - - class instance_eye_of_eternity_InstanceMapScript : InstanceScript - { - public instance_eye_of_eternity_InstanceMapScript(InstanceMap map) : base(map) - { - SetHeaders("EOE"); - SetBossNumber(EyeOfEternityConst.MaxEncounter); - } - - public override void OnPlayerEnter(Player player) - { - if (GetBossState(0) == EncounterState.Done) - player.CastSpell(player, InstanceSpells.SummomRedDragonBuddy, true); - } - - public override bool SetBossState(uint type, EncounterState state) - { - if (!base.SetBossState(type, state)) - return false; - - if (type == InstanceData.MalygosEvent) - { - if (state == EncounterState.Fail) - { - foreach (var triggerGuid in portalTriggers) - { - Creature trigger = instance.GetCreature(triggerGuid); - if (trigger) - { - // just in case - trigger.RemoveAllAuras(); - trigger.GetAI().Reset(); - } - } - - SpawnGameObject(InstanceGameObjects.ExitPortal, exitPortalPosition); - - GameObject platform = instance.GetGameObject(platformGUID); - if (platform) - platform.RemoveFlag(GameObjectFlags.Destroyed); - } - else if (state == EncounterState.Done) - SpawnGameObject(InstanceGameObjects.ExitPortal, exitPortalPosition); - } - return true; - } - - // @todo this should be handled in map, maybe add a summon function in map - // There is no other way afaik... - void SpawnGameObject(uint entry, Position pos) - { - GameObject go = GameObject.CreateGameObject(entry, instance, pos, Quaternion.fromEulerAnglesZYX(pos.GetOrientation(), 0.0f, 0.0f), 255, GameObjectState.Ready); - if (go) - instance.AddToMap(go); - } - - public override void OnGameObjectCreate(GameObject go) - { - switch (go.GetEntry()) - { - case InstanceGameObjects.NexusRaidPlatform: - platformGUID = go.GetGUID(); - break; - case InstanceGameObjects.FocusingIris10: - case InstanceGameObjects.FocusingIris25: - irisGUID = go.GetGUID(); - focusingIrisPosition = go.GetPosition(); - break; - case InstanceGameObjects.ExitPortal: - exitPortalGUID = go.GetGUID(); - exitPortalPosition = go.GetPosition(); - break; - case InstanceGameObjects.HeartOfMagic10: - case InstanceGameObjects.HeartOfMagic25: - heartOfMagicGUID = go.GetGUID(); - break; - default: - break; - } - } - - public override void OnCreatureCreate(Creature creature) - { - switch (creature.GetEntry()) - { - case InstanceNpcs.VortexTrigger: - vortexTriggers.Add(creature.GetGUID()); - break; - case InstanceNpcs.Malygos: - malygosGUID = creature.GetGUID(); - break; - case InstanceNpcs.PortalTrigger: - portalTriggers.Add(creature.GetGUID()); - break; - case InstanceNpcs.AlexstraszaBunny: - alexstraszaBunnyGUID = creature.GetGUID(); - break; - case InstanceNpcs.AlexstraszasGift: - giftBoxBunnyGUID = creature.GetGUID(); - break; - } - } - - public override void OnUnitDeath(Unit unit) - { - if (!unit.IsTypeId(TypeId.Player)) - return; - - // Player continues to be moving after death no matter if spline will be cleared along with all movements, - // so on next world tick was all about delay if box will pop or not (when new movement will be registered) - // since in EoE you never stop falling. However root at this precise* moment works, - // it will get cleared on release. If by any chance some lag happen "Reload()" and "RepopMe()" works, - // last test I made now gave me 50/0 of this bug so I can't do more about it. - unit.SetControlled(true, UnitState.Root); - } - - public override void ProcessEvent(WorldObject obj, uint eventId) - { - if (eventId == EyeOfEternityConst.EventFocusingIris) - { - Creature alexstraszaBunny = instance.GetCreature(alexstraszaBunnyGUID); - if (alexstraszaBunny) - alexstraszaBunny.CastSpell(alexstraszaBunny, InstanceSpells.IrisOpened); - - GameObject iris = instance.GetGameObject(irisGUID); - if (iris) - iris.AddFlag(GameObjectFlags.InUse); - - Creature malygos = instance.GetCreature(malygosGUID); - if (malygos) - malygos.GetAI().DoAction(0); // ACTION_LAND_ENCOUNTER_START - - GameObject exitPortal = instance.GetGameObject(exitPortalGUID); - if (exitPortal) - exitPortal.Delete(); - } - } - - void VortexHandling() - { - Creature malygos = instance.GetCreature(malygosGUID); - if (malygos) - { - var threatList = malygos.GetThreatManager().GetThreatList(); - foreach (var guid in vortexTriggers) - { - if (threatList.Empty()) - return; - - byte counter = 0; - Creature trigger = instance.GetCreature(guid); - if (trigger) - { - // each trigger have to cast the spell to 5 players. - foreach (var refe in threatList) - { - if (counter >= 5) - break; - - Unit target = refe.GetTarget(); - if (target) - { - Player player = target.ToPlayer(); - - if (!player || player.IsGameMaster() || player.HasAura(InstanceSpells.Vortex4)) - continue; - - player.CastSpell(trigger, InstanceSpells.Vortex4, true); - counter++; - } - } - } - } - } - } - - void PowerSparksHandling() - { - bool next = (lastPortalGUID == portalTriggers.Last() || !lastPortalGUID.IsEmpty() ? true : false); - - foreach (var guid in portalTriggers) - { - if (next) - { - Creature trigger = instance.GetCreature(guid); - if (trigger) - { - lastPortalGUID = trigger.GetGUID(); - trigger.CastSpell(trigger, InstanceSpells.PortalOpened, true); - return; - } - } - - if (guid == lastPortalGUID) - next = true; - } - } - - public override void SetData(uint data, uint value) - { - switch (data) - { - case InstanceData.VortexHandling: - VortexHandling(); - break; - case InstanceData.PowerSparksHandling: - PowerSparksHandling(); - break; - case InstanceData.RespawnIris: - SpawnGameObject(instance.GetDifficultyID() == Difficulty.Raid10N ? InstanceGameObjects.FocusingIris10 : InstanceGameObjects.FocusingIris25, focusingIrisPosition); - break; - } - } - - public override ObjectGuid GetGuidData(uint data) - { - switch (data) - { - case InstanceData64.Trigger: - return vortexTriggers.First(); - case InstanceData64.Malygos: - return malygosGUID; - case InstanceData64.Platform: - return platformGUID; - case InstanceData64.AlexstraszaBunnyGUID: - return alexstraszaBunnyGUID; - case InstanceData64.HeartOfMagicGUID: - return heartOfMagicGUID; - case InstanceData64.FocusingIrisGUID: - return irisGUID; - case InstanceData64.GiftBoxBunnyGUID: - return giftBoxBunnyGUID; - } - - return ObjectGuid.Empty; - } - - List vortexTriggers = new List(); - List portalTriggers = new List(); - ObjectGuid malygosGUID; - ObjectGuid irisGUID; - ObjectGuid lastPortalGUID; - ObjectGuid platformGUID; - ObjectGuid exitPortalGUID; - ObjectGuid heartOfMagicGUID; - ObjectGuid alexstraszaBunnyGUID; - ObjectGuid giftBoxBunnyGUID; - Position focusingIrisPosition; - Position exitPortalPosition; - } - - public override InstanceScript GetInstanceScript(InstanceMap map) - { - return new instance_eye_of_eternity_InstanceMapScript(map); - } - } -} diff --git a/Source/Scripts/Northrend/Nexus/Nexus/BossAnomalus.cs b/Source/Scripts/Northrend/Nexus/Nexus/BossAnomalus.cs deleted file mode 100644 index c0c0e5e1b..000000000 --- a/Source/Scripts/Northrend/Nexus/Nexus/BossAnomalus.cs +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using System; - -namespace Scripts.Northrend.Nexus.Nexus -{ - struct AnomalusConst - { - //Spells - public const uint SpellSpark = 47751; - public const uint SpellSparkHeroic = 57062; - public const uint SpellRiftShield = 47748; - public const uint SpellChargeRift = 47747; // Works Wrong (Affect Players; Not Rifts) - public const uint SpellCreateRift = 47743; // Don'T Work; Using Wa - public const uint SpellArcaneAttraction = 57063; // No Idea; When It'S Used - - public const uint SpellChaoticEnergyBurst = 47688; - public const uint SpellChargedChaoticEnergyBurst = 47737; - public const uint SpellArcaneform = 48019; // Chaotic Rift Visual - - //Texts - public const uint SayAggro = 0; - public const uint SayDeath = 1; - public const uint SayRift = 2; - public const uint SayShield = 3; - public const uint SayRiftEmote = 4; // Needs To Be Added To Script - public const uint SayShieldEmote = 5; // Needs To Be Added To Script - - //Misc - public const uint NpcCrazedManaWraith = 26746; - public const uint NpcChaoticRift = 26918; - - public const uint DataChaosTheory = 1; - - public static Position[] RiftLocation = - { - new Position(652.64f, -273.70f, -8.75f, 0.0f), - new Position(634.45f, -265.94f, -8.44f, 0.0f), - new Position(620.73f, -281.17f, -9.02f, 0.0f), - new Position(626.10f, -304.67f, -9.44f, 0.0f), - new Position(639.87f, -314.11f, -9.49f, 0.0f), - new Position(651.72f, -297.44f, -9.37f, 0.0f) - }; - } - - [Script] - class boss_anomalus : ScriptedAI - { - public boss_anomalus(Creature creature) : base(creature) - { - instance = me.GetInstanceScript(); - } - - void Initialize() - { - _scheduler.Schedule(TimeSpan.FromSeconds(5), task => - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0); - if (target) - DoCast(target, AnomalusConst.SpellSpark); - - task.Repeat(TimeSpan.FromSeconds(5)); - }); - - Phase = 0; - uiChaoticRiftGUID.Clear(); - chaosTheory = true; - } - - public override void Reset() - { - Initialize(); - - instance.SetBossState(DataTypes.Anomalus, EncounterState.NotStarted); - } - - public override void EnterCombat(Unit who) - { - Talk(AnomalusConst.SayAggro); - - instance.SetBossState(DataTypes.Anomalus, EncounterState.InProgress); - } - - public override void JustDied(Unit killer) - { - Talk(AnomalusConst.SayDeath); - - instance.SetBossState(DataTypes.Anomalus, EncounterState.Done); - } - - public override uint GetData(uint type) - { - if (type == AnomalusConst.DataChaosTheory) - return chaosTheory ? 1 : 0u; - - return 0; - } - - public override void SummonedCreatureDies(Creature summoned, Unit who) - { - if (summoned.GetEntry() == AnomalusConst.NpcChaoticRift) - chaosTheory = false; - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - if (me.GetDistance(me.GetHomePosition()) > 60.0f) - { - // Not blizzlike, hack to avoid an exploit - EnterEvadeMode(); - return; - } - - if (me.HasAura(AnomalusConst.SpellRiftShield)) - { - if (!uiChaoticRiftGUID.IsEmpty()) - { - Creature Rift = ObjectAccessor.GetCreature(me, uiChaoticRiftGUID); - if (Rift && Rift.IsDead()) - { - me.RemoveAurasDueToSpell(AnomalusConst.SpellRiftShield); - uiChaoticRiftGUID.Clear(); - } - return; - } - } - else - uiChaoticRiftGUID.Clear(); - - if ((Phase == 0) && HealthBelowPct(50)) - { - Phase = 1; - Talk(AnomalusConst.SayShield); - DoCast(me, AnomalusConst.SpellRiftShield); - Creature Rift = me.SummonCreature(AnomalusConst.NpcChaoticRift, AnomalusConst.RiftLocation[RandomHelper.IRand(0, 5)], TempSummonType.TimedDespawnOOC, 1000); - if (Rift) - { - //DoCast(Rift, SPELL_CHARGE_RIFT); - Unit target = SelectTarget(SelectAggroTarget.Random, 0); - if (target) - Rift.GetAI().AttackStart(target); - uiChaoticRiftGUID = Rift.GetGUID(); - Talk(AnomalusConst.SayRift); - } - } - - _scheduler.Update(diff); - - DoMeleeAttackIfReady(); - } - - InstanceScript instance; - - byte Phase; - ObjectGuid uiChaoticRiftGUID; - bool chaosTheory; - } - - [Script] - class npc_chaotic_rift : ScriptedAI - { - public npc_chaotic_rift(Creature creature) : base(creature) - { - Initialize(); - instance = me.GetInstanceScript(); - SetCombatMovement(false); - } - - void Initialize() - { - uiChaoticEnergyBurstTimer = 1000; - uiSummonCrazedManaWraithTimer = 5000; - } - - public override void Reset() - { - Initialize(); - me.SetDisplayFromModel(1); - DoCast(me, AnomalusConst.SpellArcaneform, false); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - if (uiChaoticEnergyBurstTimer <= diff) - { - Creature Anomalus = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.Anomalus)); - Unit target = SelectTarget(SelectAggroTarget.Random, 0); - if (target) - { - if (Anomalus && Anomalus.HasAura(AnomalusConst.SpellRiftShield)) - DoCast(target, AnomalusConst.SpellChargedChaoticEnergyBurst); - else - DoCast(target, AnomalusConst.SpellChaoticEnergyBurst); - } - uiChaoticEnergyBurstTimer = 1000; - } - else - uiChaoticEnergyBurstTimer -= diff; - - if (uiSummonCrazedManaWraithTimer <= diff) - { - Creature Wraith = me.SummonCreature(AnomalusConst.NpcCrazedManaWraith, me.GetPositionX() + 1, me.GetPositionY() + 1, me.GetPositionZ(), 0, TempSummonType.TimedDespawnOOC, 1000); - if (Wraith) - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0); - if (target) - Wraith.GetAI().AttackStart(target); - } - Creature Anomalus = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.Anomalus)); - if (Anomalus && Anomalus.HasAura(AnomalusConst.SpellRiftShield)) - uiSummonCrazedManaWraithTimer = 5000; - else - uiSummonCrazedManaWraithTimer = 10000; - } - else - uiSummonCrazedManaWraithTimer -= diff; - } - - InstanceScript instance; - - uint uiChaoticEnergyBurstTimer; - uint uiSummonCrazedManaWraithTimer; - } - - [Script] - class achievement_chaos_theory : AchievementCriteriaScript - { - public achievement_chaos_theory() : base("achievement_chaos_theory") - { - } - - public override bool OnCheck(Player player, Unit target) - { - if (!target) - return false; - - Creature Anomalus = target.ToCreature(); - if (Anomalus) - if (Anomalus.GetAI().GetData(AnomalusConst.DataChaosTheory) != 0) - return true; - - return false; - } - } -} diff --git a/Source/Scripts/Northrend/Nexus/Nexus/BossKeristrasza.cs b/Source/Scripts/Northrend/Nexus/Nexus/BossKeristrasza.cs deleted file mode 100644 index c28a8e6f1..000000000 --- a/Source/Scripts/Northrend/Nexus/Nexus/BossKeristrasza.cs +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using Game.Spells; -using System; -using System.Collections.Generic; - -namespace Scripts.Northrend.Nexus.Nexus -{ - struct KeristraszaConst - { - //Spells - public const uint SpellFrozenPrison = 47854; - public const uint SpellTailSweep = 50155; - public const uint SpellCrystalChains = 50997; - public const uint SpellEnrage = 8599; - public const uint SpellCrystalFireBreath = 48096; - public const uint SpellCrystalize = 48179; - public const uint SpellIntenseCold = 48094; - public const uint SpellIntenseColdTriggered = 48095; - - //Yells - public const uint SayAggro = 0; - public const uint SaySlay = 1; - public const uint SayEnrage = 2; - public const uint SayDeath = 3; - public const uint SayCrystalNova = 4; - public const uint SayFrenzy = 5; - - //Misc - public const uint DataIntenseCold = 1; - public const uint DataContainmentSpheres = 3; - } - - [Script] - public class boss_keristrasza : BossAI - { - public boss_keristrasza(Creature creature) : base(creature, DataTypes.Keristrasza) - { - Initialize(); - } - - void Initialize() - { - _enrage = false; - - //Crystal FireBreath - _scheduler.Schedule(TimeSpan.FromSeconds(14), task => - { - DoCastVictim(KeristraszaConst.SpellCrystalFireBreath); - task.Repeat(TimeSpan.FromSeconds(14)); - }); - - //CrystalChainsCrystalize - _scheduler.Schedule(TimeSpan.FromSeconds(DungeonMode(30, 11)), task => - { - Talk(KeristraszaConst.SayCrystalNova); - if (IsHeroic()) - DoCast(me, KeristraszaConst.SpellCrystalize); - else - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true); - if (target) - DoCast(target, KeristraszaConst.SpellCrystalChains); - } - - task.Repeat(TimeSpan.FromSeconds(DungeonMode(30, 11))); - }); - - //TailSweep - _scheduler.Schedule(TimeSpan.FromSeconds(5), task => - { - DoCast(me, KeristraszaConst.SpellTailSweep); - task.Repeat(TimeSpan.FromSeconds(5)); - }); - } - - public override void Reset() - { - Initialize(); - _intenseColdList.Clear(); - - me.RemoveUnitFlag(UnitFlags.Stunned); - - RemovePrison(CheckContainmentSpheres()); - _Reset(); - } - - public override void EnterCombat(Unit who) - { - Talk(KeristraszaConst.SayAggro); - DoCastAOE(KeristraszaConst.SpellIntenseCold); - _EnterCombat(); - } - - public override void JustDied(Unit killer) - { - Talk(KeristraszaConst.SayDeath); - _JustDied(); - } - - public override void KilledUnit(Unit who) - { - if (who.IsTypeId(TypeId.Player)) - Talk(KeristraszaConst.SaySlay); - } - - public bool CheckContainmentSpheres(bool removePrison = false) - { - for (uint i = DataTypes.AnomalusContainmetSphere; i < (DataTypes.AnomalusContainmetSphere + KeristraszaConst.DataContainmentSpheres); ++i) - { - GameObject containmentSpheres = ObjectAccessor.GetGameObject(me, instance.GetGuidData(i)); - if (!containmentSpheres || containmentSpheres.GetGoState() != GameObjectState.Active) - return false; - } - if (removePrison) - RemovePrison(true); - return true; - } - - void RemovePrison(bool remove) - { - if (remove) - { - me.RemoveUnitFlag(UnitFlags.ImmuneToPc); - me.RemoveUnitFlag(UnitFlags.NonAttackable); - if (me.HasAura(KeristraszaConst.SpellFrozenPrison)) - me.RemoveAurasDueToSpell(KeristraszaConst.SpellFrozenPrison); - } - else - { - me.AddUnitFlag(UnitFlags.ImmuneToPc); - me.AddUnitFlag(UnitFlags.NonAttackable); - DoCast(me, KeristraszaConst.SpellFrozenPrison, false); - } - } - - public override void SetGUID(ObjectGuid guid, int id = 0) - { - if (id == KeristraszaConst.DataIntenseCold) - _intenseColdList.Add(guid); - } - - public override void DamageTaken(Unit attacker, ref uint damage) - { - if (!_enrage && me.HealthBelowPctDamaged(25, damage)) - { - Talk(KeristraszaConst.SayEnrage); - Talk(KeristraszaConst.SayFrenzy); - DoCast(me, KeristraszaConst.SpellEnrage); - _enrage = true; - } - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - DoMeleeAttackIfReady(); - } - - bool _enrage; - - public List _intenseColdList = new List(); - } - - [Script] - class containment_sphere : GameObjectScript - { - public containment_sphere() : base("containment_sphere") { } - - class containment_sphereAI : GameObjectAI - { - public containment_sphereAI(GameObject go) : base(go) - { - instance = go.GetInstanceScript(); - } - - public override bool GossipHello(Player player) - { - Creature pKeristrasza = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.Keristrasza)); - if (pKeristrasza && pKeristrasza.IsAlive()) - { - // maybe these are hacks :( - me.AddFlag(GameObjectFlags.NotSelectable); - me.SetGoState(GameObjectState.Active); - - ((boss_keristrasza)pKeristrasza.GetAI()).CheckContainmentSpheres(true); - } - return true; - } - - InstanceScript instance; - } - - public override GameObjectAI GetAI(GameObject go) - { - return GetInstanceAI(go); - } - } - - [Script] - class spell_intense_cold : AuraScript - { - void HandlePeriodicTick(AuraEffect aurEff) - { - if (aurEff.GetBase().GetStackAmount() < 2) - return; - Unit caster = GetCaster(); - // @todo the caster should be boss but not the player - if (!caster || caster.GetAI() == null) - return; - - caster.GetAI().SetGUID(GetTarget().GetGUID(), (int)KeristraszaConst.DataIntenseCold); - } - - public override void Register() - { - OnEffectPeriodic.Add(new EffectPeriodicHandler(HandlePeriodicTick, 1, AuraType.PeriodicDamage)); - } - } - - [Script] - class achievement_intense_cold : AchievementCriteriaScript - { - public achievement_intense_cold() : base("achievement_intense_cold") { } - - public override bool OnCheck(Player player, Unit target) - { - if (!target) - return false; - - var _intenseColdList = ((boss_keristrasza)target.ToCreature().GetAI())._intenseColdList; - if (!_intenseColdList.Empty()) - { - foreach (var guid in _intenseColdList) - if (player.GetGUID() == guid) - return false; - } - - return true; - } - } -} diff --git a/Source/Scripts/Northrend/Nexus/Nexus/BossMagusTelestra.cs b/Source/Scripts/Northrend/Nexus/Nexus/BossMagusTelestra.cs deleted file mode 100644 index cf57c399f..000000000 --- a/Source/Scripts/Northrend/Nexus/Nexus/BossMagusTelestra.cs +++ /dev/null @@ -1,314 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; - -namespace Scripts.Northrend.Nexus.Nexus -{ - struct MagusTelestraConst - { - //Spells - public const uint SpellIceNova = 47772; - public const uint SpellIceNovaH = 56935; - public const uint SpellFirebomb = 47773; - public const uint SpellFirebombH = 56934; - public const uint SpellGravityWell = 47756; - public const uint SpellTelestraBack = 47714; - public const uint SpellFireMagusVisual = 47705; - public const uint SpellFrostMagusVisual = 47706; - public const uint SpellArcaneMagusVisual = 47704; - public const uint SpellWearChristmasHat = 61400; - - //Npcs - public const uint NpcFireMagus = 26928; - public const uint NpcFrostMagus = 26930; - public const uint NpcArcaneMagus = 26929; - - //Texts - public const uint SayAggro = 0; - public const uint SayKill = 1; - public const uint SayDeath = 2; - public const uint SayMerge = 3; - public const uint SaySplit = 4; - - //Misc - public const uint DataSplitPersonality = 1; - public const ushort GameEventWinterVeil = 2; - } - - [Script] - class boss_magus_telestra : ScriptedAI - { - public boss_magus_telestra(Creature creature) : base(creature) - { - instance = creature.GetInstanceScript(); - bFireMagusDead = false; - bFrostMagusDead = false; - bArcaneMagusDead = false; - uiIsWaitingToAppearTimer = 0; - } - - void Initialize() - { - Phase = 0; - - uiIceNovaTimer = 7 * Time.InMilliseconds; - uiFireBombTimer = 0; - uiGravityWellTimer = 15 * Time.InMilliseconds; - uiCooldown = 0; - - for (byte n = 0; n < 3; ++n) - time[n] = 0; - - splitPersonality = 0; - bIsWaitingToAppear = false; - } - - public override void Reset() - { - Initialize(); - - me.RemoveUnitFlag(UnitFlags.NotSelectable); - - instance.SetBossState(DataTypes.MagusTelestra, EncounterState.NotStarted); - - if (IsHeroic() && Global.GameEventMgr.IsActiveEvent(MagusTelestraConst.GameEventWinterVeil) && !me.HasAura(MagusTelestraConst.SpellWearChristmasHat)) - me.AddAura(MagusTelestraConst.SpellWearChristmasHat, me); - } - - public override void EnterCombat(Unit who) - { - Talk(MagusTelestraConst.SayAggro); - - instance.SetBossState(DataTypes.MagusTelestra, EncounterState.InProgress); - } - - public override void JustDied(Unit killer) - { - Talk(MagusTelestraConst.SayDeath); - - instance.SetBossState(DataTypes.MagusTelestra, EncounterState.Done); - } - - public override void KilledUnit(Unit who) - { - if (who.IsTypeId(TypeId.Player)) - Talk(MagusTelestraConst.SayKill); - } - - public override uint GetData(uint type) - { - if (type == MagusTelestraConst.DataSplitPersonality) - return splitPersonality; - - return 0; - } - - public override void UpdateAI(uint diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (bIsWaitingToAppear) - { - me.StopMoving(); - me.AttackStop(); - if (uiIsWaitingToAppearTimer <= diff) - { - me.CastSpell(me, 47714, true); - me.RemoveUnitFlag(UnitFlags.NotSelectable); - bIsWaitingToAppear = false; - InVanish = false; - me.SendAIReaction(AiReaction.Hostile); - } - else - uiIsWaitingToAppearTimer -= diff; - - return; - } - - if ((Phase == 1) || (Phase == 3)) - { - if (bFireMagusDead && bFrostMagusDead && bArcaneMagusDead) - { - for (byte n = 0; n < 3; ++n) - time[n] = 0; - - me.GetMotionMaster().Clear(); - DoCast(me, MagusTelestraConst.SpellTelestraBack); - if (Phase == 1) - Phase = 2; - if (Phase == 3) - Phase = 4; - bIsWaitingToAppear = true; - uiIsWaitingToAppearTimer = 4 * Time.InMilliseconds; - Talk(MagusTelestraConst.SayMerge); - } - else - return; - } - - if ((Phase == 0) && HealthBelowPct(50)) - { - InVanish = true; - Phase = 1; - me.CastStop(); - me.RemoveAllAuras(); - me.CastSpell(me, 47710, false); - me.AddUnitFlag(UnitFlags.NotSelectable); - bFireMagusDead = false; - bFrostMagusDead = false; - bArcaneMagusDead = false; - Talk(MagusTelestraConst.SaySplit); - return; - } - - if (IsHeroic() && (Phase == 2) && HealthBelowPct(10)) - { - InVanish = true; - Phase = 3; - me.CastStop(); - me.RemoveAllAuras(); - me.AddUnitFlag(UnitFlags.NotSelectable); - bFireMagusDead = false; - bFrostMagusDead = false; - bArcaneMagusDead = false; - Talk(MagusTelestraConst.SaySplit); - return; - } - - if (uiCooldown != 0) - { - if (uiCooldown <= diff) - uiCooldown = 0; - else - { - uiCooldown -= diff; - return; - } - } - - if (uiIceNovaTimer <= diff) - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0); - if (target) - { - DoCast(target, MagusTelestraConst.SpellIceNova, false); - uiCooldown = 1500; - } - uiIceNovaTimer = 15 * Time.InMilliseconds; - } - else uiIceNovaTimer -= diff; - - if (uiGravityWellTimer <= diff) - { - Unit target = me.GetVictim(); - if (target) - { - DoCast(target, MagusTelestraConst.SpellGravityWell); - uiCooldown = 6 * Time.InMilliseconds; - } - uiGravityWellTimer = 15 * Time.InMilliseconds; - } - else uiGravityWellTimer -= diff; - - if (uiFireBombTimer <= diff) - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0); - if (target) - { - DoCast(target, MagusTelestraConst.SpellFirebomb, false); - uiCooldown = 2 * Time.InMilliseconds; - } - uiFireBombTimer = 2 * Time.InMilliseconds; - } - else uiFireBombTimer -= diff; - - if (!InVanish) - DoMeleeAttackIfReady(); - } - - public override void SummonedCreatureDies(Creature summon, Unit killer) - { - if (summon.IsAlive()) - return; - - switch (summon.GetEntry()) - { - case MagusTelestraConst.NpcFireMagus: - bFireMagusDead = true; - break; - case MagusTelestraConst.NpcFrostMagus: - bFrostMagusDead = true; - break; - case MagusTelestraConst.NpcArcaneMagus: - bArcaneMagusDead = true; - break; - } - - byte i = 0; - while (time[i] != 0) - ++i; - - time[i] = GameTime.GetGameTime(); - if (i == 2 && (time[2] - time[1] < 5) && (time[1] - time[0] < 5)) - ++splitPersonality; - } - - InstanceScript instance; - - bool bFireMagusDead; - bool bFrostMagusDead; - bool bArcaneMagusDead; - bool bIsWaitingToAppear; - bool InVanish; - - uint uiIsWaitingToAppearTimer; - uint uiIceNovaTimer; - uint uiFireBombTimer; - uint uiGravityWellTimer; - uint uiCooldown; - - byte Phase; - byte splitPersonality; - long[] time = new long[3]; - } - - [Script] - class achievement_split_personality : AchievementCriteriaScript - { - public achievement_split_personality() : base("achievement_split_personality") { } - - public override bool OnCheck(Player player, Unit target) - { - if (!target) - return false; - - Creature Telestra = target.ToCreature(); - if (Telestra) - if (Telestra.GetAI().GetData(MagusTelestraConst.DataSplitPersonality) == 2) - return true; - - return false; - } - } -} diff --git a/Source/Scripts/Northrend/Nexus/Nexus/BossNexusCommanders.cs b/Source/Scripts/Northrend/Nexus/Nexus/BossNexusCommanders.cs deleted file mode 100644 index f5d141129..000000000 --- a/Source/Scripts/Northrend/Nexus/Nexus/BossNexusCommanders.cs +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Scripting; -using System; - -namespace Scripts.Northrend.Nexus.Nexus -{ - struct NexusCommandersConst - { - //Spells - public const uint SpellBattleShout = 31403; - public const uint SpellCharge = 60067; - public const uint SpellFrighteningShout = 19134; - public const uint SpellWhirlwind = 38618; - public const uint SpellFrozenPrison = 47543; - - //Texts - public const uint SayAggro = 0; - public const uint SayKill = 1; - public const uint SayDeath = 2; - } - - [Script] - class boss_nexus_commanders : BossAI - { - boss_nexus_commanders(Creature creature) : base(creature, DataTypes.Commander) { } - - public override void EnterCombat(Unit who) - { - _EnterCombat(); - Talk(NexusCommandersConst.SayAggro); - me.RemoveAurasDueToSpell(NexusCommandersConst.SpellFrozenPrison); - DoCast(me, NexusCommandersConst.SpellBattleShout); - - //Charge - _scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(4), task => - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100.0f, true); - if (target) - DoCast(target, NexusCommandersConst.SpellCharge); - - task.Repeat(TimeSpan.FromSeconds(11), TimeSpan.FromSeconds(15)); - }); - - //Whirlwind - _scheduler.Schedule(TimeSpan.FromSeconds(6), TimeSpan.FromSeconds(8), task => - { - DoCast(me, NexusCommandersConst.SpellWhirlwind); - task.Repeat(TimeSpan.FromSeconds(19.5), TimeSpan.FromSeconds(25)); - }); - - //Frightening Shout - _scheduler.Schedule(TimeSpan.FromSeconds(13), TimeSpan.FromSeconds(15), task => - { - DoCastAOE(NexusCommandersConst.SpellFrighteningShout); - task.Repeat(TimeSpan.FromSeconds(45), TimeSpan.FromSeconds(55)); - }); - } - - public override void JustDied(Unit killer) - { - _JustDied(); - Talk(NexusCommandersConst.SayDeath); - } - - public override void KilledUnit(Unit who) - { - if (who.IsTypeId(TypeId.Player)) - Talk(NexusCommandersConst.SayKill); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - DoMeleeAttackIfReady(); - } - } -} diff --git a/Source/Scripts/Northrend/Nexus/Nexus/BossOrmorok.cs b/Source/Scripts/Northrend/Nexus/Nexus/BossOrmorok.cs deleted file mode 100644 index 86a54bc3a..000000000 --- a/Source/Scripts/Northrend/Nexus/Nexus/BossOrmorok.cs +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Scripting; -using Game.Spells; -using System; - -namespace Scripts.Northrend.Nexus.Nexus -{ - struct OrmorokConst - { - //Spells - public const uint SpellReflection = 47981; - public const uint SpellTrample = 48016; - public const uint SpellFrenzy = 48017; - public const uint SpellSummonCrystallineTangler = 61564; - public const uint SpellCrystalSpikes = 47958; - - //Texts - public const uint SayAggro = 1; - public const uint SayDeath = 2; - public const uint SayReflect = 3; - public const uint SayCrystalSpikes = 4; - public const uint SayKill = 5; - public const uint SayFrenzy = 6; - } - - [Script] - class boss_ormorok : BossAI - { - public boss_ormorok(Creature creature) : base(creature, DataTypes.Ormorok) - { - Initialize(); - } - - void Initialize() - { - frenzy = false; - } - - public override void Reset() - { - base.Reset(); - Initialize(); - } - - public override void EnterCombat(Unit who) - { - _EnterCombat(); - - //Crystal Spikes - _scheduler.Schedule(TimeSpan.FromSeconds(12), task => - { - Talk(OrmorokConst.SayCrystalSpikes); - DoCast(OrmorokConst.SpellCrystalSpikes); - task.Repeat(TimeSpan.FromSeconds(12)); - }); - - //Trample - _scheduler.Schedule(TimeSpan.FromSeconds(10), task => - { - DoCast(me, OrmorokConst.SpellTrample); - task.Repeat(TimeSpan.FromSeconds(10)); - }); - - //Spell Reflection - _scheduler.Schedule(TimeSpan.FromSeconds(30), task => - { - Talk(OrmorokConst.SayReflect); - DoCast(me, OrmorokConst.SpellReflection); - task.Repeat(TimeSpan.FromSeconds(30)); - }); - - //Heroic Crystalline Tangler - if (IsHeroic()) - { - _scheduler.Schedule(TimeSpan.FromSeconds(17), task => - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, new OrmorokTanglerPredicate(me)); - if (target) - DoCast(target, OrmorokConst.SpellSummonCrystallineTangler); - - task.Repeat(TimeSpan.FromSeconds(17)); - }); - } - - Talk(OrmorokConst.SayAggro); - } - - public override void DamageTaken(Unit attacker, ref uint damage) - { - if (!frenzy && HealthBelowPct(25)) - { - Talk(OrmorokConst.SayFrenzy); - DoCast(me, OrmorokConst.SpellFrenzy); - frenzy = true; - } - } - - public override void JustDied(Unit killer) - { - _JustDied(); - Talk(OrmorokConst.SayDeath); - } - - public override void KilledUnit(Unit who) - { - if (who.IsTypeId(TypeId.Player)) - Talk(OrmorokConst.SayKill); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - DoMeleeAttackIfReady(); - } - - bool frenzy; - } - - class OrmorokTanglerPredicate : ISelector - { - public OrmorokTanglerPredicate(Unit unit) - { - me = unit; - } - - public bool Check(Unit target) - { - return target.GetDistance2d(me) >= 5.0f; - } - - Unit me; - } - - struct CrystalSpikesConst - { - public const uint NpcCrystalSpikeInitial = 27101; - public const uint NpcCrystalSpikeTrigger = 27079; - - public const uint DataCount = 1; - public const uint MaxCount = 5; - - public const uint SpellCrystalSpikeDamage = 47944; - - public const uint GoCrystalSpikeTrap = 188537; - - - public static uint[] CrystalSpikeSummon = - { - 47936, - 47942, - 7943 - }; - } - - [Script] - class npc_crystal_spike_trigger : ScriptedAI - { - public npc_crystal_spike_trigger(Creature creature) : base(creature) { } - - public override void IsSummonedBy(Unit owner) - { - switch (me.GetEntry()) - { - case CrystalSpikesConst.NpcCrystalSpikeInitial: - _count = 0; - me.SetFacingToObject(owner); - break; - case CrystalSpikesConst.NpcCrystalSpikeTrigger: - Creature trigger = owner.ToCreature(); - if (trigger) - _count = trigger.GetAI().GetData(CrystalSpikesConst.DataCount) + 1; - break; - default: - _count = CrystalSpikesConst.MaxCount; - break; - } - - if (me.GetEntry() == CrystalSpikesConst.NpcCrystalSpikeTrigger) - { - GameObject trap = me.FindNearestGameObject(CrystalSpikesConst.GoCrystalSpikeTrap, 1.0f); - if (trap) - trap.Use(me); - } - - //Despawn - _scheduler.Schedule(TimeSpan.FromSeconds(2), task => - { - if (me.GetEntry() == CrystalSpikesConst.NpcCrystalSpikeTrigger) - { - GameObject trap = me.FindNearestGameObject(CrystalSpikesConst.GoCrystalSpikeTrap, 1.0f); - if (trap) - trap.Delete(); - } - - me.DespawnOrUnsummon(); - }); - } - - public override uint GetData(uint type) - { - return type == CrystalSpikesConst.DataCount ? _count : 0; - } - - public override void UpdateAI(uint diff) - { - _scheduler.Update(diff); - } - - uint _count; - } - - [Script] - class spell_crystal_spike : AuraScript - { - void HandlePeriodic(AuraEffect aurEff) - { - Unit target = GetTarget(); - if (target.GetEntry() == CrystalSpikesConst.NpcCrystalSpikeInitial || target.GetEntry() == CrystalSpikesConst.NpcCrystalSpikeTrigger) - { - Creature trigger = target.ToCreature(); - if (trigger) - { - uint spell = target.GetEntry() == CrystalSpikesConst.NpcCrystalSpikeInitial ? CrystalSpikesConst.CrystalSpikeSummon[0] : CrystalSpikesConst.CrystalSpikeSummon[RandomHelper.IRand(0, 2)]; - if (trigger.GetAI().GetData(CrystalSpikesConst.DataCount) < CrystalSpikesConst.MaxCount) - trigger.CastSpell(trigger, spell, true); - } - } - } - - public override void Register() - { - OnEffectPeriodic.Add(new EffectPeriodicHandler(HandlePeriodic, 0, AuraType.PeriodicDummy)); - } - } -} diff --git a/Source/Scripts/Northrend/Nexus/Nexus/InstanceNexus.cs b/Source/Scripts/Northrend/Nexus/Nexus/InstanceNexus.cs deleted file mode 100644 index cee2ebc88..000000000 --- a/Source/Scripts/Northrend/Nexus/Nexus/InstanceNexus.cs +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.Entities; -using Game.Maps; -using Game.Scripting; - -namespace Scripts.Northrend.Nexus.Nexus -{ - struct DataTypes - { - public const uint Commander = 0; - public const uint MagusTelestra = 1; - public const uint Anomalus = 2; - public const uint Ormorok = 3; - public const uint Keristrasza = 4; - - public const uint AnomalusContainmetSphere = 5; - public const uint OrmorokContainmetSphere = 6; - public const uint TelestraContainmetSphere = 7; - } - - struct CreatureIds - { - public const uint Anomalus = 26763; - public const uint Keristrasza = 26723; - - // Alliance - public const uint AllianceBerserker = 26800; - public const uint AllianceRanger = 26802; - public const uint AllianceCleric = 26805; - public const uint AllianceCommander = 27949; - public const uint CommanderStoutbeard = 26796; - - // Horde - public const uint HordeBerserker = 26799; - public const uint HordeRanger = 26801; - public const uint HordeCleric = 26803; - public const uint HordeCommander = 27947; - public const uint CommanderKolurg = 26798; - } - - struct GameObjectIds - { - public const uint AnomalusContainmetSphere = 188527; - public const uint OrmoroksContainmetSphere = 188528; - public const uint TelestrasContainmetSphere = 188526; - } - - [Script] - class instance_nexus : InstanceMapScript - { - public instance_nexus() : base(nameof(instance_nexus), 576) { } - - class instance_nexus_InstanceMapScript : InstanceScript - { - public instance_nexus_InstanceMapScript(InstanceMap map) : base(map) - { - SetHeaders("NEX"); - SetBossNumber(DataTypes.Keristrasza + 1); - _teamInInstance = 0; - } - - public override void OnPlayerEnter(Player player) - { - if (_teamInInstance == 0) - _teamInInstance = player.GetTeam(); - } - - public override void OnCreatureCreate(Creature creature) - { - switch (creature.GetEntry()) - { - case CreatureIds.Anomalus: - AnomalusGUID = creature.GetGUID(); - break; - case CreatureIds.Keristrasza: - KeristraszaGUID = creature.GetGUID(); - break; - // Alliance npcs are spawned by default, if you are alliance, you will fight against horde npcs. - case CreatureIds.AllianceBerserker: - if (ServerAllowsTwoSideGroups()) - creature.SetFaction(16); - if (_teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.HordeBerserker); - break; - case CreatureIds.AllianceRanger: - if (ServerAllowsTwoSideGroups()) - creature.SetFaction(16); - if (_teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.HordeRanger); - break; - case CreatureIds.AllianceCleric: - if (ServerAllowsTwoSideGroups()) - creature.SetFaction(16); - if (_teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.HordeCleric); - break; - case CreatureIds.AllianceCommander: - if (ServerAllowsTwoSideGroups()) - creature.SetFaction(16); - if (_teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.HordeCommander); - break; - case CreatureIds.CommanderStoutbeard: - if (ServerAllowsTwoSideGroups()) - creature.SetFaction(16); - if (_teamInInstance == Team.Alliance) - creature.UpdateEntry(CreatureIds.CommanderKolurg); - break; - default: - break; - } - } - - public override void OnGameObjectCreate(GameObject go) - { - switch (go.GetEntry()) - { - case GameObjectIds.AnomalusContainmetSphere: - AnomalusContainmentSphere = go.GetGUID(); - if (GetBossState(DataTypes.Anomalus) == EncounterState.Done) - go.RemoveFlag(GameObjectFlags.NotSelectable); - break; - case GameObjectIds.OrmoroksContainmetSphere: - OrmoroksContainmentSphere = go.GetGUID(); - if (GetBossState(DataTypes.Ormorok) == EncounterState.Done) - go.RemoveFlag(GameObjectFlags.NotSelectable); - break; - case GameObjectIds.TelestrasContainmetSphere: - TelestrasContainmentSphere = go.GetGUID(); - if (GetBossState(DataTypes.MagusTelestra) == EncounterState.Done) - go.RemoveFlag(GameObjectFlags.NotSelectable); - break; - default: - break; - } - } - - public override bool SetBossState(uint type, EncounterState state) - { - if (!base.SetBossState(type, state)) - return false; - - switch (type) - { - case DataTypes.MagusTelestra: - if (state == EncounterState.Done) - { - GameObject sphere = instance.GetGameObject(TelestrasContainmentSphere); - if (sphere) - sphere.RemoveFlag(GameObjectFlags.NotSelectable); - } - break; - case DataTypes.Anomalus: - if (state == EncounterState.Done) - { - GameObject sphere = instance.GetGameObject(AnomalusContainmentSphere); - if (sphere) - sphere.RemoveFlag(GameObjectFlags.NotSelectable); - } - break; - case DataTypes.Ormorok: - if (state == EncounterState.Done) - { - GameObject sphere = instance.GetGameObject(OrmoroksContainmentSphere); - if (sphere) - sphere.RemoveFlag(GameObjectFlags.NotSelectable); - } - break; - default: - break; - } - - return true; - } - - public override ObjectGuid GetGuidData(uint type) - { - switch (type) - { - case DataTypes.Anomalus: - return AnomalusGUID; - case DataTypes.Keristrasza: - return KeristraszaGUID; - case DataTypes.AnomalusContainmetSphere: - return AnomalusContainmentSphere; - case DataTypes.OrmorokContainmetSphere: - return OrmoroksContainmentSphere; - case DataTypes.TelestraContainmetSphere: - return TelestrasContainmentSphere; - default: - break; - } - - return ObjectGuid.Empty; - } - - ObjectGuid AnomalusGUID; - ObjectGuid KeristraszaGUID; - ObjectGuid AnomalusContainmentSphere; - ObjectGuid OrmoroksContainmentSphere; - ObjectGuid TelestrasContainmentSphere; - Team _teamInInstance; - } - - public override InstanceScript GetInstanceScript(InstanceMap map) - { - return new instance_nexus_InstanceMapScript(map); - } - } -} diff --git a/Source/Scripts/Northrend/Nexus/Oculus/InstanceOculus.cs b/Source/Scripts/Northrend/Nexus/Oculus/InstanceOculus.cs deleted file mode 100644 index 476a03f87..000000000 --- a/Source/Scripts/Northrend/Nexus/Oculus/InstanceOculus.cs +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -namespace Scripts.Northrend.Nexus.Oculus -{ - /* - struct DataTypes - { - // Encounter States/Boss GUIDs - public const uint Drakos = 0; - public const uint Varos = 1; - public const uint Urom = 2; - public const uint Eregos = 3; - // GPS System - public const uint Constructs = 4; - } - - class instance_oculus : InstanceMapScript - { - public instance_oculus() : base(nameof(instance_oculus), 578) { } - - class instance_oculus_InstanceMapScript : InstanceScript - { - public instance_oculus_InstanceMapScript(Map map) : base(map) - { - SetHeaders("OC"); - SetBossNumber(DataTypes.Eregos + 1); - LoadDoorData(doorData); - - CentrifugueConstructCounter = 0; - } - - public override void OnCreatureCreate(Creature creature) - { - switch (creature.GetEntry()) - { - case NPC_DRAKOS: - DrakosGUID = creature.GetGUID(); - break; - case NPC_VAROS: - VarosGUID = creature.GetGUID(); - if (GetBossState(DATA_DRAKOS) == EncounterState.Done) - creature.SetPhaseMask(1, true); - break; - case NPC_UROM: - UromGUID = creature.GetGUID(); - if (GetBossState(DATA_VAROS) == EncounterState.Done) - creature.SetPhaseMask(1, true); - break; - case NPC_EREGOS: - EregosGUID = creature.GetGUID(); - if (GetBossState(DATA_UROM) == EncounterState.Done) - creature.SetPhaseMask(1, true); - break; - case NPC_CENTRIFUGE_CONSTRUCT: - if (creature.IsAlive()) - DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, ++CentrifugueConstructCounter); - break; - case NPC_BELGARISTRASZ: - BelgaristraszGUID = creature.GetGUID(); - if (GetBossState(DATA_DRAKOS) == EncounterState.Done) - { - creature.AddNpcFlag(NPCFlags.Gossip); - creature.Relocate(BelgaristraszMove); - } - break; - case NPC_ETERNOS: - EternosGUID = creature.GetGUID(); - if (GetBossState(DATA_DRAKOS) == EncounterState.Done) - { - creature.AddNpcFlag(NPCFlags.Gossip); - creature.Relocate(EternosMove); - } - break; - case NPC_VERDISA: - VerdisaGUID = creature.GetGUID(); - if (GetBossState(DATA_DRAKOS) == EncounterState.Done) - { - creature.AddNpcFlag(NPCFlags.Gossip); - creature.Relocate(VerdisaMove); - } - break; - case NPC_GREATER_WHELP: - if (GetBossState(DATA_UROM) == EncounterState.Done) - { - creature.SetPhaseMask(1, true); - GreaterWhelpList.Add(creature.GetGUID()); - } - break; - default: - break; - } - } - - public override void OnGameObjectCreate(GameObject go) - { - switch (go.GetEntry()) - { - case GO_DRAGON_CAGE_DOOR: - AddDoor(go, true); - break; - case GO_EREGOS_CACHE_N: - case GO_EREGOS_CACHE_H: - EregosCacheGUID = go.GetGUID(); - break; - default: - break; - } - } - - public override void OnGameObjectRemove(GameObject go) - { - switch (go.GetEntry()) - { - case GO_DRAGON_CAGE_DOOR: - AddDoor(go, false); - break; - default: - break; - } - } - - public override void OnUnitDeath(Unit unit) - { - Creature creature = unit.ToCreature(); - if (!creature) - return; - - if (creature.GetEntry() == NPC_CENTRIFUGE_CONSTRUCT) - { - DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, --CentrifugueConstructCounter); - - if (CentrifugueConstructCounter == 0) - { - Creature varos = instance.GetCreature(VarosGUID); - if (varos) - varos.RemoveAllAuras(); - } - } - } - - public override void FillInitialWorldStates(InitWorldStates packet) - { - if (GetBossState(DATA_DRAKOS) == EncounterState.Done && GetBossState(DATA_VAROS) != EncounterState.Done) - { - packet.Worldstates.Add(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 1); - packet.Worldstates.Add(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, CentrifugueConstructCounter); - } - else - { - packet.Worldstates.Add(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 0); - packet.Worldstates.Add(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, 0); - } - } - - public override void ProcessEvent(WorldObject Unit, uint eventId) - { - if (eventId != EVENT_CALL_DRAGON) - return; - - Creature varos = instance.GetCreature(VarosGUID); - if (varos) - { - Creature drake = varos.SummonCreature(NPC_AZURE_RING_GUARDIAN, varos.GetPositionX(), varos.GetPositionY(), varos.GetPositionZ() + 40); - if (drake) - drake.GetAI().DoAction(ACTION_CALL_DRAGON_EVENT); - } - } - - public override bool SetBossState(uint type, EncounterState state) - { - if (!base.SetBossState(type, state)) - return false; - - switch (type) - { - case DATA_DRAKOS: - if (state == EncounterState.Done) - { - DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 1); - DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, CentrifugueConstructCounter); - FreeDragons(); - Creature varos = instance.GetCreature(VarosGUID); - if (varos) - varos.SetPhaseMask(1, true); - events.ScheduleEvent(EVENT_VAROS_INTRO, 15000); - } - break; - case DATA_VAROS: - if (state == EncounterState.Done) - { - DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 0); - Creature urom = instance.GetCreature(UromGUID); - if (urom) - urom.SetPhaseMask(1, true); - } - break; - case DATA_UROM: - if (state == EncounterState.Done) - { - Creature eregos = instance.GetCreature(EregosGUID); - if (eregos) - { - eregos.SetPhaseMask(1, true); - GreaterWhelps(); - events.ScheduleEvent(EVENT_EREGOS_INTRO, 5000); - } - } - break; - case DATA_EREGOS: - if (state == EncounterState.Done) - { - GameObject cache = instance.GetGameObject(EregosCacheGUID); - if (cache) - { - cache.SetRespawnTime((int)cache.GetRespawnDelay()); - cache.RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - } - } - break; - } - - return true; - } - - public override uint GetData(uint type) - { - if (type == DATA_CONSTRUCTS) - { - if (CentrifugueConstructCounter == 0) - return KILL_NO_CONSTRUCT; - else if (CentrifugueConstructCounter == 1) - return KILL_ONE_CONSTRUCT; - else if (CentrifugueConstructCounter > 1) - return KILL_MORE_CONSTRUCT; - } - - return KILL_NO_CONSTRUCT; - } - - public override ObjectGuid GetGuidData(uint type) - { - switch (type) - { - case DATA_DRAKOS: - return DrakosGUID; - case DATA_VAROS: - return VarosGUID; - case DATA_UROM: - return UromGUID; - case DATA_EREGOS: - return EregosGUID; - default: - break; - } - - return ObjectGuid.Empty; - } - - void FreeDragons() - { - Creature belgaristrasz = instance.GetCreature(BelgaristraszGUID); - if (belgaristrasz) - { - belgaristrasz.SetWalk(true); - belgaristrasz.GetMotionMaster().MovePoint(POINT_MOVE_OUT, BelgaristraszMove); - } - - Creature eternos = instance.GetCreature(EternosGUID); - if (eternos) - { - eternos.SetWalk(true); - eternos.GetMotionMaster().MovePoint(POINT_MOVE_OUT, EternosMove); - } - - Creature verdisa = instance.GetCreature(VerdisaGUID); - if (verdisa) - { - verdisa.SetWalk(true); - verdisa.GetMotionMaster().MovePoint(POINT_MOVE_OUT, VerdisaMove); - } - } - - public override void Update(uint diff) - { - _events.Update(diff); - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case EVENT_VAROS_INTRO: - Creature varos = instance.GetCreature(VarosGUID); - if (varos) - varos.GetAI().Talk(SAY_VAROS_INTRO_TEXT); - break; - case EVENT_EREGOS_INTRO: - Creature eregos = instance.GetCreature(EregosGUID); - if (eregos) - eregos.GetAI().Talk(SAY_EREGOS_INTRO_TEXT); - break; - default: - break; - } - }); - } - - void GreaterWhelps() - { - foreach (ObjectGuid guid in GreaterWhelpList) - { - Creature gwhelp = instance.GetCreature(guid); - if (gwhelp) - gwhelp.SetPhaseMask(1, true); - } - } - - ObjectGuid DrakosGUID; - ObjectGuid VarosGUID; - ObjectGuid UromGUID; - ObjectGuid EregosGUID; - - ObjectGuid BelgaristraszGUID; - ObjectGuid EternosGUID; - ObjectGuid VerdisaGUID; - - byte CentrifugueConstructCounter; - - ObjectGuid EregosCacheGUID; - - List GreaterWhelpList = new List(); - - EventMap events = new EventMap(); - } - - */ -} diff --git a/Source/Scripts/Northrend/Ulduar/AlgalonTheObserver.cs b/Source/Scripts/Northrend/Ulduar/AlgalonTheObserver.cs deleted file mode 100644 index 7b7e2f09e..000000000 --- a/Source/Scripts/Northrend/Ulduar/AlgalonTheObserver.cs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Game.Entities; - -namespace Scripts.Northrend.Ulduar -{ - namespace Algalon - { - class AlgalonTheObserver - { - public static Position AlgalonSummonPos = new Position(1632.531f, -304.8516f, 450.1123f, 1.530165f); - public static Position AlgalonLandPos = new Position(1632.668f, -302.7656f, 417.3211f, 1.530165f); - } - } -} diff --git a/Source/Scripts/Northrend/Ulduar/FlameLeviathan.cs b/Source/Scripts/Northrend/Ulduar/FlameLeviathan.cs deleted file mode 100644 index f67700f4f..000000000 --- a/Source/Scripts/Northrend/Ulduar/FlameLeviathan.cs +++ /dev/null @@ -1,1553 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using Game.Spells; -using System; -using System.Collections.Generic; - -namespace Scripts.Northrend.Ulduar.FlameLeviathan -{ - struct Spells - { - public const uint Pursued = 62374; - public const uint GatheringSpeed = 62375; - public const uint BatteringRam = 62376; - public const uint FlameVents = 62396; - public const uint MissileBarrage = 62400; - public const uint SystemsShutdown = 62475; - public const uint OverloadCircuit = 62399; - public const uint StartTheEngine = 62472; - public const uint SearingFlame = 62402; - public const uint Blaze = 62292; - public const uint TarPassive = 62288; - public const uint SmokeTrail = 63575; - public const uint Electroshock = 62522; - public const uint Napalm = 63666; - public const uint InvisAndStealthDetect = 18950; // Passive - //Tower Additional Spells - public const uint ThorimSHammer = 62911; // Tower Of Storms - public const uint MimironSInferno = 62909; // Tower Of Flames - public const uint HodirSFury = 62533; // Tower Of Frost - public const uint FreyaSWard = 62906; // Tower Of Nature - public const uint FreyaSummons = 62947; // Tower Of Nature - //Tower Ap & Health Spells - public const uint BuffTowerOfStorms = 65076; - public const uint BuffTowerOfFlames = 65075; - public const uint BuffTowerOfFrost = 65077; - public const uint BuffTowerOfLife = 64482; - //Additional Spells - public const uint Lash = 65062; - public const uint FreyaSWardEffect1 = 62947; - public const uint FreyaSWardEffect2 = 62907; - public const uint AutoRepair = 62705; - public const uint DummyBlue = 63294; - public const uint DummyGreen = 63295; - public const uint DummyYellow = 63292; - public const uint LiquidPyrite = 62494; - public const uint DustyExplosion = 63360; - public const uint DustCloudImpact = 54740; - public const uint StealthDetection = 18950; - public const uint RideVehicle = 46598; - } - - struct CreatureIds - { - public const uint Seat = 33114; - public const uint Mechanolift = 33214; - public const uint Liquid = 33189; - public const uint Container = 33218; - public const uint ThorimBeacon = 33365; - public const uint MimironBeacon = 33370; - public const uint HodirBeacon = 33212; - public const uint FreyaBeacon = 33367; - public const uint ThorimTargetBeacon = 33364; - public const uint MimironTargetBeacon = 33369; - public const uint HodirTargetBeacon = 33108; - public const uint FreyaTargetBeacon = 33366; - public const uint Lorekeeper = 33686; // Hard Mode Starter - public const uint BranzBronzbeard = 33579; - public const uint Delorah = 33701; - public const uint UlduarGauntletGenerator = 33571; // Trigger Tied To Towers - } - - struct Towers - { - public const uint ofStorms = 194377; - public const uint ofFlames = 194371; - public const uint ofFrost = 194370; - public const uint ofLife = 194375; - } - - struct Events - { - public const int Pursue = 1; - public const int Missile = 2; - public const int Vent = 3; - public const int Speed = 4; - public const int Summon = 5; - public const int Shutdown = 6; - public const int Repair = 7; - public const int ThorimSHammer = 8; // Tower Of Storms - public const int MimironSInferno = 9; // Tower Of Flames - public const int HodirSFury = 10; // Tower Of Frost - public const int FreyaSWard = 11; // Tower Of Nature - } - - struct Seats - { - public const int Player = 0; - public const int Turret = 1; - public const int Device = 2; - public const int Cannon = 7; - } - - struct Vehicles - { - public const uint Siege = 33060; - public const uint Chopper = 33062; - public const uint Demolisher = 33109; - } - - struct Leviathan - { - public const int DataShutout = 29112912; // 2911, 2912 are achievement IDs - public const int DataOrbitAchievements = 1; - public const int VehicleSpawns = 5; - public const int FreyaSpawns = 4; - - public const int ActionStartHardMode = 5; - public const int ActionSpawnVehicles = 6; - // Amount of seats depending on Raid mode - public const int TwoSeats = 2; - public const int FourSeats = 4; - - //Postions - public static Position Center = new Position(354.8771f, -12.90240f, 409.803650f); - public static Position InfernoStart = new Position(390.93f, -13.91f, 409.81f); - - public static Position[] PosSiege = - { - new Position(-814.59f, -64.54f, 429.92f, 5.969f), - new Position(-784.37f, -33.31f, 429.92f, 5.096f), - new Position(-808.99f, -52.10f, 429.92f, 5.668f), - new Position(-798.59f, -44.00f, 429.92f, 5.663f), - new Position(-812.83f, -77.71f, 429.92f, 0.046f), - }; - - public static Position[] PosChopper = - { - new Position(-717.83f, -106.56f, 430.02f, 0.122f), - new Position(-717.83f, -114.23f, 430.44f, 0.122f), - new Position(-717.83f, -109.70f, 430.22f, 0.122f), - new Position(-718.45f, -118.24f, 430.26f, 0.052f), - new Position(-718.45f, -123.58f, 430.41f, 0.085f), - }; - - public static Position[] PosDemolisher = - { - new Position(-724.12f, -176.64f, 430.03f, 2.543f), - new Position(-766.70f, -225.03f, 430.50f, 1.710f), - new Position(-729.54f, -186.26f, 430.12f, 1.902f), - new Position(-756.01f, -219.23f, 430.50f, 2.369f), - new Position(-798.01f, -227.24f, 429.84f, 1.446f), - }; - - public static Position[] FreyaBeacons = - { - new Position(377.02f, -119.10f, 409.81f), - new Position(185.62f, -119.10f, 409.81f), - new Position(377.02f, 54.78f, 409.81f), - new Position(185.62f, 54.78f, 409.81f), - }; - } - - struct TextIds - { - public const uint Aggro = 0; - public const uint Slay = 1; - public const uint Death = 2; - public const uint Target = 3; - public const uint Hardmode = 4; - public const uint TowerNone = 5; - public const uint TowerFrost = 6; - public const uint TowerFlame = 7; - public const uint TowerNature = 8; - public const uint TowerStorm = 9; - public const uint PlayerRiding = 10; - public const uint Overload = 11; - public const uint EmotePursue = 12; - public const uint EmoteOverload = 13; - public const int EmoteRepair = 14; - } - - struct GossipIds - { - //LoreKeeperGossips - public const int MenuLoreKeeper = 10477; - public const int OptionLoreKeeper = 0; - } - - [Script] - class boss_flame_leviathan : BossAI - { - public boss_flame_leviathan(Creature creature) : base(creature, BossIds.Leviathan) - { - vehicle = creature.GetVehicleKit(); - } - - public override void InitializeAI() - { - Cypher.Assert(vehicle); - if (!me.IsDead()) - Reset(); - - ActiveTowersCount = 4; - Shutdown = 0; - ActiveTowers = false; - towerOfStorms = false; - towerOfLife = false; - towerOfFlames = false; - towerOfFrost = false; - Shutout = true; - Unbroken = true; - - DoCast(Spells.InvisAndStealthDetect); - - me.AddUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable | UnitFlags.Stunned); - me.SetReactState(ReactStates.Passive); - } - - public override void Reset() - { - _Reset(); - //resets shutdown counter to 0. 2 or 4 depending on raid mode - Shutdown = 0; - _pursueTarget.Clear(); - - me.SetReactState(ReactStates.Defensive); - } - - public override void EnterCombat(Unit who) - { - _EnterCombat(); - me.SetReactState(ReactStates.Passive); - _events.ScheduleEvent(Events.Pursue, 1); - _events.ScheduleEvent(Events.Missile, RandomHelper.URand(1500, 4 * Time.InMilliseconds)); - _events.ScheduleEvent(Events.Vent, 20 * Time.InMilliseconds); - _events.ScheduleEvent(Events.Shutdown, 150 * Time.InMilliseconds); - _events.ScheduleEvent(Events.Speed, 15 * Time.InMilliseconds); - _events.ScheduleEvent(Events.Summon, 1 * Time.InMilliseconds); - ActiveTower(); //void ActiveTower - } - - void ActiveTower() - { - if (ActiveTowers) - { - if (towerOfStorms) - { - me.AddAura(Spells.BuffTowerOfStorms, me); - _events.ScheduleEvent(Events.ThorimSHammer, 35 * Time.InMilliseconds); - } - - if (towerOfFlames) - { - me.AddAura(Spells.BuffTowerOfFlames, me); - _events.ScheduleEvent(Events.MimironSInferno, 70 * Time.InMilliseconds); - } - - if (towerOfFrost) - { - me.AddAura(Spells.BuffTowerOfFrost, me); - _events.ScheduleEvent(Events.HodirSFury, 105 * Time.InMilliseconds); - } - - if (towerOfLife) - { - me.AddAura(Spells.BuffTowerOfLife, me); - _events.ScheduleEvent(Events.FreyaSWard, 140 * Time.InMilliseconds); - } - - if (!towerOfLife && !towerOfFrost && !towerOfFlames && !towerOfStorms) - Talk(TextIds.TowerNone); - else - Talk(TextIds.Hardmode); - } - else - Talk(TextIds.Aggro); - } - - public override void JustDied(Unit killer) - { - _JustDied(); - // Set Field Flags 67108928 = 64 | 67108864 = UNIT_FLAG_UNK_6 | UNIT_FLAG_SKINNABLE - // Set DynFlags 12 - // Set NPCFlags 0 - Talk(TextIds.Death); - } - - public override void SpellHit(Unit caster, SpellInfo spell) - { - if (spell.Id == Spells.StartTheEngine) - vehicle.InstallAllAccessories(false); - - if (spell.Id == Spells.Electroshock) - me.InterruptSpell(CurrentSpellTypes.Channeled); - - if (spell.Id == Spells.OverloadCircuit) - ++Shutdown; - } - - public override uint GetData(uint type) - { - switch (type) - { - case Leviathan.DataShutout: - return (uint)(Shutout ? 1 : 0); - case InstanceAchievementData.DataUnbroken: - return (uint)(Unbroken ? 1 : 0); - case Leviathan.DataOrbitAchievements: - if (ActiveTowers) // Only on HardMode - return ActiveTowersCount; - break; - default: - break; - } - - return 0; - } - - public override void SetData(uint id, uint data) - { - if (id == InstanceAchievementData.DataUnbroken) - Unbroken = data != 0 ? true : false; - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _events.Update(diff); - - if (Shutdown == RaidMode(Leviathan.TwoSeats, Leviathan.FourSeats)) - { - Shutdown = 0; - _events.ScheduleEvent(Events.Shutdown, 4000); - me.RemoveAurasDueToSpell(Spells.OverloadCircuit); - me.InterruptNonMeleeSpells(true); - return; - } - - if (me.HasUnitState(UnitState.Casting)) - return; - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case Events.Pursue: - Talk(TextIds.Target); - DoCast(Spells.Pursued); // Will select target in spellscript - _events.ScheduleEvent(Events.Pursue, 35 * Time.InMilliseconds); - break; - case Events.Missile: - DoCast(me, Spells.MissileBarrage, true); - _events.ScheduleEvent(Events.Missile, 2 * Time.InMilliseconds); - break; - case Events.Vent: - DoCastAOE(Spells.FlameVents); - _events.ScheduleEvent(Events.Vent, 20 * Time.InMilliseconds); - break; - case Events.Speed: - DoCastAOE(Spells.GatheringSpeed); - _events.ScheduleEvent(Events.Speed, 15 * Time.InMilliseconds); - break; - case Events.Summon: - if (summons.Count < 15) - { - Creature lift = DoSummonFlyer(CreatureIds.Mechanolift, me, 30.0f, 50.0f, 0); - if (lift) - lift.GetMotionMaster().MoveRandom(100); - } - _events.ScheduleEvent(Events.Summon, 2 * Time.InMilliseconds); - break; - case Events.Shutdown: - Talk(TextIds.Overload); - Talk(TextIds.EmoteOverload); - me.CastSpell(me, Spells.SystemsShutdown, true); - if (Shutout) - Shutout = false; - _events.ScheduleEvent(Events.Repair, 4000); - _events.DelayEvents(20 * Time.InMilliseconds, 0); - break; - case Events.Repair: - Talk(TextIds.EmoteRepair); - me.ClearUnitState(UnitState.Stunned | UnitState.Root); - _events.ScheduleEvent(Events.Shutdown, 150 * Time.InMilliseconds); - _events.CancelEvent(Events.Repair); - break; - case Events.ThorimSHammer: // Tower of Storms - for (byte i = 0; i < 7; ++i) - { - Creature thorim = DoSummon(CreatureIds.ThorimBeacon, me, RandomHelper.URand(20, 60), 20000, TempSummonType.TimedDespawn); - if (thorim) - thorim.GetMotionMaster().MoveRandom(100); - } - Talk(TextIds.TowerStorm); - _events.CancelEvent(Events.ThorimSHammer); - break; - case Events.MimironSInferno: // Tower of Flames - me.SummonCreature(CreatureIds.MimironBeacon, Leviathan.InfernoStart); - Talk(TextIds.TowerFlame); - _events.CancelEvent(Events.MimironSInferno); - break; - case Events.HodirSFury: // Tower of Frost - for (byte i = 0; i < 7; ++i) - { - Creature hodir = DoSummon(CreatureIds.HodirBeacon, me, 50f, 0); - if (hodir) - hodir.GetMotionMaster().MoveRandom(100); - } - Talk(TextIds.TowerFrost); - _events.CancelEvent(Events.HodirSFury); - break; - case Events.FreyaSWard: // Tower of Nature - Talk(TextIds.TowerNature); - for (int i = 0; i < 4; ++i) - me.SummonCreature(CreatureIds.FreyaBeacon, Leviathan.FreyaBeacons[i]); - - Unit target = SelectTarget(SelectAggroTarget.Random); - if (target) - DoCast(target, Spells.FreyaSWard); - _events.CancelEvent(Events.FreyaSWard); - break; - } - }); - - DoBatteringRamIfReady(); - } - - public override void SpellHitTarget(Unit target, SpellInfo spell) - { - if (spell.Id == Spells.Pursued) - _pursueTarget = target.GetGUID(); - } - - public override void DoAction(int action) - { - if (action != 0 && action <= 4) // Tower destruction, debuff leviathan loot and reduce active tower count - { - if (me.HasLootMode(LootModes.Default | LootModes.HardMode1 | LootModes.HardMode2 | LootModes.HardMode3 | LootModes.HardMode4) && ActiveTowersCount == 4) - me.RemoveLootMode(LootModes.HardMode4); - - if (me.HasLootMode(LootModes.Default | LootModes.HardMode1 | LootModes.HardMode2 | LootModes.HardMode3) && ActiveTowersCount == 3) - me.RemoveLootMode(LootModes.HardMode3); - - if (me.HasLootMode(LootModes.Default | LootModes.HardMode1 | LootModes.HardMode2) && ActiveTowersCount == 2) - me.RemoveLootMode(LootModes.HardMode2); - - if (me.HasLootMode(LootModes.Default | LootModes.HardMode1) && ActiveTowersCount == 1) - me.RemoveLootMode(LootModes.HardMode1); - } - - switch (action) - { - case LeviathanActions.TowerOfStormDestroyed: - if (towerOfStorms) - { - towerOfStorms = false; - --ActiveTowersCount; - } - break; - case LeviathanActions.TowerOfFrostDestroyed: - if (towerOfFrost) - { - towerOfFrost = false; - --ActiveTowersCount; - } - break; - case LeviathanActions.TowerOfFlamesDestroyed: - if (towerOfFlames) - { - towerOfFlames = false; - --ActiveTowersCount; - } - break; - case LeviathanActions.TowerOfLifeDestroyed: - if (towerOfLife) - { - towerOfLife = false; - --ActiveTowersCount; - } - break; - case Leviathan.ActionStartHardMode: // Activate hard-mode enable all towers, apply buffs on leviathan - ActiveTowers = true; - towerOfStorms = true; - towerOfLife = true; - towerOfFlames = true; - towerOfFrost = true; - me.SetLootMode(LootModes.Default | LootModes.HardMode1 | LootModes.HardMode2 | LootModes.HardMode3 | LootModes.HardMode4); - break; - case LeviathanActions.MoveToCenterPosition: // Triggered by 2 Collossus near door - if (!me.IsDead()) - { - me.SetHomePosition(Leviathan.Center); - me.GetMotionMaster().MoveCharge(Leviathan.Center.GetPositionX(), Leviathan.Center.GetPositionY(), Leviathan.Center.GetPositionZ()); // position center - me.SetReactState(ReactStates.Aggressive); - me.RemoveUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable | UnitFlags.Stunned); - return; - } - break; - default: - break; - } - } - - //! Copypasta from DoSpellAttackIfReady, only difference is the target - it cannot be selected trough GetVictim this way - - //! I also removed the spellInfo check - void DoBatteringRamIfReady() - { - if (me.IsAttackReady()) - { - Unit target = Global.ObjAccessor.GetUnit(me, _pursueTarget); - if (me.IsWithinCombatRange(target, 30.0f)) - { - DoCast(target, Spells.BatteringRam); - me.ResetAttackTimer(); - } - } - } - - Vehicle vehicle; - byte ActiveTowersCount; - byte Shutdown; - bool ActiveTowers; - bool towerOfStorms; - bool towerOfLife; - bool towerOfFlames; - bool towerOfFrost; - bool Shutout; - bool Unbroken; - ObjectGuid _pursueTarget; - } - - [Script] - class boss_flame_leviathan_seat : ScriptedAI - { - public boss_flame_leviathan_seat(Creature creature) - : base(creature) - { - vehicle = creature.GetVehicleKit(); - Cypher.Assert(vehicle); - me.SetReactState(ReactStates.Passive); - me.SetDisplayFromModel(1); - instance = creature.GetInstanceScript(); - } - - InstanceScript instance; - Vehicle vehicle; - - public override void PassengerBoarded(Unit who, sbyte seatId, bool apply) - { - if (!me.GetVehicle()) - return; - - if (seatId == Seats.Player) - { - Creature leviathan = me.GetVehicleCreatureBase(); - if (!apply) - return; - else if (leviathan) - leviathan.GetAI().Talk(TextIds.PlayerRiding); - - Unit turretPassenger = me.GetVehicleKit().GetPassenger(Seats.Turret); - if (turretPassenger) - { - Creature turret = turretPassenger.ToCreature(); - if (turret) - { - turret.SetFaction(me.GetVehicleBase().GetFaction()); - turret.SetUnitFlags(0); - turret.GetAI().AttackStart(who); - } - } - Unit devicePassenger = me.GetVehicleKit().GetPassenger(Seats.Device); - if (devicePassenger) - { - Creature device = devicePassenger.ToCreature(); - if (device) - { - device.AddNpcFlag(NPCFlags.SpellClick); - device.RemoveUnitFlag(UnitFlags.NotSelectable); - } - } - - me.AddUnitFlag(UnitFlags.NotSelectable); - } - else if (seatId == Seats.Turret) - { - if (apply) - return; - - Unit device = vehicle.GetPassenger(Seats.Device); - if (device) - { - device.AddNpcFlag(NPCFlags.SpellClick); - device.SetUnitFlags(0); // unselectable - } - } - } - } - - [Script] - class boss_flame_leviathan_defense_cannon : ScriptedAI - { - public boss_flame_leviathan_defense_cannon(Creature creature) - : base(creature) - { - } - - uint NapalmTimer; - - public override void Reset() - { - NapalmTimer = 5 * Time.InMilliseconds; - DoCast(me, Spells.StealthDetection); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - if (NapalmTimer <= diff) - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0); - if (target) - if (CanAIAttack(target)) - DoCast(target, Spells.Napalm, true); - - NapalmTimer = 5000; - } - else - NapalmTimer -= diff; - } - - public override bool CanAIAttack(Unit who) - { - if (!who.IsTypeId(TypeId.Player) || !who.GetVehicle() || who.GetVehicleBase().GetEntry() == CreatureIds.Seat) - return false; - return true; - } - } - - [Script] - class boss_flame_leviathan_defense_turret : TurretAI - { - public boss_flame_leviathan_defense_turret(Creature creature) : base(creature) { } - - public override void DamageTaken(Unit who, ref uint damage) - { - if (!CanAIAttack(who)) - damage = 0; - } - - public override bool CanAIAttack(Unit who) - { - if (!who.IsTypeId(TypeId.Player) || !who.GetVehicle() || who.GetVehicleBase().GetEntry() != CreatureIds.Seat) - return false; - return true; - } - } - - [Script] - class boss_flame_leviathan_overload_device : PassiveAI - { - public boss_flame_leviathan_overload_device(Creature creature) - : base(creature) - { - } - - public override void OnSpellClick(Unit clicker, ref bool result) - { - if (!result) - return; - - if (me.GetVehicle()) - { - me.RemoveNpcFlag(NPCFlags.SpellClick); - me.AddUnitFlag(UnitFlags.NotSelectable); - - Unit player = me.GetVehicle().GetPassenger(Seats.Player); - if (player) - { - me.GetVehicleBase().CastSpell(player, Spells.SmokeTrail, true); - player.GetMotionMaster().MoveKnockbackFrom(me.GetVehicleBase().GetPositionX(), me.GetVehicleBase().GetPositionY(), 30, 30); - player.ExitVehicle(); - } - } - } - } - - [Script] - class boss_flame_leviathan_safety_container : PassiveAI - { - public boss_flame_leviathan_safety_container(Creature creature) - : base(creature) - { - } - - public override void JustDied(Unit killer) - { - float x, y, z; - me.GetPosition(out x, out y, out z); - z = me.GetMap().GetHeight(me.GetPhaseShift(), x, y, z); - me.GetMotionMaster().MovePoint(0, x, y, z); - me.UpdatePosition(x, y, z, 0); - } - - public override void UpdateAI(uint diff) - { - } - } - - [Script] - class npc_mechanolift : PassiveAI - { - public npc_mechanolift(Creature creature) : base(creature) - { - Cypher.Assert(me.GetVehicleKit()); - } - - uint MoveTimer; - - public override void Reset() - { - MoveTimer = 0; - me.GetMotionMaster().MoveRandom(50); - } - - public override void JustDied(Unit killer) - { - me.GetMotionMaster().MoveTargetedHome(); - DoCast(Spells.DustyExplosion); - Creature liquid = DoSummon(CreatureIds.Liquid, me, 0f); - if (liquid) - { - liquid.CastSpell(liquid, Spells.LiquidPyrite, true); - liquid.CastSpell(liquid, Spells.DustCloudImpact, true); - } - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - if (type == MovementGeneratorType.Point && id == 1) - { - Creature container = me.FindNearestCreature(CreatureIds.Container, 5, true); - if (container) - container.EnterVehicle(me); - } - } - - public override void UpdateAI(uint diff) - { - if (MoveTimer <= diff) - { - if (me.GetVehicleKit().HasEmptySeat(-1)) - { - Creature container = me.FindNearestCreature(CreatureIds.Container, 50, true); - if (container && !container.GetVehicle()) - me.GetMotionMaster().MovePoint(1, container.GetPositionX(), container.GetPositionY(), container.GetPositionZ()); - } - - MoveTimer = 30000; //check next 30 seconds - } - else - MoveTimer -= diff; - } - } - - [Script] - class npc_pool_of_tar : ScriptedAI - { - public npc_pool_of_tar(Creature creature) - : base(creature) - { - me.RemoveUnitFlag(UnitFlags.NotSelectable); - me.SetReactState(ReactStates.Passive); - me.CastSpell(me, Spells.TarPassive, true); - } - - public override void DamageTaken(Unit who, ref uint damage) - { - damage = 0; - } - - public override void SpellHit(Unit caster, SpellInfo spell) - { - if (spell.SchoolMask.HasAnyFlag(SpellSchoolMask.Fire) && !me.HasAura(Spells.Blaze)) - me.CastSpell(me, Spells.Blaze, true); - } - - public override void UpdateAI(uint diff) { } - } - - [Script] - class npc_colossus : ScriptedAI - { - public npc_colossus(Creature creature) - : base(creature) - { - instance = creature.GetInstanceScript(); - } - - InstanceScript instance; - - public override void JustDied(Unit killer) - { - if (me.GetHomePosition().IsInDist(Leviathan.Center, 50.0f)) - instance.SetData(InstanceData.Colossus, instance.GetData(InstanceData.Colossus) + 1); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); - } - } - - [Script] - class npc_thorims_hammer : ScriptedAI - { - public npc_thorims_hammer(Creature creature) - : base(creature) - { - me.AddUnitFlag(UnitFlags.NotSelectable); - me.CastSpell(me, Spells.DummyBlue, true); - } - - public override void MoveInLineOfSight(Unit who) - { - if (who.IsTypeId(TypeId.Player) && who.IsVehicle() && me.IsInRange(who, 0, 10, false)) - { - Creature trigger = DoSummonFlyer(CreatureIds.ThorimTargetBeacon, me, 20, 0, 1000, TempSummonType.TimedDespawn); - if (trigger) - trigger.CastSpell(who, Spells.ThorimSHammer, true); - } - } - - public override void UpdateAI(uint diff) - { - if (!me.HasAura(Spells.DummyBlue)) - me.CastSpell(me, Spells.DummyBlue, true); - - UpdateVictim(); - } - } - - [Script] - class npc_mimirons_inferno : EscortAI - { - public npc_mimirons_inferno(Creature creature) - : base(creature) - { - me.AddUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - me.CastSpell(me, Spells.DummyYellow, true); - me.SetReactState(ReactStates.Passive); - } - - public override void WaypointReached(uint waypointId, uint pathId) { } - - public override void Reset() - { - infernoTimer = 2000; - } - - uint infernoTimer; - - public override void UpdateAI(uint diff) - { - base.UpdateAI(diff); - - if (!HasEscortState(EscortState.Escorting)) - Start(false, true, ObjectGuid.Empty, null, false, true); - else - { - if (infernoTimer <= diff) - { - Creature trigger = DoSummonFlyer(CreatureIds.MimironTargetBeacon, me, 20, 0, 1000, TempSummonType.TimedDespawn); - if (trigger) - { - trigger.CastSpell(me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), Spells.MimironSInferno, true); - infernoTimer = 2000; - } - } - else - infernoTimer -= diff; - - if (!me.HasAura(Spells.DummyYellow)) - me.CastSpell(me, Spells.DummyYellow, true); - } - } - } - - [Script] - class npc_hodirs_fury : ScriptedAI - { - public npc_hodirs_fury(Creature creature) - : base(creature) - { - me.AddUnitFlag(UnitFlags.NotSelectable); - me.CastSpell(me, Spells.DummyGreen, true); - } - - public override void MoveInLineOfSight(Unit who) - { - if (who.IsTypeId(TypeId.Player) && who.IsVehicle() && me.IsInRange(who, 0, 5, false)) - { - Creature trigger = DoSummonFlyer(CreatureIds.HodirTargetBeacon, me, 20, 0, 1000, TempSummonType.TimedDespawn); - if (trigger) - trigger.CastSpell(who, Spells.HodirSFury, true); - } - } - - public override void UpdateAI(uint diff) - { - if (!me.HasAura(Spells.DummyGreen)) - me.CastSpell(me, Spells.DummyGreen, true); - - UpdateVictim(); - } - } - - [Script] - class npc_freyas_ward : ScriptedAI - { - public npc_freyas_ward(Creature creature) - : base(creature) - { - me.CastSpell(me, Spells.DummyGreen, true); - } - - uint summonTimer; - - public override void Reset() - { - summonTimer = 5000; - } - - public override void UpdateAI(uint diff) - { - if (summonTimer <= diff) - { - DoCast(Spells.FreyaSWardEffect1); - DoCast(Spells.FreyaSWardEffect2); - summonTimer = 20000; - } - else - summonTimer -= diff; - - if (!me.HasAura(Spells.DummyGreen)) - me.CastSpell(me, Spells.DummyGreen, true); - - UpdateVictim(); - } - } - - [Script] - class npc_freya_ward_summon : ScriptedAI - { - public npc_freya_ward_summon(Creature creature) - : base(creature) - { - creature.GetMotionMaster().MoveRandom(100); - } - - uint lashTimer; - - public override void Reset() - { - lashTimer = 5000; - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - if (lashTimer <= diff) - { - DoCast(Spells.Lash); - lashTimer = 20000; - } - else - lashTimer -= diff; - - DoMeleeAttackIfReady(); - } - } - - [Script] - class npc_lorekeeper : ScriptedAI - { - public npc_lorekeeper(Creature creature) : base(creature) - { - _instance = creature.GetInstanceScript(); - } - - public override void DoAction(int action) - { - // Start encounter - if (action == Leviathan.ActionSpawnVehicles) - { - for (int i = 0; i < RaidMode(2, 5); ++i) - DoSummon(Vehicles.Siege, Leviathan.PosSiege[i], 3000, TempSummonType.CorpseTimedDespawn); - for (int i = 0; i < RaidMode(2, 5); ++i) - DoSummon(Vehicles.Chopper, Leviathan.PosChopper[i], 3000, TempSummonType.CorpseTimedDespawn); - for (int i = 0; i < RaidMode(2, 5); ++i) - DoSummon(Vehicles.Demolisher, Leviathan.PosDemolisher[i], 3000, TempSummonType.CorpseTimedDespawn); - return; - } - } - - public override bool GossipSelect(Player player, uint menuId, uint gossipListId) - { - if (menuId == GossipIds.MenuLoreKeeper && gossipListId == GossipIds.OptionLoreKeeper) - { - me.RemoveNpcFlag(NPCFlags.Gossip); - player.PlayerTalkClass.SendCloseGossip(); - me.GetMap().LoadGrid(364, -16); // make sure leviathan is loaded - - Creature leviathan = ObjectAccessor.GetCreature(me, _instance.GetGuidData(BossIds.Leviathan)); - if (leviathan) - { - leviathan.GetAI().DoAction(Leviathan.ActionStartHardMode); - me.SetVisible(false); - DoAction(Leviathan.ActionSpawnVehicles); // spawn the vehicles - - Creature delorah = _instance.GetCreature(InstanceData.Dellorah); - if (delorah) - { - Creature brann = _instance.GetCreature(InstanceData.BrannBronzebeardIntro); - if (brann) - { - brann.RemoveNpcFlag(NPCFlags.Gossip); - delorah.GetMotionMaster().MovePoint(0, brann.GetPositionX() - 4, brann.GetPositionY(), brann.GetPositionZ()); - // @todo delorah.AI().Talk(xxxx, brann.GetGUID()); when reached at branz - } - } - } - } - return false; - } - - InstanceScript _instance; - } - - [Script] - class go_ulduar_tower : GameObjectScript - { - public go_ulduar_tower() : base("go_ulduar_tower") { } - - class go_ulduar_towerAI : GameObjectAI - { - public go_ulduar_towerAI(GameObject go) : base(go) - { - instance = go.GetInstanceScript(); - } - - public override void Destroyed(Player player, uint eventId) - { - switch (me.GetEntry()) - { - case Towers.ofStorms: - instance.ProcessEvent(me, InstanceEventIds.TowerOfStormDestroyed); - break; - case Towers.ofFlames: - instance.ProcessEvent(me, InstanceEventIds.TowerOfFlamesDestroyed); - break; - case Towers.ofFrost: - instance.ProcessEvent(me, InstanceEventIds.TowerOfFrostDestroyed); - break; - case Towers.ofLife: - instance.ProcessEvent(me, InstanceEventIds.TowerOfLifeDestroyed); - break; - } - - Creature trigger = me.FindNearestCreature(CreatureIds.UlduarGauntletGenerator, 15.0f, true); - if (trigger) - trigger.DisappearAndDie(); - } - - InstanceScript instance; - } - - public override GameObjectAI GetAI(GameObject go) - { - return GetInstanceAI(go); - } - } - - [Script] - class achievement_three_car_garage_demolisher : AchievementCriteriaScript - { - public achievement_three_car_garage_demolisher() : base("achievement_three_car_garage_demolisher") { } - - public override bool OnCheck(Player source, Unit target) - { - Creature vehicle = source.GetVehicleCreatureBase(); - if (vehicle) - { - if (vehicle.GetEntry() == Vehicles.Demolisher) - return true; - } - - return false; - } - } - - [Script] - class achievement_three_car_garage_chopper : AchievementCriteriaScript - { - public achievement_three_car_garage_chopper() : base("achievement_three_car_garage_chopper") { } - - public override bool OnCheck(Player source, Unit target) - { - Creature vehicle = source.GetVehicleCreatureBase(); - if (vehicle) - { - if (vehicle.GetEntry() == Vehicles.Chopper) - return true; - } - - return false; - } - } - - [Script] - class achievement_three_car_garage_siege : AchievementCriteriaScript - { - public achievement_three_car_garage_siege() : base("achievement_three_car_garage_siege") { } - - public override bool OnCheck(Player source, Unit target) - { - Creature vehicle = source.GetVehicleCreatureBase(); - if (vehicle) - { - if (vehicle.GetEntry() == Vehicles.Siege) - return true; - } - - return false; - } - } - - [Script] - class achievement_shutout : AchievementCriteriaScript - { - public achievement_shutout() : base("achievement_shutout") { } - - public override bool OnCheck(Player source, Unit target) - { - if (target) - { - Creature leviathan = target.ToCreature(); - if (leviathan) - if (leviathan.GetAI().GetData(Leviathan.DataShutout) != 0) - return true; - } - - return false; - } - } - - [Script] - class achievement_unbroken : AchievementCriteriaScript - { - public achievement_unbroken() : base("achievement_unbroken") { } - - public override bool OnCheck(Player source, Unit target) - { - if (target) - { - InstanceScript instance = target.GetInstanceScript(); - if (instance != null) - return instance.GetData(InstanceAchievementData.DataUnbroken) != 0; - } - - return false; - } - } - - [Script] - class achievement_orbital_bombardment : AchievementCriteriaScript - { - public achievement_orbital_bombardment() : base("achievement_orbital_bombardment") { } - - public override bool OnCheck(Player source, Unit target) - { - if (!target) - return false; - - Creature leviathan = target.ToCreature(); - if (leviathan) - if (leviathan.GetAI().GetData(Leviathan.DataOrbitAchievements) >= 1) - return true; - - return false; - } - } - - [Script] - class achievement_orbital_devastation : AchievementCriteriaScript - { - public achievement_orbital_devastation() : base("achievement_orbital_devastation") { } - - public override bool OnCheck(Player source, Unit target) - { - if (!target) - return false; - Creature leviathan = target.ToCreature(); - if (leviathan) - if (leviathan.GetAI().GetData(Leviathan.DataOrbitAchievements) >= 2) - return true; - - return false; - } - } - - [Script] - class achievement_nuked_from_orbit : AchievementCriteriaScript - { - public achievement_nuked_from_orbit() : base("achievement_nuked_from_orbit") { } - - public override bool OnCheck(Player source, Unit target) - { - if (!target) - return false; - - Creature leviathan = target.ToCreature(); - if (leviathan) - if (leviathan.GetAI().GetData(Leviathan.DataOrbitAchievements) >= 3) - return true; - - return false; - } - } - - [Script] - class achievement_orbit_uary : AchievementCriteriaScript - { - public achievement_orbit_uary() : base("achievement_orbit_uary") { } - - public override bool OnCheck(Player source, Unit target) - { - if (!target) - return false; - - Creature leviathan = target.ToCreature(); - if (leviathan) - if (leviathan.GetAI().GetData(Leviathan.DataOrbitAchievements) == 4) - return true; - - return false; - } - } - - [Script] - class spell_load_into_catapult : AuraScript - { - void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Unit owner = GetOwner().ToUnit(); - if (!owner) - return; - - owner.CastSpell(owner, 62340, true); - } - - void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Unit owner = GetOwner().ToUnit(); - if (!owner) - return; - - owner.RemoveAurasDueToSpell(62340); - } - - public override void Register() - { - OnEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.ControlVehicle, AuraEffectHandleModes.Real)); - OnEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.ControlVehicle, AuraEffectHandleModes.RealOrReapplyMask)); - } - } - - [Script] - class spell_auto_repair : SpellScript - { - void CheckCooldownForTarget(SpellMissInfo missInfo) - { - if (missInfo != SpellMissInfo.None) - return; - - if (GetHitUnit().HasAuraEffect(62705, 2)) // Check presence of dummy aura indicating cooldown - { - PreventHitEffect(0); - PreventHitDefaultEffect(1); - PreventHitDefaultEffect(2); - //! Currently this doesn't work: if we call PreventHitAura(), the existing aura will be removed - //! because of recent aura refreshing changes. Since removing the existing aura negates the idea - //! of a cooldown marker, we just let the dummy aura refresh itself without executing the other SpellEffectName. - //! The spelleffects can be executed by letting the dummy aura expire naturally. - //! This is a temporary solution only. - } - } - - void HandleScript(uint eff) - { - Vehicle vehicle = GetHitUnit().GetVehicleKit(); - if (!vehicle) - return; - - Player driver = vehicle.GetPassenger(0) ? vehicle.GetPassenger(0).ToPlayer() : null; - if (!driver) - return; - - driver.TextEmote(TextIds.EmoteRepair, driver, true); - - InstanceScript instance = driver.GetInstanceScript(); - if (instance == null) - return; - - // Actually should/could use basepoints (100) for this spell effect as percentage of health, but oh well. - vehicle.GetBase().SetFullHealth(); - - // For achievement - instance.SetData(InstanceAchievementData.DataUnbroken, 0); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); - BeforeHit.Add(new BeforeHitHandler(CheckCooldownForTarget)); - } - } - - [Script] - class spell_systems_shutdown : AuraScript - { - void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Creature owner = GetOwner().ToCreature(); - if (!owner) - return; - - //! This could probably in the SPELL_EFFECT_SEND_EVENT handler too: - owner.AddUnitState(UnitState.Stunned | UnitState.Root); - owner.AddUnitFlag(UnitFlags.Stunned); - owner.RemoveAurasDueToSpell(Spells.GatheringSpeed); - } - - void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Creature owner = GetOwner().ToCreature(); - if (!owner) - return; - - owner.RemoveUnitFlag(UnitFlags.Stunned); - } - - public override void Register() - { - OnEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.ModDamagePercentTaken, AuraEffectHandleModes.Real)); - OnEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.ModDamagePercentTaken, AuraEffectHandleModes.Real)); - } - } - - [Script] - class spell_pursue : SpellScript - { - public override bool Load() - { - _target = null; - return true; - } - - void FilterTargets(List targets) - { - targets.RemoveAll(target => - { - //! No players, only vehicles (@todo check if blizzlike) - Creature creatureTarget = target.ToCreature(); - if (!creatureTarget) - return true; - - //! NPC entries must match - if (creatureTarget.GetEntry() != Vehicles.Demolisher && creatureTarget.GetEntry() != Vehicles.Siege) - return true; - - //! NPC must be a valid vehicle installation - Vehicle vehicle = creatureTarget.GetVehicleKit(); - if (!vehicle) - return true; - - //! Entity needs to be in appropriate area - if (target.GetAreaId() != AREA_FORMATION_GROUNDS) - return true; - - //! Vehicle must be in use by player - bool playerFound = false; - foreach (var seat in vehicle.Seats.Values) - { - if (seat.Passenger.Guid.IsPlayer()) - { - playerFound = true; - break; - } - } - - return !playerFound; - }); - - if (targets.Empty()) - { - Creature caster = GetCaster().ToCreature(); - if (caster) - caster.GetAI().EnterEvadeMode(); - } - else - { - //! In the end, only one target should be selected - _target = targets.SelectRandom(); - FilterTargetsSubsequently(targets); - } - } - - void FilterTargetsSubsequently(List targets) - { - targets.Clear(); - if (_target) - targets.Add(_target); - } - - void HandleScript(uint eff) - { - Creature caster = GetCaster().ToCreature(); - if (!caster) - return; - - caster.GetAI().AttackStart(GetHitUnit()); // Chase target - - foreach (var seat in caster.GetVehicleKit().Seats.Values) - { - Player passenger = Global.ObjAccessor.GetPlayer(caster, seat.Passenger.Guid); - if (passenger) - { - caster.GetAI().Talk(TextIds.EmotePursue, passenger); - return; - } - } - } - - public override void Register() - { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEnemy)); - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargetsSubsequently, 1, Targets.UnitSrcAreaEnemy)); - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ApplyAura)); - } - - const uint AREA_FORMATION_GROUNDS = 4652; - - WorldObject _target; - } - - [Script] - class spell_vehicle_throw_passenger : SpellScript - { - void HandleScript(uint effIndex) - { - Spell baseSpell = GetSpell(); - SpellCastTargets targets = baseSpell.m_targets; - int damage = GetEffectValue(); - if (targets.HasTraj()) - { - Vehicle vehicle = GetCaster().GetVehicleKit(); - if (vehicle) - { - Unit passenger = vehicle.GetPassenger((sbyte)(damage - 1)); - if (passenger) - { - // use 99 because it is 3d search - List targetList = new List(); - var check = new WorldObjectSpellAreaTargetCheck(99, GetExplTargetDest(), GetCaster(), GetCaster(), GetSpellInfo(), SpellTargetCheckTypes.Default, null); - var searcher = new WorldObjectListSearcher(GetCaster(), targetList, check); - Cell.VisitAllObjects(GetCaster(), searcher, 99.0f); - float minDist = 99 * 99; - Unit target = null; - foreach (var obj in targetList) - { - Unit unit = obj.ToUnit(); - if (unit) - { - if (unit.GetEntry() == CreatureIds.Seat) - { - Vehicle seat = unit.GetVehicleKit(); - if (seat) - { - if (!seat.GetPassenger(0)) - { - Unit device = seat.GetPassenger(2); - if (device) - if (!device.GetCurrentSpell(CurrentSpellTypes.Channeled)) - { - float dist = unit.GetExactDistSq(targets.GetDstPos()); - if (dist < minDist) - { - minDist = dist; - target = unit; - } - } - } - } - } - } - } - if (target && target.IsWithinDist2d(targets.GetDstPos(), GetSpellInfo().GetEffect(effIndex).CalcRadius() * 2)) // now we use *2 because the location of the seat is not correct - passenger.EnterVehicle(target, 0); - else - { - passenger.ExitVehicle(); - passenger.GetMotionMaster().MoveJump(targets.GetDstPos(), targets.GetSpeedXY(), targets.GetSpeedZ()); - } - } - } - } - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.Dummy)); - } - } -} diff --git a/Source/Scripts/Northrend/Ulduar/Mimiron.cs b/Source/Scripts/Northrend/Ulduar/Mimiron.cs deleted file mode 100644 index ea53bd603..000000000 --- a/Source/Scripts/Northrend/Ulduar/Mimiron.cs +++ /dev/null @@ -1,2397 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Framework.GameMath; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using Game.Spells; -using System; -using System.Collections.Generic; -using System.Dynamic; -using System.Linq; - -namespace Scripts.Northrend.Ulduar -{ - namespace Mimiron - { - struct Yells - { - public const uint Aggro = 0; - public const uint HardmodeOn = 1; - public const uint MkiiActivate = 2; - public const uint MkiiSlay = 3; - public const uint MkiiDeath = 4; - public const uint Vx001Activate = 5; - public const uint Vx001Slay = 6; - public const uint Vx001Death = 7; - public const uint AerialActivate = 8; - public const uint AerialSlay = 9; - public const uint AerialDeath = 10; - public const uint V07tronActivate = 11; - public const uint V07tronSlay = 12; - public const uint V07tronDeath = 13; - public const uint Berserk = 14; - } - - struct ComputerYells - { - public const uint SelfDestructInitiated = 0; - public const uint SelfDestructTerminated = 1; - public const uint SelfDestruct10 = 2; - public const uint SelfDestruct9 = 3; - public const uint SelfDestruct8 = 4; - public const uint SelfDestruct7 = 5; - public const uint SelfDestruct6 = 6; - public const uint SelfDestruct5 = 7; - public const uint SelfDestruct4 = 8; - public const uint SelfDestruct3 = 9; - public const uint SelfDestruct2 = 10; - public const uint SelfDestruct1 = 11; - public const uint SelfDestructFinalized = 12; - } - - struct Spells - { - // Mimiron - public const uint Weld = 63339; // Idle Aura. - public const uint Seat1 = 52391; // Cast On All Vehicles; Cycled On Mkii - public const uint Seat2 = 63313; // Cast On Mkii And Vx-001; Cycled On Mkii - public const uint Seat3 = 63314; // Cast On Mkii; Cycled On Mkii - public const uint Seat5 = 63316; // Cast On Mkii And Vx-001; Cycled On Mkii - public const uint Seat6 = 63344; // Cast On Mkii - public const uint Seat7 = 63345; // Cast On Mkii - public const uint Jetpack = 63341; - public const uint DespawnAssaultBots = 64463; // Only Despawns Assault Bots... No Equivalent Spell For The Other Adds... - public const uint TeleportVisual = 41232; - public const uint SleepVisual1 = 64393; - public const uint SleepVisual2 = 64394; - - // Leviathan Mk Ii - public const uint FlameSuppressantMk = 64570; - public const uint NapalmShell = 63666; - public const uint ForceCastNapalmShell = 64539; - public const uint PlasmaBlast = 62997; - public const uint ScriptEffectPlasmaBlast = 64542; - public const uint ShockBlast = 63631; - public const uint ShockBlastAura = 63632; // Deprecated? It Is Never Cast. - - // Vx-001 - public const uint FlameSuppressantVx = 65192; - public const uint SpinningUp = 63414; - public const uint HeatWaveAura = 63679; - public const uint HandPulseLeft = 64348; - public const uint HandPulseRight = 64352; - public const uint MountMkii = 64387; - public const uint TorsoDisabled = 64120; - - // Aerial Command Unit - public const uint PlasmaBallP1 = 63689; - public const uint PlasmaBallP2 = 65647; - public const uint MountVx001 = 64388; - - // Proximity Mines - public const uint ProximityMines = 63027; // Cast By Leviathan Mk Ii - public const uint ProximityMineExplosion = 66351; - public const uint ProximityMineTrigger = 65346; - public const uint ProximityMinePeriodicTrigger = 65345; - public const uint PeriodicProximityAura = 65345; - public const uint SummonProximityMine = 65347; - - // Rapid Burst - public const uint RapidBurstLeft = 63387; - public const uint RapidBurstRight = 64019; - public const uint RapidBurst = 63382; // Cast By Vx-001 - public const uint RapidBurstTargetMe = 64841; // Cast By Burst Target - public const uint SummonBurstTarget = 64840; // Cast By Vx-001 - - // Rocket Strike - public const uint SummonRocketStrike = 63036; - public const uint ScriptEffectRocketStrike = 63681; // Cast By Rocket (Mimiron Visual) - public const uint RocketStrike = 64064; // Added In CreatureTemplateAddon - public const uint RocketStrikeSingle = 64402; // Cast By Vx-001 - public const uint RocketStrikeBoth = 65034; // Cast By Vx-001 - - // Flames - public const uint FlamesPeriodicTrigger = 64561; // Added In CreatureTemplateAddon - public const uint SummonFlamesSpreadTrigger = 64562; - public const uint SummonFlamesInitial = 64563; - public const uint SummonFlamesSpread = 64564; - public const uint Flames = 64566; - public const uint ScriptEffectSummonFlamesInitial = 64567; - - // Frost Bomb - public const uint ScriptEffectFrostBomb = 64623; // Cast By Vx-001 - public const uint FrostBombLinked = 64624; // Added In CreatureTemplateAddon - public const uint FrostBombDummy = 64625; - public const uint SummonFrostBomb = 64627; // Cast By Vx-001 - public const uint FrostBombExplosion = 64626; - public const uint ClearFires = 65354; - - // Bots - public const uint SummonFireBot = 64622; - public const uint SummonFireBotDummy = 64621; - public const uint SummonFireBotTrigger = 64620; // Cast By Areal Command Unit - public const uint DeafeningSiren = 64616; // Added In CreatureTemplateAddon - public const uint FireSearchAura = 64617; // Added In CreatureTemplateAddon - public const uint FireSearch = 64618; - public const uint WaterSpray = 64619; - - public const uint SummonJunkBot = 63819; - public const uint SummonJunkBotTrigger = 63820; // Cast By Areal Command Unit - public const uint SummonJunkBotDummy = 64398; - - public const uint SummonAssaultBotTrigger = 64425; // Cast By Areal Command Unit - public const uint SummonAssaultBotDummy = 64426; - public const uint SummonAssaultBot = 64427; - public const uint MagneticField = 64668; - - public const uint SummonBombBot = 63811; // Cast By Areal Command Unit - public const uint BombBotAura = 63767; // Added In CreatureTemplateAddon - - // Miscellaneous - public const uint SelfDestructionAura = 64610; - public const uint SelfDestructionVisual = 64613; - public const uint NotSoFriendlyFire = 65040; - public const uint ElevatorKnockback = 65096; // Cast By Worldtrigger. - public const uint VehicleDamaged = 63415; - public const uint EmergencyMode = 64582; // Mkii; Vx001; Aerial; Assault; Junk - public const uint EmergencyModeTurret = 65101; // Cast By Leviathan Mk Ii; Only Hits Leviathan Mk Ii Turret - public const uint SelfRepair = 64383; - public const uint MagneticCore = 64436; - public const uint MagneticCoreVisual = 64438; - public const uint HalfHeal = 64188; - public const uint ClearAllDebuffs = 34098; // @Todo: Make Use Of This Spell... - public const uint FreezeAnimStun = 63354; // Used To Prevent Mkii From Doing Stuff?.. - public const uint FreezeAnim = 16245; // Idle Aura. Freezes Animation. - } - - struct Data - { - public const uint SetupMine = 0; - public const uint SetupBomb = 1; - public const uint SetupRocket = 2; - public const uint NotSoFriendlyFire = 3; - public const uint Firefighter = 4; - public const uint Waterspray = 5; - public const uint MoveNew = 6; - } - - struct Events - { - // Leviathan Mk Ii - public const uint ProximityMine = 1; - public const uint NapalmShell = 2; - public const uint PlasmaBlast = 3; - public const uint ShockBlast = 4; - public const uint FlameSuppressantMk = 5; - public const uint MovePoint2 = 6; - public const uint MovePoint3 = 7; - public const uint MovePoint5 = 8; - - // Vx-001 - public const uint RapidBurst = 1; - public const uint SpinningUp = 2; - public const uint RocketStrike = 3; - public const uint HandPulse = 4; - public const uint FrostBomb = 5; - public const uint FlameSuppressantVx = 6; - public const uint Reload = 7; - - // Aerial Command Unit - public const uint SummonFireBots = 1; - public const uint SummonJunkBot = 2; - public const uint SummonAssaultBot = 3; - public const uint SummonBombBot = 4; - - // Mimiron - public const uint SummonFlames = 1; - public const uint Intro1 = 2; - public const uint Intro2 = 3; - public const uint Intro3 = 4; - - public const uint Vx001Activation1 = 5; - public const uint Vx001Activation2 = 6; - public const uint Vx001Activation3 = 7; - public const uint Vx001Activation4 = 8; - public const uint Vx001Activation5 = 9; - public const uint Vx001Activation6 = 10; - public const uint Vx001Activation7 = 11; - public const uint Vx001Activation8 = 12; - - public const uint AerialActivation1 = 13; - public const uint AerialActivation2 = 14; - public const uint AerialActivation3 = 15; - public const uint AerialActivation4 = 16; - public const uint AerialActivation5 = 17; - public const uint AerialActivation6 = 18; - - public const uint Vol7ronActivation1 = 19; - public const uint Vol7ronActivation2 = 20; - public const uint Vol7ronActivation3 = 21; - public const uint Vol7ronActivation4 = 22; - public const uint Vol7ronActivation5 = 23; - public const uint Vol7ronActivation6 = 24; - public const uint Vol7ronActivation7 = 25; - - public const uint Outtro1 = 26; - public const uint Outtro2 = 27; - public const uint Outtro3 = 28; - - // Computer - public const uint SelfDestruct10 = 1; - public const uint SelfDestruct9 = 2; - public const uint SelfDestruct8 = 3; - public const uint SelfDestruct7 = 4; - public const uint SelfDestruct6 = 5; - public const uint SelfDestruct5 = 6; - public const uint SelfDestruct4 = 7; - public const uint SelfDestruct3 = 8; - public const uint SelfDestruct2 = 9; - public const uint SelfDestruct1 = 10; - public const uint SelfDestructFinalized = 11; - } - - struct Actions - { - public const int StartMkii = 1; - public const int HardmodeMkii = 2; - - public const int ActivateVx001 = 3; - public const int StartVx001 = 4; - public const int HardmodeVx001 = 5; - - public const int ActivateAerial = 6; - public const int StartAerial = 7; - public const int HardmodeAerial = 8; - public const int DisableAerial = 9; - public const int EnableAerial = 10; - - public const int ActivateV0l7r0n1 = 11; - public const int ActivateV0l7r0n2 = 12; - public const int AssembledCombat = 13; // All 3 Parts Use This Action = 1; Its Done On Purpose. - - public const int ActivateHardMode = 14; - public const int ActivateComputer = 15; - public const int DeactivateComputer = 16; - public const int ActivateSelfDestruct = 17; - - public const int EncounterDone = 18; - } - - struct Phases - { - public const byte LeviathanMkII = 1; - public const byte Vx001 = 2; - public const byte AerialCommandUnit = 3; - public const byte Vol7ron = 4; - } - - struct Waypoints - { - public const uint MkiiP1Idle = 1; - public const uint MkiiP4Pos1 = 2; - public const uint MkiiP4Pos2 = 3; - public const uint MkiiP4Pos3 = 4; - public const uint MkiiP4Pos4 = 5; - public const uint MkiiP4Pos5 = 6; - public const uint AerialP4Pos = 7; - } - - struct SeatIds - { - public const sbyte RocketLeft = 5; - public const sbyte RocketRight = 6; - } - - struct MimironConst - { - public static uint[] RepairSpells = - { - Spells.Seat1, - Spells.Seat2, - Spells.Seat3, - Spells.Seat5 - }; - - public static Position[] VehicleRelocation = - { - new Position(0.0f, 0.0f, 0.0f), - new Position(2792.07f, 2596.32f, 364.3136f, 3.560472f), // WP_MKII_P1_IDLE - new Position(2765.945f, 2571.095f, 364.0636f), // WP_MKII_P4_POS_1 - new Position(2768.195f, 2573.095f, 364.0636f), // WP_MKII_P4_POS_2 - new Position(2763.820f, 2568.870f, 364.3136f), // WP_MKII_P4_POS_3 - new Position(2761.215f, 2568.875f, 364.0636f), // WP_MKII_P4_POS_4 - new Position(2744.610f, 2569.380f, 364.3136f), // WP_MKII_P4_POS_5 - new Position(2748.513f, 2569.051f, 364.3136f) // WP_AERIAL_P4_POS - }; - - public static Position VX001SummonPos = new Position(2744.431f, 2569.385f, 364.3968f, 3.141593f); - public static Position ACUSummonPos = new Position(2744.650f, 2569.460f, 380.0000f, 0.0f); - - public static bool IsEncounterFinished(Unit who) - { - InstanceScript instance = who.GetInstanceScript(); - - Creature mkii = ObjectAccessor.GetCreature(who, instance.GetGuidData(InstanceData.LeviathanMKII)); - Creature vx001 = ObjectAccessor.GetCreature(who, instance.GetGuidData(InstanceData.VX001)); - Creature aerial = ObjectAccessor.GetCreature(who, instance.GetGuidData(InstanceData.AerialCommandUnit)); - if (!mkii || !vx001 || !aerial) - return false; - - if (mkii.GetStandState() == UnitStandStateType.Dead && vx001.GetStandState() == UnitStandStateType.Dead && aerial.GetStandState() == UnitStandStateType.Dead) - { - who.Kill(mkii); - who.Kill(vx001); - who.Kill(aerial); - mkii.DespawnOrUnsummon(120000); - vx001.DespawnOrUnsummon(120000); - aerial.DespawnOrUnsummon(120000); - Creature mimiron = ObjectAccessor.GetCreature(who, instance.GetGuidData(BossIds.Mimiron)); - if (mimiron) - mimiron.GetAI().JustDied(who); - return true; - } - return false; - } - } - - [Script] - class boss_mimiron : BossAI - { - public boss_mimiron(Creature creature) : base(creature, BossIds.Mimiron) - { - me.SetReactState(ReactStates.Passive); - _fireFighter = false; - } - - public override void InitializeAI() - { - SetupEncounter(); - } - - void SetupEncounter() - { - _Reset(); - me.SetReactState(ReactStates.Passive); - me.RemoveUnitFlag(UnitFlags.NonAttackable); - - GameObject elevator = ObjectAccessor.GetGameObject(me, instance.GetGuidData(InstanceData.MimironElevator)); - if (elevator) - elevator.SetGoState(GameObjectState.Active); - - if (_fireFighter) - { - Creature computer = ObjectAccessor.GetCreature(me, instance.GetGuidData(InstanceData.Computer)); - if (computer) - computer.GetAI().DoAction(Actions.DeactivateComputer); - } - - GameObject button = ObjectAccessor.GetGameObject(me, instance.GetGuidData(InstanceData.MimironButton)); - if (button) - { - button.SetGoState(GameObjectState.Ready); - button.RemoveFlag(GameObjectFlags.NotSelectable); - } - - _fireFighter = false; - DoCast(me, Spells.Weld); - Unit mkii = Global.ObjAccessor.GetUnit(me, instance.GetGuidData(InstanceData.LeviathanMKII)); - if (mkii) - DoCast(mkii, Spells.Seat3); - - if (!_events.Empty()) - { - - } - } - - public override void DoAction(int action) - { - switch (action) - { - case Actions.ActivateVx001: - _events.ScheduleEvent(Events.Vx001Activation1, 1000); - break; - case Actions.ActivateAerial: - _events.ScheduleEvent(Events.AerialActivation1, 5000); - break; - case Actions.ActivateV0l7r0n1: - Talk(Yells.AerialDeath); - Creature mkii = ObjectAccessor.GetCreature(me, instance.GetGuidData(InstanceData.LeviathanMKII)); - if (mkii) - mkii.GetMotionMaster().MovePoint(Waypoints.MkiiP4Pos1, MimironConst.VehicleRelocation[Waypoints.MkiiP4Pos1]); - break; - case Actions.ActivateV0l7r0n2: - _events.ScheduleEvent(Events.Vol7ronActivation1, 1000); - break; - case Actions.ActivateHardMode: - _fireFighter = true; - DoZoneInCombat(me); - break; - default: - break; - } - } - - public override void EnterCombat(Unit who) - { - if (!me.GetVehicleBase()) - return; - - //PLay Sound number 15612 - - _EnterCombat(); - me.AddUnitFlag(UnitFlags.NonAttackable); - me.RemoveAurasDueToSpell(Spells.Weld); - DoCast(me.GetVehicleBase(), Spells.Seat6); - - GameObject button = ObjectAccessor.GetGameObject(me, instance.GetGuidData(InstanceData.MimironButton)); - if (button) - button.AddFlag(GameObjectFlags.NotSelectable); - - if (_fireFighter) - _events.ScheduleEvent(Events.SummonFlames, 3000); - - _events.ScheduleEvent(Events.Intro1, 1500); - } - - public override void JustDied(Unit who) - { - instance.SetBossState(BossIds.Mimiron, EncounterState.Done); - _events.Reset(); - me.CombatStop(true); - me.SetDisableGravity(false); - DoCast(me, Spells.SleepVisual1); - DoCastAOE(Spells.DespawnAssaultBots); - me.ExitVehicle(); - // ExitVehicle() offset position is not implemented, so we make up for that with MoveJump()... - me.GetMotionMaster().MoveJump(me.GetPositionX() + (float)(10.0f * Math.Cos(me.GetOrientation())), me.GetPositionY() + (float)(10.0f * Math.Sin(me.GetOrientation())), me.GetPositionZ(), me.GetOrientation(), 10.0f, 5.0f); - _events.ScheduleEvent(Events.Outtro1, 7000); - } - - public override void JustAppeared() - { - //SetupEncounter(); - } - - public override void EnterEvadeMode(EvadeReason why = EvadeReason.Other) - { - _DespawnAtEvade(); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim() && instance.GetBossState(BossIds.Mimiron) != EncounterState.Done) - return; - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case Events.SummonFlames: - { - Unit worldtrigger = Global.ObjAccessor.GetUnit(me, instance.GetGuidData(InstanceData.MimironWorldTrigger)); - if (worldtrigger) - worldtrigger.CastCustomSpell(Spells.ScriptEffectSummonFlamesInitial, SpellValueMod.MaxTargets, 3, null, true, null, null, me.GetGUID()); - _events.RescheduleEvent(Events.SummonFlames, 28000); - } - break; - case Events.Intro1: - Talk(_fireFighter ? Yells.HardmodeOn : Yells.MkiiActivate); - _events.ScheduleEvent(Events.Intro2, 5000); - break; - case Events.Intro2: - { - Unit mkii = me.GetVehicleBase(); - if (mkii) - { - DoCast(mkii, Spells.Seat7); - mkii.RemoveAurasDueToSpell(Spells.FreezeAnim); - mkii.RemoveUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - } - _events.ScheduleEvent(Events.Intro3, 2000); - } - break; - case Events.Intro3: - { - Creature mkii = me.GetVehicleCreatureBase(); - if (mkii) - mkii.GetAI().DoAction(_fireFighter ? Actions.HardmodeMkii : Actions.StartMkii); - } - break; - case Events.Vx001Activation1: - { - Unit mkii = me.GetVehicleBase(); - if (mkii) - DoCast(mkii, Spells.Seat6); - _events.ScheduleEvent(Events.Vx001Activation2, 1000); - } - break; - case Events.Vx001Activation2: - { - Talk(Yells.MkiiDeath); - _events.ScheduleEvent(Events.Vx001Activation3, 5000); - } - break; - case Events.Vx001Activation3: - { - GameObject elevator = ObjectAccessor.GetGameObject(me, instance.GetGuidData(InstanceData.MimironElevator)); - if (elevator) - elevator.SetGoState(GameObjectState.Ready); - Unit worldtrigger = Global.ObjAccessor.GetUnit(me, instance.GetGuidData(InstanceData.MimironWorldTrigger)); - if (worldtrigger) - worldtrigger.CastSpell(worldtrigger, Spells.ElevatorKnockback); - _events.ScheduleEvent(Events.Vx001Activation4, 6000); - } - break; - case Events.Vx001Activation4: - { - GameObject elevator = ObjectAccessor.GetGameObject(me, instance.GetGuidData(InstanceData.MimironElevator)); - if (elevator) - elevator.SetGoState(GameObjectState.ActiveAlternative); - Creature vx001 = me.SummonCreature(InstanceCreatureIds.Vx001, MimironConst.VX001SummonPos, TempSummonType.CorpseTimedDespawn, 120000); - if (vx001) - vx001.CastSpell(vx001, Spells.FreezeAnim); - _events.ScheduleEvent(Events.Vx001Activation5, 19000); - } - break; - case Events.Vx001Activation5: - { - Unit vx001 = Global.ObjAccessor.GetUnit(me, instance.GetGuidData(InstanceData.VX001)); - if (vx001) - DoCast(vx001, Spells.Seat1); - _events.ScheduleEvent(Events.Vx001Activation6, 3500); - } - break; - case Events.Vx001Activation6: - Talk(Yells.Vx001Activate); - _events.ScheduleEvent(Events.Vx001Activation7, 4000); - break; - case Events.Vx001Activation7: - { - Unit vx001 = me.GetVehicleBase(); - if (vx001) - DoCast(vx001, Spells.Seat2); - _events.ScheduleEvent(Events.Vx001Activation8, 3000); - } - break; - case Events.Vx001Activation8: - { - Creature vx001 = me.GetVehicleCreatureBase(); - if (vx001) - vx001.GetAI().DoAction(_fireFighter ? Actions.HardmodeVx001 : Actions.StartVx001); - } - break; - case Events.AerialActivation1: - { - Unit mkii = me.GetVehicleBase(); - if (mkii) - DoCast(mkii, Spells.Seat5); - _events.ScheduleEvent(Events.AerialActivation2, 2500); - } - break; - case Events.AerialActivation2: - Talk(Yells.Vx001Death); - _events.ScheduleEvent(Events.AerialActivation3, 5000); - break; - case Events.AerialActivation3: - me.SummonCreature(InstanceCreatureIds.AerialCommandUnit, MimironConst.ACUSummonPos, TempSummonType.ManualDespawn); - _events.ScheduleEvent(Events.AerialActivation4, 5000); - break; - case Events.AerialActivation4: - { - Unit aerial = Global.ObjAccessor.GetUnit(me, instance.GetGuidData(InstanceData.AerialCommandUnit)); - if (aerial) - me.CastSpell(aerial, Spells.Seat1); - _events.ScheduleEvent(Events.AerialActivation5, 2000); - } - break; - case Events.AerialActivation5: - Talk(Yells.AerialActivate); - _events.ScheduleEvent(Events.AerialActivation6, 8000); - break; - case Events.AerialActivation6: - Creature acu = me.GetVehicleCreatureBase(); - if (acu) - acu.GetAI().DoAction(_fireFighter ? Actions.HardmodeAerial : Actions.StartAerial); - break; - case Events.Vol7ronActivation1: - { - Creature mkii = ObjectAccessor.GetCreature(me, instance.GetGuidData(InstanceData.LeviathanMKII)); - if (mkii) - mkii.SetFacingTo((float)Math.PI); - _events.ScheduleEvent(Events.Vol7ronActivation2, 1000); - } - break; - case Events.Vol7ronActivation2: - { - Creature mkii = ObjectAccessor.GetCreature(me, instance.GetGuidData(InstanceData.LeviathanMKII)); - if (mkii) - { - Creature vx001 = ObjectAccessor.GetCreature(me, instance.GetGuidData(InstanceData.VX001)); - if (vx001) - { - vx001.RemoveAurasDueToSpell(Spells.TorsoDisabled); - vx001.CastSpell(mkii, Spells.MountMkii); - } - } - _events.ScheduleEvent(Events.Vol7ronActivation3, 4500); - } - break; - case Events.Vol7ronActivation3: - { - Creature mkii = ObjectAccessor.GetCreature(me, instance.GetGuidData(InstanceData.LeviathanMKII)); - if (mkii) - mkii.GetMotionMaster().MovePoint(Waypoints.MkiiP4Pos4, MimironConst.VehicleRelocation[Waypoints.MkiiP4Pos4]); - _events.ScheduleEvent(Events.Vol7ronActivation4, 5000); - } - break; - case Events.Vol7ronActivation4: - { - Creature vx001 = ObjectAccessor.GetCreature(me, instance.GetGuidData(InstanceData.VX001)); - if (vx001) - { - Creature aerial = ObjectAccessor.GetCreature(me, instance.GetGuidData(InstanceData.AerialCommandUnit)); - if (aerial) - { - aerial.GetMotionMaster().MoveLand(0, new Position(aerial.GetPositionX(), aerial.GetPositionY(), aerial.GetPositionZMinusOffset())); - aerial.SetAnimTier(UnitBytes1Flags.None, false); - aerial.CastSpell(vx001, Spells.MountVx001); - aerial.CastSpell(aerial, Spells.HalfHeal); - } - } - _events.ScheduleEvent(Events.Vol7ronActivation5, 4000); - } - break; - case Events.Vol7ronActivation5: - Talk(Yells.V07tronActivate); - _events.ScheduleEvent(Events.Vol7ronActivation6, 3000); - break; - case Events.Vol7ronActivation6: - { - Creature vx001 = ObjectAccessor.GetCreature(me, instance.GetGuidData(InstanceData.VX001)); - if (vx001) - DoCast(vx001, Spells.Seat2); - _events.ScheduleEvent(Events.Vol7ronActivation7, 5000); - } - break; - case Events.Vol7ronActivation7: - for (uint data = InstanceData.LeviathanMKII; data <= InstanceData.AerialCommandUnit; ++data) - { - Creature mimironVehicle = ObjectAccessor.GetCreature(me, instance.GetGuidData(data)); - if (mimironVehicle) - mimironVehicle.GetAI().DoAction(Actions.AssembledCombat); - } - break; - case Events.Outtro1: - me.RemoveAurasDueToSpell(Spells.SleepVisual1); - DoCast(me, Spells.SleepVisual2); - me.SetFaction(35); - _events.ScheduleEvent(Events.Outtro2, 3000); - break; - case Events.Outtro2: - Talk(Yells.V07tronDeath); - if (_fireFighter) - { - Creature computer = ObjectAccessor.GetCreature(me, instance.GetGuidData(InstanceData.Computer)); - if (computer) - computer.GetAI().DoAction(Actions.DeactivateComputer); - me.SummonGameObject(RaidMode(InstanceGameObjectIds.CacheOfInnovationFirefighter, InstanceGameObjectIds.CacheOfInnovationFirefighterHero), 2744.040f, 2569.352f, 364.3135f, 3.124123f, new Quaternion(0.0f, 0.0f, 0.9999619f, 0.008734641f), 604800); - } - else - me.SummonGameObject(RaidMode(InstanceGameObjectIds.CacheOfInnovation, InstanceGameObjectIds.CacheOfInnovationHero), 2744.040f, 2569.352f, 364.3135f, 3.124123f, new Quaternion(0.0f, 0.0f, 0.9999619f, 0.008734641f), 604800); - _events.ScheduleEvent(Events.Outtro3, 11000); - break; - case Events.Outtro3: - DoCast(me, Spells.TeleportVisual); - me.AddUnitFlag(UnitFlags.NotSelectable); - me.DespawnOrUnsummon(1000); // sniffs say 6 sec after, but it doesnt matter. - break; - default: - break; - } - }); - } - - bool _fireFighter; - } - - [Script] - class boss_leviathan_mk_ii : BossAI - { - public boss_leviathan_mk_ii(Creature creature) : base(creature, BossIds.Mimiron) - { - _fireFighter = false; - _setupMine = true; - _setupBomb = true; - _setupRocket = true; - } - - public override void InitializeAI() - { - SetupEncounter(); - } - - void SetupEncounter() - { - _Reset(); - me.AddUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - me.SetReactState(ReactStates.Passive); - _fireFighter = false; - _setupMine = true; - _setupBomb = true; - _setupRocket = true; - DoCast(me, Spells.FreezeAnim); - } - - public override void DamageTaken(Unit who, ref uint damage) - { - if (damage >= me.GetHealth()) - { - damage = (uint)(me.GetHealth() - 1); // Let creature fall to 1 hp, but do not let it die or damage itself with SetHealth(). - me.AddUnitFlag(UnitFlags.NonAttackable); - DoCast(me, Spells.VehicleDamaged, true); - me.AttackStop(); - me.SetReactState(ReactStates.Passive); - me.RemoveAllAurasExceptType(AuraType.ControlVehicle, AuraType.ModIncreaseHealthPercent); - - if (_events.IsInPhase(Phases.LeviathanMkII)) - { - me.CastStop(); - Unit turret = me.GetVehicleKit().GetPassenger(3); - if (turret) - turret.KillSelf(); - - me.SetSpeedRate(UnitMoveType.Run, 1.5f); - me.GetMotionMaster().MovePoint(Waypoints.MkiiP1Idle, MimironConst.VehicleRelocation[Waypoints.MkiiP1Idle]); - } - else if (_events.IsInPhase(Phases.Vol7ron)) - { - me.SetStandState(UnitStandStateType.Dead); - - if (MimironConst.IsEncounterFinished(who)) - return; - - me.CastStop(); - DoCast(me, Spells.SelfRepair); - } - _events.Reset(); - } - } - - public override void DoAction(int action) - { - switch (action) - { - case Actions.HardmodeMkii: - _fireFighter = true; - DoCast(me, Spells.EmergencyMode); - DoCastAOE(Spells.EmergencyModeTurret); - _events.ScheduleEvent(Events.FlameSuppressantVx, 60000, 0, Phases.LeviathanMkII); - goto case Actions.StartMkii; - case Actions.StartMkii: - me.SetReactState(ReactStates.Aggressive); - _events.SetPhase(Phases.LeviathanMkII); - - _events.ScheduleEvent(Events.NapalmShell, 3000, 0, Phases.LeviathanMkII); - _events.ScheduleEvent(Events.PlasmaBlast, 15000, 0, Phases.LeviathanMkII); - _events.ScheduleEvent(Events.ProximityMine, 5000); - _events.ScheduleEvent(Events.ShockBlast, 18000); - break; - case Actions.AssembledCombat: - me.SetStandState(UnitStandStateType.Stand); - me.RemoveUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - me.SetReactState(ReactStates.Aggressive); - - _events.SetPhase(Phases.Vol7ron); - _events.ScheduleEvent(Events.ProximityMine, 15000); - _events.ScheduleEvent(Events.ShockBlast, 45000); - break; - default: - break; - } - } - - public override uint GetData(uint type) - { - switch (type) - { - case Data.SetupMine: - return _setupMine ? 1 : 0u; - case Data.SetupBomb: - return _setupBomb ? 1 : 0u; - case Data.SetupRocket: - return _setupRocket ? 1 : 0u; - case Data.Firefighter: - return _fireFighter ? 1 : 0u; - default: - return 0; - } - } - - public override void JustSummoned(Creature summon) - { - summons.Summon(summon); - } - - public override void KilledUnit(Unit victim) - { - if (victim.IsTypeId(TypeId.Player)) - { - Creature mimiron = ObjectAccessor.GetCreature(me, instance.GetGuidData(BossIds.Mimiron)); - if (mimiron) - mimiron.GetAI().Talk(_events.IsInPhase(Phases.LeviathanMkII) ? Yells.MkiiSlay : Yells.V07tronSlay); - } - } - - public override void MovementInform(MovementGeneratorType type, uint point) - { - if (type != MovementGeneratorType.Point) - return; - - switch (point) - { - case Waypoints.MkiiP1Idle: - { - me.AddUnitFlag(UnitFlags.NotSelectable); - DoCast(me, Spells.HalfHeal); - - Creature mimiron = ObjectAccessor.GetCreature(me, instance.GetGuidData(BossIds.Mimiron)); - if (mimiron) - mimiron.GetAI().DoAction(Actions.ActivateVx001); - } - break; - case Waypoints.MkiiP4Pos1: - _events.ScheduleEvent(Events.MovePoint2, 1); - break; - case Waypoints.MkiiP4Pos2: - _events.ScheduleEvent(Events.MovePoint3, 1); - break; - case Waypoints.MkiiP4Pos3: - { - Creature mimiron = ObjectAccessor.GetCreature(me, instance.GetGuidData(BossIds.Mimiron)); - if (mimiron) - mimiron.GetAI().DoAction(Actions.ActivateV0l7r0n2); - } - break; - case Waypoints.MkiiP4Pos4: - _events.ScheduleEvent(Events.MovePoint5, 1); - break; - default: - break; - } - } - - public override void SetData(uint id, uint data) - { - switch (id) - { - case Data.SetupMine: - _setupMine = data != 0; - break; - case Data.SetupBomb: - _setupBomb = data != 0; - break; - case Data.SetupRocket: - _setupRocket = data != 0; - break; - default: - break; - } - } - - public override void JustAppeared() - { - SetupEncounter(); - } - - public override void EnterEvadeMode(EvadeReason why = EvadeReason.Other) - { - _DespawnAtEvade(); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case Events.ProximityMine: - DoCastAOE(Spells.ProximityMines); - _events.RescheduleEvent(Events.ProximityMine, 35000); - break; - case Events.PlasmaBlast: - DoCastVictim(Spells.ScriptEffectPlasmaBlast); - _events.RescheduleEvent(Events.PlasmaBlast, RandomHelper.URand(30000, 45000), 0, Phases.LeviathanMkII); - - if (_events.GetTimeUntilEvent(Events.NapalmShell) < 9000) - _events.RescheduleEvent(Events.NapalmShell, 9000, 0, Phases.LeviathanMkII); // The actual spell is cast by the turret, we should not let it interrupt itself. - break; - case Events.ShockBlast: - DoCastAOE(Spells.ShockBlast); - _events.RescheduleEvent(Events.ShockBlast, RandomHelper.URand(34000, 36000)); - break; - case Events.FlameSuppressantMk: - DoCastAOE(Spells.FlameSuppressantMk); - _events.RescheduleEvent(Events.FlameSuppressantMk, 60000, 0, Phases.LeviathanMkII); - break; - case Events.NapalmShell: - DoCastAOE(Spells.ForceCastNapalmShell); - _events.RescheduleEvent(Events.NapalmShell, RandomHelper.URand(6000, 15000), 0, Phases.LeviathanMkII); - - if (_events.GetTimeUntilEvent(Events.PlasmaBlast) < 2000) - _events.RescheduleEvent(Events.PlasmaBlast, 2000, 0, Phases.LeviathanMkII); // The actual spell is cast by the turret, we should not let it interrupt itself. - break; - case Events.MovePoint2: - me.GetMotionMaster().MovePoint(Waypoints.MkiiP4Pos2, MimironConst.VehicleRelocation[Waypoints.MkiiP4Pos2]); - break; - case Events.MovePoint3: - me.GetMotionMaster().MovePoint(Waypoints.MkiiP4Pos3, MimironConst.VehicleRelocation[Waypoints.MkiiP4Pos3]); - break; - case Events.MovePoint5: - me.GetMotionMaster().MovePoint(Waypoints.MkiiP4Pos5, MimironConst.VehicleRelocation[Waypoints.MkiiP4Pos5]); - break; - default: - break; - } - }); - DoMeleeAttackIfReady(); - } - - bool _fireFighter; - bool _setupMine; - bool _setupBomb; - bool _setupRocket; - } - - [Script] //todo check for both rockets - class boss_vx_001 : BossAI - { - public boss_vx_001(Creature creature) : base(creature, BossIds.Mimiron) - { - me.SetDisableGravity(true); // This is the unfold visual state of VX-001, it has to be set on create as it requires an objectupdate if set later. - me.SetEmoteState(Emote.StateSpecialUnarmed); // This is a hack to force the yet to be unfolded visual state. - me.SetReactState(ReactStates.Passive); - _fireFighter = false; - } - - public override void DamageTaken(Unit who, ref uint damage) - { - if (damage >= me.GetHealth()) - { - //play sound 15615 - damage = (uint)(me.GetHealth() - 1); // Let creature fall to 1 hp, but do not let it die or damage itself with SetHealth(). - me.AttackStop(); - DoCast(me, Spells.VehicleDamaged, true); - me.RemoveAllAurasExceptType(AuraType.ControlVehicle, AuraType.ModIncreaseHealthPercent); - - if (_events.IsInPhase(Phases.Vx001)) - { - me.CastStop(); - me.AddUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - DoCast(me, Spells.HalfHeal); // has no effect, wat - DoCast(me, Spells.TorsoDisabled); - Creature mimiron = ObjectAccessor.GetCreature(me, instance.GetGuidData(BossIds.Mimiron)); - if (mimiron) - mimiron.GetAI().DoAction(Actions.ActivateAerial); - } - else if (_events.IsInPhase(Phases.Vol7ron)) - { - me.SetStandState(UnitStandStateType.Dead); - me.AddUnitFlag(UnitFlags.NonAttackable); - - if (MimironConst.IsEncounterFinished(who)) - return; - - me.CastStop(); - DoCast(me, Spells.SelfRepair); - } - _events.Reset(); - } - } - - public override void DoAction(int action) - { - switch (action) - { - case Actions.HardmodeVx001: - _fireFighter = true; - DoCast(me, Spells.EmergencyMode); - _events.ScheduleEvent(Events.FrostBomb, 1000); - _events.ScheduleEvent(Events.FlameSuppressantVx, 6000); - goto case Actions.StartVx001; - case Actions.StartVx001: - me.RemoveUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - me.RemoveAurasDueToSpell(Spells.FreezeAnim); - me.SetEmoteState(Emote.OneshotNone); // Remove emotestate. - //me.SetuintValue(UnitFields.Bytes1, UnitBytes1Offsets.AnimTier, UnitBytes1Flags.AlwaysStand | UnitBytes1Flags.Hover); Blizzard handles hover animation like this it seems. - DoCast(me, Spells.HeatWaveAura); - - _events.SetPhase(Phases.Vx001); - _events.ScheduleEvent(Events.RocketStrike, 20000); - _events.ScheduleEvent(Events.SpinningUp, RandomHelper.URand(30000, 35000)); - _events.ScheduleEvent(Events.RapidBurst, 500, 0, Phases.Vx001); - break; - case Actions.AssembledCombat: - me.SetStandState(UnitStandStateType.Stand); - me.RemoveUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - - _events.SetPhase(Phases.Vol7ron); - _events.ScheduleEvent(Events.RocketStrike, 20000); - _events.ScheduleEvent(Events.SpinningUp, RandomHelper.URand(30000, 35000)); - _events.ScheduleEvent(Events.HandPulse, 500, 0, Phases.Vol7ron); - if (_fireFighter) - _events.ScheduleEvent(Events.FrostBomb, 1000); - break; - default: - break; - } - } - - public override void EnterEvadeMode(EvadeReason why) - { - summons.DespawnAll(); - } - - public override void JustSummoned(Creature summon) - { - summons.Summon(summon); - if (summon.GetEntry() == InstanceCreatureIds.BurstTarget) - summon.CastSpell(me, Spells.RapidBurstTargetMe); - } - - public override void KilledUnit(Unit victim) - { - if (victim.IsTypeId(TypeId.Player)) - { - Creature mimiron = ObjectAccessor.GetCreature(me, instance.GetGuidData(BossIds.Mimiron)); - if (mimiron) - mimiron.GetAI().Talk(_events.IsInPhase(Phases.Vx001) ? Yells.Vx001Slay : Yells.V07tronSlay); - } - } - - public override void SpellHit(Unit caster, SpellInfo spellProto) - { - if (caster.GetEntry() == InstanceCreatureIds.BurstTarget && !me.HasUnitState(UnitState.Casting)) - DoCast(caster, Spells.RapidBurst); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _events.Update(diff); - - // Handle rotation during SPELL_SPINNING_UP, SPELL_P3WX2_LASER_BARRAGE, SPELL_RAPID_BURST, and SPELL_HAND_PULSE_LEFT/RIGHT - if (me.HasUnitState(UnitState.Casting)) - { - List channelObjects = me.m_unitData.ChannelObjects; - Unit channelTarget = (channelObjects.Count == 1 ? Global.ObjAccessor.GetUnit(me, channelObjects[0]) : null); - if (channelTarget) - me.SetFacingToObject(channelTarget); - return; - } - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case Events.RapidBurst: - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 120, true); - if (target) - DoCast(target, Spells.SummonBurstTarget); - _events.RescheduleEvent(Events.RapidBurst, 3000, 0, Phases.Vx001); - } - break; - case Events.RocketStrike: - DoCastAOE(_events.IsInPhase(Phases.Vx001) ? Spells.RocketStrikeSingle : Spells.RocketStrikeBoth); - _events.ScheduleEvent(Events.Reload, 10000); - _events.RescheduleEvent(Events.RocketStrike, RandomHelper.URand(20000, 25000)); - break; - case Events.Reload: - for (sbyte seat = (sbyte)SeatIds.RocketLeft; seat <= SeatIds.RocketRight; ++seat) - { - Unit rocket = me.GetVehicleKit().GetPassenger(seat); - if (rocket) - rocket.SetDisplayId(rocket.GetNativeDisplayId()); - } - break; - case Events.HandPulse: - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 120, true); - if (target) - DoCast(target, RandomHelper.RAND(Spells.HandPulseLeft, Spells.HandPulseRight)); - _events.RescheduleEvent(Events.HandPulse, RandomHelper.URand(1500, 3000), 0, Phases.Vol7ron); - } - break; - case Events.FrostBomb: - DoCastAOE(Spells.ScriptEffectFrostBomb); - _events.RescheduleEvent(Events.FrostBomb, 45000); - break; - case Events.SpinningUp: - DoCastAOE(Spells.SpinningUp); - _events.DelayEvents(14000); - _events.RescheduleEvent(Events.SpinningUp, RandomHelper.URand(55000, 65000)); - break; - case Events.FlameSuppressantVx: - DoCastAOE(Spells.FlameSuppressantVx); - _events.RescheduleEvent(Events.FlameSuppressantVx, RandomHelper.URand(10000, 12000), 0, Phases.Vx001); - break; - default: - break; - } - }); - } - - bool _fireFighter; - } - - [Script] - class boss_aerial_command_unit : BossAI - { - public boss_aerial_command_unit(Creature creature) : base(creature, BossIds.Mimiron) - { - me.SetReactState(ReactStates.Passive); - fireFigther = false; - } - - public override void DamageTaken(Unit who, ref uint damage) - { - if (damage >= me.GetHealth()) - { - damage = (uint)(me.GetHealth() - 1); // Let creature fall to 1 hp, but do not let it die or damage itself with SetHealth(). - me.AddUnitFlag(UnitFlags.NonAttackable); - me.AttackStop(); - me.SetReactState(ReactStates.Passive); - DoCast(me, Spells.VehicleDamaged, true); - me.RemoveAllAurasExceptType(AuraType.ControlVehicle, AuraType.ModIncreaseHealthPercent); - - if (_events.IsInPhase(Phases.AerialCommandUnit)) - { - me.GetMotionMaster().Clear(true); - me.GetMotionMaster().MovePoint(Waypoints.AerialP4Pos, MimironConst.VehicleRelocation[Waypoints.AerialP4Pos]); - } - else if (_events.IsInPhase(Phases.Vol7ron)) - { - me.SetStandState(UnitStandStateType.Dead); - - if (MimironConst.IsEncounterFinished(who)) - return; - - me.CastStop(); - DoCast(me, Spells.SelfRepair); - } - _events.Reset(); - } - } - - public override void DoAction(int action) - { - switch (action) - { - case Actions.HardmodeAerial: - fireFigther = true; - DoCast(me, Spells.EmergencyMode); - _events.ScheduleEvent(Events.SummonFireBots, 1000, 0, Phases.AerialCommandUnit); - goto case Actions.StartAerial; - case Actions.StartAerial: - me.RemoveUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - me.SetReactState(ReactStates.Aggressive); - - _events.SetPhase(Phases.AerialCommandUnit); - _events.ScheduleEvent(Events.SummonJunkBot, 5000, 0, Phases.AerialCommandUnit); - _events.ScheduleEvent(Events.SummonAssaultBot, 9000, 0, Phases.AerialCommandUnit); - _events.ScheduleEvent(Events.SummonBombBot, 9000, 0, Phases.AerialCommandUnit); - break; - case Actions.DisableAerial: - me.CastStop(); - me.AttackStop(); - me.SetReactState(ReactStates.Passive); - me.GetMotionMaster().MoveFall(); - _events.DelayEvents(23000); - break; - case Actions.EnableAerial: - me.SetReactState(ReactStates.Aggressive); - break; - case Actions.AssembledCombat: - me.RemoveUnitFlag(UnitFlags.NonAttackable | UnitFlags.NotSelectable); - me.SetReactState(ReactStates.Aggressive); - me.SetStandState(UnitStandStateType.Stand); - _events.SetPhase(Phases.Vol7ron); - break; - default: - break; - } - } - - public override void EnterEvadeMode(EvadeReason why) - { - summons.DespawnAll(); - } - - public override void JustSummoned(Creature summon) - { - if (fireFigther && (summon.GetEntry() == InstanceCreatureIds.AssaultBot || summon.GetEntry() == InstanceCreatureIds.JunkBot)) - summon.CastSpell(summon, Spells.EmergencyMode); - base.JustSummoned(summon); - } - - public override void KilledUnit(Unit victim) - { - if (victim.IsTypeId(TypeId.Player)) - { - Creature mimiron = ObjectAccessor.GetCreature(me, instance.GetGuidData(BossIds.Mimiron)); - if (mimiron) - mimiron.GetAI().Talk(_events.IsInPhase(Phases.AerialCommandUnit) ? Yells.AerialSlay : Yells.V07tronSlay); - } - } - - public override void MovementInform(MovementGeneratorType type, uint point) - { - if (type == MovementGeneratorType.Point && point == Waypoints.AerialP4Pos) - { - me.AddUnitFlag(UnitFlags.NotSelectable); - - Creature mimiron = ObjectAccessor.GetCreature(me, instance.GetGuidData(BossIds.Mimiron)); - if (mimiron) - mimiron.GetAI().DoAction(Actions.ActivateV0l7r0n1); - } - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _events.Update(diff); - - if (me.HasUnitState(UnitState.Casting)) - return; - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case Events.SummonFireBots: - me.CastCustomSpell(Spells.SummonFireBotTrigger, SpellValueMod.MaxTargets, 3, null, true); - _events.RescheduleEvent(Events.SummonFireBots, 45000, 0, Phases.AerialCommandUnit); - break; - case Events.SummonJunkBot: - me.CastCustomSpell(Spells.SummonJunkBotTrigger, SpellValueMod.MaxTargets, 1, null, true); - _events.RescheduleEvent(Events.SummonJunkBot, RandomHelper.URand(11000, 12000), 0, Phases.AerialCommandUnit); - break; - case Events.SummonAssaultBot: - me.CastCustomSpell(Spells.SummonAssaultBotTrigger, SpellValueMod.MaxTargets, 1, null, true); - _events.RescheduleEvent(Events.SummonAssaultBot, 30000, 0, Phases.AerialCommandUnit); - break; - case Events.SummonBombBot: - DoCast(me, Spells.SummonBombBot); - _events.RescheduleEvent(Events.SummonBombBot, RandomHelper.URand(15000, 20000), 0, Phases.AerialCommandUnit); - break; - default: - break; - } - }); - DoSpellAttackIfReady(_events.IsInPhase(Phases.AerialCommandUnit) ? Spells.PlasmaBallP1 : Spells.PlasmaBallP2); - } - - bool fireFigther; - } - - [Script] - class npc_mimiron_assault_bot : ScriptedAI - { - public npc_mimiron_assault_bot(Creature creature) : base(creature) { } - - public override void EnterCombat(Unit who) - { - _scheduler.Schedule(TimeSpan.FromSeconds(14), task => - { - DoCastVictim(Spells.MagneticField); - me.ClearUnitState(UnitState.Casting); - task.Repeat(TimeSpan.FromSeconds(30)); - }); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - if (me.HasUnitState(UnitState.Root)) - { - Unit newTarget = SelectTarget(SelectAggroTarget.MinDistance, 0, 30.0f, true); - if (newTarget) - { - me.GetThreatManager().ClearAllThreat(); - AttackStart(newTarget); - } - } - - _scheduler.Update(diff, DoMeleeAttackIfReady); - } - } - - [Script] - class npc_mimiron_emergency_fire_bot : ScriptedAI - { - public npc_mimiron_emergency_fire_bot(Creature creature) : base(creature) - { - me.SetReactState(ReactStates.Passive); - isWaterSprayReady = true; - moveNew = true; - } - - public override uint GetData(uint id) - { - if (id == Data.Waterspray) - return isWaterSprayReady ? 1 : 0u; - if (id == Data.MoveNew) - return moveNew ? 1 : 0u; - return 0; - } - - public override void SetData(uint id, uint data) - { - if (id == Data.Waterspray) - isWaterSprayReady = false; - else if (id == Data.MoveNew) - moveNew = data == 1; - } - - public override void Reset() - { - _scheduler.Schedule(TimeSpan.FromSeconds(7), task => - { - isWaterSprayReady = true; - task.Repeat(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(9)); - }); - - isWaterSprayReady = true; - moveNew = true; - } - - public override void UpdateAI(uint diff) - { - if (!isWaterSprayReady) - _scheduler.Update(diff); - } - - bool isWaterSprayReady; - bool moveNew; - } - - [Script] - class npc_mimiron_computer : ScriptedAI - { - public npc_mimiron_computer(Creature creature) : base(creature) - { - instance = me.GetInstanceScript(); - } - - public override void DoAction(int action) - { - switch (action) - { - case Actions.ActivateComputer: - Talk(ComputerYells.SelfDestructInitiated); - _events.ScheduleEvent(Events.SelfDestruct10, 3000); - break; - case Actions.DeactivateComputer: - Talk(ComputerYells.SelfDestructTerminated); - me.RemoveAurasDueToSpell(Spells.SelfDestructionAura); - me.RemoveAurasDueToSpell(Spells.SelfDestructionVisual); - _events.Reset(); - break; - default: - break; - } - } - - public override void UpdateAI(uint diff) - { - _events.Update(diff); - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case Events.SelfDestruct10: - { - Talk(ComputerYells.SelfDestruct10); - Creature mimiron = ObjectAccessor.GetCreature(me, instance.GetGuidData(BossIds.Mimiron)); - if (mimiron) - mimiron.GetAI().DoAction(Actions.ActivateHardMode); - _events.ScheduleEvent(Events.SelfDestruct9, 60000); - } - break; - case Events.SelfDestruct9: - Talk(ComputerYells.SelfDestruct9); - _events.ScheduleEvent(Events.SelfDestruct8, 60000); - break; - case Events.SelfDestruct8: - Talk(ComputerYells.SelfDestruct8); - _events.ScheduleEvent(Events.SelfDestruct7, 60000); - break; - case Events.SelfDestruct7: - Talk(ComputerYells.SelfDestruct7); - _events.ScheduleEvent(Events.SelfDestruct6, 60000); - break; - case Events.SelfDestruct6: - Talk(ComputerYells.SelfDestruct6); - _events.ScheduleEvent(Events.SelfDestruct5, 60000); - break; - case Events.SelfDestruct5: - Talk(ComputerYells.SelfDestruct5); - _events.ScheduleEvent(Events.SelfDestruct4, 60000); - break; - case Events.SelfDestruct4: - Talk(ComputerYells.SelfDestruct4); - _events.ScheduleEvent(Events.SelfDestruct3, 60000); - break; - case Events.SelfDestruct3: - Talk(ComputerYells.SelfDestruct3); - _events.ScheduleEvent(Events.SelfDestruct2, 60000); - break; - case Events.SelfDestruct2: - Talk(ComputerYells.SelfDestruct2); - _events.ScheduleEvent(Events.SelfDestruct1, 60000); - break; - case Events.SelfDestruct1: - Talk(ComputerYells.SelfDestruct1); - _events.ScheduleEvent(Events.SelfDestructFinalized, 60000); - break; - case Events.SelfDestructFinalized: - { - Talk(ComputerYells.SelfDestructFinalized); - Creature mimiron = ObjectAccessor.GetCreature(me, instance.GetGuidData(BossIds.Mimiron)); - if (mimiron) - mimiron.GetAI().DoAction(Actions.ActivateSelfDestruct); - DoCast(me, Spells.SelfDestructionAura); - DoCast(me, Spells.SelfDestructionVisual); - } - break; - default: - break; - } - }); - } - - InstanceScript instance; - } - - [Script] - class npc_mimiron_flames : ScriptedAI - { - public npc_mimiron_flames(Creature creature) : base(creature) - { - instance = me.GetInstanceScript(); - } - - public override void Reset() // Reset is possibly more suitable for this case. - { - _scheduler.Schedule(TimeSpan.FromSeconds(4), task => - { - DoCastAOE(Spells.SummonFlamesSpreadTrigger); - }); - } - - public override void UpdateAI(uint diff) - { - if (instance.GetBossState(BossIds.Mimiron) != EncounterState.InProgress) - me.DespawnOrUnsummon(); - - _scheduler.Update(diff); - } - - InstanceScript instance; - } - - [Script] - class npc_mimiron_frost_bomb : ScriptedAI - { - public npc_mimiron_frost_bomb(Creature creature) : base(creature) { } - - public override void Reset() - { - _scheduler.Schedule(TimeSpan.FromSeconds(10), task => - { - DoCastAOE(Spells.FrostBombExplosion); - - task.Schedule(TimeSpan.FromSeconds(3), () => - { - DoCastAOE(Spells.ClearFires); - me.DespawnOrUnsummon(3000); - }); - }); - } - - public override void UpdateAI(uint diff) - { - _scheduler.Update(diff); - } - } - - [Script] - class npc_mimiron_proximity_mine : ScriptedAI - { - public npc_mimiron_proximity_mine(Creature creature) : base(creature) { } - - public override void Reset() - { - _scheduler.Schedule(TimeSpan.FromSeconds(1.5), task => - { - DoCast(me, Spells.ProximityMinePeriodicTrigger); - - task.Schedule(TimeSpan.FromSeconds(33.5), () => - { - if (me.HasAura(Spells.ProximityMinePeriodicTrigger)) - DoCastAOE(Spells.ProximityMineExplosion); - me.DespawnOrUnsummon(1000); - }); - }); - - } - - public override void UpdateAI(uint diff) - { - _scheduler.Update(diff); - } - } - - [Script] - class go_mimiron_hardmode_button : GameObjectScript - { - public go_mimiron_hardmode_button() : base("go_mimiron_hardmode_button") { } - - class go_mimiron_hardmode_buttonAI : GameObjectAI - { - go_mimiron_hardmode_buttonAI(GameObject go) : base(go) - { - instance = go.GetInstanceScript(); - } - - public override bool GossipHello(Player player) - { - if (me.HasFlag(GameObjectFlags.NotSelectable)) - return true; - - Creature computer = ObjectAccessor.GetCreature(me, instance.GetGuidData(InstanceData.Computer)); - if (computer) - computer.GetAI().DoAction(Actions.ActivateComputer); - me.SetGoState(GameObjectState.Active); - me.AddFlag(GameObjectFlags.NotSelectable); - return true; - } - - InstanceScript instance; - } - - public override GameObjectAI GetAI(GameObject go) - { - return GetInstanceAI(go); - } - } - - [Script] // 63801 - Bomb Bot - class spell_mimiron_bomb_bot : SpellScript - { - void HandleScript(uint effIndex) - { - if (GetHitPlayer()) - { - InstanceScript instance = GetCaster().GetInstanceScript(); - if (instance != null) - { - Creature mkii = ObjectAccessor.GetCreature(GetCaster(), instance.GetGuidData(InstanceData.LeviathanMKII)); - if (mkii) - mkii.GetAI().SetData(Data.SetupBomb, 0); - } - } - } - - void HandleDespawn(uint effIndex) - { - Creature target = GetHitCreature(); - if (target) - { - target.AddUnitFlag(UnitFlags.NotSelectable | UnitFlags.Pacified); - target.DespawnOrUnsummon(1000); - } - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.SchoolDamage)); - OnEffectHitTarget.Add(new EffectHandler(HandleDespawn, 1, SpellEffectName.ApplyAura)); - } - } - - [Script] // 65192 - Flame Suppressant, 65224 - Clear Fires, 65354 - Clear Fires, 64619 - Water Spray - class spell_mimiron_clear_fires : SpellScript - { - void HandleDummy(uint effIndex) - { - if (GetHitCreature()) - GetHitCreature().DespawnOrUnsummon(); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); - } - } - - [Script] // 64463 - Despawn Assault Bots - class spell_mimiron_despawn_assault_bots : SpellScript - { - void HandleScript(uint effIndex) - { - if (GetHitCreature()) - GetHitCreature().DespawnOrUnsummon(); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); - } - } - - [Script] // 64618 - Fire Search - class spell_mimiron_fire_search : SpellScript - { - public spell_mimiron_fire_search() - { - _noTarget = false; - } - - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(Spells.WaterSpray); - } - - void FilterTargets(List targets) - { - _noTarget = targets.Empty(); - if (_noTarget) - return; - - WorldObject target = targets.SelectRandom(); - targets.Clear(); - targets.Add(target); - } - - void HandleAftercast() - { - if (_noTarget) - GetCaster().GetMotionMaster().MoveRandom(15.0f); - } - - void HandleScript(uint effIndex) - { - Unit caster = GetCaster(); - UnitAI ai = caster.GetAI(); - if (ai != null) - { - if (caster.GetDistance2d(GetHitUnit()) <= 15.0f && ai.GetData(Data.Waterspray) != 0) - { - caster.CastSpell(GetHitUnit(), Spells.WaterSpray, true); - ai.SetData(Data.Waterspray, 0); - ai.SetData(Data.MoveNew, 1); - } - else if (caster.GetAI().GetData(Data.MoveNew) != 0) - { - caster.GetMotionMaster().MoveChase(GetHitUnit()); - ai.SetData(Data.MoveNew, 0); - } - } - } - - public override void Register() - { - AfterCast.Add(new CastHandler(HandleAftercast)); - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEntry)); - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); - } - - bool _noTarget; - } - - [Script] // 64436 - Magnetic Core - class spell_mimiron_magnetic_core : SpellScript - { - void FilterTargets(List targets) - { - targets.RemoveAll(obj => obj.IsUnit() && (obj.ToUnit().GetVehicleBase() || obj.ToUnit().HasUnitFlag(UnitFlags.NonAttackable))); - } - - public override void Register() - { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 1, Targets.UnitSrcAreaEntry)); - } - } - - [Script] - class spell_mimiron_magnetic_core_AuraScript : AuraScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(Spells.MagneticCoreVisual); - } - - void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Creature target = GetTarget().ToCreature(); - if (target) - { - target.GetAI().DoAction(Actions.DisableAerial); - target.CastSpell(target, Spells.MagneticCoreVisual, true); - } - } - - void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Creature target = GetTarget().ToCreature(); - if (target) - { - target.GetAI().DoAction(Actions.EnableAerial); - target.RemoveAurasDueToSpell(Spells.MagneticCoreVisual); - } - } - - void OnRemoveSelf(AuraEffect aurEff, AuraEffectHandleModes mode) - { - TempSummon summ = GetTarget().ToTempSummon(); - if (summ) - summ.DespawnOrUnsummon(); - } - - public override void Register() - { - AfterEffectApply.Add(new EffectApplyHandler(OnApply, 1, AuraType.ModDamagePercentTaken, AuraEffectHandleModes.Real)); - AfterEffectRemove.Add(new EffectApplyHandler(OnRemove, 1, AuraType.ModDamagePercentTaken, AuraEffectHandleModes.Real)); - AfterEffectRemove.Add(new EffectApplyHandler(OnRemoveSelf, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); - } - } - - [Script] // 63667 - Napalm Shell - class spell_mimiron_napalm_shell : SpellScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(Spells.NapalmShell); - } - - void FilterTargets(List targets) - { - if (targets.Empty()) - return; - - WorldObject target = targets.SelectRandom(); - - targets.RemoveAll(new AllWorldObjectsInRange(GetCaster(), 15.0f).Invoke); - - if (!targets.Empty()) - target = targets.SelectRandom(); - - targets.Clear(); - targets.Add(target); - } - - void HandleScript(uint effIndex) - { - GetCaster().CastSpell(GetHitUnit(), Spells.NapalmShell); - } - - public override void Register() - { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEnemy)); - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); - } - } - - [Script] // 64542 - Plasma Blast - class spell_mimiron_plasma_blast : SpellScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(Spells.PlasmaBlast); - } - - public override bool Load() - { - return GetCaster().GetVehicleKit() != null; - } - - void HandleScript(uint effIndex) - { - Unit caster = GetCaster().GetVehicleKit().GetPassenger(3); - if (caster) - caster.CastSpell(GetHitUnit(), Spells.PlasmaBlast); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); - } - } - - [Script] // 66351 - Explosion - class spell_mimiron_proximity_explosion : SpellScript - { - public void onHit(uint effIndex) - { - if (GetHitPlayer()) - { - InstanceScript instance = GetCaster().GetInstanceScript(); - if (instance != null) - { - Creature mkII = ObjectAccessor.GetCreature(GetCaster(), instance.GetGuidData(InstanceData.LeviathanMKII)); - if (mkII) - mkII.GetAI().SetData(Data.SetupMine, 0); - } - } - } - - void HandleAura(uint effIndex) - { - GetCaster().RemoveAurasDueToSpell(Spells.ProximityMinePeriodicTrigger); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(onHit, 0, SpellEffectName.SchoolDamage)); - OnEffectHitTarget.Add(new EffectHandler(HandleAura, 1, SpellEffectName.ApplyAura)); - } - } - - [Script] // 63027 - Proximity Mines - class spell_mimiron_proximity_mines : SpellScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(Spells.SummonProximityMine); - } - - void HandleScript(uint effIndex) - { - for (byte i = 0; i < 10; ++i) - GetCaster().CastSpell(GetCaster(), Spells.SummonProximityMine, true); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); - } - } - - [Script] // 65346 - Proximity Mine - class spell_mimiron_proximity_trigger : SpellScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(Spells.ProximityMineExplosion); - } - - void FilterTargets(List targets) - { - targets.Remove(GetExplTargetWorldObject()); - - if (targets.Empty()) - FinishCast(SpellCastResult.NoValidTargets); - } - - void HandleDummy(uint effIndex) - { - GetCaster().CastSpell((Unit)null, Spells.ProximityMineExplosion, true); - } - - public override void Register() - { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEntry)); - OnEffectHit.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); - } - } - - [Script] // 63382 - Rapid Burst - class spell_mimiron_rapid_burst : AuraScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(Spells.RapidBurstLeft, Spells.RapidBurstRight); - } - - void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode) - { - TempSummon summ = GetTarget().ToTempSummon(); - if (summ) - summ.DespawnOrUnsummon(); - } - - void HandleDummyTick(AuraEffect aurEff) - { - if (GetCaster()) - GetCaster().CastSpell(GetTarget(), aurEff.GetTickNumber() % 2 == 0 ? Spells.RapidBurstRight : Spells.RapidBurstLeft, true, null, aurEff); - } - - public override void Register() - { - AfterEffectRemove.Add(new EffectApplyHandler(AfterRemove, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.Real)); - OnEffectPeriodic.Add(new EffectPeriodicHandler(HandleDummyTick, 1, AuraType.PeriodicDummy)); - } - } - - [Script] // 64402 - Rocket Strike, 65034 - Rocket Strike - class spell_mimiron_rocket_strike : SpellScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(Spells.ScriptEffectRocketStrike); - } - - void FilterTargets(List targets) - { - if (targets.Empty()) - return; - - if (m_scriptSpellId == Spells.RocketStrikeSingle && GetCaster().IsVehicle()) - { - WorldObject target = GetCaster().GetVehicleKit().GetPassenger(RandomHelper.RAND(SeatIds.RocketLeft, SeatIds.RocketRight)); - if (target) - { - targets.Clear(); - targets.Add(target); - } - } - } - - void HandleDummy(uint effIndex) - { - GetHitUnit().CastSpell((Unit)null, Spells.ScriptEffectRocketStrike, true, null, null, GetCaster().GetGUID()); - } - - public override void Register() - { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEntry)); - OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); - } - } - - [Script] // 63041 - Rocket Strike - class spell_mimiron_rocket_strike_damage : SpellScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(Spells.NotSoFriendlyFire); - } - - void HandleAfterCast() - { - TempSummon summ = GetCaster().ToTempSummon(); - if (summ) - summ.DespawnOrUnsummon(); - } - - void HandleScript(uint effIndex) - { - if (GetHitPlayer()) - { - InstanceScript instance = GetCaster().GetInstanceScript(); - if (instance != null) - { - Creature mkii = ObjectAccessor.GetCreature(GetCaster(), instance.GetGuidData(InstanceData.LeviathanMKII)); - if (mkii) - mkii.GetAI().SetData(Data.SetupRocket, 0); - } - } - } - - void HandleFriendlyFire(uint effIndex) - { - GetHitUnit().CastSpell((Unit)null, Spells.NotSoFriendlyFire, true); - } - - public override void Register() - { - AfterCast.Add(new CastHandler(HandleAfterCast)); - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.SchoolDamage)); - OnEffectHitTarget.Add(new EffectHandler(HandleFriendlyFire, 1, SpellEffectName.SchoolDamage)); - } - } - - [Script] // 63681 - Rocket Strike - class spell_mimiron_rocket_strike_target_select : SpellScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(Spells.SummonRocketStrike); - } - - void FilterTargets(List targets) - { - if (targets.Empty()) - return; - - WorldObject target = targets.SelectRandom(); - - targets.RemoveAll(new AllWorldObjectsInRange(GetCaster(), 15.0f).Invoke); - - if (!targets.Empty()) - target = targets.SelectRandom(); - - targets.Clear(); - targets.Add(target); - } - - void HandleScript(uint effIndex) - { - InstanceScript instance = GetCaster().GetInstanceScript(); - if (instance != null) - GetCaster().CastSpell(GetHitUnit(), Spells.SummonRocketStrike, true, null, null, instance.GetGuidData(InstanceData.VX001)); - GetCaster().SetDisplayId(11686); - } - - public override void Register() - { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEnemy)); - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); - } - } - - [Script] // 64383 - Self Repair - class spell_mimiron_self_repair : SpellScript - { - void HandleScript() - { - if (GetCaster().GetAI() != null) - GetCaster().GetAI().DoAction(Actions.AssembledCombat); - } - - public override void Register() - { - AfterHit.Add(new HitHandler(HandleScript)); - } - } - - [Script] // 64426 - Summon Scrap Bot - class spell_mimiron_summon_assault_bot : AuraScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(Spells.SummonAssaultBot); - } - - void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Unit caster = GetCaster(); - if (caster) - { - InstanceScript instance = caster.GetInstanceScript(); - if (instance != null) - if (instance.GetBossState(BossIds.Mimiron) == EncounterState.InProgress) - caster.CastSpell(caster, Spells.SummonAssaultBot, false, null, aurEff, instance.GetGuidData(InstanceData.AerialCommandUnit)); - } - } - - public override void Register() - { - OnEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); - } - } - - [Script] // 64425 - Summon Scrap Bot Trigger - class spell_mimiron_summon_assault_bot_target : SpellScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(Spells.SummonAssaultBotDummy); - } - - void HandleDummy(uint effIndex) - { - GetHitUnit().CastSpell(GetHitUnit(), Spells.SummonAssaultBotDummy, true); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); - } - } - - [Script] // 64621 - Summon Fire Bot - class spell_mimiron_summon_fire_bot : AuraScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(Spells.SummonFireBot); - } - - void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Unit caster = GetCaster(); - if (caster) - { - InstanceScript instance = caster.GetInstanceScript(); - if (instance != null) - if (instance.GetBossState(BossIds.Mimiron) == EncounterState.InProgress) - caster.CastSpell(caster, Spells.SummonFireBot, false, null, aurEff, instance.GetGuidData(InstanceData.AerialCommandUnit)); - } - } - - public override void Register() - { - OnEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)) - ; - } - } - - [Script] // 64620 - Summon Fire Bot Trigger - class spell_mimiron_summon_fire_bot_target : SpellScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(Spells.SummonFireBotDummy); - } - - void HandleDummy(uint effIndex) - { - GetHitUnit().CastSpell(GetHitUnit(), Spells.SummonFireBotDummy, true); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); - } - } - - [Script] // 64562 - Summon Flames Spread Trigger - class spell_mimiron_summon_flames_spread : SpellScript - { - void FilterTargets(List targets) - { - if (targets.Empty()) - return; - - // Flames must chase the closest player - WorldObject target = targets.First(); - - foreach (var iter in targets) - if (GetCaster().GetDistance2d(iter) < GetCaster().GetDistance2d(target)) - target = iter; - - targets.Clear(); - targets.Add(target); - } - - public void onHit(uint effIndex) - { - GetCaster().SetInFront(GetHitUnit()); - } - - public override void Register() - { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEnemy)); - OnEffectHitTarget.Add(new EffectHandler(onHit, 0, SpellEffectName.ApplyAura)); - } - } - - class spell_mimiron_summon_flames_spread_AuraScript : AuraScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(Spells.SummonFlamesSpread); - } - - void HandleTick(AuraEffect aurEff) - { - PreventDefaultAction(); - Unit caster = GetCaster(); - if (caster) - if (caster.HasAura(Spells.FlamesPeriodicTrigger)) - caster.CastSpell(GetTarget(), Spells.SummonFlamesSpread, true); - } - - public override void Register() - { - OnEffectPeriodic.Add(new EffectPeriodicHandler(HandleTick, 0, AuraType.PeriodicTriggerSpell)); - } - } - - [Script] // 64623 - Frost Bomb - class spell_mimiron_summon_frost_bomb_target : SpellScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(Spells.SummonFrostBomb); - } - - void FilterTargets(List targets) - { - if (targets.Empty()) - return; - - targets.RemoveAll(new AllWorldObjectsInRange(GetCaster(), 15.0f).Invoke); - - if (targets.Empty()) - return; - - WorldObject target = targets.SelectRandom(); - - targets.Clear(); - targets.Add(target); - } - - void HandleScript(uint effIndex) - { - GetCaster().CastSpell(GetHitUnit(), Spells.SummonFrostBomb, true); - } - - public override void Register() - { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEntry)); - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); - } - } - - [Script] // 64398 - Summon Scrap Bot - class spell_mimiron_summon_junk_bot : AuraScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(Spells.SummonJunkBot); - } - - void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Unit caster = GetCaster(); - if (caster) - { - InstanceScript instance = caster.GetInstanceScript(); - if (instance != null) - if (instance.GetBossState(BossIds.Mimiron) == EncounterState.InProgress) - caster.CastSpell(caster, Spells.SummonJunkBot, false, null, aurEff, instance.GetGuidData(InstanceData.AerialCommandUnit)); - } - } - - public override void Register() - { - OnEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); - } - } - - [Script] // 63820 - Summon Scrap Bot Trigger - class spell_mimiron_summon_junk_bot_target : SpellScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(Spells.SummonJunkBotDummy); - } - - void HandleDummy(uint effIndex) - { - GetHitUnit().CastSpell(GetHitUnit(), Spells.SummonJunkBotDummy, true); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); - } - } - - [Script] // 63339 - Weld - class spell_mimiron_weld : AuraScript - { - void HandleTick(AuraEffect aurEff) - { - Unit caster = GetTarget(); - Unit vehicle = caster.GetVehicleBase(); - if (vehicle) - { - if (aurEff.GetTickNumber() % 5 == 0) - caster.CastSpell(vehicle, MimironConst.RepairSpells[RandomHelper.IRand(0, 3)]); - //caster.SetFacingToObject(vehicle); - } - } - - public override void Register() - { - OnEffectPeriodic.Add(new EffectPeriodicHandler(HandleTick, 0, AuraType.PeriodicTriggerSpell)); - } - } - - [Script] - class achievement_setup_boom : AchievementCriteriaScript - { - public achievement_setup_boom() : base("achievement_setup_boom") { } - - public override bool OnCheck(Player source, Unit target) - { - return target && target.GetAI().GetData(Data.SetupBomb) != 0; - } - } - - [Script] - class achievement_setup_mine : AchievementCriteriaScript - { - public achievement_setup_mine() : base("achievement_setup_mine") { } - - public override bool OnCheck(Player source, Unit target) - { - return target && target.GetAI().GetData(Data.SetupMine) != 0; - } - } - - [Script] - class achievement_setup_rocket : AchievementCriteriaScript - { - public achievement_setup_rocket() : base("achievement_setup_rocket") { } - - public override bool OnCheck(Player source, Unit target) - { - return target && target.GetAI().GetData(Data.SetupRocket) != 0; - } - } - - [Script] - class achievement_firefighter : AchievementCriteriaScript - { - public achievement_firefighter() : base("achievement_firefighter") { } - - public override bool OnCheck(Player source, Unit target) - { - return target && target.GetAI().GetData(Data.Firefighter) != 0; - } - } - } -} diff --git a/Source/Scripts/Northrend/Ulduar/Razorscale.cs b/Source/Scripts/Northrend/Ulduar/Razorscale.cs deleted file mode 100644 index 29f71e591..000000000 --- a/Source/Scripts/Northrend/Ulduar/Razorscale.cs +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -namespace Scripts.Northrend.Ulduar -{ - namespace Razorscale - { - /*class boss_razorscale_controller : BossAI - { - public boss_razorscale_controller(Creature creature) : base(creature, InstanceData.RazorscaleControl) - { - me.SetDisplayId(me.GetCreatureTemplate().ModelId2); - } - - public override void Reset() - { - _Reset(); - me.SetReactState(ReactStates.Passive); - } - - public override void SpellHit(Unit caster, SpellInfo spell) - { - switch (spell.Id) - { - case SPELL_FLAMED: - GameObject Harpoon = ObjectAccessor.GetGameObject(me, instance.GetGuidData(GO_RAZOR_HARPOON_1)); - if (Harpoon) - Harpoon.RemoveFromWorld(); - Harpoon = ObjectAccessor.GetGameObject(me, instance.GetGuidData(GO_RAZOR_HARPOON_2)); - if (Harpoon) - Harpoon.RemoveFromWorld(); - Harpoon = ObjectAccessor.GetGameObject(me, instance.GetGuidData(GO_RAZOR_HARPOON_3)); - if (Harpoon) - Harpoon.RemoveFromWorld(); - Harpoon = ObjectAccessor.GetGameObject(me, instance.GetGuidData(GO_RAZOR_HARPOON_4)); - if (Harpoon) - Harpoon.RemoveFromWorld(); - - DoAction(ACTION_HARPOON_BUILD); - DoAction(ACTION_PLACE_BROKEN_HARPOON); - break; - case SPELL_HARPOON_SHOT_1: - case SPELL_HARPOON_SHOT_2: - case SPELL_HARPOON_SHOT_3: - case SPELL_HARPOON_SHOT_4: - DoCast(SPELL_HARPOON_TRIGGER); - break; - } - } - - public override void JustDied(Unit killer) - { - _JustDied(); - } - - public override void DoAction(int action) - { - if (instance.GetBossState(BOSS_RAZORSCALE) != EncounterState.InProgress) - return; - - switch (action) - { - case ACTION_HARPOON_BUILD: - events.ScheduleEvent(EVENT_BUILD_HARPOON_1, 50000); - if (me.GetMap().GetSpawnMode() == DIFFICULTY_25_N) - events.ScheduleEvent(EVENT_BUILD_HARPOON_3, 90000); - break; - case ACTION_PLACE_BROKEN_HARPOON: - for (uint8 n = 0; n < RAID_MODE(2, 4); n++) - me.SummonGameObject(GO_RAZOR_BROKEN_HARPOON, PosHarpoon[n].GetPositionX(), PosHarpoon[n].GetPositionY(), PosHarpoon[n].GetPositionZ(), 2.286f, 0, 0, 0, 0, 180); - break; - } - } - - public override void UpdateAI(uint Diff) - { - _events.Update(Diff); - - while (uint eventId = _events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_BUILD_HARPOON_1: - Talk(EMOTE_HARPOON); - if (GameObject * Harpoon = me.SummonGameObject(GO_RAZOR_HARPOON_1, PosHarpoon[0].GetPositionX(), PosHarpoon[0].GetPositionY(), PosHarpoon[0].GetPositionZ(), 4.790f, 0.0f, 0.0f, 0.0f, 0.0f, uint32(me.GetRespawnTime()))) - { - if (GameObject * BrokenHarpoon = Harpoon.FindNearestGameObject(GO_RAZOR_BROKEN_HARPOON, 5.0f)) //only nearest broken harpoon - BrokenHarpoon.RemoveFromWorld(); - events.ScheduleEvent(EVENT_BUILD_HARPOON_2, 20000); - events.CancelEvent(EVENT_BUILD_HARPOON_1); - } - return; - case EVENT_BUILD_HARPOON_2: - Talk(EMOTE_HARPOON); - if (GameObject * Harpoon = me.SummonGameObject(GO_RAZOR_HARPOON_2, PosHarpoon[1].GetPositionX(), PosHarpoon[1].GetPositionY(), PosHarpoon[1].GetPositionZ(), 4.659f, 0, 0, 0, 0, uint32(me.GetRespawnTime()))) - { - if (GameObject * BrokenHarpoon = Harpoon.FindNearestGameObject(GO_RAZOR_BROKEN_HARPOON, 5.0f)) - BrokenHarpoon.RemoveFromWorld(); - events.CancelEvent(EVENT_BUILD_HARPOON_2); - } - return; - case EVENT_BUILD_HARPOON_3: - Talk(EMOTE_HARPOON); - if (GameObject * Harpoon = me.SummonGameObject(GO_RAZOR_HARPOON_3, PosHarpoon[2].GetPositionX(), PosHarpoon[2].GetPositionY(), PosHarpoon[2].GetPositionZ(), 5.382f, 0, 0, 0, 0, uint32(me.GetRespawnTime()))) - { - if (GameObject * BrokenHarpoon = Harpoon.FindNearestGameObject(GO_RAZOR_BROKEN_HARPOON, 5.0f)) - BrokenHarpoon.RemoveFromWorld(); - events.ScheduleEvent(EVENT_BUILD_HARPOON_4, 20000); - events.CancelEvent(EVENT_BUILD_HARPOON_3); - } - return; - case EVENT_BUILD_HARPOON_4: - Talk(EMOTE_HARPOON); - if (GameObject * Harpoon = me.SummonGameObject(GO_RAZOR_HARPOON_4, PosHarpoon[3].GetPositionX(), PosHarpoon[3].GetPositionY(), PosHarpoon[3].GetPositionZ(), 4.266f, 0, 0, 0, 0, uint32(me.GetRespawnTime()))) - { - if (GameObject * BrokenHarpoon = Harpoon.FindNearestGameObject(GO_RAZOR_BROKEN_HARPOON, 5.0f)) - BrokenHarpoon.RemoveFromWorld(); - events.CancelEvent(EVENT_BUILD_HARPOON_4); - } - return; - } - } - } - } - - public override CreatureAI Get(Creature creature) - { - return GetInstanceAI(creature); - } - }*/ - - } -} diff --git a/Source/Scripts/Northrend/Ulduar/UlduarConst.cs b/Source/Scripts/Northrend/Ulduar/UlduarConst.cs deleted file mode 100644 index 8bc9e01f2..000000000 --- a/Source/Scripts/Northrend/Ulduar/UlduarConst.cs +++ /dev/null @@ -1,415 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -namespace Scripts.Northrend.Ulduar -{ - struct BossIds - { - public const uint MaxEncounter = 17; - - public const uint Leviathan = 0; - public const uint Ignis = 1; - public const uint Razorscale = 2; - public const uint Xt002 = 3; - public const uint AssemblyOfIron = 4; - public const uint Kologarn = 5; - public const uint Auriaya = 6; - public const uint Mimiron = 7; - public const uint Hodir = 8; - public const uint Thorim = 9; - public const uint Freya = 10; - public const uint Brightleaf = 11; - public const uint Ironbranch = 12; - public const uint Stonebark = 13; - public const uint Vezax = 14; - public const uint YoggSaron = 15; - public const uint Algalon = 16; - } - - struct InstanceCreatureIds - { - // General - public const uint Leviathan = 33113; - public const uint SalvagedDemolisher = 33109; - public const uint SalvagedSiegeEngine = 33060; - public const uint SalvagedChopper = 33062; - public const uint Ignis = 33118; - public const uint Razorscale = 33186; - public const uint RazorscaleController = 33233; - public const uint SteelforgedDeffender = 33236; - public const uint ExpeditionCommander = 33210; - public const uint Xt002 = 33293; - public const uint XtToyPile = 33337; - public const uint Steelbreaker = 32867; - public const uint Molgeim = 32927; - public const uint Brundir = 32857; - public const uint Kologarn = 32930; - public const uint FocusedEyebeam = 33632; - public const uint FocusedEyebeamRight = 33802; - public const uint LeftArm = 32933; - public const uint RightArm = 32934; - public const uint Rubble = 33768; - public const uint Auriaya = 33515; - public const uint Mimiron = 33350; - public const uint Hodir = 32845; - public const uint Thorim = 32865; - public const uint Freya = 32906; - public const uint Vezax = 33271; - public const uint YoggSaron = 33288; - public const uint Algalon = 32871; - - //XT002 - public const uint XS013Scrapbot = 33343; - - // Mimiron - public const uint LeviathanMkII = 33432; - public const uint Vx001 = 33651; - public const uint AerialCommandUnit = 33670; - public const uint AssaultBot = 34057; - public const uint BombBot = 33836; - public const uint JunkBot = 33855; - public const uint EmergencyFireBot = 34147; - public const uint FrostBomb = 34149; - public const uint BurstTarget = 34211; - public const uint Flame = 34363; - public const uint FlameSpread = 34121; - public const uint DBTarget = 33576; - public const uint RocketMimironVisual = 34050; - public const uint WorldTriggerMimiron = 21252; - public const uint Computer = 34143; - - // Freya'S Keepers - public const uint Ironbranch = 32913; - public const uint Brightleaf = 32915; - public const uint Stonebark = 32914; - - // Hodir'S Helper Npcs - public const uint TorGreycloud = 32941; - public const uint KarGreycloud = 33333; - public const uint EiviNightfeather = 33325; - public const uint EllieNightfeather = 32901; - public const uint SpiritwalkerTara = 33332; - public const uint SpiritwalkerYona = 32950; - public const uint ElementalistMahfuun = 33328; - public const uint ElementalistAvuun = 32900; - public const uint AmiraBlazeweaver = 33331; - public const uint VeeshaBlazeweaver = 32946; - public const uint MissyFlamecuffs = 32893; - public const uint SissyFlamecuffs = 33327; - public const uint BattlePriestEliza = 32948; - public const uint BattlePriestGina = 33330; - public const uint FieldMedicPenny = 32897; - public const uint FieldMedicJessi = 33326; - - // Freya'S Trash Npcs - public const uint CorruptedServitor = 33354; - public const uint MisguidedNymph = 33355; - public const uint GuardianLasher = 33430; - public const uint ForestSwarmer = 33431; - public const uint MangroveEnt = 33525; - public const uint IronrootLasher = 33526; - public const uint NaturesBlade = 33527; - public const uint GuardianOfLife = 33528; - - // Freya Achievement Trigger - public const uint FreyaAchieveTrigger = 33406; - - // Yogg-Saron - public const uint Sara = 33134; - public const uint GuardianOfYoggSaron = 33136; - public const uint HodirObservationRing = 33213; - public const uint FreyaObservationRing = 33241; - public const uint ThorimObservationRing = 33242; - public const uint MimironObservationRing = 33244; - public const uint VoiceOfYoggSaron = 33280; - public const uint OminousCloud = 33292; - public const uint FreyaYs = 33410; - public const uint HodirYs = 33411; - public const uint MimironYs = 33412; - public const uint ThorimYs = 33413; - public const uint SuitOfArmor = 33433; - public const uint KingLlane = 33437; - public const uint TheLichKing = 33441; - public const uint ImmolatedChampion = 33442; - public const uint Ysera = 33495; - public const uint Neltharion = 33523; - public const uint Malygos = 33535; - public const uint DeathRay = 33881; - public const uint DeathOrb = 33882; - public const uint BrainOfYoggSaron = 33890; - public const uint InfluenceTentacle = 33943; - public const uint TurnedChampion = 33962; - public const uint CrusherTentacle = 33966; - public const uint ConstrictorTentacle = 33983; - public const uint CorruptorTentacle = 33985; - public const uint ImmortalGuardian = 33988; - public const uint SanityWell = 33991; - public const uint DescendIntoMadness = 34072; - public const uint MarkedImmortalGuardian = 36064; - - // Algalon The Observer - public const uint BrannBronzbeardAlg = 34064; - public const uint Azeroth = 34246; - public const uint LivingConstellation = 33052; - public const uint AlgalonStalker = 33086; - public const uint CollapsingStar = 32955; - public const uint BlackHole = 32953; - public const uint WormHole = 34099; - public const uint AlgalonVoidZoneVisualStalker = 34100; - public const uint AlgalonStalkerAsteroidTarget01 = 33104; - public const uint AlgalonStalkerAsteroidTarget02 = 33105; - public const uint UnleashedDarkMatter = 34097; - } - - struct InstanceGameObjectIds - { - // Leviathan - public const uint LeviathanDoor = 194905; - public const uint LeviathanGate = 194630; - - // Razorscale - public const uint MoleMachine = 194316; - public const uint RazorHarpoon1 = 194542; - public const uint RazorHarpoon2 = 194541; - public const uint RazorHarpoon3 = 194543; - public const uint RazorHarpoon4 = 194519; - public const uint RazorBrokenHarpoon = 194565; - - // Xt-002 - public const uint Xt002Door = 194631; - - // Assembly Of Iron - public const uint IronCouncilDoor = 194554; - public const uint ArchivumDoor = 194556; - - // Kologarn - public const uint KologarnChestHero = 195047; - public const uint KologarnChest = 195046; - public const uint KologarnBridge = 194232; - public const uint KologarnDoor = 194553; - - // Hodir - public const uint HodirEntrance = 194442; - public const uint HodirDoor = 194634; - public const uint HodirIceDoor = 194441; - public const uint HodirRareCacheOfWinter = 194200; - public const uint HodirRareCacheOfWinterHero = 194201; - public const uint HodirChestHero = 194308; - public const uint HodirChest = 194307; - - // Thorim - public const uint ThorimChestHero = 194315; - public const uint ThorimChest = 194314; - - // Mimiron - public const uint MimironTram = 194675; - public const uint MimironElevator = 194749; - public const uint MimironButton = 194739; - public const uint MimironDoor1 = 194774; - public const uint MimironDoor2 = 194775; - public const uint MimironDoor3 = 194776; - public const uint CacheOfInnovation = 194789; - public const uint CacheOfInnovationFirefighter = 194957; - public const uint CacheOfInnovationHero = 194956; - public const uint CacheOfInnovationFirefighterHero = 194958; - - // Vezax - public const uint VezaxDoor = 194750; - - // Yogg-Saron - public const uint YoggSaronDoor = 194773; - public const uint BrainRoomDoor1 = 194635; - public const uint BrainRoomDoor2 = 194636; - public const uint BrainRoomDoor3 = 194637; - - // Algalon The Observer - public const uint CelestialPlanetariumAccess10 = 194628; - public const uint CelestialPlanetariumAccess25 = 194752; - public const uint DoodadUlSigildoor01 = 194767; - public const uint DoodadUlSigildoor02 = 194911; - public const uint DoodadUlSigildoor03 = 194910; - public const uint DoodadUlUniversefloor01 = 194715; - public const uint DoodadUlUniversefloor02 = 194716; - public const uint DoodadUlUniverseglobe01 = 194148; - public const uint DoodadUlUlduarTrapdoor03 = 194253; - public const uint GiftOfTheObserver10 = 194821; - public const uint GiftOfTheObserver25 = 194822; - } - - struct InstanceEventIds - { - public const int TowerOfStormDestroyed = 21031; - public const int TowerOfFrostDestroyed = 21032; - public const int TowerOfFlamesDestroyed = 21033; - public const int TowerOfLifeDestroyed = 21030; - public const int ActivateSanityWell = 21432; - public const int HodirsProtectiveGazeProc = 21437; - } - - struct LeviathanActions - { - public const int TowerOfStormDestroyed = 1; - public const int TowerOfFrostDestroyed = 2; - public const int TowerOfFlamesDestroyed = 3; - public const int TowerOfLifeDestroyed = 4; - public const int MoveToCenterPosition = 10; - } - - struct InstanceCriteriaIds - { - public const uint ConSpeedAtory = 21597; - public const uint Lumberjacked = 21686; - public const uint Disarmed = 21687; - public const uint WaitsDreamingStormwind25 = 10321; - public const uint WaitsDreamingChamber25 = 10322; - public const uint WaitsDreamingIcecrown25 = 10323; - public const uint WaitsDreamingStormwind10 = 10324; - public const uint WaitsDreamingChamber10 = 10325; - public const uint WaitsDreamingIcecrown10 = 10326; - public const uint DriveMeCrazy10 = 10185; - public const uint DriveMeCrazy25 = 10296; - public const uint ThreeLightsInTheDarkness10 = 10410; - public const uint ThreeLightsInTheDarkness25 = 10414; - public const uint TwoLightsInTheDarkness10 = 10388; - public const uint TwoLightsInTheDarkness25 = 10415; - public const uint OneLightInTheDarkness10 = 10409; - public const uint OneLightInTheDarkness25 = 10416; - public const uint AloneInTheDarkness10 = 10412; - public const uint AloneInTheDarkness25 = 10417; - public const uint HeraldOfTitans = 10678; - - // Champion Of Ulduar - public const uint ChampionLeviathan10 = 10042; - public const uint ChampionIgnis10 = 10342; - public const uint ChampionRazorscale10 = 10340; - public const uint ChampionXt002_10 = 10341; - public const uint ChampionIronCouncil10 = 10598; - public const uint ChampionKologarn10 = 10348; - public const uint ChampionAuriaya10 = 10351; - public const uint ChampionHodir10 = 10439; - public const uint ChampionThorim10 = 10403; - public const uint ChampionFreya10 = 10582; - public const uint ChampionMimiron10 = 10347; - public const uint ChampionVezax10 = 10349; - public const uint ChampionYoggSaron10 = 10350; - // Conqueror Of Ulduar - public const uint ChampionLeviathan25 = 10352; - public const uint ChampionIgnis25 = 10355; - public const uint ChampionRazorscale25 = 10353; - public const uint ChampionXt002_25 = 10354; - public const uint ChampionIronCouncil25 = 10599; - public const uint ChampionKologarn25 = 10357; - public const uint ChampionAuriaya25 = 10363; - public const uint ChampionHodir25 = 10719; - public const uint ChampionThorim25 = 10404; - public const uint ChampionFreya25 = 10583; - public const uint ChampionMimiron25 = 10361; - public const uint ChampionVezax25 = 10362; - public const uint ChampionYoggSaron25 = 10364; - } - - struct InstanceData - { - // Colossus (Leviathan) - public const uint Colossus = 20; - - // Razorscale - public const uint ExpeditionCommander = 21; - public const uint RazorscaleControl = 22; - - // Xt-002 - public const uint ToyPile0 = 23; - public const uint ToyPile1 = 24; - public const uint ToyPile2 = 25; - public const uint ToyPile3 = 26; - - // Assembly Of Iron - public const uint Steelbreaker = 27; - public const uint Molgeim = 28; - public const uint Brundir = 29; - - // Hodir - public const uint HodirRareCache = 30; - - // Mimiron - public const uint LeviathanMKII = 31; - public const uint VX001 = 32; - public const uint AerialCommandUnit = 33; - public const uint Computer = 34; - public const uint MimironWorldTrigger = 35; - public const uint MimironElevator = 36; - public const uint MimironTram = 37; - public const uint MimironButton = 38; - - // Yogg-Saron - public const uint VoiceOfYoggSaron = 39; - public const uint Sara = 40; - public const uint BrainOfYoggSaron = 41; - public const uint FreyaYs = 42; - public const uint HodirYs = 43; - public const uint ThorimYs = 44; - public const uint MimironYs = 45; - public const uint Illusion = 46; - public const uint DriveMeCrazy = 47; - public const uint KeepersCount = 48; - - // Algalon The Observer - public const uint AlgalonSummonState = 49; - public const uint Sigildoor01 = 50; - public const uint Sigildoor02 = 51; - public const uint Sigildoor03 = 52; - public const uint UniverseFloor01 = 53; - public const uint UniverseFloor02 = 54; - public const uint UniverseGlobe = 55; - public const uint AlgalonTrapdoor = 56; - public const uint BrannBronzebeardAlg = 57; - - // Misc - public const uint BrannBronzebeardIntro = 58; - public const uint LoreKeeperOfNorgannon = 59; - public const uint Dellorah = 60; - public const uint BronzebeardRadio = 61; - } - - struct InstanceWorldStates - { - public const uint AlgalonDespawnTimer = 4131; - public const uint AlgalonTimerEnabled = 4132; - } - - struct InstanceAchievementData - { - // Fl Achievement Boolean - public const uint DataUnbroken = 29052906; // 2905, 2906 Are Achievement Ids, - public const uint MaxHeraldArmorItemlevel = 226; - public const uint MaxHeraldWeaponItemlevel = 232; - } - - struct InstanceEvents - { - public const uint EventDespawnAlgalon = 1; - public const uint EventUpdateAlgalonTimer = 2; - public const uint ActionInitAlgalon = 6; - } - - struct YoggSaronIllusions - { - public const uint ChamberIllusion = 0; - public const uint IcecrownIllusion = 1; - public const uint StormwindIllusion = 2; - } -} diff --git a/Source/Scripts/Northrend/Ulduar/UlduarInstance.cs b/Source/Scripts/Northrend/Ulduar/UlduarInstance.cs deleted file mode 100644 index 054d9a13c..000000000 --- a/Source/Scripts/Northrend/Ulduar/UlduarInstance.cs +++ /dev/null @@ -1,1235 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Framework.IO; -using Game.Entities; -using Game.Maps; -using Game.Networking.Packets; -using Game.Scripting; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Scripts.Northrend.Ulduar -{ - [Script] - class instance_ulduar : InstanceMapScript - { - public instance_ulduar() : base("instance_ulduar", 603) { } - - class instance_ulduar_InstanceMapScript : InstanceScript - { - public instance_ulduar_InstanceMapScript(InstanceMap map) : base(map) - { - SetHeaders("UU"); - SetBossNumber(BossIds.MaxEncounter); - - LoadDoorData(doorData); - LoadMinionData(minionData); - - _algalonTimer = 61; - - Unbroken = true; - IsDriveMeCrazyEligible = true; - } - - public override void FillInitialWorldStates(InitWorldStates packet) - { - packet.AddState(InstanceWorldStates.AlgalonTimerEnabled, (_algalonTimer != 0 && _algalonTimer <= 60 ? 1 : 0)); - packet.AddState(InstanceWorldStates.AlgalonDespawnTimer, (int)Math.Min(_algalonTimer, 60)); - } - - public override void OnPlayerEnter(Player player) - { - if (TeamInInstance == 0) - TeamInInstance = player.GetTeam(); - - if (_summonAlgalon) - { - _summonAlgalon = false; - TempSummon algalon = instance.SummonCreature(InstanceCreatureIds.Algalon, Algalon.AlgalonTheObserver.AlgalonLandPos); - if (_algalonTimer != 0 && _algalonTimer <= 60) - algalon.GetAI().DoAction((int)InstanceEvents.ActionInitAlgalon); - else - algalon.RemoveUnitFlag(UnitFlags.ImmuneToPc); - } - - // Keepers at Observation Ring - if (GetBossState(BossIds.Freya) == EncounterState.Done && _summonObservationRingKeeper[0] && KeeperGUIDs[0].IsEmpty()) - { - _summonObservationRingKeeper[0] = false; - instance.SummonCreature(InstanceCreatureIds.FreyaObservationRing, YoggSaron.ObservationRingKeepersPos[0]); - } - if (GetBossState(BossIds.Hodir) == EncounterState.Done && _summonObservationRingKeeper[1] && KeeperGUIDs[1].IsEmpty()) - { - _summonObservationRingKeeper[1] = false; - instance.SummonCreature(InstanceCreatureIds.HodirObservationRing, YoggSaron.ObservationRingKeepersPos[1]); - } - if (GetBossState(BossIds.Thorim) == EncounterState.Done && _summonObservationRingKeeper[2] && KeeperGUIDs[2].IsEmpty()) - { - _summonObservationRingKeeper[2] = false; - instance.SummonCreature(InstanceCreatureIds.ThorimObservationRing, YoggSaron.ObservationRingKeepersPos[2]); - } - if (GetBossState(BossIds.Mimiron) == EncounterState.Done && _summonObservationRingKeeper[3] && KeeperGUIDs[3].IsEmpty()) - { - _summonObservationRingKeeper[3] = false; - instance.SummonCreature(InstanceCreatureIds.MimironObservationRing, YoggSaron.ObservationRingKeepersPos[3]); - } - - // Keepers in Yogg-Saron's room - if (_summonYSKeeper[0]) - instance.SummonCreature(InstanceCreatureIds.FreyaYs, YoggSaron.YSKeepersPos[0]); - if (_summonYSKeeper[1]) - instance.SummonCreature(InstanceCreatureIds.HodirYs, YoggSaron.YSKeepersPos[1]); - if (_summonYSKeeper[2]) - instance.SummonCreature(InstanceCreatureIds.ThorimYs, YoggSaron.YSKeepersPos[2]); - if (_summonYSKeeper[3]) - instance.SummonCreature(InstanceCreatureIds.MimironYs, YoggSaron.YSKeepersPos[3]); - } - - public override void OnCreatureCreate(Creature creature) - { - if (TeamInInstance == 0) - { - var Players = instance.GetPlayers(); - if (!Players.Empty()) - { - Player player = Players.First(); - if (player) - TeamInInstance = player.GetTeam(); - } - } - - switch (creature.GetEntry()) - { - case InstanceCreatureIds.Leviathan: - LeviathanGUID = creature.GetGUID(); - break; - case InstanceCreatureIds.SalvagedDemolisher: - case InstanceCreatureIds.SalvagedSiegeEngine: - case InstanceCreatureIds.SalvagedChopper: - LeviathanVehicleGUIDs.Add(creature.GetGUID()); - break; - case InstanceCreatureIds.Ignis: - IgnisGUID = creature.GetGUID(); - break; - - // Razorscale - case InstanceCreatureIds.Razorscale: - RazorscaleGUID = creature.GetGUID(); - break; - case InstanceCreatureIds.RazorscaleController: - RazorscaleController = creature.GetGUID(); - break; - case InstanceCreatureIds.ExpeditionCommander: - ExpeditionCommanderGUID = creature.GetGUID(); - break; - - // XT-002 Deconstructor - case InstanceCreatureIds.Xt002: - XT002GUID = creature.GetGUID(); - break; - case InstanceCreatureIds.XtToyPile: - for (byte i = 0; i < 4; ++i) - { - if (XTToyPileGUIDs[i].IsEmpty()) - { - XTToyPileGUIDs[i] = creature.GetGUID(); - break; - } - } - break; - - // Assembly of Iron - case InstanceCreatureIds.Steelbreaker: - AssemblyGUIDs[0] = creature.GetGUID(); - AddMinion(creature, true); - break; - case InstanceCreatureIds.Molgeim: - AssemblyGUIDs[1] = creature.GetGUID(); - AddMinion(creature, true); - break; - case InstanceCreatureIds.Brundir: - AssemblyGUIDs[2] = creature.GetGUID(); - AddMinion(creature, true); - break; - - case InstanceCreatureIds.Kologarn: - KologarnGUID = creature.GetGUID(); - break; - case InstanceCreatureIds.Auriaya: - AuriayaGUID = creature.GetGUID(); - break; - - // Hodir - case InstanceCreatureIds.Hodir: - HodirGUID = creature.GetGUID(); - break; - case InstanceCreatureIds.EiviNightfeather: - if (TeamInInstance == Team.Horde) - creature.UpdateEntry(InstanceCreatureIds.TorGreycloud); - break; - case InstanceCreatureIds.EllieNightfeather: - if (TeamInInstance == Team.Horde) - creature.UpdateEntry(InstanceCreatureIds.KarGreycloud); - break; - case InstanceCreatureIds.ElementalistMahfuun: - if (TeamInInstance == Team.Horde) - creature.UpdateEntry(InstanceCreatureIds.SpiritwalkerTara); - break; - case InstanceCreatureIds.ElementalistAvuun: - if (TeamInInstance == Team.Horde) - creature.UpdateEntry(InstanceCreatureIds.SpiritwalkerYona); - break; - case InstanceCreatureIds.MissyFlamecuffs: - if (TeamInInstance == Team.Horde) - creature.UpdateEntry(InstanceCreatureIds.AmiraBlazeweaver); - break; - case InstanceCreatureIds.SissyFlamecuffs: - if (TeamInInstance == Team.Horde) - creature.UpdateEntry(InstanceCreatureIds.VeeshaBlazeweaver); - break; - case InstanceCreatureIds.FieldMedicPenny: - if (TeamInInstance == Team.Horde) - creature.UpdateEntry(InstanceCreatureIds.BattlePriestEliza); - break; - case InstanceCreatureIds.FieldMedicJessi: - if (TeamInInstance == Team.Horde) - creature.UpdateEntry(InstanceCreatureIds.BattlePriestGina); - break; - - case InstanceCreatureIds.Thorim: - ThorimGUID = creature.GetGUID(); - break; - - // Freya - case InstanceCreatureIds.Freya: - FreyaGUID = creature.GetGUID(); - break; - case InstanceCreatureIds.Ironbranch: - ElderGUIDs[0] = creature.GetGUID(); - if (GetBossState(BossIds.Freya) == EncounterState.Done) - creature.DespawnOrUnsummon(); - break; - case InstanceCreatureIds.Brightleaf: - ElderGUIDs[1] = creature.GetGUID(); - if (GetBossState(BossIds.Freya) == EncounterState.Done) - creature.DespawnOrUnsummon(); - break; - case InstanceCreatureIds.Stonebark: - ElderGUIDs[2] = creature.GetGUID(); - if (GetBossState(BossIds.Freya) == EncounterState.Done) - creature.DespawnOrUnsummon(); - break; - case InstanceCreatureIds.FreyaAchieveTrigger: - FreyaAchieveTriggerGUID = creature.GetGUID(); - break; - - // Mimiron - case InstanceCreatureIds.Mimiron: - MimironGUID = creature.GetGUID(); - break; - case InstanceCreatureIds.LeviathanMkII: - MimironVehicleGUIDs[0] = creature.GetGUID(); - break; - case InstanceCreatureIds.Vx001: - MimironVehicleGUIDs[1] = creature.GetGUID(); - break; - case InstanceCreatureIds.AerialCommandUnit: - MimironVehicleGUIDs[2] = creature.GetGUID(); - break; - case InstanceCreatureIds.Computer: - MimironComputerGUID = creature.GetGUID(); - break; - case InstanceCreatureIds.WorldTriggerMimiron: - MimironWorldTriggerGUID = creature.GetGUID(); - break; - - case InstanceCreatureIds.Vezax: - VezaxGUID = creature.GetGUID(); - break; - - // Yogg-Saron - case InstanceCreatureIds.YoggSaron: - YoggSaronGUID = creature.GetGUID(); - break; - case InstanceCreatureIds.VoiceOfYoggSaron: - VoiceOfYoggSaronGUID = creature.GetGUID(); - break; - case InstanceCreatureIds.BrainOfYoggSaron: - BrainOfYoggSaronGUID = creature.GetGUID(); - break; - case InstanceCreatureIds.Sara: - SaraGUID = creature.GetGUID(); - break; - case InstanceCreatureIds.FreyaYs: - KeeperGUIDs[0] = creature.GetGUID(); - _summonYSKeeper[0] = false; - SaveToDB(); - ++keepersCount; - break; - case InstanceCreatureIds.HodirYs: - KeeperGUIDs[1] = creature.GetGUID(); - _summonYSKeeper[1] = false; - SaveToDB(); - ++keepersCount; - break; - case InstanceCreatureIds.ThorimYs: - KeeperGUIDs[2] = creature.GetGUID(); - _summonYSKeeper[2] = false; - SaveToDB(); - ++keepersCount; - break; - case InstanceCreatureIds.MimironYs: - KeeperGUIDs[3] = creature.GetGUID(); - _summonYSKeeper[3] = false; - SaveToDB(); - ++keepersCount; - break; - case InstanceCreatureIds.SanityWell: - creature.SetReactState(ReactStates.Passive); - break; - - // Algalon - case InstanceCreatureIds.Algalon: - AlgalonGUID = creature.GetGUID(); - break; - case InstanceCreatureIds.BrannBronzbeardAlg: - BrannBronzebeardAlgGUID = creature.GetGUID(); - break; - //! These creatures are summoned by something else than Algalon - //! but need to be controlled/despawned by him - so they need to be - //! registered in his summon list - case InstanceCreatureIds.AlgalonVoidZoneVisualStalker: - case InstanceCreatureIds.AlgalonStalkerAsteroidTarget01: - case InstanceCreatureIds.AlgalonStalkerAsteroidTarget02: - case InstanceCreatureIds.UnleashedDarkMatter: - Creature algalon = instance.GetCreature(AlgalonGUID); - if (algalon) - algalon.GetAI().JustSummoned(creature); - break; - } - } - - public override void OnCreatureRemove(Creature creature) - { - switch (creature.GetEntry()) - { - case InstanceCreatureIds.XtToyPile: - for (byte i = 0; i < 4; ++i) - if (XTToyPileGUIDs[i] == creature.GetGUID()) - { - XTToyPileGUIDs[i].Clear(); - break; - } - break; - case InstanceCreatureIds.Steelbreaker: - case InstanceCreatureIds.Molgeim: - case InstanceCreatureIds.Brundir: - AddMinion(creature, false); - break; - case InstanceCreatureIds.BrannBronzbeardAlg: - if (BrannBronzebeardAlgGUID == creature.GetGUID()) - BrannBronzebeardAlgGUID.Clear(); - break; - default: - break; - } - } - - public override void OnGameObjectCreate(GameObject gameObject) - { - switch (gameObject.GetEntry()) - { - case InstanceGameObjectIds.KologarnChestHero: - case InstanceGameObjectIds.KologarnChest: - KologarnChestGUID = gameObject.GetGUID(); - break; - case InstanceGameObjectIds.KologarnBridge: - KologarnBridgeGUID = gameObject.GetGUID(); - if (GetBossState(BossIds.Kologarn) == EncounterState.Done) - HandleGameObject(ObjectGuid.Empty, false, gameObject); - break; - case InstanceGameObjectIds.ThorimChestHero: - case InstanceGameObjectIds.ThorimChest: - ThorimChestGUID = gameObject.GetGUID(); - break; - case InstanceGameObjectIds.HodirRareCacheOfWinterHero: - case InstanceGameObjectIds.HodirRareCacheOfWinter: - HodirRareCacheGUID = gameObject.GetGUID(); - break; - case InstanceGameObjectIds.HodirChestHero: - case InstanceGameObjectIds.HodirChest: - HodirChestGUID = gameObject.GetGUID(); - break; - case InstanceGameObjectIds.MimironTram: - MimironTramGUID = gameObject.GetGUID(); - break; - case InstanceGameObjectIds.MimironElevator: - MimironElevatorGUID = gameObject.GetGUID(); - break; - case InstanceGameObjectIds.MimironButton: - MimironButtonGUID = gameObject.GetGUID(); - break; - case InstanceGameObjectIds.LeviathanGate: - LeviathanGateGUID = gameObject.GetGUID(); - if (GetBossState(BossIds.Leviathan) == EncounterState.Done) - gameObject.SetGoState(GameObjectState.ActiveAlternative); - break; - case InstanceGameObjectIds.LeviathanDoor: - case InstanceGameObjectIds.Xt002Door: - case InstanceGameObjectIds.IronCouncilDoor: - case InstanceGameObjectIds.ArchivumDoor: - case InstanceGameObjectIds.HodirEntrance: - case InstanceGameObjectIds.HodirDoor: - case InstanceGameObjectIds.HodirIceDoor: - case InstanceGameObjectIds.MimironDoor1: - case InstanceGameObjectIds.MimironDoor2: - case InstanceGameObjectIds.MimironDoor3: - case InstanceGameObjectIds.VezaxDoor: - case InstanceGameObjectIds.YoggSaronDoor: - AddDoor(gameObject, true); - break; - case InstanceGameObjectIds.RazorHarpoon1: - RazorHarpoonGUIDs[0] = gameObject.GetGUID(); - break; - case InstanceGameObjectIds.RazorHarpoon2: - RazorHarpoonGUIDs[1] = gameObject.GetGUID(); - break; - case InstanceGameObjectIds.RazorHarpoon3: - RazorHarpoonGUIDs[2] = gameObject.GetGUID(); - break; - case InstanceGameObjectIds.RazorHarpoon4: - RazorHarpoonGUIDs[3] = gameObject.GetGUID(); - break; - case InstanceGameObjectIds.MoleMachine: - if (GetBossState(BossIds.Razorscale) == EncounterState.InProgress) - gameObject.SetGoState(GameObjectState.Active); - break; - case InstanceGameObjectIds.BrainRoomDoor1: - BrainRoomDoorGUIDs[0] = gameObject.GetGUID(); - break; - case InstanceGameObjectIds.BrainRoomDoor2: - BrainRoomDoorGUIDs[1] = gameObject.GetGUID(); - break; - case InstanceGameObjectIds.BrainRoomDoor3: - BrainRoomDoorGUIDs[2] = gameObject.GetGUID(); - break; - case InstanceGameObjectIds.CelestialPlanetariumAccess10: - case InstanceGameObjectIds.CelestialPlanetariumAccess25: - if (_algalonSummoned) - gameObject.AddFlag(GameObjectFlags.InUse); - break; - case InstanceGameObjectIds.DoodadUlSigildoor01: - AlgalonSigilDoorGUID[0] = gameObject.GetGUID(); - if (_algalonSummoned) - gameObject.SetGoState(GameObjectState.Active); - break; - case InstanceGameObjectIds.DoodadUlSigildoor02: - AlgalonSigilDoorGUID[1] = gameObject.GetGUID(); - if (_algalonSummoned) - gameObject.SetGoState(GameObjectState.Active); - break; - case InstanceGameObjectIds.DoodadUlSigildoor03: - AlgalonSigilDoorGUID[2] = gameObject.GetGUID(); - AddDoor(gameObject, true); - break; - case InstanceGameObjectIds.DoodadUlUniversefloor01: - AlgalonFloorGUID[0] = gameObject.GetGUID(); - AddDoor(gameObject, true); - break; - case InstanceGameObjectIds.DoodadUlUniversefloor02: - AlgalonFloorGUID[1] = gameObject.GetGUID(); - AddDoor(gameObject, true); - break; - case InstanceGameObjectIds.DoodadUlUniverseglobe01: - AlgalonUniverseGUID = gameObject.GetGUID(); - AddDoor(gameObject, true); - break; - case InstanceGameObjectIds.DoodadUlUlduarTrapdoor03: - AlgalonTrapdoorGUID = gameObject.GetGUID(); - AddDoor(gameObject, true); - break; - case InstanceGameObjectIds.GiftOfTheObserver10: - case InstanceGameObjectIds.GiftOfTheObserver25: - GiftOfTheObserverGUID = gameObject.GetGUID(); - break; - default: - break; - } - } - - public override void OnGameObjectRemove(GameObject gameObject) - { - switch (gameObject.GetEntry()) - { - case InstanceGameObjectIds.LeviathanDoor: - case InstanceGameObjectIds.Xt002Door: - case InstanceGameObjectIds.IronCouncilDoor: - case InstanceGameObjectIds.ArchivumDoor: - case InstanceGameObjectIds.HodirEntrance: - case InstanceGameObjectIds.HodirDoor: - case InstanceGameObjectIds.HodirIceDoor: - case InstanceGameObjectIds.MimironDoor1: - case InstanceGameObjectIds.MimironDoor2: - case InstanceGameObjectIds.MimironDoor3: - case InstanceGameObjectIds.VezaxDoor: - case InstanceGameObjectIds.YoggSaronDoor: - case InstanceGameObjectIds.DoodadUlSigildoor01: - case InstanceGameObjectIds.DoodadUlUniversefloor01: - case InstanceGameObjectIds.DoodadUlUniversefloor02: - case InstanceGameObjectIds.DoodadUlUniverseglobe01: - case InstanceGameObjectIds.DoodadUlUlduarTrapdoor03: - AddDoor(gameObject, false); - break; - default: - break; - } - } - - public override void OnUnitDeath(Unit unit) - { - // Champion/Conqueror of Ulduar - if (unit.IsTypeId(TypeId.Player)) - { - for (byte i = 0; i < BossIds.Algalon; i++) - { - if (GetBossState(i) == EncounterState.InProgress) - { - _CoUAchivePlayerDeathMask |= (1u << i); - SaveToDB(); - } - } - } - - Creature creature = unit.ToCreature(); - if (!creature) - return; - - switch (creature.GetEntry()) - { - case InstanceCreatureIds.CorruptedServitor: - case InstanceCreatureIds.MisguidedNymph: - case InstanceCreatureIds.GuardianLasher: - case InstanceCreatureIds.ForestSwarmer: - case InstanceCreatureIds.MangroveEnt: - case InstanceCreatureIds.IronrootLasher: - case InstanceCreatureIds.NaturesBlade: - case InstanceCreatureIds.GuardianOfLife: - if (!conSpeedAtory) - { - DoStartCriteriaTimer(CriteriaTimedTypes.Event, InstanceCriteriaIds.ConSpeedAtory); - conSpeedAtory = true; - } - break; - case InstanceCreatureIds.Ironbranch: - case InstanceCreatureIds.Stonebark: - case InstanceCreatureIds.Brightleaf: - if (!lumberjacked) - { - DoStartCriteriaTimer(CriteriaTimedTypes.Event, InstanceCriteriaIds.Lumberjacked); - lumberjacked = true; - } - break; - default: - break; - } - } - - public override void ProcessEvent(WorldObject gameObject, uint eventId) - { - // Flame Leviathan's Tower Event triggers - Creature FlameLeviathan = instance.GetCreature(LeviathanGUID); - - switch (eventId) - { - case LeviathanActions.TowerOfStormDestroyed: - if (FlameLeviathan && FlameLeviathan.IsAlive()) - FlameLeviathan.GetAI().DoAction(LeviathanActions.TowerOfStormDestroyed); - break; - case LeviathanActions.TowerOfFrostDestroyed: - if (FlameLeviathan && FlameLeviathan.IsAlive()) - FlameLeviathan.GetAI().DoAction(LeviathanActions.TowerOfFrostDestroyed); - break; - case LeviathanActions.TowerOfFlamesDestroyed: - if (FlameLeviathan && FlameLeviathan.IsAlive()) - FlameLeviathan.GetAI().DoAction(LeviathanActions.TowerOfFlamesDestroyed); - break; - case LeviathanActions.TowerOfLifeDestroyed: - if (FlameLeviathan && FlameLeviathan.IsAlive()) - FlameLeviathan.GetAI().DoAction(LeviathanActions.TowerOfLifeDestroyed); - break; - case InstanceEventIds.ActivateSanityWell: - Creature freya = instance.GetCreature(KeeperGUIDs[0]); - if (freya) - freya.GetAI().DoAction(4/*ACTION_SANITY_WELLS*/); - break; - case InstanceEventIds.HodirsProtectiveGazeProc: - Creature hodir = instance.GetCreature(KeeperGUIDs[1]); - if (hodir) - hodir.GetAI().DoAction(5/*ACTION_FLASH_FREEZE*/); - break; - } - } - - public override bool SetBossState(uint type, EncounterState state) - { - if (!base.SetBossState(type, state)) - return false; - - switch (type) - { - case BossIds.Leviathan: - if (state == EncounterState.Done) - { - // Eject all players from vehicles and make them untargetable. - // They will be despawned after a while - foreach (var vehicleGuid in LeviathanVehicleGUIDs) - { - Creature vehicleCreature = instance.GetCreature(vehicleGuid); - if (vehicleCreature != null) - { - Vehicle vehicle = vehicleCreature.GetVehicleKit(); - if (vehicle != null) - { - vehicle.RemoveAllPassengers(); - vehicleCreature.AddUnitFlag(UnitFlags.NotSelectable); - vehicleCreature.DespawnOrUnsummon(5 * Time.Minute * Time.InMilliseconds); - } - } - } - } - break; - case BossIds.Ignis: - case BossIds.Razorscale: - case BossIds.Xt002: - case BossIds.AssemblyOfIron: - case BossIds.Auriaya: - case BossIds.Vezax: - case BossIds.YoggSaron: - break; - case BossIds.Mimiron: - if (state == EncounterState.Done) - instance.SummonCreature(InstanceCreatureIds.MimironObservationRing, YoggSaron.ObservationRingKeepersPos[3]); - break; - case BossIds.Freya: - if (state == EncounterState.Done) - instance.SummonCreature(InstanceCreatureIds.FreyaObservationRing, YoggSaron.ObservationRingKeepersPos[0]); - break; - case BossIds.Kologarn: - if (state == EncounterState.Done) - { - GameObject gameObject = instance.GetGameObject(KologarnChestGUID); - if (gameObject) - { - gameObject.SetRespawnTime((int)gameObject.GetRespawnDelay()); - gameObject.RemoveFlag(GameObjectFlags.NotSelectable); - } - HandleGameObject(KologarnBridgeGUID, false); - } - break; - case BossIds.Hodir: - if (state == EncounterState.Done) - { - GameObject HodirRareCache = instance.GetGameObject(HodirRareCacheGUID); - if (HodirRareCache) - if (GetData(InstanceData.HodirRareCache) != 0) - HodirRareCache.RemoveFlag(GameObjectFlags.NotSelectable); - GameObject HodirChest = instance.GetGameObject(HodirChestGUID); - if (HodirChest) - HodirChest.SetRespawnTime((int)HodirChest.GetRespawnDelay()); - - instance.SummonCreature(InstanceCreatureIds.HodirObservationRing, YoggSaron.ObservationRingKeepersPos[1]); - } - break; - case BossIds.Thorim: - if (state == EncounterState.Done) - { - GameObject gameObject = instance.GetGameObject(ThorimChestGUID); - if (gameObject) - gameObject.SetRespawnTime((int)gameObject.GetRespawnDelay()); - - instance.SummonCreature(InstanceCreatureIds.ThorimObservationRing, YoggSaron.ObservationRingKeepersPos[2]); - } - break; - case BossIds.Algalon: - if (state == EncounterState.Done) - { - _events.CancelEvent(InstanceEvents.EventUpdateAlgalonTimer); - _events.CancelEvent(InstanceEvents.EventDespawnAlgalon); - DoUpdateWorldState(InstanceWorldStates.AlgalonTimerEnabled, 0); - _algalonTimer = 61; - GameObject gameObject = instance.GetGameObject(GiftOfTheObserverGUID); - if (gameObject) - gameObject.SetRespawnTime((int)gameObject.GetRespawnDelay()); - // get item level (recheck weapons) - var players = instance.GetPlayers(); - foreach (var player in players) - { - for (byte slot = EquipmentSlot.MainHand; slot <= EquipmentSlot.OffHand; ++slot) - { - Item item = player.GetItemByPos(InventorySlots.Bag0, slot); - if (item) - if (item.GetTemplate().GetBaseItemLevel() > _maxWeaponItemLevel) - _maxWeaponItemLevel = item.GetTemplate().GetBaseItemLevel(); - } - } - } - else if (state == EncounterState.InProgress) - { - // get item level (armor cannot be swapped in combat) - var players = instance.GetPlayers(); - foreach (var player in players) - { - for (byte slot = EquipmentSlot.Start; slot < EquipmentSlot.End; ++slot) - { - if (slot == EquipmentSlot.Tabard || slot == EquipmentSlot.Cloak) - continue; - - Item item = player.GetItemByPos(InventorySlots.Bag0, slot); - if (item) - { - if (slot >= EquipmentSlot.MainHand && slot <= EquipmentSlot.OffHand) - { - if (item.GetTemplate().GetBaseItemLevel() > _maxWeaponItemLevel) - _maxWeaponItemLevel = item.GetTemplate().GetBaseItemLevel(); - } - else if (item.GetTemplate().GetBaseItemLevel() > _maxArmorItemLevel) - _maxArmorItemLevel = item.GetTemplate().GetBaseItemLevel(); - } - } - - } - } - break; - } - - return true; - } - - public override void SetData(uint type, uint data) - { - switch (type) - { - case InstanceData.Colossus: - ColossusData = data; - if (data == 2) - { - Creature Leviathan = instance.GetCreature(LeviathanGUID); - if (Leviathan) - Leviathan.GetAI().DoAction(LeviathanActions.MoveToCenterPosition); - GameObject gameObject = instance.GetGameObject(LeviathanGateGUID); - if (gameObject) - gameObject.SetGoState(GameObjectState.ActiveAlternative); - SaveToDB(); - } - break; - case InstanceData.HodirRareCache: - HodirRareCacheData = data; - if (HodirRareCacheData == 0) - { - Creature Hodir = instance.GetCreature(HodirGUID); - if (Hodir) - { - GameObject gameObject = instance.GetGameObject(HodirRareCacheGUID); - if (gameObject) - Hodir.RemoveGameObject(gameObject, false); - } - } - break; - case InstanceAchievementData.DataUnbroken: - Unbroken = data != 0; - break; - case InstanceData.Illusion: - illusion = (byte)data; - break; - case InstanceData.DriveMeCrazy: - IsDriveMeCrazyEligible = data != 0 ? true : false; - break; - case InstanceEvents.EventDespawnAlgalon: - DoUpdateWorldState(InstanceWorldStates.AlgalonTimerEnabled, 1); - DoUpdateWorldState(InstanceWorldStates.AlgalonDespawnTimer, 60); - _algalonTimer = 60; - _events.ScheduleEvent(InstanceEvents.EventDespawnAlgalon, 3600000); - _events.ScheduleEvent(InstanceEvents.EventUpdateAlgalonTimer, 60000); - break; - case InstanceData.AlgalonSummonState: - _algalonSummoned = true; - break; - default: - break; - } - } - - public override void SetGuidData(uint type, ObjectGuid data) { } - - public override ObjectGuid GetGuidData(uint data) - { - switch (data) - { - case BossIds.Leviathan: - return LeviathanGUID; - case BossIds.Ignis: - return IgnisGUID; - - // Razorscale - case BossIds.Razorscale: - return RazorscaleGUID; - case InstanceData.RazorscaleControl: - return RazorscaleController; - case InstanceData.ExpeditionCommander: - return ExpeditionCommanderGUID; - case InstanceGameObjectIds.RazorHarpoon1: - return RazorHarpoonGUIDs[0]; - case InstanceGameObjectIds.RazorHarpoon2: - return RazorHarpoonGUIDs[1]; - case InstanceGameObjectIds.RazorHarpoon3: - return RazorHarpoonGUIDs[2]; - case InstanceGameObjectIds.RazorHarpoon4: - return RazorHarpoonGUIDs[3]; - - // XT-002 Deconstructor - case BossIds.Xt002: - return XT002GUID; - case InstanceData.ToyPile0: - case InstanceData.ToyPile1: - case InstanceData.ToyPile2: - case InstanceData.ToyPile3: - return XTToyPileGUIDs[data - InstanceData.ToyPile0]; - - // Assembly of Iron - case InstanceData.Steelbreaker: - return AssemblyGUIDs[0]; - case InstanceData.Molgeim: - return AssemblyGUIDs[1]; - case InstanceData.Brundir: - return AssemblyGUIDs[2]; - - case BossIds.Kologarn: - return KologarnGUID; - case BossIds.Auriaya: - return AuriayaGUID; - case BossIds.Hodir: - return HodirGUID; - case BossIds.Thorim: - return ThorimGUID; - - // Freya - case BossIds.Freya: - return FreyaGUID; - case BossIds.Brightleaf: - return ElderGUIDs[0]; - case BossIds.Ironbranch: - return ElderGUIDs[1]; - case BossIds.Stonebark: - return ElderGUIDs[2]; - - // Mimiron - case BossIds.Mimiron: - return MimironGUID; - case InstanceData.LeviathanMKII: - return MimironVehicleGUIDs[0]; - case InstanceData.VX001: - return MimironVehicleGUIDs[1]; - case InstanceData.AerialCommandUnit: - return MimironVehicleGUIDs[2]; - case InstanceData.Computer: - return MimironComputerGUID; - case InstanceData.MimironWorldTrigger: - return MimironWorldTriggerGUID; - case InstanceData.MimironElevator: - return MimironElevatorGUID; - case InstanceData.MimironButton: - return MimironButtonGUID; - - case BossIds.Vezax: - return VezaxGUID; - - // Yogg-Saron - case BossIds.YoggSaron: - return YoggSaronGUID; - case InstanceData.VoiceOfYoggSaron: - return VoiceOfYoggSaronGUID; - case InstanceData.BrainOfYoggSaron: - return BrainOfYoggSaronGUID; - case InstanceData.Sara: - return SaraGUID; - case InstanceGameObjectIds.BrainRoomDoor1: - return BrainRoomDoorGUIDs[0]; - case InstanceGameObjectIds.BrainRoomDoor2: - return BrainRoomDoorGUIDs[1]; - case InstanceGameObjectIds.BrainRoomDoor3: - return BrainRoomDoorGUIDs[2]; - case InstanceData.FreyaYs: - return KeeperGUIDs[0]; - case InstanceData.HodirYs: - return KeeperGUIDs[1]; - case InstanceData.ThorimYs: - return KeeperGUIDs[2]; - case InstanceData.MimironYs: - return KeeperGUIDs[3]; - - // Algalon - case BossIds.Algalon: - return AlgalonGUID; - case InstanceData.Sigildoor01: - return AlgalonSigilDoorGUID[0]; - case InstanceData.Sigildoor02: - return AlgalonSigilDoorGUID[1]; - case InstanceData.Sigildoor03: - return AlgalonSigilDoorGUID[2]; - case InstanceData.UniverseFloor01: - return AlgalonFloorGUID[0]; - case InstanceData.UniverseFloor02: - return AlgalonFloorGUID[1]; - case InstanceData.UniverseGlobe: - return AlgalonUniverseGUID; - case InstanceData.AlgalonTrapdoor: - return AlgalonTrapdoorGUID; - case InstanceData.BrannBronzebeardAlg: - return BrannBronzebeardAlgGUID; - } - - return ObjectGuid.Empty; - } - - public override uint GetData(uint type) - { - switch (type) - { - case InstanceData.Colossus: - return ColossusData; - case InstanceData.HodirRareCache: - return HodirRareCacheData; - case InstanceAchievementData.DataUnbroken: - return (uint)(Unbroken ? 1 : 0); - case InstanceData.Illusion: - return illusion; - case InstanceData.KeepersCount: - return keepersCount; - default: - break; - } - - return 0; - } - - public override bool CheckAchievementCriteriaMeet(uint criteriaId, Player source, Unit target = null, uint miscvalue1 = 0) - { - switch (criteriaId) - { - case InstanceCriteriaIds.HeraldOfTitans: - return _maxArmorItemLevel <= InstanceAchievementData.MaxHeraldArmorItemlevel && _maxWeaponItemLevel <= InstanceAchievementData.MaxHeraldWeaponItemlevel; - case InstanceCriteriaIds.WaitsDreamingStormwind10: - case InstanceCriteriaIds.WaitsDreamingStormwind25: - return illusion == YoggSaronIllusions.StormwindIllusion; - case InstanceCriteriaIds.WaitsDreamingChamber10: - case InstanceCriteriaIds.WaitsDreamingChamber25: - return illusion == YoggSaronIllusions.ChamberIllusion; - case InstanceCriteriaIds.WaitsDreamingIcecrown10: - case InstanceCriteriaIds.WaitsDreamingIcecrown25: - return illusion == YoggSaronIllusions.IcecrownIllusion; - case InstanceCriteriaIds.DriveMeCrazy10: - case InstanceCriteriaIds.DriveMeCrazy25: - return IsDriveMeCrazyEligible; - case InstanceCriteriaIds.ThreeLightsInTheDarkness10: - case InstanceCriteriaIds.ThreeLightsInTheDarkness25: - return keepersCount <= 3; - case InstanceCriteriaIds.TwoLightsInTheDarkness10: - case InstanceCriteriaIds.TwoLightsInTheDarkness25: - return keepersCount <= 2; - case InstanceCriteriaIds.OneLightInTheDarkness10: - case InstanceCriteriaIds.OneLightInTheDarkness25: - return keepersCount <= 1; - case InstanceCriteriaIds.AloneInTheDarkness10: - case InstanceCriteriaIds.AloneInTheDarkness25: - return keepersCount == 0; - case InstanceCriteriaIds.ChampionLeviathan10: - case InstanceCriteriaIds.ChampionLeviathan25: - return (_CoUAchivePlayerDeathMask & (1 << (int)BossIds.Leviathan)) == 0; - case InstanceCriteriaIds.ChampionIgnis10: - case InstanceCriteriaIds.ChampionIgnis25: - return (_CoUAchivePlayerDeathMask & (1 << (int)BossIds.Ignis)) == 0; - case InstanceCriteriaIds.ChampionRazorscale10: - case InstanceCriteriaIds.ChampionRazorscale25: - return (_CoUAchivePlayerDeathMask & (1 << (int)BossIds.Razorscale)) == 0; - case InstanceCriteriaIds.ChampionXt002_10: - case InstanceCriteriaIds.ChampionXt002_25: - return (_CoUAchivePlayerDeathMask & (1 << (int)BossIds.Xt002)) == 0; - case InstanceCriteriaIds.ChampionIronCouncil10: - case InstanceCriteriaIds.ChampionIronCouncil25: - return (_CoUAchivePlayerDeathMask & (1 << (int)BossIds.AssemblyOfIron)) == 0; - case InstanceCriteriaIds.ChampionKologarn10: - case InstanceCriteriaIds.ChampionKologarn25: - return (_CoUAchivePlayerDeathMask & (1 << (int)BossIds.Kologarn)) == 0; - case InstanceCriteriaIds.ChampionAuriaya10: - case InstanceCriteriaIds.ChampionAuriaya25: - return (_CoUAchivePlayerDeathMask & (1 << (int)BossIds.Auriaya)) == 0; - case InstanceCriteriaIds.ChampionHodir10: - case InstanceCriteriaIds.ChampionHodir25: - return (_CoUAchivePlayerDeathMask & (1 << (int)BossIds.Hodir)) == 0; - case InstanceCriteriaIds.ChampionThorim10: - case InstanceCriteriaIds.ChampionThorim25: - return (_CoUAchivePlayerDeathMask & (1 << (int)BossIds.Thorim)) == 0; - case InstanceCriteriaIds.ChampionFreya10: - case InstanceCriteriaIds.ChampionFreya25: - return (_CoUAchivePlayerDeathMask & (1 << (int)BossIds.Freya)) == 0; - case InstanceCriteriaIds.ChampionMimiron10: - case InstanceCriteriaIds.ChampionMimiron25: - return (_CoUAchivePlayerDeathMask & (1 << (int)BossIds.Mimiron)) == 0; - case InstanceCriteriaIds.ChampionVezax10: - case InstanceCriteriaIds.ChampionVezax25: - return (_CoUAchivePlayerDeathMask & (1 << (int)BossIds.Vezax)) == 0; - case InstanceCriteriaIds.ChampionYoggSaron10: - case InstanceCriteriaIds.ChampionYoggSaron25: - return (_CoUAchivePlayerDeathMask & (1 << (int)BossIds.YoggSaron)) == 0; - } - - return false; - } - - public override void WriteSaveDataMore(StringBuilder data) - { - data.AppendFormat("{0} {1} {2}", GetData(InstanceData.Colossus), _algalonTimer, (_algalonSummoned ? 1 : 0)); - - for (byte i = 0; i < 4; ++i) - data.AppendFormat(" {0}", (KeeperGUIDs[i].IsEmpty() ? 0 : 1)); - - data.AppendFormat(" {0}", _CoUAchivePlayerDeathMask); - } - - public override void ReadSaveDataMore(StringArguments data) - { - EncounterState tempState = (EncounterState)data.NextUInt32(); - if (tempState == EncounterState.InProgress || tempState > EncounterState.Special) - tempState = EncounterState.NotStarted; - SetData(InstanceData.Colossus, (uint)tempState); - - _algalonTimer = data.NextUInt32(); - tempState = (EncounterState)data.NextUInt32(); - _algalonSummoned = tempState != 0; - if (_algalonSummoned && GetBossState(BossIds.Algalon) != EncounterState.Done) - { - _summonAlgalon = true; - if (_algalonTimer != 0 && _algalonTimer <= 60) - { - _events.ScheduleEvent(InstanceEvents.EventUpdateAlgalonTimer, 60000); - DoUpdateWorldState(InstanceWorldStates.AlgalonTimerEnabled, 1); - DoUpdateWorldState(InstanceWorldStates.AlgalonDespawnTimer, _algalonTimer); - } - } - - for (byte i = 0; i < 4; ++i) - { - tempState = (EncounterState)data.NextUInt32(); - _summonYSKeeper[i] = tempState != 0; - } - - if (GetBossState(BossIds.Freya) == EncounterState.Done && !_summonYSKeeper[0]) - _summonObservationRingKeeper[0] = true; - if (GetBossState(BossIds.Hodir) == EncounterState.Done && !_summonYSKeeper[1]) - _summonObservationRingKeeper[1] = true; - if (GetBossState(BossIds.Thorim) == EncounterState.Done && !_summonYSKeeper[2]) - _summonObservationRingKeeper[2] = true; - if (GetBossState(BossIds.Mimiron) == EncounterState.Done && !_summonYSKeeper[3]) - _summonObservationRingKeeper[3] = true; - - _CoUAchivePlayerDeathMask = data.NextUInt32(); - } - - public override void Update(uint diff) - { - if (_events.Empty()) - return; - - _events.Update(diff); - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case InstanceEvents.EventUpdateAlgalonTimer: - SaveToDB(); - DoUpdateWorldState(InstanceWorldStates.AlgalonDespawnTimer, --_algalonTimer); - if (_algalonTimer != 0) - _events.ScheduleEvent(InstanceEvents.EventUpdateAlgalonTimer, 60000); - else - { - DoUpdateWorldState(InstanceWorldStates.AlgalonTimerEnabled, 0); - _events.CancelEvent(InstanceEvents.EventUpdateAlgalonTimer); - Creature algalon = instance.GetCreature(AlgalonGUID); - if (algalon) - algalon.GetAI().DoAction((int)InstanceEvents.EventDespawnAlgalon); - } - break; - } - }); - } - - public override void UpdateDoorState(GameObject door) - { - // Leviathan doors are set to DOOR_TYPE_ROOM except the one it uses to enter the room - // which has to be set to DOOR_TYPE_PASSAGE - if (door.GetEntry() == InstanceGameObjectIds.LeviathanDoor && door.GetPositionX() > 400.0f) - door.SetGoState(GetBossState(BossIds.Leviathan) == EncounterState.Done ? GameObjectState.Active : GameObjectState.Ready); - else - base.UpdateDoorState(door); - } - - public override void AddDoor(GameObject door, bool add) - { - // Leviathan doors are South except the one it uses to enter the room - // which is North and should not be used for boundary checks in BossAI.CheckBoundary() - if (door.GetEntry() == InstanceGameObjectIds.LeviathanDoor && door.GetPositionX() > 400.0f) - { - if (add) - GetBossInfo(BossIds.Leviathan).door[(int)DoorType.Passage].Add(door.GetGUID()); - else - GetBossInfo(BossIds.Leviathan).door[(int)DoorType.Passage].Remove(door.GetGUID()); - - if (add) - UpdateDoorState(door); - } - else - base.AddDoor(door, add); - } - - BossBoundaryEntry[] boundaries = - { - new BossBoundaryEntry(BossIds.Leviathan, new RectangleBoundary(148.0f, 401.3f, -155.0f, 90.0f) ), - new BossBoundaryEntry(BossIds.Ignis, new RectangleBoundary(495.0f, 680.0f, 90.0f, 400.0f) ), - new BossBoundaryEntry(BossIds.Razorscale, new RectangleBoundary(370.0f, 810.0f, -542.0f, -55.0f)), - new BossBoundaryEntry(BossIds.Xt002, new RectangleBoundary(755.0f, 940.0f, -125.0f, 95.0f)), - new BossBoundaryEntry(BossIds.AssemblyOfIron, new CircleBoundary(new Position(1587.2f, 121.0f), 90.0)), - new BossBoundaryEntry(BossIds.Algalon, new CircleBoundary(new Position(1632.668f, -307.7656f), 45.0)), - new BossBoundaryEntry(BossIds.Algalon, new ZRangeBoundary(410.0f, 440.0f)), - new BossBoundaryEntry(BossIds.Hodir, new EllipseBoundary(new Position(2001.5f, -240.0f), 50.0, 75.0)), - new BossBoundaryEntry(BossIds.Thorim, new CircleBoundary(new Position(2134.73f, -263.2f), 50.0)), - new BossBoundaryEntry(BossIds.Freya, new RectangleBoundary(2094.6f, 2520.0f, -250.0f, 200.0f)), - new BossBoundaryEntry(BossIds.Mimiron, new CircleBoundary(new Position(2744.0f, 2569.0f), 70.0)), - new BossBoundaryEntry(BossIds.Vezax, new RectangleBoundary(1740.0f, 1930.0f, 31.0f, 228.0f)), - new BossBoundaryEntry(BossIds.YoggSaron, new CircleBoundary(new Position(1980.42f, -27.68f), 105.0)) - }; - - DoorData[] doorData = - { - new DoorData(InstanceGameObjectIds.LeviathanDoor, BossIds.Leviathan, DoorType.Room), - new DoorData(InstanceGameObjectIds.Xt002Door, BossIds.Xt002, DoorType.Room), - new DoorData(InstanceGameObjectIds.IronCouncilDoor, BossIds.AssemblyOfIron, DoorType.Room), - new DoorData(InstanceGameObjectIds.ArchivumDoor, BossIds.AssemblyOfIron, DoorType.Passage), - new DoorData(InstanceGameObjectIds.HodirEntrance, BossIds.Hodir, DoorType.Room), - new DoorData(InstanceGameObjectIds.HodirDoor, BossIds.Hodir, DoorType.Passage), - new DoorData(InstanceGameObjectIds.HodirIceDoor, BossIds.Hodir, DoorType.Passage), - new DoorData(InstanceGameObjectIds.MimironDoor1, BossIds.Mimiron, DoorType.Room), - new DoorData(InstanceGameObjectIds.MimironDoor2, BossIds.Mimiron, DoorType.Room), - new DoorData(InstanceGameObjectIds.MimironDoor3, BossIds.Mimiron, DoorType.Room), - new DoorData(InstanceGameObjectIds.VezaxDoor, BossIds.Vezax, DoorType.Passage), - new DoorData(InstanceGameObjectIds.YoggSaronDoor, BossIds.YoggSaron, DoorType.Room), - new DoorData(InstanceGameObjectIds.DoodadUlSigildoor03, BossIds.Algalon, DoorType.Room), - new DoorData(InstanceGameObjectIds.DoodadUlUniversefloor01, BossIds.Algalon, DoorType.Room), - new DoorData(InstanceGameObjectIds.DoodadUlUniversefloor02, BossIds.Algalon, DoorType.SpawnHole), - new DoorData(InstanceGameObjectIds.DoodadUlUniverseglobe01, BossIds.Algalon, DoorType.SpawnHole), - new DoorData(InstanceGameObjectIds.DoodadUlUlduarTrapdoor03, BossIds.Algalon, DoorType.SpawnHole), - new DoorData(0, 0, DoorType.Room) - }; - - MinionData[] minionData = - { - new MinionData(InstanceCreatureIds.Steelbreaker, BossIds.AssemblyOfIron), - new MinionData(InstanceCreatureIds.Molgeim, BossIds.AssemblyOfIron), - new MinionData(InstanceCreatureIds.Brundir, BossIds.AssemblyOfIron), - new MinionData(0, 0 ) - }; - - // Creatures - ObjectGuid LeviathanGUID; - List LeviathanVehicleGUIDs = new List(); - ObjectGuid IgnisGUID; - ObjectGuid RazorscaleGUID; - ObjectGuid RazorscaleController; - ObjectGuid ExpeditionCommanderGUID; - ObjectGuid XT002GUID; - ObjectGuid[] XTToyPileGUIDs = new ObjectGuid[4]; - ObjectGuid[] AssemblyGUIDs = new ObjectGuid[3]; - ObjectGuid KologarnGUID; - ObjectGuid AuriayaGUID; - ObjectGuid HodirGUID; - ObjectGuid ThorimGUID; - ObjectGuid FreyaGUID; - ObjectGuid[] ElderGUIDs = new ObjectGuid[3]; - ObjectGuid FreyaAchieveTriggerGUID; - ObjectGuid MimironGUID; - ObjectGuid[] MimironVehicleGUIDs = new ObjectGuid[3]; - ObjectGuid MimironComputerGUID; - ObjectGuid MimironWorldTriggerGUID; - ObjectGuid VezaxGUID; - ObjectGuid YoggSaronGUID; - ObjectGuid VoiceOfYoggSaronGUID; - ObjectGuid SaraGUID; - ObjectGuid BrainOfYoggSaronGUID; - ObjectGuid[] KeeperGUIDs = new ObjectGuid[4]; - ObjectGuid AlgalonGUID; - ObjectGuid BrannBronzebeardAlgGUID; - - // GameObjects - ObjectGuid LeviathanGateGUID; - ObjectGuid[] RazorHarpoonGUIDs = new ObjectGuid[4]; - ObjectGuid KologarnChestGUID; - ObjectGuid KologarnBridgeGUID; - ObjectGuid ThorimChestGUID; - ObjectGuid HodirRareCacheGUID; - ObjectGuid HodirChestGUID; - ObjectGuid MimironTramGUID; - ObjectGuid MimironElevatorGUID; - ObjectGuid MimironButtonGUID; - ObjectGuid[] BrainRoomDoorGUIDs = new ObjectGuid[3]; - ObjectGuid[] AlgalonSigilDoorGUID = new ObjectGuid[3]; - ObjectGuid[] AlgalonFloorGUID = new ObjectGuid[2]; - ObjectGuid AlgalonUniverseGUID; - ObjectGuid AlgalonTrapdoorGUID; - ObjectGuid GiftOfTheObserverGUID; - - // Miscellaneous - Team TeamInInstance; - uint HodirRareCacheData; - uint ColossusData; - //byte elderCount; - byte illusion; - byte keepersCount; - bool conSpeedAtory; - bool lumberjacked; - bool Unbroken; - bool IsDriveMeCrazyEligible; - - uint _algalonTimer; - bool _summonAlgalon; - bool _algalonSummoned; - bool[] _summonObservationRingKeeper = new bool[4]; - bool[] _summonYSKeeper = new bool[4]; - uint _maxArmorItemLevel; - uint _maxWeaponItemLevel; - uint _CoUAchivePlayerDeathMask; - } - - public override InstanceScript GetInstanceScript(InstanceMap map) - { - return new instance_ulduar_InstanceMapScript(map); - } - } -} diff --git a/Source/Scripts/Northrend/Ulduar/Xt002.cs b/Source/Scripts/Northrend/Ulduar/Xt002.cs deleted file mode 100644 index 10286b099..000000000 --- a/Source/Scripts/Northrend/Ulduar/Xt002.cs +++ /dev/null @@ -1,883 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Framework.Dynamic; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using Game.Spells; -using System; -using System.Collections.Generic; -using Game.Networking.Packets; - -namespace Scripts.Northrend.Ulduar.Xt002 -{ - struct SpellIds - { - public const uint TympanicTantrum = 62776; - public const uint SearingLight = 63018; - - public const uint SummonLifeSpark = 64210; - public const uint SummonVoidZone = 64203; - - public const uint GravityBomb = 63024; - - public const uint Heartbreak = 65737; - - // Cast By 33337 At Heartbreak: - public const uint RechargePummeler = 62831; // Summons 33344 - public const uint RechargeScrapbot = 62828; // Summons 33343 - public const uint RechargeBoombot = 62835; // Summons 33346 - - // Cast By 33329 On 33337 (Visual?) - public const uint EnergyOrb = 62790; // Triggers 62826 - Needs Spellscript For Periodic Tick To Cast One Of The Random Spells Above - - public const uint HeartHealToFull = 17683; - public const uint HeartOverload = 62789; - - public const uint HeartLightningTether = 64799; // Cast On Self? - public const uint Enrage = 26662; - public const uint Stand = 37752; - public const uint Submerge = 37751; - - //------------------Void Zone-------------------- - public const uint VoidZone = 64203; - public const uint Consumption = 64208; - - // Life Spark - public const uint ArcanePowerState = 49411; - public const uint StaticCharged = 64227; - public const uint Shock = 64230; - - //----------------Xt-002 Heart------------------- - public const uint ExposedHeart = 63849; - public const uint HeartRideVehicle = 63852; - public const uint RideVehicleExposed = 63313; //Heart Exposed - - //---------------Xm-024 Pummeller---------------- - public const uint ArcingSmash = 8374; - public const uint Trample = 5568; - public const uint Uppercut = 10966; - - // Scrabot: - public const uint ScrapbotRideVehicle = 47020; - public const uint ScrapRepair = 62832; - public const uint Suicide = 7; - - //------------------Boombot----------------------- - public const uint AuraBoombot = 65032; - public const uint Boom = 62834; - - // Achievement-Related Spells - public const uint AchievementCreditNerfScrapbots = 65037; - } - - struct XT002Data - { - public const uint TransferedHealth = 0; - public const uint HardMode = 1; - public const uint HealthRecovered = 2; - public const uint GravityBombCasualty = 3; - } - - struct Texts - { - public const uint Aggro = 0; - public const uint HeartOpened = 1; - public const uint HeartClosed = 2; - public const uint TympanicTantrum = 3; - public const uint Slay = 4; - public const uint Berserk = 5; - public const uint Death = 6; - public const uint Summon = 7; - public const uint EmoteHeartOpened = 8; - public const uint EmoteHeartClosed = 9; - public const uint EmoteTympanicTantrum = 10; - public const uint EmoteScrapbot = 11; - } - - struct Misc - { - public const uint PhaseOneGroup = 1; - public const int ActionHardMode = 1; - public const uint AchievMustDeconstructFaster = 21027; - - public const sbyte SeatHeartNormal = 0; - public const sbyte SeatHeartExposed = 1; - } - - [Script] - class boss_xt002 : BossAI - { - public boss_xt002(Creature creature) : base(creature, BossIds.Xt002) - { - Initialize(); - _transferHealth = 0; - } - - void Initialize() - { - _healthRecovered = false; - _gravityBombCasualty = false; - _hardMode = false; - - _heartExposed = 0; - } - - public override void Reset() - { - _Reset(); - - me.RemoveUnitFlag(UnitFlags.NotSelectable); - me.SetReactState(ReactStates.Aggressive); - DoCastSelf(SpellIds.Stand); - - Initialize(); - - instance.DoStopCriteriaTimer(CriteriaTimedTypes.Event, Misc.AchievMustDeconstructFaster); - } - - public override void EnterEvadeMode(EvadeReason why) - { - summons.DespawnAll(); - _DespawnAtEvade(); - } - - public override void EnterCombat(Unit who) - { - Talk(Texts.Aggro); - _EnterCombat(); - - //Enrage - _scheduler.Schedule(TimeSpan.FromMinutes(10), task => - { - Talk(Texts.Berserk); - DoCastSelf(SpellIds.Enrage); - }); - - //Gavity Bomb - _scheduler.Schedule(TimeSpan.FromSeconds(20), Misc.PhaseOneGroup, task => - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0); - if (target) - DoCast(target, SpellIds.GravityBomb); - - task.Repeat(TimeSpan.FromSeconds(20)); - }); - - //Searing Light - _scheduler.Schedule(TimeSpan.FromSeconds(20), Misc.PhaseOneGroup, task => - { - Unit target = SelectTarget(SelectAggroTarget.Random, 0); - if (target) - DoCast(target, SpellIds.SearingLight); - - task.Repeat(TimeSpan.FromSeconds(20)); - }); - - //Tympanic Tantrum - _scheduler.Schedule(TimeSpan.FromSeconds(30), Misc.PhaseOneGroup, task => - { - Talk(Texts.TympanicTantrum); - Talk(Texts.EmoteTympanicTantrum); - DoCast(SpellIds.TympanicTantrum); - task.Repeat(TimeSpan.FromSeconds(30)); - }); - - instance.DoStartCriteriaTimer(CriteriaTimedTypes.Event, Misc.AchievMustDeconstructFaster); - } - - public override void DoAction(int action) - { - switch (action) - { - case Misc.ActionHardMode: - _scheduler.Schedule(TimeSpan.FromMilliseconds(1), task => - { - SetPhaseOne(true); - }); - break; - } - } - - public override void KilledUnit(Unit who) - { - if (who.GetTypeId() == TypeId.Player) - Talk(Texts.Slay); - } - - public override void JustDied(Unit killer) - { - Talk(Texts.Death); - _JustDied(); - me.RemoveUnitFlag(UnitFlags.NotSelectable); - } - - public override void DamageTaken(Unit attacker, ref uint damage) - { - if (!_hardMode && !me.HasReactState(ReactStates.Passive) && !HealthAbovePct(100 - 25 * (_heartExposed + 1))) - ExposeHeart(); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - if (!me.HasReactState(ReactStates.Passive)) - DoMeleeAttackIfReady(); - } - - public override void PassengerBoarded(Unit who, sbyte seatId, bool apply) - { - if (apply && who.GetEntry() == InstanceCreatureIds.XS013Scrapbot) - { - // Need this so we can properly determine when to expose heart again in damagetaken hook - if (me.GetHealthPct() > (25 * (4 - _heartExposed))) - ++_heartExposed; - - Talk(Texts.EmoteScrapbot); - DoCast(who, SpellIds.ScrapRepair, true); - _healthRecovered = true; - } - - if (apply && seatId == Misc.SeatHeartExposed) - who.CastSpell(who, SpellIds.ExposedHeart); // Channeled - } - - public override uint GetData(uint type) - { - switch (type) - { - case XT002Data.HardMode: - return _hardMode ? 1 : 0u; - case XT002Data.HealthRecovered: - return _healthRecovered ? 1 : 0u; - case XT002Data.GravityBombCasualty: - return _gravityBombCasualty ? 1 : 0u; - } - - return 0; - } - - public override void SetData(uint type, uint data) - { - switch (type) - { - case XT002Data.TransferedHealth: - _transferHealth = data; - break; - case XT002Data.GravityBombCasualty: - _gravityBombCasualty = (data > 0) ? true : false; - break; - } - } - - void ExposeHeart() - { - Talk(Texts.HeartOpened); - Talk(Texts.EmoteHeartOpened); - - DoCastSelf(SpellIds.Submerge); // WIll make creature untargetable - me.AttackStop(); - me.SetReactState(ReactStates.Passive); - - Unit heart = me.GetVehicleKit() ? me.GetVehicleKit().GetPassenger(Misc.SeatHeartNormal) : null; - if (heart) - { - heart.CastSpell(heart, SpellIds.HeartOverload); - heart.CastSpell(me, SpellIds.HeartLightningTether); - heart.CastSpell(heart, SpellIds.HeartHealToFull, true); - heart.CastSpell(me, SpellIds.RideVehicleExposed, true); - heart.RemoveUnitFlag(UnitFlags.NotSelectable); - heart.AddUnitFlag(UnitFlags.Unk29); - } - _scheduler.DelayGroup(Misc.PhaseOneGroup, TimeSpan.FromSeconds(30)); - - // Start "end of phase 2 timer" - _scheduler.Schedule(TimeSpan.FromSeconds(30), task => { SetPhaseOne(false); }); - - _heartExposed++; - } - - void SetPhaseOne(bool isHardMode) - { - if (isHardMode) - { - me.SetFullHealth(); - DoCastSelf(SpellIds.Heartbreak, true); - me.AddLootMode(LootModes.HardMode1); - _hardMode = true; - } - - Talk(Texts.HeartClosed); - Talk(Texts.EmoteHeartClosed); - - me.RemoveUnitFlag(UnitFlags.NotSelectable); - me.SetReactState(ReactStates.Aggressive); - DoCastSelf(SpellIds.Stand); - - //_events.RescheduleEvent(EVENT_SEARING_LIGHT, TIMER_SEARING_LIGHT / 2); - //_events.RescheduleEvent(EVENT_GRAVITY_BOMB, TIMER_GRAVITY_BOMB); - //_events.RescheduleEvent(EVENT_TYMPANIC_TANTRUM, RandomHelper.URand(TIMER_TYMPANIC_TANTRUM_MIN, TIMER_TYMPANIC_TANTRUM_MAX)); - - Unit heart = me.GetVehicleKit() ? me.GetVehicleKit().GetPassenger(Misc.SeatHeartExposed) : null; - if (!heart) - return; - - heart.CastSpell(me, SpellIds.HeartRideVehicle, true); - heart.AddUnitFlag(UnitFlags.NotSelectable); - heart.RemoveUnitFlag(UnitFlags.Unk29); - heart.RemoveAurasDueToSpell(SpellIds.ExposedHeart); - - if (!_hardMode) - { - if (_transferHealth == 0) - _transferHealth = (uint)(heart.GetMaxHealth() - heart.GetHealth()); - - if (_transferHealth >= me.GetHealth()) - _transferHealth = (uint)me.GetHealth() - 1; - - me.ModifyHealth(-(int)_transferHealth); - me.LowerPlayerDamageReq(_transferHealth); - } - } - - // Achievement related - bool _healthRecovered; // Did a scrapbot recover XT-002's health during the encounter? - bool _hardMode; // Are we in hard mode? Or: was the heart killed during phase 2? - bool _gravityBombCasualty; // Did someone die because of Gravity Bomb damage? - - byte _heartExposed; - uint _transferHealth; - } - - [Script] - class npc_xt002_heart : NullCreatureAI - { - public npc_xt002_heart(Creature creature) : base(creature) - { - _instance = creature.GetInstanceScript(); - } - - public override void JustDied(Unit killer) - { - Creature xt002 = ObjectAccessor.GetCreature(me, _instance.GetGuidData(BossIds.Xt002)); - if (xt002) - { - xt002.GetAI().SetData(XT002Data.TransferedHealth, (uint)me.GetHealth()); - xt002.GetAI().DoAction(Misc.ActionHardMode); - } - } - - InstanceScript _instance; - } - - [Script] - class npc_scrapbot : ScriptedAI - { - public npc_scrapbot(Creature creature) : base(creature) - { - _instance = me.GetInstanceScript(); - } - - public override void Reset() - { - me.SetReactState(ReactStates.Passive); - Creature pXT002 = ObjectAccessor.GetCreature(me, _instance.GetGuidData(BossIds.Xt002)); - if (pXT002) - me.GetMotionMaster().MoveFollow(pXT002, 0.0f, 0.0f); - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - ObjectGuid guid = _instance.GetGuidData(BossIds.Xt002); - if (type == MovementGeneratorType.Follow && id == guid.GetCounter()) - { - Creature xt002 = ObjectAccessor.GetCreature(me, guid); - if (xt002) - { - if (me.IsWithinMeleeRange(xt002)) - { - DoCast(xt002, SpellIds.ScrapbotRideVehicle); - // Unapply vehicle aura again - xt002.RemoveAurasDueToSpell(SpellIds.ScrapbotRideVehicle); - me.DespawnOrUnsummon(); - } - } - } - } - - InstanceScript _instance; - } - - [Script] - class npc_pummeller : ScriptedAI - { - public npc_pummeller(Creature creature) : base(creature) - { - Initialize(); - _instance = creature.GetInstanceScript(); - } - - void Initialize() - { - _scheduler.SetValidator(() => me.IsWithinMeleeRange(me.GetVictim())); - - //Arcing Smash - _scheduler.Schedule(TimeSpan.FromSeconds(27), task => - { - DoCastVictim(SpellIds.ArcingSmash); - task.Repeat(TimeSpan.FromSeconds(27)); - }); - - //Trample - _scheduler.Schedule(TimeSpan.FromSeconds(22), task => - { - DoCastVictim(SpellIds.Trample); - task.Repeat(TimeSpan.FromSeconds(22)); - }); - - //Uppercut - _scheduler.Schedule(TimeSpan.FromSeconds(17), task => - { - DoCastVictim(SpellIds.Uppercut); - task.Repeat(TimeSpan.FromSeconds(17)); - }); - } - - public override void Reset() - { - Initialize(); - Creature xt002 = ObjectAccessor.GetCreature(me, _instance.GetGuidData(BossIds.Xt002)); - if (xt002) - { - Position pos = xt002.GetPosition(); - me.GetMotionMaster().MovePoint(0, pos); - } - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _scheduler.Update(diff); - - DoMeleeAttackIfReady(); - } - - InstanceScript _instance; - } - - class BoomEvent : BasicEvent - { - public BoomEvent(Creature me) - { - _me = me; - } - - public override bool Execute(ulong time, uint diff) - { - // This hack is here because we suspect our implementation of spell effect execution on targets - // is done in the wrong order. We suspect that 0 needs to be applied on all targets, - // then 1, etc - instead of applying each effect on target1, then target2, etc. - // The above situation causes the visual for this spell to be bugged, so we remove the instakill - // effect and implement a script hack for that. - - _me.CastSpell(_me, SpellIds.Boom, false); - return true; - } - - Creature _me; - } - - [Script] - class npc_boombot : ScriptedAI - { - public npc_boombot(Creature creature) : base(creature) - { - Initialize(); - _instance = creature.GetInstanceScript(); - } - - void Initialize() - { - _boomed = false; - } - - public override void Reset() - { - Initialize(); - - DoCast(SpellIds.AuraBoombot); // For achievement - - // @todo proper waypoints? - Creature pXT002 = ObjectAccessor.GetCreature(me, _instance.GetGuidData(BossIds.Xt002)); - if (pXT002) - me.GetMotionMaster().MoveFollow(pXT002, 0.0f, 0.0f); - } - - public override void DamageTaken(Unit who, ref uint damage) - { - if (damage >= (me.GetHealth() - me.GetMaxHealth() * 0.5f) && !_boomed) - { - _boomed = true; // Prevent recursive calls - - SpellInstakillLog instakill = new SpellInstakillLog(); - instakill.Caster = me.GetGUID(); - instakill.Target = me.GetGUID(); - instakill.SpellID = SpellIds.Boom; - me.SendMessageToSet(instakill, false); - - me.DealDamage(me, (uint)me.GetHealth(), null, DamageEffectType.NoDamage, SpellSchoolMask.Normal, null, false); - - damage = 0; - - // Visual only seems to work if the instant kill event is delayed or the spell itself is delayed - // Casting done from player and caster source has the same targetinfo flags, - // so that can't be the issue - // See BoomEvent class - // Schedule 1s delayed - me.m_Events.AddEvent(new BoomEvent(me), me.m_Events.CalculateTime(1 * Time.InMilliseconds)); - } - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - // No melee attack - } - - InstanceScript _instance; - bool _boomed; - } - - [Script] - class npc_life_spark : ScriptedAI - { - public npc_life_spark(Creature creature) : base(creature) { } - - void Initialize() - { - _scheduler.Schedule(TimeSpan.FromMilliseconds(1), task => - { - DoCastVictim(SpellIds.Shock); - task.Repeat(TimeSpan.FromSeconds(12)); - }); - } - - public override void Reset() - { - DoCastSelf(SpellIds.ArcanePowerState); - _scheduler.CancelAll(); - } - - public override void EnterCombat(Unit victim) - { - DoCastSelf(SpellIds.StaticCharged); - _scheduler.Schedule(TimeSpan.FromSeconds(12), task => - { - DoCastVictim(SpellIds.Shock); - task.Repeat(); - }); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - if (me.HasUnitState(UnitState.Casting)) - return; - - _scheduler.Update(diff, DoMeleeAttackIfReady); - } - } - - [Script] - class npc_xt_void_zone : PassiveAI - { - public npc_xt_void_zone(Creature creature) : base(creature) { } - - public override void Reset() - { - _scheduler.Schedule(TimeSpan.FromSeconds(1), consumption => - { - DoCastSelf(SpellIds.Consumption); - consumption.Repeat(); - }); - } - - public override void UpdateAI(uint diff) - { - _scheduler.Update(diff); - } - } - - [Script] - class spell_xt002_searing_light_spawn_life_spark : AuraScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(SpellIds.SummonLifeSpark); - } - - void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Player player = GetOwner().ToPlayer(); - if (player) - { - Unit xt002 = GetCaster(); - if (xt002) - if (xt002.HasAura((uint)aurEff.GetAmount())) // Heartbreak aura indicating hard mode - xt002.CastSpell(player, SpellIds.SummonLifeSpark, true); - } - } - - public override void Register() - { - AfterEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.PeriodicTriggerSpell, AuraEffectHandleModes.Real)); - } - } - - [Script] - class spell_xt002_gravity_bomb_aura : AuraScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(SpellIds.SummonVoidZone); - } - - void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Player player = GetOwner().ToPlayer(); - if (player) - { - Unit xt002 = GetCaster(); - if (xt002) - if (xt002.HasAura((uint)aurEff.GetAmount())) // Heartbreak aura indicating hard mode - xt002.CastSpell(player, SpellIds.SummonVoidZone, true); - } - } - - void OnPeriodic(AuraEffect aurEff) - { - Unit xt002 = GetCaster(); - if (!xt002) - return; - - Unit owner = GetOwner().ToUnit(); - if (!owner) - return; - - if ((uint)aurEff.GetAmount() >= owner.GetHealth()) - if (xt002.GetAI() != null) - xt002.GetAI().SetData(XT002Data.GravityBombCasualty, 1); - } - - public override void Register() - { - OnEffectPeriodic.Add(new EffectPeriodicHandler(OnPeriodic, 2, AuraType.PeriodicDamage)); - AfterEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.PeriodicTriggerSpell, AuraEffectHandleModes.Real)); - } - } - - [Script] - class spell_xt002_gravity_bomb_damage : SpellScript - { - void HandleScript(uint eff) - { - Unit caster = GetCaster(); - if (!caster) - return; - - if ((uint)GetHitDamage() >= GetHitUnit().GetHealth()) - if (caster.GetAI() != null) - caster.GetAI().SetData(XT002Data.GravityBombCasualty, 1); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.SchoolDamage)); - } - } - - [Script] - class spell_xt002_heart_overload_periodic : SpellScript - { - public override bool Validate(SpellInfo spell) - { - return ValidateSpellInfo(SpellIds.EnergyOrb, SpellIds.RechargeBoombot, SpellIds.RechargePummeler, SpellIds.RechargeScrapbot); - } - - void HandleScript(uint effIndex) - { - Unit caster = GetCaster(); - if (caster) - { - InstanceScript instance = caster.GetInstanceScript(); - if (instance != null) - { - Unit toyPile = Global.ObjAccessor.GetUnit(caster, instance.GetGuidData(InstanceData.ToyPile0 + RandomHelper.URand(0, 3))); - if (toyPile) - { - caster.CastSpell(toyPile, SpellIds.EnergyOrb, true); - - // This should probably be incorporated in a dummy effect handler, but I've had trouble getting the correct target - // Weighed randomization (approximation) - uint[] spells = { SpellIds.RechargeScrapbot, SpellIds.RechargeScrapbot, SpellIds.RechargeScrapbot, SpellIds.RechargePummeler, SpellIds.RechargeBoombot }; - - for (byte i = 0; i < 5; ++i) - { - uint spellId = spells[RandomHelper.IRand(0, 4)]; - toyPile.CastSpell(toyPile, spellId, true, null, null, instance.GetGuidData(BossIds.Xt002)); - } - } - } - - Creature creatureBase = caster.GetVehicleCreatureBase(); - if (creatureBase) - creatureBase.GetAI().Talk(Texts.Summon); - } - } - - public override void Register() - { - OnEffectHit.Add(new EffectHandler(HandleScript, 0, SpellEffectName.Dummy)); - } - } - - [Script] - class spell_xt002_tympanic_tantrum : SpellScript - { - void FilterTargets(List targets) - { - targets.RemoveAll(new PlayerOrPetCheck()); - } - - void RecalculateDamage() - { - SetHitDamage((int)GetHitUnit().CountPctFromMaxHealth(GetHitDamage())); - } - - public override void Register() - { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEnemy)); - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 1, Targets.UnitSrcAreaEnemy)); - OnHit.Add(new HitHandler(RecalculateDamage)); - } - } - - [Script] - class spell_xt002_submerged : SpellScript - { - void HandleScript(uint eff) - { - Creature target = GetHitCreature(); - if (!target) - return; - - target.AddUnitFlag(UnitFlags.NotSelectable); - target.SetStandState(UnitStandStateType.Submerged); - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); - } - } - - [Script] - class spell_xt002_321_boombot_aura : AuraScript - { - public override bool Validate(SpellInfo spellInfo) - { - return ValidateSpellInfo(SpellIds.AchievementCreditNerfScrapbots); - } - - bool CheckProc(ProcEventInfo eventInfo) - { - if (eventInfo.GetActionTarget().GetEntry() != InstanceCreatureIds.XS013Scrapbot) - return false; - return true; - } - - void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo) - { - InstanceScript instance = eventInfo.GetActor().GetInstanceScript(); - if (instance == null) - return; - - instance.DoCastSpellOnPlayers(SpellIds.AchievementCreditNerfScrapbots); - } - - public override void Register() - { - DoCheckProc.Add(new CheckProcHandler(CheckProc)); - OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.Dummy)); - } - } - - [Script] - class achievement_nerf_engineering : AchievementCriteriaScript - { - public achievement_nerf_engineering() : base("achievement_nerf_engineering") { } - - public override bool OnCheck(Player source, Unit target) - { - if (!target || target.GetAI() == null) - return false; - - return target.GetAI().GetData(XT002Data.HealthRecovered) == 0; - } - } - - [Script] - class achievement_heartbreaker : AchievementCriteriaScript - { - public achievement_heartbreaker() : base("achievement_heartbreaker") { } - - public override bool OnCheck(Player source, Unit target) - { - if (!target || target.GetAI() == null) - return false; - - return target.GetAI().GetData(XT002Data.HardMode) != 0; - } - } - - [Script] - class achievement_nerf_gravity_bombs : AchievementCriteriaScript - { - public achievement_nerf_gravity_bombs() : base("achievement_nerf_gravity_bombs") { } - - public override bool OnCheck(Player source, Unit target) - { - if (!target || target.GetAI() == null) - return false; - - return target.GetAI().GetData(XT002Data.GravityBombCasualty) == 0; - } - } -} diff --git a/Source/Scripts/Northrend/Ulduar/YoggSaron.cs b/Source/Scripts/Northrend/Ulduar/YoggSaron.cs deleted file mode 100644 index dcbc7488f..000000000 --- a/Source/Scripts/Northrend/Ulduar/YoggSaron.cs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Game.Entities; - -namespace Scripts.Northrend.Ulduar -{ - class YoggSaron - { - public static Position[] ObservationRingKeepersPos = - { - new Position(1945.682f, 33.34201f, 411.4408f, 5.270895f), // Freya - new Position(1945.761f, -81.52171f, 411.4407f, 1.029744f), // Hodir - new Position(2028.822f, -65.73573f, 411.4426f, 2.460914f), // Thorim - new Position(2028.766f, 17.42014f, 411.4446f, 3.857178f), // Mimiron - }; - public static Position[] YSKeepersPos = - { - new Position(2036.873f, 25.42513f, 338.4984f, 3.909538f), // Freya - new Position(1939.045f, -90.87457f, 338.5426f, 0.994837f), // Hodir - new Position(1939.148f, 42.49035f, 338.5427f, 5.235988f), // Thorim - new Position(2036.658f, -73.58822f, 338.4985f, 2.460914f), // Mimiron - }; - } -} diff --git a/Source/Scripts/Northrend/VioletHold/VioletHold.cs b/Source/Scripts/Northrend/VioletHold/VioletHold.cs deleted file mode 100644 index 36e332a58..000000000 --- a/Source/Scripts/Northrend/VioletHold/VioletHold.cs +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -namespace Scripts.Northrend.VioletHold -{ - -} diff --git a/Source/Scripts/Northrend/WinterGrasp.cs b/Source/Scripts/Northrend/WinterGrasp.cs deleted file mode 100644 index 80da0f9a2..000000000 --- a/Source/Scripts/Northrend/WinterGrasp.cs +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.BattleFields; -using Game.Conditions; -using Game.Entities; -using Game.Scripting; - -namespace Scripts.Northrend -{ - [Script] - class spell_wintergrasp_defender_teleport : SpellScript - { - SpellCastResult CheckCast() - { - BattleField wg = Global.BattleFieldMgr.GetBattlefieldByBattleId(1); - if (wg != null) - { - Player target = GetExplTargetUnit().ToPlayer(); - if (target) - // check if we are in Wintergrasp at all, SotA uses same teleport spells - if ((target.GetZoneId() == 4197 && target.GetTeamId() != wg.GetDefenderTeam()) || target.HasAura(54643)) - return SpellCastResult.BadTargets; - } - - return SpellCastResult.SpellCastOk; - } - - public override void Register() - { - OnCheckCast.Add(new CheckCastHandler(CheckCast)); - } - } - - [Script] - class spell_wintergrasp_defender_teleport_trigger : SpellScript - { - void HandleDummy(uint effindex) - { - Unit target = GetHitUnit(); - if (target) - { - WorldLocation loc = target.GetWorldLocation(); - SetExplTargetDest(loc); - } - } - - public override void Register() - { - OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); - } - } - - [Script] - class condition_is_wintergrasp_horde : ConditionScript - { - public condition_is_wintergrasp_horde() : base("condition_is_wintergrasp_horde") { } - - public override bool OnConditionCheck(Condition condition, ConditionSourceInfo sourceInfo) - { - BattleField wintergrasp = Global.BattleFieldMgr.GetBattlefieldByBattleId(BattlefieldIds.WG); - if (wintergrasp.IsEnabled() && wintergrasp.GetDefenderTeam() == TeamId.Horde) - return true; - return false; - } - } - - [Script] - class condition_is_wintergrasp_alliance : ConditionScript - { - public condition_is_wintergrasp_alliance() : base("condition_is_wintergrasp_alliance") { } - - public override bool OnConditionCheck(Condition condition, ConditionSourceInfo sourceInfo) - { - BattleField wintergrasp = Global.BattleFieldMgr.GetBattlefieldByBattleId(BattlefieldIds.WG); - if (wintergrasp.IsEnabled() && wintergrasp.GetDefenderTeam() == TeamId.Alliance) - return true; - return false; - } - } -} diff --git a/Source/Scripts/Outlands/HellfirePeninsula.cs b/Source/Scripts/Outlands/HellfirePeninsula.cs deleted file mode 100644 index af4124259..000000000 --- a/Source/Scripts/Outlands/HellfirePeninsula.cs +++ /dev/null @@ -1,301 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game; -using Game.AI; -using Game.Entities; -using Game.Scripting; - -namespace Scripts.Outlands -{ - struct Aeranas - { - public const uint SaySummon = 0; - public const uint SayFree = 1; - - public const uint FactionHostile = 16; - public const uint FactionFriendly = 35; - - public const uint SpellEncelopingWinds = 15535; - public const uint SpellShock = 12553; - } - - [Script] - class npc_aeranas : ScriptedAI - { - public npc_aeranas(Creature creature) : base(creature) { } - - public override void Reset() - { - faction_Timer = 8000; - envelopingWinds_Timer = 9000; - shock_Timer = 5000; - - me.RemoveNpcFlag(NPCFlags.QuestGiver); - me.SetFaction(Aeranas.FactionFriendly); - - Talk(Aeranas.SaySummon); - } - - public override void UpdateAI(uint diff) - { - if (faction_Timer != 0) - { - if (faction_Timer <= diff) - { - me.SetFaction(Aeranas.FactionHostile); - faction_Timer = 0; - } - else - faction_Timer -= diff; - } - - if (!UpdateVictim()) - return; - - if (HealthBelowPct(30)) - { - me.SetFaction(Aeranas.FactionFriendly); - me.AddNpcFlag(NPCFlags.QuestGiver); - me.RemoveAllAuras(); - me.GetThreatManager().ClearAllThreat(); - me.CombatStop(true); - Talk(Aeranas.SayFree); - return; - } - - if (shock_Timer <= diff) - { - DoCastVictim(Aeranas.SpellShock); - shock_Timer = 10000; - } - else - shock_Timer -= diff; - - if (envelopingWinds_Timer <= diff) - { - DoCastVictim(Aeranas.SpellEncelopingWinds); - envelopingWinds_Timer = 25000; - } - else - envelopingWinds_Timer -= diff; - - DoMeleeAttackIfReady(); - } - - uint faction_Timer; - uint envelopingWinds_Timer; - uint shock_Timer; - } - - struct AncestralWolf - { - public const uint EmoteWoldLiftHead = 0; - public const uint EmoteWolfHowl = 1; - public const uint SayWolfWelcome = 2; - - public const uint SpellAncestralWoldBuff = 29981; - - public const uint NpcRyga = 17123; - } - - [Script] - class npc_ancestral_wolf : EscortAI - { - public npc_ancestral_wolf(Creature creature) : base(creature) - { - if (creature.GetOwner() && creature.GetOwner().IsTypeId(TypeId.Player)) - Start(false, false, creature.GetOwner().GetGUID()); - else - Log.outError(LogFilter.Scripts, "Scripts: npc_ancestral_wolf can not obtain owner or owner is not a player."); - - creature.SetSpeed(UnitMoveType.Walk, 1.5f); - Reset(); - } - - public override void Reset() - { - ryga = null; - DoCast(me, AncestralWolf.SpellAncestralWoldBuff, true); - } - - public override void MoveInLineOfSight(Unit who) - { - if (!ryga && who.GetEntry() == AncestralWolf.NpcRyga && me.IsWithinDistInMap(who, 15.0f)) - { - Creature temp = who.ToCreature(); - if (temp) - ryga = temp; - } - - base.MoveInLineOfSight(who); - } - - public override void WaypointReached(uint waypointId, uint pathId) - { - switch (waypointId) - { - case 0: - Talk(AncestralWolf.EmoteWoldLiftHead); - break; - case 2: - Talk(AncestralWolf.EmoteWolfHowl); - break; - case 50: - if (ryga && ryga.IsAlive() && !ryga.IsInCombat()) - ryga.GetAI().Talk(AncestralWolf.SayWolfWelcome); - break; - } - } - - Creature ryga; - } - - [Script] - class npc_wounded_blood_elf : EscortAI - { - public npc_wounded_blood_elf(Creature creature) : base(creature) { } - - public override void Reset() { } - - public override void EnterCombat(Unit who) - { - if (HasEscortState(EscortState.Escorting)) - Talk(SAY_ELF_AGGRO); - } - - public override void JustSummoned(Creature summoned) - { - summoned.GetAI().AttackStart(me); - } - - public override void QuestAccept(Player player, Quest quest) - { - if (quest.Id == QUEST_ROAD_TO_FALCON_WATCH) - { - me.SetFaction(FACTION_FALCON_WATCH_QUEST); - Start(true, false, player.GetGUID()); - } - } - - public override void WaypointReached(uint waypointId, uint pathId) - { - Player player = GetPlayerForEscort(); - if (!player) - return; - - switch (waypointId) - { - case 0: - Talk(SAY_ELF_START, player); - break; - case 9: - Talk(SAY_ELF_SUMMON1, player); - // Spawn two Haal'eshi Talonguard - DoSpawnCreature(NPC_HAALESHI_TALONGUARD, -15, -15, 0, 0, TempSummonType.TimedDespawnOOC, 5000); - DoSpawnCreature(NPC_HAALESHI_TALONGUARD, -17, -17, 0, 0, TempSummonType.TimedDespawnOOC, 5000); - break; - case 13: - Talk(SAY_ELF_RESTING, player); - break; - case 14: - Talk(SAY_ELF_SUMMON2, player); - // Spawn two Haal'eshi Windwalker - DoSpawnCreature(NPC_HAALESHI_WINDWALKER, -15, -15, 0, 0, TempSummonType.TimedDespawnOOC, 5000); - DoSpawnCreature(NPC_HAALESHI_WINDWALKER, -17, -17, 0, 0, TempSummonType.TimedDespawnOOC, 5000); - break; - case 27: - Talk(SAY_ELF_COMPLETE, player); - // Award quest credit - player.GroupEventHappens(QUEST_ROAD_TO_FALCON_WATCH, me); - break; - } - } - - const uint SAY_ELF_START = 0; - const uint SAY_ELF_SUMMON1 = 1; - const uint SAY_ELF_RESTING = 2; - const uint SAY_ELF_SUMMON2 = 3; - const uint SAY_ELF_COMPLETE = 4; - const uint SAY_ELF_AGGRO = 5; - const uint QUEST_ROAD_TO_FALCON_WATCH = 9375; - const uint NPC_HAALESHI_WINDWALKER = 16966; - const uint NPC_HAALESHI_TALONGUARD = 16967; - const uint FACTION_FALCON_WATCH_QUEST = 775; - } - - - [Script] - class npc_fel_guard_hound : ScriptedAI - { - public npc_fel_guard_hound(Creature creature) : base(creature) { } - - public override void Reset() - { - checkTimer = 5000; //check for creature every 5 sec - helboarGUID.Clear(); - } - - public override void MovementInform(MovementGeneratorType type, uint id) - { - if (type != MovementGeneratorType.Point || id != 1) - return; - - Creature helboar = me.GetMap().GetCreature(helboarGUID); - if (helboar) - { - helboar.RemoveCorpse(); - DoCast(SPELL_SUMMON_POO); - - Player owner = me.GetCharmerOrOwnerPlayerOrPlayerItself(); - if (owner) - me.GetMotionMaster().MoveFollow(owner, 0.0f, 0.0f); - } - } - - public override void UpdateAI(uint diff) - { - if (checkTimer <= diff) - { - Creature helboar = me.FindNearestCreature(NPC_DERANGED_HELBOAR, 10.0f, false); - if (helboar) - { - if (helboar.GetGUID() != helboarGUID && me.GetMotionMaster().GetCurrentMovementGeneratorType() != MovementGeneratorType.Point && !me.FindCurrentSpellBySpellId(SPELL_SUMMON_POO)) - { - helboarGUID = helboar.GetGUID(); - me.GetMotionMaster().MovePoint(1, helboar.GetPositionX(), helboar.GetPositionY(), helboar.GetPositionZ()); - } - } - checkTimer = 5000; - } - else checkTimer -= diff; - - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); - } - - uint checkTimer; - ObjectGuid helboarGUID; - - const uint SPELL_SUMMON_POO = 37688; - const uint NPC_DERANGED_HELBOAR = 16863; - } -} - diff --git a/Source/Scripts/Outlands/Zangarmarsh.cs b/Source/Scripts/Outlands/Zangarmarsh.cs deleted file mode 100644 index f02684eb3..000000000 --- a/Source/Scripts/Outlands/Zangarmarsh.cs +++ /dev/null @@ -1,354 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game; -using Game.AI; -using Game.Entities; -using Game.Scripting; -using System.Collections.Generic; - -namespace Scripts.Outlands -{ - [Script] - class npcs_ashyen_and_keleth : CreatureScript - { - public npcs_ashyen_and_keleth() : base("npcs_ashyen_and_keleth") { } - - class npcs_ashyen_and_kelethAI : ScriptedAI - { - public npcs_ashyen_and_kelethAI(Creature creature) : base(creature) { } - - public override bool GossipHello(Player player) - { - if (player.GetReputationRank(942) > ReputationRank.Neutral) - { - if (me.GetEntry() == NPC_ASHYEN) - player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GOSSIP_ITEM_BLESS_ASH, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1); - - if (me.GetEntry() == NPC_KELETH) - player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GOSSIP_ITEM_BLESS_KEL, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1); - } - player.SEND_GOSSIP_MENU(player.GetGossipTextId(me), me.GetGUID()); - - return true; - } - - public override bool GossipSelect(Player player, uint menuId, uint gossipListId) - { - uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId); - player.PlayerTalkClass.ClearMenus(); - if (action == eTradeskill.GossipActionInfoDef + 1) - { - me.SetPowerType(PowerType.Mana); - me.SetMaxPower(PowerType.Mana, 200); //set a "fake" mana value, we can't depend on database doing it in this case - me.SetPower(PowerType.Mana, 200); - - if (me.GetEntry() == NPC_ASHYEN) //check which Creature we are dealing with - { - uint spell = 0; - switch (player.GetReputationRank(942)) - { //mark of lore - case ReputationRank.Friendly: - spell = SPELL_BLESS_ASH_FRI; - break; - case ReputationRank.Honored: - spell = SPELL_BLESS_ASH_HON; - break; - case ReputationRank.Revered: - spell = SPELL_BLESS_ASH_REV; - break; - case ReputationRank.Exalted: - spell = SPELL_BLESS_ASH_EXA; - break; - default: - break; - } - - if (spell != 0) - { - DoCast(player, spell, true); - me.GetAI().Talk(GOSSIP_REWARD_BLESS); - } - } - - if (me.GetEntry() == NPC_KELETH) - { - uint spell = 0; - switch (player.GetReputationRank(942)) //mark of war - { - case ReputationRank.Friendly: - spell = SPELL_BLESS_KEL_FRI; - break; - case ReputationRank.Honored: - spell = SPELL_BLESS_KEL_HON; - break; - case ReputationRank.Revered: - spell = SPELL_BLESS_KEL_REV; - break; - case ReputationRank.Exalted: - spell = SPELL_BLESS_KEL_EXA; - break; - default: - break; - } - - if (spell != 0) - { - DoCast(player, spell, true); - me.GetAI().Talk(GOSSIP_REWARD_BLESS); - } - } - player.CLOSE_GOSSIP_MENU(); - player.TalkedToCreature(me.GetEntry(), me.GetGUID()); - } - return true; - } - - const uint GOSSIP_REWARD_BLESS = 0; - - const uint NPC_ASHYEN = 17900; - const uint NPC_KELETH = 17901; - - const uint SPELL_BLESS_ASH_EXA = 31815; - const uint SPELL_BLESS_ASH_REV = 31811; - const uint SPELL_BLESS_ASH_HON = 31810; - const uint SPELL_BLESS_ASH_FRI = 31808; - - const uint SPELL_BLESS_KEL_EXA = 31814; - const uint SPELL_BLESS_KEL_REV = 31813; - const uint SPELL_BLESS_KEL_HON = 31812; - const uint SPELL_BLESS_KEL_FRI = 31807; - - const string GOSSIP_ITEM_BLESS_ASH = "Grant me your mark, wise ancient."; - const string GOSSIP_ITEM_BLESS_KEL = "Grant me your mark, mighty ancient."; - } - - public override CreatureAI GetAI(Creature creature) - { - return new npcs_ashyen_and_kelethAI(creature); - } - } - - [Script] - class npc_cooshcoosh : CreatureScript - { - public npc_cooshcoosh() : base("npc_cooshcoosh") { } - - class npc_cooshcooshAI : ScriptedAI - { - public npc_cooshcooshAI(Creature creature) : base(creature) - { - m_uiNormFaction = creature.GetFaction(); - } - - uint m_uiNormFaction; - - public override void Reset() - { - _events.ScheduleEvent(Event_LightningBolt, 2000); - if (me.GetFaction() != m_uiNormFaction) - me.SetFaction(m_uiNormFaction); - } - - public override void EnterCombat(Unit who) { } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - _events.Update(diff); - - _events.ExecuteEvents(id => - { - DoCastVictim(SPELL_LIGHTNING_BOLT); - _events.ScheduleEvent(Event_LightningBolt, 5000); - }); - - DoMeleeAttackIfReady(); - } - - public override bool GossipHello(Player player) - { - if (player.GetQuestStatus(QUEST_CRACK_SKULLS) == QuestStatus.Incomplete) - player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GOSSIP_COOSH, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef); - - player.SEND_GOSSIP_MENU(9441, me.GetGUID()); - return true; - } - - public override bool GossipSelect(Player player, uint menuId, uint gossipListId) - { - uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId); - player.PlayerTalkClass.ClearMenus(); - if (action == eTradeskill.GossipActionInfoDef) - { - player.CLOSE_GOSSIP_MENU(); - me.SetFaction(FACTION_HOSTILE_CO); - me.GetAI().AttackStart(player); - } - return true; - } - } - - public override CreatureAI GetAI(Creature creature) - { - return new npc_cooshcooshAI(creature); - } - - const uint SPELL_LIGHTNING_BOLT = 9532; - const uint QUEST_CRACK_SKULLS = 10009; - const uint FACTION_HOSTILE_CO = 45; - const int Event_LightningBolt = 1; - - const string GOSSIP_COOSH = "You owe Sim'salabim money. Hand them over or die!"; - } - - [Script] - class npc_elder_kuruti : CreatureScript - { - public npc_elder_kuruti() : base("npc_elder_kuruti") { } - - class npc_elder_kurutiAI : ScriptedAI - { - public npc_elder_kurutiAI(Creature creature) : base(creature) { } - - public override bool GossipHello(Player player) - { - if (player.GetQuestStatus(9803) == QuestStatus.Incomplete) - player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GOSSIP_ITEM_KUR1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef); - - player.SEND_GOSSIP_MENU(9226, me.GetGUID()); - return true; - } - - public override bool GossipSelect(Player player, uint menuId, uint gossipListId) - { - uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId); - player.PlayerTalkClass.ClearMenus(); - switch (action) - { - case eTradeskill.GossipActionInfoDef: - player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GOSSIP_ITEM_KUR2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1); - player.SEND_GOSSIP_MENU(9227, me.GetGUID()); - break; - case eTradeskill.GossipActionInfoDef + 1: - player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GOSSIP_ITEM_KUR3, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2); - player.SEND_GOSSIP_MENU(9229, me.GetGUID()); - break; - case eTradeskill.GossipActionInfoDef + 2: - { - if (!player.HasItemCount(24573)) - { - List dest = new List(); - uint itemId = 24573; - uint temp; - InventoryResult msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, itemId, 1, out temp); - if (msg == InventoryResult.Ok) - { - player.StoreNewItem(dest, itemId, true); - } - else - player.SendEquipError(msg, null, null, itemId); - } - player.SEND_GOSSIP_MENU(9231, me.GetGUID()); - break; - } - } - return true; - } - - const string GOSSIP_ITEM_KUR1 = "Greetings, elder. It is time for your people to end their hostility towards the draenei and their allies."; - const string GOSSIP_ITEM_KUR2 = "I did not mean to deceive you, elder. The draenei of Telredor thought to approach you in a way that would seem familiar to you."; - const string GOSSIP_ITEM_KUR3 = "I will tell them. Farewell, elder."; - } - - public override CreatureAI GetAI(Creature creature) - { - return new npc_elder_kurutiAI(creature); - } - } - - [Script] - class npc_kayra_longmane : CreatureScript - { - public npc_kayra_longmane() : base("npc_kayra_longmane") { } - - class npc_kayra_longmaneAI : EscortAI - { - public npc_kayra_longmaneAI(Creature creature) : base(creature) { } - - public override void Reset() { } - - public override void WaypointReached(uint waypointId, uint pathId) - { - Player player = GetPlayerForEscort(); - if (!player) - return; - - switch (waypointId) - { - case 4: - Talk(SAY_AMBUSH1, player); - DoSpawnCreature(NPC_SLAVEBINDER, -10.0f, -5.0f, 0.0f, 0.0f, TempSummonType.TimedDespawnOOC, 30000); - DoSpawnCreature(NPC_SLAVEBINDER, -8.0f, 5.0f, 0.0f, 0.0f, TempSummonType.TimedDespawnOOC, 30000); - break; - case 5: - Talk(SAY_PROGRESS, player); - SetRun(); - break; - case 16: - Talk(SAY_AMBUSH2, player); - DoSpawnCreature(NPC_SLAVEBINDER, -10.0f, -5.0f, 0.0f, 0.0f, TempSummonType.TimedDespawnOOC, 30000); - DoSpawnCreature(NPC_SLAVEBINDER, -8.0f, 5.0f, 0.0f, 0.0f, TempSummonType.TimedDespawnOOC, 30000); - break; - case 17: - SetRun(false); - break; - case 25: - Talk(SAY_END, player); - player.GroupEventHappens(QUEST_ESCAPE_FROM, me); - break; - } - } - - public override void QuestAccept(Player player, Quest quest) - { - if (quest.Id == QUEST_ESCAPE_FROM) - { - Talk(SAY_START, player); - Start(false, false, player.GetGUID()); - } - } - } - - public override CreatureAI GetAI(Creature creature) - { - return new npc_kayra_longmaneAI(creature); - } - - const uint SAY_START = 0; - const uint SAY_AMBUSH1 = 1; - const uint SAY_PROGRESS = 2; - const uint SAY_AMBUSH2 = 3; - const uint SAY_END = 4; - - const uint QUEST_ESCAPE_FROM = 9752; - const uint NPC_SLAVEBINDER = 18042; - } -} diff --git a/Source/Scripts/Pets/DeathKinght.cs b/Source/Scripts/Pets/DeathKinght.cs deleted file mode 100644 index ecdca0480..000000000 --- a/Source/Scripts/Pets/DeathKinght.cs +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using Game.Spells; -using System; -using System.Collections.Generic; - -namespace Scripts.Pets -{ - [Script] - class npc_pet_dk_ebon_gargoyle : CasterAI - { - public npc_pet_dk_ebon_gargoyle(Creature creature) : base(creature) { } - - public override void InitializeAI() - { - base.InitializeAI(); - ObjectGuid ownerGuid = me.GetOwnerGUID(); - if (ownerGuid.IsEmpty()) - return; - - // Find victim of Summon Gargoyle spell - List targets = new List(); - var u_check = new AnyUnfriendlyUnitInObjectRangeCheck(me, me, 30.0f); - var searcher = new UnitListSearcher(me, targets, u_check); - Cell.VisitAllObjects(me, searcher, 30.0f); - foreach (var iter in targets) - { - if (iter.GetAura(SpellSummonGargoyle1, ownerGuid) != null) - { - me.Attack(iter, false); - break; - } - } - } - - public override void JustDied(Unit killer) - { - // Stop Feeding Gargoyle when it dies - Unit owner = me.GetOwner(); - if (owner) - owner.RemoveAurasDueToSpell(SpellSummonGargoyle2); - } - - // Fly away when dismissed - public override void SpellHit(Unit source, SpellInfo spell) - { - if (spell.Id != SpellDismissGargoyle || !me.IsAlive()) - return; - - Unit owner = me.GetOwner(); - if (!owner || owner != source) - return; - - // Stop Fighting - me.AddUnitFlag(UnitFlags.NonAttackable); - - // Sanctuary - me.CastSpell(me, SpellSanctuary, true); - me.SetReactState(ReactStates.Passive); - - //! HACK: Creature's can't have MOVEMENTFLAG_FLYING - // Fly Away - me.SetCanFly(true); - me.SetSpeedRate(UnitMoveType.Flight, 0.75f); - me.SetSpeedRate(UnitMoveType.Run, 0.75f); - float x = me.GetPositionX() + 20 * (float)Math.Cos(me.GetOrientation()); - float y = me.GetPositionY() + 20 * (float)Math.Sin(me.GetOrientation()); - float z = me.GetPositionZ() + 40; - me.GetMotionMaster().Clear(false); - me.GetMotionMaster().MovePoint(0, x, y, z); - - // Despawn as soon as possible - me.DespawnOrUnsummon(4 * Time.InMilliseconds); - } - - const uint SpellSummonGargoyle1 = 49206; - const uint SpellSummonGargoyle2 = 50514; - const uint SpellDismissGargoyle = 50515; - const uint SpellSanctuary = 54661; - } - - [Script] - class npc_pet_dk_guardian : AggressorAI - { - public npc_pet_dk_guardian(Creature creature) : base(creature) { } - - public override bool CanAIAttack(Unit target) - { - if (!target) - return false; - Unit owner = me.GetOwner(); - if (owner && !target.IsInCombatWith(owner)) - return false; - return base.CanAIAttack(target); - } - } -} diff --git a/Source/Scripts/Pets/DeathKnight.cs b/Source/Scripts/Pets/DeathKnight.cs new file mode 100644 index 000000000..4b3c3ec67 --- /dev/null +++ b/Source/Scripts/Pets/DeathKnight.cs @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2012-2020 CypherCore + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +using Framework.Constants; +using Game.AI; +using Game.Entities; +using Game.Maps; +using Game.Scripting; +using Game.Spells; +using System; +using System.Collections.Generic; + +namespace Scripts.Pets +{ + namespace DeathKnight + { + struct SpellIds + { + public const uint SummonGargoyle1 = 49206; + public const uint SummonGargoyle2 = 50514; + public const uint DismissGargoyle = 50515; + public const uint Sanctuary = 54661; + } + + [Script] + class npc_pet_dk_ebon_gargoyle : CasterAI + { + public npc_pet_dk_ebon_gargoyle(Creature creature) : base(creature) { } + + public override void InitializeAI() + { + base.InitializeAI(); + ObjectGuid ownerGuid = me.GetOwnerGUID(); + if (ownerGuid.IsEmpty()) + return; + + // Find victim of Summon Gargoyle spell + List targets = new List(); + var u_check = new AnyUnfriendlyUnitInObjectRangeCheck(me, me, 30.0f); + var searcher = new UnitListSearcher(me, targets, u_check); + Cell.VisitAllObjects(me, searcher, 30.0f); + foreach (var iter in targets) + { + if (iter.GetAura(SpellIds.SummonGargoyle1, ownerGuid) != null) + { + me.Attack(iter, false); + break; + } + } + } + + public override void JustDied(Unit killer) + { + // Stop Feeding Gargoyle when it dies + Unit owner = me.GetOwner(); + if (owner) + owner.RemoveAurasDueToSpell(SpellIds.SummonGargoyle2); + } + + // Fly away when dismissed + public override void SpellHit(Unit source, SpellInfo spell) + { + if (spell.Id != SpellIds.DismissGargoyle || !me.IsAlive()) + return; + + Unit owner = me.GetOwner(); + if (!owner || owner != source) + return; + + // Stop Fighting + me.AddUnitFlag(UnitFlags.NonAttackable); + + // Sanctuary + me.CastSpell(me, SpellIds.Sanctuary, true); + me.SetReactState(ReactStates.Passive); + + //! HACK: Creature's can't have MOVEMENTFLAG_FLYING + // Fly Away + me.SetCanFly(true); + me.SetSpeedRate(UnitMoveType.Flight, 0.75f); + me.SetSpeedRate(UnitMoveType.Run, 0.75f); + float x = me.GetPositionX() + 20 * (float)Math.Cos(me.GetOrientation()); + float y = me.GetPositionY() + 20 * (float)Math.Sin(me.GetOrientation()); + float z = me.GetPositionZ() + 40; + me.GetMotionMaster().Clear(false); + me.GetMotionMaster().MovePoint(0, x, y, z); + + // Despawn as soon as possible + me.DespawnOrUnsummon(4 * Time.InMilliseconds); + } + + + } + + [Script] + class npc_pet_dk_guardian : AggressorAI + { + public npc_pet_dk_guardian(Creature creature) : base(creature) { } + + public override bool CanAIAttack(Unit target) + { + if (!target) + return false; + Unit owner = me.GetOwner(); + if (owner && !target.IsInCombatWith(owner)) + return false; + return base.CanAIAttack(target); + } + } + } +} diff --git a/Source/Scripts/Pets/Generic.cs b/Source/Scripts/Pets/Generic.cs index 7421ade4a..82d30fb76 100644 --- a/Source/Scripts/Pets/Generic.cs +++ b/Source/Scripts/Pets/Generic.cs @@ -22,54 +22,64 @@ using Game.Scripting; namespace Scripts.Pets { - [Script] - class npc_pet_gen_mojo : ScriptedAI + namespace Generic { - public npc_pet_gen_mojo(Creature creature) : base(creature) { } - - public override void Reset() + struct SpellIds { - _victimGUID.Clear(); - - Unit owner = me.GetOwner(); - if (owner) - me.GetMotionMaster().MoveFollow(owner, 0.0f, 0.0f); + public const uint FeelingFroggy = 43906; + public const uint SeductionVisual = 43919; } - public override void EnterCombat(Unit who) { } - - public override void UpdateAI(uint diff) { } - - public override void ReceiveEmote(Player player, TextEmotes emote) + struct TextIds { - me.HandleEmoteCommand((Emote)emote); - Unit owner = me.GetOwner(); - if (emote != TextEmotes.Kiss || !owner || !owner.IsTypeId(TypeId.Player) || - owner.ToPlayer().GetTeam() != player.GetTeam()) - { - return; - } - - Talk(SayMojo, player); - - if (!_victimGUID.IsEmpty()) - { - Player victim = Global.ObjAccessor.GetPlayer(me, _victimGUID); - if (victim) - victim.RemoveAura(SpellFeelingFroggy); - } - - _victimGUID = player.GetGUID(); - - DoCast(player, SpellFeelingFroggy, true); - DoCast(me, SpellSeductionVisual, true); - me.GetMotionMaster().MoveFollow(player, 0.0f, 0.0f); + public const uint SayMojo = 0; } - ObjectGuid _victimGUID; + [Script] + class npc_pet_gen_mojo : ScriptedAI + { + public npc_pet_gen_mojo(Creature creature) : base(creature) { } - const uint SayMojo = 0; - const uint SpellFeelingFroggy = 43906; - const uint SpellSeductionVisual = 43919; + public override void Reset() + { + _victimGUID.Clear(); + + Unit owner = me.GetOwner(); + if (owner) + me.GetMotionMaster().MoveFollow(owner, 0.0f, 0.0f); + } + + public override void EnterCombat(Unit who) { } + + public override void UpdateAI(uint diff) { } + + public override void ReceiveEmote(Player player, TextEmotes emote) + { + me.HandleEmoteCommand((Emote)emote); + Unit owner = me.GetOwner(); + if (emote != TextEmotes.Kiss || !owner || !owner.IsTypeId(TypeId.Player) || + owner.ToPlayer().GetTeam() != player.GetTeam()) + { + return; + } + + Talk(TextIds.SayMojo, player); + + if (!_victimGUID.IsEmpty()) + { + Player victim = Global.ObjAccessor.GetPlayer(me, _victimGUID); + if (victim) + victim.RemoveAura(SpellIds.FeelingFroggy); + } + + _victimGUID = player.GetGUID(); + + DoCast(player, SpellIds.FeelingFroggy, true); + DoCast(me, SpellIds.SeductionVisual, true); + me.GetMotionMaster().MoveFollow(player, 0.0f, 0.0f); + } + + ObjectGuid _victimGUID; + } } } diff --git a/Source/Scripts/Pets/Hunter.cs b/Source/Scripts/Pets/Hunter.cs index 210a1392f..433bc7697 100644 --- a/Source/Scripts/Pets/Hunter.cs +++ b/Source/Scripts/Pets/Hunter.cs @@ -22,96 +22,106 @@ using Game.Scripting; namespace Scripts.Pets { - [Script] - class npc_pet_hunter_snake_trap : ScriptedAI + namespace Hunter { - public npc_pet_hunter_snake_trap(Creature creature) : base(creature) { } - - public override void EnterCombat(Unit who) { } - - public override void Reset() + struct SpellIds { - _spellTimer = 0; + public const uint CripplingPoison = 30981; // Viper + public const uint DeadlyPoisonPassive = 34657; // Venomous Snake + public const uint MindNumbingPoison = 25810; // Viper - CreatureTemplate Info = me.GetCreatureTemplate(); - - _isViper = Info.Entry == NpcViper ? true : false; - - me.SetMaxHealth((uint)(107 * (me.GetLevel() - 40) * 0.025f)); - // Add delta to make them not all hit the same time - uint delta = (RandomHelper.Rand32() % 7) * 100; - me.SetBaseAttackTime(WeaponAttackType.BaseAttack, Info.BaseAttackTime + delta); - //me.SetStatFloatValue(UnitFields.RangedAttackPower, (float)Info.AttackPower); - - // Start attacking attacker of owner on first ai update after spawn - move in line of sight may choose better target - if (!me.GetVictim() && me.IsSummon()) - { - Unit owner = me.ToTempSummon().GetSummoner(); - if (owner) - if (owner.GetAttackerForHelper()) - AttackStart(owner.GetAttackerForHelper()); - } - - if (!_isViper) - DoCast(me, SpellDeadlyPoisonPassive, true); } - // Redefined for random target selection: - public override void MoveInLineOfSight(Unit who) + struct CreatureIds { - if (!me.GetVictim() && me.CanCreatureAttack(who)) - { - if (me.GetDistanceZ(who) > SharedConst.CreatureAttackRangeZ) - return; + public const int Viper = 19921; + } - float attackRadius = me.GetAttackDistance(who); - if (me.IsWithinDistInMap(who, attackRadius) && me.IsWithinLOSInMap(who)) + [Script] + class npc_pet_hunter_snake_trap : ScriptedAI + { + public npc_pet_hunter_snake_trap(Creature creature) : base(creature) { } + + public override void EnterCombat(Unit who) { } + + public override void Reset() + { + _spellTimer = 0; + + CreatureTemplate Info = me.GetCreatureTemplate(); + + _isViper = Info.Entry == CreatureIds.Viper ? true : false; + + me.SetMaxHealth((uint)(107 * (me.GetLevel() - 40) * 0.025f)); + // Add delta to make them not all hit the same time + uint delta = (RandomHelper.Rand32() % 7) * 100; + me.SetBaseAttackTime(WeaponAttackType.BaseAttack, Info.BaseAttackTime + delta); + //me.SetStatFloatValue(UnitFields.RangedAttackPower, (float)Info.AttackPower); + + // Start attacking attacker of owner on first ai update after spawn - move in line of sight may choose better target + if (!me.GetVictim() && me.IsSummon()) { - if ((RandomHelper.Rand32() % 5) == 0) + Unit owner = me.ToTempSummon().GetSummoner(); + if (owner) + if (owner.GetAttackerForHelper()) + AttackStart(owner.GetAttackerForHelper()); + } + + if (!_isViper) + DoCast(me, SpellIds.DeadlyPoisonPassive, true); + } + + // Redefined for random target selection: + public override void MoveInLineOfSight(Unit who) + { + if (!me.GetVictim() && me.CanCreatureAttack(who)) + { + if (me.GetDistanceZ(who) > SharedConst.CreatureAttackRangeZ) + return; + + float attackRadius = me.GetAttackDistance(who); + if (me.IsWithinDistInMap(who, attackRadius) && me.IsWithinLOSInMap(who)) { - me.SetAttackTimer(WeaponAttackType.BaseAttack, (RandomHelper.Rand32() % 10) * 100); - _spellTimer = (RandomHelper.Rand32() % 10) * 100; - AttackStart(who); + if ((RandomHelper.Rand32() % 5) == 0) + { + me.SetAttackTimer(WeaponAttackType.BaseAttack, (RandomHelper.Rand32() % 10) * 100); + _spellTimer = (RandomHelper.Rand32() % 10) * 100; + AttackStart(who); + } } } } - } - public override void UpdateAI(uint diff) - { - if (!UpdateVictim() || !me.GetVictim()) - return; - - if (me.GetVictim().HasBreakableByDamageCrowdControlAura(me)) + public override void UpdateAI(uint diff) { - me.InterruptNonMeleeSpells(false); - return; - } + if (!UpdateVictim() || !me.GetVictim()) + return; - //Viper - if (_isViper) - { - if (_spellTimer <= diff) + if (me.GetVictim().HasBreakableByDamageCrowdControlAura(me)) { - if (RandomHelper.IRand(0, 2) == 0) //33% chance to cast - DoCastVictim(RandomHelper.RAND(SpellMindNumbingPoison, SpellCripplingPoison)); - - _spellTimer = 3000; + me.InterruptNonMeleeSpells(false); + return; } - else - _spellTimer -= diff; + + //Viper + if (_isViper) + { + if (_spellTimer <= diff) + { + if (RandomHelper.IRand(0, 2) == 0) //33% chance to cast + DoCastVictim(RandomHelper.RAND(SpellIds.MindNumbingPoison, SpellIds.CripplingPoison)); + + _spellTimer = 3000; + } + else + _spellTimer -= diff; + } + + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); + bool _isViper; + uint _spellTimer; } - - bool _isViper; - uint _spellTimer; - - const uint SpellCripplingPoison = 30981; // Viper - const uint SpellDeadlyPoisonPassive = 34657; // Venomous Snake - const uint SpellMindNumbingPoison = 25810; // Viper - - const int NpcViper = 19921; } } diff --git a/Source/Scripts/Pets/Mage.cs b/Source/Scripts/Pets/Mage.cs index 98952ff54..b0bfba300 100644 --- a/Source/Scripts/Pets/Mage.cs +++ b/Source/Scripts/Pets/Mage.cs @@ -21,221 +21,232 @@ using Game.Entities; using Game.Maps; using Game.Scripting; using System.Collections.Generic; +using System; namespace Scripts.Pets { - struct PetMageConst + namespace Mage { - public const uint SpellCloneMe = 45204; - public const uint SpellMastersThreatList = 58838; - public const uint SpellMageFrostBolt = 59638; - public const uint SpellMageFireBlast = 59637; - - - public const uint TimerMirrorImageInit = 0; - public const uint TimerMirrorImageFrostBolt = 4000; - public const uint TimerMirrorImageFireBlast = 6000; - } - - [Script] - class npc_pet_mage_mirror_image : CasterAI - { - public npc_pet_mage_mirror_image(Creature creature) : base(creature) { } - - void Init() + struct SpellIds { - Unit owner = me.GetCharmerOrOwner(); - - List targets = new List(); - var u_check = new AnyUnfriendlyUnitInObjectRangeCheck(me, me, 30.0f); - var searcher = new UnitListSearcher(me, targets, u_check); - Cell.VisitAllObjects(me, searcher, 40.0f); - - Unit highestThreatUnit = null; - float highestThreat = 0.0f; - Unit nearestPlayer = null; - foreach (var unit in targets) - { - // Consider only units without CC - if (!unit.HasBreakableByDamageCrowdControlAura(unit)) - { - // Take first found unit - if (!highestThreatUnit && !unit.IsTypeId(TypeId.Player)) - { - highestThreatUnit = unit; - continue; - } - if (!nearestPlayer && unit.IsTypeId(TypeId.Player)) - { - nearestPlayer = unit; - continue; - } - // else compare best fit unit with current unit - var triggers = unit.GetThreatManager().GetThreatList(); - foreach (var reference in triggers) - { - // Try to find threat referenced to owner - if (reference.GetTarget() == owner) - { - // Check if best fit hostile unit hs lower threat than this current unit - if (highestThreat < reference.GetThreat()) - { - // If so, update best fit unit - highestThreat = reference.GetThreat(); - highestThreatUnit = unit; - break; - } - } - } - // In case no unit with threat was found so far, always check for nearest unit (only for players) - if (unit.IsTypeId(TypeId.Player)) - { - // If this player is closer than the previous one, update it - if (me.GetDistance(unit.GetPosition()) < me.GetDistance(nearestPlayer.GetPosition())) - nearestPlayer = unit; - } - } - } - // Prioritize units with threat referenced to owner - if (highestThreat > 0.0f && highestThreatUnit) - me.Attack(highestThreatUnit, false); - // If there is no such target, try to attack nearest hostile unit if such exists - else if (nearestPlayer) - me.Attack(nearestPlayer, false); + public const uint CloneMe = 45204; + public const uint MastersThreatList = 58838; + public const uint MageFrostBolt = 59638; + public const uint MageFireBlast = 59637; } - bool IsInThreatList(Unit target) + struct MiscConst { - Unit owner = me.GetCharmerOrOwner(); + public const uint TimerMirrorImageInit = 0; + public const uint TimerMirrorImageFrostBolt = 4000; + public const uint TimerMirrorImageFireBlast = 6000; + } - List targets = new List(); - var u_check = new AnyUnfriendlyUnitInObjectRangeCheck(me, me, 30.0f); - var searcher = new UnitListSearcher(me, targets, u_check); - Cell.VisitAllObjects(me, searcher, 40.0f); + [Script] + class npc_pet_mage_mirror_image : CasterAI + { + public npc_pet_mage_mirror_image(Creature creature) : base(creature) { } - foreach (var unit in targets) + void Init() { - if (unit == target) + Unit owner = me.GetCharmerOrOwner(); + + List targets = new List(); + var u_check = new AnyUnfriendlyUnitInObjectRangeCheck(me, me, 30.0f); + var searcher = new UnitListSearcher(me, targets, u_check); + Cell.VisitAllObjects(me, searcher, 40.0f); + + Unit highestThreatUnit = null; + float highestThreat = 0.0f; + Unit nearestPlayer = null; + foreach (var unit in targets) { // Consider only units without CC if (!unit.HasBreakableByDamageCrowdControlAura(unit)) { + // Take first found unit + if (!highestThreatUnit && !unit.IsTypeId(TypeId.Player)) + { + highestThreatUnit = unit; + continue; + } + if (!nearestPlayer && unit.IsTypeId(TypeId.Player)) + { + nearestPlayer = unit; + continue; + } + // else compare best fit unit with current unit var triggers = unit.GetThreatManager().GetThreatList(); foreach (var reference in triggers) { // Try to find threat referenced to owner if (reference.GetTarget() == owner) - return true; + { + // Check if best fit hostile unit hs lower threat than this current unit + if (highestThreat < reference.GetThreat()) + { + // If so, update best fit unit + highestThreat = reference.GetThreat(); + highestThreatUnit = unit; + break; + } + } + } + // In case no unit with threat was found so far, always check for nearest unit (only for players) + if (unit.IsTypeId(TypeId.Player)) + { + // If this player is closer than the previous one, update it + if (me.GetDistance(unit.GetPosition()) < me.GetDistance(nearestPlayer.GetPosition())) + nearestPlayer = unit; } } } - } - return false; - } - - public override void InitializeAI() - { - base.InitializeAI(); - Unit owner = me.GetOwner(); - if (!owner) - return; - - // here mirror image casts on summoner spell (not present in client dbc) 49866 - // here should be auras (not present in client dbc): 35657, 35658, 35659, 35660 selfcasted by mirror images (stats related?) - // Clone Me! - owner.CastSpell(me, PetMageConst.SpellCloneMe, false); - } - - public override void EnterCombat(Unit victim) - { - if (me.GetVictim() && !me.GetVictim().HasBreakableByDamageCrowdControlAura(me)) - { - me.CastSpell(victim, PetMageConst.SpellMageFireBlast, false); - _events.ScheduleEvent(PetMageConst.SpellMageFrostBolt, PetMageConst.TimerMirrorImageInit); - _events.ScheduleEvent(PetMageConst.SpellMageFireBlast, PetMageConst.TimerMirrorImageFireBlast); - } - else - EnterEvadeMode(EvadeReason.Other); - } - - public override void Reset() - { - _events.Reset(); - } - - public override void UpdateAI(uint diff) - { - Unit owner = me.GetCharmerOrOwner(); - if (!owner) - return; - - Unit target = owner.GetAttackerForHelper(); - - _events.Update(diff); - - // prevent CC interrupts by images - if (me.GetVictim() && me.GetVictim().HasBreakableByDamageCrowdControlAura(me)) - { - me.InterruptNonMeleeSpells(false); - return; + // Prioritize units with threat referenced to owner + if (highestThreat > 0.0f && highestThreatUnit) + me.Attack(highestThreatUnit, false); + // If there is no such target, try to attack nearest hostile unit if such exists + else if (nearestPlayer) + me.Attack(nearestPlayer, false); } - if (me.HasUnitState(UnitState.Casting)) - return; - - // assign target if image doesnt have any or the target is not actual - if (!target || me.GetVictim() != target) + bool IsInThreatList(Unit target) { - Unit ownerTarget = null; - Player owner1 = me.GetCharmerOrOwner().ToPlayer(); - if (owner1) - ownerTarget = owner1.GetSelectedUnit(); + Unit owner = me.GetCharmerOrOwner(); - // recognize which victim will be choosen - if (ownerTarget && ownerTarget.IsTypeId(TypeId.Player)) + List targets = new List(); + var u_check = new AnyUnfriendlyUnitInObjectRangeCheck(me, me, 30.0f); + var searcher = new UnitListSearcher(me, targets, u_check); + Cell.VisitAllObjects(me, searcher, 40.0f); + + foreach (var unit in targets) { - if (!ownerTarget.HasBreakableByDamageCrowdControlAura(ownerTarget)) - me.Attack(ownerTarget, false); + if (unit == target) + { + // Consider only units without CC + if (!unit.HasBreakableByDamageCrowdControlAura(unit)) + { + var triggers = unit.GetThreatManager().GetThreatList(); + foreach (var reference in triggers) + { + // Try to find threat referenced to owner + if (reference.GetTarget() == owner) + return true; + } + } + } } - else if (ownerTarget && !ownerTarget.IsTypeId(TypeId.Player) && IsInThreatList(ownerTarget)) + return false; + } + + public override void InitializeAI() + { + base.InitializeAI(); + Unit owner = me.GetOwner(); + if (!owner) + return; + + // here mirror image casts on summoner spell (not present in client dbc) 49866 + // here should be auras (not present in client dbc): 35657, 35658, 35659, 35660 selfcasted by mirror images (stats related?) + // Clone Me! + owner.CastSpell(me, SpellIds.CloneMe, false); + } + + public override void EnterCombat(Unit victim) + { + if (me.GetVictim() && !me.GetVictim().HasBreakableByDamageCrowdControlAura(me)) { - if (!ownerTarget.HasBreakableByDamageCrowdControlAura(ownerTarget)) - me.Attack(ownerTarget, false); + me.CastSpell(victim, SpellIds.MageFireBlast, false); + _scheduler.Schedule(TimeSpan.FromSeconds(0), task => + { + DoCastVictim(SpellIds.MageFrostBolt); + task.Repeat(TimeSpan.FromSeconds(4)); + }); + _scheduler.Schedule(TimeSpan.FromSeconds(6), task => + { + DoCastVictim(SpellIds.MageFireBlast); + task.Repeat(); + }); } else - Init(); + EnterEvadeMode(EvadeReason.Other); } - _events.ExecuteEvents(spellId => + public override void Reset() { - if (spellId == PetMageConst.SpellMageFrostBolt) - { - _events.ScheduleEvent(PetMageConst.SpellMageFrostBolt, PetMageConst.TimerMirrorImageFrostBolt); - DoCastVictim(spellId); - } - else if (spellId == PetMageConst.SpellMageFireBlast) - { - DoCastVictim(spellId); - _events.ScheduleEvent(PetMageConst.SpellMageFireBlast, PetMageConst.TimerMirrorImageFireBlast); - } - }); - } - - // Do not reload Creature templates on evade mode enter - prevent visual lost - public override void EnterEvadeMode(EvadeReason why) - { - if (me.IsInEvadeMode() || !me.IsAlive()) - return; - - Unit owner = me.GetCharmerOrOwner(); - - me.CombatStop(true); - if (owner && !me.HasUnitState(UnitState.Follow)) - { - me.GetMotionMaster().Clear(false); - me.GetMotionMaster().MoveFollow(owner, SharedConst.PetFollowDist, me.GetFollowAngle(), MovementSlot.Active); + _scheduler.CancelAll(); + } + + public override void UpdateAI(uint diff) + { + Unit owner = me.GetCharmerOrOwner(); + if (!owner) + return; + + Unit target = owner.GetAttackerForHelper(); + + _scheduler.Update(diff); + + // prevent CC interrupts by images + if (me.GetVictim() && me.GetVictim().HasBreakableByDamageCrowdControlAura(me)) + { + me.InterruptNonMeleeSpells(false); + return; + } + + if (me.HasUnitState(UnitState.Casting)) + return; + + // assign target if image doesnt have any or the target is not actual + if (!target || me.GetVictim() != target) + { + Unit ownerTarget = null; + Player owner1 = me.GetCharmerOrOwner().ToPlayer(); + if (owner1) + ownerTarget = owner1.GetSelectedUnit(); + + // recognize which victim will be choosen + if (ownerTarget && ownerTarget.IsTypeId(TypeId.Player)) + { + if (!ownerTarget.HasBreakableByDamageCrowdControlAura(ownerTarget)) + me.Attack(ownerTarget, false); + } + else if (ownerTarget && !ownerTarget.IsTypeId(TypeId.Player) && IsInThreatList(ownerTarget)) + { + if (!ownerTarget.HasBreakableByDamageCrowdControlAura(ownerTarget)) + me.Attack(ownerTarget, false); + } + else + Init(); + } + + _events.ExecuteEvents(eventId => + { + if (eventId == SpellIds.MageFrostBolt) + { + + } + else if (eventId == SpellIds.MageFireBlast) + { + } + }); + } + + // Do not reload Creature templates on evade mode enter - prevent visual lost + public override void EnterEvadeMode(EvadeReason why) + { + if (me.IsInEvadeMode() || !me.IsAlive()) + return; + + Unit owner = me.GetCharmerOrOwner(); + + me.CombatStop(true); + if (owner && !me.HasUnitState(UnitState.Follow)) + { + me.GetMotionMaster().Clear(false); + me.GetMotionMaster().MoveFollow(owner, SharedConst.PetFollowDist, me.GetFollowAngle(), MovementSlot.Active); + } + Init(); } - Init(); } } } diff --git a/Source/Scripts/Pets/Priest.cs b/Source/Scripts/Pets/Priest.cs index 41a2ca698..d0baf33e6 100644 --- a/Source/Scripts/Pets/Priest.cs +++ b/Source/Scripts/Pets/Priest.cs @@ -20,43 +20,46 @@ using Game.AI; using Game.Entities; using Game.Scripting; -namespace Scripts.Pets.Priest +namespace Scripts.Pets { - struct SpellIds + namespace Priest { - public const uint GlyphOfShadowFiend = 58228; - public const uint ShadowFiendDeath = 57989; - public const uint LightWellCharges = 59907; - } - - [Script] - class npc_pet_pri_lightwell : PassiveAI - { - public npc_pet_pri_lightwell(Creature creature) : base(creature) + struct SpellIds { - DoCast(creature, SpellIds.LightWellCharges, false); + public const uint GlyphOfShadowFiend = 58228; + public const uint ShadowFiendDeath = 57989; + public const uint LightWellCharges = 59907; } - public override void EnterEvadeMode(EvadeReason why) + [Script] + class npc_pet_pri_lightwell : PassiveAI { - if (!me.IsAlive()) - return; + public npc_pet_pri_lightwell(Creature creature) : base(creature) + { + DoCast(creature, SpellIds.LightWellCharges, false); + } - me.GetThreatManager().ClearAllThreat(); - me.CombatStop(true); - me.ResetPlayerDamageReq(); + public override void EnterEvadeMode(EvadeReason why) + { + if (!me.IsAlive()) + return; + + me.GetThreatManager().ClearAllThreat(); + me.CombatStop(true); + me.ResetPlayerDamageReq(); + } } - } - [Script] - class npc_pet_pri_shadowfiend : PetAI - { - public npc_pet_pri_shadowfiend(Creature creature) : base(creature) { } - - public override void IsSummonedBy(Unit summoner) + [Script] + class npc_pet_pri_shadowfiend : PetAI { - if (summoner.HasAura(SpellIds.GlyphOfShadowFiend)) - DoCastAOE(SpellIds.ShadowFiendDeath); + public npc_pet_pri_shadowfiend(Creature creature) : base(creature) { } + + public override void IsSummonedBy(Unit summoner) + { + if (summoner.HasAura(SpellIds.GlyphOfShadowFiend)) + DoCastAOE(SpellIds.ShadowFiendDeath); + } } } } diff --git a/Source/Scripts/Pets/Shaman.cs b/Source/Scripts/Pets/Shaman.cs index 62cfa1dce..37be2b373 100644 --- a/Source/Scripts/Pets/Shaman.cs +++ b/Source/Scripts/Pets/Shaman.cs @@ -19,95 +19,89 @@ using Framework.Constants; using Game.AI; using Game.Entities; using Game.Scripting; +using System; namespace Scripts.Pets { - [Script] - class npc_pet_shaman_earth_elemental : ScriptedAI + namespace Shaman { - public npc_pet_shaman_earth_elemental(Creature creature) : base(creature) { } - - public override void Reset() + struct SpellIds { - _events.Reset(); - _events.ScheduleEvent(EventAngeredEarth, 0); - me.ApplySpellImmune(0, SpellImmunity.School, SpellSchoolMask.Nature, true); + //npc_pet_shaman_earth_elemental + public const uint AngeredEarth = 36213; + + //npc_pet_shaman_fire_elemental + public const uint FireBlast = 57984; + public const uint FireNova = 12470; + public const uint FireShield = 13376; } - public override void UpdateAI(uint diff) + [Script] + class npc_pet_shaman_earth_elemental : ScriptedAI { - if (!UpdateVictim()) - return; + public npc_pet_shaman_earth_elemental(Creature creature) : base(creature) { } - _events.Update(diff); - - if (_events.ExecuteEvent() == EventAngeredEarth) + public override void Reset() { - DoCastVictim(SpellAngeredEarth); - _events.ScheduleEvent(EventAngeredEarth, RandomHelper.URand(5000, 20000)); + _scheduler.CancelAll(); + _scheduler.Schedule(TimeSpan.FromSeconds(0), task => + { + DoCastVictim(SpellIds.AngeredEarth); + task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(20)); + }); + me.ApplySpellImmune(0, SpellImmunity.School, SpellSchoolMask.Nature, true); } - DoMeleeAttackIfReady(); - } - - const int EventAngeredEarth = 1; - const uint SpellAngeredEarth = 36213; - } - - [Script] - public class npc_pet_shaman_fire_elemental : ScriptedAI - { - public npc_pet_shaman_fire_elemental(Creature creature) : base(creature) { } - - public override void Reset() - { - _events.Reset(); - _events.ScheduleEvent(EventFireNova, RandomHelper.URand(5000, 20000)); - _events.ScheduleEvent(EventFireBlast, RandomHelper.URand(5000, 20000)); - _events.ScheduleEvent(EventFireShield, 0); - me.ApplySpellImmune(0, SpellImmunity.School, SpellSchoolMask.Fire, true); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - if (me.HasUnitState(UnitState.Casting)) - return; - - _events.Update(diff); - - _events.ExecuteEvents(eventId => + public override void UpdateAI(uint diff) { - switch (eventId) - { - case EventFireNova: - DoCastVictim(SpellFireNova); - _events.ScheduleEvent(EventFireNova, RandomHelper.URand(5000, 20000)); - break; - case EventFireShield: - DoCastVictim(SpellFireShield); - _events.ScheduleEvent(EventFireShield, 2000); - break; - case EventFireBlast: - DoCastVictim(SpellFireBlast); - _events.ScheduleEvent(EventFireBlast, RandomHelper.URand(5000, 20000)); - break; - default: - break; - } - }); + if (!UpdateVictim()) + return; - DoMeleeAttackIfReady(); + _scheduler.Update(diff); + + DoMeleeAttackIfReady(); + } } - const int EventFireNova = 1; - const int EventFireShield = 2; - const int EventFireBlast = 3; + [Script] + public class npc_pet_shaman_fire_elemental : ScriptedAI + { + public npc_pet_shaman_fire_elemental(Creature creature) : base(creature) { } - const uint SpellFireBlast = 57984; - const uint SpellFireNova = 12470; - const uint SpellFireShield = 13376; + public override void Reset() + { + _scheduler.CancelAll(); + _scheduler.Schedule(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(20), task => + { + DoCastVictim(SpellIds.FireNova); + task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(20)); + }); + _scheduler.Schedule(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(20), task => + { + DoCastVictim(SpellIds.FireShield); + task.Repeat(TimeSpan.FromSeconds(2)); + }); + _scheduler.Schedule(TimeSpan.FromSeconds(0), task => + { + DoCastVictim(SpellIds.FireBlast); + task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(20)); + }); + me.ApplySpellImmune(0, SpellImmunity.School, SpellSchoolMask.Fire, true); + } + + public override void UpdateAI(uint diff) + { + if (!UpdateVictim()) + return; + + _scheduler.Update(diff); + + if (me.HasUnitState(UnitState.Casting)) + return; + + DoMeleeAttackIfReady(); + } + } } } + diff --git a/Source/Scripts/Spells/DeathKnight.cs b/Source/Scripts/Spells/DeathKnight.cs index c8609b9a5..ce40fc08b 100644 --- a/Source/Scripts/Spells/DeathKnight.cs +++ b/Source/Scripts/Spells/DeathKnight.cs @@ -300,7 +300,7 @@ namespace Scripts.Spells.DeathKnight } [Script] - class spell_dk_death_and_decay_AuraScript: AuraScript + class spell_dk_death_and_decay_AuraScript : AuraScript { void HandleDummyTick(AuraEffect aurEff) { @@ -429,7 +429,7 @@ namespace Scripts.Spells.DeathKnight void HandleHeal(uint effIndex) { Unit caster = GetCaster(); - //TODO: heal = std::min(10% health, 20% of all damage taken in last 5 seconds) + //TODO: heal = Math.Min(10% health, 20% of all damage taken in last 5 seconds) int heal = (int)MathFunctions.CalculatePct(caster.GetMaxHealth(), GetSpellInfo().GetEffect(4).CalcValue()); caster.CastCustomSpell(SpellIds.DeathStrikeHeal, SpellValueMod.BasePoint0, heal, caster, true); diff --git a/Source/Scripts/Spells/Druid.cs b/Source/Scripts/Spells/Druid.cs index 65a1d890b..17ee8fb24 100644 --- a/Source/Scripts/Spells/Druid.cs +++ b/Source/Scripts/Spells/Druid.cs @@ -742,7 +742,7 @@ namespace Scripts.Spells.Druid void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode) { - // No need to check remove mode, it's safe for auras to remove each other in AfterRemove hook. + // No need to check Remove mode, it's safe for auras to Remove each other in AfterRemove hook. GetTarget().RemoveAura(SpellIds.FormStag); GetTarget().RemoveAura(SpellIds.FormAquatic); GetTarget().RemoveAura(SpellIds.FormFlight); @@ -782,7 +782,7 @@ namespace Scripts.Spells.Druid void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode) { - // If it stays 0, it removes Travel Form dummy in AfterRemove. + // If it stays 0, it Removes Travel Form dummy in AfterRemove. triggeredSpellId = 0; // We should only handle aura interrupts. @@ -798,7 +798,7 @@ namespace Scripts.Spells.Druid else if (CheckLocationForForm(SpellIds.FormStag) == SpellCastResult.SpellCastOk) // Stag form triggeredSpellId = SpellIds.FormStag; - // If chosen form is current aura, just don't remove it. + // If chosen form is current aura, just don't Remove it. if (triggeredSpellId == m_scriptSpellId) PreventDefaultAction(); } @@ -809,7 +809,7 @@ namespace Scripts.Spells.Druid if (triggeredSpellId != 0) // Apply new form player.AddAura(triggeredSpellId, player); - else // If not set, simply remove Travel Form dummy + else // If not set, simply Remove Travel Form dummy player.RemoveAura(SpellIds.TravelForm); } @@ -1004,8 +1004,8 @@ namespace Scripts.Spells.Druid { public override bool Validate(SpellInfo spellInfo) { - SpellEffectInfo effect2 = spellInfo.GetEffect(2); - if (effect2 == null || effect2.IsEffect() || effect2.CalcValue() <= 0) + SpellEffectInfo effectInfo = spellInfo.GetEffect(2); + if (effectInfo == null || effectInfo.IsEffect() || effectInfo.CalcValue() <= 0) return false; return true; } diff --git a/Source/Scripts/Spells/Generic.cs b/Source/Scripts/Spells/Generic.cs index f87315357..e8a30d027 100644 --- a/Source/Scripts/Spells/Generic.cs +++ b/Source/Scripts/Spells/Generic.cs @@ -140,8 +140,8 @@ namespace Scripts.Spells.Generic public const uint Damage45k = 64591; public const uint ChargingEffect8k5 = 63661; - public const uint ChargingEffect20k1 = 68284; - public const uint ChargingEffect20k2 = 68501; + public const uint Charging20k1 = 68284; + public const uint Charging20k2 = 68501; public const uint ChargingEffect45k1 = 62563; public const uint ChargingEffect45k2 = 66481; @@ -269,7 +269,7 @@ namespace Scripts.Spells.Generic public const uint MarkOfKazrogalHellfire = 189512; public const uint MarkOfKazrogalDamageHellfire = 189515; - // Auraprocremovespells + // AuraprocRemovespells public const uint FaceRage = 99947; public const uint ImpatientMind = 187213; } @@ -1184,7 +1184,7 @@ namespace Scripts.Spells.Generic if (spell.GetEffect(2).ApplyAuraName == AuraType.ModDamagePercentTaken) OnEffectRemove.Add(new EffectApplyHandler(RemoveDummyFromDriver, 2, AuraType.ModDamagePercentTaken, AuraEffectHandleModes.Real)); - // Defend spells cast by players (add/remove visuals) + // Defend spells cast by players (add/Remove visuals) if (spell.GetEffect(1).ApplyAuraName == AuraType.Dummy) { AfterEffectApply.Add(new EffectApplyHandler(RefreshVisualShields, 1, AuraType.Dummy, AuraEffectHandleModes.RealOrReapplyMask)); @@ -1550,7 +1550,7 @@ namespace Scripts.Spells.Generic switch (GetSpellInfo().Id) { case SpellIds.TriggerTrialChampion: - spellId = SpellIds.ChargingEffect20k1; + spellId = SpellIds.Charging20k1; break; case SpellIds.TriggerFactionMounts: spellId = SpellIds.ChargingEffect8k5; @@ -1608,8 +1608,8 @@ namespace Scripts.Spells.Generic case SpellIds.ChargingEffect8k5: spellId = SpellIds.Damage8k5; break; - case SpellIds.ChargingEffect20k1: - case SpellIds.ChargingEffect20k2: + case SpellIds.Charging20k1: + case SpellIds.Charging20k2: spellId = SpellIds.Damage20k; break; case SpellIds.ChargingEffect45k1: @@ -1662,7 +1662,7 @@ namespace Scripts.Spells.Generic // triggered spells are 28703 to 28707 // Note: some sources say, that there was the possibility of - // receiving a debuff. However, this seems to be removed by a patch. + // receiving a debuff. However, this seems to be Removed by a patch. // don't overwrite an existing aura for (byte i = 0; i < 5; ++i) @@ -1762,155 +1762,6 @@ namespace Scripts.Spells.Generic } } - [Script] - class spell_gen_on_tournament_mount : AuraScript - { - uint _pennantSpellId; - - public override bool Load() - { - _pennantSpellId = 0; - return GetCaster() && GetCaster().IsTypeId(TypeId.Player); - } - - void HandleApplyEffect(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Unit caster = GetCaster(); - if (caster) - { - Unit vehicle = caster.GetVehicleBase(); - if (vehicle) - { - _pennantSpellId = GetPennatSpellId(caster.ToPlayer(), vehicle); - caster.CastSpell(caster, _pennantSpellId, true); - } - } - } - - void HandleRemoveEffect(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Unit caster = GetCaster(); - if (caster) - caster.RemoveAurasDueToSpell(_pennantSpellId); - } - - uint GetPennatSpellId(Player player, Unit mount) - { - switch (mount.GetEntry()) - { - case CreatureIds.ArgentSteedAspirant: - case CreatureIds.StormwindSteed: - { - if (player.HasAchieved(AchievementIds.ChampionStormwind)) - return SpellIds.StormwindChampion; - else if (player.GetQuestRewardStatus(QuestIds.ValiantOfStormwind) || player.GetQuestRewardStatus(QuestIds.A_ValiantOfStormwind)) - return SpellIds.StormwindValiant; - else - return SpellIds.StormwindAspirant; - } - case CreatureIds.GnomereganMechanostrider: - { - if (player.HasAchieved(AchievementIds.ChampionGnomeregan)) - return SpellIds.GnomereganChampion; - else if (player.GetQuestRewardStatus(QuestIds.ValiantOfGnomeregan) || player.GetQuestRewardStatus(QuestIds.A_ValiantOfGnomeregan)) - return SpellIds.GnomereganValiant; - else - return SpellIds.GnomereganAspirant; - } - case CreatureIds.DarkSpearRaptor: - { - if (player.HasAchieved(AchievementIds.ChampionSenJin)) - return SpellIds.SenjinChampion; - else if (player.GetQuestRewardStatus(QuestIds.ValiantOfSenJin) || player.GetQuestRewardStatus(QuestIds.A_ValiantOfSenJin)) - return SpellIds.SenjinValiant; - else - return SpellIds.SenjinAspirant; - } - case CreatureIds.ArgentHawkstriderAspirant: - case CreatureIds.SilvermoonHawkstrider: - { - if (player.HasAchieved(AchievementIds.ChampionSilvermoon)) - return SpellIds.SilvermoonChampion; - else if (player.GetQuestRewardStatus(QuestIds.ValiantOfSilvermoon) || player.GetQuestRewardStatus(QuestIds.A_ValiantOfSilvermoon)) - return SpellIds.SilvermoonValiant; - else - return SpellIds.SilvermoonAspirant; - } - case CreatureIds.DarnassianNightsaber: - { - if (player.HasAchieved(AchievementIds.ChampionDarnassus)) - return SpellIds.DarnassusChampion; - else if (player.GetQuestRewardStatus(QuestIds.ValiantOfDarnassus) || player.GetQuestRewardStatus(QuestIds.A_ValiantOfDarnassus)) - return SpellIds.DarnassusValiant; - else - return SpellIds.DarnassusAspirant; - } - case CreatureIds.ExodarElekk: - { - if (player.HasAchieved(AchievementIds.ChampionTheExodar)) - return SpellIds.ExodarChampion; - else if (player.GetQuestRewardStatus(QuestIds.ValiantOfTheExodar) || player.GetQuestRewardStatus(QuestIds.A_ValiantOfTheExodar)) - return SpellIds.ExodarValiant; - else - return SpellIds.ExodarAspirant; - } - case CreatureIds.IronforgeRam: - { - if (player.HasAchieved(AchievementIds.ChampionIronforge)) - return SpellIds.IronforgeChampion; - else if (player.GetQuestRewardStatus(QuestIds.ValiantOfIronforge) || player.GetQuestRewardStatus(QuestIds.A_ValiantOfIronforge)) - return SpellIds.IronforgeValiant; - else - return SpellIds.IronforgeAspirant; - } - case CreatureIds.ForsakenWarhorse: - { - if (player.HasAchieved(AchievementIds.ChampionUndercity)) - return SpellIds.UndercityChampion; - else if (player.GetQuestRewardStatus(QuestIds.ValiantOfUndercity) || player.GetQuestRewardStatus(QuestIds.A_ValiantOfUndercity)) - return SpellIds.UndercityValiant; - else - return SpellIds.UndercityAspirant; - } - case CreatureIds.OrgrimmarWolf: - { - if (player.HasAchieved(AchievementIds.ChampionOrgrimmar)) - return SpellIds.OrgrimmarChampion; - else if (player.GetQuestRewardStatus(QuestIds.ValiantOfOrgrimmar) || player.GetQuestRewardStatus(QuestIds.A_ValiantOfOrgrimmar)) - return SpellIds.OrgrimmarValiant; - else - return SpellIds.OrgrimmarAspirant; - } - case CreatureIds.ThunderBluffKodo: - { - if (player.HasAchieved(AchievementIds.ChampionThunderBluff)) - return SpellIds.ThunderbluffChampion; - else if (player.GetQuestRewardStatus(QuestIds.ValiantOfThunderBluff) || player.GetQuestRewardStatus(QuestIds.A_ValiantOfThunderBluff)) - return SpellIds.ThunderbluffValiant; - else - return SpellIds.ThunderbluffAspirant; - } - case CreatureIds.ArgentWarhorse: - { - if (player.HasAchieved(AchievementIds.ChampionAlliance) || player.HasAchieved(AchievementIds.ChampionHorde)) - return player.GetClass() == Class.Deathknight ? SpellIds.EbonbladeChampion : SpellIds.ArgentcrusadeChampion; - else if (player.HasAchieved(AchievementIds.ArgentValor)) - return player.GetClass() == Class.Deathknight ? SpellIds.EbonbladeValiant : SpellIds.ArgentcrusadeValiant; - else - return player.GetClass() == Class.Deathknight ? SpellIds.EbonbladeAspirant : SpellIds.ArgentcrusadeAspirant; - } - default: - return 0; - } - } - - public override void Register() - { - AfterEffectApply.Add(new EffectApplyHandler(HandleApplyEffect, 0, AuraType.Dummy, AuraEffectHandleModes.RealOrReapplyMask)); - OnEffectRemove.Add(new EffectApplyHandler(HandleRemoveEffect, 0, AuraType.Dummy, AuraEffectHandleModes.RealOrReapplyMask)); - } - } - [Script] class spell_gen_oracle_wolvar_reputation : SpellScript { @@ -2875,7 +2726,7 @@ namespace Scripts.Spells.Generic player.InterruptNonMeleeSpells(true); player.AddUnitFlag(UnitFlags.NonAttackable); - // if player class = hunter || warlock remove pet if alive + // if player class = hunter || warlock Remove pet if alive if ((player.GetClass() == Class.Hunter) || (player.GetClass() == Class.Warlock)) { Pet pet = player.GetPet(); diff --git a/Source/Scripts/Spells/Holiday.cs b/Source/Scripts/Spells/Holiday.cs index 0efa3bebf..92023ec11 100644 --- a/Source/Scripts/Spells/Holiday.cs +++ b/Source/Scripts/Spells/Holiday.cs @@ -159,9 +159,6 @@ namespace Scripts.Spells.Holiday { public const uint RibbonPole = 181605; } - - - [Script] // 45102 Romantic Picnic class spell_love_is_in_the_air_romantic_picnic : AuraScript { @@ -178,7 +175,7 @@ namespace Scripts.Spells.Holiday Unit target = GetTarget(); Unit caster = GetCaster(); - // If our player is no longer sit, remove all auras + // If our player is no longer sit, Remove all auras if (target.GetStandState() != UnitStandStateType.Sit) { target.RemoveAura(SpellIds.RomanticPicnicAchiev); @@ -756,7 +753,7 @@ namespace Scripts.Spells.Holiday { Unit target = GetTarget(); - // check if aura needs to be removed + // check if aura needs to be Removed if (!target.FindNearestGameObject(GameobjectIds.RibbonPole, 8.0f) || !target.HasUnitState(UnitState.Casting)) { target.InterruptNonMeleeSpells(false); diff --git a/Source/Scripts/Spells/Hunter.cs b/Source/Scripts/Spells/Hunter.cs index 0c852a740..be4f42762 100644 --- a/Source/Scripts/Spells/Hunter.cs +++ b/Source/Scripts/Spells/Hunter.cs @@ -300,7 +300,7 @@ namespace Scripts.Spells.Hunter { if (GetTargetApplication().GetRemoveMode() == AuraRemoveMode.Default || GetTargetApplication().GetRemoveMode() == AuraRemoveMode.Interrupt) return; - + if (!GetTarget().HasAura(SpellIds.MisdirectionProc)) GetTarget().ResetRedirectThreat(); } @@ -524,7 +524,7 @@ namespace Scripts.Spells.Hunter void HandleDummy(uint effIndex) { Player caster = GetCaster().ToPlayer(); - // break Auto Shot and autohit + // break auto Shot and varhit caster.InterruptSpell(CurrentSpellTypes.AutoRepeat); caster.AttackStop(); caster.SendAttackSwingCancelAttack(); diff --git a/Source/Scripts/Spells/Items.cs b/Source/Scripts/Spells/Items.cs index b4b92c6d9..472e6377f 100644 --- a/Source/Scripts/Spells/Items.cs +++ b/Source/Scripts/Spells/Items.cs @@ -368,7 +368,7 @@ namespace Scripts.Spells.Items public const uint UnstablePowerAuraStack = 24659; public const uint RestlessStrengthAuraStack = 24662; - // Auraprocremovespells + // AuraprocRemovespells public const uint TalismanOfAscendance = 28200; public const uint JomGabbar = 29602; public const uint BattleTrance = 45040; @@ -655,27 +655,27 @@ namespace Scripts.Spells.Items //CLASS_NONE new uint[] { }, //CLASS_WARRIOR - new uint[] { SpellIds.Sociopath, SpellIds.Delusional, SpellIds.Kleptomania, SpellIds.Paranoia, SpellIds.Manic, SpellIds.MartyrComplex }, + new uint[] {SpellIds.Sociopath, SpellIds.Delusional, SpellIds.Kleptomania, SpellIds.Paranoia, SpellIds.Manic, SpellIds.MartyrComplex }, //CLASS_PALADIN - new uint[]{ SpellIds.Sociopath, SpellIds.Delusional, SpellIds.Kleptomania, SpellIds.Megalomania, SpellIds.Paranoia, SpellIds.Manic, SpellIds.Narcissism, SpellIds.MartyrComplex, SpellIds.Dementia }, + new uint[] {SpellIds.Sociopath, SpellIds.Delusional, SpellIds.Kleptomania, SpellIds.Megalomania, SpellIds.Paranoia, SpellIds.Manic, SpellIds.Narcissism, SpellIds.MartyrComplex, SpellIds.Dementia }, //CLASS_HUNTER - new uint[]{ SpellIds.Delusional, SpellIds.Megalomania, SpellIds.Paranoia, SpellIds.Manic, SpellIds.Narcissism, SpellIds.MartyrComplex, SpellIds.Dementia }, + new uint[] {SpellIds.Delusional, SpellIds.Megalomania, SpellIds.Paranoia, SpellIds.Manic, SpellIds.Narcissism, SpellIds.MartyrComplex, SpellIds.Dementia }, //CLASS_ROGUE - new uint[]{ SpellIds.Sociopath, SpellIds.Delusional, SpellIds.Kleptomania, SpellIds.Paranoia, SpellIds.Manic, SpellIds.MartyrComplex }, + new uint[] {SpellIds.Sociopath, SpellIds.Delusional, SpellIds.Kleptomania, SpellIds.Paranoia, SpellIds.Manic, SpellIds.MartyrComplex }, //CLASS_PRIEST - new uint[]{ SpellIds.Megalomania, SpellIds.Paranoia, SpellIds.Manic, SpellIds.Narcissism, SpellIds.MartyrComplex, SpellIds.Dementia }, + new uint[] {SpellIds.Megalomania, SpellIds.Paranoia, SpellIds.Manic, SpellIds.Narcissism, SpellIds.MartyrComplex, SpellIds.Dementia }, //CLASS_DEATH_KNIGHT - new uint[]{ SpellIds.Sociopath, SpellIds.Delusional, SpellIds.Kleptomania, SpellIds.Paranoia, SpellIds.Manic, SpellIds.MartyrComplex }, + new uint[] {SpellIds.Sociopath, SpellIds.Delusional, SpellIds.Kleptomania, SpellIds.Paranoia, SpellIds.Manic, SpellIds.MartyrComplex }, //CLASS_SHAMAN - new uint[] { SpellIds.Megalomania, SpellIds.Paranoia, SpellIds.Manic, SpellIds.Narcissism, SpellIds.MartyrComplex, SpellIds.Dementia }, + new uint[] {SpellIds.Megalomania, SpellIds.Paranoia, SpellIds.Manic, SpellIds.Narcissism, SpellIds.MartyrComplex, SpellIds.Dementia }, //CLASS_MAGE - new uint[]{ SpellIds.Megalomania, SpellIds.Paranoia, SpellIds.Manic, SpellIds.Narcissism, SpellIds.MartyrComplex, SpellIds.Dementia }, + new uint[] {SpellIds.Megalomania, SpellIds.Paranoia, SpellIds.Manic, SpellIds.Narcissism, SpellIds.MartyrComplex, SpellIds.Dementia }, //CLASS_WARLOCK - new uint[]{ SpellIds.Megalomania, SpellIds.Paranoia, SpellIds.Manic, SpellIds.Narcissism, SpellIds.MartyrComplex, SpellIds.Dementia }, + new uint[] {SpellIds.Megalomania, SpellIds.Paranoia, SpellIds.Manic, SpellIds.Narcissism, SpellIds.MartyrComplex, SpellIds.Dementia }, //CLASS_UNK new uint[]{ }, //CLASS_DRUID - new uint[]{ SpellIds.Sociopath, SpellIds.Delusional, SpellIds.Kleptomania, SpellIds.Megalomania, SpellIds.Paranoia, SpellIds.Manic, SpellIds.Narcissism, SpellIds.MartyrComplex, SpellIds.Dementia } + new uint[] {SpellIds.Sociopath, SpellIds.Delusional, SpellIds.Kleptomania, SpellIds.Megalomania, SpellIds.Paranoia, SpellIds.Manic, SpellIds.Narcissism, SpellIds.MartyrComplex, SpellIds.Dementia } }; PreventDefaultAction(); @@ -820,19 +820,19 @@ namespace Scripts.Spells.Items //CLASS_NONE new uint[] { }, //CLASS_WARRIOR - new uint[] { _strengthSpellId, _criticalSpellId, _hasteSpellId }, + new uint[] {_strengthSpellId, _criticalSpellId, _hasteSpellId }, //CLASS_PALADIN new uint[] { _strengthSpellId, _criticalSpellId, _hasteSpellId }, //CLASS_HUNTER - new uint[] { _agilitySpellId, _criticalSpellId, _apSpellId }, + new uint[] {_agilitySpellId, _criticalSpellId, _apSpellId }, //CLASS_ROGUE - new uint[] { _agilitySpellId, _hasteSpellId, _apSpellId }, + new uint[] {_agilitySpellId, _hasteSpellId, _apSpellId }, //CLASS_PRIEST new uint[] { }, //CLASS_DEATH_KNIGHT - new uint[] { _strengthSpellId, _criticalSpellId, _hasteSpellId }, + new uint[] {_strengthSpellId, _criticalSpellId, _hasteSpellId }, //CLASS_SHAMAN - new uint[] { _agilitySpellId, _hasteSpellId, _apSpellId }, + new uint[] {_agilitySpellId, _hasteSpellId, _apSpellId }, //CLASS_MAGE new uint[] { }, //CLASS_WARLOCK @@ -840,7 +840,7 @@ namespace Scripts.Spells.Items //CLASS_UNK new uint[] { }, //CLASS_DRUID - new uint[] { _strengthSpellId, _agilitySpellId, _hasteSpellId } + new uint[] {_strengthSpellId, _agilitySpellId, _hasteSpellId } }; PreventDefaultAction(); @@ -1984,7 +1984,7 @@ namespace Scripts.Spells.Items Player target = GetHitPlayer(); if (target) { - uint[] items = { ItemIds.HeartCandy1, ItemIds.HeartCandy2, ItemIds.HeartCandy3, ItemIds.HeartCandy4, ItemIds.HeartCandy5, ItemIds.HeartCandy6, ItemIds.HeartCandy7, ItemIds.HeartCandy8 }; + uint[] items = new uint[] { ItemIds.HeartCandy1, ItemIds.HeartCandy2, ItemIds.HeartCandy3, ItemIds.HeartCandy4, ItemIds.HeartCandy5, ItemIds.HeartCandy6, ItemIds.HeartCandy7, ItemIds.HeartCandy8 }; target.AddItem(items[RandomHelper.IRand(0, 7)], 1); } } @@ -2112,7 +2112,7 @@ namespace Scripts.Spells.Items uint sound_id = RandomHelper.RAND(SoundIds.Ashbringer1, SoundIds.Ashbringer2, SoundIds.Ashbringer3, SoundIds.Ashbringer4, SoundIds.Ashbringer5, SoundIds.Ashbringer6, SoundIds.Ashbringer7, SoundIds.Ashbringer8, SoundIds.Ashbringer9, SoundIds.Ashbringer10, SoundIds.Ashbringer11, SoundIds.Ashbringer12); - // Ashbringers effect (spellID 28441) retriggers every 5 seconds, with a chance of making it say one of the above 12 sounds + // Ashbringers effect (SpellIds.ID 28441) retriggers every 5 seconds, with a chance of making it say one of the above 12 sounds if (RandomHelper.URand(0, 60) < 1) player.PlayDirectSound(sound_id, player); } @@ -2557,7 +2557,7 @@ namespace Scripts.Spells.Items float lastZ = MapConst.InvalidHeight; } - + [Script] class spell_item_teach_language : SpellScript { @@ -2972,7 +2972,7 @@ namespace Scripts.Spells.Items if (dummy == null || dummy.GetStackAmount() < aurEff.GetAmount()) return; - // if right amount, remove the aura and cast real trigger + // if right amount, Remove the aura and cast real trigger caster.RemoveAurasDueToSpell(_stackSpell); Unit target = eventInfo.GetActionTarget(); if (target) @@ -3392,7 +3392,7 @@ namespace Scripts.Spells.Items } [Script]// 45051 - Mad Alchemist's Potion (34440) - class mad_alchemists_potion_SpellScript : SpellScript + class spell_item_mad_alchemists_potion : SpellScript { void SecondaryEffect() { @@ -3461,7 +3461,7 @@ namespace Scripts.Spells.Items } [Script]// 53750 - Crazy Alchemist's Potion (40077) - class crazy_alchemists_potion_SpellScript : SpellScript + class spell_item_crazy_alchemists_potion : SpellScript { void SecondaryEffect() { diff --git a/Source/Scripts/Spells/Mage.cs b/Source/Scripts/Spells/Mage.cs index bb6649e8e..0c4ef752f 100644 --- a/Source/Scripts/Spells/Mage.cs +++ b/Source/Scripts/Spells/Mage.cs @@ -138,8 +138,8 @@ namespace Scripts.Spells.Mage void HandleAbsorb(AuraEffect aurEff, DamageInfo dmgInfo, ref uint absorbAmount) { - AuraEffect effect1 = GetEffect(1); - if (effect1 == null || !GetTargetApplication().HasEffect(1) || + AuraEffect effectInfo = GetEffect(1); + if (effectInfo == null || !GetTargetApplication().HasEffect(1) || dmgInfo.GetDamage() < GetTarget().GetHealth() || dmgInfo.GetDamage() > GetTarget().GetMaxHealth() * 2 || GetTarget().HasAura(SpellIds.Cauterized)) @@ -148,7 +148,7 @@ namespace Scripts.Spells.Mage return; } - GetTarget().SetHealth(GetTarget().CountPctFromMaxHealth(effect1.GetAmount())); + GetTarget().SetHealth(GetTarget().CountPctFromMaxHealth(effectInfo.GetAmount())); GetTarget().CastSpell(GetTarget(), GetSpellInfo().GetEffect(2).TriggerSpell, TriggerCastFlags.FullMask); GetTarget().CastSpell(GetTarget(), SpellIds.CauterizeDot, TriggerCastFlags.FullMask); GetTarget().CastSpell(GetTarget(), SpellIds.Cauterized, TriggerCastFlags.FullMask); @@ -303,7 +303,7 @@ namespace Scripts.Spells.Mage } } - // 37447 - Improved Mana Gems + // 37447 - Improved Mana Gems [Script] // 61062 - Improved Mana Gems class spell_mage_imp_mana_gems : AuraScript { @@ -501,7 +501,7 @@ namespace Scripts.Spells.Mage ObjectGuid _ringOfFrostGUID; } - + [Script] // 82691 - Ring of Frost (freeze efect) class spell_mage_ring_of_frost_freeze : SpellScript { @@ -552,7 +552,7 @@ namespace Scripts.Spells.Mage AfterEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.ModStun, AuraEffectHandleModes.Real)); } } - + [Script] // 80353 - Time Warp class spell_mage_time_warp : SpellScript { diff --git a/Source/Scripts/Spells/Paladin.cs b/Source/Scripts/Spells/Paladin.cs index 9b6933188..3a59cccf4 100644 --- a/Source/Scripts/Spells/Paladin.cs +++ b/Source/Scripts/Spells/Paladin.cs @@ -162,7 +162,7 @@ namespace Scripts.Spells.Paladin { public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.Forbearance) //, SPELL_PALADIN_IMMUNE_SHIELD_MARKER) // uncomment when we have serverside only spells + return ValidateSpellInfo(SpellIds.Forbearance) //, SpellIds._PALADIN_IMMUNE_SHIELD_MARKER) // uncomment when we have serverside only spells && spellInfo.ExcludeTargetAuraSpell == SpellIds.ImmuneShieldMarker; } @@ -218,7 +218,7 @@ namespace Scripts.Spells.Paladin { public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.FinalStand, SpellIds.FinalStandEffect, SpellIds.Forbearance) //, SPELL_PALADIN_IMMUNE_SHIELD_MARKER // uncomment when we have serverside only spells + return ValidateSpellInfo(SpellIds.FinalStand, SpellIds.FinalStandEffect, SpellIds.Forbearance) //, SpellIds._PALADIN_IMMUNE_SHIELD_MARKER // uncomment when we have serverside only spells && spellInfo.ExcludeCasterAuraSpell == SpellIds.ImmuneShieldMarker; } diff --git a/Source/Scripts/Spells/Priest.cs b/Source/Scripts/Spells/Priest.cs index 0fdc728e5..6f2b0e8b0 100644 --- a/Source/Scripts/Spells/Priest.cs +++ b/Source/Scripts/Spells/Priest.cs @@ -473,7 +473,7 @@ namespace Scripts.Spells.Priest return; int healAmount = (int)target.CountPctFromMaxHealth((int)healPct); - // remove the aura now, we don't want 40% healing bonus + // Remove the aura now, we don't want 40% healing bonus Remove(AuraRemoveMode.EnemySpell); target.CastCustomSpell(target, SpellIds.GuardianSpiritHeal, healAmount, 0, 0, true); absorbAmount = dmgInfo.GetDamage(); diff --git a/Source/Scripts/Spells/Quest.cs b/Source/Scripts/Spells/Quest.cs index 22feebca4..c76cdd425 100644 --- a/Source/Scripts/Spells/Quest.cs +++ b/Source/Scripts/Spells/Quest.cs @@ -284,12 +284,11 @@ namespace Scripts.Spells.Quest // 34665 Administer Antidote // http://www.wowhead.com/quest=11515 Blood for Blood // 44936 Quest - Fel Siphon Dummy - [Script("spell_q55_sacred_cleansing", SpellEffectName.Dummy, 1u, CreatureIds.Morbent, CreatureIds.WeakenedMorbent, true)] - [Script("spell_q10255_administer_antidote", SpellEffectName.Dummy, 0u, CreatureIds.Helboar, CreatureIds.Dreadtusk, true)] - [Script("spell_q11515_fel_siphon_dummy", SpellEffectName.Dummy, 0u, CreatureIds.FelbloodInitiate, CreatureIds.EmaciatedFelblood, true)] + [Script("spell_q55_sacred_cleansing", SpellEffectName.Dummy, 1u, CreatureIds.Morbent, CreatureIds.WeakenedMorbent, true, 0)] + [Script("spell_q10255_administer_antidote", SpellEffectName.Dummy, 0u, CreatureIds.Helboar, CreatureIds.Dreadtusk, true, 0)] + [Script("spell_q11515_fel_siphon_dummy", SpellEffectName.Dummy, 0u, CreatureIds.FelbloodInitiate, CreatureIds.EmaciatedFelblood, true, 0)] class spell_generic_quest_update_entry : SpellScript { - public spell_generic_quest_update_entry(SpellEffectName spellEffect, uint effIndex, uint originalEntry, uint newEntry, bool shouldAttack) : this(spellEffect, effIndex, originalEntry, newEntry, shouldAttack, 0) { } public spell_generic_quest_update_entry(SpellEffectName spellEffect, uint effIndex, uint originalEntry, uint newEntry, bool shouldAttack, uint despawnTime) { _spellEffect = spellEffect; diff --git a/Source/Scripts/Spells/Warlock.cs b/Source/Scripts/Spells/Warlock.cs index ff043db27..93d2aa4aa 100644 --- a/Source/Scripts/Spells/Warlock.cs +++ b/Source/Scripts/Spells/Warlock.cs @@ -89,7 +89,7 @@ namespace Scripts.Spells.Warlock Unit target = GetHitUnit(); if (target) { - // Casting Banish on a banished target will remove applied aura + // Casting Banish on a banished target will Remove applied aura Aura banishAura = target.GetAura(GetSpellInfo().Id, GetCaster().GetGUID()); if (banishAura != null) banishAura.Remove(); @@ -119,7 +119,7 @@ namespace Scripts.Spells.Warlock public override void Register() { - //OnEffectHitTarget.Add(new EffectHandler(spell_warl_conflagrate_SpellScript::HandleHit, 0, SPELL_EFFECT_SCHOOL_DAMAGE); + //OnEffectHitTarget.Add(new EffectHandler(spell_warl_conflagrate_SpellScript::HandleHit, 0, SpellIds._EFFECT_SCHOOL_DAMAGE); } } @@ -128,15 +128,15 @@ namespace Scripts.Spells.Warlock { void HandleAbsorb(AuraEffect aurEff, DamageInfo dmgInfo, ref uint absorbAmount) { - AuraEffect effect1 = GetEffect(1); - if (effect1 == null || !GetTargetApplication().HasEffect(1)) + AuraEffect auraEffect = GetEffect(1); + if (auraEffect == null || !GetTargetApplication().HasEffect(1)) { PreventDefaultAction(); return; } // You take ${$s2/3}% reduced damage - float damageReductionPct = (float)effect1.GetAmount() / 3; + float damageReductionPct = (float)auraEffect.GetAmount() / 3; // plus a random amount of up to ${$s2/3}% additional reduced damage damageReductionPct += RandomHelper.FRand(0.0f, damageReductionPct); @@ -210,7 +210,7 @@ namespace Scripts.Spells.Warlock { void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode) { - // If effect is removed by expire remove the summoned demonic circle too. + // If effect is Removed by expire Remove the summoned demonic circle too. if (!mode.HasAnyFlag(AuraEffectHandleModes.Reapply)) GetTarget().RemoveGameObject(GetId(), true); @@ -224,7 +224,7 @@ namespace Scripts.Spells.Warlock { // Here we check if player is in demonic circle teleport range, if so add // WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST; allowing him to cast the WARLOCK_DEMONIC_CIRCLE_TELEPORT. - // If not in range remove the WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST. + // If not in range Remove the WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST. SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.DemonicCircleTeleport, GetCastDifficulty()); @@ -646,7 +646,7 @@ namespace Scripts.Spells.Warlock { if (caster.GetOwner() && caster.GetOwner().HasAura(SpellIds.GlyphOfSuccubus)) { - target.RemoveAurasByType(AuraType.PeriodicDamage, ObjectGuid.Empty, target.GetAura(SpellIds.PriestShadowWordDeath)); // SW:D shall not be removed. + target.RemoveAurasByType(AuraType.PeriodicDamage, ObjectGuid.Empty, target.GetAura(SpellIds.PriestShadowWordDeath)); // SW:D shall not be Removed. target.RemoveAurasByType(AuraType.PeriodicDamagePercent); target.RemoveAurasByType(AuraType.PeriodicLeech); } @@ -828,8 +828,6 @@ namespace Scripts.Spells.Warlock public List GetDotList() { return _dotList; } public Unit GetOriginalSwapSource() { return _swapCaster; } public void SetOriginalSwapSource(Unit victim) { _swapCaster = victim; } - - List _dotList = new List(); Unit _swapCaster; } diff --git a/Source/Scripts/Spells/Warrior.cs b/Source/Scripts/Spells/Warrior.cs index 73a57cada..4ff95d3d2 100644 --- a/Source/Scripts/Spells/Warrior.cs +++ b/Source/Scripts/Spells/Warrior.cs @@ -483,8 +483,6 @@ namespace Scripts.Spells.Warrior OnEffectHitTarget.Add(new EffectHandler(HandleEffect, 0, SpellEffectName.Any)); } } - - [Script] // 97462 - Rallying Cry class spell_warr_rallying_cry : SpellScript { @@ -574,7 +572,7 @@ namespace Scripts.Spells.Warrior { PreventHitDefaultEffect(effIndex); - // remove shields, will still display immune to damage part + // Remove shields, will still display immune to damage part Unit target = GetHitUnit(); if (target) target.RemoveAurasWithMechanic(1 << (int)Mechanics.ImmuneShield, AuraRemoveMode.EnemySpell); diff --git a/Source/Scripts/World/BossEmeraldDragons.cs b/Source/Scripts/World/BossEmeraldDragons.cs deleted file mode 100644 index e80a71c16..000000000 --- a/Source/Scripts/World/BossEmeraldDragons.cs +++ /dev/null @@ -1,581 +0,0 @@ -/* - * Copyright (C) 2012-2020 CypherCore - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -using Framework.Constants; -using Game.AI; -using Game.Entities; -using Game.Scripting; -using Game.Spells; -using System; -using System.Collections.Generic; - -namespace Scripts.World.BossEmeraldDragons -{ - struct CreatureIds - { - public const uint DragonYsondre = 14887; - public const uint DragonLethon = 14888; - public const uint DragonEmeriss = 14889; - public const uint DragonTaerar = 14890; - public const uint DreamFog = 15224; - - //Ysondre - public const uint DementedDruid = 15260; - - //Lethon - public const uint SpiritShade = 15261; - } - - struct Spells - { - public const uint TailSweep = 15847; // Tail Sweep - Slap Everything Behind Dragon (2 Seconds Interval) - public const uint SummonPlayer = 24776; // Teleport Highest Threat Player In Front Of Dragon If Wandering Off - public const uint DreamFog = 24777; // Auraspell For Dream Fog Npc (15224) - public const uint Sleep = 24778; // Sleep Triggerspell (Used For Dream Fog) - public const uint SeepingFogLeft = 24813; // Dream Fog - Summon Left - public const uint SeepingFogRight = 24814; // Dream Fog - Summon Right - public const uint NoxiousBreath = 24818; - public const uint MarkOfNature = 25040; // Mark Of Nature Trigger (Applied On Target Death - 15 Minutes Of Being Suspectible To Aura Of Nature) - public const uint MarkOfNatureAura = 25041; // Mark Of Nature (Passive Marker-Test; Ticks Every 10 Seconds From Boss; Triggers Spellid 25042 (Scripted) - public const uint AuraOfNature = 25043; // Stun For 2 Minutes (Used When public const uint MarkOfNature Exists On The Target) - - //Ysondre - public const uint LightningWave = 24819; - public const uint SummonDruidSpirits = 24795; - - //Lethon - public const uint DrawSpirit = 24811; - public const uint ShadowBoltWhirl = 24834; - public const uint DarkOffering = 24804; - - //Emeriss - public const uint PutridMushroom = 24904; - public const uint CorruptionOfEarth = 24910; - public const uint VolatileInfection = 24928; - - //Taerar - public const uint BellowingRoar = 22686; - public const uint Shade = 24313; - public const uint ArcaneBlast = 24857; - - public static uint[] TaerarShadeSpells = { 24841, 24842, 24843 }; - } - - struct Texts - { - //Ysondre - public const uint YsondreAggro = 0; - public const uint YsondreSummonDruids = 1; - - //Lethon - public const uint LethonAggro = 0; - public const uint LethonDrawSpirit = 1; - - //Emeriss - public const uint EmerissAggro = 0; - public const uint EmerissCastCorruption = 1; - - //Taerar - public const uint TaerarAggro = 0; - public const uint TaerarSummonShades = 1; - } - - class emerald_dragonAI : WorldBossAI - { - public emerald_dragonAI(Creature creature) : base(creature) { } - - public override void Reset() - { - base.Reset(); - me.RemoveUnitFlag(UnitFlags.NotSelectable | UnitFlags.NonAttackable); - me.SetReactState(ReactStates.Aggressive); - DoCast(me, Spells.MarkOfNatureAura, true); - - _scheduler.Schedule(TimeSpan.FromSeconds(4), task => - { - // Tail Sweep is cast every two seconds, no matter what goes on in front of the dragon - DoCast(me, Spells.TailSweep); - task.Repeat(TimeSpan.FromSeconds(2)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(7.5), TimeSpan.FromSeconds(15), task => - { - // Noxious Breath is cast on random intervals, no less than 7.5 seconds between - DoCast(me, Spells.NoxiousBreath); - task.Repeat(); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(12.5), TimeSpan.FromSeconds(20), task => - { - // Seeping Fog appears only as "pairs", and only ONE pair at any given time! - // Despawntime is 2 minutes, so reschedule it for new cast after 2 minutes + a minor "random time" (30 seconds at max) - DoCast(me, Spells.SeepingFogLeft, true); - DoCast(me, Spells.SeepingFogRight, true); - task.Repeat(TimeSpan.FromMinutes(2), TimeSpan.FromMinutes(2.5)); - }); - } - - // Target killed during encounter, mark them as suspectible for Aura Of Nature - public override void KilledUnit(Unit who) - { - if (who.IsTypeId(TypeId.Player)) - who.CastSpell(who, Spells.MarkOfNature, true); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - if (me.HasUnitState(UnitState.Casting)) - return; - - _scheduler.Update(diff); - - Unit target = SelectTarget(SelectAggroTarget.MaxThreat, 0, -50.0f, true); - if (target) - DoCast(target, Spells.SummonPlayer); - - DoMeleeAttackIfReady(); - } - } - - [Script] - class npc_dream_fog : ScriptedAI - { - public npc_dream_fog(Creature creature) : base(creature) - { - Initialize(); - } - - void Initialize() - { - _roamTimer = 0; - } - - public override void Reset() - { - Initialize(); - } - - public override void UpdateAI(uint diff) - { - if (!UpdateVictim()) - return; - - if (_roamTimer == 0) - { - // Chase target, but don't attack - otherwise just roam around - Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true); - if (target) - { - _roamTimer = RandomHelper.URand(15000, 30000); - me.GetMotionMaster().Clear(false); - me.GetMotionMaster().MoveChase(target, 0.2f); - } - else - { - _roamTimer = 2500; - me.GetMotionMaster().Clear(false); - me.GetMotionMaster().MoveRandom(25.0f); - } - // Seeping fog movement is slow enough for a player to be able to walk backwards and still outpace it - me.SetWalk(true); - me.SetSpeedRate(UnitMoveType.Walk, 0.75f); - } - else - _roamTimer -= diff; - } - - uint _roamTimer; - } - - [Script] - class boss_ysondre : CreatureScript - { - public boss_ysondre() : base("boss_ysondre") { } - - class boss_ysondreAI : emerald_dragonAI - { - public boss_ysondreAI(Creature creature) : base(creature) - { - Initialize(); - } - - void Initialize() - { - _stage = 1; - } - - public override void Reset() - { - Initialize(); - base.Reset(); - _scheduler.Schedule(TimeSpan.FromSeconds(12), task => - { - DoCastVictim(Spells.LightningWave); - task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(20)); - }); - } - - public override void EnterCombat(Unit who) - { - Talk(Texts.YsondreAggro); - base.EnterCombat(who); - } - - // Summon druid spirits on 75%, 50% and 25% health - public override void DamageTaken(Unit attacker, ref uint damage) - { - if (!HealthAbovePct(100 - 25 * _stage)) - { - Talk(Texts.YsondreSummonDruids); - - for (byte i = 0; i < 10; ++i) - DoCast(me, Spells.SummonDruidSpirits, true); - ++_stage; - } - } - - byte _stage; - } - - public override CreatureAI GetAI(Creature creature) - { - return new boss_ysondreAI(creature); - } - } - - [Script] - class boss_lethon : CreatureScript - { - public boss_lethon() : base("boss_lethon") { } - - class boss_lethonAI : emerald_dragonAI - { - public boss_lethonAI(Creature creature) : base(creature) - { - Initialize(); - } - - void Initialize() - { - _stage = 1; - } - - public override void Reset() - { - Initialize(); - base.Reset(); - - _scheduler.Schedule(TimeSpan.FromSeconds(10), task => - { - me.CastSpell((Unit)null, Spells.ShadowBoltWhirl, false); - task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30)); - }); - } - - public override void EnterCombat(Unit who) - { - Talk(Texts.LethonAggro); - base.EnterCombat(who); - } - - public override void DamageTaken(Unit attacker, ref uint damage) - { - if (!HealthAbovePct(100 - 25 * _stage)) - { - Talk(Texts.LethonDrawSpirit); - DoCast(me, Spells.DrawSpirit); - ++_stage; - } - } - - public override void SpellHitTarget(Unit target, SpellInfo spell) - { - if (spell.Id == Spells.DrawSpirit && target.IsTypeId(TypeId.Player)) - { - Position targetPos = target.GetPosition(); - me.SummonCreature(CreatureIds.SpiritShade, targetPos, TempSummonType.TimedDespawnOOC, 50000); - } - } - - byte _stage; - } - - public override CreatureAI GetAI(Creature creature) - { - return new boss_lethonAI(creature); - } - } - - [Script] - class npc_spirit_shade : PassiveAI - { - public npc_spirit_shade(Creature creature) : base(creature) { } - - public override void IsSummonedBy(Unit summoner) - { - _summonerGuid = summoner.GetGUID(); - me.GetMotionMaster().MoveFollow(summoner, 0.0f, 0.0f); - } - - public override void MovementInform(MovementGeneratorType moveType, uint data) - { - if (moveType == MovementGeneratorType.Follow && data == _summonerGuid.GetCounter()) - { - me.CastSpell((Unit)null, Spells.DarkOffering, false); - me.DespawnOrUnsummon(1000); - } - } - - ObjectGuid _summonerGuid; - } - - [Script] - class boss_emeriss : CreatureScript - { - public boss_emeriss() : base("boss_emeriss") { } - - class boss_emerissAI : emerald_dragonAI - { - public boss_emerissAI(Creature creature) : base(creature) - { - Initialize(); - } - - void Initialize() - { - _stage = 1; - } - - public override void Reset() - { - Initialize(); - base.Reset(); - - _scheduler.Schedule(TimeSpan.FromSeconds(12), task => - { - DoCastVictim(Spells.VolatileInfection); - task.Repeat(TimeSpan.FromSeconds(120)); - }); - } - - public override void KilledUnit(Unit who) - { - if (who.IsTypeId(TypeId.Player)) - DoCast(who, Spells.PutridMushroom, true); - base.KilledUnit(who); - } - - public override void EnterCombat(Unit who) - { - Talk(Texts.EmerissAggro); - base.EnterCombat(who); - } - - public override void DamageTaken(Unit attacker, ref uint damage) - { - if (!HealthAbovePct(100 - 25 * _stage)) - { - Talk(Texts.EmerissCastCorruption); - DoCast(me, Spells.CorruptionOfEarth, true); - ++_stage; - } - } - - byte _stage; - } - - public override CreatureAI GetAI(Creature creature) - { - return new boss_emerissAI(creature); - } - } - - [Script] - class boss_taerar : CreatureScript - { - public boss_taerar() : base("boss_taerar") { } - - class boss_taerarAI : emerald_dragonAI - { - public boss_taerarAI(Creature creature) : base(creature) - { - Initialize(); - } - - void Initialize() - { - _stage = 1; - _shades = 0; - _banished = false; - _banishedTimer = 0; - } - - public override void Reset() - { - me.RemoveAurasDueToSpell(Spells.Shade); - - Initialize(); - - base.Reset(); - - _scheduler.Schedule(TimeSpan.FromSeconds(12), task => - { - DoCast(Spells.ArcaneBlast); - task.Repeat(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(12)); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(30), task => - { - DoCast(Spells.BellowingRoar); - task.Repeat(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(30)); - }); - } - - public override void EnterCombat(Unit who) - { - Talk(Texts.TaerarAggro); - base.EnterCombat(who); - } - - public override void SummonedCreatureDies(Creature summon, Unit killer) - { - --_shades; - } - - public override void DamageTaken(Unit attacker, ref uint damage) - { - // At 75, 50 or 25 percent health, we need to activate the shades and go "banished" - // Note: _stage holds the amount of times they have been summoned - if (!_banished && !HealthAbovePct(100 - 25 * _stage)) - { - _banished = true; - _banishedTimer = 60000; - - me.InterruptNonMeleeSpells(false); - DoStopAttack(); - - Talk(Texts.TaerarSummonShades); - - foreach (var spell in Spells.TaerarShadeSpells) - DoCastVictim(spell, true); - _shades += (byte)Spells.TaerarShadeSpells.Length; - - DoCast(Spells.Shade); - me.AddUnitFlag(UnitFlags.NotSelectable | UnitFlags.NonAttackable); - me.SetReactState(ReactStates.Passive); - - ++_stage; - } - } - - public override void UpdateAI(uint diff) - { - if (!me.IsInCombat()) - return; - - if (_banished) - { - // If all three shades are dead, OR it has taken too long, end the current event and get Taerar back into business - if (_banishedTimer <= diff || _shades == 0) - { - _banished = false; - - me.RemoveUnitFlag(UnitFlags.NotSelectable | UnitFlags.NonAttackable); - me.RemoveAurasDueToSpell(Spells.Shade); - me.SetReactState(ReactStates.Aggressive); - } - // _banishtimer has not expired, and we still have active shades: - else - _banishedTimer -= diff; - - // Update the scheduler before we return (handled under emerald_dragonAI.UpdateAI(diff); if we're not inside this check) - _scheduler.Update(diff); - - return; - } - - base.UpdateAI(diff); - } - - bool _banished; // used for shades activation testing - uint _banishedTimer; // counter for banishment timeout - byte _shades; // keep track of how many shades are dead - byte _stage; // check which "shade phase" we're at (75-50-25 percentage counters) - } - - public override CreatureAI GetAI(Creature creature) - { - return new boss_taerarAI(creature); - } - } - - [Script] - class spell_dream_fog_sleep : SpellScript - { - void FilterTargets(List targets) - { - targets.RemoveAll(obj => - { - Unit unit = obj.ToUnit(); - if (unit) - return unit.HasAura(Spells.Sleep); - return true; - }); - } - - public override void Register() - { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitDestAreaEnemy)); - } - } - - [Script] - class spell_mark_of_nature : SpellScript - { - public override bool Validate(SpellInfo spellInfo) - { - return ValidateSpellInfo(Spells.MarkOfNature, Spells.AuraOfNature); - } - - void FilterTargets(List targets) - { - targets.RemoveAll(obj => - { - // return those not tagged or already under the influence of Aura of Nature - Unit unit = obj.ToUnit(); - if (unit) - return !(unit.HasAura(Spells.MarkOfNature) && !unit.HasAura(Spells.AuraOfNature)); - return true; - }); - } - - void HandleEffect(uint effIndex) - { - PreventHitDefaultEffect(effIndex); - GetHitUnit().CastSpell(GetHitUnit(), Spells.AuraOfNature, true); - } - - public override void Register() - { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEnemy)); - OnEffectHitTarget.Add(new EffectHandler(HandleEffect, 0, SpellEffectName.ApplyAura)); - } - } -} diff --git a/Source/Scripts/World/DuelReset.cs b/Source/Scripts/World/DuelReset.cs index f3d7afcc2..53fd7802f 100644 --- a/Source/Scripts/World/DuelReset.cs +++ b/Source/Scripts/World/DuelReset.cs @@ -92,7 +92,7 @@ namespace Scripts.World void ResetSpellCooldowns(Player player, bool onStartDuel) { - // remove cooldowns on spells that have < 10 min CD > 30 sec and has no onHold + // Remove cooldowns on spells that have < 10 min CD > 30 sec and has no onHold player.GetSpellHistory().ResetCooldowns(itr => { SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(itr.Key, Difficulty.None); diff --git a/Source/Scripts/World/EmeraldDragons.cs b/Source/Scripts/World/EmeraldDragons.cs new file mode 100644 index 000000000..99794c160 --- /dev/null +++ b/Source/Scripts/World/EmeraldDragons.cs @@ -0,0 +1,541 @@ +/* + * Copyright (C) 2012-2020 CypherCore + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +using Framework.Constants; +using Game.AI; +using Game.Entities; +using Game.Scripting; +using Game.Spells; +using System; +using System.Collections.Generic; + +namespace Scripts.World.BossEmeraldDragons +{ + struct CreatureIds + { + public const uint DragonYsondre = 14887; + public const uint DragonLethon = 14888; + public const uint DragonEmeriss = 14889; + public const uint DragonTaerar = 14890; + public const uint DreamFog = 15224; + + //Ysondre + public const uint DementedDruid = 15260; + + //Lethon + public const uint SpiritShade = 15261; + } + + struct SpellIds + { + public const uint TailSweep = 15847; // Tail Sweep - Slap Everything Behind Dragon (2 Seconds Interval) + public const uint SummonPlayer = 24776; // Teleport Highest Threat Player In Front Of Dragon If Wandering Off + public const uint DreamFog = 24777; // Auraspell For Dream Fog Npc (15224) + public const uint Sleep = 24778; // Sleep Triggerspell (Used For Dream Fog) + public const uint SeepingFogLeft = 24813; // Dream Fog - Summon Left + public const uint SeepingFogRight = 24814; // Dream Fog - Summon Right + public const uint NoxiousBreath = 24818; + public const uint MarkOfNature = 25040; // Mark Of Nature Trigger (Applied On Target Death - 15 Minutes Of Being Suspectible To Aura Of Nature) + public const uint MarkOfNatureAura = 25041; // Mark Of Nature (Passive Marker-Test; Ticks Every 10 Seconds From Boss; Triggers Spellid 25042 (Scripted) + public const uint AuraOfNature = 25043; // Stun For 2 Minutes (Used When public const uint MarkOfNature Exists On The Target) + + //Ysondre + public const uint LightningWave = 24819; + public const uint SummonDruidSpirits = 24795; + + //Lethon + public const uint DrawSpirit = 24811; + public const uint ShadowBoltWhirl = 24834; + public const uint DarkOffering = 24804; + + //Emeriss + public const uint PutridMushroom = 24904; + public const uint CorruptionOfEarth = 24910; + public const uint VolatileInfection = 24928; + + //Taerar + public const uint BellowingRoar = 22686; + public const uint Shade = 24313; + public const uint ArcaneBlast = 24857; + + public static uint[] TaerarShadeSpells = new uint[] { 24841, 24842, 24843 }; + } + + struct Texts + { + //Ysondre + public const uint YsondreAggro = 0; + public const uint YsondreSummonDruids = 1; + + //Lethon + public const uint LethonAggro = 0; + public const uint LethonDrawSpirit = 1; + + //Emeriss + public const uint EmerissAggro = 0; + public const uint EmerissCastCorruption = 1; + + //Taerar + public const uint TaerarAggro = 0; + public const uint TaerarSummonShades = 1; + } + + class emerald_dragonAI : WorldBossAI + { + public emerald_dragonAI(Creature creature) : base(creature) { } + + public override void Reset() + { + base.Reset(); + me.RemoveUnitFlag(UnitFlags.NotSelectable | UnitFlags.NonAttackable); + me.SetReactState(ReactStates.Aggressive); + DoCast(me, SpellIds.MarkOfNatureAura, true); + + _scheduler.Schedule(TimeSpan.FromSeconds(4), task => + { + // Tail Sweep is cast every two seconds, no matter what goes on in front of the dragon + DoCast(me, SpellIds.TailSweep); + task.Repeat(TimeSpan.FromSeconds(2)); + }); + + _scheduler.Schedule(TimeSpan.FromSeconds(7.5), TimeSpan.FromSeconds(15), task => + { + // Noxious Breath is cast on random intervals, no less than 7.5 seconds between + DoCast(me, SpellIds.NoxiousBreath); + task.Repeat(); + }); + + _scheduler.Schedule(TimeSpan.FromSeconds(12.5), TimeSpan.FromSeconds(20), task => + { + // Seeping Fog appears only as "pairs", and only ONE pair at any given time! + // Despawntime is 2 minutes, so reschedule it for new cast after 2 minutes + a minor "random time" (30 seconds at max) + DoCast(me, SpellIds.SeepingFogLeft, true); + DoCast(me, SpellIds.SeepingFogRight, true); + task.Repeat(TimeSpan.FromMinutes(2), TimeSpan.FromMinutes(2.5)); + }); + } + + // Target killed during encounter, mark them as suspectible for Aura Of Nature + public override void KilledUnit(Unit who) + { + if (who.IsTypeId(TypeId.Player)) + who.CastSpell(who, SpellIds.MarkOfNature, true); + } + + public override void UpdateAI(uint diff) + { + if (!UpdateVictim()) + return; + + if (me.HasUnitState(UnitState.Casting)) + return; + + _scheduler.Update(diff); + + Unit target = SelectTarget(SelectAggroTarget.MaxThreat, 0, -50.0f, true); + if (target) + DoCast(target, SpellIds.SummonPlayer); + + DoMeleeAttackIfReady(); + } + } + + [Script] + class npc_dream_fog : ScriptedAI + { + public npc_dream_fog(Creature creature) : base(creature) + { + Initialize(); + } + + void Initialize() + { + _roamTimer = 0; + } + + public override void Reset() + { + Initialize(); + } + + public override void UpdateAI(uint diff) + { + if (!UpdateVictim()) + return; + + if (_roamTimer == 0) + { + // Chase target, but don't attack - otherwise just roam around + Unit target = SelectTarget(SelectAggroTarget.Random, 0, 0.0f, true); + if (target) + { + _roamTimer = RandomHelper.URand(15000, 30000); + me.GetMotionMaster().Clear(false); + me.GetMotionMaster().MoveChase(target, 0.2f); + } + else + { + _roamTimer = 2500; + me.GetMotionMaster().Clear(false); + me.GetMotionMaster().MoveRandom(25.0f); + } + // Seeping fog movement is slow enough for a player to be able to walk backwards and still outpace it + me.SetWalk(true); + me.SetSpeedRate(UnitMoveType.Walk, 0.75f); + } + else + _roamTimer -= diff; + } + + uint _roamTimer; + } + + [Script] + class boss_ysondre : emerald_dragonAI + { + public boss_ysondre(Creature creature) : base(creature) + { + Initialize(); + } + + void Initialize() + { + _stage = 1; + } + + public override void Reset() + { + Initialize(); + base.Reset(); + _scheduler.Schedule(TimeSpan.FromSeconds(12), task => + { + DoCastVictim(SpellIds.LightningWave); + task.Repeat(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(20)); + }); + } + + public override void EnterCombat(Unit who) + { + Talk(Texts.YsondreAggro); + base.EnterCombat(who); + } + + // Summon druid spirits on 75%, 50% and 25% health + public override void DamageTaken(Unit attacker, ref uint damage) + { + if (!HealthAbovePct(100 - 25 * _stage)) + { + Talk(Texts.YsondreSummonDruids); + + for (byte i = 0; i < 10; ++i) + DoCast(me, SpellIds.SummonDruidSpirits, true); + ++_stage; + } + } + + byte _stage; + } + + [Script] + class boss_lethon : emerald_dragonAI + { + public boss_lethon(Creature creature) : base(creature) + { + Initialize(); + } + + void Initialize() + { + _stage = 1; + } + + public override void Reset() + { + Initialize(); + base.Reset(); + + _scheduler.Schedule(TimeSpan.FromSeconds(10), task => + { + me.CastSpell((Unit)null, SpellIds.ShadowBoltWhirl, false); + task.Repeat(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(30)); + }); + } + + public override void EnterCombat(Unit who) + { + Talk(Texts.LethonAggro); + base.EnterCombat(who); + } + + public override void DamageTaken(Unit attacker, ref uint damage) + { + if (!HealthAbovePct(100 - 25 * _stage)) + { + Talk(Texts.LethonDrawSpirit); + DoCast(me, SpellIds.DrawSpirit); + ++_stage; + } + } + + public override void SpellHitTarget(Unit target, SpellInfo spell) + { + if (spell.Id == SpellIds.DrawSpirit && target.IsTypeId(TypeId.Player)) + { + Position targetPos = target.GetPosition(); + me.SummonCreature(CreatureIds.SpiritShade, targetPos, TempSummonType.TimedDespawnOOC, 50000); + } + } + + byte _stage; + } + + [Script] + class npc_spirit_shade : PassiveAI + { + public npc_spirit_shade(Creature creature) : base(creature) { } + + public override void IsSummonedBy(Unit summoner) + { + _summonerGuid = summoner.GetGUID(); + me.GetMotionMaster().MoveFollow(summoner, 0.0f, 0.0f); + } + + public override void MovementInform(MovementGeneratorType moveType, uint data) + { + if (moveType == MovementGeneratorType.Follow && data == _summonerGuid.GetCounter()) + { + me.CastSpell((Unit)null, SpellIds.DarkOffering, false); + me.DespawnOrUnsummon(1000); + } + } + + ObjectGuid _summonerGuid; + } + + [Script] + class boss_emeriss : emerald_dragonAI + { + public boss_emeriss(Creature creature) : base(creature) + { + Initialize(); + } + + void Initialize() + { + _stage = 1; + } + + public override void Reset() + { + Initialize(); + base.Reset(); + + _scheduler.Schedule(TimeSpan.FromSeconds(12), task => + { + DoCastVictim(SpellIds.VolatileInfection); + task.Repeat(TimeSpan.FromSeconds(120)); + }); + } + + public override void KilledUnit(Unit who) + { + if (who.IsTypeId(TypeId.Player)) + DoCast(who, SpellIds.PutridMushroom, true); + base.KilledUnit(who); + } + + public override void EnterCombat(Unit who) + { + Talk(Texts.EmerissAggro); + base.EnterCombat(who); + } + + public override void DamageTaken(Unit attacker, ref uint damage) + { + if (!HealthAbovePct(100 - 25 * _stage)) + { + Talk(Texts.EmerissCastCorruption); + DoCast(me, SpellIds.CorruptionOfEarth, true); + ++_stage; + } + } + + byte _stage; + } + + [Script] + class boss_taerar : emerald_dragonAI + { + public boss_taerar(Creature creature) : base(creature) + { + Initialize(); + } + + void Initialize() + { + _stage = 1; + _shades = 0; + _banished = false; + _banishedTimer = 0; + } + + public override void Reset() + { + me.RemoveAurasDueToSpell(SpellIds.Shade); + + Initialize(); + + base.Reset(); + + _scheduler.Schedule(TimeSpan.FromSeconds(12), task => + { + DoCast(SpellIds.ArcaneBlast); + task.Repeat(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(12)); + }); + + _scheduler.Schedule(TimeSpan.FromSeconds(30), task => + { + DoCast(SpellIds.BellowingRoar); + task.Repeat(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(30)); + }); + } + + public override void EnterCombat(Unit who) + { + Talk(Texts.TaerarAggro); + base.EnterCombat(who); + } + + public override void SummonedCreatureDies(Creature summon, Unit killer) + { + --_shades; + } + + public override void DamageTaken(Unit attacker, ref uint damage) + { + // At 75, 50 or 25 percent health, we need to activate the shades and go "banished" + // Note: _stage holds the amount of times they have been summoned + if (!_banished && !HealthAbovePct(100 - 25 * _stage)) + { + _banished = true; + _banishedTimer = 60000; + + me.InterruptNonMeleeSpells(false); + DoStopAttack(); + + Talk(Texts.TaerarSummonShades); + + foreach (var spell in SpellIds.TaerarShadeSpells) + DoCastVictim(spell, true); + _shades += (byte)SpellIds.TaerarShadeSpells.Length; + + DoCast(SpellIds.Shade); + me.AddUnitFlag(UnitFlags.NotSelectable | UnitFlags.NonAttackable); + me.SetReactState(ReactStates.Passive); + + ++_stage; + } + } + + public override void UpdateAI(uint diff) + { + if (!me.IsInCombat()) + return; + + if (_banished) + { + // If all three shades are dead, OR it has taken too long, end the current event and get Taerar back into business + if (_banishedTimer <= diff || _shades == 0) + { + _banished = false; + + me.RemoveUnitFlag(UnitFlags.NotSelectable | UnitFlags.NonAttackable); + me.RemoveAurasDueToSpell(SpellIds.Shade); + me.SetReactState(ReactStates.Aggressive); + } + // _banishtimer has not expired, and we still have active shades: + else + _banishedTimer -= diff; + + // Update the scheduler before we return (handled under emerald_dragonAI.UpdateAI(diff); if we're not inside this check) + _scheduler.Update(diff); + + return; + } + + base.UpdateAI(diff); + } + + bool _banished; // used for shades activation testing + uint _banishedTimer; // counter for banishment timeout + byte _shades; // keep track of how many shades are dead + byte _stage; // check which "shade phase" we're at (75-50-25 percentage counters) + } + + [Script] + class spell_dream_fog_sleep : SpellScript + { + void FilterTargets(List targets) + { + targets.RemoveAll(obj => + { + Unit unit = obj.ToUnit(); + if (unit) + return unit.HasAura(SpellIds.Sleep); + return true; + }); + } + + public override void Register() + { + OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitDestAreaEnemy)); + } + } + + [Script] + class spell_mark_of_nature : SpellScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.MarkOfNature, SpellIds.AuraOfNature); + } + + void FilterTargets(List targets) + { + targets.RemoveAll(obj => + { + // return those not tagged or already under the influence of Aura of Nature + Unit unit = obj.ToUnit(); + if (unit) + return !(unit.HasAura(SpellIds.MarkOfNature) && !unit.HasAura(SpellIds.AuraOfNature)); + return true; + }); + } + + void HandleEffect(uint effIndex) + { + PreventHitDefaultEffect(effIndex); + GetHitUnit().CastSpell(GetHitUnit(), SpellIds.AuraOfNature, true); + } + + public override void Register() + { + OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEnemy)); + OnEffectHitTarget.Add(new EffectHandler(HandleEffect, 0, SpellEffectName.ApplyAura)); + } + } +} diff --git a/Source/Scripts/World/GameObjects.cs b/Source/Scripts/World/GameObjects.cs index b2bf1e89b..ed42e0c1e 100644 --- a/Source/Scripts/World/GameObjects.cs +++ b/Source/Scripts/World/GameObjects.cs @@ -252,1369 +252,955 @@ namespace Scripts.World } [Script] - class go_cat_figurine : GameObjectScript + class go_cat_figurine : GameObjectAI { - public go_cat_figurine() : base("go_cat_figurine") { } + public go_cat_figurine(GameObject go) : base(go) { } - class go_cat_figurineAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_cat_figurineAI(GameObject go) : base(go) { } - - public override bool GossipHello(Player player) - { - player.CastSpell(player, GameobjectConst.SpellSummonGhostSaber, true); - return false; - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_cat_figurineAI(go); + player.CastSpell(player, GameobjectConst.SpellSummonGhostSaber, true); + return false; } } [Script] //go_barov_journal - class go_barov_journal : GameObjectScript + class go_barov_journal : GameObjectAI { - public go_barov_journal() : base("go_barov_journal") { } + public go_barov_journal(GameObject go) : base(go) { } - class go_barov_journalAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_barov_journalAI(GameObject go) : base(go) { } + if (player.HasSkill(SkillType.Tailoring) && player.GetBaseSkillValue(SkillType.Tailoring) >= 280 && !player.HasSpell(26086)) + player.CastSpell(player, 26095, false); - public override bool GossipHello(Player player) - { - if (player.HasSkill(SkillType.Tailoring) && player.GetBaseSkillValue(SkillType.Tailoring) >= 280 && !player.HasSpell(26086)) - player.CastSpell(player, 26095, false); - - return true; - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_barov_journalAI(go); + return true; } } [Script] //go_gilded_brazier (Paladin First Trail quest (9678)) - class go_gilded_brazier : GameObjectScript + class go_gilded_brazier : GameObjectAI { - public go_gilded_brazier() : base("go_gilded_brazier") { } + public go_gilded_brazier(GameObject go) : base(go) { } - class go_gilded_brazierAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_gilded_brazierAI(GameObject go) : base(go) { } - - public override bool GossipHello(Player player) + if (me.GetGoType() == GameObjectTypes.Goober) { - if (me.GetGoType() == GameObjectTypes.Goober) + if (player.GetQuestStatus(GameobjectConst.QuestTheFirstTrial) == QuestStatus.Incomplete) { - if (player.GetQuestStatus(GameobjectConst.QuestTheFirstTrial) == QuestStatus.Incomplete) - { - Creature Stillblade = player.SummonCreature(GameobjectConst.NpcStillblade, 8106.11f, -7542.06f, 151.775f, 3.02598f, TempSummonType.DeadDespawn, 60000); - if (Stillblade) - Stillblade.GetAI().AttackStart(player); - } + Creature Stillblade = player.SummonCreature(GameobjectConst.NpcStillblade, 8106.11f, -7542.06f, 151.775f, 3.02598f, TempSummonType.DeadDespawn, 60000); + if (Stillblade) + Stillblade.GetAI().AttackStart(player); } - return true; } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_gilded_brazierAI(go); + return true; } } [Script] //go_orb_of_command - class go_orb_of_command : GameObjectScript + class go_orb_of_command : GameObjectAI { - public go_orb_of_command() : base("go_orb_of_command") { } + public go_orb_of_command(GameObject go) : base(go) { } - class go_orb_of_commandAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_orb_of_commandAI(GameObject go) : base(go) { } + if (player.GetQuestRewardStatus(7761)) + player.CastSpell(player, 23460, true); - public override bool GossipHello(Player player) - { - if (player.GetQuestRewardStatus(7761)) - player.CastSpell(player, 23460, true); - - return true; - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_orb_of_commandAI(go); + return true; } } [Script] //go_tablet_of_madness - class go_tablet_of_madness : GameObjectScript + class go_tablet_of_madness : GameObjectAI { - public go_tablet_of_madness() : base("go_tablet_of_madness") { } + public go_tablet_of_madness(GameObject go) : base(go) { } - class go_tablet_of_madnessAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_tablet_of_madnessAI(GameObject go) : base(go) { } + if (player.HasSkill(SkillType.Alchemy) && player.GetSkillValue(SkillType.Alchemy) >= 300 && !player.HasSpell(24266)) + player.CastSpell(player, 24267, false); - public override bool GossipHello(Player player) - { - if (player.HasSkill(SkillType.Alchemy) && player.GetSkillValue(SkillType.Alchemy) >= 300 && !player.HasSpell(24266)) - player.CastSpell(player, 24267, false); - - return true; - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_tablet_of_madnessAI(go); + return true; } } [Script] //go_tablet_of_the_seven - class go_tablet_of_the_seven : GameObjectScript + class go_tablet_of_the_seven : GameObjectAI { - public go_tablet_of_the_seven() : base("go_tablet_of_the_seven") { } + public go_tablet_of_the_seven(GameObject go) : base(go) { } - class go_tablet_of_the_sevenAI : GameObjectAI + // @todo use gossip option ("Transcript the Tablet") instead, if Trinity adds support. + public override bool GossipHello(Player player) { - public go_tablet_of_the_sevenAI(GameObject go) : base(go) { } - - // @todo use gossip option ("Transcript the Tablet") instead, if Trinity adds support. - public override bool GossipHello(Player player) - { - if (me.GetGoType() != GameObjectTypes.QuestGiver) - return true; - - if (player.GetQuestStatus(4296) == QuestStatus.Incomplete) - player.CastSpell(player, 15065, false); - + if (me.GetGoType() != GameObjectTypes.QuestGiver) return true; - } - } - public override GameObjectAI GetAI(GameObject go) - { - return new go_tablet_of_the_sevenAI(go); + if (player.GetQuestStatus(4296) == QuestStatus.Incomplete) + player.CastSpell(player, 15065, false); + + return true; } } [Script] //go_jump_a_tron - class go_jump_a_tron : GameObjectScript + class go_jump_a_tron : GameObjectAI { - public go_jump_a_tron() : base("go_jump_a_tron") { } + public go_jump_a_tron(GameObject go) : base(go) { } - class go_jump_a_tronAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_jump_a_tronAI(GameObject go) : base(go) { } + if (player.GetQuestStatus(10111) == QuestStatus.Incomplete) + player.CastSpell(player, 33382, true); - public override bool GossipHello(Player player) - { - if (player.GetQuestStatus(10111) == QuestStatus.Incomplete) - player.CastSpell(player, 33382, true); - - return true; - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_jump_a_tronAI(go); + return true; } } [Script] //go_ethereum_prison - class go_ethereum_prison : GameObjectScript + class go_ethereum_prison : GameObjectAI { - public go_ethereum_prison() : base("go_ethereum_prison") { } + public go_ethereum_prison(GameObject go) : base(go) { } - class go_ethereum_prisonAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_ethereum_prisonAI(GameObject go) : base(go) { } - - public override bool GossipHello(Player player) + me.UseDoorOrButton(); + int Random = (int)(RandomHelper.Rand32() % (GameobjectConst.NpcPrisonEntry.Length / sizeof(uint))); + Creature creature = player.SummonCreature(GameobjectConst.NpcPrisonEntry[Random], me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), me.GetAngle(player), TempSummonType.TimedDespawnOOC, 30000); + if (creature) { - me.UseDoorOrButton(); - int Random = (int)(RandomHelper.Rand32() % (GameobjectConst.NpcPrisonEntry.Length / sizeof(uint))); - Creature creature = player.SummonCreature(GameobjectConst.NpcPrisonEntry[Random], me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), me.GetAngle(player), TempSummonType.TimedDespawnOOC, 30000); - if (creature) + if (!creature.IsHostileTo(player)) { - if (!creature.IsHostileTo(player)) + FactionTemplateRecord pFaction = creature.GetFactionTemplateEntry(); + if (pFaction != null) { - FactionTemplateRecord pFaction = creature.GetFactionTemplateEntry(); - if (pFaction != null) + uint spellId = 0; + + switch (pFaction.Faction) { - uint Spell = 0; - - switch (pFaction.Faction) - { - case 1011: Spell = GameobjectConst.SpellRepLc; break; - case 935: Spell = GameobjectConst.SpellRepShat; break; - case 942: Spell = GameobjectConst.SpellRepCe; break; - case 933: Spell = GameobjectConst.SpellRepCon; break; - case 989: Spell = GameobjectConst.SpellRepKt; break; - case 970: Spell = GameobjectConst.SpellRepSpor; break; - } - - if (Spell != 0) - creature.CastSpell(player, Spell, false); - else - Log.outError(LogFilter.Scripts, "go_ethereum_prison summoned Creature (entry {0}) but faction ({1}) are not expected by script.", creature.GetEntry(), creature.GetFaction()); + case 1011: spellId = GameobjectConst.SpellRepLc; break; + case 935: spellId = GameobjectConst.SpellRepShat; break; + case 942: spellId = GameobjectConst.SpellRepCe; break; + case 933: spellId = GameobjectConst.SpellRepCon; break; + case 989: spellId = GameobjectConst.SpellRepKt; break; + case 970: spellId = GameobjectConst.SpellRepSpor; break; } + + if (spellId != 0) + creature.CastSpell(player, spellId, false); + else + Log.outError(LogFilter.Scripts, "go_ethereum_prison summoned Creature (entry {0}) but faction ({1}) are not expected by script.", creature.GetEntry(), creature.GetFaction()); } } - - return false; } - } - public override GameObjectAI GetAI(GameObject go) - { - return new go_ethereum_prisonAI(go); + return false; } } [Script] //go_ethereum_stasis - class go_ethereum_stasis : GameObjectScript + class go_ethereum_stasis : GameObjectAI { - public go_ethereum_stasis() : base("go_ethereum_stasis") { } + public go_ethereum_stasis(GameObject go) : base(go) { } - class go_ethereum_stasisAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_ethereum_stasisAI(GameObject go) : base(go) { } + me.UseDoorOrButton(); + int Random = (int)(RandomHelper.Rand32() % GameobjectConst.NpcStasisEntry.Length / sizeof(uint)); - public override bool GossipHello(Player player) - { - me.UseDoorOrButton(); - int Random = (int)(RandomHelper.Rand32() % GameobjectConst.NpcStasisEntry.Length / sizeof(uint)); + player.SummonCreature(GameobjectConst.NpcStasisEntry[Random], me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), me.GetAngle(player), TempSummonType.TimedDespawnOOC, 30000); - player.SummonCreature(GameobjectConst.NpcStasisEntry[Random], me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), me.GetAngle(player), TempSummonType.TimedDespawnOOC, 30000); - - return false; - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_ethereum_stasisAI(go); + return false; } } [Script] //go_resonite_cask - class go_resonite_cask : GameObjectScript + class go_resonite_cask : GameObjectAI { - public go_resonite_cask() : base("go_resonite_cask") { } + public go_resonite_cask(GameObject go) : base(go) { } - class go_resonite_caskAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_resonite_caskAI(GameObject go) : base(go) { } + if (me.GetGoType() == GameObjectTypes.Goober) + me.SummonCreature(GameobjectConst.NpcGoggeroc, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.TimedDespawnOOC, 300000); - public override bool GossipHello(Player player) - { - if (me.GetGoType() == GameObjectTypes.Goober) - me.SummonCreature(GameobjectConst.NpcGoggeroc, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.TimedDespawnOOC, 300000); - - return false; - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_resonite_caskAI(go); + return false; } } [Script] //go_sacred_fire_of_life - class go_sacred_fire_of_life : GameObjectScript + class go_sacred_fire_of_life : GameObjectAI { - public go_sacred_fire_of_life() : base("go_sacred_fire_of_life") { } + public go_sacred_fire_of_life(GameObject go) : base(go) { } - class go_sacred_fire_of_lifeAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_sacred_fire_of_lifeAI(GameObject go) : base(go) { } + if (me.GetGoType() == GameObjectTypes.Goober) + player.SummonCreature(GameobjectConst.NpcArikara, -5008.338f, -2118.894f, 83.657f, 0.874f, TempSummonType.TimedDespawnOOC, 30000); - public override bool GossipHello(Player player) - { - if (me.GetGoType() == GameObjectTypes.Goober) - player.SummonCreature(GameobjectConst.NpcArikara, -5008.338f, -2118.894f, 83.657f, 0.874f, TempSummonType.TimedDespawnOOC, 30000); - - return true; - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_sacred_fire_of_lifeAI(go); + return true; } } [Script] //go_shrine_of_the_birds - class go_shrine_of_the_birds : GameObjectScript + class go_shrine_of_the_birds : GameObjectAI { - public go_shrine_of_the_birds() : base("go_shrine_of_the_birds") { } + public go_shrine_of_the_birds(GameObject go) : base(go) { } - class go_shrine_of_the_birdsAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_shrine_of_the_birdsAI(GameObject go) : base(go) { } + uint BirdEntry = 0; - public override bool GossipHello(Player player) + float fX, fY, fZ; + me.GetClosePoint(out fX, out fY, out fZ, me.GetCombatReach(), SharedConst.InteractionDistance); + + switch (me.GetEntry()) { - uint BirdEntry = 0; - - float fX, fY, fZ; - me.GetClosePoint(out fX, out fY, out fZ, me.GetCombatReach(), SharedConst.InteractionDistance); - - switch (me.GetEntry()) - { - case GameobjectConst.GoShrineHawk: - BirdEntry = GameobjectConst.NpcHawkGuard; - break; - case GameobjectConst.GoShrineEagle: - BirdEntry = GameobjectConst.NpcEagleGuard; - break; - case GameobjectConst.GoShrineFalcon: - BirdEntry = GameobjectConst.NpcFalconGuard; - break; - } - - if (BirdEntry != 0) - player.SummonCreature(BirdEntry, fX, fY, fZ, me.GetOrientation(), TempSummonType.TimedDespawnOOC, 60000); - - return false; + case GameobjectConst.GoShrineHawk: + BirdEntry = GameobjectConst.NpcHawkGuard; + break; + case GameobjectConst.GoShrineEagle: + BirdEntry = GameobjectConst.NpcEagleGuard; + break; + case GameobjectConst.GoShrineFalcon: + BirdEntry = GameobjectConst.NpcFalconGuard; + break; } - } - public override GameObjectAI GetAI(GameObject go) - { - return new go_shrine_of_the_birdsAI(go); + if (BirdEntry != 0) + player.SummonCreature(BirdEntry, fX, fY, fZ, me.GetOrientation(), TempSummonType.TimedDespawnOOC, 60000); + + return false; } } [Script] //go_southfury_moonstone - class go_southfury_moonstone : GameObjectScript + class go_southfury_moonstone : GameObjectAI { - public go_southfury_moonstone() : base("go_southfury_moonstone") { } + public go_southfury_moonstone(GameObject go) : base(go) { } - class go_southfury_moonstoneAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_southfury_moonstoneAI(GameObject go) : base(go) { } + //implicitTarget=48 not implemented as of writing this code, and manual summon may be just ok for our purpose + //player.CastSpell(player, SpellIds._SUMMON_RIZZLE, false); - public override bool GossipHello(Player player) - { - //implicitTarget=48 not implemented as of writing this code, and manual summon may be just ok for our purpose - //player.CastSpell(player, SPELL_SUMMON_RIZZLE, false); + Creature creature = player.SummonCreature(GameobjectConst.NpcRizzle, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.DeadDespawn, 0); + if (creature) + creature.CastSpell(player, GameobjectConst.SpellBlackjack, false); - Creature creature = player.SummonCreature(GameobjectConst.NpcRizzle, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.DeadDespawn, 0); - if (creature) - creature.CastSpell(player, GameobjectConst.SpellBlackjack, false); - - return false; - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_southfury_moonstoneAI(go); + return false; } } [Script] //go_tele_to_dalaran_crystal - class go_tele_to_dalaran_crystal : GameObjectScript + class go_tele_to_dalaran_crystal : GameObjectAI { - public go_tele_to_dalaran_crystal() : base("go_tele_to_dalaran_crystal") { } + public go_tele_to_dalaran_crystal(GameObject go) : base(go) { } - class go_tele_to_dalaran_crystalAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_tele_to_dalaran_crystalAI(GameObject go) : base(go) { } + if (player.GetQuestRewardStatus(GameobjectConst.QuestTeleCrystalFlag)) + return false; - public override bool GossipHello(Player player) - { - if (player.GetQuestRewardStatus(GameobjectConst.QuestTeleCrystalFlag)) - return false; + player.GetSession().SendNotification(GameobjectConst.GoTeleToDalaranCrystalFailed); - player.GetSession().SendNotification(GameobjectConst.GoTeleToDalaranCrystalFailed); - - return true; - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_tele_to_dalaran_crystalAI(go); + return true; } } [Script] //go_tele_to_violet_stand - class go_tele_to_violet_stand : GameObjectScript + class go_tele_to_violet_stand : GameObjectAI { - public go_tele_to_violet_stand() : base("go_tele_to_violet_stand") { } + public go_tele_to_violet_stand(GameObject go) : base(go) { } - class go_tele_to_violet_standAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_tele_to_violet_standAI(GameObject go) : base(go) { } + if (player.GetQuestRewardStatus(GameobjectConst.QuestLearnLeaveReturn) || player.GetQuestStatus(GameobjectConst.QuestLearnLeaveReturn) == QuestStatus.Incomplete) + return false; - public override bool GossipHello(Player player) - { - if (player.GetQuestRewardStatus(GameobjectConst.QuestLearnLeaveReturn) || player.GetQuestStatus(GameobjectConst.QuestLearnLeaveReturn) == QuestStatus.Incomplete) - return false; - - return true; - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_tele_to_violet_standAI(go); + return true; } } [Script] //go_fel_crystalforge - class go_fel_crystalforge : GameObjectScript + class go_fel_crystalforge : GameObjectAI { - public go_fel_crystalforge() : base("go_fel_crystalforge") { } + public go_fel_crystalforge(GameObject go) : base(go) { } - class go_fel_crystalforgeAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_fel_crystalforgeAI(GameObject go) : base(go) { } + if (me.GetGoType() == GameObjectTypes.QuestGiver) /* != GAMEOBJECT_TYPE_QUESTGIVER) */ + player.PrepareQuestMenu(me.GetGUID()); /* return true*/ - public override bool GossipHello(Player player) - { - if (me.GetGoType() == GameObjectTypes.QuestGiver) /* != GAMEOBJECT_TYPE_QUESTGIVER) */ - player.PrepareQuestMenu(me.GetGUID()); /* return true*/ + player.AddGossipItem(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItem1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef); + player.AddGossipItem(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItem5, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1); - player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItem1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef); - player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItem5, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1); + player.SendGossipMenu(GameobjectConst.GossipFelCrystalforgeText, me.GetGUID()); - player.SEND_GOSSIP_MENU(GameobjectConst.GossipFelCrystalforgeText, me.GetGUID()); - - return true; - } - - public override bool GossipSelect(Player player, uint menuId, uint gossipListId) - { - uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId); - player.PlayerTalkClass.ClearMenus(); - switch (action) - { - case eTradeskill.GossipActionInfoDef: - player.CastSpell(player, GameobjectConst.SpellCreate1FlaskOfBeast, false); - player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItemReturn, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2); - player.SEND_GOSSIP_MENU(GameobjectConst.GossipFelCrystalforgeItemTextReturn, me.GetGUID()); - break; - case eTradeskill.GossipActionInfoDef + 1: - player.CastSpell(player, GameobjectConst.SpellCreate5FlaskOfBeast, false); - player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItemReturn, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2); - player.SEND_GOSSIP_MENU(GameobjectConst.GossipFelCrystalforgeItemTextReturn, me.GetGUID()); - break; - case eTradeskill.GossipActionInfoDef + 2: - player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItem1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef); - player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItem5, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1); - player.SEND_GOSSIP_MENU(GameobjectConst.GossipFelCrystalforgeText, me.GetGUID()); - break; - } - return true; - } + return true; } - public override GameObjectAI GetAI(GameObject go) + public override bool GossipSelect(Player player, uint menuId, uint gossipListId) { - return new go_fel_crystalforgeAI(go); + uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId); + player.PlayerTalkClass.ClearMenus(); + switch (action) + { + case eTradeskill.GossipActionInfoDef: + player.CastSpell(player, GameobjectConst.SpellCreate1FlaskOfBeast, false); + player.AddGossipItem(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItemReturn, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2); + player.SendGossipMenu(GameobjectConst.GossipFelCrystalforgeItemTextReturn, me.GetGUID()); + break; + case eTradeskill.GossipActionInfoDef + 1: + player.CastSpell(player, GameobjectConst.SpellCreate5FlaskOfBeast, false); + player.AddGossipItem(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItemReturn, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2); + player.SendGossipMenu(GameobjectConst.GossipFelCrystalforgeItemTextReturn, me.GetGUID()); + break; + case eTradeskill.GossipActionInfoDef + 2: + player.AddGossipItem(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItem1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef); + player.AddGossipItem(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItem5, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1); + player.SendGossipMenu(GameobjectConst.GossipFelCrystalforgeText, me.GetGUID()); + break; + } + return true; } } [Script] //go_bashir_crystalforge - class go_bashir_crystalforge : GameObjectScript + class go_bashir_crystalforge : GameObjectAI { - public go_bashir_crystalforge() : base("go_bashir_crystalforge") { } + public go_bashir_crystalforge(GameObject go) : base(go) { } - class go_bashir_crystalforgeAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_bashir_crystalforgeAI(GameObject go) : base(go) { } + if (me.GetGoType() == GameObjectTypes.QuestGiver) /* != GAMEOBJECT_TYPE_QUESTGIVER) */ + player.PrepareQuestMenu(me.GetGUID()); /* return true*/ - public override bool GossipHello(Player player) - { - if (me.GetGoType() == GameObjectTypes.QuestGiver) /* != GAMEOBJECT_TYPE_QUESTGIVER) */ - player.PrepareQuestMenu(me.GetGUID()); /* return true*/ + player.AddGossipItem(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItem1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef); + player.AddGossipItem(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItem5, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1); - player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItem1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef); - player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItem5, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1); + player.SendGossipMenu(GameobjectConst.GossipBashirCrystalforgeText, me.GetGUID()); - player.SEND_GOSSIP_MENU(GameobjectConst.GossipBashirCrystalforgeText, me.GetGUID()); - - return true; - } - - public override bool GossipSelect(Player player, uint menuId, uint gossipListId) - { - uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId); - player.PlayerTalkClass.ClearMenus(); - switch (action) - { - case eTradeskill.GossipActionInfoDef: - player.CastSpell(player, GameobjectConst.SpellCreate1FlaskOfSorcerer, false); - player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItemReturn, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2); - player.SEND_GOSSIP_MENU(GameobjectConst.GossipBashirCrystalforgeItemTextReturn, me.GetGUID()); - break; - case eTradeskill.GossipActionInfoDef + 1: - player.CastSpell(player, GameobjectConst.SpellCreate5FlaskOfBeast, false); - player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItemReturn, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2); - player.SEND_GOSSIP_MENU(GameobjectConst.GossipBashirCrystalforgeItemTextReturn, me.GetGUID()); - break; - case eTradeskill.GossipActionInfoDef + 2: - player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItem1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef); - player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItem5, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1); - player.SEND_GOSSIP_MENU(GameobjectConst.GossipBashirCrystalforgeText, me.GetGUID()); - break; - } - return true; - } + return true; } - public override GameObjectAI GetAI(GameObject go) + public override bool GossipSelect(Player player, uint menuId, uint gossipListId) { - return new go_bashir_crystalforgeAI(go); + uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId); + player.PlayerTalkClass.ClearMenus(); + switch (action) + { + case eTradeskill.GossipActionInfoDef: + player.CastSpell(player, GameobjectConst.SpellCreate1FlaskOfSorcerer, false); + player.AddGossipItem(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItemReturn, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2); + player.SendGossipMenu(GameobjectConst.GossipBashirCrystalforgeItemTextReturn, me.GetGUID()); + break; + case eTradeskill.GossipActionInfoDef + 1: + player.CastSpell(player, GameobjectConst.SpellCreate5FlaskOfBeast, false); + player.AddGossipItem(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItemReturn, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2); + player.SendGossipMenu(GameobjectConst.GossipBashirCrystalforgeItemTextReturn, me.GetGUID()); + break; + case eTradeskill.GossipActionInfoDef + 2: + player.AddGossipItem(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItem1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef); + player.AddGossipItem(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItem5, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1); + player.SendGossipMenu(GameobjectConst.GossipBashirCrystalforgeText, me.GetGUID()); + break; + } + return true; } } [Script] //matrix_punchograph - class go_matrix_punchograph : GameObjectScript + class go_matrix_punchograph : GameObjectAI { - public go_matrix_punchograph() : base("go_matrix_punchograph") { } + public go_matrix_punchograph(GameObject go) : base(go) { } - class go_matrix_punchographAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_matrix_punchographAI(GameObject go) : base(go) { } - - public override bool GossipHello(Player player) + switch (me.GetEntry()) { - switch (me.GetEntry()) - { - case GameobjectConst.MatrixPunchograph3005A: - if (player.HasItemCount(GameobjectConst.ItemWhitePunchCard)) - { - player.DestroyItemCount(GameobjectConst.ItemWhitePunchCard, 1, true); - player.CastSpell(player, GameobjectConst.SpellYellowPunchCard, true); - } - break; - case GameobjectConst.MatrixPunchograph3005B: - if (player.HasItemCount(GameobjectConst.ItemYellowPunchCard)) - { - player.DestroyItemCount(GameobjectConst.ItemYellowPunchCard, 1, true); - player.CastSpell(player, GameobjectConst.SpellBluePunchCard, true); - } - break; - case GameobjectConst.MatrixPunchograph3005C: - if (player.HasItemCount(GameobjectConst.ItemBluePunchCard)) - { - player.DestroyItemCount(GameobjectConst.ItemBluePunchCard, 1, true); - player.CastSpell(player, GameobjectConst.SpellRedPunchCard, true); - } - break; - case GameobjectConst.MatrixPunchograph3005D: - if (player.HasItemCount(GameobjectConst.ItemRedPunchCard)) - { - player.DestroyItemCount(GameobjectConst.ItemRedPunchCard, 1, true); - player.CastSpell(player, GameobjectConst.SpellPrismaticPunchCard, true); - } - break; - default: - break; - } - return false; + case GameobjectConst.MatrixPunchograph3005A: + if (player.HasItemCount(GameobjectConst.ItemWhitePunchCard)) + { + player.DestroyItemCount(GameobjectConst.ItemWhitePunchCard, 1, true); + player.CastSpell(player, GameobjectConst.SpellYellowPunchCard, true); + } + break; + case GameobjectConst.MatrixPunchograph3005B: + if (player.HasItemCount(GameobjectConst.ItemYellowPunchCard)) + { + player.DestroyItemCount(GameobjectConst.ItemYellowPunchCard, 1, true); + player.CastSpell(player, GameobjectConst.SpellBluePunchCard, true); + } + break; + case GameobjectConst.MatrixPunchograph3005C: + if (player.HasItemCount(GameobjectConst.ItemBluePunchCard)) + { + player.DestroyItemCount(GameobjectConst.ItemBluePunchCard, 1, true); + player.CastSpell(player, GameobjectConst.SpellRedPunchCard, true); + } + break; + case GameobjectConst.MatrixPunchograph3005D: + if (player.HasItemCount(GameobjectConst.ItemRedPunchCard)) + { + player.DestroyItemCount(GameobjectConst.ItemRedPunchCard, 1, true); + player.CastSpell(player, GameobjectConst.SpellPrismaticPunchCard, true); + } + break; + default: + break; } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_matrix_punchographAI(go); + return false; } } [Script] //go_scourge_cage - class go_scourge_cage : GameObjectScript + class go_scourge_cage : GameObjectAI { - public go_scourge_cage() : base("go_scourge_cage") { } + public go_scourge_cage(GameObject go) : base(go) { } - class go_scourge_cageAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_scourge_cageAI(GameObject go) : base(go) { } - - public override bool GossipHello(Player player) + me.UseDoorOrButton(); + Creature pNearestPrisoner = me.FindNearestCreature(GameobjectConst.NpcScourgePrisoner, 5.0f, true); + if (pNearestPrisoner) { - me.UseDoorOrButton(); - Creature pNearestPrisoner = me.FindNearestCreature(GameobjectConst.NpcScourgePrisoner, 5.0f, true); - if (pNearestPrisoner) - { - player.KilledMonsterCredit(GameobjectConst.NpcScourgePrisoner, pNearestPrisoner.GetGUID()); - pNearestPrisoner.DisappearAndDie(); - } - - return true; + player.KilledMonsterCredit(GameobjectConst.NpcScourgePrisoner, pNearestPrisoner.GetGUID()); + pNearestPrisoner.DisappearAndDie(); } - } - public override GameObjectAI GetAI(GameObject go) - { - return new go_scourge_cageAI(go); + return true; } } [Script] //go_arcane_prison - class go_arcane_prison : GameObjectScript + class go_arcane_prison : GameObjectAI { - public go_arcane_prison() : base("go_arcane_prison") { } + public go_arcane_prison(GameObject go) : base(go) { } - class go_arcane_prisonAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_arcane_prisonAI(GameObject go) : base(go) { } - - public override bool GossipHello(Player player) + if (player.GetQuestStatus(GameobjectConst.QuestPrisonBreak) == QuestStatus.Incomplete) { - if (player.GetQuestStatus(GameobjectConst.QuestPrisonBreak) == QuestStatus.Incomplete) - { - me.SummonCreature(25318, 3485.089844f, 6115.7422188f, 70.966812f, 0, TempSummonType.TimedDespawn, 60000); - player.CastSpell(player, GameobjectConst.SpellArcanePrisonerKillCredit, true); - return true; - } - return false; + me.SummonCreature(25318, 3485.089844f, 6115.7422188f, 70.966812f, 0, TempSummonType.TimedDespawn, 60000); + player.CastSpell(player, GameobjectConst.SpellArcanePrisonerKillCredit, true); + return true; } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_arcane_prisonAI(go); + return false; } } [Script] //go_blood_filled_orb - class go_blood_filled_orb : GameObjectScript + class go_blood_filled_orb : GameObjectAI { - public go_blood_filled_orb() : base("go_blood_filled_orb") { } + public go_blood_filled_orb(GameObject go) : base(go) { } - class go_blood_filled_orbAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_blood_filled_orbAI(GameObject go) : base(go) { } + if (me.GetGoType() == GameObjectTypes.Goober) + player.SummonCreature(GameobjectConst.NpcZelemar, -369.746f, 166.759f, -21.50f, 5.235f, TempSummonType.TimedDespawnOOC, 30000); - public override bool GossipHello(Player player) - { - if (me.GetGoType() == GameObjectTypes.Goober) - player.SummonCreature(GameobjectConst.NpcZelemar, -369.746f, 166.759f, -21.50f, 5.235f, TempSummonType.TimedDespawnOOC, 30000); - - return true; - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_blood_filled_orbAI(go); + return true; } } [Script] //go_jotunheim_cage - class go_jotunheim_cage : GameObjectScript + class go_jotunheim_cage : GameObjectAI { - public go_jotunheim_cage() : base("go_jotunheim_cage") { } + public go_jotunheim_cage(GameObject go) : base(go) { } - class go_jotunheim_cageAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_jotunheim_cageAI(GameObject go) : base(go) { } - - public override bool GossipHello(Player player) + me.UseDoorOrButton(); + Creature pPrisoner = me.FindNearestCreature(GameobjectConst.NpcEbonBladePrisonerHuman, 5.0f, true); + if (!pPrisoner) { - me.UseDoorOrButton(); - Creature pPrisoner = me.FindNearestCreature(GameobjectConst.NpcEbonBladePrisonerHuman, 5.0f, true); + pPrisoner = me.FindNearestCreature(GameobjectConst.NpcEbonBladePrisonerTroll, 5.0f, true); if (!pPrisoner) { - pPrisoner = me.FindNearestCreature(GameobjectConst.NpcEbonBladePrisonerTroll, 5.0f, true); + pPrisoner = me.FindNearestCreature(GameobjectConst.NpcEbonBladePrisonerOrc, 5.0f, true); if (!pPrisoner) - { - pPrisoner = me.FindNearestCreature(GameobjectConst.NpcEbonBladePrisonerOrc, 5.0f, true); - if (!pPrisoner) - pPrisoner = me.FindNearestCreature(GameobjectConst.NpcEbonBladePrisonerNe, 5.0f, true); - } + pPrisoner = me.FindNearestCreature(GameobjectConst.NpcEbonBladePrisonerNe, 5.0f, true); } - if (!pPrisoner || !pPrisoner.IsAlive()) - return false; - - pPrisoner.DisappearAndDie(); - player.KilledMonsterCredit(GameobjectConst.NpcEbonBladePrisonerHuman); - switch (pPrisoner.GetEntry()) - { - case GameobjectConst.NpcEbonBladePrisonerHuman: - player.CastSpell(player, GameobjectConst.SpellSummonBladeKnightH, true); - break; - case GameobjectConst.NpcEbonBladePrisonerNe: - player.CastSpell(player, GameobjectConst.SpellSummonBladeKnightNe, true); - break; - case GameobjectConst.NpcEbonBladePrisonerTroll: - player.CastSpell(player, GameobjectConst.SpellSummonBladeKnightTroll, true); - break; - case GameobjectConst.NpcEbonBladePrisonerOrc: - player.CastSpell(player, GameobjectConst.SpellSummonBladeKnightOrc, true); - break; - } - return true; } - } + if (!pPrisoner || !pPrisoner.IsAlive()) + return false; - public override GameObjectAI GetAI(GameObject go) - { - return new go_jotunheim_cageAI(go); + pPrisoner.DisappearAndDie(); + player.KilledMonsterCredit(GameobjectConst.NpcEbonBladePrisonerHuman); + switch (pPrisoner.GetEntry()) + { + case GameobjectConst.NpcEbonBladePrisonerHuman: + player.CastSpell(player, GameobjectConst.SpellSummonBladeKnightH, true); + break; + case GameobjectConst.NpcEbonBladePrisonerNe: + player.CastSpell(player, GameobjectConst.SpellSummonBladeKnightNe, true); + break; + case GameobjectConst.NpcEbonBladePrisonerTroll: + player.CastSpell(player, GameobjectConst.SpellSummonBladeKnightTroll, true); + break; + case GameobjectConst.NpcEbonBladePrisonerOrc: + player.CastSpell(player, GameobjectConst.SpellSummonBladeKnightOrc, true); + break; + } + return true; } } [Script] - class go_table_theka : GameObjectScript + class go_table_theka : GameObjectAI { - public go_table_theka() : base("go_table_theka") { } + public go_table_theka(GameObject go) : base(go) { } - class go_table_thekaAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_table_thekaAI(GameObject go) : base(go) { } + if (player.GetQuestStatus(GameobjectConst.QuestSpiderGold) == QuestStatus.Incomplete) + player.AreaExploredOrEventHappens(GameobjectConst.QuestSpiderGold); - public override bool GossipHello(Player player) - { - if (player.GetQuestStatus(GameobjectConst.QuestSpiderGold) == QuestStatus.Incomplete) - player.AreaExploredOrEventHappens(GameobjectConst.QuestSpiderGold); + player.SendGossipMenu(GameobjectConst.GossipTableTheka, me.GetGUID()); - player.SEND_GOSSIP_MENU(GameobjectConst.GossipTableTheka, me.GetGUID()); - - return true; - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_table_thekaAI(go); + return true; } } [Script] //go_inconspicuous_landmark - class go_inconspicuous_landmark : GameObjectScript + class go_inconspicuous_landmark : GameObjectAI { - public go_inconspicuous_landmark() : base("go_inconspicuous_landmark") { } + public go_inconspicuous_landmark(GameObject go) : base(go) { } - class go_inconspicuous_landmarkAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_inconspicuous_landmarkAI(GameObject go) : base(go) { } + if (player.HasItemCount(GameobjectConst.ItemCuergosKey)) + return false; - public override bool GossipHello(Player player) - { - if (player.HasItemCount(GameobjectConst.ItemCuergosKey)) - return false; + player.CastSpell(player, GameobjectConst.SpellSummonPiratesTreasureAndTriggerMob, true); - player.CastSpell(player, GameobjectConst.SpellSummonPiratesTreasureAndTriggerMob, true); - - return true; - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_inconspicuous_landmarkAI(go); + return true; } } [Script] //go_soulwell - class go_soulwell : GameObjectScript + class go_soulwell : GameObjectAI { - public go_soulwell() : base("go_soulwell") { } + public go_soulwell(GameObject go) : base(go) { } - class go_soulwellAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_soulwellAI(GameObject go) : base(go) { } - - public override bool GossipHello(Player player) - { - Unit owner = me.GetOwner(); - if (!owner || !owner.IsTypeId(TypeId.Player) || !player.IsInSameRaidWith(owner.ToPlayer())) - return true; - return false; - } + Unit owner = me.GetOwner(); + if (!owner || !owner.IsTypeId(TypeId.Player) || !player.IsInSameRaidWith(owner.ToPlayer())) + return true; + return false; } } [Script] //go_dragonflayer_cage - class go_dragonflayer_cage : GameObjectScript + class go_dragonflayer_cage : GameObjectAI { - public go_dragonflayer_cage() : base("go_dragonflayer_cage") { } + public go_dragonflayer_cage(GameObject go) : base(go) { } - class go_dragonflayer_cageAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_dragonflayer_cageAI(GameObject go) : base(go) { } + me.UseDoorOrButton(); + if (player.GetQuestStatus(GameobjectConst.QuestPrisonersOfWyrmskull) != QuestStatus.Incomplete) + return true; - public override bool GossipHello(Player player) + Creature pPrisoner = me.FindNearestCreature(GameobjectConst.NpcPrisonerPriest, 2.0f); + if (!pPrisoner) { - me.UseDoorOrButton(); - if (player.GetQuestStatus(GameobjectConst.QuestPrisonersOfWyrmskull) != QuestStatus.Incomplete) - return true; - - Creature pPrisoner = me.FindNearestCreature(GameobjectConst.NpcPrisonerPriest, 2.0f); + pPrisoner = me.FindNearestCreature(GameobjectConst.NpcPrisonerMage, 2.0f); if (!pPrisoner) { - pPrisoner = me.FindNearestCreature(GameobjectConst.NpcPrisonerMage, 2.0f); + pPrisoner = me.FindNearestCreature(GameobjectConst.NpcPrisonerWarrior, 2.0f); if (!pPrisoner) - { - pPrisoner = me.FindNearestCreature(GameobjectConst.NpcPrisonerWarrior, 2.0f); - if (!pPrisoner) - pPrisoner = me.FindNearestCreature(GameobjectConst.NpcPrisonerPaladin, 2.0f); - } + pPrisoner = me.FindNearestCreature(GameobjectConst.NpcPrisonerPaladin, 2.0f); } - - if (!pPrisoner || !pPrisoner.IsAlive()) - return true; - - // @todo prisoner should help player for a short period of time - player.KilledMonsterCredit(GameobjectConst.NpcCapturedValgardePrisonerProxy); - pPrisoner.DespawnOrUnsummon(); - return true; } - } - public override GameObjectAI GetAI(GameObject go) - { - return new go_dragonflayer_cageAI(go); + if (!pPrisoner || !pPrisoner.IsAlive()) + return true; + + // @todo prisoner should help player for a short period of time + player.KilledMonsterCredit(GameobjectConst.NpcCapturedValgardePrisonerProxy); + pPrisoner.DespawnOrUnsummon(); + return true; } } [Script] //go_tadpole_cage - class go_tadpole_cage : GameObjectScript + class go_tadpole_cage : GameObjectAI { - public go_tadpole_cage() : base("go_tadpole_cage") { } + public go_tadpole_cage(GameObject go) : base(go) { } - class go_tadpole_cageAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_tadpole_cageAI(GameObject go) : base(go) { } - - public override bool GossipHello(Player player) + me.UseDoorOrButton(); + if (player.GetQuestStatus(GameobjectConst.QuestOhNoesTheTadpoles) == QuestStatus.Incomplete) { - me.UseDoorOrButton(); - if (player.GetQuestStatus(GameobjectConst.QuestOhNoesTheTadpoles) == QuestStatus.Incomplete) + Creature pTadpole = me.FindNearestCreature(GameobjectConst.NpcWinterfinTadpole, 1.0f); + if (pTadpole) { - Creature pTadpole = me.FindNearestCreature(GameobjectConst.NpcWinterfinTadpole, 1.0f); - if (pTadpole) - { - pTadpole.DisappearAndDie(); - player.KilledMonsterCredit(GameobjectConst.NpcWinterfinTadpole); - //FIX: Summon minion tadpole - } + pTadpole.DisappearAndDie(); + player.KilledMonsterCredit(GameobjectConst.NpcWinterfinTadpole); + //FIX: Summon minion tadpole } - return true; } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_tadpole_cageAI(go); + return true; } } [Script] //go_amberpine_outhouse - class go_amberpine_outhouse : GameObjectScript + class go_amberpine_outhouse : GameObjectAI { - public go_amberpine_outhouse() : base("go_amberpine_outhouse") { } + public go_amberpine_outhouse(GameObject go) : base(go) { } - class go_amberpine_outhouseAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_amberpine_outhouseAI(GameObject go) : base(go) { } - - public override bool GossipHello(Player player) + QuestStatus status = player.GetQuestStatus(GameobjectConst.QuestDoingYourDuty); + if (status == QuestStatus.Incomplete || status == QuestStatus.Complete || status == QuestStatus.Rewarded) { - QuestStatus status = player.GetQuestStatus(GameobjectConst.QuestDoingYourDuty); - if (status == QuestStatus.Incomplete || status == QuestStatus.Complete || status == QuestStatus.Rewarded) - { - player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipUseOuthouse, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1); - player.SEND_GOSSIP_MENU(GameobjectConst.GossipOuthouseVacant, me.GetGUID()); - } - else - player.SEND_GOSSIP_MENU(GameobjectConst.GossipOuthouseInuse, me.GetGUID()); - - return true; + player.AddGossipItem(GossipOptionIcon.Chat, GameobjectConst.GossipUseOuthouse, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1); + player.SendGossipMenu(GameobjectConst.GossipOuthouseVacant, me.GetGUID()); } + else + player.SendGossipMenu(GameobjectConst.GossipOuthouseInuse, me.GetGUID()); - public override bool GossipSelect(Player player, uint menuId, uint gossipListId) - { - uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId); - player.PlayerTalkClass.ClearMenus(); - if (action == eTradeskill.GossipActionInfoDef + 1) - { - player.CLOSE_GOSSIP_MENU(); - Creature target = ScriptedAI.GetClosestCreatureWithEntry(player, GameobjectConst.NpcOuthouseBunny, 3.0f); - if (target) - { - target.GetAI().SetData(1, (uint)player.GetGender()); - me.CastSpell(target, GameobjectConst.SpellIndisposedIii); - } - me.CastSpell(player, GameobjectConst.SpellIndisposed); - if (player.HasItemCount(GameobjectConst.ItemAnderholsSliderCider)) - me.CastSpell(player, GameobjectConst.SpellCreateAmberseeds); - return true; - } - else - { - player.CLOSE_GOSSIP_MENU(); - player.GetSession().SendNotification(GameobjectConst.GoAnderholsSliderCiderNotFound); - return false; - } - } + return true; } - public override GameObjectAI GetAI(GameObject go) + public override bool GossipSelect(Player player, uint menuId, uint gossipListId) { - return new go_amberpine_outhouseAI(go); + uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId); + player.PlayerTalkClass.ClearMenus(); + if (action == eTradeskill.GossipActionInfoDef + 1) + { + player.CloseGossipMenu(); + Creature target = ScriptedAI.GetClosestCreatureWithEntry(player, GameobjectConst.NpcOuthouseBunny, 3.0f); + if (target) + { + target.GetAI().SetData(1, (uint)player.GetGender()); + me.CastSpell(target, GameobjectConst.SpellIndisposedIii); + } + me.CastSpell(player, GameobjectConst.SpellIndisposed); + if (player.HasItemCount(GameobjectConst.ItemAnderholsSliderCider)) + me.CastSpell(player, GameobjectConst.SpellCreateAmberseeds); + return true; + } + else + { + player.CloseGossipMenu(); + player.GetSession().SendNotification(GameobjectConst.GoAnderholsSliderCiderNotFound); + return false; + } } } [Script] //go_hive_pod - class go_hive_pod : GameObjectScript + class go_hive_pod : GameObjectAI { - public go_hive_pod() : base("go_hive_pod") { } + public go_hive_pod(GameObject go) : base(go) { } - class go_hive_podAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_hive_podAI(GameObject go) : base(go) { } - - public override bool GossipHello(Player player) - { - player.SendLoot(me.GetGUID(), LootType.Corpse); - me.SummonCreature(GameobjectConst.NpcHiveAmbusher, me.GetPositionX() + 1, me.GetPositionY(), me.GetPositionZ(), me.GetAngle(player), TempSummonType.TimedOrDeadDespawn, 60000); - me.SummonCreature(GameobjectConst.NpcHiveAmbusher, me.GetPositionX(), me.GetPositionY() + 1, me.GetPositionZ(), me.GetAngle(player), TempSummonType.TimedOrDeadDespawn, 60000); - return true; - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_hive_podAI(go); + player.SendLoot(me.GetGUID(), LootType.Corpse); + me.SummonCreature(GameobjectConst.NpcHiveAmbusher, me.GetPositionX() + 1, me.GetPositionY(), me.GetPositionZ(), me.GetAngle(player), TempSummonType.TimedOrDeadDespawn, 60000); + me.SummonCreature(GameobjectConst.NpcHiveAmbusher, me.GetPositionX(), me.GetPositionY() + 1, me.GetPositionZ(), me.GetAngle(player), TempSummonType.TimedOrDeadDespawn, 60000); + return true; } } [Script] - class go_massive_seaforium_charge : GameObjectScript + class go_massive_seaforium_charge : GameObjectAI { - public go_massive_seaforium_charge() : base("go_massive_seaforium_charge") { } + public go_massive_seaforium_charge(GameObject go) : base(go) { } - class go_massive_seaforium_chargeAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_massive_seaforium_chargeAI(GameObject go) : base(go) { } - - public override bool GossipHello(Player player) - { - me.SetLootState(LootState.JustDeactivated); - return true; - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_massive_seaforium_chargeAI(go); + me.SetLootState(LootState.JustDeactivated); + return true; } } [Script] //go_veil_skith_cage - class go_veil_skith_cage : GameObjectScript + class go_veil_skith_cage : GameObjectAI { - public go_veil_skith_cage() : base("go_veil_skith_cage") { } + public go_veil_skith_cage(GameObject go) : base(go) { } - class go_veil_skith_cageAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_veil_skith_cageAI(GameObject go) : base(go) { } - - public override bool GossipHello(Player player) + me.UseDoorOrButton(); + if (player.GetQuestStatus(GameobjectConst.QuestMissingFriends) == QuestStatus.Incomplete) { - me.UseDoorOrButton(); - if (player.GetQuestStatus(GameobjectConst.QuestMissingFriends) == QuestStatus.Incomplete) + List childrenList = new List(); + me.GetCreatureListWithEntryInGrid(childrenList, GameobjectConst.NpcCaptiveChild, SharedConst.InteractionDistance); + foreach (var creature in childrenList) { - List childrenList = new List(); - me.GetCreatureListWithEntryInGrid(childrenList, GameobjectConst.NpcCaptiveChild, SharedConst.InteractionDistance); - foreach (var creature in childrenList) - { - player.KilledMonsterCredit(GameobjectConst.NpcCaptiveChild, creature.GetGUID()); - creature.DespawnOrUnsummon(5000); - creature.GetMotionMaster().MovePoint(1, me.GetPositionX() + 5, me.GetPositionY(), me.GetPositionZ()); - creature.GetAI().Talk(GameobjectConst.SayFree0); - creature.GetMotionMaster().Clear(); - } + player.KilledMonsterCredit(GameobjectConst.NpcCaptiveChild, creature.GetGUID()); + creature.DespawnOrUnsummon(5000); + creature.GetMotionMaster().MovePoint(1, me.GetPositionX() + 5, me.GetPositionY(), me.GetPositionZ()); + creature.GetAI().Talk(GameobjectConst.SayFree0); + creature.GetMotionMaster().Clear(); } - return false; } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_veil_skith_cageAI(go); + return false; } } [Script] //go_frostblade_shrine - class go_frostblade_shrine : GameObjectScript + class go_frostblade_shrine : GameObjectAI { - public go_frostblade_shrine() : base("go_frostblade_shrine") { } + public go_frostblade_shrine(GameObject go) : base(go) { } - class go_frostblade_shrineAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_frostblade_shrineAI(GameObject go) : base(go) { } - - public override bool GossipHello(Player player) - { - me.UseDoorOrButton(10); - if (!player.HasAura(GameobjectConst.SpellRecentMeditation)) - if (player.GetQuestStatus(GameobjectConst.QuestTheCleansingHorde) == QuestStatus.Incomplete || player.GetQuestStatus(GameobjectConst.QuestTheCleansingAlliance) == QuestStatus.Incomplete) - { - player.CastSpell(player, GameobjectConst.SpellCleansingSoul); - player.SetStandState(UnitStandStateType.Sit); - } - return true; - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_frostblade_shrineAI(go); + me.UseDoorOrButton(10); + if (!player.HasAura(GameobjectConst.SpellRecentMeditation)) + if (player.GetQuestStatus(GameobjectConst.QuestTheCleansingHorde) == QuestStatus.Incomplete || player.GetQuestStatus(GameobjectConst.QuestTheCleansingAlliance) == QuestStatus.Incomplete) + { + player.CastSpell(player, GameobjectConst.SpellCleansingSoul); + player.SetStandState(UnitStandStateType.Sit); + } + return true; } } [Script] //go_midsummer_bonfire - class go_midsummer_bonfire : GameObjectScript + class go_midsummer_bonfire : GameObjectAI { - public go_midsummer_bonfire() : base("go_midsummer_bonfire") { } + public go_midsummer_bonfire(GameObject go) : base(go) { } - class go_midsummer_bonfireAI : GameObjectAI + public override bool GossipSelect(Player player, uint menuId, uint gossipListId) { - public go_midsummer_bonfireAI(GameObject go) : base(go) { } - - public override bool GossipSelect(Player player, uint menuId, uint gossipListId) - { - player.CastSpell(player, GameobjectConst.StampOutBonfireQuestComplete, true); - player.CLOSE_GOSSIP_MENU(); - return false; - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_midsummer_bonfireAI(go); + player.CastSpell(player, GameobjectConst.StampOutBonfireQuestComplete, true); + player.CloseGossipMenu(); + return false; } } [Script] - class go_midsummer_ribbon_pole : GameObjectScript + class go_midsummer_ribbon_pole : GameObjectAI { - public go_midsummer_ribbon_pole() : base("go_midsummer_ribbon_pole") { } + public go_midsummer_ribbon_pole(GameObject go) : base(go) { } - class go_midsummer_ribbon_poleAI : GameObjectAI + public override bool GossipHello(Player player) { - public go_midsummer_ribbon_poleAI(GameObject go) : base(go) { } - - public override bool GossipHello(Player player) + Creature creature = me.FindNearestCreature(GameobjectConst.NpcPoleRibbonBunny, 10.0f); + if (creature) { - Creature creature = me.FindNearestCreature(GameobjectConst.NpcPoleRibbonBunny, 10.0f); - if (creature) + creature.GetAI().DoAction(0); + player.CastSpell(creature, GameobjectConst.SpellPoleDance, true); + } + return true; + } + } + + [Script] + class go_toy_train_set : GameObjectAI + { + public go_toy_train_set(GameObject go) : base(go) + { + _scheduler.Schedule(TimeSpan.FromSeconds(3), task => + { + me.CastSpell(null, GameobjectConst.SpellToyTrainPulse, true); + task.Repeat(TimeSpan.FromSeconds(6)); + }); + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + + // triggered on wrecker'd + public override void DoAction(int action) + { + me.Delete(); + } + } + + [Script] + class go_brewfest_music : GameObjectAI + { + public go_brewfest_music(GameObject go) : base(go) + { + _scheduler.Schedule(TimeSpan.FromSeconds(1), task => + { + if (Global.GameEventMgr.IsHolidayActive(HolidayIds.Brewfest)) // Check if Brewfest is active { - creature.GetAI().DoAction(0); - player.CastSpell(creature, GameobjectConst.SpellPoleDance, true); + rnd = RandomHelper.URand(0, 2); // Select random music sample + task.Repeat(TimeSpan.FromMilliseconds(musicTime)); // Select new song music after play time is over } - return true; - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_midsummer_ribbon_poleAI(go); - } - } - - [Script] - class go_toy_train_set : GameObjectScript - { - public go_toy_train_set() : base("go_toy_train_set") { } - - class go_toy_train_setAI : GameObjectAI - { - public go_toy_train_setAI(GameObject go) : base(go) + }); + _scheduler.Schedule(TimeSpan.FromSeconds(2), task => { - _scheduler.Schedule(TimeSpan.FromSeconds(3), task => + if (Global.GameEventMgr.IsHolidayActive(HolidayIds.Brewfest)) // Check if Brewfest is active { - me.CastSpell(null, GameobjectConst.SpellToyTrainPulse, true); - task.Repeat(TimeSpan.FromSeconds(6)); - }); - } - - public override void UpdateAI(uint diff) - { - _scheduler.Update(diff); - } - - // triggered on wrecker'd - public override void DoAction(int action) - { - me.Delete(); - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_toy_train_setAI(go); - } - } - - [Script] - class go_brewfest_music : GameObjectScript - { - public go_brewfest_music() : base("go_brewfest_music") { } - - class go_brewfest_musicAI : GameObjectAI - { - public go_brewfest_musicAI(GameObject go) : base(go) - { - _events.ScheduleEvent(GameobjectConst.EventBmSelectMusic, 1000); - _events.ScheduleEvent(GameobjectConst.EventBmStartMusic, 2000); - } - - public override void UpdateAI(uint diff) - { - _events.Update(diff); - - _events.ExecuteEvents(eventId => - { - switch (eventId) + // Check if gob is correct area, play music, set time of music + if (me.GetAreaId() == GameobjectConst.Silvermoon || me.GetAreaId() == GameobjectConst.Undercity || me.GetAreaId() == GameobjectConst.Orgrimmar1 || me.GetAreaId() == GameobjectConst.Orgrimmar2 || me.GetAreaId() == GameobjectConst.Thunderbluff || me.GetAreaId() == GameobjectConst.Shattrath) { - case GameobjectConst.EventBmSelectMusic: - if (!Global.GameEventMgr.IsHolidayActive(HolidayIds.Brewfest)) // Check if Brewfest is active - break; - rnd = RandomHelper.URand(0, 2); // Select random music sample - _events.ScheduleEvent(GameobjectConst.EventBmSelectMusic, musicTime); // Select new song music after play time is over - break; - case GameobjectConst.EventBmStartMusic: - if (!Global.GameEventMgr.IsHolidayActive(HolidayIds.Brewfest)) // Check if Brewfest is active - break; - // Check if gob is correct area, play music, set time of music - if (me.GetAreaId() == GameobjectConst.Silvermoon || me.GetAreaId() == GameobjectConst.Undercity || me.GetAreaId() == GameobjectConst.Orgrimmar1 || me.GetAreaId() == GameobjectConst.Orgrimmar2 || me.GetAreaId() == GameobjectConst.Thunderbluff || me.GetAreaId() == GameobjectConst.Shattrath) - { - if (rnd == 0) - { - me.PlayDirectMusic(GameobjectConst.EventBrewfestgoblin01); - musicTime = GameobjectConst.EventBrewfestgoblin01Time; - } - else if (rnd == 1) - { - me.PlayDirectMusic(GameobjectConst.EventBrewfestgoblin02); - musicTime = GameobjectConst.EventBrewfestgoblin02Time; - } - else - { - me.PlayDirectMusic(GameobjectConst.EventBrewfestgoblin03); - musicTime = GameobjectConst.EventBrewfestgoblin03Time; - } - } - if (me.GetAreaId() == GameobjectConst.Ironforge1 || me.GetAreaId() == GameobjectConst.Ironforge2 || me.GetAreaId() == GameobjectConst.Stormwind || me.GetAreaId() == GameobjectConst.Exodar || me.GetAreaId() == GameobjectConst.Darnassus || me.GetAreaId() == GameobjectConst.Shattrath) - { - if (rnd == 0) - { - me.PlayDirectMusic(GameobjectConst.EventBrewfestdwarf01); - musicTime = GameobjectConst.EventBrewfestdwarf01Time; - } - else if (rnd == 1) - { - me.PlayDirectMusic(GameobjectConst.EventBrewfestdwarf02); - musicTime = GameobjectConst.EventBrewfestdwarf02Time; - } - else - { - me.PlayDirectMusic(GameobjectConst.EventBrewfestdwarf03); - musicTime = GameobjectConst.EventBrewfestdwarf03Time; - } - } - _events.ScheduleEvent(GameobjectConst.EventBmStartMusic, 5000); // Every 5 second's SMSG_PLAY_MUSIC packet (PlayDirectMusic) is pushed to the client - break; - default: - break; - } - }); - } - - uint rnd; - uint musicTime = 1000; - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_brewfest_musicAI(go); - } - } - - [Script] - class go_midsummer_music : GameObjectScript - { - public go_midsummer_music() : base("go_midsummer_music") { } - - class go_midsummer_musicAI : GameObjectAI - { - public go_midsummer_musicAI(GameObject go) : base(go) - { - _scheduler.Schedule(TimeSpan.FromSeconds(1), task => - { - if (!Global.GameEventMgr.IsHolidayActive(HolidayIds.FireFestival)) - return; - - var playersNearby = me.GetPlayerListInGrid(me.GetMap().GetVisibilityRange()); - foreach (var player in playersNearby) - { - if (player.GetTeam() == Team.Horde) - me.PlayDirectMusic(12325, player); - else - me.PlayDirectMusic(12319, player); - } - - task.Repeat(TimeSpan.FromSeconds(5)); // Every 5 second's SMSG_PLAY_MUSIC packet (PlayDirectMusic) is pushed to the client (sniffed value) - }); - } - - public override void UpdateAI(uint diff) - { - _scheduler.Update(diff); - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_midsummer_musicAI(go); - } - } - - [Script] - class go_darkmoon_faire_music : GameObjectScript - { - public go_darkmoon_faire_music() : base("go_darkmoon_faire_music") { } - - class go_darkmoon_faire_musicAI : GameObjectAI - { - public go_darkmoon_faire_musicAI(GameObject go) : base(go) - { - _scheduler.Schedule(TimeSpan.FromSeconds(1), task => - { - if (Global.GameEventMgr.IsHolidayActive(HolidayIds.DarkmoonFaireElwynn) || !Global.GameEventMgr.IsHolidayActive(HolidayIds.DarkmoonFaireThunder) || !Global.GameEventMgr.IsHolidayActive(HolidayIds.DarkmoonFaireShattrath)) - { - me.PlayDirectMusic(8440); - task.Repeat(TimeSpan.FromSeconds(5)); // Every 5 second's SMSG_PLAY_MUSIC packet (PlayDirectMusic) is pushed to the client (sniffed value) - } - }); - } - - public override void UpdateAI(uint diff) - { - _scheduler.Update(diff); - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_darkmoon_faire_musicAI(go); - } - } - - [Script] - class go_pirate_day_music : GameObjectScript - { - public go_pirate_day_music() : base("go_pirate_day_music") { } - - class go_pirate_day_musicAI : GameObjectAI - { - public go_pirate_day_musicAI(GameObject go) : base(go) - { - _scheduler.Schedule(TimeSpan.FromSeconds(1), task => - { - if (!Global.GameEventMgr.IsHolidayActive(HolidayIds.PiratesDay)) - return; - me.PlayDirectMusic(12845); - task.Repeat(TimeSpan.FromSeconds(5)); // Every 5 second's SMSG_PLAY_MUSIC packet (PlayDirectMusic) is pushed to the client (sniffed value) - }); - } - - public override void UpdateAI(uint diff) - { - _scheduler.Update(diff); - } - } - - public override GameObjectAI GetAI(GameObject go) - { - return new go_pirate_day_musicAI(go); - } - } - - [Script] - class go_bells : GameObjectScript - { - public go_bells() : base("go_bells") { } - - class go_bellsAI : GameObjectAI - { - public go_bellsAI(GameObject go) : base(go) { } - - public override void InitializeAI() - { - switch (me.GetEntry()) - { - case GameobjectConst.GoHordeBell: - _soundId = me.GetAreaId() == GameobjectConst.UndercityArea ? GameobjectConst.BellTollhorde : GameobjectConst.BellTolltribal; - break; - case GameobjectConst.GoAllianceBell: + if (rnd == 0) { - if (me.GetAreaId() == GameobjectConst.Ironforge1Area || me.GetAreaId() == GameobjectConst.Ironforge2Area) - _soundId = GameobjectConst.BellTolldwarfgnome; - else if (me.GetAreaId() == GameobjectConst.DarnassusArea || me.GetZoneId() == GameobjectConst.TeldrassilZone) - _soundId = GameobjectConst.BellTollnightelf; - else - _soundId = GameobjectConst.BellTollalliance; - - break; + me.PlayDirectMusic(GameobjectConst.EventBrewfestgoblin01); + musicTime = GameobjectConst.EventBrewfestgoblin01Time; + } + else if (rnd == 1) + { + me.PlayDirectMusic(GameobjectConst.EventBrewfestgoblin02); + musicTime = GameobjectConst.EventBrewfestgoblin02Time; + } + else + { + me.PlayDirectMusic(GameobjectConst.EventBrewfestgoblin03); + musicTime = GameobjectConst.EventBrewfestgoblin03Time; } - case GameobjectConst.GoKharazhanBell: - _soundId = GameobjectConst.Belltollkharazhan; - break; - } - } - - public override void OnGameEvent(bool start, ushort eventId) - { - if (eventId == GameobjectConst.GameEventHourlyBells && start) - { - var localTm = Time.UnixTimeToDateTime(GameTime.GetGameTime()).ToLocalTime(); - int _rings = (localTm.Hour - 1) % 12 + 1; - - for (var i = 0; i < _rings; ++i) - _events.ScheduleEvent(GameobjectConst.EventRingBell, TimeSpan.FromSeconds(i * 4 + 1)); - } - } - - public override void UpdateAI(uint diff) - { - _events.Update(diff); - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case GameobjectConst.EventRingBell: - me.PlayDirectSound(_soundId); - break; - default: - break; } - }); - } - - uint _soundId; + if (me.GetAreaId() == GameobjectConst.Ironforge1 || me.GetAreaId() == GameobjectConst.Ironforge2 || me.GetAreaId() == GameobjectConst.Stormwind || me.GetAreaId() == GameobjectConst.Exodar || me.GetAreaId() == GameobjectConst.Darnassus || me.GetAreaId() == GameobjectConst.Shattrath) + { + if (rnd == 0) + { + me.PlayDirectMusic(GameobjectConst.EventBrewfestdwarf01); + musicTime = GameobjectConst.EventBrewfestdwarf01Time; + } + else if (rnd == 1) + { + me.PlayDirectMusic(GameobjectConst.EventBrewfestdwarf02); + musicTime = GameobjectConst.EventBrewfestdwarf02Time; + } + else + { + me.PlayDirectMusic(GameobjectConst.EventBrewfestdwarf03); + musicTime = GameobjectConst.EventBrewfestdwarf03Time; + } + } + task.Repeat(TimeSpan.FromSeconds(5)); // Every 5 second's SMSG_PLAY_MUSIC packet (PlayDirectMusic) is pushed to the client + } + }); } - public override GameObjectAI GetAI(GameObject go) + public override void UpdateAI(uint diff) { - return new go_bellsAI(go); + _scheduler.Update(diff); } + + uint rnd; + uint musicTime = 1000; + } + + [Script] + class go_midsummer_music : GameObjectAI + { + public go_midsummer_music(GameObject go) : base(go) + { + _scheduler.Schedule(TimeSpan.FromSeconds(1), task => + { + if (!Global.GameEventMgr.IsHolidayActive(HolidayIds.FireFestival)) + return; + + var playersNearby = me.GetPlayerListInGrid(me.GetMap().GetVisibilityRange()); + foreach (var player in playersNearby) + { + if (player.GetTeam() == Team.Horde) + me.PlayDirectMusic(12325, player); + else + me.PlayDirectMusic(12319, player); + } + + task.Repeat(TimeSpan.FromSeconds(5)); // Every 5 second's SMSG_PLAY_MUSIC packet (PlayDirectMusic) is pushed to the client (sniffed value) + }); + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + } + + [Script] + class go_darkmoon_faire_music : GameObjectAI + { + public go_darkmoon_faire_music(GameObject go) : base(go) + { + _scheduler.Schedule(TimeSpan.FromSeconds(1), task => + { + if (Global.GameEventMgr.IsHolidayActive(HolidayIds.DarkmoonFaireElwynn) || !Global.GameEventMgr.IsHolidayActive(HolidayIds.DarkmoonFaireThunder) || !Global.GameEventMgr.IsHolidayActive(HolidayIds.DarkmoonFaireShattrath)) + { + me.PlayDirectMusic(8440); + task.Repeat(TimeSpan.FromSeconds(5)); // Every 5 second's SMSG_PLAY_MUSIC packet (PlayDirectMusic) is pushed to the client (sniffed value) + } + }); + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + } + + [Script] + class go_pirate_day_music : GameObjectAI + { + public go_pirate_day_music(GameObject go) : base(go) + { + _scheduler.Schedule(TimeSpan.FromSeconds(1), task => + { + if (!Global.GameEventMgr.IsHolidayActive(HolidayIds.PiratesDay)) + return; + me.PlayDirectMusic(12845); + task.Repeat(TimeSpan.FromSeconds(5)); // Every 5 second's SMSG_PLAY_MUSIC packet (PlayDirectMusic) is pushed to the client (sniffed value) + }); + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + } + + [Script] + class go_bells : GameObjectAI + { + public go_bells(GameObject go) : base(go) { } + + public override void InitializeAI() + { + switch (me.GetEntry()) + { + case GameobjectConst.GoHordeBell: + _soundId = me.GetAreaId() == GameobjectConst.UndercityArea ? GameobjectConst.BellTollhorde : GameobjectConst.BellTolltribal; + break; + case GameobjectConst.GoAllianceBell: + { + if (me.GetAreaId() == GameobjectConst.Ironforge1Area || me.GetAreaId() == GameobjectConst.Ironforge2Area) + _soundId = GameobjectConst.BellTolldwarfgnome; + else if (me.GetAreaId() == GameobjectConst.DarnassusArea || me.GetZoneId() == GameobjectConst.TeldrassilZone) + _soundId = GameobjectConst.BellTollnightelf; + else + _soundId = GameobjectConst.BellTollalliance; + + break; + } + case GameobjectConst.GoKharazhanBell: + _soundId = GameobjectConst.Belltollkharazhan; + break; + } + } + + public override void OnGameEvent(bool start, ushort eventId) + { + if (eventId == GameobjectConst.GameEventHourlyBells && start) + { + var localTm = Time.UnixTimeToDateTime(GameTime.GetGameTime()).ToLocalTime(); + int _rings = (localTm.Hour - 1) % 12 + 1; + + for (var i = 0; i < _rings; ++i) + _scheduler.Schedule(TimeSpan.FromSeconds(i * 4 + 1), task => me.PlayDirectSound(_soundId)); + } + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + + uint _soundId; } } diff --git a/Source/Scripts/World/Guards.cs b/Source/Scripts/World/Guards.cs index 2a2b151a4..abaeedc63 100644 --- a/Source/Scripts/World/Guards.cs +++ b/Source/Scripts/World/Guards.cs @@ -61,6 +61,7 @@ namespace Scripts.World { if (me.GetEntry() == CreatureIds.CenarionHoldIndantry) Talk(GuardsConst.SaySilAggro, who); + SpellInfo spell = me.ReachWithSpellAttack(who); if (spell != null) DoCast(who, spell.Id); diff --git a/Source/Scripts/World/NpcProfessions.cs b/Source/Scripts/World/NpcProfessions.cs index f35b7615b..ae00a7eaa 100644 --- a/Source/Scripts/World/NpcProfessions.cs +++ b/Source/Scripts/World/NpcProfessions.cs @@ -14,9 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - - namespace Scripts.World { - } \ No newline at end of file diff --git a/Source/Scripts/World/NpcSpecial.cs b/Source/Scripts/World/NpcSpecial.cs index 874b9ebf2..5b945ada2 100644 --- a/Source/Scripts/World/NpcSpecial.cs +++ b/Source/Scripts/World/NpcSpecial.cs @@ -125,11 +125,11 @@ namespace Scripts.World.NpcSpecial //Argent squire/gruntling public static Tuple[] bannerSpells = { - Tuple.Create(Spells.DarnassusPennant, Spells.SenjinPennant), - Tuple.Create(Spells.ExodarPennant, Spells.UndercityPennant), - Tuple.Create(Spells.GnomereganPennant, Spells.OrgrimmarPennant), - Tuple.Create(Spells.IronforgePennant, Spells.SilvermoonPennant), - Tuple.Create(Spells.StormwindPennant, Spells.ThunderbluffPennant) + Tuple.Create(SpellIds.DarnassusPennant, SpellIds.SenjinPennant), + Tuple.Create(SpellIds.ExodarPennant, SpellIds.UndercityPennant), + Tuple.Create(SpellIds.GnomereganPennant, SpellIds.OrgrimmarPennant), + Tuple.Create(SpellIds.IronforgePennant, SpellIds.SilvermoonPennant), + Tuple.Create(SpellIds.StormwindPennant, SpellIds.ThunderbluffPennant) }; } @@ -227,7 +227,7 @@ namespace Scripts.World.NpcSpecial public const uint RibbonPole = 181605; } - struct Spells + struct SpellIds { public const uint GuardsMark = 38067; @@ -341,7 +341,7 @@ namespace Scripts.World.NpcSpecial public const uint Darkness = 5650; } - struct Texts + struct TextIds { //Lunaclawspirit public const uint TextIdDefault = 4714; @@ -511,7 +511,7 @@ namespace Scripts.World.NpcSpecial if (!who.IsWithinDistInMap(me, NpcSpecialConst.RangeGuardsMark)) return; - Aura markAura = who.GetAura(Spells.GuardsMark); + Aura markAura = who.GetAura(SpellIds.GuardsMark); if (markAura != null) { // the target wasn't able to move out of our range within 25 seconds @@ -535,7 +535,7 @@ namespace Scripts.World.NpcSpecial if (!lastSpawnedGuard) return; - lastSpawnedGuard.CastSpell(who, Spells.GuardsMark, true); + lastSpawnedGuard.CastSpell(who, SpellIds.GuardsMark, true); } break; } @@ -562,90 +562,80 @@ namespace Scripts.World.NpcSpecial } [Script] - class npc_chicken_cluck : CreatureScript + class npc_chicken_cluck : ScriptedAI { - public npc_chicken_cluck() : base("npc_chicken_cluck") { } - - class npc_chicken_cluckAI : ScriptedAI + public npc_chicken_cluck(Creature creature) : base(creature) { - public npc_chicken_cluckAI(Creature creature) : base(creature) + Initialize(); + } + + void Initialize() + { + ResetFlagTimer = 120000; + } + + uint ResetFlagTimer; + + public override void Reset() + { + Initialize(); + me.SetFaction(NpcSpecialConst.FactionChicken); + me.RemoveNpcFlag(NPCFlags.QuestGiver); + } + + public override void EnterCombat(Unit who) { } + + public override void UpdateAI(uint diff) + { + // Reset flags after a certain time has passed so that the next player has to start the 'event' again + if (me.HasNpcFlag(NPCFlags.QuestGiver)) { - Initialize(); - } - - void Initialize() - { - ResetFlagTimer = 120000; - } - - uint ResetFlagTimer; - - public override void Reset() - { - Initialize(); - me.SetFaction(NpcSpecialConst.FactionChicken); - me.RemoveNpcFlag(NPCFlags.QuestGiver); - } - - public override void EnterCombat(Unit who) { } - - public override void UpdateAI(uint diff) - { - // Reset flags after a certain time has passed so that the next player has to start the 'event' again - if (me.HasNpcFlag(NPCFlags.QuestGiver)) + if (ResetFlagTimer <= diff) { - if (ResetFlagTimer <= diff) + EnterEvadeMode(); + return; + } + else + ResetFlagTimer -= diff; + } + + if (UpdateVictim()) + DoMeleeAttackIfReady(); + } + + public override void ReceiveEmote(Player player, TextEmotes emote) + { + switch (emote) + { + case TextEmotes.Chicken: + if (player.GetQuestStatus(QuestConst.Cluck) == QuestStatus.None && RandomHelper.Rand32() % 30 == 1) { - EnterEvadeMode(); - return; + me.AddNpcFlag(NPCFlags.QuestGiver); + me.SetFaction(NpcSpecialConst.FactionFriendly); + Talk(player.GetTeam() == Team.Horde ? TextIds.EmoteHelloH : TextIds.EmoteHelloA); } - else - ResetFlagTimer -= diff; - } - - if (UpdateVictim()) - DoMeleeAttackIfReady(); - } - - public override void ReceiveEmote(Player player, TextEmotes emote) - { - switch (emote) - { - case TextEmotes.Chicken: - if (player.GetQuestStatus(QuestConst.Cluck) == QuestStatus.None && RandomHelper.Rand32() % 30 == 1) - { - me.AddNpcFlag(NPCFlags.QuestGiver); - me.SetFaction(NpcSpecialConst.FactionFriendly); - Talk(player.GetTeam() == Team.Horde ? Texts.EmoteHelloH : Texts.EmoteHelloA); - } - break; - case TextEmotes.Cheer: - if (player.GetQuestStatus(QuestConst.Cluck) == QuestStatus.Complete) - { - me.AddNpcFlag(NPCFlags.QuestGiver); - me.SetFaction(NpcSpecialConst.FactionFriendly); - Talk(Texts.EmoteCluck); - } - break; - } - } - - public override void QuestAccept(Player player, Quest quest) - { - if (quest.Id == QuestConst.Cluck) - Reset(); - } - - public override void QuestReward(Player player, Quest quest, uint opt) - { - if (quest.Id == QuestConst.Cluck) - Reset(); + break; + case TextEmotes.Cheer: + if (player.GetQuestStatus(QuestConst.Cluck) == QuestStatus.Complete) + { + me.AddNpcFlag(NPCFlags.QuestGiver); + me.SetFaction(NpcSpecialConst.FactionFriendly); + Talk(TextIds.EmoteCluck); + } + break; } } - public override CreatureAI GetAI(Creature creature) + public override void QuestAccept(Player player, Quest quest) { - return new npc_chicken_cluckAI(creature); + if (quest.Id == QuestConst.Cluck) + Reset(); + } + + public override void QuestReward(Player player, Quest quest, uint opt) + { + if (quest.Id == QuestConst.Cluck) + Reset(); } } @@ -669,8 +659,8 @@ namespace Scripts.World.NpcSpecial public override void Reset() { Initialize(); - DoCast(me, Spells.Brazier, true); - DoCast(me, Spells.FieryAura, false); + DoCast(me, SpellIds.Brazier, true); + DoCast(me, SpellIds.FieryAura, false); float x, y, z; me.GetPosition(out x, out y, out z); me.Relocate(x, y, z + 0.94f); @@ -717,8 +707,8 @@ namespace Scripts.World.NpcSpecial me.HandleEmoteCommand(Emote.OneshotLaugh); break; case TextEmotes.Dance: - if (!player.HasAura(Spells.Seduction)) - DoCast(player, Spells.Seduction, true); + if (!player.HasAura(SpellIds.Seduction)) + DoCast(player, SpellIds.Seduction, true); break; } } @@ -754,7 +744,7 @@ namespace Scripts.World.NpcSpecial { Unit target = Global.ObjAccessor.GetUnit(me, DoSearchForTargets(_lastTargetGUID)); if (target) - target.CastSpell(target, Spells.TargetIndicator, true); + target.CastSpell(target, SpellIds.TargetIndicator, true); _targetTimer = 3000; } @@ -796,7 +786,7 @@ namespace Scripts.World.NpcSpecial GameObject go = me.FindNearestGameObject(GameobjectIds.RibbonPole, 10.0f); if (go) - me.CastSpell(go, Spells.RedFireRing, true); + me.CastSpell(go, SpellIds.RedFireRing, true); task.Schedule(TimeSpan.FromSeconds(5), task1 => { @@ -808,7 +798,7 @@ namespace Scripts.World.NpcSpecial go = me.FindNearestGameObject(GameobjectIds.RibbonPole, 10.0f); if (go) - me.CastSpell(go, Spells.BlueFireRing, true); + me.CastSpell(go, SpellIds.BlueFireRing, true); task.Repeat(TimeSpan.FromSeconds(5)); }); @@ -829,7 +819,7 @@ namespace Scripts.World.NpcSpecial { // Returns true if no nearby player has aura "Test Ribbon Pole Channel". List players = new List(); - var check = new UnitAuraCheck(true, Spells.RibbonDanceCosmetic); + var check = new UnitAuraCheck(true, SpellIds.RibbonDanceCosmetic); var searcher = new PlayerListSearcher(me, players, check); Cell.VisitWorldObjects(me, searcher, 10.0f); @@ -848,76 +838,108 @@ namespace Scripts.World.NpcSpecial } [Script] - class npc_doctor : CreatureScript + class npc_doctor : ScriptedAI { - public npc_doctor() : base("npc_doctor") { } - - public class npc_doctorAI : ScriptedAI + public npc_doctor(Creature creature) : base(creature) { - public npc_doctorAI(Creature creature) : base(creature) + Initialize(); + } + + void Initialize() + { + PlayerGUID.Clear(); + + SummonPatientTimer = 10000; + SummonPatientCount = 0; + PatientDiedCount = 0; + PatientSavedCount = 0; + + Patients.Clear(); + Coordinates.Clear(); + + Event = false; + } + + public override void Reset() + { + Initialize(); + me.RemoveUnitFlag(UnitFlags.NotSelectable); + } + + public void BeginEvent(Player player) + { + PlayerGUID = player.GetGUID(); + + SummonPatientTimer = 10000; + SummonPatientCount = 0; + PatientDiedCount = 0; + PatientSavedCount = 0; + + switch (me.GetEntry()) { - Initialize(); + case CreatureIds.DoctorAlliance: + foreach (var coord in NpcSpecialConst.DoctorAllianceCoords) + Coordinates.Add(coord); + break; + case CreatureIds.DoctorHorde: + foreach (var coord in NpcSpecialConst.DoctorHordeCoords) + Coordinates.Add(coord); + break; } - void Initialize() + Event = true; + me.AddUnitFlag(UnitFlags.NotSelectable); + } + + public void PatientDied(Position point) + { + Player player = Global.ObjAccessor.GetPlayer(me, PlayerGUID); + if (player && ((player.GetQuestStatus(6624) == QuestStatus.Incomplete) || (player.GetQuestStatus(6622) == QuestStatus.Incomplete))) { - PlayerGUID.Clear(); + ++PatientDiedCount; - SummonPatientTimer = 10000; - SummonPatientCount = 0; - PatientDiedCount = 0; - PatientSavedCount = 0; - - Patients.Clear(); - Coordinates.Clear(); - - Event = false; - } - - public override void Reset() - { - Initialize(); - me.RemoveUnitFlag(UnitFlags.NotSelectable); - } - - public void BeginEvent(Player player) - { - PlayerGUID = player.GetGUID(); - - SummonPatientTimer = 10000; - SummonPatientCount = 0; - PatientDiedCount = 0; - PatientSavedCount = 0; - - switch (me.GetEntry()) + if (PatientDiedCount > 5 && Event) { - case CreatureIds.DoctorAlliance: - foreach (var coord in NpcSpecialConst.DoctorAllianceCoords) - Coordinates.Add(coord); - break; - case CreatureIds.DoctorHorde: - foreach (var coord in NpcSpecialConst.DoctorHordeCoords) - Coordinates.Add(coord); - break; + if (player.GetQuestStatus(6624) == QuestStatus.Incomplete) + player.FailQuest(6624); + else if (player.GetQuestStatus(6622) == QuestStatus.Incomplete) + player.FailQuest(6622); + + Reset(); + return; } - Event = true; - me.AddUnitFlag(UnitFlags.NotSelectable); + Coordinates.Add(point); } + else + // If no player or player abandon quest in progress + Reset(); + } - public void PatientDied(Position point) + public void PatientSaved(Creature soldier, Player player, Position point) + { + if (player && PlayerGUID == player.GetGUID()) { - Player player = Global.ObjAccessor.GetPlayer(me, PlayerGUID); - if (player && ((player.GetQuestStatus(6624) == QuestStatus.Incomplete) || (player.GetQuestStatus(6622) == QuestStatus.Incomplete))) + if ((player.GetQuestStatus(6624) == QuestStatus.Incomplete) || (player.GetQuestStatus(6622) == QuestStatus.Incomplete)) { - ++PatientDiedCount; + ++PatientSavedCount; - if (PatientDiedCount > 5 && Event) + if (PatientSavedCount == 15) { + if (!Patients.Empty()) + { + foreach (var guid in Patients) + { + Creature patient = ObjectAccessor.GetCreature(me, guid); + if (patient) + patient.SetDeathState(DeathState.JustDied); + } + } + if (player.GetQuestStatus(6624) == QuestStatus.Incomplete) - player.FailQuest(6624); + player.AreaExploredOrEventHappens(6624); else if (player.GetQuestStatus(6622) == QuestStatus.Incomplete) - player.FailQuest(6622); + player.AreaExploredOrEventHappens(6622); Reset(); return; @@ -925,122 +947,80 @@ namespace Scripts.World.NpcSpecial Coordinates.Add(point); } - else - // If no player or player abandon quest in progress - Reset(); } - - public void PatientSaved(Creature soldier, Player player, Position point) - { - if (player && PlayerGUID == player.GetGUID()) - { - if ((player.GetQuestStatus(6624) == QuestStatus.Incomplete) || (player.GetQuestStatus(6622) == QuestStatus.Incomplete)) - { - ++PatientSavedCount; - - if (PatientSavedCount == 15) - { - if (!Patients.Empty()) - { - foreach (var guid in Patients) - { - Creature patient = ObjectAccessor.GetCreature(me, guid); - if (patient) - patient.SetDeathState(DeathState.JustDied); - } - } - - if (player.GetQuestStatus(6624) == QuestStatus.Incomplete) - player.AreaExploredOrEventHappens(6624); - else if (player.GetQuestStatus(6622) == QuestStatus.Incomplete) - player.AreaExploredOrEventHappens(6622); - - Reset(); - return; - } - - Coordinates.Add(point); - } - } - } - - public override void UpdateAI(uint diff) - { - if (Event && SummonPatientCount >= 20) - { - Reset(); - return; - } - - if (Event) - { - if (SummonPatientTimer <= diff) - { - if (Coordinates.Empty()) - return; - - uint patientEntry; - switch (me.GetEntry()) - { - case CreatureIds.DoctorAlliance: - patientEntry = NpcSpecialConst.AllianceSoldierId[RandomHelper.Rand32() % 3]; - break; - case CreatureIds.DoctorHorde: - patientEntry = NpcSpecialConst.HordeSoldierId[RandomHelper.Rand32() % 3]; - break; - default: - Log.outError(LogFilter.Scripts, "Invalid entry for Triage doctor. Please check your database"); - return; - } - - var index = RandomHelper.IRand(0, Coordinates.Count - 1); - - Creature Patient = me.SummonCreature(patientEntry, Coordinates[index], TempSummonType.TimedDespawnOOC, 5000); - if (Patient) - { - //303, this flag appear to be required for client side item.spell to work (TARGET_SINGLE_FRIEND) - Patient.AddUnitFlag(UnitFlags.PvpAttackable); - - Patients.Add(Patient.GetGUID()); - ((npc_injured_patient)Patient.GetAI()).DoctorGUID = me.GetGUID(); - ((npc_injured_patient)Patient.GetAI()).Coord = Coordinates[index]; - - Coordinates.RemoveAt(index); - } - - SummonPatientTimer = 10000; - ++SummonPatientCount; - } - else - SummonPatientTimer -= diff; - } - } - - public override void EnterCombat(Unit who) { } - - public override void QuestAccept(Player player, Quest quest) - { - if ((quest.Id == 6624) || (quest.Id == 6622)) - BeginEvent(player); - } - - ObjectGuid PlayerGUID; - - uint SummonPatientTimer; - uint SummonPatientCount; - uint PatientDiedCount; - uint PatientSavedCount; - - bool Event; - - List Patients = new List(); - List Coordinates = new List(); } - public override CreatureAI GetAI(Creature creature) + public override void UpdateAI(uint diff) { - return new npc_doctorAI(creature); + if (Event && SummonPatientCount >= 20) + { + Reset(); + return; + } + + if (Event) + { + if (SummonPatientTimer <= diff) + { + if (Coordinates.Empty()) + return; + + uint patientEntry; + switch (me.GetEntry()) + { + case CreatureIds.DoctorAlliance: + patientEntry = NpcSpecialConst.AllianceSoldierId[RandomHelper.Rand32() % 3]; + break; + case CreatureIds.DoctorHorde: + patientEntry = NpcSpecialConst.HordeSoldierId[RandomHelper.Rand32() % 3]; + break; + default: + Log.outError(LogFilter.Scripts, "Invalid entry for Triage doctor. Please check your database"); + return; + } + + var index = RandomHelper.IRand(0, Coordinates.Count - 1); + + Creature Patient = me.SummonCreature(patientEntry, Coordinates[index], TempSummonType.TimedDespawnOOC, 5000); + if (Patient) + { + //303, this flag appear to be required for client side item.spell to work (TARGET_SINGLE_FRIEND) + Patient.AddUnitFlag(UnitFlags.PvpAttackable); + + Patients.Add(Patient.GetGUID()); + ((npc_injured_patient)Patient.GetAI()).DoctorGUID = me.GetGUID(); + ((npc_injured_patient)Patient.GetAI()).Coord = Coordinates[index]; + + Coordinates.RemoveAt(index); + } + + SummonPatientTimer = 10000; + ++SummonPatientCount; + } + else + SummonPatientTimer -= diff; + } } + + public override void EnterCombat(Unit who) { } + + public override void QuestAccept(Player player, Quest quest) + { + if ((quest.Id == 6624) || (quest.Id == 6622)) + BeginEvent(player); + } + + ObjectGuid PlayerGUID; + + uint SummonPatientTimer; + uint SummonPatientCount; + uint PatientDiedCount; + uint PatientSavedCount; + + bool Event; + + List Patients = new List(); + List Coordinates = new List(); } [Script] @@ -1106,7 +1086,7 @@ namespace Scripts.World.NpcSpecial { Creature doctor = ObjectAccessor.GetCreature(me, DoctorGUID); if (doctor) - ((npc_doctor.npc_doctorAI)doctor.GetAI()).PatientSaved(me, player, Coord); + ((npc_doctor)doctor.GetAI()).PatientSaved(me, player, Coord); } } @@ -1119,7 +1099,7 @@ namespace Scripts.World.NpcSpecial //stand up me.SetStandState(UnitStandStateType.Stand); - Talk(Texts.SayDoc); + Talk(TextIds.SayDoc); uint mobId = me.GetEntry(); me.SetWalk(false); @@ -1156,7 +1136,7 @@ namespace Scripts.World.NpcSpecial { Creature doctor = ObjectAccessor.GetCreature((me), DoctorGUID); if (doctor) - ((npc_doctor.npc_doctorAI)doctor.GetAI()).PatientDied(Coord); + ((npc_doctor)doctor.GetAI()).PatientDied(Coord); } } } @@ -1218,7 +1198,7 @@ namespace Scripts.World.NpcSpecial public override void SpellHit(Unit caster, SpellInfo spell) { - if (spell.Id == Spells.LesserHealR2 || spell.Id == Spells.FortitudeR1) + if (spell.Id == SpellIds.LesserHealR2 || spell.Id == SpellIds.FortitudeR1) { //not while in combat if (me.IsInCombat()) @@ -1233,16 +1213,16 @@ namespace Scripts.World.NpcSpecial { if (quest != 0 && player.GetQuestStatus(quest) == QuestStatus.Incomplete) { - if (IsHealed && !CanRun && spell.Id == Spells.FortitudeR1) + if (IsHealed && !CanRun && spell.Id == SpellIds.FortitudeR1) { - Talk(Texts.SayThanks, caster); + Talk(TextIds.SayThanks, caster); CanRun = true; } - else if (!IsHealed && spell.Id == Spells.LesserHealR2) + else if (!IsHealed && spell.Id == SpellIds.LesserHealR2) { CasterGUID = caster.GetGUID(); me.SetStandState(UnitStandStateType.Stand); - Talk(Texts.SayHealed, caster); + Talk(TextIds.SayHealed, caster); IsHealed = true; } } @@ -1256,7 +1236,6 @@ namespace Scripts.World.NpcSpecial public override void WaypointReached(uint waypointId, uint pathId) { - } public override void UpdateAI(uint diff) @@ -1275,7 +1254,7 @@ namespace Scripts.World.NpcSpecial case CreatureIds.Dolf: case CreatureIds.Korja: case CreatureIds.DgKel: - Talk(Texts.SayGoodbye, unit); + Talk(TextIds.SayGoodbye, unit); break; } @@ -1315,144 +1294,133 @@ namespace Scripts.World.NpcSpecial if (me.IsAttackReady()) { - DoCastVictim(Spells.Deathtouch, true); + DoCastVictim(SpellIds.Deathtouch, true); me.ResetAttackTimer(); } } } [Script] - class npc_sayge : CreatureScript + class npc_sayge : ScriptedAI { - public npc_sayge() : base("npc_sayge") { } + public npc_sayge(Creature creature) : base(creature) { } - class npc_saygeAI : ScriptedAI + public override bool GossipHello(Player player) { - public npc_saygeAI(Creature creature) : base(creature) { } + if (me.IsQuestGiver()) + player.PrepareQuestMenu(me.GetGUID()); - public override bool GossipHello(Player player) + if (player.GetSpellHistory().HasCooldown(SpellIds.Strength) || + player.GetSpellHistory().HasCooldown(SpellIds.Agility) || + player.GetSpellHistory().HasCooldown(SpellIds.Stamina) || + player.GetSpellHistory().HasCooldown(SpellIds.Spirit) || + player.GetSpellHistory().HasCooldown(SpellIds.Intellect) || + player.GetSpellHistory().HasCooldown(SpellIds.Armor) || + player.GetSpellHistory().HasCooldown(SpellIds.Damage) || + player.GetSpellHistory().HasCooldown(SpellIds.Resistance)) + player.SendGossipMenu(GossipMenus.CantGiveYouYour, me.GetGUID()); + else { - if (me.IsQuestGiver()) - player.PrepareQuestMenu(me.GetGUID()); - - if (player.GetSpellHistory().HasCooldown(Spells.Strength) || - player.GetSpellHistory().HasCooldown(Spells.Agility) || - player.GetSpellHistory().HasCooldown(Spells.Stamina) || - player.GetSpellHistory().HasCooldown(Spells.Spirit) || - player.GetSpellHistory().HasCooldown(Spells.Intellect) || - player.GetSpellHistory().HasCooldown(Spells.Armor) || - player.GetSpellHistory().HasCooldown(Spells.Damage) || - player.GetSpellHistory().HasCooldown(Spells.Resistance)) - player.SEND_GOSSIP_MENU(GossipMenus.CantGiveYouYour, me.GetGUID()); - else - { - player.ADD_GOSSIP_ITEM_DB(GossipMenus.IAmReadyToDiscover, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1); - player.SEND_GOSSIP_MENU(GossipMenus.IHaveLongKnown, me.GetGUID()); - } - - return true; + player.ADD_GOSSIP_ITEM_DB(GossipMenus.IAmReadyToDiscover, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1); + player.SendGossipMenu(GossipMenus.IHaveLongKnown, me.GetGUID()); } - void SendAction(Player player, uint action) - { - switch (action) - { - case eTradeskill.GossipActionInfoDef + 1: - player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2); - player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge, GossipMenus.OptionIdAnswer2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 3); - player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge, GossipMenus.OptionIdAnswer3, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 4); - player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge, GossipMenus.OptionIdAnswer4, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 5); - player.SEND_GOSSIP_MENU(GossipMenus.YouHaveBeenTasked, me.GetGUID()); - break; - case eTradeskill.GossipActionInfoDef + 2: - player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge2, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain + 1, eTradeskill.GossipActionInfoDef); - player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge2, GossipMenus.OptionIdAnswer2, eTradeskill.GossipSenderMain + 2, eTradeskill.GossipActionInfoDef); - player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge2, GossipMenus.OptionIdAnswer3, eTradeskill.GossipSenderMain + 3, eTradeskill.GossipActionInfoDef); - player.SEND_GOSSIP_MENU(GossipMenus.SwornExecutioner, me.GetGUID()); - break; - case eTradeskill.GossipActionInfoDef + 3: - player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge3, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain + 4, eTradeskill.GossipActionInfoDef); - player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge3, GossipMenus.OptionIdAnswer2, eTradeskill.GossipSenderMain + 5, eTradeskill.GossipActionInfoDef); - player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge3, GossipMenus.OptionIdAnswer3, eTradeskill.GossipSenderMain + 2, eTradeskill.GossipActionInfoDef); - player.SEND_GOSSIP_MENU(GossipMenus.DiplomaticMission, me.GetGUID()); - break; - case eTradeskill.GossipActionInfoDef + 4: - player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge4, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain + 6, eTradeskill.GossipActionInfoDef); - player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge4, GossipMenus.OptionIdAnswer2, eTradeskill.GossipSenderMain + 7, eTradeskill.GossipActionInfoDef); - player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge4, GossipMenus.OptionIdAnswer3, eTradeskill.GossipSenderMain + 8, eTradeskill.GossipActionInfoDef); - player.SEND_GOSSIP_MENU(GossipMenus.YourBrotherSeeks, me.GetGUID()); - break; - case eTradeskill.GossipActionInfoDef + 5: - player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge5, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain + 5, eTradeskill.GossipActionInfoDef); - player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge5, GossipMenus.OptionIdAnswer2, eTradeskill.GossipSenderMain + 4, eTradeskill.GossipActionInfoDef); - player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge5, GossipMenus.OptionIdAnswer3, eTradeskill.GossipSenderMain + 3, eTradeskill.GossipActionInfoDef); - player.SEND_GOSSIP_MENU(GossipMenus.ATerribleBeast, me.GetGUID()); - break; - case eTradeskill.GossipActionInfoDef: - player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge6, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 6); - player.SEND_GOSSIP_MENU(GossipMenus.YourFortuneIsCast, me.GetGUID()); - break; - case eTradeskill.GossipActionInfoDef + 6: - DoCast(player, Spells.Fortune, false); - player.SEND_GOSSIP_MENU(GossipMenus.HereIsYourFortune, me.GetGUID()); - break; - } - } + return true; + } - public override bool GossipSelect(Player player, uint menuId, uint gossipListId) + void SendAction(Player player, uint action) + { + switch (action) { - uint sender = player.PlayerTalkClass.GetGossipOptionSender(gossipListId); - uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId); - player.PlayerTalkClass.ClearMenus(); - uint spellId = 0; - switch (sender) - { - case eTradeskill.GossipSenderMain: - SendAction(player, action); - break; - case eTradeskill.GossipSenderMain + 1: - spellId = Spells.Damage; - break; - case eTradeskill.GossipSenderMain + 2: - spellId = Spells.Resistance; - break; - case eTradeskill.GossipSenderMain + 3: - spellId = Spells.Armor; - break; - case eTradeskill.GossipSenderMain + 4: - spellId = Spells.Spirit; - break; - case eTradeskill.GossipSenderMain + 5: - spellId = Spells.Intellect; - break; - case eTradeskill.GossipSenderMain + 6: - spellId = Spells.Stamina; - break; - case eTradeskill.GossipSenderMain + 7: - spellId = Spells.Strength; - break; - case eTradeskill.GossipSenderMain + 8: - spellId = Spells.Agility; - break; - } - - if (spellId != 0) - { - DoCast(player, spellId, false); - player.GetSpellHistory().AddCooldown(spellId, 0, TimeSpan.FromHours(2)); - SendAction(player, action); - } - return true; + case eTradeskill.GossipActionInfoDef + 1: + player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2); + player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge, GossipMenus.OptionIdAnswer2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 3); + player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge, GossipMenus.OptionIdAnswer3, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 4); + player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge, GossipMenus.OptionIdAnswer4, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 5); + player.SendGossipMenu(GossipMenus.YouHaveBeenTasked, me.GetGUID()); + break; + case eTradeskill.GossipActionInfoDef + 2: + player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge2, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain + 1, eTradeskill.GossipActionInfoDef); + player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge2, GossipMenus.OptionIdAnswer2, eTradeskill.GossipSenderMain + 2, eTradeskill.GossipActionInfoDef); + player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge2, GossipMenus.OptionIdAnswer3, eTradeskill.GossipSenderMain + 3, eTradeskill.GossipActionInfoDef); + player.SendGossipMenu(GossipMenus.SwornExecutioner, me.GetGUID()); + break; + case eTradeskill.GossipActionInfoDef + 3: + player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge3, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain + 4, eTradeskill.GossipActionInfoDef); + player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge3, GossipMenus.OptionIdAnswer2, eTradeskill.GossipSenderMain + 5, eTradeskill.GossipActionInfoDef); + player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge3, GossipMenus.OptionIdAnswer3, eTradeskill.GossipSenderMain + 2, eTradeskill.GossipActionInfoDef); + player.SendGossipMenu(GossipMenus.DiplomaticMission, me.GetGUID()); + break; + case eTradeskill.GossipActionInfoDef + 4: + player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge4, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain + 6, eTradeskill.GossipActionInfoDef); + player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge4, GossipMenus.OptionIdAnswer2, eTradeskill.GossipSenderMain + 7, eTradeskill.GossipActionInfoDef); + player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge4, GossipMenus.OptionIdAnswer3, eTradeskill.GossipSenderMain + 8, eTradeskill.GossipActionInfoDef); + player.SendGossipMenu(GossipMenus.YourBrotherSeeks, me.GetGUID()); + break; + case eTradeskill.GossipActionInfoDef + 5: + player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge5, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain + 5, eTradeskill.GossipActionInfoDef); + player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge5, GossipMenus.OptionIdAnswer2, eTradeskill.GossipSenderMain + 4, eTradeskill.GossipActionInfoDef); + player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge5, GossipMenus.OptionIdAnswer3, eTradeskill.GossipSenderMain + 3, eTradeskill.GossipActionInfoDef); + player.SendGossipMenu(GossipMenus.ATerribleBeast, me.GetGUID()); + break; + case eTradeskill.GossipActionInfoDef: + player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge6, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 6); + player.SendGossipMenu(GossipMenus.YourFortuneIsCast, me.GetGUID()); + break; + case eTradeskill.GossipActionInfoDef + 6: + DoCast(player, SpellIds.Fortune, false); + player.SendGossipMenu(GossipMenus.HereIsYourFortune, me.GetGUID()); + break; } } - public override CreatureAI GetAI(Creature creature) + public override bool GossipSelect(Player player, uint menuId, uint gossipListId) { - return new npc_saygeAI(creature); + uint sender = player.PlayerTalkClass.GetGossipOptionSender(gossipListId); + uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId); + player.PlayerTalkClass.ClearMenus(); + uint spellId = 0; + switch (sender) + { + case eTradeskill.GossipSenderMain: + SendAction(player, action); + break; + case eTradeskill.GossipSenderMain + 1: + spellId = SpellIds.Damage; + break; + case eTradeskill.GossipSenderMain + 2: + spellId = SpellIds.Resistance; + break; + case eTradeskill.GossipSenderMain + 3: + spellId = SpellIds.Armor; + break; + case eTradeskill.GossipSenderMain + 4: + spellId = SpellIds.Spirit; + break; + case eTradeskill.GossipSenderMain + 5: + spellId = SpellIds.Intellect; + break; + case eTradeskill.GossipSenderMain + 6: + spellId = SpellIds.Stamina; + break; + case eTradeskill.GossipSenderMain + 7: + spellId = SpellIds.Strength; + break; + case eTradeskill.GossipSenderMain + 8: + spellId = SpellIds.Agility; + break; + } + + if (spellId != 0) + { + DoCast(player, spellId, false); + player.GetSpellHistory().AddCooldown(spellId, 0, TimeSpan.FromHours(2)); + SendAction(player, action); + } + return true; } } - [Script] class npc_steam_tonk : ScriptedAI { @@ -1505,7 +1473,7 @@ namespace Scripts.World.NpcSpecial { if (ExplosionTimer <= diff) { - DoCast(me, Spells.TonkMineDetonate, true); + DoCast(me, SpellIds.TonkMineDetonate, true); me.SetDeathState(DeathState.Dead); // unsummon it } else @@ -1524,7 +1492,7 @@ namespace Scripts.World.NpcSpecial return; if (emote == TextEmotes.Dance) - me.CastSpell(player, Spells.BrewfestToast, false); + me.CastSpell(player, SpellIds.BrewfestToast, false); } } @@ -1541,12 +1509,30 @@ namespace Scripts.World.NpcSpecial // TODO: solve this in a different way! setting them as stunned prevents dummies from parrying me.SetControlled(true, UnitState.Stunned);//disable rotate - _events.Reset(); + _scheduler.CancelAll(); _damageTimes.Clear(); if (me.GetEntry() != AdvancedTargetDummy && me.GetEntry() != TargetDummy) - _events.ScheduleEvent(EventCheckCombat, 1000); + { + _scheduler.Schedule(TimeSpan.FromSeconds(1), task => + { + long now = Time.UnixTime; + foreach (var pair in _damageTimes.ToList()) + { + // If unit has not dealt damage to training dummy for 5 seconds, Remove him from combat + if (pair.Value < now - 5) + { + Unit unit = Global.ObjAccessor.GetUnit(me, pair.Key); + if (unit) + unit.GetHostileRefManager().DeleteReference(me); + + _damageTimes.Remove(pair.Key); + } + } + task.Repeat(); + }); + } else - _events.ScheduleEvent(EventDespawn, 15000); + _scheduler.Schedule(TimeSpan.FromSeconds(15), task => me.DespawnOrUnsummon()); } public override void EnterEvadeMode(EvadeReason why) @@ -1572,181 +1558,133 @@ namespace Scripts.World.NpcSpecial if (!me.HasUnitState(UnitState.Stunned)) me.SetControlled(true, UnitState.Stunned);//disable rotate - _events.Update(diff); - - _events.ExecuteEvents(eventId => - { - switch (eventId) - { - case EventCheckCombat: - long now = Time.UnixTime; - foreach (var pair in _damageTimes.ToList()) - { - // If unit has not dealt damage to training dummy for 5 seconds, remove him from combat - if (pair.Value < now - 5) - { - Unit unit = Global.ObjAccessor.GetUnit(me, pair.Key); - if (unit) - unit.GetHostileRefManager().DeleteReference(me); - - _damageTimes.Remove(pair.Key); - } - } - _events.ScheduleEvent(EventCheckCombat, 1000); - break; - case EventDespawn: - me.DespawnOrUnsummon(); - break; - } - }); + _scheduler.Update(diff); } public override void MoveInLineOfSight(Unit who) { } Dictionary _damageTimes = new Dictionary(); - const int EventCheckCombat = 1; - const int EventDespawn = 2; const uint AdvancedTargetDummy = 2674; const uint TargetDummy = 2673; } [Script] - class npc_wormhole : CreatureScript + class npc_wormhole : PassiveAI { - public npc_wormhole() : base("npc_wormhole") { } - - class npc_wormholeAI : PassiveAI + public npc_wormhole(Creature creature) : base(creature) { - public npc_wormholeAI(Creature creature) : base(creature) - { - Initialize(); - } - - void Initialize() - { - _showUnderground = RandomHelper.URand(0, 100) == 0; // Guessed value, it is really rare though - } - - public override void InitializeAI() - { - Initialize(); - } - - public override bool GossipHello(Player player) - { - if (me.IsSummon()) - { - if (player == me.ToTempSummon().GetSummoner()) - { - player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1); - player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2); - player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole3, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 3); - player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole4, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 4); - player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole5, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 5); - - if (_showUnderground) - player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole6, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 6); - - player.SEND_GOSSIP_MENU(Texts.Wormhole, me.GetGUID()); - } - } - - return true; - } - - public override bool GossipSelect(Player player, uint menuId, uint gossipListId) - { - uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId); - player.PlayerTalkClass.ClearMenus(); - - switch (action) - { - case eTradeskill.GossipActionInfoDef + 1: // Borean Tundra - player.CLOSE_GOSSIP_MENU(); - DoCast(player, Spells.BoreanTundra, false); - break; - case eTradeskill.GossipActionInfoDef + 2: // Howling Fjord - player.CLOSE_GOSSIP_MENU(); - DoCast(player, Spells.HowlingFjord, false); - break; - case eTradeskill.GossipActionInfoDef + 3: // Sholazar Basin - player.CLOSE_GOSSIP_MENU(); - DoCast(player, Spells.SholazarBasin, false); - break; - case eTradeskill.GossipActionInfoDef + 4: // Icecrown - player.CLOSE_GOSSIP_MENU(); - DoCast(player, Spells.Icecrown, false); - break; - case eTradeskill.GossipActionInfoDef + 5: // Storm peaks - player.CLOSE_GOSSIP_MENU(); - DoCast(player, Spells.StormPeaks, false); - break; - case eTradeskill.GossipActionInfoDef + 6: // Underground - player.CLOSE_GOSSIP_MENU(); - DoCast(player, Spells.Underground, false); - break; - } - - return true; - } - - bool _showUnderground; + Initialize(); } - public override CreatureAI GetAI(Creature creature) + void Initialize() { - return new npc_wormholeAI(creature); + _showUnderground = RandomHelper.URand(0, 100) == 0; // Guessed value, it is really rare though } + + public override void InitializeAI() + { + Initialize(); + } + + public override bool GossipHello(Player player) + { + if (me.IsSummon()) + { + if (player == me.ToTempSummon().GetSummoner()) + { + player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1); + player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2); + player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole3, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 3); + player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole4, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 4); + player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole5, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 5); + + if (_showUnderground) + player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole6, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 6); + + player.SendGossipMenu(TextIds.Wormhole, me.GetGUID()); + } + } + + return true; + } + + public override bool GossipSelect(Player player, uint menuId, uint gossipListId) + { + uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId); + player.PlayerTalkClass.ClearMenus(); + + switch (action) + { + case eTradeskill.GossipActionInfoDef + 1: // Borean Tundra + player.CloseGossipMenu(); + DoCast(player, SpellIds.BoreanTundra, false); + break; + case eTradeskill.GossipActionInfoDef + 2: // Howling Fjord + player.CloseGossipMenu(); + DoCast(player, SpellIds.HowlingFjord, false); + break; + case eTradeskill.GossipActionInfoDef + 3: // Sholazar Basin + player.CloseGossipMenu(); + DoCast(player, SpellIds.SholazarBasin, false); + break; + case eTradeskill.GossipActionInfoDef + 4: // Icecrown + player.CloseGossipMenu(); + DoCast(player, SpellIds.Icecrown, false); + break; + case eTradeskill.GossipActionInfoDef + 5: // Storm peaks + player.CloseGossipMenu(); + DoCast(player, SpellIds.StormPeaks, false); + break; + case eTradeskill.GossipActionInfoDef + 6: // Underground + player.CloseGossipMenu(); + DoCast(player, SpellIds.Underground, false); + break; + } + + return true; + } + + bool _showUnderground; } [Script] - class npc_experience : CreatureScript + class npc_experience : ScriptedAI { - public npc_experience() : base("npc_experience") { } + public npc_experience(Creature creature) : base(creature) { } - class npc_experienceAI : ScriptedAI + public override bool GossipHello(Player player) { - public npc_experienceAI(Creature creature) : base(creature) { } - - public override bool GossipHello(Player player) + if (player.HasPlayerFlag(PlayerFlags.NoXPGain)) // not gaining XP { - if (player.HasPlayerFlag(PlayerFlags.NoXPGain)) // not gaining XP - { - player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdXpOnOff, GossipMenus.OptionIdXpOn, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1); - player.SEND_GOSSIP_MENU(Texts.XpOnOff, me.GetGUID()); - } - else // currently gaining XP - { - player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdXpOnOff, GossipMenus.OptionIdXpOff, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2); - player.SEND_GOSSIP_MENU(Texts.XpOnOff, me.GetGUID()); - } - return true; + player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdXpOnOff, GossipMenus.OptionIdXpOn, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1); + player.SendGossipMenu(TextIds.XpOnOff, me.GetGUID()); } - - public override bool GossipSelect(Player player, uint menuId, uint gossipListId) + else // currently gaining XP { - uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId); - player.PlayerTalkClass.ClearMenus(); - - switch (action) - { - case eTradeskill.GossipActionInfoDef + 1:// XP ON selected - player.RemovePlayerFlag(PlayerFlags.NoXPGain); // turn on XP gain - break; - case eTradeskill.GossipActionInfoDef + 2:// XP OFF selected - player.AddPlayerFlag(PlayerFlags.NoXPGain); // turn off XP gain - break; - } - - player.PlayerTalkClass.SendCloseGossip(); - return true; + player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdXpOnOff, GossipMenus.OptionIdXpOff, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2); + player.SendGossipMenu(TextIds.XpOnOff, me.GetGUID()); } + return true; } - public override CreatureAI GetAI(Creature creature) + public override bool GossipSelect(Player player, uint menuId, uint gossipListId) { - return new npc_experienceAI(creature); + uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId); + player.PlayerTalkClass.ClearMenus(); + + switch (action) + { + case eTradeskill.GossipActionInfoDef + 1:// XP ON selected + player.RemovePlayerFlag(PlayerFlags.NoXPGain); // turn on XP gain + break; + case eTradeskill.GossipActionInfoDef + 2:// XP OFF selected + player.AddPlayerFlag(PlayerFlags.NoXPGain); // turn off XP gain + break; + } + + player.PlayerTalkClass.SendCloseGossip(); + return true; } } @@ -1832,29 +1770,29 @@ namespace Scripts.World.NpcSpecial switch (entry) { case CreatureIds.FireworkBlue: - return Spells.RocketBlue; + return SpellIds.RocketBlue; case CreatureIds.FireworkGreen: - return Spells.RocketGreen; + return SpellIds.RocketGreen; case CreatureIds.FireworkPurple: - return Spells.RocketPurple; + return SpellIds.RocketPurple; case CreatureIds.FireworkRed: - return Spells.RocketRed; + return SpellIds.RocketRed; case CreatureIds.FireworkYellow: - return Spells.RocketYellow; + return SpellIds.RocketYellow; case CreatureIds.FireworkWhite: - return Spells.RocketWhite; + return SpellIds.RocketWhite; case CreatureIds.FireworkBigBlue: - return Spells.RocketBigBlue; + return SpellIds.RocketBigBlue; case CreatureIds.FireworkBigGreen: - return Spells.RocketBigGreen; + return SpellIds.RocketBigGreen; case CreatureIds.FireworkBigPurple: - return Spells.RocketBigPurple; + return SpellIds.RocketBigPurple; case CreatureIds.FireworkBigRed: - return Spells.RocketBigRed; + return SpellIds.RocketBigRed; case CreatureIds.FireworkBigYellow: - return Spells.RocketBigYellow; + return SpellIds.RocketBigYellow; case CreatureIds.FireworkBigWhite: - return Spells.RocketBigWhite; + return SpellIds.RocketBigWhite; default: return 0; } @@ -1949,7 +1887,7 @@ namespace Scripts.World.NpcSpecial } } if (me.GetEntry() == CreatureIds.ClusterElune) - DoCast(Spells.LunarFortune); + DoCast(SpellIds.LunarFortune); float displacement = 0.7f; for (byte i = 0; i < 4; i++) @@ -1999,7 +1937,7 @@ namespace Scripts.World.NpcSpecial inLove = true; Unit owner = me.GetOwner(); if (owner) - owner.CastSpell(owner, Spells.SpringFling, true); + owner.CastSpell(owner, SpellIds.SpringFling, true); } public override void UpdateAI(uint diff) @@ -2010,14 +1948,14 @@ namespace Scripts.World.NpcSpecial { Unit rabbit = Global.ObjAccessor.GetUnit(me, rabbitGUID); if (rabbit) - DoCast(rabbit, Spells.SpringRabbitJump); + DoCast(rabbit, SpellIds.SpringRabbitJump); jumpTimer = RandomHelper.URand(5000, 10000); } else jumpTimer -= diff; if (bunnyTimer <= diff) { - DoCast(Spells.SummonBabyBunny); + DoCast(SpellIds.SummonBabyBunny); bunnyTimer = RandomHelper.URand(20000, 40000); } else bunnyTimer -= diff; @@ -2029,14 +1967,14 @@ namespace Scripts.World.NpcSpecial Creature rabbit = me.FindNearestCreature(CreatureIds.SpringRabbit, 10.0f); if (rabbit) { - if (rabbit == me || rabbit.HasAura(Spells.SpringRabbitInLove)) + if (rabbit == me || rabbit.HasAura(SpellIds.SpringRabbitInLove)) return; - me.AddAura(Spells.SpringRabbitInLove, me); + me.AddAura(SpellIds.SpringRabbitInLove, me); DoAction(1); - rabbit.AddAura(Spells.SpringRabbitInLove, rabbit); + rabbit.AddAura(SpellIds.SpringRabbitInLove, rabbit); rabbit.GetAI().DoAction(1); - rabbit.CastSpell(rabbit, Spells.SpringRabbitJump, true); + rabbit.CastSpell(rabbit, SpellIds.SpringRabbitJump, true); rabbitGUID = rabbit.GetGUID(); } searchTimer = RandomHelper.URand(5000, 10000); @@ -2166,7 +2104,7 @@ namespace Scripts.World.NpcSpecial GameObject target = VerifyTarget(); if (target) { - me.CastSpell(target, Spells.WreckTrain, false); + me.CastSpell(target, SpellIds.WreckTrain, false); target.GetAI().DoAction(TrainWrecker.ActionWrecked); _timer = 2 * Time.InMilliseconds; _nextAction = TrainWrecker.EventDoDance; @@ -2214,21 +2152,21 @@ namespace Scripts.World.NpcSpecial ScheduleTasks(); } - void ScheduleTasks() + public void ScheduleTasks() { _scheduler.Schedule(TimeSpan.FromSeconds(1), task => { - Aura ownerTired = me.GetOwner().GetAura(Spells.TiredPlayer); + Aura ownerTired = me.GetOwner().GetAura(SpellIds.TiredPlayer); if (ownerTired != null) { - Aura squireTired = me.AddAura(IsArgentSquire() ? Spells.AuraTiredS : Spells.AuraTiredG, me); + Aura squireTired = me.AddAura(IsArgentSquire() ? SpellIds.AuraTiredS : SpellIds.AuraTiredG, me); if (squireTired != null) squireTired.SetDuration(ownerTired.GetDuration()); } }); _scheduler.Schedule(TimeSpan.FromSeconds(1), task => { - if ((me.HasAura(Spells.AuraTiredS) || me.HasAura(Spells.AuraTiredG)) && me.HasNpcFlag(NPCFlags.Banker | NPCFlags.Mailbox | NPCFlags.Vendor)) + if ((me.HasAura(SpellIds.AuraTiredS) || me.HasAura(SpellIds.AuraTiredG)) && me.HasNpcFlag(NPCFlags.Banker | NPCFlags.Mailbox | NPCFlags.Vendor)) me.RemoveNpcFlag(NPCFlags.Banker | NPCFlags.Mailbox | NPCFlags.Vendor); task.Repeat(); }); @@ -2241,23 +2179,23 @@ namespace Scripts.World.NpcSpecial case GossipMenus.OptionIdBank: { me.AddNpcFlag(NPCFlags.Banker); - uint _bankAura = IsArgentSquire() ? Spells.AuraBankS : Spells.AuraBankG; + uint _bankAura = IsArgentSquire() ? SpellIds.AuraBankS : SpellIds.AuraBankG; if (!me.HasAura(_bankAura)) DoCastSelf(_bankAura); - if (!player.HasAura(Spells.TiredPlayer)) - player.CastSpell(player, Spells.TiredPlayer, true); + if (!player.HasAura(SpellIds.TiredPlayer)) + player.CastSpell(player, SpellIds.TiredPlayer, true); break; } case GossipMenus.OptionIdShop: { me.AddNpcFlag(NPCFlags.Vendor); - uint _shopAura = IsArgentSquire() ? Spells.AuraShopS : Spells.AuraShopG; + uint _shopAura = IsArgentSquire() ? SpellIds.AuraShopS : SpellIds.AuraShopG; if (!me.HasAura(_shopAura)) DoCastSelf(_shopAura); - if (!player.HasAura(Spells.TiredPlayer)) - player.CastSpell(player, Spells.TiredPlayer, true); + if (!player.HasAura(SpellIds.TiredPlayer)) + player.CastSpell(player, SpellIds.TiredPlayer, true); break; } case GossipMenus.OptionIdMail: @@ -2265,12 +2203,12 @@ namespace Scripts.World.NpcSpecial me.AddNpcFlag(NPCFlags.Mailbox); player.GetSession().SendShowMailBox(me.GetGUID()); - uint _mailAura = IsArgentSquire() ? Spells.AuraPostmanS : Spells.AuraPostmanG; + uint _mailAura = IsArgentSquire() ? SpellIds.AuraPostmanS : SpellIds.AuraPostmanG; if (!me.HasAura(_mailAura)) DoCastSelf(_mailAura); - if (!player.HasAura(Spells.TiredPlayer)) - player.CastSpell(player, Spells.TiredPlayer, true); + if (!player.HasAura(SpellIds.TiredPlayer)) + player.CastSpell(player, SpellIds.TiredPlayer, true); break; } case GossipMenus.OptionIdDarnassusSenjinPennant: diff --git a/Source/WorldServer/WorldServer.csproj b/Source/WorldServer/WorldServer.csproj index 0cbe73493..88c15ae51 100644 --- a/Source/WorldServer/WorldServer.csproj +++ b/Source/WorldServer/WorldServer.csproj @@ -10,6 +10,7 @@ +