diff --git a/Source/Game/Entities/Conversation.cs b/Source/Game/Entities/Conversation.cs index 01447e2b8..1591cf11b 100644 --- a/Source/Game/Entities/Conversation.cs +++ b/Source/Game/Entities/Conversation.cs @@ -165,7 +165,7 @@ namespace Game.Entities Global.ScriptMgr.OnConversationCreate(this, creator); } - bool Start() + public bool Start() { foreach (ConversationLine line in m_conversationData.Lines.GetValue()) { diff --git a/Source/Game/Entities/Object/WorldObject.cs b/Source/Game/Entities/Object/WorldObject.cs index 2fda4988e..1ea26fc1e 100644 --- a/Source/Game/Entities/Object/WorldObject.cs +++ b/Source/Game/Entities/Object/WorldObject.cs @@ -2881,7 +2881,6 @@ namespace Game.Entities return creatureList; } - public List GetPlayerListInGrid(float maxSearchRange, bool alive = true) { List playerList = new(); diff --git a/Source/Game/Entities/Unit/Unit.Combat.cs b/Source/Game/Entities/Unit/Unit.Combat.cs index 77afaaf58..a74781664 100644 --- a/Source/Game/Entities/Unit/Unit.Combat.cs +++ b/Source/Game/Entities/Unit/Unit.Combat.cs @@ -109,6 +109,29 @@ namespace Game.Entities owner.RemoveUnitFlag(UnitFlags.PetInCombat); } + public bool IsAttackingPlayer() + { + if (HasUnitState(UnitState.AttackPlayer)) + return true; + + foreach (var unit in m_Controlled) + if (unit.IsAttackingPlayer()) + return true; + + for (byte i = 0; i < SharedConst.MaxSummonSlot; ++i) + { + if (!m_SummonSlot[i].IsEmpty()) + { + Creature summon = GetMap().GetCreature(m_SummonSlot[i]); + if (summon != null) + if (summon.IsAttackingPlayer()) + return true; + } + } + + return false; + } + public void RemoveAllAttackers() { while (!attackerList.Empty()) @@ -372,7 +395,7 @@ namespace Game.Entities { SendMessageToSet(new SAttackStop(this, victim), true); - if (victim != null) + if (victim != null) Log.outInfo(LogFilter.Unit, "{0} {1} stopped attacking {2} {3}", (IsTypeId(TypeId.Player) ? "Player" : "Creature"), GetGUID().ToString(), (victim.IsTypeId(TypeId.Player) ? "player" : "creature"), victim.GetGUID().ToString()); else @@ -555,7 +578,7 @@ namespace Game.Entities }); if (auraEffect != null) - meleeAttackSpellId = (uint)auraEffect.GetSpellEffectInfo().MiscValue; + meleeAttackSpellId = (uint)auraEffect.GetSpellEffectInfo().MiscValue; } if (meleeAttackSpellId == 0) @@ -832,7 +855,7 @@ namespace Game.Entities } new KillRewarder(tappers.ToArray(), victim, false).Reward(); - } + } // Do KILL and KILLED procs. KILL proc is called only for the unit who landed the killing blow (and its owner - for pets and totems) regardless of who tapped the victim if (attacker != null && (attacker.IsPet() || attacker.IsTotem())) diff --git a/Source/Scripts/Argus/AntorusTheBurningThrone/GarothiWorldbreaker.cs b/Source/Scripts/Argus/AntorusTheBurningThrone/GarothiWorldbreaker.cs index d09783ecb..b836804ca 100644 --- a/Source/Scripts/Argus/AntorusTheBurningThrone/GarothiWorldbreaker.cs +++ b/Source/Scripts/Argus/AntorusTheBurningThrone/GarothiWorldbreaker.cs @@ -1,17 +1,16 @@ // Copyright (c) CypherCore All rights reserved. // Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. -using Game.Entities; -using Game.Scripting; -using Game.AI; -using Game.Maps; -using Game.Spells; -using System.Linq; -using System.Collections.Generic; 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.Argus.AntorusTheBurningThrone.GarothiWorldbreaker +namespace Scripts.Argus.AntorusTheBurningThrone.Argus { struct TextIds { @@ -83,8 +82,8 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker { // Garothi Worldbreaker public const uint ReengagePlayers = 1; - public const uint FelBombardment= 2; - public const uint SearingBarrage= 3; + public const uint FelBombardment = 2; + public const uint SearingBarrage = 3; public const uint CannonChooser = 4; public const uint SurgingFel = 5; } @@ -94,22 +93,22 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker public const uint MinTargetsSize = 2; public const uint MaxTargetsSize = 6; + public const uint DataLastFiredCannon = 0; public const byte SummonGroupIdSurgingFel = 0; public const ushort AnimKitIdCannonDestroyed = 13264; - public const uint DataLastFiredCannon = 0; public const uint MaxApocalypseDriveCount = 2; - public static Position AnnihilationCenterReferencePos = new(-3296.72f, 9767.78f, -60.0f); - + public static Position AnnihilationCenterReferencePos = new(-3296.72f, 9767.78f, -60.0f); + public static void PreferNonTankTargetsAndResizeTargets(List targets, Unit caster) { if (targets.Empty()) return; - List targetsCopy = targets; - byte size = (byte)targetsCopy.Count; + List targetsCopy = new(targets); + int size = targetsCopy.Count; // Selecting our prefered target size based on total targets (min 10 player: 2, max 30 player: 6) - byte preferedSize = (byte)(Math.Min(Math.Max(MathF.Ceiling(size / 5), MiscConst.MinTargetsSize), MiscConst.MaxTargetsSize)); + uint preferedSize = (uint)Math.Min(Math.Max(MathF.Ceiling(size / 5), MinTargetsSize), MaxTargetsSize); // Now we get rid of the tank as these abilities prefer non-tanks above tanks as long as there are alternatives targetsCopy.RemoveAll(new VictimCheck(caster, false)); @@ -127,9 +126,41 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker } } + class VictimCheck : ICheck + { + Unit _caster; + bool _keepTank; // true = Remove all nontank targets | false = Remove current tank + + public VictimCheck(Unit caster, bool keepTank) + { + _caster = caster; + _keepTank = keepTank; + } + + public bool Invoke(WorldObject obj) + { + Unit unit = obj.ToUnit(); + if (unit == null) + return true; + + if (_caster.GetVictim() != null && _caster.GetVictim() != unit) + return _keepTank; + + return false; + } + } + [Script] class boss_garothi_worldbreaker : BossAI { + byte[] _apocalypseDriveHealthLimit = new byte[MiscConst.MaxApocalypseDriveCount]; + byte _apocalypseDriveCount; + uint _searingBarrageSpellId; + uint _lastCanonEntry; + bool _castEradication; + ObjectGuid _lastSurgingFelDummyGuid; + List _surgingFelDummyGuids = new(); + public boss_garothi_worldbreaker(Creature creature) : base(creature, DataTypes.GarothiWorldbreaker) { _lastCanonEntry = CreatureIds.Decimator; @@ -179,7 +210,7 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker instance.SendEncounterUnit(EncounterFrameType.Disengage, me); _events.Reset(); CleanupEncounter(); - _DespawnAtEvade(TimeSpan.FromSeconds(30)); + _DespawnAtEvade(); } public override void KilledUnit(Unit victim) @@ -232,7 +263,7 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker me.SetUninteractible(true); Creature decimator = instance.GetCreature(DataTypes.Decimator); - if (decimator) + if (decimator != null) { instance.SendEncounterUnit(EncounterFrameType.Engage, decimator, 2); decimator.SetUnitFlag(UnitFlags.InCombat); @@ -240,7 +271,7 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker } Creature annihilator = instance.GetCreature(DataTypes.Annihilator); - if (annihilator) + if (annihilator != null) { instance.SendEncounterUnit(EncounterFrameType.Engage, annihilator, 2); annihilator.SetUnitFlag(UnitFlags.InCombat); @@ -361,10 +392,11 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker break; case EventIds.SurgingFel: { - _surgingFelDummyGuids.Remove(_lastSurgingFelDummyGuid); - _lastSurgingFelDummyGuid = _surgingFelDummyGuids.SelectRandom(); + List guids = new(_surgingFelDummyGuids); + guids.Remove(_lastSurgingFelDummyGuid); + _lastSurgingFelDummyGuid = guids.SelectRandom(); Creature dummy = ObjectAccessor.GetCreature(me, _lastSurgingFelDummyGuid); - if (dummy) + if (dummy != null) dummy.CastSpell(dummy, SpellIds.SurgingFelAreaTrigger); _events.Repeat(TimeSpan.FromSeconds(8)); @@ -374,29 +406,22 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker break; } }); - - if (me.GetVictim() && me.GetVictim().IsWithinMeleeRange(me)) + + + if (me.GetVictim() != null && me.GetVictim().IsWithinMeleeRange(me)) DoMeleeAttackIfReady(); else DoSpellAttackIfReady(SpellIds.Carnage); } - byte[] _apocalypseDriveHealthLimit = new byte[MiscConst.MaxApocalypseDriveCount]; - byte _apocalypseDriveCount; - uint _searingBarrageSpellId; - uint _lastCanonEntry; - bool _castEradication; - ObjectGuid _lastSurgingFelDummyGuid; - List _surgingFelDummyGuids = new(); - void CleanupEncounter() { Creature decimator = instance.GetCreature(DataTypes.Decimator); - if (decimator) + if (decimator != null) instance.SendEncounterUnit(EncounterFrameType.Disengage, decimator); Creature annihilator = instance.GetCreature(DataTypes.Annihilator); - if (annihilator) + if (annihilator != null) instance.SendEncounterUnit(EncounterFrameType.Disengage, annihilator); instance.DoRemoveAurasDueToSpellOnPlayers(SpellIds.DecimationWarning); @@ -408,7 +433,7 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker void HideCannons() { Creature decimator = instance.GetCreature(DataTypes.Decimator); - if (decimator) + if (decimator != null) { instance.SendEncounterUnit(EncounterFrameType.Disengage, decimator); decimator.SetUninteractible(true); @@ -416,7 +441,7 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker } Creature annihilator = instance.GetCreature(DataTypes.Annihilator); - if (annihilator) + if (annihilator != null) { instance.SendEncounterUnit(EncounterFrameType.Disengage, annihilator); annihilator.SetUninteractible(true); @@ -428,6 +453,8 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker [Script] class at_garothi_annihilation : AreaTriggerAI { + byte _playerCount; + public at_garothi_annihilation(AreaTrigger areatrigger) : base(areatrigger) { Initialize(); @@ -446,7 +473,7 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker _playerCount++; Unit annihilation = at.GetCaster(); - if (annihilation) + if (annihilation != null) annihilation.RemoveAurasDueToSpell(SpellIds.AnnihilationWarning); } @@ -464,8 +491,6 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker annihilation.CastSpell(annihilation, SpellIds.AnnihilationWarning); } } - - byte _playerCount; } [Script] @@ -478,12 +503,12 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker void HandlePeriodic(AuraEffect aurEff) { - GetTarget().CastSpell(GetTarget(), SpellIds.ApocalypseDrivePeriodicDamage, new CastSpellExtraArgs(aurEff)); + GetTarget().CastSpell(GetTarget(), SpellIds.ApocalypseDrivePeriodicDamage, aurEff); } public override void Register() { - OnEffectPeriodic.Add(new EffectPeriodicHandler(HandlePeriodic, 1, AuraType.PeriodicDummy)); + OnEffectPeriodic.Add(new(HandlePeriodic, 1, AuraType.PeriodicDummy)); } } @@ -501,14 +526,14 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker return; Unit caster = GetCaster(); - if (caster) + if (caster != null) targets.RemoveAll(new VictimCheck(caster, true)); } void HandleWarningEffect(uint effIndex) { - Creature caster = GetCaster() ? GetCaster().ToCreature() : null; - if (!caster || !caster.IsAIEnabled()) + Creature caster = GetCaster()?.ToCreature(); + if (caster == null || !caster.IsAIEnabled()) return; Unit target = GetHitUnit(); @@ -519,8 +544,8 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker public override void Register() { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEnemy)); - OnEffectHitTarget.Add(new EffectHandler(HandleWarningEffect, 0, SpellEffectName.Dummy)); + OnObjectAreaTargetSelect.Add(new(FilterTargets, 0, Targets.UnitSrcAreaEnemy)); + OnEffectHitTarget.Add(new(HandleWarningEffect, 0, SpellEffectName.Dummy)); } } @@ -537,14 +562,14 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker if (GetTargetApplication().GetRemoveMode() == AuraRemoveMode.Expire) { Unit caster = GetCaster(); - if (caster) + if (caster != null) caster.CastSpell(GetTarget(), SpellIds.FelBombardmentPeriodic, true); } } public override void Register() { - AfterEffectRemove.Add(new EffectApplyHandler(AfterRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + AfterEffectRemove.Add(new(AfterRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); } } @@ -553,19 +578,19 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker { public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellEffect(spellInfo.Id, 0) && ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue()); + return ValidateSpellEffect((spellInfo.Id, 0)) && ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue()); } void HandlePeriodic(AuraEffect aurEff) { Unit caster = GetCaster(); - if (caster) + if (caster != null) caster.CastSpell(GetTarget(), (uint)aurEff.GetSpellEffectInfo().CalcValue(caster), true); } public override void Register() { - OnEffectPeriodic.Add(new EffectPeriodicHandler(HandlePeriodic, 0, AuraType.PeriodicTriggerSpell)); + OnEffectPeriodic.Add(new(HandlePeriodic, 0, AuraType.PeriodicTriggerSpell)); } } @@ -584,7 +609,7 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleHit, 0, SpellEffectName.Dummy)); + OnEffectHitTarget.Add(new(HandleHit, 0, SpellEffectName.Dummy)); } } @@ -605,14 +630,14 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker { uint spellId = GetEffectValue() == SpellIds.SearingBarrageDummyAnnihilator ? SpellIds.SearingBarrageDamageAnnihilator : SpellIds.SearingBarrageDamageDecimator; Unit caster = GetCaster(); - if (caster) + if (caster != null) caster.CastSpell(GetHitUnit(), spellId, true); } public override void Register() { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEntry)); - OnEffectHitTarget.Add(new EffectHandler(HandleHit, 0, SpellEffectName.Dummy)); + OnObjectAreaTargetSelect.Add(new(FilterTargets, 0, Targets.UnitSrcAreaEntry)); + OnEffectHitTarget.Add(new(HandleHit, 0, SpellEffectName.Dummy)); } } @@ -632,11 +657,11 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker void HandleHit(uint effIndex) { Unit caster = GetCaster(); - if (caster) + if (caster != null) { caster.CastSpell(GetHitUnit(), SpellIds.DecimationWarning, true); Creature decimator = caster.ToCreature(); - if (decimator) + if (decimator != null) if (decimator.IsAIEnabled()) decimator.GetAI().Talk(TextIds.SayAnnounceDecimation, GetHitUnit()); } @@ -644,8 +669,8 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker public override void Register() { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitSrcAreaEnemy)); - OnEffectHitTarget.Add(new EffectHandler(HandleHit, 0, SpellEffectName.Dummy)); + OnObjectAreaTargetSelect.Add(new(FilterTargets, 0, Targets.UnitSrcAreaEnemy)); + OnEffectHitTarget.Add(new(HandleHit, 0, SpellEffectName.Dummy)); } } @@ -662,7 +687,7 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker if (GetTargetApplication().GetRemoveMode() == AuraRemoveMode.Expire) { Unit caster = GetCaster(); - if (caster) + if (caster != null) { caster.CastSpell(GetTarget(), SpellIds.DecimationMissile, true); if (!caster.HasUnitState(UnitState.Casting)) @@ -673,7 +698,7 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker public override void Register() { - AfterEffectRemove.Add(new EffectApplyHandler(AfterRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + AfterEffectRemove.Add(new(AfterRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); } } @@ -682,7 +707,7 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker { void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo) { - // Usually we could just handle this via spell_proc but since we want + // Usually we could just handle this via spell_proc but Math.Since we want // to silence the console message because it's not a spell trigger proc, we need a script here. PreventDefaultAction(); Remove(); @@ -690,7 +715,7 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker public override void Register() { - OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.PeriodicTriggerSpell)); + OnEffectProc.Add(new(HandleProc, 0, AuraType.PeriodicTriggerSpell)); } } @@ -699,19 +724,19 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker { public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellEffect(spellInfo.Id, 0) && ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue()); + return ValidateSpellEffect((spellInfo.Id, 0)) && ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue()); } void HandleHit(uint effIndex) { Unit caster = GetCaster(); - if (caster) + if (caster != null) caster.CastSpell(GetHitUnit(), (uint)GetEffectInfo().CalcValue(caster), true); } public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleHit, 0, SpellEffectName.Dummy)); + OnEffectHitTarget.Add(new(HandleHit, 0, SpellEffectName.Dummy)); } } @@ -734,7 +759,7 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleHit, 1, SpellEffectName.Dummy)); + OnEffectHitTarget.Add(new(HandleHit, 1, SpellEffectName.Dummy)); } } @@ -744,16 +769,16 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker void ChangeDamage() { Unit caster = GetCaster(); - if (caster) + if (caster != null) { - uint damageReduction = (uint)MathFunctions.CalculatePct(GetHitDamage(), GetHitUnit().GetDistance(caster)); - SetHitDamage((int)(GetHitDamage() - damageReduction)); + int damageReduction = MathFunctions.CalculatePct(GetHitDamage(), GetHitUnit().GetDistance(caster)); + SetHitDamage(GetHitDamage() - damageReduction); } } public override void Register() { - OnHit.Add(new HitHandler(ChangeDamage)); + OnHit.Add(new(ChangeDamage)); } } @@ -773,7 +798,7 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker public override void Register() { - AfterEffectRemove.Add(new EffectApplyHandler(AfterRemove, 0, AuraType.AreaTrigger, AuraEffectHandleModes.Real)); + AfterEffectRemove.Add(new(AfterRemove, 0, AuraType.AreaTrigger, AuraEffectHandleModes.Real)); } } @@ -783,7 +808,7 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker void HandleDummyEffect(uint effIndex) { Creature caster = GetHitCreature(); - if (!caster || !caster.IsAIEnabled()) + if (caster == null || !caster.IsAIEnabled()) return; InstanceScript instance = caster.GetInstanceScript(); @@ -794,23 +819,23 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker Creature annihilator = instance.GetCreature(DataTypes.Annihilator); uint lastCannonEntry = caster.GetAI().GetData(MiscConst.DataLastFiredCannon); - if ((lastCannonEntry == CreatureIds.Annihilator && decimator) || (decimator && !annihilator)) + if ((lastCannonEntry == CreatureIds.Annihilator && decimator != null) || (decimator != null && annihilator == null)) { decimator.CastSpell(decimator, SpellIds.DecimationSelector, true); caster.GetAI().Talk(TextIds.SayDecimation, decimator); lastCannonEntry = CreatureIds.Decimator; } - else if ((lastCannonEntry == CreatureIds.Decimator && annihilator) || (annihilator && !decimator)) + else if ((lastCannonEntry == CreatureIds.Decimator && annihilator != null) || (annihilator != null && decimator == null)) { - byte count = (byte)(caster.GetMap().GetDifficultyID() == Difficulty.MythicRaid ? MiscConst.MaxTargetsSize : - Math.Max(MiscConst.MinTargetsSize, Math.Ceiling((float)caster.GetMap().GetPlayersCountExceptGMs() / 5))); + int count = (int)(caster.GetMap().GetDifficultyID() == Difficulty.MythicRaid ? MiscConst.MaxTargetsSize : + Math.Max(MiscConst.MinTargetsSize, MathF.Ceiling((float)caster.GetMap().GetPlayersCountExceptGMs() / 5))); for (byte i = 0; i < count; i++) { - float x = MiscConst.AnnihilationCenterReferencePos.GetPositionX() + MathF.Cos(RandomHelper.FRand(0.0f, MathF.PI * 2)) * RandomHelper.FRand(15.0f, 30.0f); - float y = MiscConst.AnnihilationCenterReferencePos.GetPositionY() + MathF.Sin(RandomHelper.FRand(0.0f, MathF.PI * 2)) * RandomHelper.FRand(15.0f, 30.0f); + float x = MiscConst.AnnihilationCenterReferencePos.GetPositionX() + MathF.Cos(RandomHelper.FRand(0.0f, (float)(MathF.PI * 2))) * RandomHelper.FRand(15.0f, 30.0f); + float y = MiscConst.AnnihilationCenterReferencePos.GetPositionY() + MathF.Sin(RandomHelper.FRand(0.0f, (float)(MathF.PI * 2))) * RandomHelper.FRand(15.0f, 30.0f); float z = caster.GetMap().GetHeight(caster.GetPhaseShift(), x, y, MiscConst.AnnihilationCenterReferencePos.GetPositionZ()); - annihilator.CastSpell(new Position(x, y, z), SpellIds.AnnihilationSummon, new CastSpellExtraArgs(true)); + annihilator.CastSpell(new Position(x, y, z), SpellIds.AnnihilationSummon, true); } annihilator.CastSpell(annihilator, SpellIds.AnnihilationDummy); @@ -824,32 +849,7 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleDummyEffect, 0, SpellEffectName.Dummy)); + OnEffectHitTarget.Add(new(HandleDummyEffect, 0, SpellEffectName.Dummy)); } } - - class VictimCheck : ICheck - { - public VictimCheck(Unit caster, bool keepTank) - { - _caster = caster; - _keepTank = keepTank; - } - - public bool Invoke(WorldObject obj) - { - Unit unit = obj.ToUnit(); - if (!unit) - return true; - - if (_caster.GetVictim() && _caster.GetVictim() != unit) - return _keepTank; - - return false; - } - - Unit _caster; - bool _keepTank; // true = remove all nontank targets | false = remove current tank - } -} - +} \ No newline at end of file diff --git a/Source/Scripts/Argus/AntorusTheBurningThrone/InstanceAntorusTheBurningThrone.cs b/Source/Scripts/Argus/AntorusTheBurningThrone/InstanceAntorusTheBurningThrone.cs index c25bd2c3a..8279a4476 100644 --- a/Source/Scripts/Argus/AntorusTheBurningThrone/InstanceAntorusTheBurningThrone.cs +++ b/Source/Scripts/Argus/AntorusTheBurningThrone/InstanceAntorusTheBurningThrone.cs @@ -1,10 +1,9 @@ // Copyright (c) CypherCore All rights reserved. // Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. +using Game.Entities; using Game.Maps; using Game.Scripting; -using Game.Entities; -using Framework.Constants; namespace Scripts.Argus.AntorusTheBurningThrone { @@ -28,20 +27,17 @@ namespace Scripts.Argus.AntorusTheBurningThrone public const uint Annihilator = 12; } - struct BossIds - { - // Bosses - public const uint GarothiWorldbreaker = 122450; - public const uint EncounterCount = 10; - } - struct CreatureIds { - // Garothi Worldbreaker - public const uint Decimator = 122773; - public const uint Annihilator = 122778; - public const uint Annihilation = 122818; - public const uint GarothiWorldbreaker = 124167; + // Bosses + public const uint BossGarothiWorldbreaker = 122450; + + // Encounter related creatures + //Garothi Worldbreaker + public const uint Decimator = 122773; + public const uint Annihilator = 122778; + public const uint Annihilation = 122818; + public const uint GarothiWorldbreaker = 124167; } struct GameObjectIds @@ -50,48 +46,51 @@ namespace Scripts.Argus.AntorusTheBurningThrone public const uint Rock = 278488; } + struct MiscConst + { + public static ObjectData[] creatureData = + { + new(CreatureIds.BossGarothiWorldbreaker, DataTypes.GarothiWorldbreaker), + new(CreatureIds.Decimator, DataTypes.Decimator), + new(CreatureIds.Annihilator, DataTypes.Annihilator) + }; + + public static DoorData[] doorData = + { + new(GameObjectIds.Collision, DataTypes.GarothiWorldbreaker, Framework.Constants.DoorType.Passage), + new(GameObjectIds.Rock, DataTypes.GarothiWorldbreaker, Framework.Constants.DoorType.Passage) + }; + + public static DungeonEncounterData[] encounters = + { + new(DataTypes.GarothiWorldbreaker, 2076), + new(DataTypes.FelhoundsOfSageras, 2074), + new(DataTypes.AntoranHighCommand, 2070), + new(DataTypes.PortalKeeperHasabel, 2064), + new(DataTypes.EonarTheLifeBinder, 2075), + new(DataTypes.ImonarTheSoulhunter, 2082), + new(DataTypes.Kingaroth, 2088), + new(DataTypes.Varimathras, 2069), + new(DataTypes.TheCovenOfShivarra, 2073), + new(DataTypes.Aggramar, 2063), + new(DataTypes.ArgusTheUnmaker, 2092) + }; + } + [Script] class instance_antorus_the_burning_throne : InstanceMapScript { - static ObjectData[] creatureData = - { - new ObjectData(BossIds.GarothiWorldbreaker, DataTypes.GarothiWorldbreaker), - new ObjectData(CreatureIds.Decimator, DataTypes.Decimator), - new ObjectData(CreatureIds.Annihilator, DataTypes.Annihilator) - }; - - static DoorData[] doorData = - { - new DoorData(GameObjectIds.Collision, DataTypes.GarothiWorldbreaker, DoorType.Passage), - new DoorData(GameObjectIds.Rock, DataTypes.GarothiWorldbreaker, DoorType.Passage) - }; - - static DungeonEncounterData[] encounters = - { - new DungeonEncounterData(DataTypes.GarothiWorldbreaker, 2076), - new DungeonEncounterData(DataTypes.FelhoundsOfSageras, 2074), - new DungeonEncounterData(DataTypes.AntoranHighCommand, 2070), - new DungeonEncounterData(DataTypes.PortalKeeperHasabel, 2064), - new DungeonEncounterData(DataTypes.EonarTheLifeBinder, 2075), - new DungeonEncounterData(DataTypes.ImonarTheSoulhunter, 2082), - new DungeonEncounterData(DataTypes.Kingaroth, 2088), - new DungeonEncounterData(DataTypes.Varimathras, 2069), - new DungeonEncounterData(DataTypes.TheCovenOfShivarra, 2073), - new DungeonEncounterData(DataTypes.Aggramar, 2063), - new DungeonEncounterData(DataTypes.ArgusTheUnmaker, 2092) - }; - - public instance_antorus_the_burning_throne() : base("instance_antorus_the_burning_throne", 1712) { } + public instance_antorus_the_burning_throne() : base(nameof(instance_antorus_the_burning_throne), 1712) { } class instance_antorus_the_burning_throne_InstanceMapScript : InstanceScript { public instance_antorus_the_burning_throne_InstanceMapScript(InstanceMap map) : base(map) { SetHeaders("ABT"); - SetBossNumber(BossIds.EncounterCount); - LoadObjectData(creatureData, null); - LoadDoorData(doorData); - LoadDungeonEncounterData(encounters); + SetBossNumber(10); + LoadObjectData(MiscConst.creatureData, null); + LoadDoorData(MiscConst.doorData); + LoadDungeonEncounterData(MiscConst.encounters); } public override void OnCreatureCreate(Creature creature) @@ -102,7 +101,7 @@ namespace Scripts.Argus.AntorusTheBurningThrone { case CreatureIds.Annihilation: Creature garothi = GetCreature(DataTypes.GarothiWorldbreaker); - if (garothi) + if (garothi != null) garothi.GetAI().JustSummoned(creature); break; default: diff --git a/Source/Scripts/BrokenIsles/ZoneMardum.cs b/Source/Scripts/BrokenIsles/ZoneMardum.cs new file mode 100644 index 000000000..d0fb3fa9d --- /dev/null +++ b/Source/Scripts/BrokenIsles/ZoneMardum.cs @@ -0,0 +1,555 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using Framework.Constants; +using Framework.Dynamic; +using Game; +using Game.AI; +using Game.Entities; +using Game.Maps; +using Game.Scripting; +using Game.Spells; +using System; +using System.Collections.Generic; +using static Global; + +namespace Scripts.BrokenIsles.ZoneMardum +{ + + enum MardumQuestData + { + QuestDemonHunterIntroTracker = 40076 + } + + enum MardumSoundData + { + } + + [Script] + class scene_demonhunter_intro : SceneScript + { + const uint ConvoDemonhunterIntroStart = 705; + + public scene_demonhunter_intro() : base("scene_demonhunter_intro") { } + + public override void OnSceneStart(Player player, uint sceneInstanceID, SceneTemplate sceneTemplate) + { + Conversation.CreateConversation(ConvoDemonhunterIntroStart, player, player, player.GetGUID(), null); + } + + public override void OnSceneComplete(Player player, uint sceneInstanceID, SceneTemplate sceneTemplate) + { + PhasingHandler.OnConditionChange(player); + } + } + + [Script] // 196030 - Start: Quest Invis + class spell_demon_hunter_intro_AuraScript : AuraScript + { + const uint SpellStartDemonHunterPlayScene = 193525; + + void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode) + { + GetTarget().CastSpell(null, SpellStartDemonHunterPlayScene, true); + } + + public override void Register() + { + AfterEffectRemove.Add(new(AfterRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + } + } + + struct TheInvasionBeginsConst + { + public const uint QuestTheInvasionBegins = 40077; + + public const int ConvoTheInvasionBegins = 922; + + public const uint NpcKaynSunfuryInvasionBegins = 93011; + public const uint NpcJayceDarkweaverInvasionBegins = 98228; + public const uint NpcAllariTheSouleaterInvasionBegins = 98227; + public const uint NpcCyanaNightglaiveInvasionBegins = 98290; + public const uint NpcKorvasBloodthornInvasionBegins = 98292; + public const uint NpcSevisBrightflameInvasionBegins = 99918; + public const uint NpcWrathWarriorInvasionBegins = 94580; + + public const uint SpellTheInvasionBegins = 187382; + public const uint SpellTrackTargetInChannel = 175799; + public const uint SpellDemonHunterGlideState = 199303; + + // Kayn + public const uint PathKaynAttackDemon = 9301100; + public const uint PathKaynAfterDemon = 9301101; + + // Path before Jump + public const uint PathJayceInvasionBegins = 9822800; + public const uint PathAllariInvasionBegins = 9822700; + public const uint PathCyanaInvasionBegins = 9829000; + public const uint PathKorvasinvasionBegins = 9829200; + public const uint PathSevisinvasionBegins = 9991800; + + // Path after Jump + public const uint PathJayceJupinvasionBegins = 9822801; + public const uint PathAllariJupinvasionBegins = 9822701; + public const uint PathCyanaJupinvasionBegins = 9829001; + public const uint PathKorvasJupinvasionBegins = 9829201; + public const uint PathSevisJupinvasionBegins = 9991801; + + public const uint PointIllidariLandPos = 1; + public const uint PointKaynTriggerDoubleJump = 2; + public const uint PointKaynMoveToDemon = 3; + + public const ushort AnimDhWings = 58110; + public const ushort AnimDhRun = 9767; + public const ushort AnimDhRunAllari = 9180; + + public const uint SpellVisualKitKaynGlide = 59738; + public const uint SpellVisualKitKaynWings = 59406; + public const uint SpellVisualKitKaynDoubleJump = 58110; + public const uint SpellVisualKitKorvasJump = 63071; + public const uint SpellVisualKitWrathWarriorDie = 58476; + + public static Position WrathWarriorSpawnPosition = new(1081.9166f, 3183.8716f, 26.335993f); + public static Position KaynJumpPos = new(1172.17f, 3202.55f, 54.3479f); + public static Position KaynDoubleJumpPosition = new(1094.2384f, 3186.058f, 28.81562f); + public static Position JayceJumpPos = new(1119.24f, 3203.42f, 38.1061f); + public static Position AllariJumpPos = new(1120.08f, 3197.2f, 36.8502f); + public static Position KorvasJumpPos = new(1117.89f, 3196.24f, 36.2158f); + public static Position SevisJumpPos = new(1120.74f, 3199.47f, 37.5157f); + public static Position CyanaJumpPos = new(1120.34f, 3194.28f, 36.4321f); + } + + [Script] // 93011 - Kayn Sunfury + class npc_kayn_sunfury_invasion_begins : ScriptedAI + { + const uint SoundSpellDoubleJump = 53780; + + public npc_kayn_sunfury_invasion_begins(Creature creature) : base(creature) { } + + public override void OnQuestAccept(Player player, Quest quest) + { + if (quest.Id == TheInvasionBeginsConst.QuestTheInvasionBegins) + { + PhasingHandler.OnConditionChange(player); + player.CastSpell(TheInvasionBeginsConst.WrathWarriorSpawnPosition, TheInvasionBeginsConst.SpellTheInvasionBegins, false); + Conversation.CreateConversation(TheInvasionBeginsConst.ConvoTheInvasionBegins, player, player, player.GetGUID(), null, false); + } + } + + public override void WaypointPathEnded(uint nodeId, uint pathId) + { + if (pathId == TheInvasionBeginsConst.PathKaynAttackDemon) + { + Creature wrathWarrior = me.FindNearestCreatureWithOptions(100.0f, new FindCreatureOptions() { CreatureId = TheInvasionBeginsConst.NpcWrathWarriorInvasionBegins, IgnorePhases = true, OwnerGuid = me.GetOwnerGUID() }); + if (wrathWarrior == null) + return; + + me.SetFacingToObject(wrathWarrior); + + wrathWarrior.SendPlaySpellVisualKit(TheInvasionBeginsConst.SpellVisualKitWrathWarriorDie, 0, 0); + wrathWarrior.KillSelf(); + + _scheduler.Schedule(TimeSpan.FromMilliseconds(600), _ => me.GetMotionMaster().MovePath(TheInvasionBeginsConst.PathKaynAfterDemon, false)); + } + else if (pathId == TheInvasionBeginsConst.PathKaynAfterDemon) + me.DespawnOrUnsummon(); + } + + public override void MovementInform(MovementGeneratorType type, uint pointId) + { + if (type != MovementGeneratorType.Effect) + return; + + if (pointId == TheInvasionBeginsConst.PointKaynTriggerDoubleJump) + { + TempSummon summon = me.ToTempSummon(); + if (summon == null) + return; + + WorldObject summoner = summon.GetSummoner(); + if (summoner == null) + return; + + Player summonerPlayer = summoner.ToPlayer(); + if (summonerPlayer == null) + return; + + me.SendPlaySpellVisualKit(TheInvasionBeginsConst.SpellVisualKitKaynWings, 4, 3000); + me.PlayObjectSound(SoundSpellDoubleJump, me.GetGUID(), summonerPlayer); + me.SendPlaySpellVisualKit(TheInvasionBeginsConst.SpellVisualKitKaynDoubleJump, 0, 0); + me.GetMotionMaster().MoveJumpWithGravity(TheInvasionBeginsConst.KaynDoubleJumpPosition, 24.0f, 0.9874f, TheInvasionBeginsConst.PointKaynMoveToDemon); + } + else if (pointId == TheInvasionBeginsConst.PointKaynMoveToDemon) + { + me.SetAIAnimKitId(TheInvasionBeginsConst.AnimDhRun); + me.GetMotionMaster().MovePath(TheInvasionBeginsConst.PathKaynAttackDemon, false, null, 4.0f); + } + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + } + + [Script] // 98228 - Jayce Darkweaver + class npc_jayce_darkweaver_invasion_begins : ScriptedAI + { + public npc_jayce_darkweaver_invasion_begins(Creature creature) : base(creature) { } + + public override void WaypointPathEnded(uint nodeId, uint pathId) + { + if (pathId == TheInvasionBeginsConst.PathJayceInvasionBegins) + { + me.CastSpell(null, TheInvasionBeginsConst.SpellDemonHunterGlideState, true); + me.GetMotionMaster().MoveJumpWithGravity(TheInvasionBeginsConst.JayceJumpPos, 12.0f, 15.2792f, TheInvasionBeginsConst.PointIllidariLandPos); + } + else if (pathId == TheInvasionBeginsConst.PathJayceJupinvasionBegins) + me.DespawnOrUnsummon(); + } + + public override void MovementInform(MovementGeneratorType type, uint pointId) + { + if (type != MovementGeneratorType.Effect) + return; + + if (pointId == TheInvasionBeginsConst.PointIllidariLandPos) + { + me.RemoveAurasDueToSpell(TheInvasionBeginsConst.SpellDemonHunterGlideState); + me.GetMotionMaster().MovePath(TheInvasionBeginsConst.PathJayceJupinvasionBegins, false); + } + } + } + + [Script] // 98227 - Allari the Souleater + class npc_allari_the_souleater_invasion_begins : ScriptedAI + { + public npc_allari_the_souleater_invasion_begins(Creature creature) : base(creature) { } + + public override void WaypointPathEnded(uint nodeId, uint pathId) + { + if (pathId == TheInvasionBeginsConst.PathAllariInvasionBegins) + { + me.CastSpell(null, TheInvasionBeginsConst.SpellDemonHunterGlideState, true); + me.GetMotionMaster().MoveJumpWithGravity(TheInvasionBeginsConst.AllariJumpPos, 12.0f, 9.2722f, TheInvasionBeginsConst.PointIllidariLandPos); + } + else if (pathId == TheInvasionBeginsConst.PathAllariJupinvasionBegins) + me.DespawnOrUnsummon(); + } + + public override void MovementInform(MovementGeneratorType type, uint pointId) + { + if (type != MovementGeneratorType.Effect) + return; + + if (pointId == TheInvasionBeginsConst.PointIllidariLandPos) + { + me.RemoveAurasDueToSpell(TheInvasionBeginsConst.SpellDemonHunterGlideState); + me.GetMotionMaster().MovePath(TheInvasionBeginsConst.PathAllariJupinvasionBegins, false); + } + } + } + + [Script] // 98292 - Korvas Bloodthorn + class npc_korvas_bloodthorn_invasion_begins : ScriptedAI + { + public npc_korvas_bloodthorn_invasion_begins(Creature creature) : base(creature) { } + + public override void WaypointPathEnded(uint nodeId, uint pathId) + { + if (pathId == TheInvasionBeginsConst.PathKorvasinvasionBegins) + { + me.SendPlaySpellVisualKit(TheInvasionBeginsConst.SpellVisualKitKorvasJump, 4, 2000); + me.GetMotionMaster().MoveJumpWithGravity(TheInvasionBeginsConst.KorvasJumpPos, 24.0f, 19.2911f, TheInvasionBeginsConst.PointIllidariLandPos); + } + else if (pathId == TheInvasionBeginsConst.PathKorvasJupinvasionBegins) + me.DespawnOrUnsummon(); + } + + public override void MovementInform(MovementGeneratorType type, uint pointId) + { + if (type != MovementGeneratorType.Effect) + return; + + if (pointId == TheInvasionBeginsConst.PointIllidariLandPos) + { + me.RemoveAurasDueToSpell(TheInvasionBeginsConst.SpellDemonHunterGlideState); + me.GetMotionMaster().MovePath(TheInvasionBeginsConst.PathKorvasJupinvasionBegins, false); + } + } + } + + [Script] // 99918 - Sevis Brightflame + class npc_sevis_brightflame_invasion_begins : ScriptedAI + { + public npc_sevis_brightflame_invasion_begins(Creature creature) : base(creature) { } + + public override void WaypointPathEnded(uint nodeId, uint pathId) + { + if (pathId == TheInvasionBeginsConst.PathSevisinvasionBegins) + { + me.CastSpell(null, TheInvasionBeginsConst.SpellDemonHunterGlideState, true); + me.GetMotionMaster().MoveJumpWithGravity(TheInvasionBeginsConst.SevisJumpPos, 12.0f, 13.3033f, TheInvasionBeginsConst.PointIllidariLandPos); + } + else if (pathId == TheInvasionBeginsConst.PathSevisJupinvasionBegins) + me.DespawnOrUnsummon(); + } + + public override void MovementInform(MovementGeneratorType type, uint pointId) + { + if (type != MovementGeneratorType.Effect) + return; + + if (pointId == TheInvasionBeginsConst.PointIllidariLandPos) + { + me.RemoveAurasDueToSpell(TheInvasionBeginsConst.SpellDemonHunterGlideState); + me.GetMotionMaster().MovePath(TheInvasionBeginsConst.PathSevisJupinvasionBegins, false); + } + } + } + + [Script] // 98290 - Cyana Nightglaive + class npc_cyana_nightglaive_invasion_begins : ScriptedAI + { + public npc_cyana_nightglaive_invasion_begins(Creature creature) : base(creature) { } + + public override void WaypointPathEnded(uint nodeId, uint pathId) + { + if (pathId == TheInvasionBeginsConst.PathCyanaInvasionBegins) + { + me.CastSpell(null, TheInvasionBeginsConst.SpellDemonHunterGlideState, true); + me.GetMotionMaster().MoveJumpWithGravity(TheInvasionBeginsConst.CyanaJumpPos, 12.0f, 8.4555f, TheInvasionBeginsConst.PointIllidariLandPos); + } + else if (pathId == TheInvasionBeginsConst.PathCyanaJupinvasionBegins) + me.DespawnOrUnsummon(); + } + + public override void MovementInform(MovementGeneratorType type, uint pointId) + { + if (type != MovementGeneratorType.Effect) + return; + + if (pointId == TheInvasionBeginsConst.PointIllidariLandPos) + { + me.RemoveAurasDueToSpell(TheInvasionBeginsConst.SpellDemonHunterGlideState); + me.GetMotionMaster().MovePath(TheInvasionBeginsConst.PathCyanaJupinvasionBegins, false); + } + } + } + + [Script] // 922 - The Invasion Begins + class conversation_the_invasion_begins : ConversationScript + { + const int ConvoLineTriggerFacing = 2529; + const int ConvoLineStartPath = 2288; + + const int ConvoActorIdxKayn = 1; + const int ConvoActorIdxKorvas = 2; + + const uint SoundMetalWeaponUnsheath = 700; + + TaskScheduler _scheduler = new TaskScheduler(); + + ObjectGuid _jayceGUID; + ObjectGuid _allariGUID; + ObjectGuid _cyanaGUID; + ObjectGuid _sevisGUID; + + public conversation_the_invasion_begins() : base("conversation_the_invasion_begins") { } + + public override void OnConversationCreate(Conversation conversation, Unit creator) + { + Creature kaynObject = creator.FindNearestCreatureWithOptions(10.0f, new FindCreatureOptions() { CreatureId = TheInvasionBeginsConst.NpcKaynSunfuryInvasionBegins, IgnorePhases = true }); + Creature jayceObject = creator.FindNearestCreatureWithOptions(10.0f, new FindCreatureOptions() { CreatureId = TheInvasionBeginsConst.NpcJayceDarkweaverInvasionBegins, IgnorePhases = true }); + Creature allariaObject = creator.FindNearestCreatureWithOptions(10.0f, new FindCreatureOptions() { CreatureId = TheInvasionBeginsConst.NpcAllariTheSouleaterInvasionBegins, IgnorePhases = true }); + Creature cyanaObject = creator.FindNearestCreatureWithOptions(10.0f, new FindCreatureOptions() { CreatureId = TheInvasionBeginsConst.NpcCyanaNightglaiveInvasionBegins, IgnorePhases = true }); + Creature korvasObject = creator.FindNearestCreatureWithOptions(10.0f, new FindCreatureOptions() { CreatureId = TheInvasionBeginsConst.NpcKorvasBloodthornInvasionBegins, IgnorePhases = true }); + Creature sevisObject = creator.FindNearestCreatureWithOptions(10.0f, new FindCreatureOptions() { CreatureId = TheInvasionBeginsConst.NpcSevisBrightflameInvasionBegins, IgnorePhases = true }); + if (kaynObject == null || jayceObject == null || allariaObject == null || cyanaObject == null || korvasObject == null || sevisObject == null) + return; + + TempSummon kaynClone = kaynObject.SummonPersonalClone(kaynObject.GetPosition(), TempSummonType.ManualDespawn, TimeSpan.FromSeconds(0), 0, 0, creator.ToPlayer()); + TempSummon jayceClone = jayceObject.SummonPersonalClone(jayceObject.GetPosition(), TempSummonType.ManualDespawn, TimeSpan.FromSeconds(0), 0, 0, creator.ToPlayer()); + TempSummon allariaClone = allariaObject.SummonPersonalClone(allariaObject.GetPosition(), TempSummonType.ManualDespawn, TimeSpan.FromSeconds(0), 0, 0, creator.ToPlayer()); + TempSummon cyanaClone = cyanaObject.SummonPersonalClone(cyanaObject.GetPosition(), TempSummonType.ManualDespawn, TimeSpan.FromSeconds(0), 0, 0, creator.ToPlayer()); + TempSummon korvasClone = korvasObject.SummonPersonalClone(korvasObject.GetPosition(), TempSummonType.ManualDespawn, TimeSpan.FromSeconds(0), 0, 0, creator.ToPlayer()); + TempSummon sevisClone = sevisObject.SummonPersonalClone(sevisObject.GetPosition(), TempSummonType.ManualDespawn, TimeSpan.FromSeconds(0), 0, 0, creator.ToPlayer()); + if (kaynClone == null || jayceClone == null || allariaClone == null || cyanaClone == null || korvasClone == null || sevisClone == null) + return; + + _jayceGUID = jayceClone.GetGUID(); + _allariGUID = allariaClone.GetGUID(); + _cyanaGUID = cyanaClone.GetGUID(); + _sevisGUID = sevisClone.GetGUID(); + allariaClone.SetAIAnimKitId(TheInvasionBeginsConst.AnimDhRunAllari); + kaynClone.RemoveNpcFlag(NPCFlags.Gossip | NPCFlags.QuestGiver); + + conversation.AddActor(TheInvasionBeginsConst.ConvoTheInvasionBegins, ConvoActorIdxKayn, kaynClone.GetGUID()); + conversation.AddActor(TheInvasionBeginsConst.ConvoTheInvasionBegins, ConvoActorIdxKorvas, korvasClone.GetGUID()); + conversation.Start(); + } + + public override void OnConversationStart(Conversation conversation) + { + Locale privateOwnerLocale = conversation.GetPrivateObjectOwnerLocale(); + + TimeSpan illidariFacingLineStarted = conversation.GetLineStartTime(privateOwnerLocale, ConvoLineTriggerFacing); + if (illidariFacingLineStarted != TimeSpan.Zero) + { + _scheduler.Schedule(illidariFacingLineStarted, _ => + { + StartCloneChannel(conversation.GetActorUnit(ConvoActorIdxKayn).GetGUID(), conversation); + StartCloneChannel(conversation.GetActorUnit(ConvoActorIdxKorvas).GetGUID(), conversation); + StartCloneChannel(_jayceGUID, conversation); + StartCloneChannel(_allariGUID, conversation); + StartCloneChannel(_cyanaGUID, conversation); + StartCloneChannel(_sevisGUID, conversation); + }); + } + + TimeSpan illidariStartPathLineStarted = conversation.GetLineStartTime(privateOwnerLocale, ConvoLineStartPath); + if (illidariStartPathLineStarted != TimeSpan.Zero) + { + _scheduler.Schedule(illidariStartPathLineStarted, _ => + { + Creature kaynClone = conversation.GetActorCreature(ConvoActorIdxKayn); + if (kaynClone == null) + return; + + Unit privateObjectOwner = ObjAccessor.GetUnit(conversation, conversation.GetPrivateObjectOwner()); + if (privateObjectOwner == null) + return; + + Player player = privateObjectOwner.ToPlayer(); + if (player == null) + return; + + kaynClone.PlayObjectSound(SoundMetalWeaponUnsheath, kaynClone.GetGUID(), player); + kaynClone.SendPlaySpellVisualKit(TheInvasionBeginsConst.SpellVisualKitKaynGlide, 4, 3000); + kaynClone.SendPlaySpellVisualKit(TheInvasionBeginsConst.SpellVisualKitKaynWings, 4, 4000); + kaynClone.GetMotionMaster().MoveJumpWithGravity(TheInvasionBeginsConst.KaynJumpPos, 20.5f, 396.3535f, TheInvasionBeginsConst.PointKaynTriggerDoubleJump); + kaynClone.SetSheath(SheathState.Melee); + kaynClone.SetNpcFlag(NPCFlags.QuestGiver); + + StartCloneMovement(conversation.GetActorUnit(ConvoActorIdxKorvas).GetGUID(), TheInvasionBeginsConst.PathKorvasinvasionBegins, TheInvasionBeginsConst.AnimDhRun, conversation); + StartCloneMovement(_jayceGUID, TheInvasionBeginsConst.PathJayceInvasionBegins, 0, conversation); + StartCloneMovement(_allariGUID, TheInvasionBeginsConst.PathAllariInvasionBegins, TheInvasionBeginsConst.AnimDhRunAllari, conversation); + StartCloneMovement(_cyanaGUID, TheInvasionBeginsConst.PathCyanaInvasionBegins, 0, conversation); + StartCloneMovement(_sevisGUID, TheInvasionBeginsConst.PathSevisinvasionBegins, TheInvasionBeginsConst.AnimDhRun, conversation); + }); + } + } + + void StartCloneChannel(ObjectGuid guid, Conversation conversation) + { + Unit privateObjectOwner = ObjAccessor.GetUnit(conversation, conversation.GetPrivateObjectOwner()); + if (privateObjectOwner == null) + return; + + Creature clone = ObjectAccessor.GetCreature(conversation, guid); + if (clone == null) + return; + + clone.CastSpell(privateObjectOwner, TheInvasionBeginsConst.SpellTrackTargetInChannel, false); + } + + void StartCloneMovement(ObjectGuid cloneGUID, uint pathId, uint animKit, Conversation conversation) + { + Creature clone = ObjectAccessor.GetCreature(conversation, cloneGUID); + if (clone == null) + return; + + clone.InterruptNonMeleeSpells(true); + clone.GetMotionMaster().MovePath(pathId, false); + if (animKit != 0) + clone.SetAIAnimKitId((ushort)animKit); + } + + public override void OnConversationUpdate(Conversation conversation, uint diff) + { + _scheduler.Update(diff); + } + } + + // 98459 - Kayn Sunfury + // 98458 - Jayce Darkweaver + // 98456 - Allari the Souleater + // 98460 - Korvas Bloodthorn + // 99919 - Sevis Brightflame + [Script] // 98457 - Cyana Nightglaive + class npc_illidari_fighting_invasion_begins : ScriptedAI + { + const uint SpellIllidariChaosStrike = 197639; + const uint SpellIllidariFelRush = 200879; + + public npc_illidari_fighting_invasion_begins(Creature creature) : base(creature) { } + + Unit GetNextTarget() + { + List targetList = new(); + AnyUnfriendlyUnitInObjectRangeCheck checker = new(me, me, 100.0f); + UnitListSearcher searcher = new(me, targetList, checker); + Cell.VisitAllObjects(me, searcher, 100.0f); + targetList.RemoveAll(possibleTarget => possibleTarget.IsAttackingPlayer()); + + return targetList.SelectRandom(); + } + + void ScheduleTargetSelection() + { + _scheduler.Schedule(TimeSpan.FromMilliseconds(200), task => + { + Unit target = GetNextTarget(); + if (target == null) + { + task.Repeat(TimeSpan.FromMilliseconds(500)); + return; + } + AttackStart(target); + }); + } + + public override void JustAppeared() + { + ScheduleTargetSelection(); + } + + public override void Reset() + { + _scheduler.CancelAll(); + } + + public override void JustEngagedWith(Unit who) + { + _scheduler.CancelAll(); + _scheduler.Schedule(TimeSpan.FromSeconds(5), task => + { + DoCastVictim(SpellIllidariChaosStrike); + task.Repeat(TimeSpan.FromSeconds(5)); + }); + _scheduler.Schedule(TimeSpan.FromSeconds(7), task => + { + DoCastVictim(SpellIllidariFelRush); + task.Repeat(TimeSpan.FromSeconds(7)); + }); + } + + public override void EnterEvadeMode(EvadeReason why) + { + // manualling calling it to not move to home position but move to next target instead + _EnterEvadeMode(why); + Reset(); + ScheduleTargetSelection(); + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + + if (me.HasUnitState(UnitState.Casting)) + return; + + DoMeleeAttackIfReady(); + } + } +} diff --git a/Source/Scripts/BrokenIsles/ZoneOrderhallWarrior.cs b/Source/Scripts/BrokenIsles/ZoneOrderhallWarrior.cs index 3c681fee9..4dd43ae08 100644 --- a/Source/Scripts/BrokenIsles/ZoneOrderhallWarrior.cs +++ b/Source/Scripts/BrokenIsles/ZoneOrderhallWarrior.cs @@ -10,8 +10,9 @@ using Game.Scripting; using System; using System.Collections.Generic; using System.Numerics; +using static Global; -namespace Scripts.BrokenIsles.ZoneOrderhallWarrior +namespace Scripts.BrokenIsles { struct SpellIds { @@ -20,17 +21,6 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior public const uint CancelCompleteSceneWarriorOrderFormation = 193711; } - struct PhaseIds - { - public const uint Odyn = 5107; - public const uint Danica = 5090; - } - - struct QuestIds - { - public const uint OdynAndTheValarjar = 39654; - } - struct CreatureIds { public const uint KillCreditFollowedDanica = 103036; @@ -47,49 +37,54 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior public const uint HovShield2 = 137265; } - struct EmoteIds + struct MiscConst { + public const uint PhaseOdyn = 5107; + public const uint PhaseDanica = 5090; + + public const uint QuestOdynAndTheValarjar = 39654; + public static Emote[] PayingRespectToOdynRandomEmotes = { Emote.OneshotPoint, Emote.OneshotTalk, Emote.OneshotNo }; } [Script] class npc_danica_the_reclaimer : ScriptedAI { - ObjectGuid _summonerGuid; - Vector3[] DanicaPath01 = { - new Vector3(1050.219f, 7232.470f, 100.5846f), - new Vector3(1046.207f, 7240.372f, 100.5846f), - new Vector3(1040.963f, 7245.498f, 100.6819f), - new Vector3(1034.726f, 7250.083f, 100.5846f), - new Vector3(1027.422f, 7257.835f, 100.5846f), - new Vector3(1027.542f, 7259.735f, 100.5846f) + new(1050.219f, 7232.470f, 100.5846f), + new(1046.207f, 7240.372f, 100.5846f), + new(1040.963f, 7245.498f, 100.6819f), + new(1034.726f, 7250.083f, 100.5846f), + new(1027.422f, 7257.835f, 100.5846f), + new(1027.542f, 7259.735f, 100.5846f) }; Vector3[] DanicaPath02 = { - new Vector3(1018.493f, 7247.438f, 100.5846f), - new Vector3(1013.535f, 7243.327f, 100.5846f), - new Vector3(1007.063f, 7235.723f, 100.5846f), - new Vector3(1003.337f, 7229.650f, 100.5846f), - new Vector3(995.4549f, 7227.286f, 100.5846f), - new Vector3(984.4410f, 7224.357f, 100.5846f) + new(1018.493f, 7247.438f, 100.5846f), + new(1013.535f, 7243.327f, 100.5846f), + new(1007.063f, 7235.723f, 100.5846f), + new(1003.337f, 7229.650f, 100.5846f), + new(995.4549f, 7227.286f, 100.5846f), + new(984.4410f, 7224.357f, 100.5846f) }; Vector3[] DanicaPath03 = { - new Vector3(962.5208f, 7223.089f, 100.5846f), - new Vector3(934.2795f, 7223.116f, 100.5846f), - new Vector3(911.8507f, 7223.776f, 100.5846f), - new Vector3(879.0139f, 7224.100f, 100.9079f), - new Vector3(851.691f, 7224.5490f, 109.5846f) + new(962.5208f, 7223.089f, 100.5846f), + new(934.2795f, 7223.116f, 100.5846f), + new(911.8507f, 7223.776f, 100.5846f), + new(879.0139f, 7224.100f, 100.9079f), + new(851.691f, 7224.5490f, 109.5846f) }; + ObjectGuid _summonerGuid; + public npc_danica_the_reclaimer(Creature creature) : base(creature) { } // Should be the player - // Personal spawn ? Demon Creator is the player who accepts the quest, no phasing involved but the quest giver dissapears and gets replaced with a new one + // Personal spawn ? Demon Creator is the player who accepts the quest, no phaMath.Sing involved but the quest giver dissapears and gets replaced with a new one public override void IsSummonedBy(WorldObject summoner) { if (!summoner.IsPlayer()) @@ -97,7 +92,7 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior me.RemoveNpcFlag(NPCFlags.Gossip); _summonerGuid = summoner.GetGUID(); - _scheduler.Schedule(TimeSpan.FromSeconds(2), context => + _scheduler.Schedule(TimeSpan.FromSeconds(2), _ => { me.GetMotionMaster().MoveSmoothPath(0, DanicaPath01, DanicaPath01.Length, false, true); Talk(1, summoner); @@ -109,21 +104,21 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior switch (id) { case 0: - _scheduler.Schedule(TimeSpan.FromSeconds(10), context => + _scheduler.Schedule(TimeSpan.FromSeconds(10), _ => { - Player player = Global.ObjAccessor.FindConnectedPlayer(_summonerGuid); + Player player = ObjAccessor.FindConnectedPlayer(_summonerGuid); me.GetMotionMaster().MoveSmoothPath(1, DanicaPath02, DanicaPath02.Length, false, true); Talk(2, player); }); break; case 1: - _scheduler.Schedule(TimeSpan.FromSeconds(10), context => + _scheduler.Schedule(TimeSpan.FromSeconds(10), _ => { - Player player = Global.ObjAccessor.FindConnectedPlayer(_summonerGuid); + Player player = ObjAccessor.FindConnectedPlayer(_summonerGuid); me.GetMotionMaster().MoveSmoothPath(2, DanicaPath03, DanicaPath03.Length, false, true); Talk(3, player); - if (player) + if (player != null) player.KilledMonsterCredit(CreatureIds.KillCreditFollowedDanica); }); break; @@ -154,12 +149,9 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior [Script] class npc_feasting_valarjar : ScriptedAI { - List _randomEmotes = new(); + List _randomEmotes = new() { Emote.OneshotEatNoSheathe, Emote.OneshotLaughNoSheathe, Emote.OneshotRoar, Emote.OneshotLaugh, Emote.OneshotPoint, Emote.OneshotTalk, Emote.OneshotCheerNoSheathe }; - public npc_feasting_valarjar(Creature creature) : base(creature) - { - _randomEmotes.AddRange(new[] { Emote.OneshotEatNoSheathe, Emote.OneshotLaughNoSheathe, Emote.OneshotRoar, Emote.OneshotLaugh, Emote.OneshotPoint, Emote.OneshotTalk, Emote.OneshotCheerNoSheathe }); - } + public npc_feasting_valarjar(Creature creature) : base(creature) { } public override void UpdateAI(uint diff) { @@ -168,25 +160,25 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior public override void Reset() { - _scheduler.Schedule(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(30), context => + _scheduler.Schedule(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(30), task => { Emote emoteID = _randomEmotes.SelectRandom(); if (emoteID == Emote.OneshotEatNoSheathe) { - me.SetVirtualItem(0, RandomHelper.URand(0, 1) == 1 ? ItemIds.MonsterItemMuttonWithBite : ItemIds.MonsterItemTankardWooden); - _scheduler.Schedule(TimeSpan.FromSeconds(1), context => - { - me.SetVirtualItem(0, 0); - if (RandomHelper.randChance(85)) - DoCastSelf(SpellIds.EmoteBelch); - }); + me.SetVirtualItem(0, RandomHelper.URand(0, 1) != 0 ? ItemIds.MonsterItemMuttonWithBite : ItemIds.MonsterItemTankardWooden); + _scheduler.Schedule(TimeSpan.FromSeconds(1), _ => + { + me.SetVirtualItem(0, 0); + if (RandomHelper.randChance(85)) + DoCastSelf(SpellIds.EmoteBelch); + }); } me.HandleEmoteCommand(emoteID); - context.Repeat(); + task.Repeat(); }); - _scheduler.Schedule(TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(20), context => + _scheduler.Schedule(TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(20), _ => { float direction = me.GetOrientation() + MathF.PI; me.GetMotionMaster().MovePoint(0, me.GetFirstCollisionPosition(5.0f, direction)); @@ -211,39 +203,39 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior { Vector3[] IncommingValarjarAspirantPath01 = { - new Vector3(876.7396f, 7220.805f, 98.91662f), - new Vector3(870.6129f, 7220.945f, 101.8951f), - new Vector3(865.0677f, 7220.975f, 103.7846f), - new Vector3(854.6389f, 7221.030f, 106.7846f), - new Vector3(851.1597f, 7220.292f, 106.7846f), - new Vector3(848.0573f, 7216.386f, 106.7846f), - new Vector3(844.7570f, 7210.920f, 106.7846f), - new Vector3(841.9844f, 7207.228f, 106.7846f), - new Vector3(839.2396f, 7203.619f, 107.5846f), - new Vector3(836.4844f, 7200.202f, 107.5846f), - new Vector3(834.2430f, 7196.000f, 107.5846f) + new (876.7396f, 7220.805f, 98.91662f), + new (870.6129f, 7220.945f, 101.8951f), + new (865.0677f, 7220.975f, 103.7846f), + new (854.6389f, 7221.030f, 106.7846f), + new (851.1597f, 7220.292f, 106.7846f), + new (848.0573f, 7216.386f, 106.7846f), + new (844.7570f, 7210.920f, 106.7846f), + new (841.9844f, 7207.228f, 106.7846f), + new (839.2396f, 7203.619f, 107.5846f), + new (836.4844f, 7200.202f, 107.5846f), + new (834.2430f, 7196.000f, 107.5846f) }; Vector3[] IncommingValarjarAspirantPath02 = { - new Vector3(828.5851f, 7204.096f, 106.7846f), - new Vector3(819.4636f, 7212.124f, 106.7846f), - new Vector3(814.2853f, 7215.074f, 106.7846f), - new Vector3(809.4948f, 7217.543f, 106.7846f), - new Vector3(806.0313f, 7219.614f, 106.7846f) + new (828.5851f, 7204.096f, 106.7846f), + new (819.4636f, 7212.124f, 106.7846f), + new (814.2853f, 7215.074f, 106.7846f), + new (809.4948f, 7217.543f, 106.7846f), + new (806.0313f, 7219.614f, 106.7846f) }; Vector3[] IncommingValarjarAspirantPath03 = { - new Vector3(824.1597f, 7221.822f, 106.7846f), - new Vector3(831.7500f, 7221.092f, 106.7846f), - new Vector3(842.4236f, 7222.208f, 106.7846f), - new Vector3(853.5781f, 7222.473f, 106.7846f), - new Vector3(863.9618f, 7223.012f, 103.7846f), - new Vector3(867.9358f, 7223.165f, 103.3735f), - new Vector3(880.6215f, 7222.569f, 97.78457f), - new Vector3(887.8438f, 7221.310f, 97.78457f), - new Vector3(903.7118f, 7215.743f, 97.78458f) + new (824.1597f, 7221.822f, 106.7846f), + new (831.7500f, 7221.092f, 106.7846f), + new (842.4236f, 7222.208f, 106.7846f), + new (853.5781f, 7222.473f, 106.7846f), + new (863.9618f, 7223.012f, 103.7846f), + new (867.9358f, 7223.165f, 103.3735f), + new (880.6215f, 7222.569f, 97.78457f), + new (887.8438f, 7221.310f, 97.78457f), + new (903.7118f, 7215.743f, 97.78458f) }; public npc_incoming_valarjar_aspirant_1(Creature creature) : base(creature) { } @@ -263,24 +255,15 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior switch (id) { case 0: - _scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(6), context => - { - me.HandleEmoteCommand(EmoteIds.PayingRespectToOdynRandomEmotes.SelectRandom()); - }); + _scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(6), _ => me.HandleEmoteCommand(MiscConst.PayingRespectToOdynRandomEmotes.SelectRandom())); - _scheduler.Schedule(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(15), context => - { - me.GetMotionMaster().MoveSmoothPath(1, IncommingValarjarAspirantPath02, IncommingValarjarAspirantPath02.Length, true); - }); + _scheduler.Schedule(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(15), _ => me.GetMotionMaster().MoveSmoothPath(1, IncommingValarjarAspirantPath02, IncommingValarjarAspirantPath02.Length, true)); break; case 1: - _scheduler.Schedule(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(3), context => + _scheduler.Schedule(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(3), task => { me.PlayOneShotAnimKitId(1431); - _scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(10), context => - { - me.GetMotionMaster().MoveSmoothPath(2, IncommingValarjarAspirantPath03, IncommingValarjarAspirantPath03.Length); - }); + task.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(10), _ => me.GetMotionMaster().MoveSmoothPath(2, IncommingValarjarAspirantPath03, IncommingValarjarAspirantPath03.Length)); }); break; case 2: @@ -297,42 +280,42 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior { Vector3[] IncommingValarjarAspirantPath01 = { - new Vector3(890.5521f, 7235.710f, 97.78457f), - new Vector3(883.8073f, 7233.402f, 97.78457f), - new Vector3(872.1979f, 7234.018f, 101.2886f), - new Vector3(863.5941f, 7234.594f, 103.7846f), - new Vector3(855.2899f, 7235.626f, 106.7593f), - new Vector3(849.8177f, 7236.571f, 106.7846f), - new Vector3(845.7830f, 7241.082f, 106.7846f), - new Vector3(841.8489f, 7246.654f, 106.7846f), - new Vector3(839.7205f, 7250.986f, 106.7846f), - new Vector3(840.8889f, 7254.773f, 107.5846f), - new Vector3(841.9254f, 7259.517f, 107.5846f), - new Vector3(840.6077f, 7266.662f, 107.5846f) + new (890.5521f, 7235.710f, 97.78457f), + new (883.8073f, 7233.402f, 97.78457f), + new (872.1979f, 7234.018f, 101.2886f), + new (863.5941f, 7234.594f, 103.7846f), + new (855.2899f, 7235.626f, 106.7593f), + new (849.8177f, 7236.571f, 106.7846f), + new (845.7830f, 7241.082f, 106.7846f), + new (841.8489f, 7246.654f, 106.7846f), + new (839.7205f, 7250.986f, 106.7846f), + new (840.8889f, 7254.773f, 107.5846f), + new (841.9254f, 7259.517f, 107.5846f), + new (840.6077f, 7266.662f, 107.5846f) }; Vector3[] IncommingValarjarAspirantPath02 = { - new Vector3(838.1493f, 7260.027f, 107.5846f), - new Vector3(832.2691f, 7253.756f, 106.7846f), - new Vector3(823.1996f, 7246.677f, 106.7846f), - new Vector3(821.2500f, 7244.573f, 106.7846f), - new Vector3(815.8906f, 7241.437f, 106.7846f), - new Vector3(809.8281f, 7239.580f, 106.7846f) + new (838.1493f, 7260.027f, 107.5846f), + new (832.2691f, 7253.756f, 106.7846f), + new (823.1996f, 7246.677f, 106.7846f), + new (821.2500f, 7244.573f, 106.7846f), + new (815.8906f, 7241.437f, 106.7846f), + new (809.8281f, 7239.580f, 106.7846f) }; Vector3[] IncommingValarjarAspirantPath03 = { - new Vector3(827.4757f, 7236.593f, 106.7846f), - new Vector3(837.1840f, 7236.047f, 106.7846f), - new Vector3(847.1684f, 7235.377f, 106.7846f), - new Vector3(854.7185f, 7235.294f, 106.7846f), - new Vector3(862.3524f, 7234.287f, 104.4290f), - new Vector3(882.3489f, 7233.743f, 97.78457f), - new Vector3(894.3768f, 7233.098f, 97.78457f), - new Vector3(906.0660f, 7232.520f, 97.78458f), - new Vector3(915.0070f, 7233.368f, 97.78458f), - new Vector3(924.6910f, 7233.694f, 97.78458f) + new (827.4757f, 7236.593f, 106.7846f), + new (837.1840f, 7236.047f, 106.7846f), + new (847.1684f, 7235.377f, 106.7846f), + new (854.7185f, 7235.294f, 106.7846f), + new (862.3524f, 7234.287f, 104.4290f), + new (882.3489f, 7233.743f, 97.78457f), + new (894.3768f, 7233.098f, 97.78457f), + new (906.0660f, 7232.520f, 97.78458f), + new (915.0070f, 7233.368f, 97.78458f), + new (924.6910f, 7233.694f, 97.78458f) }; public npc_incoming_valarjar_aspirant_2(Creature creature) : base(creature) { } @@ -352,24 +335,14 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior switch (id) { case 0: - _scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(6), context => - { - me.HandleEmoteCommand(EmoteIds.PayingRespectToOdynRandomEmotes.SelectRandom()); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(15), context => - { - me.GetMotionMaster().MoveSmoothPath(1, IncommingValarjarAspirantPath02, IncommingValarjarAspirantPath02.Length, true); - }); + _scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(6), context => me.HandleEmoteCommand(MiscConst.PayingRespectToOdynRandomEmotes.SelectRandom())); + _scheduler.Schedule(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(15), context => me.GetMotionMaster().MoveSmoothPath(1, IncommingValarjarAspirantPath02, IncommingValarjarAspirantPath02.Length, true)); break; case 1: - _scheduler.Schedule(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(3), context => + _scheduler.Schedule(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(3), task => { me.PlayOneShotAnimKitId(1431); - _scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(10), context => - { - me.GetMotionMaster().MoveSmoothPath(2, IncommingValarjarAspirantPath03, IncommingValarjarAspirantPath03.Length); - }); + task.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(10), _ => me.GetMotionMaster().MoveSmoothPath(2, IncommingValarjarAspirantPath03, IncommingValarjarAspirantPath03.Length)); }); break; case 2: @@ -386,38 +359,38 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior { Vector3[] PathLeavingValarjar01 = { - new Vector3(802.5903f, 7304.605f, 106.7846f), - new Vector3(809.3333f, 7296.529f, 106.7846f), - new Vector3(811.8004f, 7293.676f, 106.7846f), - new Vector3(817.4219f, 7287.498f, 106.7846f), - new Vector3(821.0313f, 7283.637f, 106.7846f), - new Vector3(822.1111f, 7275.672f, 106.7846f), - new Vector3(826.4662f, 7270.601f, 107.5846f), - new Vector3(830.8212f, 7268.729f, 107.5846f) + new (802.5903f, 7304.605f, 106.7846f), + new (809.3333f, 7296.529f, 106.7846f), + new (811.8004f, 7293.676f, 106.7846f), + new (817.4219f, 7287.498f, 106.7846f), + new (821.0313f, 7283.637f, 106.7846f), + new (822.1111f, 7275.672f, 106.7846f), + new (826.4662f, 7270.601f, 107.5846f), + new (830.8212f, 7268.729f, 107.5846f) }; Vector3[] PathLeavingValarjar02 = { - new Vector3(824.9757f, 7261.047f, 107.5846f), - new Vector3(822.0989f, 7256.705f, 106.7846f), - new Vector3(819.0261f, 7253.674f, 106.7846f), - new Vector3(813.1910f, 7249.034f, 106.7846f), - new Vector3(809.1493f, 7245.616f, 106.7846f), - new Vector3(806.3559f, 7243.057f, 106.7846f) + new (824.9757f, 7261.047f, 107.5846f), + new (822.0989f, 7256.705f, 106.7846f), + new (819.0261f, 7253.674f, 106.7846f), + new (813.1910f, 7249.034f, 106.7846f), + new (809.1493f, 7245.616f, 106.7846f), + new (806.3559f, 7243.057f, 106.7846f) }; Vector3[] PathLeavingValarjar03 = { - new Vector3(825.3177f, 7244.253f, 106.7846f), - new Vector3(837.5816f, 7243.241f, 106.7846f), - new Vector3(845.0243f, 7240.063f, 106.7846f), - new Vector3(853.7274f, 7238.423f, 106.7953f), - new Vector3(862.9948f, 7238.000f, 103.9737f), - new Vector3(872.7899f, 7236.939f, 100.8285f), - new Vector3(882.8333f, 7235.922f, 97.78457f), - new Vector3(897.2813f, 7235.469f, 97.78457f), - new Vector3(908.8090f, 7234.836f, 97.78458f), - new Vector3(919.8750f, 7238.241f, 97.78458f) + new (825.3177f, 7244.253f, 106.7846f), + new (837.5816f, 7243.241f, 106.7846f), + new (845.0243f, 7240.063f, 106.7846f), + new (853.7274f, 7238.423f, 106.7953f), + new (862.9948f, 7238.000f, 103.9737f), + new (872.7899f, 7236.939f, 100.8285f), + new (882.8333f, 7235.922f, 97.78457f), + new (897.2813f, 7235.469f, 97.78457f), + new (908.8090f, 7234.836f, 97.78458f), + new (919.8750f, 7238.241f, 97.78458f) }; public npc_leaving_valarjar_1(Creature creature) : base(creature) { } @@ -437,24 +410,14 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior switch (id) { case 0: - _scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(6), context => - { - me.HandleEmoteCommand(EmoteIds.PayingRespectToOdynRandomEmotes.SelectRandom()); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(15), context => - { - me.GetMotionMaster().MoveSmoothPath(1, PathLeavingValarjar02, PathLeavingValarjar02.Length, true); - }); + _scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(6), _ => me.HandleEmoteCommand(MiscConst.PayingRespectToOdynRandomEmotes.SelectRandom())); + _scheduler.Schedule(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(15), _ => me.GetMotionMaster().MoveSmoothPath(1, PathLeavingValarjar02, PathLeavingValarjar02.Length, true)); break; case 1: - _scheduler.Schedule(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(3), context => + _scheduler.Schedule(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(3), task => { me.PlayOneShotAnimKitId(1431); - _scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(10), context => - { - me.GetMotionMaster().MoveSmoothPath(2, PathLeavingValarjar03, PathLeavingValarjar03.Length); - }); + task.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(10), _ => me.GetMotionMaster().MoveSmoothPath(2, PathLeavingValarjar03, PathLeavingValarjar03.Length)); }); break; case 2: @@ -471,34 +434,34 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior { Vector3[] PathLeavingValarjar01 = { - new Vector3(787.2361f, 7155.902f, 107.5846f), - new Vector3(792.4844f, 7154.038f, 106.7846f), - new Vector3(798.7830f, 7154.968f, 106.7846f), - new Vector3(807.8160f, 7162.251f, 106.7846f), - new Vector3(813.2882f, 7167.856f, 106.7846f), - new Vector3(816.4913f, 7170.818f, 106.7846f), - new Vector3(819.8299f, 7166.373f, 107.6281f) + new (787.2361f, 7155.902f, 107.5846f), + new (792.4844f, 7154.038f, 106.7846f), + new (798.7830f, 7154.968f, 106.7846f), + new (807.8160f, 7162.251f, 106.7846f), + new (813.2882f, 7167.856f, 106.7846f), + new (816.4913f, 7170.818f, 106.7846f), + new (819.8299f, 7166.373f, 107.6281f) }; Vector3[] PathLeavingValarjar02 = { - new Vector3(818.2708f, 7175.469f, 106.7846f), - new Vector3(819.5643f, 7185.691f, 106.7846f), - new Vector3(818.4184f, 7193.082f, 106.7846f), - new Vector3(818.8750f, 7199.256f, 106.7846f), - new Vector3(815.2361f, 7203.648f, 106.7846f), - new Vector3(809.6198f, 7208.319f, 106.7846f), - new Vector3(804.2743f, 7215.379f, 106.7846f) + new (818.2708f, 7175.469f, 106.7846f), + new (819.5643f, 7185.691f, 106.7846f), + new (818.4184f, 7193.082f, 106.7846f), + new (818.8750f, 7199.256f, 106.7846f), + new (815.2361f, 7203.648f, 106.7846f), + new (809.6198f, 7208.319f, 106.7846f), + new (804.2743f, 7215.379f, 106.7846f) }; Vector3[] PathLeavingValarjar03 = { - new Vector3(810.8403f, 7231.531f, 106.7846f), - new Vector3(807.5087f, 7248.719f, 106.7846f), - new Vector3(801.2587f, 7254.592f, 106.7846f), - new Vector3(794.6649f, 7265.814f, 107.5846f), - new Vector3(792.0191f, 7274.151f, 107.5846f), - new Vector3(790.1823f, 7282.182f, 107.5846f) + new (810.8403f, 7231.531f, 106.7846f), + new (807.5087f, 7248.719f, 106.7846f), + new (801.2587f, 7254.592f, 106.7846f), + new (794.6649f, 7265.814f, 107.5846f), + new (792.0191f, 7274.151f, 107.5846f), + new (790.1823f, 7282.182f, 107.5846f) }; public npc_leaving_valarjar_2(Creature creature) : base(creature) { } @@ -518,24 +481,14 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior switch (id) { case 0: - _scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(6), context => - { - me.HandleEmoteCommand(EmoteIds.PayingRespectToOdynRandomEmotes.SelectRandom()); - }); - - _scheduler.Schedule(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(15), context => - { - me.GetMotionMaster().MoveSmoothPath(1, PathLeavingValarjar02, PathLeavingValarjar02.Length, true); - }); + _scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(6), _ => me.HandleEmoteCommand(MiscConst.PayingRespectToOdynRandomEmotes.SelectRandom())); + _scheduler.Schedule(TimeSpan.FromSeconds(7), TimeSpan.FromSeconds(15), _ => me.GetMotionMaster().MoveSmoothPath(1, PathLeavingValarjar02, PathLeavingValarjar02.Length, true)); break; case 1: - _scheduler.Schedule(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(3), context => + _scheduler.Schedule(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(3), task => { me.PlayOneShotAnimKitId(1431); - _scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(10), context => - { - me.GetMotionMaster().MoveSmoothPath(2, PathLeavingValarjar03, PathLeavingValarjar03.Length); - }); + task.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(10), _ => me.GetMotionMaster().MoveSmoothPath(2, PathLeavingValarjar03, PathLeavingValarjar03.Length)); }); break; case 2: @@ -557,9 +510,9 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior public override void MoveInLineOfSight(Unit who) { Player player = who.ToPlayer(); - if (player) + if (player != null) { - if (player.GetQuestStatus(QuestIds.OdynAndTheValarjar) == QuestStatus.Incomplete) + if (player.GetQuestStatus(MiscConst.QuestOdynAndTheValarjar) == QuestStatus.Incomplete) { if (player.IsInDist(me, 60.0f)) { @@ -591,7 +544,7 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior context.Repeat(); }); - _scheduler.Schedule(TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(20), context => + _scheduler.Schedule(TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(20), _ => { float direction = me.GetOrientation() + MathF.PI; me.GetMotionMaster().MovePoint(0, me.GetFirstCollisionPosition(5.0f, direction)); @@ -616,28 +569,23 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior [Script] class npc_valkyr_of_odyn_1 : ScriptedAI { - public npc_valkyr_of_odyn_1(Creature creature) : base(creature) { } - Vector3[] Path = { - new Vector3(996.5347f, 7321.393f, 124.0931f), - new Vector3(1009.880f, 7311.655f, 118.0898f), - new Vector3(1024.688f, 7293.689f, 120.4009f), - new Vector3(1038.288f, 7266.321f, 122.2708f), - new Vector3(1049.439f, 7235.418f, 120.1065f), - new Vector3(1067.825f, 7229.589f, 114.6320f), - new Vector3(1082.800f, 7223.660f, 98.63562f) + new (996.5347f, 7321.393f, 124.0931f), + new (1009.880f, 7311.655f, 118.0898f), + new (1024.688f, 7293.689f, 120.4009f), + new (1038.288f, 7266.321f, 122.2708f), + new (1049.439f, 7235.418f, 120.1065f), + new (1067.825f, 7229.589f, 114.6320f), + new (1082.800f, 7223.660f, 98.63562f) }; + public npc_valkyr_of_odyn_1(Creature creature) : base(creature) { } + public override void Reset() { if (me.GetPositionZ() >= 100.0f) - { - _scheduler.Schedule(TimeSpan.FromSeconds(3), context => - { - me.GetMotionMaster().MoveSmoothPath(2, Path, Path.Length, false, true); - }); - } + _scheduler.Schedule(TimeSpan.FromSeconds(3), _ => me.GetMotionMaster().MoveSmoothPath(2, Path, Path.Length, false, true)); else me.GetMotionMaster().MoveSmoothPath(1, Path, Path.Length, false, true); } @@ -652,7 +600,7 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior switch (id) { case 2: - _scheduler.Schedule(TimeSpan.FromMilliseconds(250), context => + _scheduler.Schedule(TimeSpan.FromMilliseconds(250), _ => { /* * (MovementMonsterSpline) (MovementSpline) MoveTime: 3111 @@ -680,24 +628,24 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior { Vector3[] Path = { - new Vector3(1113.635f, 7214.023f, 7.808200f), - new Vector3(1110.443f, 7213.999f, 17.28479f), - new Vector3(1108.583f, 7213.984f, 22.80371f), - new Vector3(1103.488f, 7221.702f, 70.68047f), - new Vector3(1101.911f, 7222.535f, 82.51234f), - new Vector3(1098.861f, 7222.271f, 90.03111f), - new Vector3(1095.129f, 7223.033f, 94.15130f), - new Vector3(1089.240f, 7223.335f, 97.94925f), - new Vector3(1077.932f, 7222.822f, 110.2143f), - new Vector3(1068.802f, 7223.216f, 110.2143f), - new Vector3(1045.356f, 7224.674f, 114.5371f), - new Vector3(1023.946f, 7224.304f, 120.0150f), - new Vector3(1002.535f, 7224.943f, 121.1011f), - new Vector3(911.7552f, 7227.165f, 121.7384f), - new Vector3(879.1285f, 7227.272f, 121.7384f), - new Vector3(830.8785f, 7233.613f, 121.7384f), - new Vector3(809.5052f, 7267.270f, 121.7384f), - new Vector3(795.2899f, 7311.849f, 121.7384f) + new (1113.635f, 7214.023f, 7.808200f), + new (1110.443f, 7213.999f, 17.28479f), + new (1108.583f, 7213.984f, 22.80371f), + new (1103.488f, 7221.702f, 70.68047f), + new (1101.911f, 7222.535f, 82.51234f), + new (1098.861f, 7222.271f, 90.03111f), + new (1095.129f, 7223.033f, 94.15130f), + new (1089.240f, 7223.335f, 97.94925f), + new (1077.932f, 7222.822f, 110.2143f), + new (1068.802f, 7223.216f, 110.2143f), + new (1045.356f, 7224.674f, 114.5371f), + new (1023.946f, 7224.304f, 120.0150f), + new (1002.535f, 7224.943f, 121.1011f), + new (911.7552f, 7227.165f, 121.7384f), + new (879.1285f, 7227.272f, 121.7384f), + new (830.8785f, 7233.613f, 121.7384f), + new (809.5052f, 7267.270f, 121.7384f), + new (795.2899f, 7311.849f, 121.7384f) }; public npc_valkyr_of_odyn_2(Creature creature) : base(creature) { } @@ -705,12 +653,7 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior public override void Reset() { if (me.GetPositionZ() >= 100.0f) - { - _scheduler.Schedule(TimeSpan.FromSeconds(3), context => - { - me.GetMotionMaster().MoveSmoothPath(2, Path, Path.Length, false, true); - }); - } + _scheduler.Schedule(TimeSpan.FromSeconds(3), _ => me.GetMotionMaster().MoveSmoothPath(2, Path, Path.Length, false, true)); else me.GetMotionMaster().MoveSmoothPath(1, Path, Path.Length, false, true); } @@ -725,7 +668,7 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior switch (id) { case 2: - _scheduler.Schedule(TimeSpan.FromMilliseconds(250), context => + _scheduler.Schedule(TimeSpan.FromMilliseconds(250), _ => { /* * (MovementMonsterSpline) (MovementSpline) MoveTime: 3111 @@ -753,20 +696,20 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior { Vector3[] Path = { - new Vector3(1133.929f, 7223.167f, 38.90330f), - new Vector3(1124.510f, 7222.310f, 42.15336f), - new Vector3(1119.903f, 7221.891f, 43.74335f), - new Vector3(1103.934f, 7227.212f, 69.99904f), - new Vector3(1097.554f, 7226.132f, 89.09371f), - new Vector3(1092.602f, 7224.059f, 101.1545f), - new Vector3(1078.701f, 7228.348f, 109.5599f), - new Vector3(1068.967f, 7232.247f, 116.7876f), - new Vector3(1053.540f, 7229.623f, 117.8927f), - new Vector3(1044.104f, 7242.757f, 118.7891f), - new Vector3(1031.111f, 7256.717f, 118.7891f), - new Vector3(1029.684f, 7288.019f, 126.3048f), - new Vector3(1029.889f, 7325.333f, 126.3061f), - new Vector3(1039.043f, 7365.176f, 133.2310f) + new (1133.929f, 7223.167f, 38.90330f), + new (1124.510f, 7222.310f, 42.15336f), + new (1119.903f, 7221.891f, 43.74335f), + new (1103.934f, 7227.212f, 69.99904f), + new (1097.554f, 7226.132f, 89.09371f), + new (1092.602f, 7224.059f, 101.1545f), + new (1078.701f, 7228.348f, 109.5599f), + new (1068.967f, 7232.247f, 116.7876f), + new (1053.540f, 7229.623f, 117.8927f), + new (1044.104f, 7242.757f, 118.7891f), + new (1031.111f, 7256.717f, 118.7891f), + new (1029.684f, 7288.019f, 126.3048f), + new (1029.889f, 7325.333f, 126.3061f), + new (1039.043f, 7365.176f, 133.2310f) }; public npc_valkyr_of_odyn_3(Creature creature) : base(creature) { } @@ -774,12 +717,7 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior public override void Reset() { if (me.GetPositionZ() >= 100.0f) - { - _scheduler.Schedule(TimeSpan.FromSeconds(3), context => - { - me.GetMotionMaster().MoveSmoothPath(2, Path, Path.Length, false, true); - }); - } + _scheduler.Schedule(TimeSpan.FromSeconds(3), _ => me.GetMotionMaster().MoveSmoothPath(2, Path, Path.Length, false, true)); else me.GetMotionMaster().MoveSmoothPath(1, Path, Path.Length, false, true); } @@ -794,7 +732,7 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior switch (id) { case 2: - _scheduler.Schedule(TimeSpan.FromMilliseconds(250), context => + _scheduler.Schedule(TimeSpan.FromMilliseconds(250), _ => { /* * (MovementMonsterSpline) (MovementSpline) MoveTime: 3111 @@ -822,26 +760,21 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior { Vector3[] Path = { - new Vector3(914.8663f, 7204.922f, 128.1687f), - new Vector3(945.4445f, 7216.170f, 128.1687f), - new Vector3(987.2483f, 7220.554f, 125.4318f), - new Vector3(1015.882f, 7222.849f, 126.0546f), - new Vector3(1053.023f, 7224.076f, 119.6729f), - new Vector3(1071.891f, 7222.934f, 108.9545f), - new Vector3(1081.530f, 7224.331f, 98.63076f) + new (914.8663f, 7204.922f, 128.1687f), + new (945.4445f, 7216.170f, 128.1687f), + new (987.2483f, 7220.554f, 125.4318f), + new (1015.882f, 7222.849f, 126.0546f), + new (1053.023f, 7224.076f, 119.6729f), + new (1071.891f, 7222.934f, 108.9545f), + new (1081.530f, 7224.331f, 98.63076f) }; - + public npc_valkyr_of_odyn_4(Creature creature) : base(creature) { } public override void Reset() { if (me.GetPositionZ() >= 100.0f) - { - _scheduler.Schedule(TimeSpan.FromSeconds(3), context => - { - me.GetMotionMaster().MoveSmoothPath(2, Path, Path.Length, false, true); - }); - } + _scheduler.Schedule(TimeSpan.FromSeconds(3), _ => me.GetMotionMaster().MoveSmoothPath(2, Path, Path.Length, false, true)); else me.GetMotionMaster().MoveSmoothPath(1, Path, Path.Length, false, true); } @@ -856,7 +789,7 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior switch (id) { case 2: - _scheduler.Schedule(TimeSpan.FromMilliseconds(250), context => + _scheduler.Schedule(TimeSpan.FromMilliseconds(250), _ => { /* * (MovementMonsterSpline) (MovementSpline) MoveTime: 3111 @@ -884,31 +817,26 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior { Vector3[] Path = { - new Vector3(1038.141f, 7134.033f, 105.8965f), - new Vector3(1033.373f, 7134.492f, 105.8965f), - new Vector3(1027.882f, 7136.373f, 105.8965f), - new Vector3(1026.943f, 7144.288f, 105.8965f), - new Vector3(1027.608f, 7167.030f, 108.4167f), - new Vector3(1027.767f, 7180.922f, 108.4167f), - new Vector3(1028.484f, 7197.977f, 108.4167f), - new Vector3(1034.113f, 7207.747f, 108.4167f), - new Vector3(1041.977f, 7216.452f, 108.4167f), - new Vector3(1054.269f, 7223.207f, 108.4167f), - new Vector3(1075.891f, 7224.811f, 101.7954f), - new Vector3(1082.438f, 7224.540f, 99.12900f) + new (1038.141f, 7134.033f, 105.8965f), + new (1033.373f, 7134.492f, 105.8965f), + new (1027.882f, 7136.373f, 105.8965f), + new (1026.943f, 7144.288f, 105.8965f), + new (1027.608f, 7167.030f, 108.4167f), + new (1027.767f, 7180.922f, 108.4167f), + new (1028.484f, 7197.977f, 108.4167f), + new (1034.113f, 7207.747f, 108.4167f), + new (1041.977f, 7216.452f, 108.4167f), + new (1054.269f, 7223.207f, 108.4167f), + new (1075.891f, 7224.811f, 101.7954f), + new (1082.438f, 7224.540f, 99.12900f) }; - + public npc_valkyr_of_odyn_5(Creature creature) : base(creature) { } public override void Reset() { if (me.GetPositionZ() >= 100.0f) - { - _scheduler.Schedule(TimeSpan.FromSeconds(3), context => - { - me.GetMotionMaster().MoveSmoothPath(2, Path, Path.Length, false, true); - }); - } + _scheduler.Schedule(TimeSpan.FromSeconds(3), _ => me.GetMotionMaster().MoveSmoothPath(2, Path, Path.Length, false, true)); else me.GetMotionMaster().MoveSmoothPath(1, Path, Path.Length, false, true); } @@ -923,7 +851,7 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior switch (id) { case 2: - _scheduler.Schedule(TimeSpan.FromMilliseconds(250), context => + _scheduler.Schedule(TimeSpan.FromMilliseconds(250), _ => { /* * (MovementMonsterSpline) (MovementSpline) MoveTime: 3111 @@ -951,36 +879,31 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior { Vector3[] Path = { - new Vector3(1112.011f, 7233.799f, 45.87240f), - new Vector3(1107.887f, 7234.073f, 54.97818f), - new Vector3(1106.264f, 7234.181f, 58.56218f), - new Vector3(1099.969f, 7236.397f, 75.87664f), - new Vector3(1096.552f, 7233.196f, 85.53920f), - new Vector3(1095.531f, 7229.387f, 89.86687f), - new Vector3(1092.981f, 7225.366f, 97.69602f), - new Vector3(1082.800f, 7221.249f, 109.4660f), - new Vector3(1070.983f, 7218.749f, 112.6827f), - new Vector3(1057.455f, 7216.709f, 112.6827f), - new Vector3(1051.859f, 7210.338f, 112.6827f), - new Vector3(1042.427f, 7200.762f, 112.6827f), - new Vector3(1032.616f, 7183.982f, 112.6827f), - new Vector3(1027.792f, 7157.764f, 112.6827f), - new Vector3(1026.870f, 7126.981f, 112.6827f), - new Vector3(1053.083f, 7102.808f, 125.9283f), - new Vector3(1055.122f, 7059.807f, 130.4395f) + new (1112.011f, 7233.799f, 45.87240f), + new (1107.887f, 7234.073f, 54.97818f), + new (1106.264f, 7234.181f, 58.56218f), + new (1099.969f, 7236.397f, 75.87664f), + new (1096.552f, 7233.196f, 85.53920f), + new (1095.531f, 7229.387f, 89.86687f), + new (1092.981f, 7225.366f, 97.69602f), + new (1082.800f, 7221.249f, 109.4660f), + new (1070.983f, 7218.749f, 112.6827f), + new (1057.455f, 7216.709f, 112.6827f), + new (1051.859f, 7210.338f, 112.6827f), + new (1042.427f, 7200.762f, 112.6827f), + new (1032.616f, 7183.982f, 112.6827f), + new (1027.792f, 7157.764f, 112.6827f), + new (1026.870f, 7126.981f, 112.6827f), + new (1053.083f, 7102.808f, 125.9283f), + new (1055.122f, 7059.807f, 130.4395f) }; - + public npc_valkyr_of_odyn_6(Creature creature) : base(creature) { } public override void Reset() { if (me.GetPositionZ() >= 100.0f) - { - _scheduler.Schedule(TimeSpan.FromSeconds(3), context => - { - me.GetMotionMaster().MoveSmoothPath(2, Path, Path.Length, false, true); - }); - } + _scheduler.Schedule(TimeSpan.FromSeconds(3), _ => me.GetMotionMaster().MoveSmoothPath(2, Path, Path.Length, false, true)); else me.GetMotionMaster().MoveSmoothPath(1, Path, Path.Length, false, true); } @@ -995,7 +918,7 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior switch (id) { case 2: - _scheduler.Schedule(TimeSpan.FromMilliseconds(250), context => + _scheduler.Schedule(TimeSpan.FromMilliseconds(250), _ => { /* * (MovementMonsterSpline) (MovementSpline) MoveTime: 3111 @@ -1023,16 +946,16 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior { Vector3[] Path = { - new Vector3(1064.076f, 7305.979f, 117.5428f), - new Vector3(1058.290f, 7305.543f, 117.5428f), - new Vector3(1046.578f, 7305.583f, 117.5428f), - new Vector3(1034.373f, 7295.979f, 117.5428f), - new Vector3(1026.639f, 7275.582f, 114.1900f), - new Vector3(1030.729f, 7251.381f, 114.1900f), - new Vector3(1040.950f, 7237.213f, 114.1900f), - new Vector3(1057.274f, 7229.228f, 114.1900f), - new Vector3(1070.297f, 7226.421f, 111.7502f), - new Vector3(1082.146f, 7225.846f, 101.0798f) + new (1064.076f, 7305.979f, 117.5428f), + new (1058.290f, 7305.543f, 117.5428f), + new (1046.578f, 7305.583f, 117.5428f), + new (1034.373f, 7295.979f, 117.5428f), + new (1026.639f, 7275.582f, 114.1900f), + new (1030.729f, 7251.381f, 114.1900f), + new (1040.950f, 7237.213f, 114.1900f), + new (1057.274f, 7229.228f, 114.1900f), + new (1070.297f, 7226.421f, 111.7502f), + new (1082.146f, 7225.846f, 101.0798f) }; public npc_valkyr_of_odyn_7(Creature creature) : base(creature) { } @@ -1040,12 +963,7 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior public override void Reset() { if (me.GetPositionZ() >= 100.0f) - { - _scheduler.Schedule(TimeSpan.FromSeconds(3), context => - { - me.GetMotionMaster().MoveSmoothPath(2, Path, Path.Length, false, true); - }); - } + _scheduler.Schedule(TimeSpan.FromSeconds(3), _ => me.GetMotionMaster().MoveSmoothPath(2, Path, Path.Length, false, true)); else me.GetMotionMaster().MoveSmoothPath(1, Path, Path.Length, false, true); } @@ -1086,7 +1004,7 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior [Script] class npc_weapon_inspector_valarjar : ScriptedAI { - Tuple[] _randomWeapons = { Tuple.Create(ItemIds.Hov2HAxe, 0u), Tuple.Create(ItemIds.Hov1HSword, ItemIds.HovShield2) }; + (uint, uint)[] _randomWeapons = { (ItemIds.Hov2HAxe, 0u), (ItemIds.Hov1HSword, ItemIds.HovShield2) }; public npc_weapon_inspector_valarjar(Creature creature) : base(creature) { } @@ -1100,18 +1018,15 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior _scheduler.Schedule(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(20), context => { me.SetAIAnimKitId(0); - Tuple weapons = _randomWeapons.SelectRandom(); - me.SetVirtualItem(0, weapons.Item1); - me.SetVirtualItem(1, weapons.Item2); + var (itemId1, itemId2) = _randomWeapons.SelectRandom(); + me.SetVirtualItem(0, itemId1); + me.SetVirtualItem(1, itemId2); - context.Schedule(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(10), context => + _scheduler.Schedule(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(10), context => { me.SetVirtualItem(0, 0); me.SetVirtualItem(1, 0); - context.Schedule(TimeSpan.FromSeconds(10), context => - { - me.SetAIAnimKitId(1583); - }); + context.Schedule(TimeSpan.FromSeconds(10), _ => me.SetAIAnimKitId(1583)); }); context.Repeat(TimeSpan.FromSeconds(30)); @@ -1126,8 +1041,8 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior public override void OnSceneStart(Player player, uint sceneInstanceID, SceneTemplate sceneTemplate) { - PhasingHandler.RemovePhase(player, PhaseIds.Danica, false); - PhasingHandler.RemovePhase(player, PhaseIds.Odyn, true); + PhasingHandler.RemovePhase(player, MiscConst.PhaseDanica, false); + PhasingHandler.RemovePhase(player, MiscConst.PhaseOdyn, true); player.SetControlled(true, UnitState.Root); } @@ -1145,10 +1060,9 @@ namespace Scripts.BrokenIsles.ZoneOrderhallWarrior void Finish(Player player) { - PhasingHandler.AddPhase(player, PhaseIds.Odyn, true); + PhasingHandler.AddPhase(player, MiscConst.PhaseOdyn, true); player.SetControlled(false, UnitState.Root); player.CastSpell(player, SpellIds.CancelCompleteSceneWarriorOrderFormation); } } } -