diff --git a/Source/Game/Entities/Unit/Unit.cs b/Source/Game/Entities/Unit/Unit.cs index b2c205259..d6bc4e5f8 100644 --- a/Source/Game/Entities/Unit/Unit.cs +++ b/Source/Game/Entities/Unit/Unit.cs @@ -1287,6 +1287,8 @@ namespace Game.Entities public virtual UnitAI GetAI() { return i_AI; } + public virtual T GetAI() where T : UnitAI { return (T)i_AI; } + public UnitAI GetTopAI() { return i_AIs.Count == 0 ? null : i_AIs.Peek(); } public void AIUpdateTick(uint diff) diff --git a/Source/Scripts/BrokenIsles/ZoneMardum.cs b/Source/Scripts/BrokenIsles/ZoneMardum.cs index d0fb3fa9d..0d72c4358 100644 --- a/Source/Scripts/BrokenIsles/ZoneMardum.cs +++ b/Source/Scripts/BrokenIsles/ZoneMardum.cs @@ -15,16 +15,6 @@ using static Global; namespace Scripts.BrokenIsles.ZoneMardum { - - enum MardumQuestData - { - QuestDemonHunterIntroTracker = 40076 - } - - enum MardumSoundData - { - } - [Script] class scene_demonhunter_intro : SceneScript { @@ -44,7 +34,7 @@ namespace Scripts.BrokenIsles.ZoneMardum } [Script] // 196030 - Start: Quest Invis - class spell_demon_hunter_intro_AuraScript : AuraScript + class spell_demon_hunter_intro : AuraScript { const uint SpellStartDemonHunterPlayScene = 193525; @@ -552,4 +542,212 @@ namespace Scripts.BrokenIsles.ZoneMardum DoMeleeAttackIfReady(); } } + + struct AshtongueIntroData + { + public const uint QuestEnterTheIllidariAshtongue = 40378; + + public const uint NpcKaynSunfuryAshtongue = 98229; + public const uint NpcKorvasBloodthornAshtongue = 98354; + public const uint NpcSevisBrightflameAshtongue = 99916; + public const uint NpcAllariSouleaterAshtongue = 94410; + + public const uint DisplayIdSevisMount = 64385; + + public const uint SayKaynActivateGateway = 0; + public const uint SayKaynCutAHole = 1; + public const uint SayKorvasSlayMoreDemons = 0; + public const uint SaySevisSayFindAllari = 1; + + public const uint SpellVisualKitSevisMount = 36264; + + public const uint SpellCastMountDhFelsaber = 200175; + public const uint SpellAshtongueFellsaberKillCredit = 200254; + + public const uint PathKaynSunfuryNearTeleport = 9822900; + public const uint PathKorvasBloodthornNearTeleport = 9835400; + public const uint PathSevisBrightflameGateway = 9991600; + } + + [Script] // 98229 - Kayn Sunfury + class npc_kayn_sunfury_ashtongue_intro : ScriptedAI + { + public npc_kayn_sunfury_ashtongue_intro(Creature creature) : base(creature) { } + + public override void OnQuestAccept(Player player, Quest quest) + { + if (quest.Id == AshtongueIntroData.QuestEnterTheIllidariAshtongue) + { + PhasingHandler.OnConditionChange(player); + Creature kaynObject = GetClosestCreatureWithOptions(player, 10.0f, new FindCreatureOptions() { CreatureId = AshtongueIntroData.NpcKaynSunfuryAshtongue, IgnorePhases = true }); + Creature korvasObject = GetClosestCreatureWithOptions(player, 10.0f, new FindCreatureOptions() { CreatureId = AshtongueIntroData.NpcKorvasBloodthornAshtongue, IgnorePhases = true }); + if (kaynObject == null || korvasObject == null) + return; + + TempSummon kaynClone = kaynObject.SummonPersonalClone(kaynObject.GetPosition(), TempSummonType.ManualDespawn, TimeSpan.Zero, 0, 0, player); + TempSummon korvasClone = korvasObject.SummonPersonalClone(korvasObject.GetPosition(), TempSummonType.ManualDespawn, TimeSpan.Zero, 0, 0, player); + if (kaynClone == null || korvasClone == null) + return; + + korvasClone.SetEmoteState(Emote.StateReady1h); + kaynClone.RemoveNpcFlag(NPCFlags.QuestGiver); + } + } + + public override void JustAppeared() + { + if (!me.IsPrivateObject()) + return; + + Creature korvasObject = GetClosestCreatureWithOptions(me, 10.0f, new FindCreatureOptions() { CreatureId = AshtongueIntroData.NpcKorvasBloodthornAshtongue, IgnorePhases = true, PrivateObjectOwnerGuid = me.GetPrivateObjectOwner() }); + if (korvasObject == null) + return; + + ObjectGuid korvasGuid = korvasObject.GetGUID(); + + _scheduler.Schedule(TimeSpan.FromSeconds(1), task => + { + Unit privateObjectOwner = ObjAccessor.GetUnit(me, me.GetPrivateObjectOwner()); + if (privateObjectOwner == null) + return; + + Unit korvas = ObjAccessor.GetUnit(me, korvasGuid); + if (korvas == null) + return; + + Talk(AshtongueIntroData.SayKaynActivateGateway, me); + me.CastSpell(privateObjectOwner, TheInvasionBeginsConst.SpellTrackTargetInChannel, false); + korvas.CastSpell(privateObjectOwner, TheInvasionBeginsConst.SpellTrackTargetInChannel, false); + + task.Schedule(TimeSpan.FromSeconds(6), task => + { + Talk(AshtongueIntroData.SayKaynCutAHole, me); + + task.Schedule(TimeSpan.FromSeconds(6), task => + { + Creature korvas = ObjectAccessor.GetCreature(me, korvasGuid); + if (korvas == null) + return; + + if (!korvas.IsAIEnabled()) + return; + + korvas.GetAI().Talk(AshtongueIntroData.SayKorvasSlayMoreDemons, me); + me.InterruptNonMeleeSpells(true); + me.GetMotionMaster().MovePath(AshtongueIntroData.PathKaynSunfuryNearTeleport, false); + me.SetAIAnimKitId(TheInvasionBeginsConst.AnimDhRun); + me.DespawnOrUnsummon(TimeSpan.FromSeconds(10)); + + task.Schedule(TimeSpan.FromSeconds(2), _ => + { + Creature korvas = ObjectAccessor.GetCreature(me, korvasGuid); + if (korvas == null) + return; + + korvas.InterruptNonMeleeSpells(true); + korvas.GetMotionMaster().MovePath(AshtongueIntroData.PathKorvasBloodthornNearTeleport, false); + korvas.SetAIAnimKitId(TheInvasionBeginsConst.AnimDhRun); + korvas.DespawnOrUnsummon(TimeSpan.FromSeconds(12)); + }); + }); + }); + }); + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + } + + [Script] // 1053 - Enter the Illidari: Ashtongue + class scene_enter_the_illidari_ashtongue : SceneScript + { + public scene_enter_the_illidari_ashtongue() : base("scene_enter_the_illidari_ashtongue") { } + + public override void OnSceneStart(Player player, uint sceneInstanceID, SceneTemplate sceneTemplate) + { + Creature sevisObject = player.FindNearestCreatureWithOptions(30.0f, new() { CreatureId = AshtongueIntroData.NpcSevisBrightflameAshtongue, IgnorePhases = true }); + if (sevisObject == null) + return; + + TempSummon sevisClone = sevisObject.SummonPersonalClone(sevisObject.GetPosition(), TempSummonType.ManualDespawn, TimeSpan.Zero, 0, 0, player); + if (sevisClone == null) + return; + + sevisClone.CastSpell(player, TheInvasionBeginsConst.SpellTrackTargetInChannel, false); + sevisClone.DespawnOrUnsummon(TimeSpan.FromSeconds(15)); + } + + public override void OnSceneTriggerEvent(Player player, uint sceneInstanceID, SceneTemplate sceneTemplate, string triggerName) + { + if (triggerName == "SEEFELSABERCREDIT") + player.CastSpell(player, AshtongueIntroData.SpellAshtongueFellsaberKillCredit, true); + else if (triggerName == "UPDATEPHASE") + PhasingHandler.OnConditionChange(player); + } + } + + [Script] // 99916 - Sevis Brightflame (Ashtongue Gateway) + class npc_sevis_brightflame_ashtongue_gateway_private : ScriptedAI + { + public npc_sevis_brightflame_ashtongue_gateway_private(Creature creature) : base(creature) { } + + public override void JustAppeared() + { + if (!me.IsPrivateObject()) + return; + + _scheduler.Schedule(TimeSpan.FromSeconds(1), task => + { + Talk(AshtongueIntroData.SaySevisSayFindAllari, me); + + task.Schedule(TimeSpan.FromSeconds(2), task => + { + me.SendPlaySpellVisualKit(AshtongueIntroData.SpellVisualKitSevisMount, 0, 0); + me.SetMountDisplayId(AshtongueIntroData.DisplayIdSevisMount); + + task.Schedule(TimeSpan.FromSeconds(3), _ => + { + me.InterruptNonMeleeSpells(true); + me.GetMotionMaster().MovePath(AshtongueIntroData.PathSevisBrightflameGateway, false); + }); + }); + }); + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + } + + [Script] // 200255 - Accepting Felsaber Gift + class spell_accepting_felsaber_gift : SpellScript + { + void HandleHitTarget(uint effIndex) + { + GetCaster().CastSpell(null, AshtongueIntroData.SpellCastMountDhFelsaber, true); + } + + public override void Register() + { + OnEffectHitTarget.Add(new(HandleHitTarget, 3, SpellEffectName.Dummy)); + } + } + + [Script] // 32 - Mardum - Trigger KillCredit for Quest "Enter the Illidari: Ashtongue" + class at_enter_the_illidari_ashtongue_allari_killcredit : AreaTriggerAI + { + public at_enter_the_illidari_ashtongue_allari_killcredit(AreaTrigger areatrigger) : base(areatrigger) { } + + public override void OnUnitEnter(Unit unit) + { + Player player = unit.ToPlayer(); + if (player == null || player.GetQuestStatus(AshtongueIntroData.QuestEnterTheIllidariAshtongue) != QuestStatus.Incomplete) + return; + + player.KilledMonsterCredit(AshtongueIntroData.NpcAllariSouleaterAshtongue); + } + } } diff --git a/Source/Scripts/DragonIsles/RubyLifePools/RubyLifePools.cs b/Source/Scripts/DragonIsles/RubyLifePools/RubyLifePools.cs index 5c2c0a568..74f2e36a0 100644 --- a/Source/Scripts/DragonIsles/RubyLifePools/RubyLifePools.cs +++ b/Source/Scripts/DragonIsles/RubyLifePools/RubyLifePools.cs @@ -15,9 +15,9 @@ namespace Scripts.DragonIsles.RubyLifePools // Primal Juggernaut public const uint Excavate = 373497; - }; + } - // 371652 - Executed + [Script] // 371652 - Executed class spell_ruby_life_pools_executed : AuraScript { void HandleEffectApply(AuraEffect aurEff, AuraEffectHandleModes mode) @@ -34,7 +34,7 @@ namespace Scripts.DragonIsles.RubyLifePools } } - // 384933 - Ice Shield + [Script] // 384933 - Ice Shield class spell_ruby_life_pools_ice_shield : AuraScript { void HandleEffectPeriodic(AuraEffect aurEff) @@ -49,7 +49,7 @@ namespace Scripts.DragonIsles.RubyLifePools } } - // 372793 - Excavate + [Script] // 372793 - Excavate class spell_ruby_life_pools_excavate : AuraScript { void HandleEffectPeriodic(AuraEffect aurEff) @@ -63,7 +63,7 @@ namespace Scripts.DragonIsles.RubyLifePools } } - // 395029 - Storm Infusion + [Script] // 395029 - Storm Infusion class spell_ruby_life_pools_storm_infusion : SpellScript { void SetDest(ref SpellDestination dest) diff --git a/Source/Scripts/Events/Brewfest.cs b/Source/Scripts/Events/Brewfest.cs index 2f417f33f..de53429b3 100644 --- a/Source/Scripts/Events/Brewfest.cs +++ b/Source/Scripts/Events/Brewfest.cs @@ -1,4 +1,4 @@ -// Copyright (c) CypherCore All rights reserved. +// 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; @@ -11,7 +11,6 @@ namespace Scripts.Events.Brewfest { struct SpellIds { - //Ramblabla public const uint Giddyup = 42924; public const uint RentalRacingRam = 43883; public const uint SwiftWorkRam = 43880; @@ -24,23 +23,14 @@ namespace Scripts.Events.Brewfest public const uint ExhaustedRam = 43332; public const uint RelayRaceTurnIn = 44501; - //Brewfestmounttransformation - public const uint MountRam100 = 43900; - public const uint MountRam60 = 43899; - public const uint MountKodo100 = 49379; - public const uint MountKodo60 = 49378; - public const uint BrewfestMountTransform = 49357; - public const uint BrewfestMountTransformReverse = 52845; + // Quest + public const uint BrewfestQuestSpeedBunnyGreen = 43345; + public const uint BrewfestQuestSpeedBunnyYellow = 43346; + public const uint BrewfestQuestSpeedBunnyRed = 43347; } struct QuestIds { - //Ramblabla - public const uint BrewfestSpeedBunnyGreen = 43345; - public const uint BrewfestSpeedBunnyYellow = 43346; - public const uint BrewfestSpeedBunnyRed = 43347; - - //Barkerbunny // Horde public const uint BarkForDrohnsDistillery = 11407; public const uint BarkForTchalisVoodooBrewery = 11408; @@ -49,32 +39,31 @@ namespace Scripts.Events.Brewfest public const uint BarkBarleybrew = 11293; public const uint BarkForThunderbrews = 11294; } - struct TextIds { - // Bark For Drohn'S Distillery! - public const uint DrohnDistillery1 = 23520; - public const uint DrohnDistillery2 = 23521; - public const uint DrohnDistillery3 = 23522; - public const uint DrohnDistillery4 = 23523; + // Bark for Drohn's Distillery! + public const uint SayDrohnDistillery1 = 23520; + public const uint SayDrohnDistillery2 = 23521; + public const uint SayDrohnDistillery3 = 23522; + public const uint SayDrohnDistillery4 = 23523; - // Bark For T'Chali'S Voodoo Brewery! - public const uint TChalisVoodoo1 = 23524; - public const uint TChalisVoodoo2 = 23525; - public const uint TChalisVoodoo3 = 23526; - public const uint TChalisVoodoo4 = 23527; + // Bark for T'chali's Voodoo Brewery! + public const uint SayTchalisVoodoo1 = 23524; + public const uint SayTchalisVoodoo2 = 23525; + public const uint SayTchalisVoodoo3 = 23526; + public const uint SayTchalisVoodoo4 = 23527; - // Bark For The Barleybrews! - public const uint Barleybrew1 = 23464; - public const uint Barleybrew2 = 23465; - public const uint Barleybrew3 = 23466; - public const uint Barleybrew4 = 22941; + // Bark for the Barleybrews! + public const uint SayBarleybrew1 = 23464; + public const uint SayBarleybrew2 = 23465; + public const uint SayBarleybrew3 = 23466; + public const uint SayBarleybrew4 = 22941; - // Bark For The Thunderbrews! - public const uint Thunderbrews1 = 23467; - public const uint Thunderbrews2 = 23468; - public const uint Thunderbrews3 = 23469; - public const uint Thunderbrews4 = 22942; + // Bark for the Thunderbrews! + public const uint SayThunderbrews1 = 23467; + public const uint SayThunderbrews2 = 23468; + public const uint SayThunderbrews3 = 23469; + public const uint SayThunderbrews4 = 22942; } [Script] // 42924 - Giddyup! @@ -126,17 +115,16 @@ namespace Scripts.Events.Brewfest public override void Register() { - AfterEffectApply.Add(new EffectApplyHandler(OnChange, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.ChangeAmountMask)); - OnEffectRemove.Add(new EffectApplyHandler(OnChange, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.ChangeAmountMask)); - OnEffectPeriodic.Add(new EffectPeriodicHandler(OnPeriodic, 0, AuraType.PeriodicDummy)); + AfterEffectApply.Add(new(OnChange, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.ChangeAmountMask)); + OnEffectRemove.Add(new(OnChange, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.ChangeAmountMask)); + OnEffectPeriodic.Add(new(OnPeriodic, 0, AuraType.PeriodicDummy)); } } // 43310 - Ram Level - Neutral // 42992 - Ram - Trot // 42993 - Ram - Canter - // 42994 - Ram - Gallop - [Script] + [Script] // 42994 - Ram - Gallop class spell_brewfest_ram : AuraScript { void OnPeriodic(AuraEffect aurEff) @@ -152,43 +140,44 @@ namespace Scripts.Events.Brewfest Aura aura = target.GetAura(SpellIds.RamFatigue); if (aura != null) aura.ModStackAmount(-4); + break; } - break; case SpellIds.RamTrot: // green { Aura aura = target.GetAura(SpellIds.RamFatigue); if (aura != null) aura.ModStackAmount(-2); if (aurEff.GetTickNumber() == 4) - target.CastSpell(target, QuestIds.BrewfestSpeedBunnyGreen, true); + target.CastSpell(target, SpellIds.BrewfestQuestSpeedBunnyGreen, true); + break; } - break; case SpellIds.RamCanter: { CastSpellExtraArgs args = new(TriggerCastFlags.FullMask); args.AddSpellMod(SpellValueMod.AuraStack, 1); target.CastSpell(target, SpellIds.RamFatigue, args); if (aurEff.GetTickNumber() == 8) - target.CastSpell(target, QuestIds.BrewfestSpeedBunnyYellow, true); + target.CastSpell(target, SpellIds.BrewfestQuestSpeedBunnyYellow, true); break; } case SpellIds.RamGallop: { CastSpellExtraArgs args = new(TriggerCastFlags.FullMask); - args.AddSpellMod(SpellValueMod.AuraStack, target.HasAura(SpellIds.RamFatigue) ? 4 : 5 /*Hack*/); + args.AddSpellMod(SpellValueMod.AuraStack, target.HasAura(SpellIds.RamFatigue) ? 4 : 5); target.CastSpell(target, SpellIds.RamFatigue, args); if (aurEff.GetTickNumber() == 8) - target.CastSpell(target, QuestIds.BrewfestSpeedBunnyRed, true); + target.CastSpell(target, SpellIds.BrewfestQuestSpeedBunnyRed, true); break; } default: break; } + } public override void Register() { - OnEffectPeriodic.Add(new EffectPeriodicHandler(OnPeriodic, 1, AuraType.PeriodicDummy)); + OnEffectPeriodic.Add(new(OnPeriodic, 1, AuraType.PeriodicDummy)); } } @@ -213,11 +202,11 @@ namespace Scripts.Events.Brewfest public override void Register() { - AfterEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.Dummy, AuraEffectHandleModes.RealOrReapplyMask)); + AfterEffectApply.Add(new(OnApply, 0, AuraType.Dummy, AuraEffectHandleModes.RealOrReapplyMask)); } } - [Script] // 43450 - Brewfest - apple trap - friendly DND + [Script] // 43450 - Brewfest - apple trap - friendly Dnd class spell_brewfest_apple_trap : AuraScript { void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode) @@ -227,7 +216,7 @@ namespace Scripts.Events.Brewfest public override void Register() { - OnEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.ForceReaction, AuraEffectHandleModes.Real)); + OnEffectApply.Add(new(OnApply, 0, AuraType.ForceReaction, AuraEffectHandleModes.Real)); } } @@ -242,11 +231,11 @@ namespace Scripts.Events.Brewfest public override void Register() { - OnEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.ModDecreaseSpeed, AuraEffectHandleModes.Real)); + OnEffectRemove.Add(new(OnRemove, 0, AuraType.ModDecreaseSpeed, AuraEffectHandleModes.Real)); } } - [Script] // 43714 - Brewfest - Relay Race - Intro - Force - Player to throw- DND + [Script] // 43714 - Brewfest - Relay Race - Intro - Force - Player to throw- Dnd class spell_brewfest_relay_race_intro_force_player_to_throw : SpellScript { void HandleForceCast(uint effIndex) @@ -254,16 +243,16 @@ namespace Scripts.Events.Brewfest PreventHitDefaultEffect(effIndex); // All this spells trigger a spell that requires reagents; if the // triggered spell is cast as "triggered", reagents are not consumed - GetHitUnit().CastSpell((Unit)null, GetEffectInfo().TriggerSpell, new CastSpellExtraArgs(TriggerCastFlags.FullMask & ~TriggerCastFlags.IgnorePowerAndReagentCost)); + GetHitUnit().CastSpell(null, GetEffectInfo().TriggerSpell, TriggerCastFlags.FullMask & ~TriggerCastFlags.IgnorePowerAndReagentCost); } public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleForceCast, 0, SpellEffectName.ForceCast)); + OnEffectHitTarget.Add(new(HandleForceCast, 0, SpellEffectName.ForceCast)); } } - [Script] // 43755 - Brewfest - Daily - Relay Race - Player - Increase Mount Duration - DND + [Script] // 43755 - Brewfest - Daily - Relay Race - Player - Increase Mount Duration - Dnd class spell_brewfest_relay_race_turn_in : SpellScript { void HandleDummy(uint effIndex) @@ -274,13 +263,13 @@ namespace Scripts.Events.Brewfest if (aura != null) { aura.SetDuration(aura.GetDuration() + 30 * Time.InMilliseconds); - GetCaster().CastSpell(GetHitUnit(), SpellIds.RelayRaceTurnIn, new CastSpellExtraArgs(TriggerCastFlags.FullMask)); + GetCaster().CastSpell(GetHitUnit(), SpellIds.RelayRaceTurnIn, TriggerCastFlags.FullMask); } } public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); + OnEffectHitTarget.Add(new(HandleDummy, 0, SpellEffectName.Dummy)); } } @@ -294,20 +283,19 @@ namespace Scripts.Events.Brewfest public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); + OnEffectHitTarget.Add(new(HandleScript, 0, SpellEffectName.ScriptEffect)); } } // 43259 Brewfest - Barker Bunny 1 // 43260 Brewfest - Barker Bunny 2 // 43261 Brewfest - Barker Bunny 3 - // 43262 Brewfest - Barker Bunny 4 - [Script] + [Script] // 43262 Brewfest - Barker Bunny 4 class spell_brewfest_barker_bunny : AuraScript { public override bool Load() { - return GetUnitOwner().IsTypeId(TypeId.Player); + return GetUnitOwner().IsPlayer(); } void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode) @@ -318,19 +306,19 @@ namespace Scripts.Events.Brewfest if (target.GetQuestStatus(QuestIds.BarkForDrohnsDistillery) == QuestStatus.Incomplete || target.GetQuestStatus(QuestIds.BarkForDrohnsDistillery) == QuestStatus.Complete) - BroadcastTextId = RandomHelper.RAND(TextIds.DrohnDistillery1, TextIds.DrohnDistillery2, TextIds.DrohnDistillery3, TextIds.DrohnDistillery4); + BroadcastTextId = RandomHelper.RAND(TextIds.SayDrohnDistillery1, TextIds.SayDrohnDistillery2, TextIds.SayDrohnDistillery3, TextIds.SayDrohnDistillery4); if (target.GetQuestStatus(QuestIds.BarkForTchalisVoodooBrewery) == QuestStatus.Incomplete || target.GetQuestStatus(QuestIds.BarkForTchalisVoodooBrewery) == QuestStatus.Complete) - BroadcastTextId = RandomHelper.RAND(TextIds.TChalisVoodoo1, TextIds.TChalisVoodoo2, TextIds.TChalisVoodoo3, TextIds.TChalisVoodoo4); + BroadcastTextId = RandomHelper.RAND(TextIds.SayTchalisVoodoo1, TextIds.SayTchalisVoodoo2, TextIds.SayTchalisVoodoo3, TextIds.SayTchalisVoodoo4); if (target.GetQuestStatus(QuestIds.BarkBarleybrew) == QuestStatus.Incomplete || target.GetQuestStatus(QuestIds.BarkBarleybrew) == QuestStatus.Complete) - BroadcastTextId = RandomHelper.RAND(TextIds.Barleybrew1, TextIds.Barleybrew2, TextIds.Barleybrew3, TextIds.Barleybrew4); + BroadcastTextId = RandomHelper.RAND(TextIds.SayBarleybrew1, TextIds.SayBarleybrew2, TextIds.SayBarleybrew3, TextIds.SayBarleybrew4); if (target.GetQuestStatus(QuestIds.BarkForThunderbrews) == QuestStatus.Incomplete || target.GetQuestStatus(QuestIds.BarkForThunderbrews) == QuestStatus.Complete) - BroadcastTextId = RandomHelper.RAND(TextIds.Thunderbrews1, TextIds.Thunderbrews2, TextIds.Thunderbrews3, TextIds.Thunderbrews4); + BroadcastTextId = RandomHelper.RAND(TextIds.SayThunderbrews1, TextIds.SayThunderbrews2, TextIds.SayThunderbrews3, TextIds.SayThunderbrews4); if (BroadcastTextId != 0) target.Talk(BroadcastTextId, ChatMsg.Say, WorldConfig.GetFloatValue(WorldCfg.ListenRangeSay), target); @@ -338,16 +326,24 @@ namespace Scripts.Events.Brewfest public override void Register() { - OnEffectApply.Add(new EffectApplyHandler(OnApply, 1, AuraType.Dummy, AuraEffectHandleModes.Real)); + OnEffectApply.Add(new(OnApply, 1, AuraType.Dummy, AuraEffectHandleModes.Real)); } } - [Script] - class spell_item_brewfest_mount_transformation : SpellScript + // 49357 - Brewfest Mount Transformation + [Script] // 52845 - Brewfest Mount Transformation (Faction Swap) + class spell_brewfest_mount_transformation : SpellScript { + const uint SpellMountRam100 = 43900; + const uint SpellMountRam60 = 43899; + const uint SpellMountKodo100 = 49379; + const uint SpellMountKodo60 = 49378; + const uint SpellBrewfestMountTransform = 49357; + const uint SpellBrewfestMountTransformReverse = 52845; + public override bool Validate(SpellInfo spell) { - return ValidateSpellInfo(SpellIds.MountRam100, SpellIds.MountRam60, SpellIds.MountKodo100, SpellIds.MountKodo60); + return ValidateSpellInfo(SpellMountRam100, SpellMountRam60, SpellMountKodo100, SpellMountKodo60); } void HandleDummy(uint effIndex) @@ -360,17 +356,17 @@ namespace Scripts.Events.Brewfest switch (GetSpellInfo().Id) { - case SpellIds.BrewfestMountTransform: + case SpellBrewfestMountTransform: if (caster.GetSpeedRate(UnitMoveType.Run) >= 2.0f) - spell_id = caster.GetTeam() == Team.Alliance ? SpellIds.MountRam100 : SpellIds.MountKodo100; + spell_id = caster.GetTeam() == Team.Alliance ? SpellMountRam100 : SpellMountKodo100; else - spell_id = caster.GetTeam() == Team.Alliance ? SpellIds.MountRam60 : SpellIds.MountKodo60; + spell_id = caster.GetTeam() == Team.Alliance ? SpellMountRam60 : SpellMountKodo60; break; - case SpellIds.BrewfestMountTransformReverse: + case SpellBrewfestMountTransformReverse: if (caster.GetSpeedRate(UnitMoveType.Run) >= 2.0f) - spell_id = caster.GetTeam() == Team.Horde ? SpellIds.MountRam100 : SpellIds.MountKodo100; + spell_id = caster.GetTeam() == Team.Horde ? SpellMountRam100 : SpellMountKodo100; else - spell_id = caster.GetTeam() == Team.Horde ? SpellIds.MountRam60 : SpellIds.MountKodo60; + spell_id = caster.GetTeam() == Team.Horde ? SpellMountRam60 : SpellMountKodo60; break; default: return; @@ -381,7 +377,185 @@ namespace Scripts.Events.Brewfest public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); + OnEffectHit.Add(new(HandleDummy, 0, SpellEffectName.Dummy)); } } -} + + [Script] // 50098 - The Beast Within + class spell_brewfest_botm_the_beast_within : AuraScript + { + const uint SpellBotmUnleashTheBeast = 50099; + + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellBotmUnleashTheBeast); + } + + void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode) + { + GetTarget().CastSpell(GetTarget(), SpellBotmUnleashTheBeast); + } + + public override void Register() + { + AfterEffectRemove.Add(new(AfterRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + } + } + + [Script] // 49864 - Gassy + class spell_brewfest_botm_gassy : AuraScript + { + const uint SpellBotmBelchBrewBelchVisual = 49860; + + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellBotmBelchBrewBelchVisual); + } + + void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode) + { + GetTarget().CastSpell(GetTarget(), SpellBotmBelchBrewBelchVisual, true); + } + + public override void Register() + { + AfterEffectRemove.Add(new(AfterRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + } + } + + [Script] // 49822 - Bloated + class spell_brewfest_botm_bloated : AuraScript + { + const uint SpellBotmBubbleBrewTriggerMissile = 50072; + + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellBotmBubbleBrewTriggerMissile); + } + + void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode) + { + GetTarget().CastSpell(GetTarget(), SpellBotmBubbleBrewTriggerMissile, true); + } + + public override void Register() + { + AfterEffectRemove.Add(new(AfterRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + } + } + + [Script] // 49738 - Internal Combustion + class spell_brewfest_botm_internal_combustion : AuraScript + { + const uint SpellBotmBelchFireVisual = 49737; + + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellBotmBelchFireVisual); + } + + void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode) + { + GetTarget().CastSpell(GetTarget(), SpellBotmBelchFireVisual, true); + } + + public override void Register() + { + AfterEffectRemove.Add(new(AfterRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + } + } + + [Script] // 49962 - Jungle Madness! + class spell_brewfest_botm_jungle_madness : SpellScript + { + const uint SpellBotmJungleBrewVisionEffect = 50010; + + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellBotmJungleBrewVisionEffect); + } + + void HandleAfterCast() + { + GetCaster().CastSpell(GetCaster(), SpellBotmJungleBrewVisionEffect, true); + } + + public override void Register() + { + AfterCast.Add(new(HandleAfterCast)); + } + } + + [Script] // 50243 - Teach Language + class spell_brewfest_botm_teach_language : SpellScript + { + const uint SpellLearnGnomishBinary = 50242; + const uint SpellLearnGoblinBinary = 50246; + + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellLearnGnomishBinary, SpellLearnGoblinBinary); + } + + void HandleDummy(uint effIndex) + { + Player caster = GetCaster().ToPlayer(); + if (caster != null) + caster.CastSpell(caster, caster.GetTeam() == Team.Alliance ? SpellLearnGnomishBinary : SpellLearnGoblinBinary, true); + } + + public override void Register() + { + OnEffectHit.Add(new(HandleDummy, 0, SpellEffectName.Dummy)); + } + } + + [Script] // 42254, 42255, 42256, 42257, 42258, 42259, 42260, 42261, 42263, 42264, 43959, 43961 - Weak Alcohol + class spell_brewfest_botm_weak_alcohol : SpellScript + { + const uint SpellBotmCreateEmptyBrewBottle = 51655; + + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellBotmCreateEmptyBrewBottle); + } + + void HandleAfterCast() + { + GetCaster().CastSpell(GetCaster(), SpellBotmCreateEmptyBrewBottle, true); + } + + public override void Register() + { + AfterCast.Add(new(HandleAfterCast)); + } + } + + [Script] // 51694 - Botm - Empty Bottle Throw - Resolve + class spell_brewfest_botm_empty_bottle_throw_resolve : SpellScript + { + const uint SpellBotmEmptyBottleThrowImpactCreature = 51695; // Just unit, not creature + const uint SpellBotmEmptyBottleThrowImpactGround = 51697; + + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellBotmEmptyBottleThrowImpactCreature, SpellBotmEmptyBottleThrowImpactGround); + } + + void HandleDummy(uint effIndex) + { + Unit caster = GetCaster(); + + Unit target = GetHitUnit(); + if (target != null) + caster.CastSpell(target, SpellBotmEmptyBottleThrowImpactCreature, true); + else + caster.CastSpell(GetHitDest().GetPosition(), SpellBotmEmptyBottleThrowImpactGround, true); + } + + public override void Register() + { + OnEffectHitTarget.Add(new(HandleDummy, 0, SpellEffectName.Dummy)); + } + } +} \ No newline at end of file diff --git a/Source/Scripts/Events/ChildrensWeek.cs b/Source/Scripts/Events/ChildrensWeek.cs new file mode 100644 index 000000000..aea60879a --- /dev/null +++ b/Source/Scripts/Events/ChildrensWeek.cs @@ -0,0 +1,917 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using Framework.Constants; +using Game; +using Game.AI; +using Game.DataStorage; +using Game.Entities; +using Game.Scripting; +using Game.Spells; +using System; + +namespace Scripts.Events.ChildrensWeek +{ + struct TextIds + { + public const uint OracleOrphan1 = 1; + public const uint OracleOrphan2 = 2; + public const uint OracleOrphan3 = 3; + public const uint OracleOrphan4 = 4; + public const uint OracleOrphan5 = 5; + public const uint OracleOrphan6 = 6; + public const uint OracleOrphan7 = 7; + public const uint OracleOrphan8 = 8; + public const uint OracleOrphan9 = 9; + public const uint OracleOrphan10 = 10; + public const uint OracleOrphan11 = 11; + public const uint OracleOrphan12 = 12; + public const uint OracleOrphan13 = 13; + public const uint OracleOrphan14 = 14; + + public const uint WolvarOrphan1 = 1; + public const uint WolvarOrphan2 = 2; + public const uint WolvarOrphan3 = 3; + public const uint WolvarOrphan4 = 4; + public const uint WolvarOrphan5 = 5; + // 6 - 9 used in Nesingwary script + public const uint WolvarOrphan10 = 10; + public const uint WolvarOrphan11 = 11; + public const uint WolvarOrphan12 = 12; + public const uint WolvarOrphan13 = 13; + + public const uint WinterfinPlaymate1 = 1; + public const uint WinterfinPlaymate2 = 2; + + public const uint SnowfallGladePlaymate1 = 1; + public const uint SnowfallGladePlaymate2 = 2; + + public const uint SooRoo1 = 1; + public const uint ElderKekek1 = 1; + + public const uint Alexstrasza2 = 2; + public const uint Krasus8 = 8; + } + + struct QuestIds + { + public const uint PlaymateWolvar = 13951; + public const uint PlaymateOracle = 13950; + public const uint TheBiggestTreeEver = 13929; + public const uint TheBronzeDragonshrineOracle = 13933; + public const uint TheBronzeDragonshrineWolvar = 13934; + public const uint MeetingAGreatOne = 13956; + public const uint TheMightyHemetNesingwary = 13957; + public const uint DownAtTheDocks = 910; + public const uint GatewayToTheFrontier = 911; + public const uint BoughtOfEternals = 1479; + public const uint SpookyLighthouse = 1687; + public const uint StonewroughtDam = 1558; + public const uint DarkPortalH = 10951; + public const uint DarkPortalA = 10952; + public const uint LordaeronThroneRoom = 1800; + public const uint AuchindounAndTheRing = 10950; + public const uint TimeToVisitTheCavernsH = 10963; + public const uint TimeToVisitTheCavernsA = 10962; + public const uint TheSeatOfTheNaruu = 10956; + public const uint CallOnTheFarseer = 10968; + public const uint JheelIsAtAerisLanding = 10954; + public const uint HchuuAndTheMushroomPeople = 10945; + public const uint VisitTheThroneOfElements = 10953; + public const uint NowWhenIGrowUp = 11975; + public const uint HomeOfTheBearMen = 13930; + public const uint TheDragonQueenOracle = 13954; + public const uint TheDragonQueenWolvar = 13955; + } + + struct AreatriggerIds + { + public const uint DownAtTheDocks = 3551; + public const uint GatewayToTheFrontier = 3549; + public const uint LordaeronThroneRoom = 3547; + public const uint BoughtOfEternals = 3546; + public const uint SpookyLighthouse = 3552; + public const uint StonewroughtDam = 3548; + public const uint DarkPortal = 4356; + } + + struct CreatureIds + { + public const uint OrphanOracle = 33533; + public const uint OrphanWolvar = 33532; + public const uint OrphanBloodElf = 22817; + public const uint OrphanDraenei = 22818; + public const uint OrphanHuman = 14305; + public const uint OrphanOrcish = 14444; + + public const uint CavernsOfTimeCwTrigger = 22872; + public const uint Exodar01CwTrigger = 22851; + public const uint Exodar02CwTrigger = 22905; + public const uint AerisLandingCwTrigger = 22838; + public const uint AuchindounCwTrigger = 22831; + public const uint SporeggarCwTrigger = 22829; + public const uint ThroneOfElementsCwTrigger = 22839; + public const uint Silvermoon01CwTrigger = 22866; + public const uint Krasus = 27990; + } + + struct Misc + { + public const uint SpellSnowball = 21343; + public const uint SpellOrphanOut = 58818; + + public const uint DisplayInvisible = 11686; + + public static ObjectGuid GetOrphanGUID(Player player, uint orphan) + { + Aura orphanOut = player.GetAura(SpellOrphanOut); + if (orphanOut != null) + if (orphanOut.GetCaster() != null && orphanOut.GetCaster().GetEntry() == orphan) + return orphanOut.GetCaster().GetGUID(); + + return ObjectGuid.Empty; + } + } + + [Script] + class npc_winterfin_playmate : ScriptedAI + { + bool working; + ObjectGuid orphanGUID; + + public npc_winterfin_playmate(Creature creature) : base(creature) + { + Initialize(); + } + + void Initialize() + { + working = false; + orphanGUID.Clear(); + } + + public override void Reset() + { + Initialize(); + } + + public override void MoveInLineOfSight(Unit who) + { + if (!working && who != null && who.GetDistance2d(me) < 10.0f) + { + Player player = who.ToPlayer(); + if (player == null) + { + Reset(); + return; + } + + if (player.GetQuestStatus(QuestIds.PlaymateOracle) == QuestStatus.Incomplete) + { + orphanGUID = Misc.GetOrphanGUID(player, CreatureIds.OrphanOracle); + if (!orphanGUID.IsEmpty()) + { + Creature orphan = ObjectAccessor.GetCreature(me, orphanGUID); + if (orphan == null) + { + Reset(); + return; + } + + working = true; + + _scheduler.Schedule(TimeSpan.FromSeconds(0), _ => + { + orphan.GetMotionMaster().MovePoint(0, me.GetPositionX() + MathF.Cos(me.GetOrientation()) * 5, me.GetPositionY() + MathF.Sin(me.GetOrientation()) * 5, me.GetPositionZ()); + orphan.GetAI().Talk(TextIds.OracleOrphan1); + }); + + _scheduler.Schedule(TimeSpan.FromSeconds(3), _ => + { + orphan.SetFacingToObject(me); + Talk(TextIds.WinterfinPlaymate1); + me.HandleEmoteCommand(Emote.StateDance); + }); + + _scheduler.Schedule(TimeSpan.FromSeconds(6), _ => orphan.GetAI().Talk(TextIds.OracleOrphan2)); + + _scheduler.Schedule(TimeSpan.FromSeconds(9), _ => Talk(TextIds.WinterfinPlaymate2)); + + _scheduler.Schedule(TimeSpan.FromSeconds(14), _ => + { + orphan.GetAI().Talk(TextIds.OracleOrphan3); + me.HandleEmoteCommand(Emote.StateNone); + player.GroupEventHappens(QuestIds.PlaymateOracle, me); + orphan.GetMotionMaster().MoveFollow(player, SharedConst.PetFollowDist, SharedConst.PetFollowAngle); + Reset(); + }); + } + } + } + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + } + + class npc_snowfall_glade_playmate : ScriptedAI + { + bool working; + ObjectGuid orphanGUID; + + public npc_snowfall_glade_playmate(Creature creature) : base(creature) + { + Initialize(); + } + + void Initialize() + { + working = false; + orphanGUID.Clear(); + } + + public override void Reset() + { + Initialize(); + } + + public override void MoveInLineOfSight(Unit who) + { + if (!working && who != null && who.GetDistance2d(me) < 10.0f) + { + Player player = who.ToPlayer(); + if (player == null) + { + Reset(); + return; + } + + if (player.GetQuestStatus(QuestIds.PlaymateWolvar) == QuestStatus.Incomplete) + { + orphanGUID = Misc.GetOrphanGUID(player, CreatureIds.OrphanWolvar); + if (!orphanGUID.IsEmpty()) + { + Creature orphan = ObjectAccessor.GetCreature(me, orphanGUID); + if (orphan == null) + { + Reset(); + return; + } + + working = true; + + _scheduler.Schedule(TimeSpan.FromSeconds(0), _ => + { + orphan.GetMotionMaster().MovePoint(0, me.GetPositionX() + MathF.Cos(me.GetOrientation()) * 5, me.GetPositionY() + MathF.Sin(me.GetOrientation()) * 5, me.GetPositionZ()); + orphan.GetAI().Talk(TextIds.WolvarOrphan1); + }); + + _scheduler.Schedule(TimeSpan.FromSeconds(5), _ => + { + orphan.SetFacingToObject(me); + Talk(TextIds.SnowfallGladePlaymate1); + DoCast(orphan, Misc.SpellSnowball); + }); + + _scheduler.Schedule(TimeSpan.FromSeconds(10), _ => Talk(TextIds.SnowfallGladePlaymate2)); + + _scheduler.Schedule(TimeSpan.FromSeconds(15), _ => + { + orphan.GetAI().Talk(TextIds.WolvarOrphan2); + orphan.CastSpell(me, Misc.SpellSnowball); + }); + + _scheduler.Schedule(TimeSpan.FromSeconds(20), _ => + { + orphan.GetAI().Talk(TextIds.WolvarOrphan3); + player.GroupEventHappens(QuestIds.PlaymateWolvar, me); + orphan.GetMotionMaster().MoveFollow(player, SharedConst.PetFollowDist, SharedConst.PetFollowAngle); + Reset(); + }); + } + } + } + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + } + + class npc_the_biggest_tree : ScriptedAI + { + bool working; + ObjectGuid orphanGUID; + + public npc_the_biggest_tree(Creature creature) : base(creature) + { + Initialize(); + me.SetDisplayId(Misc.DisplayInvisible); + } + + void Initialize() + { + working = false; + orphanGUID.Clear(); + } + + public override void Reset() + { + Initialize(); + } + + public override void MoveInLineOfSight(Unit who) + { + if (!working && who != null && who.GetDistance2d(me) < 10.0f) + { + Player player = who.ToPlayer(); + if (player == null) + { + Reset(); + return; + } + + if (player.GetQuestStatus(QuestIds.TheBiggestTreeEver) == QuestStatus.Incomplete) + { + orphanGUID = Misc.GetOrphanGUID(player, CreatureIds.OrphanOracle); + if (!orphanGUID.IsEmpty()) + { + Creature orphan = ObjectAccessor.GetCreature(me, orphanGUID); + if (orphan == null) + { + Reset(); + return; + } + + working = true; + + _scheduler.Schedule(TimeSpan.FromSeconds(0), _ => orphan.GetMotionMaster().MovePoint(0, me.GetPositionX() + MathF.Cos(me.GetOrientation()) * 5, me.GetPositionY() + MathF.Sin(me.GetOrientation()) * 5, me.GetPositionZ())); + + _scheduler.Schedule(TimeSpan.FromSeconds(2), _ => + { + orphan.SetFacingToObject(me); + orphan.GetAI().Talk(TextIds.OracleOrphan4); + }); + + _scheduler.Schedule(TimeSpan.FromSeconds(7), _ => + { + player.GroupEventHappens(QuestIds.TheBiggestTreeEver, me); + orphan.GetMotionMaster().MoveFollow(player, SharedConst.PetFollowDist, SharedConst.PetFollowAngle); + Reset(); + }); + } + } + } + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + } + + class npc_high_oracle_soo_roo : ScriptedAI + { + bool working; + ObjectGuid orphanGUID; + + public npc_high_oracle_soo_roo(Creature creature) : base(creature) + { + Initialize(); + } + + void Initialize() + { + working = false; + orphanGUID.Clear(); + } + + public override void Reset() + { + Initialize(); + } + + public override void MoveInLineOfSight(Unit who) + { + if (!working && who != null && who.GetDistance2d(me) < 10.0f) + { + Player player = who.ToPlayer(); + if (player == null) + { + Reset(); + return; + } + + if (player.GetQuestStatus(QuestIds.TheBronzeDragonshrineOracle) == QuestStatus.Incomplete) + { + orphanGUID = Misc.GetOrphanGUID(player, CreatureIds.OrphanOracle); + if (!orphanGUID.IsEmpty()) + { + Creature orphan = ObjectAccessor.GetCreature(me, orphanGUID); + if (orphan == null) + { + Reset(); + return; + } + + working = true; + + _scheduler.Schedule(TimeSpan.FromSeconds(0), _ => + { + orphan.GetMotionMaster().MovePoint(0, me.GetPositionX() + MathF.Cos(me.GetOrientation()) * 5, me.GetPositionY() + MathF.Sin(me.GetOrientation()) * 5, me.GetPositionZ()); + orphan.GetAI().Talk(TextIds.OracleOrphan5); + }); + + _scheduler.Schedule(TimeSpan.FromSeconds(3), _ => + { + orphan.SetFacingToObject(me); + Talk(TextIds.SooRoo1); + }); + + _scheduler.Schedule(TimeSpan.FromSeconds(9), _ => + { + orphan.GetAI().Talk(TextIds.OracleOrphan6); + player.GroupEventHappens(QuestIds.TheBronzeDragonshrineOracle, me); + orphan.GetMotionMaster().MoveFollow(player, SharedConst.PetFollowDist, SharedConst.PetFollowAngle); + Reset(); + }); + } + } + } + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + } + + class npc_elder_kekek : ScriptedAI + { + bool working; + ObjectGuid orphanGUID; + + public npc_elder_kekek(Creature creature) : base(creature) + { + Initialize(); + } + + void Initialize() + { + working = false; + orphanGUID.Clear(); + } + + public override void Reset() + { + Initialize(); + } + + public override void MoveInLineOfSight(Unit who) + { + if (!working && who != null && who.GetDistance2d(me) < 10.0f) + { + Player player = who.ToPlayer(); + if (player == null) + { + Reset(); + return; + } + + if (player.GetQuestStatus(QuestIds.TheBronzeDragonshrineWolvar) == QuestStatus.Incomplete) + { + orphanGUID = Misc.GetOrphanGUID(player, CreatureIds.OrphanWolvar); + if (!orphanGUID.IsEmpty()) + { + Creature orphan = ObjectAccessor.GetCreature(me, orphanGUID); + if (orphan == null) + { + Reset(); + return; + } + + working = true; + + _scheduler.Schedule(TimeSpan.FromSeconds(0), _ => + { + orphan.GetMotionMaster().MovePoint(0, me.GetPositionX() + MathF.Cos(me.GetOrientation()) * 5, me.GetPositionY() + MathF.Sin(me.GetOrientation()) * 5, me.GetPositionZ()); + orphan.GetAI().Talk(TextIds.WolvarOrphan4); + }); + + _scheduler.Schedule(TimeSpan.FromSeconds(3), _ => Talk(TextIds.ElderKekek1)); + + _scheduler.Schedule(TimeSpan.FromSeconds(9), _ => + { + orphan.GetAI().Talk(TextIds.WolvarOrphan5); + player.GroupEventHappens(QuestIds.TheBronzeDragonshrineWolvar, me); + orphan.GetMotionMaster().MoveFollow(player, SharedConst.PetFollowDist, SharedConst.PetFollowAngle); + Reset(); + }); + } + } + } + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + } + + class npc_the_etymidian : ScriptedAI + { + const uint SayActivation = 0; + const uint QuestTheActivationRune = 12547; + + bool working; + ObjectGuid orphanGUID; + + public npc_the_etymidian(Creature creature) : base(creature) + { + Initialize(); + } + + void Initialize() + { + working = false; + orphanGUID.Clear(); + } + + public override void Reset() + { + Initialize(); + } + + public override void OnQuestReward(Player player, Quest quest, LootItemType type, uint opt) + { + if (quest.Id != QuestTheActivationRune) + return; + + Talk(SayActivation); + } + + // doesn't trigger if creature is stunned. Restore aura 25900 when it will be possible or + // find another way to start event(from orphan script) + public override void MoveInLineOfSight(Unit who) + { + if (!working && who != null && who.GetDistance2d(me) < 10.0f) + { + Player player = who.ToPlayer(); + if (player == null) + { + Reset(); + return; + } + + if (player.GetQuestStatus(QuestIds.MeetingAGreatOne) == QuestStatus.Incomplete) + { + orphanGUID = Misc.GetOrphanGUID(player, CreatureIds.OrphanOracle); + if (!orphanGUID.IsEmpty()) + { + Creature orphan = ObjectAccessor.GetCreature(me, orphanGUID); + if (orphan == null) + { + Reset(); + return; + } + + working = true; + + _scheduler.Schedule(TimeSpan.FromSeconds(0), _ => + { + orphan.GetMotionMaster().MovePoint(0, me.GetPositionX() + MathF.Cos(me.GetOrientation()) * 5, me.GetPositionY() + MathF.Sin(me.GetOrientation()) * 5, me.GetPositionZ()); + orphan.GetAI().Talk(TextIds.OracleOrphan7); + }); + + _scheduler.Schedule(TimeSpan.FromSeconds(5), _ => + { + orphan.SetFacingToObject(me); + orphan.GetAI().Talk(TextIds.OracleOrphan8); + }); + + _scheduler.Schedule(TimeSpan.FromSeconds(10), _ => orphan.GetAI().Talk(TextIds.OracleOrphan9)); + + _scheduler.Schedule(TimeSpan.FromSeconds(15), _ => orphan.GetAI().Talk(TextIds.OracleOrphan10)); + + _scheduler.Schedule(TimeSpan.FromSeconds(20), _ => + { + orphan.GetMotionMaster().MoveFollow(player, SharedConst.PetFollowDist, SharedConst.PetFollowAngle); + player.GroupEventHappens(QuestIds.MeetingAGreatOne, me); + Reset(); + }); + } + } + + } + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + } + + class npc_alexstraza_the_lifebinder : ScriptedAI + { + bool working; + ObjectGuid orphanGUID; + + public npc_alexstraza_the_lifebinder(Creature creature) : base(creature) + { + Initialize(); + } + + void Initialize() + { + working = false; + orphanGUID.Clear(); + } + + public override void Reset() + { + Initialize(); + } + + public override void SetData(uint type, uint data) + { + // Existing SmartAI + if (type == 0) + { + switch (data) + { + case 1: + me.SetOrientation(1.6049f); + break; + case 2: + me.SetOrientation(me.GetHomePosition().GetOrientation()); + break; + } + } + } + + public override void MoveInLineOfSight(Unit who) + { + if (!working && who != null && who.GetDistance2d(me) < 10.0f) + { + Player player = who.ToPlayer(); + if (player == null) + { + Reset(); + return; + } + + if (player.GetQuestStatus(QuestIds.TheDragonQueenOracle) == QuestStatus.Incomplete) + { + orphanGUID = Misc.GetOrphanGUID(player, CreatureIds.OrphanOracle); + if (!orphanGUID.IsEmpty()) + { + Creature orphan = ObjectAccessor.GetCreature(me, orphanGUID); + if (orphan == null) + { + Reset(); + return; + } + + working = true; + + _scheduler.Schedule(TimeSpan.FromSeconds(0), _ => + { + orphan.GetMotionMaster().MovePoint(0, me.GetPositionX() + MathF.Cos(me.GetOrientation()) * 5, me.GetPositionY() + MathF.Sin(me.GetOrientation()) * 5, me.GetPositionZ()); + orphan.GetAI().Talk(TextIds.OracleOrphan11); + }); + + _scheduler.Schedule(TimeSpan.FromSeconds(5), _ => + { + orphan.SetFacingToObject(me); + orphan.GetAI().Talk(TextIds.OracleOrphan12); + }); + + _scheduler.Schedule(TimeSpan.FromSeconds(10), _ => orphan.GetAI().Talk(TextIds.OracleOrphan13)); + + _scheduler.Schedule(TimeSpan.FromSeconds(15), _ => + { + Talk(TextIds.Alexstrasza2); + me.SetStandState(UnitStandStateType.Kneel); + me.SetFacingToObject(orphan); + }); + + _scheduler.Schedule(TimeSpan.FromSeconds(20), _ => orphan.GetAI().Talk(TextIds.OracleOrphan14)); + + _scheduler.Schedule(TimeSpan.FromSeconds(25), _ => + { + me.SetStandState(UnitStandStateType.Stand); + me.SetOrientation(me.GetHomePosition().GetOrientation()); + player.GroupEventHappens(QuestIds.TheDragonQueenOracle, me); + orphan.GetMotionMaster().MoveFollow(player, SharedConst.PetFollowDist, SharedConst.PetFollowAngle); + Reset(); + return; + }); + } + } + else if (player.GetQuestStatus(QuestIds.TheDragonQueenWolvar) == QuestStatus.Incomplete) + { + orphanGUID = Misc.GetOrphanGUID(player, CreatureIds.OrphanWolvar); + if (!orphanGUID.IsEmpty()) + { + Creature orphan = ObjectAccessor.GetCreature(me, orphanGUID); + if (orphan == null) + { + Reset(); + return; + } + + working = true; + + _scheduler.Schedule(TimeSpan.FromSeconds(0), _ => + { + orphan.GetMotionMaster().MovePoint(0, me.GetPositionX() + MathF.Cos(me.GetOrientation()) * 5, me.GetPositionY() + MathF.Sin(me.GetOrientation()) * 5, me.GetPositionZ()); + orphan.GetAI().Talk(TextIds.WolvarOrphan11); + }); + + _scheduler.Schedule(TimeSpan.FromSeconds(5), _ => + { + Creature krasus = me.FindNearestCreature(CreatureIds.Krasus, 10.0f); + if (krasus != null) + { + orphan.SetFacingToObject(krasus); + krasus.GetAI().Talk(TextIds.Krasus8); + } + }); + + _scheduler.Schedule(TimeSpan.FromSeconds(10), _ => orphan.GetAI().Talk(TextIds.WolvarOrphan12)); + + _scheduler.Schedule(TimeSpan.FromSeconds(15), _ => + { + orphan.SetFacingToObject(me); + Talk(TextIds.Alexstrasza2); + }); + + _scheduler.Schedule(TimeSpan.FromSeconds(20), _ => orphan.GetAI().Talk(TextIds.WolvarOrphan13)); + + _scheduler.Schedule(TimeSpan.FromSeconds(25), _ => + { + player.GroupEventHappens(QuestIds.TheDragonQueenWolvar, me); + orphan.GetMotionMaster().MoveFollow(player, SharedConst.PetFollowDist, SharedConst.PetFollowAngle); + Reset(); + return; + }); + } + } + } + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + } + + class at_bring_your_orphan_to : AreaTriggerScript + { + public at_bring_your_orphan_to() : base("at_bring_your_orphan_to") { } + + public override bool OnTrigger(Player player, AreaTriggerRecord trigger) + { + if (player.IsDead() || !player.HasAura(Misc.SpellOrphanOut)) + return false; + + uint questId = 0; + uint orphanId = 0; + + switch (trigger.Id) + { + case AreatriggerIds.DownAtTheDocks: + questId = QuestIds.DownAtTheDocks; + orphanId = CreatureIds.OrphanOrcish; + break; + case AreatriggerIds.GatewayToTheFrontier: + questId = QuestIds.GatewayToTheFrontier; + orphanId = CreatureIds.OrphanOrcish; + break; + case AreatriggerIds.LordaeronThroneRoom: + questId = QuestIds.LordaeronThroneRoom; + orphanId = CreatureIds.OrphanOrcish; + break; + case AreatriggerIds.BoughtOfEternals: + questId = QuestIds.BoughtOfEternals; + orphanId = CreatureIds.OrphanHuman; + break; + case AreatriggerIds.SpookyLighthouse: + questId = QuestIds.SpookyLighthouse; + orphanId = CreatureIds.OrphanHuman; + break; + case AreatriggerIds.StonewroughtDam: + questId = QuestIds.StonewroughtDam; + orphanId = CreatureIds.OrphanHuman; + break; + case AreatriggerIds.DarkPortal: + questId = player.GetTeam() == Team.Alliance ? QuestIds.DarkPortalA : QuestIds.DarkPortalH; + orphanId = player.GetTeam() == Team.Alliance ? CreatureIds.OrphanDraenei : CreatureIds.OrphanBloodElf; + break; + } + + if (questId != 0 && orphanId != 0 && !Misc.GetOrphanGUID(player, orphanId).IsEmpty() && player.GetQuestStatus(questId) == QuestStatus.Incomplete) + player.AreaExploredOrEventHappens(questId); + + return true; + } + } + + class npc_cw_area_trigger : ScriptedAI + { + public npc_cw_area_trigger(Creature creature) : base(creature) + { + me.SetDisplayId(Misc.DisplayInvisible); + } + + public override void MoveInLineOfSight(Unit who) + { + if (who != null && me.GetDistance2d(who) < 20.0f) + { + Player player = who.ToPlayer(); + if (player != null && player.HasAura(Misc.SpellOrphanOut)) + { + uint questId = 0; + uint orphanId = 0; + switch (me.GetEntry()) + { + case CreatureIds.CavernsOfTimeCwTrigger: + questId = player.GetTeam() == Team.Alliance ? QuestIds.TimeToVisitTheCavernsA : QuestIds.TimeToVisitTheCavernsH; + orphanId = player.GetTeam() == Team.Alliance ? CreatureIds.OrphanDraenei : CreatureIds.OrphanBloodElf; + break; + case CreatureIds.Exodar01CwTrigger: + questId = QuestIds.TheSeatOfTheNaruu; + orphanId = CreatureIds.OrphanDraenei; + break; + case CreatureIds.Exodar02CwTrigger: + questId = QuestIds.CallOnTheFarseer; + orphanId = CreatureIds.OrphanDraenei; + break; + case CreatureIds.AerisLandingCwTrigger: + questId = QuestIds.JheelIsAtAerisLanding; + orphanId = CreatureIds.OrphanDraenei; + break; + case CreatureIds.AuchindounCwTrigger: + questId = QuestIds.AuchindounAndTheRing; + orphanId = CreatureIds.OrphanDraenei; + break; + case CreatureIds.SporeggarCwTrigger: + questId = QuestIds.HchuuAndTheMushroomPeople; + orphanId = CreatureIds.OrphanBloodElf; + break; + case CreatureIds.ThroneOfElementsCwTrigger: + questId = QuestIds.VisitTheThroneOfElements; + orphanId = CreatureIds.OrphanBloodElf; + break; + case CreatureIds.Silvermoon01CwTrigger: + if (player.GetQuestStatus(QuestIds.NowWhenIGrowUp) == QuestStatus.Incomplete && !Misc.GetOrphanGUID(player, CreatureIds.OrphanBloodElf).IsEmpty()) + { + player.AreaExploredOrEventHappens(QuestIds.NowWhenIGrowUp); + if (player.GetQuestStatus(QuestIds.NowWhenIGrowUp) == QuestStatus.Complete) + { + Creature samuro = me.FindNearestCreature(25151, 20.0f); + if (samuro != null) + samuro.HandleEmoteCommand(RandomHelper.RAND(Emote.OneshotWave, Emote.OneshotRoar, Emote.OneshotFlex, Emote.OneshotSalute, Emote.OneshotDance)); + } + } + break; + } + if (questId != 0 && orphanId != 0 && !Misc.GetOrphanGUID(player, orphanId).IsEmpty() && player.GetQuestStatus(questId) == QuestStatus.Incomplete) + player.AreaExploredOrEventHappens(questId); + } + + } + } + } + + class npc_grizzlemaw_cw_trigger : ScriptedAI + { + public npc_grizzlemaw_cw_trigger(Creature creature) : base(creature) + { + me.SetDisplayId(Misc.DisplayInvisible); + } + + public override void MoveInLineOfSight(Unit who) + { + if (who != null && who.GetDistance2d(me) < 10.0f) + { + Player player = who.ToPlayer(); + if (player != null) + { + if (player.GetQuestStatus(QuestIds.HomeOfTheBearMen) == QuestStatus.Incomplete) + { + Creature orphan = ObjectAccessor.GetCreature(me, Misc.GetOrphanGUID(player, CreatureIds.OrphanWolvar)); + if (orphan != null) + { + player.AreaExploredOrEventHappens(QuestIds.HomeOfTheBearMen); + orphan.GetAI().Talk(TextIds.WolvarOrphan10); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Source/Scripts/Events/DarkmoonFaire.cs b/Source/Scripts/Events/DarkmoonFaire.cs new file mode 100644 index 000000000..a8c31e047 --- /dev/null +++ b/Source/Scripts/Events/DarkmoonFaire.cs @@ -0,0 +1,126 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using Game.AI; +using Game.DataStorage; +using Game.Entities; +using Game.Scripting; +using System; + +namespace Scripts.Events.DarkmoonFaire +{ + struct GossipIds + { + public const uint MenuSelinaPois = 13076; + public const uint MenuSelinaItem = 13113; + + public const uint MenuOptionTonkArenaPoi = 0; + public const uint MenuOptionCannonPoi = 1; + public const uint MenuOptionWhackAGnollPoi = 2; + public const uint MenuOptionRingTossPoi = 3; + public const uint MenuOptionShootingGalleryPoi = 4; + public const uint MenuOptionFortuneTellerPoi = 5; + } + + struct PoiIds + { + public const uint WhackAGnoll = 2716; + public const uint Cannon = 2717; + public const uint ShootingGallery = 2718; + public const uint TonkArena = 2719; + public const uint FortuneTeller = 2720; + public const uint RingToss = 2721; + } + + [Script] // 10445 - Selina Dourman + class npc_selina_dourman : ScriptedAI + { + const uint SpellReplaceDarkmoonAdventuresGuide = 103413; + const uint SayWelcome = 0; + + bool _talkCooldown; + + public npc_selina_dourman(Creature creature) : base(creature) { } + + public override bool OnGossipSelect(Player player, uint menuId, uint gossipListId) + { + switch (menuId) + { + case GossipIds.MenuSelinaPois: + { + uint poiId = 0; + switch (gossipListId) + { + case GossipIds.MenuOptionTonkArenaPoi: + poiId = PoiIds.TonkArena; + break; + case GossipIds.MenuOptionCannonPoi: + poiId = PoiIds.Cannon; + break; + case GossipIds.MenuOptionWhackAGnollPoi: + poiId = PoiIds.WhackAGnoll; + break; + case GossipIds.MenuOptionRingTossPoi: + poiId = PoiIds.RingToss; + break; + case GossipIds.MenuOptionShootingGalleryPoi: + poiId = PoiIds.ShootingGallery; + break; + case GossipIds.MenuOptionFortuneTellerPoi: + poiId = PoiIds.FortuneTeller; + break; + default: + break; + } + if (poiId != 0) + player.PlayerTalkClass.SendPointOfInterest(poiId); + break; + } + case GossipIds.MenuSelinaItem: + me.CastSpell(player, SpellReplaceDarkmoonAdventuresGuide); + player.CloseGossipMenu(); + break; + default: + break; + } + + return false; + } + + public void DoWelcomeTalk(Unit talkTarget) + { + if (talkTarget == null || _talkCooldown) + return; + + _talkCooldown = true; + _scheduler.Schedule(TimeSpan.FromSeconds(30), _ => _talkCooldown = false); + Talk(SayWelcome, talkTarget); + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + } + + [Script] // 7016 - Darkmoon Faire Entrance + class at_darkmoon_faire_entrance : AreaTriggerScript + { + const uint NpcSelinaDourman = 10445; + + public at_darkmoon_faire_entrance() : base("at_darkmoon_faire_entrance") { } + + public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger) + { + Creature selinaDourman = player.FindNearestCreature(NpcSelinaDourman, 50.0f); + if (selinaDourman != null) + { + npc_selina_dourman selinaDourmanAI = selinaDourman.GetAI(); + if (selinaDourmanAI != null) + selinaDourmanAI.DoWelcomeTalk(player); + } + + return true; + } + } +} \ No newline at end of file diff --git a/Source/Scripts/Events/FireworksShow.cs b/Source/Scripts/Events/FireworksShow.cs new file mode 100644 index 000000000..48205553e --- /dev/null +++ b/Source/Scripts/Events/FireworksShow.cs @@ -0,0 +1,865 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using Framework.Constants; +using Game.AI; +using Game.Entities; +using Game.Scripting; +using System; +using System.Collections.Generic; +using System.Numerics; +using static Global; + +namespace Scripts.Events.FireworksShow +{ + enum ObjectIds + { + FireworkShowType1Red = 180703, + FireworkShowType2Red = 180704, + FireworkShowType1RedBig = 180707, + FireworkShowType2RedBig = 180708, + FireworkShowType1Blue = 180720, + FireworkShowType2Blue = 180721, + FireworkShowType1BlueBig = 180722, + FireworkShowType2BlueBig = 180723, + FireworkShowType1Green = 180724, + FireworkShowType2GreenBig = 180725, + FireworkShowType1GreenBig = 180726, + FireworkShowType2Green = 180727, + FireworkShowType1White = 180728, + FireworkShowType1WhiteBig = 180729, + FireworkShowType2White = 180730, + FireworkShowType2WhiteBig = 180731, + FireworkShowType1Yellow = 180736, + FireworkShowType1YellowBig = 180737, + FireworkShowType2Yellow = 180738, + FireworkShowType2YellowBig = 180739, + FireworkShowType2Purple = 180740, + FireworkShowType1PurpleBig = 180741, + FireworkShowType2PurpleBig = 180733 + } + + enum ZoneIds + { + StranglethornVale = 33, // Booty bay + EversongWoods = 3430, // Silvermoon + Orgrimmar = 1637, + Durotar = 14, // Orgrimmar + Undercity = 1497, + TirisfalGlades = 85, // Undercity + Teldrassil = 141, // Darnassus + Exodar = 3557, + Thunderbluff = 1638, + DunMorogh = 1, // Ironforge + Ironforge = 1537, + Stormwind = 1519 + } + + struct MiscConst + { + public const uint SoundCheer1 = 8574; + public const uint SoundCheer2 = 8573; + public const uint SoundCheer3 = 8572; + public const uint SoundCheer4 = 8571; + public const uint EventCheer = 1; + public const uint EventFire = 2; + public const ushort GameEventNewYear = 6; + + static Position[] BootyBayPos = + { + new(-14358.03f, 515.058f, 34.2664f, 3.68265f), + new(-14357.49f, 490.8445f, 39.47329f, 0.9773831f), + new(-14355.49f, 518.5656f, 35.36923f, 4.76475f), + new(-14353.66f, 485.8341f, 36.86639f, 4.886924f), + new(-14376.54f, 487.5282f, 44.47044f, 5.899214f), + new(-14376.66f, 516.6852f, 38.5385f, 2.199115f), + new(-14382.42f, 516.2576f, 37.59617f, 5.846854f), + new(-14389.55f, 485.7437f, 36.32653f, 6.0912f), + new(-14376.76f, 507.9842f, 59.56532f, 0.9773831f), + new(-14358.97f, 502.0223f, 43.82631f, 2.199115f), + new(-14370.77f, 487.4859f, 45.46445f, 4.886924f), + new(-14379.15f, 507.237f, 43.95641f, 6.0912f), + new(-14363.28f, 506.7344f, 41.27156f, 5.899214f), + new(-14374.43f, 496.0701f, 31.31265f, 4.76475f), + new(-14360.71f, 493.6036f, 32.06157f, 5.846854f), + new(-14354.37f, 491.8791f, 39.83374f, 3.68265f), + new(-14371.19f, 505.8404f, 28.75178f, 6.0912f), + new(-14356.57f, 494.1887f, 39.58786f, 3.68265f), + new(-14380.02f, 506.3313f, 59.75512f, 6.0912f), + new(-14389.84f, 503.4612f, 37.37088f, 5.899214f), + new(-14353.64f, 485.4063f, 34.11704f, 4.76475f), + new(-14359.63f, 522.2571f, 31.2866f, 2.199115f), + new(-14374.91f, 491.508f, 40.34925f, 4.886924f), + new(-14351.33f, 506.1898f, 28.69684f, 5.846854f), + new(-14378.1f, 473.5608f, 40.16786f, 0.9773831f) + }; + + static Position[] StormwindPos = + { + new(-8823.592f, 470.316f, 179.2295f, 1.239183f), + new(-8883.005f, 590.1927f, 163.1264f, 0.9773831f), + new(-8919.692f, 482.9097f, 185.6471f, 3.735006f), + new(-8907.228f, 551.7864f, 188.68f, 4.729844f), + new(-8979.651f, 639.3976f, 184.4983f, 3.961899f), + new(-8878.851f, 583.1771f, 166.3018f, 3.700105f), + new(-8937.466f, 517.0521f, 183.7207f, 3.68265f), + new(-8919.247f, 562.2882f, 176.1023f, 3.630291f), + new(-8866.37f, 576.0504f, 157.8798f, 3.47321f), + new(-8957.122f, 517.7014f, 161.3226f, 3.630291f), + new(-8957.857f, 521.934f, 158.9058f, 4.729844f), + new(-8851.988f, 486.5625f, 179.6635f, 4.258607f), + new(-8972.651f, 531.0799f, 176.6744f, 4.886924f), + new(-8986.207f, 560.9792f, 179.1758f, 5.550147f), + new(-8848.866f, 488.8281f, 184.9777f, 3.961899f), + new(-8946.897f, 521.3976f, 193.4021f, 0.9424766f), + new(-8876.854f, 593.6771f, 171.0399f, 0.1396245f), + new(-8828.743f, 463.0382f, 195.7672f, 0.9424766f), + new(-8968.125f, 525.1285f, 181.9304f, 3.054327f), + new(-8952.893f, 629.2743f, 188.2722f, 0.9424766f), + new(-8882.172f, 574.4219f, 181.7124f, 6.0912f), + new(-8980.363f, 546.7934f, 180.4686f, 4.66003f), + new(-8874.944f, 575.5f, 175.7746f, 0.9075702f), + new(-8945.109f, 496.3715f, 153.2825f, 6.073746f), + new(-8953.094f, 513.5521f, 180.9165f, 3.735006f), + new(-8955.02f, 623.7621f, 193.7679f, 0.9424766f), + new(-8977.524f, 644.9097f, 197.926f, 3.961899f), + new(-8985.639f, 653.9809f, 200.0452f, 3.630291f), + new(-8985.639f, 653.9809f, 200.0452f, 3.630291f), + new(-8849.723f, 624.1337f, 144.0357f, 0.8552105f), + new(-8938.404f, 511.8854f, 179.5132f, 0.4712385f), + new(-8815.946f, 571.0833f, 166.8412f, 0.8552105f), + new(-8968.125f, 525.1285f, 180.6735f, 3.054327f), + new(-8887.63f, 582.0261f, 180.219f, 3.787367f), + new(-8962.538f, 541.4132f, 169.8063f, 0.6283169f), + new(-8854.854f, 503.4115f, 194.6336f, 3.630291f), + new(-8810.004f, 589.0504f, 150.2928f, 0.8552105f), + new(-8921.13f, 570.2153f, 186.4456f, 3.857183f), + new(-8957.076f, 538.8073f, 165.0997f, 0.5235979f), + new(-8954.139f, 507.5695f, 178.861f, 3.595379f), + new(-8817.174f, 577.4948f, 152.5639f, 0.8552105f), + new(-8808.778f, 582.6389f, 158.5705f, 0.8552105f), + new(-8898.136f, 566.4236f, 186.5282f, 6.0912f), + new(-8877.205f, 598.0347f, 164.5646f, 0.1396245f), + new(-8815.911f, 460.2049f, 179.4585f, 3.926996f), + new(-8836.877f, 574.1649f, 168.0506f, 0.8552105f), + new(-8883.005f, 590.1927f, 157.0154f, 0.9773831f), + new(-8942.71f, 561.3316f, 198.328f, 3.630291f), + new(-8949.616f, 617.007f, 197.4469f, 3.630291f), + new(-8939.357f, 507.9288f, 155.7625f, 0.6457717f), + new(-8976.667f, 558.6233f, 170.7597f, 5.550147f), + new(-8871.924f, 609.7327f, 151.6364f, 0.8552105f), + new(-8829.264f, 551.5052f, 137.5144f, 0.8552105f), + new(-8859.802f, 567.184f, 162.9909f, 3.47321f), + new(-8864.504f, 604.0816f, 144.7161f, 0.8552105f), + new(-8854.042f, 616.0121f, 146.4188f, 0.8552105f), + new(-8839.778f, 576.8004f, 163.2873f, 0.8552105f), + new(-8863.049f, 497.7986f, 179.2041f, 3.926996f), + new(-8951.743f, 611.4948f, 185.3027f, 3.630291f), + new(-8976.063f, 535.0504f, 178.1283f, 4.66003f), + new(-8937.466f, 517.0521f, 170.561f, 3.68265f), + new(-8940.363f, 490.4288f, 180.8207f, 3.996807f), + new(-8838.177f, 541.6476f, 168.6789f, 0.8552105f), + new(-8825.467f, 450.7708f, 196.6236f, 3.630291f), + new(-8878.851f, 583.1771f, 165.5726f, 3.700105f), + new(-8822.146f, 557.2292f, 147.8244f, 0.8552105f), + new(-8953.243f, 523.8958f, 158.0031f, 3.630291f), + new(-8983.514f, 659.493f, 198.6248f, 3.630291f), + new(-8939.941f, 499.6163f, 158.6714f, 3.944446f), + new(-8925.567f, 542.2158f, 116.1619f, 6.0912f), + new(-8964.125f, 634.6736f, 182.0301f, 0.6283169f), + new(-8930.696f, 491.8021f, 185.6471f, 3.944446f), + new(-8882.172f, 574.4219f, 165.4764f, 6.0912f), + new(-8943.316f, 516.0191f, 155.9438f, 5.846854f), + new(-8871.973f, 589.2795f, 159.1132f, 0.4712385f), + new(-8883.328f, 579.6736f, 172.1912f, 0.6283169f), + new(-8961.998f, 640.1858f, 188.2798f, 0.6283169f), + new(-8912.467f, 506.625f, 175.9382f, 5.846854f), + new(-8843.524f, 481.7865f, 179.664f, 0.9250238f), + new(-8964.986f, 535.2136f, 163.4313f, 4.886924f), + new(-8833.341f, 484.1042f, 192.8578f, 0.6283169f), + new(-8861.382f, 574.7413f, 162.1575f, 3.47321f), + new(-8973.627f, 631.7726f, 192.3904f, 0.6283169f), + new(-8878.851f, 583.1771f, 166.149f, 3.700105f), + new(-8842.842f, 481.2031f, 204.4827f, 0.6283169f), + new(-8902.143f, 527.5035f, 187.1883f, 3.630291f), + new(-8956.248f, 514.2257f, 161.3226f, 3.630291f), + new(-8835.826f, 488.0764f, 179.2099f, 0.9250238f), + new(-8961.319f, 533.3333f, 162.5372f, 3.961899f), + new(-8947.649f, 516.0955f, 163.2207f, 3.68265f), + new(-8949.186f, 504.1337f, 180.9165f, 3.804818f), + new(-8945.564f, 511.5156f, 164.3801f, 5.899214f), + new(-8969.266f, 543.882f, 180.4686f, 4.66003f), + new(-8874.156f, 586.6302f, 161.5547f, 0.9773831f), + new(-8919.748f, 552.2986f, 176.0453f, 3.996807f), + new(-8971.5f, 637.2847f, 197.926f, 0.6283169f), + new(-8965.389f, 525.8906f, 170.2664f, 2.199115f), + new(-8885.1768f, 584.675781f, 141.623886f, 0.62527f), + new(-8880.427734f, 576.678406f, 141.62886f, 0.69819f), + new(-8873.7005f, 570.2418f, 139.33889f, 0.762973f), + new(-8888.692383f, 571.265015f, 120.36886f, 0.601966f), + new(-8870.9571f, 575.9952f, 120.811226f, 0.880780f), + new(-8875.3905f, 582.87028f, 120.81226f, 0.76898f), + new(-8887.0238f, 594.304871f, 120.81226f, 0.700139f), + new(-8887.0238f, 594.3041f, 132.571243f, 5.30658f), + new(-8874.3430f, 584.368164f, 131.409271f, 5.428242f), + new(-8856.23049f, 573.789795f, 131.861237f, 5.707060f), + new(-8881.462891f, 592.391418f, 108.883751f, 0.464518f), + new(-8871.443359f, 582.234802f, 107.030724f, 0.562685f), + new(-8884.809570f, 576.020081f, 100.489868f, 0.621592f), + new(-8871.830078f, 585.984314f, 100.492371f, 0.696206f), + new(-8871.830078f, 585.984314f, 119.252373f, 0.700133f), + new(-8875.578125f, 563.403931f, 104.059372f, 4.521095f), + new(-8896.128906f, 584.406311f, 107.437462f, 2.922810f), + new(-8873.742188f, 599.873718f, 107.512787f, 3.001356f), + new(-8885.817383f, 586.529175f, 98.614265f, 0.437024f), + new(-8872.734375f, 573.338440f, 97.723770f, 1.831103f) + }; + + static Position[] OrgrimmarPos = + { + new(1609.075f, -4383.707f, 90.23414f, 0.3665176f), + new(1469.648f, -4371.285f, 113.8313f, 6.073746f), + new(1391.792f, -4371.0f, 165.0406f, 3.630291f), + new(1405.918f, -4504.896f, 123.1683f, 3.700105f), + new(1610.016f, -4386.493f, 82.81187f, 3.909541f), + new(1523.767f, -4385.934f, 100.7948f, 4.572764f), + new(1486.345f, -4493.087f, 146.1718f, 0.1396245f), + new(1606.724f, -4414.668f, 121.4687f, 5.550147f), + new(1647.043f, -4402.644f, 121.7353f, 1.570796f), + new(1573.078f, -4426.342f, 104.5087f, 5.550147f), + new(1600.927f, -4367.731f, 87.9886f, 3.874631f), + new(1558.359f, -4368.33f, 120.0258f, 4.363324f), + new(1377.49f, -4298.74f, 136.4911f, 5.846854f), + new(1395.439f, -4403.583f, 170.1769f, 3.68265f), + new(1394.175f, -4390.438f, 166.5045f, 5.550147f), + new(1389.752f, -4352.681f, 150.5359f, 3.228859f), + new(1471.724f, -4393.083f, 129.966f, 3.159062f), + new(1586.208f, -4334.78f, 104.248f, 2.617989f), + new(1590.582f, -4338.588f, 110.6812f, 0.2094394f), + new(1601.163f, -4367.491f, 105.1535f, 0.5410506f), + new(1493.476f, -4448.524f, 142.9773f, 3.630291f), + new(1481.592f, -4421.177f, 156.4658f, 0.1396245f), + new(1382.604f, -4319.927f, 143.5185f, 3.298687f), + new(1647.483f, -4404.724f, 113.3714f, 2.617989f), + new(1567.398f, -4423.649f, 108.9948f, 4.206246f), + new(1560.326f, -4372.816f, 112.5343f, 6.19592f), + new(1521.741f, -4390.443f, 103.8611f, 5.550147f), + new(1479.924f, -4424.903f, 156.0753f, 3.054327f), + new(1387.427f, -4334.854f, 150.2641f, 0.9773831f), + new(1481.771f, -4466.378f, 138.0009f, 3.47321f), + new(1390.512f, -4372.778f, 154.748f, 3.071766f), + new(1605.115f, -4411.217f, 112.0536f, 0.06981169f), + new(1466.144f, -4341.917f, 140.5263f, 2.548179f), + new(1479.922f, -4467.948f, 129.9536f, 3.33359f), + new(1397.09f, -4405.764f, 149.5936f, 2.199115f), + new(1404.153f, -4497.729f, 121.3236f, 6.0912f), + new(1493.337f, -4441.268f, 137.3894f, 3.211419f), + new(1469.385f, -4340.427f, 150.2859f, 2.548179f), + new(1385.043f, -4317.056f, 145.6198f, 3.194002f), + new(1472.734f, -4398.983f, 135.9285f, 3.47321f), + new(1469.135f, -4380.587f, 117.5022f, 0.1396245f), + new(1389.047f, -4339.42f, 150.2229f, 4.76475f), + new(1476.245f, -4420.931f, 159.4286f, 3.630291f), + new(1479.87f, -4421.628f, 161.0234f, 3.054327f), + new(1391.415f, -4370.76f, 161.9061f, 3.089183f), + new(1394.175f, -4385.715f, 153.2316f, 5.899214f), + new(1396.132f, -4411.295f, 161.1071f, 4.66003f), + new(1403.262f, -4474.733f, 103.9363f, 4.886924f), + new(1488.257f, -4491.0f, 130.442f, 0.03490625f), + new(1467.707f, -4361.327f, 105.1312f, 3.700105f), + new(1375.649f, -4366.401f, 152.1661f, 0.1745321f), + new(1389.922f, -4375.253f, 77.87833f, 6.0912f), + new(1392.398f, -4379.628f, 172.5377f, 2.199115f), + new(1394.943f, -4388.257f, 176.3171f, 3.246347f), + new(1481.833f, -4466.399f, 160.8109f, 3.630291f), + new(1469.816f, -4366.597f, 120.6296f, 3.159062f), + new(1379.802f, -4309.967f, 146.3039f, 2.984498f), + new(1388.002f, -4353.233f, 148.1396f, 5.899214f), + new(1378.589f, -4296.118f, 144.691f, 5.846854f), + new(1470.207f, -4395.868f, 133.8257f, 6.073746f), + new(1406.467f, -4511.327f, 123.2332f, 0.1396245f), + new(1395.04f, -4390.569f, 167.5848f, 3.228859f), + new(1480.908f, -4422.219f, 154.6776f, 3.194002f), + new(1486.033f, -4493.719f, 144.937f, 3.47321f), + new(1403.845f, -4488.743f, 124.8069f, 3.700105f), + new(1494.733f, -4446.885f, 140.0633f, 6.248279f), + new(1481.875f, -4428.431f, 161.3601f, 3.316144f), + new(1384.299f, -4332.253f, 146.5117f, 3.194002f), + new(1468.939f, -4346.42f, 143.6888f, 3.054327f), + new(1393.356f, -4478.347f, 125.5958f, 6.0912f), + new(1384.672f, -4449.229f, 146.3165f, 4.886924f), + new(1486.5393f, -4372.5333f, 117.014f, 5.951700f), + new(1489.1738f, -4415.65091f, 110.5526f, 1.309994f), + new(1501.63171f, -4454.74668f, 107.716637f, 0.387151f), + new(1518.3159f, -4438.94873f, 82.9114f, 1.891189f), + new(1511.754272f, -4423.58203f, 75.781662f, 6.1763f), + new(1508.1212f, -4399.4312f, 75.781662f, 3.575869f), + new(1515.1198f, -4356.886719f, 81.859f, 5.87775f), + new(1553.78795f, -4387.95084f, 72.565178f, 1.372812f), + new(1549.74023f, -4413.03227f, 74.2219f, 0.42641f), + new(1528.63644f, -4408.71850f, 118.7224f, 0.23985f), + new(1532.7171f, -4399.64944f, 50.62704f, 0.13188f), + new(1509.3391f, -4422.2905f, 55.24475f, 0.1554f), + new(1501.4160f, -4413.1782f, 42.63250f, 0.347852f), + new(1499.258179f, -4395.1628f, 42.230198f, 6.02282f), + new(1485.33571f, -4397.560547f, 51.07567f, 3.2190f), + new(1495.2693f, -4417.2910f, 50.232471f, 3.31666f), + new(1498.65912f, -4439.20613f, 49.07176f, 3.7643f), + new(1523.45699f, -4393.04395f, 39.775066f, 3.71542f), + new(1536.62665f, -4419.85963f, 40.4508f, 3.46193f), + new(1497.2632f, -4401.54637f, 33.805511f, 2.60181f), + new(1497.9363f, -4437.58008f, 32.326393f, 4.96205f), + new(1493.26253f, -4402.19919f, 59.147816f, 2.2917f) + }; + + static Position[] IronForgePos = + { + new(-5196.038f, -858.4618f, 525.0447f, 6.073746f), + new(-5195.734f, -887.6441f, 534.168f, 3.68265f), + new(-5195.063f, -762.2795f, 510.0929f, 4.66003f), + new(-5164.59f, -858.3264f, 540.0117f, 5.899214f), + new(-5130.776f, -791.1945f, 523.2938f, 5.846854f), + new(-5127.663f, -827.1771f, 534.2573f, 4.76475f), + new(-5227.184f, -754.8802f, 500.0329f, 5.550147f), + new(-5197.655f, -857.8889f, 525.5248f, 2.199115f), + new(-5227.705f, -859.0052f, 513.9084f, 6.0912f), + new(-5227.0f, -821.7795f, 471.7424f, 3.700105f), + new(-5131.42f, -791.9445f, 537.8198f, 3.054327f), + new(-5223.59f, -889.6302f, 509.3725f, 4.886924f), + new(-5164.124f, -825.3795f, 525.2161f, 0.9773831f), + new(-5196.168f, -826.6163f, 517.4463f, 2.111848f), + new(-5227.393f, -757.1059f, 501.0704f, 3.47321f), + new(-5192.556f, -784.4583f, 506.9716f, 4.729844f), + new(-5227.965f, -792.184f, 509.1933f, 0.1396245f), + new(-5182.054f, -782.283f, 514.0707f, 4.886924f), + new(-5152.384f, -819.2031f, 508.2252f, 0.9773831f), + new(-5220.162f, -722.941f, 501.573f, 3.700105f), + new(-5218.438f, -879.0486f, 534.1289f, 2.111848f), + new(-5186.096f, -846.5903f, 526.4001f, 3.054327f), + new(-5182.972f, -816.2309f, 522.7172f, 5.550147f), + new(-5172.745f, -854.6077f, 541.5695f, 2.548179f), + new(-5126.936f, -816.5712f, 506.1032f, 4.76475f), + new(-5214.637f, -850.4496f, 524.1501f, 4.729844f), + new(-5156.693f, -818.3021f, 532.9488f, 4.66003f), + new(-5188.997f, -876.8524f, 544.1463f, 6.073746f), + new(-5216.222f, -817.3351f, 498.4872f, 3.630291f), + new(-5190.08f, -758.6545f, 507.9708f, 6.0912f), + new(-5156.724f, -844.0851f, 529.4639f, 5.899214f), + new(-5215.002f, -754.8802f, 488.5055f, 0.1396245f), + new(-5137.646f, -787.2882f, 502.1171f, 5.846854f), + new(-5183.194f, -817.217f, 508.4071f, 3.68265f), + new(-5183.191f, -848.6163f, 518.0361f, 2.199115f), + new(-5215.972f, -785.0452f, 494.1193f, 3.47321f), + new(-5117.396f, -791.4796f, 483.5854f, 6.0912f), + new(-5153.132f, -781.2309f, 539.7031f, 5.899214f), + new(-5209.993f, -710.1337f, 501.9293f, 5.846854f), + new(-5172.809f, -848.1094f, 520.4458f, 6.0912f), + new(-5120.552f, -812.3004f, 547.9608f, 3.68265f), + new(-5142.92f, -811.507f, 526.748f, 4.886924f), + new(-5208.391f, -773.4583f, 497.451f, 4.729844f), + new(-5181.903f, -779.1979f, 518.5895f, 0.9773831f), + new(-5208.097f, -843.934f, 514.2054f, 3.47321f), + new(-5118.309f, -783.3246f, 545.3275f, 2.199115f), + new(-5213.969f, -715.6684f, 493.5344f, 6.073746f), + new(-5211.384f, -872.493f, 523.3142f, 0.1396245f), + new(-5215.563f, -812.7205f, 501.1313f, 2.548179f), + new(-5159.971f, -819.0695f, 523.9502f, 5.550147f), + new(-5243.21f, -741.7934f, 479.6208f, 2.111848f), + new(-5158.577f, -784.243f, 515.7791f, 3.054327f), + new(-5210.179f, -809.2413f, 507.136f, 3.630291f), + new(-5182.26f, -818.6476f, 519.5022f, 4.66003f), + new(-5178.493f, -870.8143f, 539.2921f, 3.700105f), + new(-5206.622f, -741.5938f, 511.1593f, 4.76475f), + new(-5194.976f, -759.9896f, 517.6288f, 3.630291f) + }; + + static Position[] SilvermoonPos = + { + new(9466.583f, -7307.326f, 107.8366f, 0.1047193f), + new(9411.616f, -7322.223f, 79.95399f, 2.722713f), + new(9472.98f, -7276.879f, 111.8719f, 6.056293f), + new(9403.265f, -7283.608f, 108.6991f, 3.106652f), + new(9426.45f, -7221.809f, 95.899f, 3.612838f), + new(9410.442f, -7283.999f, 113.0489f, 3.106652f), + new(9398.225f, -7284.489f, 81.34821f, 3.019413f), + new(9400.401f, -7268.281f, 114.684f, 3.228859f), + new(9478.615f, -7259.143f, 109.0896f, 5.777041f), + new(9480.074f, -7163.523f, 113.2669f, 0.1396245f), + new(9482.511f, -7119.089f, 95.79392f, 6.021387f), + new(9407.579f, -7277.173f, 145.9511f, 3.159062f), + new(9399.398f, -7323.894f, 106.2334f, 2.617989f), + new(9395.489f, -7278.119f, 77.25965f, 3.106652f), + new(9407.703f, -7330.93f, 97.46037f, 2.565632f), + new(9408.553f, -7254.359f, 103.7934f, 3.455756f), + new(9480.151f, -7135.254f, 120.9287f, 6.19592f), + new(9412.958f, -7276.931f, 107.8171f, 3.141593f), + new(9475.104f, -7306.728f, 116.2541f, 0.1745321f), + new(9464.988f, -7319.295f, 101.1637f, 0.2617982f), + new(9472.38f, -7267.314f, 140.3056f, 5.93412f), + new(9410.978f, -7300.815f, 109.2923f, 2.583081f), + new(9405.042f, -7301.033f, 124.4924f, 2.967041f), + new(9403.106f, -7309.054f, 103.702f, 2.984498f), + new(9464.217f, -7350.079f, 131.7602f, 0.5759573f), + new(9456.133f, -7348.024f, 104.9382f, 0.383971f), + new(9411.794f, -7285.174f, 101.2357f, 3.089183f), + new(9411.597f, -7266.42f, 102.0371f, 3.263772f), + new(9478.836f, -7127.272f, 95.90057f, 6.143561f), + new(9481.063f, -7136.337f, 101.3669f, 0.01745246f), + new(9398.232f, -7329.835f, 85.74606f, 2.775069f), + new(9399.838f, -7268.37f, 72.05019f, 3.211419f), + new(9409.207f, -7241.094f, 85.7521f, 3.368496f), + new(9465.259f, -7310.388f, 113.2353f, 0.6283169f), + new(9487.643f, -7155.167f, 124.4381f, 0.122173f), + new(9431.971f, -7222.501f, 95.89851f, 3.455756f), + new(9393.978f, -7278.168f, 71.72367f, 3.124123f), + new(9487.966f, -7268.014f, 119.8879f, 5.829401f), + new(9404.565f, -7330.906f, 90.92167f, 2.740162f), + new(9465.2f, -7313.238f, 124.9027f, 0.2268925f), + new(9470.827f, -7304.245f, 135.3172f, 6.265733f), + new(9403.582f, -7255.257f, 107.5193f, 3.298687f), + new(9399.23f, -7310.893f, 80.78027f, 2.879789f), + new(9472.535f, -7267.201f, 112.1708f, 6.03884f), + new(9491.937f, -7154.478f, 97.61007f, 0.05235888f), + new(9412.064f, -7278.493f, 116.0459f, 3.106652f), + new(9369.768f, -7276.374f, 14.24026f, 6.0912f), + new(9410.102f, -7295.561f, 143.4681f, 3.019413f), + new(9484.801f, -7131.789f, 81.00427f, 6.161013f), + new(9411.763f, -7266.338f, 107.3137f, 3.106652f), + new(9407.249f, -7253.171f, 115.6959f, 3.316144f), + new(9465.064f, -7316.58f, 144.7163f, 0.2967052f), + new(9411.466f, -7252.686f, 113.9839f, 3.33359f), + new(9474.942f, -7260.846f, 125.8512f, 5.969027f), + new(9485.356f, -7110.373f, 104.1972f, 6.03884f), + new(9402.48f, -7333.202f, 107.0458f, 2.460913f), + new(9404.987f, -7279.173f, 133.3515f, 2.949595f), + new(9476.116f, -7270.055f, 105.0233f, 6.003934f), + new(9470.456f, -7300.805f, 107.3014f, 0.087266f), + new(9434.106f, -7236.905f, 133.1817f, 3.368496f), + new(9416.494f, -7325.862f, 113.1137f, 2.652894f), + new(9406.013f, -7302.038f, 109.1291f, 2.740162f), + new(9473.886f, -7256.887f, 108.9899f, 5.829401f), + new(9430.171f, -7231.706f, 114.6874f, 3.42085f), + new(9404.366f, -7275.19f, 144.4704f, 3.071766f), + new(9411.504f, -7288.202f, 112.2664f, 2.844883f) + }; + + static Position[] ExodarPos = + { + new(-3992.465f, -11843.86f, 186.4043f, 2.199115f), + new(-3948.378f, -11854.06f, 135.6206f, 3.47321f), + new(-3918.684f, -11840.53f, 216.565f, 4.886924f), + new(-3946.1f, -11854.03f, 131.2059f, 6.0912f), + new(-3966.864f, -11851.99f, 106.2717f, 2.548179f), + new(-3994.082f, -11855.4f, 66.14954f, 4.32842f), + new(-3989.288f, -11846.68f, 147.7923f, 3.700105f), + new(-3974.271f, -11849.3f, 183.4967f, 0.9773831f), + new(-3943.34f, -11850.36f, 191.2153f, 5.846854f), + new(-3923.543f, -11851.16f, 93.1925f, 3.054327f), + new(-3990.212f, -11844.83f, 89.08578f, 2.111848f), + new(-3977.315f, -11848.61f, 128.4479f, 3.700105f), + new(-3972.831f, -11850.72f, 89.65628f, 2.548179f), + new(-3946.937f, -11851.44f, 192.1654f, 2.199115f), + new(-3937.843f, -11856.82f, 80.51583f, 4.66003f), + new(-3954.331f, -11851.98f, 81.24915f, 3.054327f), + new(-3937.817f, -11853.64f, 121.1544f, 3.47321f), + new(-3967.367f, -11851.36f, 123.7478f, 4.729844f), + new(-3986.625f, -11847.29f, 142.0192f, 6.0912f), + new(-3990.369f, -11844.75f, 94.17735f, 6.073746f), + new(-3938.356f, -11850.21f, 200.6413f, 3.68265f), + new(-3954.939f, -11852.58f, 184.5983f, 5.899214f), + new(-3988.003f, -11846.72f, 73.19949f, 6.0912f), + new(-3896.356f, -11844.68f, 148.2895f, 5.899214f), + new(-3971.118f, -11850.72f, 137.1919f, 6.073746f), + new(-3930.919f, -11853.74f, 138.6459f, 0.9773831f), + new(-3984.946f, -11844.98f, 164.378f, 4.66003f), + new(-3943.503f, -11854.65f, 145.232f, 3.630291f), + new(-3812.792f, -11807.49f, 135.9212f, 3.700105f), + new(-3943.854f, -11854.62f, 163.0852f, 5.550147f), + new(-3957.711f, -11850.8f, 147.1301f, 3.68265f), + new(-3949.376f, -11848.43f, 146.4466f, 2.199115f), + new(-4014.848f, -11815.58f, 130.2189f, 4.729844f), + new(-4012.328f, -11821.78f, 92.57595f, 6.073746f), + new(-4025.119f, -11794.49f, 183.6754f, 4.76475f), + new(-4031.543f, -11791.47f, 78.31419f, 4.66003f), + new(-4019.754f, -11805.57f, 129.9788f, 3.630291f), + new(-4009.46f, -11824.12f, 126.7007f, 0.1396245f), + new(-4049.115f, -11781.37f, 197.9942f, 3.68265f), + new(-4006.23f, -11830.18f, 184.4535f, 5.899214f), + new(-4017.271f, -11814.06f, 73.86016f, 2.111848f), + new(-4018.511f, -11807.98f, 179.3607f, 4.450591f), + new(-4038.572f, -11767.11f, 191.1657f, 4.76475f), + new(-4018.321f, -11808.37f, 178.2087f, 0.9773831f), + new(-4013.852f, -11817.62f, 126.2276f, 4.886924f), + new(-4028.476f, -11782.85f, 100.8544f, 0.1396245f), + new(-4006.938f, -11821.57f, 81.11591f, 5.550147f), + new(-4018.111f, -11808.96f, 113.2876f, 3.630291f), + new(-4069.263f, -11755.89f, 133.3362f, 0.1396245f), + new(-4041.02f, -11757.23f, 139.8532f, 5.846854f), + new(-4012.13f, -11814.23f, 165.8398f, 3.054327f), + new(-4028.264f, -11781.04f, 135.2486f, 6.0912f), + new(-4025.534f, -11790.81f, 164.8259f, 2.548179f), + new(-4015.083f, -11815.16f, 147.3407f, 4.886924f), + new(-4011.046f, -11818.31f, 141.9634f, 4.76475f), + new(-4043.675f, -11746.47f, 136.9332f, 3.47321f), + new(-4013.666f, -11817.91f, 169.5565f, 2.111848f), + new(-4036.461f, -11783.4f, 142.8152f, 4.729844f) + }; + + static Position[] ThunderBluffPos = + { + new(-1234.804f, -19.72239f, 206.5436f, 0.1396245f), + new(-1244.442f, -35.88308f, 206.82f, 4.729844f), + new(-1239.212f, -11.25857f, 208.6352f, 3.700105f), + new(-1217.165f, -15.58898f, 207.4553f, 3.68265f), + new(-1229.332f, -6.54617f, 208.2537f, 2.548179f), + new(-1227.353f, -14.30225f, 206.6192f, 3.054327f), + new(-1234.8f, -14.12402f, 208.0964f, 6.0912f), + new(-1246.791f, -38.59223f, 206.846f, 6.073746f), + new(-1229.818f, -6.788249f, 209.4552f, 4.886924f), + new(-1223.867f, -10.67551f, 205.7558f, 0.9773831f), + new(-1229.833f, -6.403429f, 208.6842f, 4.76475f), + new(-1239.199f, -23.20622f, 207.0188f, 3.47321f), + new(-1246.258f, -37.36089f, 208.2598f, 2.199115f), + new(-1223.363f, -12.2462f, 201.3805f, 4.66003f), + new(-1218.116f, -16.37305f, 199.9185f, 5.550147f), + new(-1239.709f, -42.34294f, 204.2466f, 2.111848f), + new(-1219.295f, -12.87424f, 206.2387f, 5.899214f), + new(-1251.241f, -33.18164f, 209.7986f, 3.630291f), + new(-1219.549f, -12.32769f, 207.9862f, 3.47321f), + new(-1251.181f, -34.52919f, 206.8795f, 4.66003f), + new(-1235.567f, -15.02116f, 205.3759f, 2.199115f), + new(-1241.148f, -41.8049f, 205.8436f, 0.1396245f), + new(-1241.41f, -23.09136f, 206.5933f, 3.054327f), + new(-1235.885f, -19.49116f, 206.4422f, 3.68265f), + new(-1234.823f, -13.99685f, 210.1406f, 6.073746f), + new(-1220.117f, -10.93815f, 204.8297f, 4.76475f), + new(-1219.087f, -6.230252f, 206.5717f, 5.899214f), + new(-1235.053f, -20.39225f, 206.5732f, 3.630291f), + new(-1239.364f, -22.23714f, 207.2047f, 4.886924f), + new(-1245.448f, -37.35639f, 208.0733f, 3.700105f), + new(-1222.941f, -10.68441f, 208.3044f, 0.9773831f), + new(-1238.765f, -11.7156f, 203.8905f, 2.111848f), + new(-1251.638f, -34.5931f, 207.4821f, 6.0912f), + new(-1229.332f, -6.54617f, 205.5314f, 4.729844f), + new(-1245.196f, -37.02111f, 208.2277f, 5.550147f), + new(-1235.227f, -19.88525f, 206.9543f, 2.548179f), + new(-1249.993f, -35.97727f, 206.9852f, 5.846854f), + new(-1238.741f, -11.55127f, 216.4102f, 4.76475f), + new(-1242.702f, -23.95698f, 215.8784f, 2.199115f), + new(-1223.998f, -11.75629f, 187.3124f, 6.0912f), + new(-1220.138f, -16.90701f, 218.7182f, 2.111848f), + new(-1239.351f, -23.36654f, 218.1057f, 5.550147f), + new(-1222.544f, -11.58713f, 218.9956f, 3.630291f), + new(-1234.379f, -19.82167f, 211.3573f, 5.899214f), + new(-1224.649f, -16.73172f, 217.2839f, 6.073746f), + new(-1219.856f, -11.69358f, 218.5711f, 0.1396245f), + new(-1223.967f, -8.415148f, 219.2347f, 3.47321f), + new(-1252.266f, -33.21897f, 215.823f, 3.68265f), + new(-1244.304f, -41.49599f, 214.7235f, 3.700105f), + new(-1245.102f, -34.69542f, 215.4592f, 4.886924f), + new(-1239.761f, -41.99474f, 211.7772f, 6.0912f), + new(-1219.803f, -11.18414f, 219.6471f, 4.729844f), + new(-1219.832f, -12.19803f, 219.4899f, 5.846854f), + new(-1236.825f, -18.4617f, 220.2076f, 4.66003f), + new(-1239.635f, -11.55973f, 220.694f, 2.548179f), + new(-1233.765f, -15.5765f, 216.1068f, 3.054327f), + new(-1233.56f, -15.80257f, 215.6199f, 0.9773831f), + new(-1240.617f, -41.39486f, 205.0362f, 5.846854f) + }; + + static Position[] UndercityPos = + { + new(1850.231f, 257.0156f, 124.1743f, 4.729844f), + new(1863.302f, 193.9063f, 114.5829f, 0.9773831f), + new(1851.997f, 212.7726f, 127.959f, 5.550147f), + new(1862.474f, 288.1528f, 118.4504f, 6.0912f), + new(1851.906f, 267.6267f, 131.5442f, 3.054327f), + new(1868.905f, 323.2587f, 131.801f, 0.1396245f), + new(1849.677f, 196.5052f, 119.4152f, 2.548179f), + new(1870.382f, 155.8438f, 135.8888f, 5.846854f), + new(1863.309f, 211.9219f, 117.2065f, 5.899214f), + new(1849.877f, 215.7413f, 120.1931f, 6.073746f), + new(1864.762f, 170.5399f, 108.2692f, 4.76475f), + new(1839.986f, 288.4306f, 126.1348f, 3.47321f), + new(1875.91f, 230.566f, 125.1612f, 2.199115f), + new(1854.146f, 238.7622f, 131.7162f, 4.66003f), + new(1863.307f, 264.4583f, 123.374f, 4.886924f), + new(1871.578f, 266.8681f, 108.0443f, 4.66003f), + new(1836.901f, 185.5868f, 113.362f, 3.630291f), + new(1871.545f, 191.2622f, 105.8294f, 6.073746f), + new(1863.307f, 211.816f, 114.3906f, 4.76475f), + new(1841.543f, 205.1754f, 102.9691f, 3.47321f), + new(1843.304f, 273.4757f, 104.6566f, 6.0912f), + new(1870.818f, 167.0938f, 126.3066f, 4.729844f), + new(1840.653f, 227.6319f, 106.8095f, 0.1396245f), + new(1863.299f, 282.1806f, 110.9902f, 2.199115f), + new(1875.688f, 230.5278f, 112.7081f, 3.054327f), + new(1872.264f, 311.1458f, 119.7756f, 3.68265f), + new(1871.248f, 297.1684f, 113.6078f, 5.550147f), + new(1863.293f, 186.4896f, 114.6143f, 5.846854f), + new(1838.384f, 252.3264f, 103.8479f, 3.700105f), + new(1886.804f, 166.3976f, 125.2679f, 2.111848f), + new(1863.363f, 237.5417f, 125.3641f, 0.9773831f), + new(1863.307f, 267.875f, 113.7794f, 5.899214f), + new(1845.602f, 299.4445f, 120.9578f, 4.886924f), + new(1871.884f, 217.2656f, 108.2966f, 2.548179f), + new(1867.459f, 240.2357f, 106.0639f, 6.0912f), + new(1863.326f, 298.4879f, 121.1103f, 3.054327f), + new(1844.776f, 287.776f, 131.6692f, 4.76475f), + new(1842.595f, 299.8854f, 132.9048f, 5.846854f), + new(1843.754f, 233.0833f, 122.607f, 3.68265f), + new(1865.563f, 238.7674f, 127.128f, 5.550147f), + new(1863.302f, 282.6076f, 117.6718f, 2.548179f), + new(1850.063f, 218.7344f, 116.5234f, 4.886924f), + new(1852.528f, 257.8333f, 125.5587f, 5.899214f), + new(1870.385f, 321.809f, 123.7424f, 4.66003f), + new(1864.694f, 167.474f, 111.3632f, 0.1396245f), + new(1846.231f, 194.2656f, 108.0038f, 3.700105f), + new(1876.434f, 227.1129f, 116.7266f, 4.729844f), + new(1839.993f, 245.0399f, 120.8441f, 2.199115f), + new(1864.042f, 204.4774f, 105.6403f, 3.630291f), + new(1875.594f, 246.9271f, 110.0379f, 2.111848f), + new(1850.892f, 273.6059f, 133.6044f, 0.9773831f), + new(1863.3f, 186.2188f, 118.3104f, 3.47321f), + new(1851.578f, 203.2604f, 118.5638f, 6.0912f), + new(1863.307f, 259.8038f, 116.5421f, 6.073746f), + new(1877.592f, 247.3872f, 128.022f, 3.68265f), + new(1850.288f, 267.309f, 125.0537f, 3.630291f) + }; + + static Position[] DarnassusPos = + { + new(8578.888f, 975.2604f, 42.48742f, 5.846854f), + new(8574.236f, 944.2083f, 44.71943f, 4.76475f), + new(8517.067f, 986.0851f, 66.32562f, 4.729844f), + new(8553.734f, 780.0504f, 63.21661f, 4.886924f), + new(8537.763f, 877.8924f, 76.7791f, 3.054327f), + new(8572.691f, 814.7379f, 72.4253f, 3.68265f), + new(8572.691f, 814.7379f, 72.4253f, 3.68265f), + new(8494.191f, 943.868f, 59.0681f, 6.073746f), + new(8536.576f, 873.7222f, 45.29478f, 0.1396245f), + new(8550.191f, 850.7222f, 57.6362f, 3.700105f), + new(8554.281f, 875.8316f, 48.10747f, 5.550147f), + new(8590.731f, 846.9427f, 56.89664f, 2.199115f), + new(8519.5f, 949.7708f, 63.29575f, 3.630291f), + new(8508.24f, 838.3646f, 77.00415f, 4.66003f), + new(8588.622f, 912.0434f, 49.60857f, 0.9773831f), + new(8538.786f, 820.7361f, 67.0003f, 6.0912f), + new(8488.077f, 983.2379f, 59.87747f, 2.111848f), + new(8494.68f, 911.783f, 72.29862f, 2.548179f), + new(8556.297f, 920.9479f, 42.13089f, 3.47321f), + new(8571.629f, 880.1511f, 53.78056f, 5.899214f), + new(8544.278f, 885.059f, 70.3073f, 0.1396245f), + new(8551.224f, 947.6059f, 60.74737f, 6.0912f), + new(8586.716f, 913.4774f, 42.5911f, 4.76475f), + new(8617.442f, 917.658f, 41.92455f, 4.886924f), + new(8519.375f, 917.842f, 74.22758f, 2.111848f), + new(8550.322f, 910.9809f, 52.84513f, 3.700105f), + new(8582.255f, 848.0608f, 53.87154f, 5.899214f), + new(8547.279f, 964.1684f, 45.09663f, 5.550147f), + new(8581.158f, 881.2344f, 54.83494f, 0.9773831f), + new(8550.932f, 817.2396f, 60.80384f, 3.630291f), + new(8550.214f, 787.1684f, 66.42948f, 4.729844f), + new(8583.88f, 948.4114f, 41.32378f, 5.846854f), + new(8550.997f, 848.8594f, 70.56313f, 3.47321f), + new(8517.45f, 879.5555f, 83.80603f, 6.073746f), + new(8558.55f, 838.934f, 56.89937f, 4.66003f), + new(8617.526f, 851.5955f, 37.39491f, 3.68265f), + new(8579.229f, 911.8906f, 44.37334f, 3.054327f), + new(8581.771f, 817.0295f, 30.07061f, 2.199115f), + new(8514.054f, 848.6059f, 59.20383f, 2.548179f), + new(8570.65f, 885.1719f, 59.11485f, 2.548179f), + new(8576.803f, 814.3611f, 50.15007f, 4.66003f), + new(8697.891f, 991.0841f, 39.18531f, 6.0912f), + new(8547.403f, 974.4879f, 63.7893f, 5.846854f), + new(8553.929f, 853.6476f, 84.47609f, 0.1396245f), + new(8507.603f, 878.8854f, 70.23988f, 5.899214f), + new(8570.95f, 854.1406f, 65.7302f, 3.054327f), + new(8560.618f, 777.342f, 79.87446f, 4.886924f), + new(8542.07f, 852.0174f, 64.99033f, 3.700105f), + new(8514.364f, 940.0868f, 64.65899f, 4.76475f), + new(8526.2f, 848.8542f, 63.1242f, 2.199115f), + new(8571.85f, 913.1511f, 43.11662f, 6.073746f), + new(8591.914f, 901.6493f, 26.83536f, 5.550147f), + new(8539.892f, 914.3368f, 45.99331f, 3.630291f), + new(8578.143f, 948.3264f, 62.56763f, 2.111848f), + new(8539.493f, 887.2274f, 79.56437f, 3.47321f), + new(8538.561f, 951.6632f, 69.08958f, 4.729844f), + new(8523.006f, 907.7413f, 72.85262f, 0.9773831f), + new(8520.907f, 813.0208f, 81.70242f, 3.68265f), + new(8554.825f, 813.0746f, 78.88226f, 6.0912f) + }; + + public static Dictionary PositionsByZoneMap = new() + { + { (uint)ZoneIds.StranglethornVale, BootyBayPos }, + { (uint)ZoneIds.Stormwind, StormwindPos }, + { (uint)ZoneIds.Orgrimmar, OrgrimmarPos }, + { (uint)ZoneIds.Durotar, OrgrimmarPos }, + { (uint)ZoneIds.DunMorogh, IronForgePos}, + { (uint)ZoneIds.Ironforge, IronForgePos}, + { (uint)ZoneIds.EversongWoods, SilvermoonPos}, + { (uint)ZoneIds.Exodar, ExodarPos}, + { (uint)ZoneIds.Thunderbluff, ThunderBluffPos}, + { (uint)ZoneIds.Undercity, UndercityPos}, + { (uint)ZoneIds.TirisfalGlades, UndercityPos}, + { (uint)ZoneIds.Teldrassil, DarnassusPos } + }; + } + + [Script] + class go_cheer_speaker : GameObjectAI + { + bool _started; + bool _big; + + public go_cheer_speaker(GameObject go) : base(go) { } + + static uint CheerPicker() + { + return RandomHelper.RAND(MiscConst.SoundCheer1, MiscConst.SoundCheer2, MiscConst.SoundCheer3, MiscConst.SoundCheer4); + } + + static uint FireworksPicker() + { + return (uint)RandomHelper.RAND( + ObjectIds.FireworkShowType1Red, + ObjectIds.FireworkShowType2Red, + ObjectIds.FireworkShowType1RedBig, + ObjectIds.FireworkShowType2RedBig, + ObjectIds.FireworkShowType1Blue, + ObjectIds.FireworkShowType2Blue, + ObjectIds.FireworkShowType1BlueBig, + ObjectIds.FireworkShowType2BlueBig, + ObjectIds.FireworkShowType1Green, + ObjectIds.FireworkShowType2GreenBig, + ObjectIds.FireworkShowType1GreenBig, + ObjectIds.FireworkShowType2Green, + ObjectIds.FireworkShowType1White, + ObjectIds.FireworkShowType1WhiteBig, + ObjectIds.FireworkShowType2White, + ObjectIds.FireworkShowType2WhiteBig, + ObjectIds.FireworkShowType1Yellow, + ObjectIds.FireworkShowType1YellowBig, + ObjectIds.FireworkShowType2Yellow, + ObjectIds.FireworkShowType2YellowBig, + ObjectIds.FireworkShowType2Purple, + ObjectIds.FireworkShowType1PurpleBig, + ObjectIds.FireworkShowType2PurpleBig + ); + } + + static uint FireworksBIGOnlyPicker() + { + return (uint)RandomHelper.RAND( + ObjectIds.FireworkShowType1RedBig, + ObjectIds.FireworkShowType2RedBig, + ObjectIds.FireworkShowType1BlueBig, + ObjectIds.FireworkShowType2BlueBig, + ObjectIds.FireworkShowType2GreenBig, + ObjectIds.FireworkShowType1GreenBig, + ObjectIds.FireworkShowType1WhiteBig, + ObjectIds.FireworkShowType2WhiteBig, + ObjectIds.FireworkShowType1YellowBig, + ObjectIds.FireworkShowType2YellowBig, + ObjectIds.FireworkShowType1PurpleBig, + ObjectIds.FireworkShowType2PurpleBig + ); + } + + public override void UpdateAI(uint diff) + { + _events.Update(diff); + + var localTm = GameTime.GetDateAndTime(); + + // Start + if ((localTm.Minute == 0 && localTm.Second == 0) && !_started && (GameEventMgr.IsHolidayActive(HolidayIds.FireworksSpectacular) || GameEventMgr.IsEventActive(MiscConst.GameEventNewYear))) + { + _events.ScheduleEvent(MiscConst.EventCheer, TimeSpan.FromSeconds(1)); + _events.ScheduleEvent(MiscConst.EventFire, TimeSpan.FromSeconds(1)); + _started = true; + } + + // Event is active + if ((localTm.Minute >= 0 && localTm.Second >= 1 && localTm.Minute <= 9 && localTm.Second <= 59 && !_started) && (GameEventMgr.IsHolidayActive(HolidayIds.FireworksSpectacular) || GameEventMgr.IsEventActive(MiscConst.GameEventNewYear))) + { + _events.ScheduleEvent(MiscConst.EventFire, TimeSpan.FromSeconds(1)); + _started = true; + } + + // Stop + if ((localTm.Minute == 10 && localTm.Second == 0) && _started == true) + { + _started = false; + _events.ScheduleEvent(MiscConst.EventCheer, TimeSpan.FromSeconds(1)); + _events.CancelEvent(MiscConst.EventFire); + } + + // New Year (Only!) - One more big bang! + if ((localTm.Minute == 10 && localTm.Second == 30 && localTm.Hour == 0) && GameEventMgr.IsEventActive(MiscConst.GameEventNewYear) && _big == true) + { + _big = false; + _events.ScheduleEvent(MiscConst.EventCheer, TimeSpan.FromSeconds(1)); + _events.ScheduleEvent(MiscConst.EventFire, TimeSpan.FromSeconds(1)); + _events.ScheduleEvent(MiscConst.EventFire, TimeSpan.FromSeconds(1)); + _events.ScheduleEvent(MiscConst.EventFire, TimeSpan.FromSeconds(1)); + _events.ScheduleEvent(MiscConst.EventFire, TimeSpan.FromSeconds(1)); + _events.ScheduleEvent(MiscConst.EventFire, TimeSpan.FromSeconds(1)); + _events.ScheduleEvent(MiscConst.EventFire, TimeSpan.FromSeconds(1)); + _events.ScheduleEvent(MiscConst.EventFire, TimeSpan.FromSeconds(1)); + _events.ScheduleEvent(MiscConst.EventFire, TimeSpan.FromSeconds(1)); + _events.ScheduleEvent(MiscConst.EventFire, TimeSpan.FromSeconds(1)); + _events.ScheduleEvent(MiscConst.EventFire, TimeSpan.FromSeconds(1)); + } + + _events.ExecuteEvents(eventId => + { + switch (eventId) + { + case MiscConst.EventCheer: + { + me.PlayDistanceSound(CheerPicker()); + break; + } + case MiscConst.EventFire: + { + var positions = MiscConst.PositionsByZoneMap.LookupByKey(me.GetZoneId()); + if (positions != null) + { + Position rndpos = positions.SelectRandom(); + float rndrot = RandomHelper.FRand(-1.0000000f, 1.0000000f); + float rndrot2 = RandomHelper.FRand(-1.0000000f, 1.0000000f); + + if (_big) + { + GameObject firework = me.SummonGameObject(FireworksBIGOnlyPicker(), rndpos, new Quaternion(0.0f, 0.0f, rndrot, rndrot2), TimeSpan.FromMinutes(5)); + if (firework != null) + { + firework.SetRespawnTime(0); + firework.Delete(); + } + } + else + { + GameObject firework = me.SummonGameObject(FireworksPicker(), rndpos, new Quaternion(0.0f, 0.0f, rndrot, rndrot2), TimeSpan.FromMinutes(5)); + if (firework != null) + { + firework.SetRespawnTime(0); + firework.Delete(); + } + } + } + + if (_started == true) + _events.ScheduleEvent(MiscConst.EventFire, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(2)); + + break; + } + default: + break; + } + }); + } + } +} \ No newline at end of file diff --git a/Source/Scripts/Events/HallowsEnd.cs b/Source/Scripts/Events/HallowsEnd.cs index dba855386..5ff04f9be 100644 --- a/Source/Scripts/Events/HallowsEnd.cs +++ b/Source/Scripts/Events/HallowsEnd.cs @@ -1,4 +1,4 @@ -// Copyright (c) CypherCore All rights reserved. +// 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; @@ -11,15 +11,15 @@ namespace Scripts.Events.HallowsEnd { struct SpellIds { - //HallowEndCandysSpells - public const uint CandyOrangeGiant = 24924; // Effect 1: Apply Aura: Mod Size, Value: 30% - public const uint CandySkeleton = 24925; // Effect 1: Apply Aura: Change Model (Skeleton). Effect 2: Apply Aura: Underwater Breathing - public const uint CandyPirate = 24926; // Effect 1: Apply Aura: Increase Swim Speed, Value: 50% - public const uint CandyGhost = 24927; // Effect 1: Apply Aura: Levitate / Hover. Effect 2: Apply Aura: Slow Fall, Effect 3: Apply Aura: Water Walking - public const uint CandyFemaleDefiasPirate = 44742; // Effect 1: Apply Aura: Change Model (Defias Pirate, Female). Effect 2: Increase Swim Speed, Value: 50% - public const uint CandyMaleDefiasPirate = 44743; // Effect 1: Apply Aura: Change Model (Defias Pirate, Male). Effect 2: Increase Swim Speed, Value: 50% + //CandySpells + public const uint HallowsEndCandyOrangeGiant = 24924; + public const uint HallowsEndCandySkeleton = 24925; + public const uint HallowsEndCandyPirate = 24926; + public const uint HallowsEndCandyGhost = 24927; + public const uint HallowsEndCandyFemaleDefiasPirate = 44742; + public const uint HallowsEndCandyMaleDefiasPirate = 44743; - //Trickspells + //TrickSpells public const uint PirateCostumeMale = 24708; public const uint PirateCostumeFemale = 24709; public const uint NinjaCostumeMale = 24710; @@ -31,7 +31,7 @@ namespace Scripts.Events.HallowsEnd public const uint GhostCostumeFemale = 24736; public const uint TrickBuff = 24753; - //Trickortreatspells + //TrickOrTreatSpells public const uint Trick = 24714; public const uint Treat = 24715; public const uint TrickedOrTreated = 24755; @@ -39,7 +39,7 @@ namespace Scripts.Events.HallowsEnd public const uint TrickyTreatTrigger = 42965; public const uint UpsetTummy = 42966; - //Wand Spells + //HallowendData public const uint HallowedWandPirate = 24717; public const uint HallowedWandNinja = 24718; public const uint HallowedWandLeperGnome = 24719; @@ -50,98 +50,79 @@ namespace Scripts.Events.HallowsEnd public const uint HallowedWandBat = 24741; } - [Script] // 24930 - Hallow's End Candy - class spell_hallow_end_candy_SpellScript : SpellScript + class spell_hallow_end_candy : SpellScript { - uint[] spells = - { - SpellIds.CandyOrangeGiant, - SpellIds.CandySkeleton, - SpellIds.CandyPirate, - SpellIds.CandyGhost - }; + uint[] CandysSpells = { SpellIds.HallowsEndCandyOrangeGiant, SpellIds.HallowsEndCandySkeleton, SpellIds.HallowsEndCandyPirate, SpellIds.HallowsEndCandyGhost }; public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(spells); + return ValidateSpellInfo(CandysSpells); } void HandleDummy(uint effIndex) { - GetCaster().CastSpell(GetCaster(), spells.SelectRandom(), true); + GetCaster().CastSpell(GetCaster(), CandysSpells.SelectRandom(), true); } public override void Register() { - OnEffectHit.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); + OnEffectHit.Add(new(HandleDummy, 0, SpellEffectName.Dummy)); } } [Script] // 24926 - Hallow's End Candy - class spell_hallow_end_candy_pirate_AuraScript : AuraScript + class spell_hallow_end_candy_pirate : AuraScript { public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.CandyFemaleDefiasPirate, SpellIds.CandyMaleDefiasPirate); + return ValidateSpellInfo(SpellIds.HallowsEndCandyFemaleDefiasPirate, SpellIds.HallowsEndCandyMaleDefiasPirate); } void HandleApply(AuraEffect aurEff, AuraEffectHandleModes mode) { - uint spell = GetTarget().GetNativeGender() == Gender.Female ? SpellIds.CandyFemaleDefiasPirate : SpellIds.CandyMaleDefiasPirate; + uint spell = GetTarget().GetNativeGender() == Gender.Female ? SpellIds.HallowsEndCandyFemaleDefiasPirate : SpellIds.HallowsEndCandyMaleDefiasPirate; GetTarget().CastSpell(GetTarget(), spell, true); } void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode) { - uint spell = GetTarget().GetNativeGender() == Gender.Female ? SpellIds.CandyFemaleDefiasPirate : SpellIds.CandyMaleDefiasPirate; + uint spell = GetTarget().GetNativeGender() == Gender.Female ? SpellIds.HallowsEndCandyFemaleDefiasPirate : SpellIds.HallowsEndCandyMaleDefiasPirate; GetTarget().RemoveAurasDueToSpell(spell); } public override void Register() { - AfterEffectApply.Add(new EffectApplyHandler(HandleApply, 0, AuraType.ModIncreaseSwimSpeed, AuraEffectHandleModes.Real)); - AfterEffectRemove.Add(new EffectApplyHandler(HandleRemove, 0, AuraType.ModIncreaseSwimSpeed, AuraEffectHandleModes.Real)); + AfterEffectApply.Add(new(HandleApply, 0, AuraType.ModIncreaseSwimSpeed, AuraEffectHandleModes.Real)); + AfterEffectRemove.Add(new(HandleRemove, 0, AuraType.ModIncreaseSwimSpeed, AuraEffectHandleModes.Real)); } } - [Script] // 24750 Trick + [Script] // 24750 - Trick class spell_hallow_end_trick : SpellScript { public override bool Validate(SpellInfo spell) { - return ValidateSpellInfo(SpellIds.PirateCostumeMale, SpellIds.PirateCostumeFemale, SpellIds.NinjaCostumeMale, SpellIds.NinjaCostumeFemale, - SpellIds.LeperGnomeCostumeMale, SpellIds.LeperGnomeCostumeFemale, SpellIds.SkeletonCostume, SpellIds.GhostCostumeMale, SpellIds.GhostCostumeFemale, SpellIds.TrickBuff); + return ValidateSpellInfo(SpellIds.PirateCostumeMale, SpellIds.PirateCostumeFemale, SpellIds.NinjaCostumeMale, SpellIds.NinjaCostumeFemale, SpellIds.LeperGnomeCostumeMale, + SpellIds.LeperGnomeCostumeFemale, SpellIds.SkeletonCostume, SpellIds.GhostCostumeMale, SpellIds.GhostCostumeFemale, SpellIds.TrickBuff); } void HandleScript(uint effIndex) { Unit caster = GetCaster(); Player target = GetHitPlayer(); - if (target) + if (target != null) { Gender gender = target.GetNativeGender(); - uint spellId = SpellIds.TrickBuff; - switch (RandomHelper.URand(0, 5)) + uint spellId = RandomHelper.URand(0, 5) switch { - case 1: - spellId = gender == Gender.Female ? SpellIds.LeperGnomeCostumeFemale : SpellIds.LeperGnomeCostumeMale; - break; - case 2: - spellId = gender == Gender.Female ? SpellIds.PirateCostumeFemale : SpellIds.PirateCostumeMale; - break; - case 3: - spellId = gender == Gender.Female ? SpellIds.GhostCostumeFemale : SpellIds.GhostCostumeMale; - break; - case 4: - spellId = gender == Gender.Female ? SpellIds.NinjaCostumeFemale : SpellIds.NinjaCostumeMale; - break; - case 5: - spellId = SpellIds.SkeletonCostume; - break; - default: - break; - } + 1 => gender == Gender.Female ? SpellIds.LeperGnomeCostumeFemale : SpellIds.LeperGnomeCostumeMale, + 2 => gender == Gender.Female ? SpellIds.PirateCostumeFemale : SpellIds.PirateCostumeMale, + 3 => gender == Gender.Female ? SpellIds.GhostCostumeFemale : SpellIds.GhostCostumeMale, + 4 => gender == Gender.Female ? SpellIds.NinjaCostumeFemale : SpellIds.NinjaCostumeMale, + 5 => SpellIds.SkeletonCostume, + _ => SpellIds.TrickBuff + }; caster.CastSpell(target, spellId, true); } @@ -149,11 +130,11 @@ namespace Scripts.Events.HallowsEnd public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); + OnEffectHitTarget.Add(new(HandleScript, 0, SpellEffectName.ScriptEffect)); } } - [Script] // 24751 Trick or Treat + [Script] // 24751 - Trick or Treat class spell_hallow_end_trick_or_treat : SpellScript { public override bool Validate(SpellInfo spell) @@ -165,7 +146,7 @@ namespace Scripts.Events.HallowsEnd { Unit caster = GetCaster(); Player target = GetHitPlayer(); - if (target) + if (target != null) { caster.CastSpell(target, RandomHelper.randChance(50) ? SpellIds.Trick : SpellIds.Treat, true); caster.CastSpell(target, SpellIds.TrickedOrTreated, true); @@ -174,7 +155,7 @@ namespace Scripts.Events.HallowsEnd public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); + OnEffectHitTarget.Add(new(HandleScript, 0, SpellEffectName.ScriptEffect)); } } @@ -195,7 +176,7 @@ namespace Scripts.Events.HallowsEnd public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); + OnEffectHitTarget.Add(new(HandleScript, 0, SpellEffectName.ScriptEffect)); } } @@ -204,8 +185,8 @@ namespace Scripts.Events.HallowsEnd { public override bool Validate(SpellInfo spellEntry) { - return ValidateSpellInfo(SpellIds.PirateCostumeMale, SpellIds.PirateCostumeFemale, SpellIds.NinjaCostumeMale, SpellIds.NinjaCostumeFemale, - SpellIds.LeperGnomeCostumeMale, SpellIds.LeperGnomeCostumeFemale, SpellIds.GhostCostumeMale, SpellIds.GhostCostumeFemale); + return ValidateSpellInfo(SpellIds.PirateCostumeMale, SpellIds.PirateCostumeFemale, SpellIds.NinjaCostumeMale, SpellIds.NinjaCostumeFemale, SpellIds.LeperGnomeCostumeMale, + SpellIds.LeperGnomeCostumeFemale, SpellIds.GhostCostumeMale, SpellIds.GhostCostumeFemale); } void HandleScriptEffect() @@ -213,35 +194,25 @@ namespace Scripts.Events.HallowsEnd Unit caster = GetCaster(); Unit target = GetHitUnit(); - uint spellId; - bool female = target.GetNativeGender() == Gender.Female; + Gender gender = target.GetNativeGender(); - switch (GetSpellInfo().Id) + uint spellId = GetSpellInfo().Id switch { - case SpellIds.HallowedWandLeperGnome: - spellId = female ? SpellIds.LeperGnomeCostumeFemale : SpellIds.LeperGnomeCostumeMale; - break; - case SpellIds.HallowedWandPirate: - spellId = female ? SpellIds.PirateCostumeFemale : SpellIds.PirateCostumeMale; - break; - case SpellIds.HallowedWandGhost: - spellId = female ? SpellIds.GhostCostumeFemale : SpellIds.GhostCostumeMale; - break; - case SpellIds.HallowedWandNinja: - spellId = female ? SpellIds.NinjaCostumeFemale : SpellIds.NinjaCostumeMale; - break; - case SpellIds.HallowedWandRandom: - spellId = RandomHelper.RAND(SpellIds.HallowedWandPirate, SpellIds.HallowedWandNinja, SpellIds.HallowedWandLeperGnome, SpellIds.HallowedWandSkeleton, SpellIds.HallowedWandWisp, SpellIds.HallowedWandGhost, SpellIds.HallowedWandBat); - break; - default: - return; - } - caster.CastSpell(target, spellId, true); + SpellIds.HallowedWandLeperGnome => gender == Gender.Female ? SpellIds.LeperGnomeCostumeFemale : SpellIds.LeperGnomeCostumeMale, + SpellIds.HallowedWandPirate => gender == Gender.Female ? SpellIds.PirateCostumeFemale : SpellIds.PirateCostumeMale, + SpellIds.HallowedWandGhost => gender == Gender.Female ? SpellIds.GhostCostumeFemale : SpellIds.GhostCostumeMale, + SpellIds.HallowedWandNinja => gender == Gender.Female ? SpellIds.NinjaCostumeFemale : SpellIds.NinjaCostumeMale, + SpellIds.HallowedWandRandom => RandomHelper.RAND(SpellIds.HallowedWandPirate, SpellIds.HallowedWandNinja, SpellIds.HallowedWandLeperGnome, SpellIds.HallowedWandSkeleton, SpellIds.HallowedWandWisp, SpellIds.HallowedWandGhost, SpellIds.HallowedWandBat), + _ => 0 + }; + + if (spellId != 0) + caster.CastSpell(target, spellId, true); } public override void Register() { - AfterHit.Add(new HitHandler(HandleScriptEffect)); + AfterHit.Add(new(HandleScriptEffect)); } } -} +} \ No newline at end of file diff --git a/Source/Scripts/Events/LoveIsInTheAir.cs b/Source/Scripts/Events/LoveIsInTheAir.cs index 82a61980e..ad5309acd 100644 --- a/Source/Scripts/Events/LoveIsInTheAir.cs +++ b/Source/Scripts/Events/LoveIsInTheAir.cs @@ -1,4 +1,4 @@ -// Copyright (c) CypherCore All rights reserved. +// 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; @@ -10,53 +10,26 @@ using System.Collections.Generic; namespace Scripts.Events.LoveIsInTheAir { - struct SpellIds - { - //Romantic Picnic - public const uint BasketCheck = 45119; // Holiday - Valentine - Romantic Picnic Near Basket Check - public const uint MealPeriodic = 45103; // Holiday - Valentine - Romantic Picnic Meal Periodic - Effect Dummy - public const uint MealEatVisual = 45120; // Holiday - Valentine - Romantic Picnic Meal Eat Visual - //public const uint MealParticle = 45114; // Holiday - Valentine - Romantic Picnic Meal Particle - Unused - public const uint DrinkVisual = 45121; // Holiday - Valentine - Romantic Picnic Drink Visual - public const uint RomanticPicnicAchiev = 45123; // Romantic Picnic Periodic = 5000 - - //CreateHeartCandy - public const uint CreateHeartCandy1 = 26668; - public const uint CreateHeartCandy2 = 26670; - public const uint CreateHeartCandy3 = 26671; - public const uint CreateHeartCandy4 = 26672; - public const uint CreateHeartCandy5 = 26673; - public const uint CreateHeartCandy6 = 26674; - public const uint CreateHeartCandy7 = 26675; - public const uint CreateHeartCandy8 = 26676; - - //SomethingStinks - public const uint HeavilyPerfumed = 71507; - - //PilferingPerfume - public const uint ServiceUniform = 71450; - } - - struct ModelIds - { - //PilferingPerfume - public const uint GoblinMale = 31002; - public const uint GoblinFemale = 31003; - } - - [Script] // 45102 Romantic Picnic + [Script] // 45102 - Romantic Picnic class spell_love_is_in_the_air_romantic_picnic : AuraScript { + const uint SpellBasketCheck = 45119; // Holiday - Valentine - Romantic Picnic Near Basket Check + const uint SpellMealPeriodic = 45103; // Holiday - Valentine - Romantic Picnic Meal Periodic - effect dummy + const uint SpellMealEatVisual = 45120; // Holiday - Valentine - Romantic Picnic Meal Eat Visual + // const uint SpellMealParticle = 45114; // Holiday - Valentine - Romantic Picnic Meal Particle - unused + const uint SpellDrinkVisual = 45121; // Holiday - Valentine - Romantic Picnic Drink Visual + const uint SpellRomanticPicnicAchiev = 45123; // Romantic Picnic periodic = 5000 + public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.BasketCheck, SpellIds.MealPeriodic, SpellIds.MealEatVisual, SpellIds.DrinkVisual, SpellIds.RomanticPicnicAchiev); + return ValidateSpellInfo(SpellBasketCheck, SpellMealPeriodic, SpellMealEatVisual, SpellDrinkVisual, SpellRomanticPicnicAchiev); } void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode) { Unit target = GetTarget(); target.SetStandState(UnitStandStateType.Sit); - target.CastSpell(target, SpellIds.MealPeriodic); + target.CastSpell(target, SpellMealPeriodic); } void OnPeriodic(AuraEffect aurEff) @@ -67,51 +40,50 @@ namespace Scripts.Events.LoveIsInTheAir // If our player is no longer sit, Remove all auras if (target.GetStandState() != UnitStandStateType.Sit) { - target.RemoveAura(SpellIds.RomanticPicnicAchiev); + target.RemoveAurasDueToSpell(SpellRomanticPicnicAchiev); target.RemoveAura(GetAura()); return; } - target.CastSpell(target, SpellIds.BasketCheck); // unknown use, it targets Romantic Basket - target.CastSpell(target, RandomHelper.RAND(SpellIds.MealEatVisual, SpellIds.DrinkVisual)); + target.CastSpell(target, SpellBasketCheck); // unknown use, it targets Romantic Basket + target.CastSpell(target, RandomHelper.RAND(SpellMealEatVisual, SpellDrinkVisual)); bool foundSomeone = false; // For nearby players, check if they have the same aura. If so, cast Romantic Picnic (45123) // required by achievement and "hearts" visual List playerList = new(); AnyPlayerInObjectRangeCheck checker = new(target, SharedConst.InteractionDistance * 2); - var searcher = new PlayerListSearcher(target, playerList, checker); + PlayerListSearcher searcher = new(target, playerList, checker); Cell.VisitWorldObjects(target, searcher, SharedConst.InteractionDistance * 2); - foreach (Player playerFound in playerList) + foreach (var playerFound in playerList) { - if (target != playerFound && playerFound.HasAura(GetId())) + if (playerFound != null) { - playerFound.CastSpell(playerFound, SpellIds.RomanticPicnicAchiev, true); - target.CastSpell(target, SpellIds.RomanticPicnicAchiev, true); - foundSomeone = true; - break; + if (target != playerFound && playerFound.HasAura(GetId())) + { + playerFound.CastSpell(playerFound, SpellRomanticPicnicAchiev, true); + target.CastSpell(target, SpellRomanticPicnicAchiev, true); + foundSomeone = true; + break; + } } } - if (!foundSomeone && target.HasAura(SpellIds.RomanticPicnicAchiev)) - target.RemoveAura(SpellIds.RomanticPicnicAchiev); + if (!foundSomeone && target.HasAura(SpellRomanticPicnicAchiev)) + target.RemoveAurasDueToSpell(SpellRomanticPicnicAchiev); } public override void Register() { - AfterEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.Real)); - OnEffectPeriodic.Add(new EffectPeriodicHandler(OnPeriodic, 0, AuraType.PeriodicDummy)); + AfterEffectApply.Add(new(OnApply, 0, AuraType.PeriodicDummy, AuraEffectHandleModes.Real)); + OnEffectPeriodic.Add(new(OnPeriodic, 0, AuraType.PeriodicDummy)); } } [Script] // 26678 - Create Heart Candy class spell_love_is_in_the_air_create_heart_candy : SpellScript { - uint[] CreateHeartCandySpells = - { - SpellIds.CreateHeartCandy1, SpellIds.CreateHeartCandy2, SpellIds.CreateHeartCandy3, SpellIds.CreateHeartCandy4, - SpellIds.CreateHeartCandy5, SpellIds.CreateHeartCandy6, SpellIds.CreateHeartCandy7, SpellIds.CreateHeartCandy8 - }; + uint[] CreateHeartCandySpells = { 26668, 26670, 26671, 26672, 26673, 26674, 26675, 26676 }; public override bool Validate(SpellInfo spellInfo) { @@ -120,15 +92,12 @@ namespace Scripts.Events.LoveIsInTheAir void HandleScript(uint effIndex) { - PreventHitDefaultEffect(effIndex); - Player target = GetHitPlayer(); - if (target != null) - target.CastSpell(target, CreateHeartCandySpells.SelectRandom(), true); + GetCaster().CastSpell(GetCaster(), CreateHeartCandySpells.SelectRandom()); } public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); + OnEffectHit.Add(new(HandleScript, 0, SpellEffectName.ScriptEffect)); } } @@ -147,7 +116,7 @@ namespace Scripts.Events.LoveIsInTheAir public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); + OnEffectHitTarget.Add(new(HandleScript, 0, SpellEffectName.ScriptEffect)); } } @@ -166,30 +135,33 @@ namespace Scripts.Events.LoveIsInTheAir public override void Register() { - AfterEffectRemove.Add(new EffectApplyHandler(AfterRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + AfterEffectRemove.Add(new(AfterRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); } } [Script] // 71508 - Recently Analyzed class spell_love_is_in_the_air_recently_analyzed : AuraScript { + const uint SpellHeavilyPerfumed = 71507; + public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.HeavilyPerfumed); + return ValidateSpellInfo(SpellHeavilyPerfumed); } void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode) { if (GetTargetApplication().GetRemoveMode() == AuraRemoveMode.Expire) - GetTarget().CastSpell(GetTarget(), SpellIds.HeavilyPerfumed); + GetTarget().CastSpell(GetTarget(), SpellHeavilyPerfumed); } public override void Register() { - AfterEffectRemove.Add(new EffectApplyHandler(AfterRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + AfterEffectRemove.Add(new(AfterRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); } } + [Script] // 69438 - Sample Satisfaction class spell_love_is_in_the_air_sample_satisfaction : AuraScript { @@ -201,13 +173,16 @@ namespace Scripts.Events.LoveIsInTheAir public override void Register() { - OnEffectPeriodic.Add(new EffectPeriodicHandler(OnPeriodic, 0, AuraType.PeriodicDummy)); + OnEffectPeriodic.Add(new(OnPeriodic, 0, AuraType.PeriodicDummy)); } } [Script] // 71450 - Crown Parcel Service Uniform class spell_love_is_in_the_air_service_uniform : AuraScript { + const uint ModelGoblinMale = 31002; + const uint ModelGoblinFemale = 31003; + public override bool Validate(SpellInfo spellInfo) { return ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue()); @@ -219,9 +194,9 @@ namespace Scripts.Events.LoveIsInTheAir if (target.IsPlayer()) { if (target.GetNativeGender() == Gender.Male) - target.SetDisplayId(ModelIds.GoblinMale); + target.SetDisplayId(ModelGoblinMale); else - target.SetDisplayId(ModelIds.GoblinFemale); + target.SetDisplayId(ModelGoblinFemale); } } @@ -232,8 +207,8 @@ namespace Scripts.Events.LoveIsInTheAir public override void Register() { - AfterEffectApply.Add(new EffectApplyHandler(AfterApply, 0, AuraType.Transform, AuraEffectHandleModes.Real)); - AfterEffectRemove.Add(new EffectApplyHandler(AfterRemove, 0, AuraType.Transform, AuraEffectHandleModes.Real)); + AfterEffectApply.Add(new(AfterApply, 0, AuraType.Transform, AuraEffectHandleModes.Real)); + AfterEffectRemove.Add(new(AfterRemove, 0, AuraType.Transform, AuraEffectHandleModes.Real)); } } @@ -241,22 +216,25 @@ namespace Scripts.Events.LoveIsInTheAir [Script] // 71539 - Crown Chemical Co. Supplies class spell_love_is_in_the_air_cancel_service_uniform : SpellScript { + const uint SpellServiceUniform = 71450; + public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.ServiceUniform); + return ValidateSpellInfo(SpellServiceUniform); } void HandleScript(uint effIndex) { - GetHitUnit().RemoveAurasDueToSpell(SpellIds.ServiceUniform); + GetHitUnit().RemoveAurasDueToSpell(SpellServiceUniform); } public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 1, SpellEffectName.ScriptEffect)); + OnEffectHitTarget.Add(new(HandleScript, 1, SpellEffectName.ScriptEffect)); } } + // 68529 - Perfume Immune [Script] // 68530 - Cologne Immune class spell_love_is_in_the_air_perfume_cologne_immune : SpellScript @@ -273,8 +251,8 @@ namespace Scripts.Events.LoveIsInTheAir public override void Register() { - OnEffectHit.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); - OnEffectHit.Add(new EffectHandler(HandleScript, 1, SpellEffectName.ScriptEffect)); + OnEffectHit.Add(new(HandleScript, 0, SpellEffectName.ScriptEffect)); + OnEffectHit.Add(new(HandleScript, 1, SpellEffectName.ScriptEffect)); } } -} +} \ No newline at end of file diff --git a/Source/Scripts/Events/LunarFestival.cs b/Source/Scripts/Events/LunarFestival.cs index 77051176a..4061bb53a 100644 --- a/Source/Scripts/Events/LunarFestival.cs +++ b/Source/Scripts/Events/LunarFestival.cs @@ -1,4 +1,4 @@ -// Copyright (c) CypherCore All rights reserved. +// 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; @@ -8,44 +8,12 @@ using Game.Scripting; using Game.Spells; using System; using System.Numerics; +using static Global; namespace Scripts.Events.LunarFestival { - struct SpellIds - { - //Fireworks - public const uint RocketBlue = 26344; - public const uint RocketGreen = 26345; - public const uint RocketPurple = 26346; - public const uint RocketRed = 26347; - public const uint RocketWhite = 26348; - public const uint RocketYellow = 26349; - public const uint RocketBigBlue = 26351; - public const uint RocketBigGreen = 26352; - public const uint RocketBigPurple = 26353; - public const uint RocketBigRed = 26354; - public const uint RocketBigWhite = 26355; - public const uint RocketBigYellow = 26356; - public const uint LunarFortune = 26522; - - //Omen - public const uint OmenCleave = 15284; - public const uint OmenStarfall = 26540; - public const uint OmenSummonSpotlight = 26392; - public const uint EluneCandle = 26374; - - //EluneCandle - public const uint EluneCandleOmenHead = 26622; - public const uint EluneCandleOmenChest = 26624; - public const uint EluneCandleOmenHandR = 26625; - public const uint EluneCandleOmenHandL = 26649; - public const uint EluneCandleNormal = 26636; - - } - struct CreatureIds { - //Fireworks public const uint Omen = 15467; public const uint MinionOfOmen = 15466; public const uint FireworkBlue = 15879; @@ -78,7 +46,6 @@ namespace Scripts.Events.LunarFestival struct GameObjectIds { - //Fireworks public const uint FireworkLauncher1 = 180771; public const uint FireworkLauncher2 = 180868; public const uint FireworkLauncher3 = 180850; @@ -86,25 +53,36 @@ namespace Scripts.Events.LunarFestival public const uint ClusterLauncher2 = 180859; public const uint ClusterLauncher3 = 180869; public const uint ClusterLauncher4 = 180874; - - //Omen - public const uint EluneTrap1 = 180876; - public const uint EluneTrap2 = 180877; } - struct MiscConst + struct SpellIds + { + public const uint RocketBlue = 26344; + public const uint RocketGreen = 26345; + public const uint RocketPurple = 26346; + public const uint RocketRed = 26347; + public const uint RocketWhite = 26348; + public const uint RocketYellow = 26349; + public const uint RocketBigBlue = 26351; + public const uint RocketBigGreen = 26352; + public const uint RocketBigPurple = 26353; + public const uint RocketBigRed = 26354; + public const uint RocketBigWhite = 26355; + public const uint RocketBigYellow = 26356; + public const uint LunarFortune = 26522; + } + + struct Misc { - //Fireworks public const uint AnimGoLaunchFirework = 3; public const uint ZoneMoonglade = 493; - - //Omen - public static Position OmenSummonPos = new(7558.993f, -2839.999f, 450.0214f, 4.46f); } [Script] class npc_firework : ScriptedAI { + Position omenSummonPos = new(7558.993f, -2839.999f, 450.0214f, 4.46f); + public npc_firework(Creature creature) : base(creature) { } bool isCluster() @@ -153,13 +131,13 @@ namespace Scripts.Events.LunarFestival GameObject launcher3 = GetClosestGameObjectWithEntry(me, GameObjectIds.ClusterLauncher3, 0.5f); GameObject launcher4 = GetClosestGameObjectWithEntry(me, GameObjectIds.ClusterLauncher4, 0.5f); - if (launcher1) + if (launcher1 != null) launcher = launcher1; - else if (launcher2) + else if (launcher2 != null) launcher = launcher2; - else if (launcher3) + else if (launcher3 != null) launcher = launcher3; - else if (launcher4) + else if (launcher4 != null) launcher = launcher4; } else @@ -168,11 +146,11 @@ namespace Scripts.Events.LunarFestival GameObject launcher2 = GetClosestGameObjectWithEntry(me, GameObjectIds.FireworkLauncher2, 0.5f); GameObject launcher3 = GetClosestGameObjectWithEntry(me, GameObjectIds.FireworkLauncher3, 0.5f); - if (launcher1) + if (launcher1 != null) launcher = launcher1; - else if (launcher2) + else if (launcher2 != null) launcher = launcher2; - else if (launcher3) + else if (launcher3 != null) launcher = launcher3; } @@ -259,7 +237,7 @@ namespace Scripts.Events.LunarFestival break; } - SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None); + SpellInfo spellInfo = SpellMgr.GetSpellInfo(spellId, Difficulty.None); if (spellInfo != null && spellInfo.GetEffect(0).Effect == SpellEffectName.SummonObjectWild) return (uint)spellInfo.GetEffect(0).MiscValue; @@ -270,10 +248,10 @@ namespace Scripts.Events.LunarFestival public override void Reset() { GameObject launcher = FindNearestLauncher(); - if (launcher) + if (launcher != null) { - launcher.SendCustomAnim(MiscConst.AnimGoLaunchFirework); - me.SetOrientation(launcher.GetOrientation() + MathF.PI / 2); + launcher.SendCustomAnim(Misc.AnimGoLaunchFirework); + me.SetOrientation(launcher.GetOrientation() + (float)(MathF.PI) / 2); } else return; @@ -281,9 +259,9 @@ namespace Scripts.Events.LunarFestival if (isCluster()) { // Check if we are near Elune'ara lake south, if so try to summon Omen or a minion - if (me.GetZoneId() == MiscConst.ZoneMoonglade) + if (me.GetZoneId() == Misc.ZoneMoonglade) { - if (!me.FindNearestCreature(CreatureIds.Omen, 100.0f) && me.GetDistance2d(MiscConst.OmenSummonPos.GetPositionX(), MiscConst.OmenSummonPos.GetPositionY()) <= 100.0f) + if (me.FindNearestCreature(CreatureIds.Omen, 100.0f) == null && me.GetDistance2d(omenSummonPos.GetPositionX(), omenSummonPos.GetPositionY()) <= 100.0f) { switch (RandomHelper.URand(0, 9)) { @@ -292,11 +270,11 @@ namespace Scripts.Events.LunarFestival case 2: case 3: Creature minion = me.SummonCreature(CreatureIds.MinionOfOmen, me.GetPositionX() + RandomHelper.FRand(-5.0f, 5.0f), me.GetPositionY() + RandomHelper.FRand(-5.0f, 5.0f), me.GetPositionZ(), 0.0f, TempSummonType.CorpseTimedDespawn, TimeSpan.FromSeconds(20)); - if (minion) + if (minion != null) minion.GetAI().AttackStart(me.SelectNearestPlayer(20.0f)); break; case 9: - me.SummonCreature(CreatureIds.Omen, MiscConst.OmenSummonPos); + me.SummonCreature(CreatureIds.Omen, omenSummonPos); break; } } @@ -310,13 +288,18 @@ namespace Scripts.Events.LunarFestival } else //me.CastSpell(me, GetFireworkSpell(me.GetEntry()), true); - me.CastSpell(me.GetPosition(), GetFireworkSpell(me.GetEntry()), new CastSpellExtraArgs(true)); + me.CastSpell(me.GetPosition(), GetFireworkSpell(me.GetEntry()), true); } } [Script] class npc_omen : ScriptedAI { + const uint SpellOmenCleave = 15284; + const uint SpellOmenStarfall = 26540; + const uint SpellOmenSummonSpotlight = 26392; + const uint SpellEluneCandle = 26374; + public npc_omen(Creature creature) : base(creature) { me.SetImmuneToPC(true); @@ -333,7 +316,7 @@ namespace Scripts.Events.LunarFestival me.SetHomePosition(me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), me.GetOrientation()); me.SetImmuneToPC(false); Player player = me.SelectNearestPlayer(40.0f); - if (player) + if (player != null) AttackStart(player); } } @@ -341,31 +324,33 @@ namespace Scripts.Events.LunarFestival public override void JustEngagedWith(Unit attacker) { _scheduler.CancelAll(); + _scheduler.Schedule(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(5), task => { - DoCastVictim(SpellIds.OmenCleave); + DoCastVictim(SpellOmenCleave); task.Repeat(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(10)); }); + _scheduler.Schedule(TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(10), 1, task => { Unit target = SelectTarget(SelectTargetMethod.Random, 0); - if (target) - DoCast(target, SpellIds.OmenStarfall); + if (target != null) + DoCast(target, SpellOmenStarfall); task.Repeat(TimeSpan.FromSeconds(14), TimeSpan.FromSeconds(16)); }); } public override void JustDied(Unit killer) { - DoCast(SpellIds.OmenSummonSpotlight); + DoCast(SpellOmenSummonSpotlight); } public override void SpellHit(WorldObject caster, SpellInfo spellInfo) { - if (spellInfo.Id == SpellIds.EluneCandle) + if (spellInfo.Id == SpellEluneCandle) { - if (me.HasAura(SpellIds.OmenStarfall)) - me.RemoveAurasDueToSpell(SpellIds.OmenStarfall); + if (me.HasAura(SpellOmenStarfall)) + me.RemoveAurasDueToSpell(SpellOmenStarfall); _scheduler.RescheduleGroup(1, TimeSpan.FromSeconds(14), TimeSpan.FromSeconds(16)); } @@ -376,32 +361,33 @@ namespace Scripts.Events.LunarFestival if (!UpdateVictim()) return; - _scheduler.Update(diff); - - DoMeleeAttackIfReady(); + _scheduler.Update(diff, DoMeleeAttackIfReady); } } [Script] class npc_giant_spotlight : ScriptedAI { + const uint GoEluneTrap1 = 180876; + const uint GoEluneTrap2 = 180877; + public npc_giant_spotlight(Creature creature) : base(creature) { } public override void Reset() { _scheduler.CancelAll(); - _scheduler.Schedule(TimeSpan.FromMinutes(5), task => + _scheduler.Schedule(TimeSpan.FromMinutes(5), _ => { - GameObject trap = me.FindNearestGameObject(GameObjectIds.EluneTrap1, 5.0f); - if (trap) + GameObject trap = me.FindNearestGameObject(GoEluneTrap1, 5.0f); + if (trap != null) trap.RemoveFromWorld(); - trap = me.FindNearestGameObject(GameObjectIds.EluneTrap2, 5.0f); - if (trap) + trap = me.FindNearestGameObject(GoEluneTrap2, 5.0f); + if (trap != null) trap.RemoveFromWorld(); Creature omen = me.FindNearestCreature(CreatureIds.Omen, 5.0f, false); - if (omen) + if (omen != null) omen.DespawnOrUnsummon(); me.DespawnOrUnsummon(); @@ -417,9 +403,20 @@ namespace Scripts.Events.LunarFestival [Script] // 26374 - Elune's Candle class spell_lunar_festival_elune_candle : SpellScript { + const uint SpellEluneCandleOmenHead = 26622; + const uint SpellEluneCandleOmenChest = 26624; + const uint SpellEluneCandleOmenHandR = 26625; + const uint SpellEluneCandleOmenHandL = 26649; + const uint SpellEluneCandleNormal = 26636; + public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.EluneCandleOmenHead, SpellIds.EluneCandleOmenChest, SpellIds.EluneCandleOmenHandR, SpellIds.EluneCandleOmenHandL, SpellIds.EluneCandleNormal); + return ValidateSpellInfo(SpellEluneCandleOmenHead, + SpellEluneCandleOmenChest, + SpellEluneCandleOmenHandR, + SpellEluneCandleOmenHandL, + SpellEluneCandleNormal + ); } void HandleScript(uint effIndex) @@ -431,28 +428,28 @@ namespace Scripts.Events.LunarFestival switch (RandomHelper.URand(0, 3)) { case 0: - spellId = SpellIds.EluneCandleOmenHead; + spellId = SpellEluneCandleOmenHead; break; case 1: - spellId = SpellIds.EluneCandleOmenChest; + spellId = SpellEluneCandleOmenChest; break; case 2: - spellId = SpellIds.EluneCandleOmenHandR; + spellId = SpellEluneCandleOmenHandR; break; case 3: - spellId = SpellIds.EluneCandleOmenHandL; + spellId = SpellEluneCandleOmenHandL; break; } } else - spellId = SpellIds.EluneCandleNormal; + spellId = SpellEluneCandleNormal; GetCaster().CastSpell(GetHitUnit(), spellId, true); } public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.Dummy)); + OnEffectHitTarget.Add(new(HandleScript, 0, SpellEffectName.Dummy)); } } -} +} \ No newline at end of file diff --git a/Source/Scripts/Events/Midsummer.cs b/Source/Scripts/Events/Midsummer.cs index bbb471c6a..fd37d30e3 100644 --- a/Source/Scripts/Events/Midsummer.cs +++ b/Source/Scripts/Events/Midsummer.cs @@ -1,4 +1,4 @@ -// Copyright (c) CypherCore All rights reserved. +// 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; @@ -8,194 +8,182 @@ using Game.Spells; using System; using System.Collections.Generic; -namespace Scripts.Events.Midsummer +namespace Scripts.Events { - struct SpellIds - { - //Brazierhit - public const uint TorchTossingTraining = 45716; - public const uint TorchTossingPractice = 46630; - public const uint TorchTossingTrainingSuccessAlliance = 45719; - public const uint TorchTossingTrainingSuccessHorde = 46651; - public const uint TargetIndicatorCosmetic = 46901; - public const uint TargetIndicator = 45723; - public const uint BraziersHit = 45724; - - //RibbonPoleData - public const uint HasFullMidsummerSet = 58933; - public const uint BurningHotPoleDance = 58934; - public const uint RibbonPolePeriodicVisual = 45406; - public const uint RibbonDance = 29175; - public const uint TestRibbonPole1 = 29705; - public const uint TestRibbonPole2 = 29726; - public const uint TestRibbonPole3 = 29727; - - //Jugglingtorch - public const uint JuggleTorchSlow = 45792; - public const uint JuggleTorchMedium = 45806; - public const uint JuggleTorchFast = 45816; - public const uint JuggleTorchSelf = 45638; - public const uint JuggleTorchShadowSlow = 46120; - public const uint JuggleTorchShadowMedium = 46118; - public const uint JuggleTorchShadowFast = 46117; - public const uint JuggleTorchShadowSelf = 46121; - public const uint GiveTorch = 45280; - - //Flingtorch - public const uint FlingTorchTriggered = 45669; - public const uint FlingTorchShadow = 46105; - public const uint JuggleTorchMissed = 45676; - public const uint TorchesCaught = 45693; - public const uint TorchCatchingSuccessAlliance = 46081; - public const uint TorchCatchingSuccessHorde = 46654; - public const uint TorchCatchingRemoveTorches = 46084; - } - - struct QuestIds - { - //JugglingTorch - public const uint TorchCatchingA = 11657; - public const uint TorchCatchingH = 11923; - public const uint MoreTorchCatchingA = 11924; - public const uint MoreTorchCatchingH = 11925; - } - [Script] // 45724 - Braziers Hit! class spell_midsummer_braziers_hit : AuraScript { + const uint SpellTorchTossingTraining = 45716; + const uint SpellTorchTossingPractice = 46630; + const uint SpellTorchTossingTrainingSuccessAlliance = 45719; + const uint SpellTorchTossingTrainingSuccessHorde = 46651; + public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.TorchTossingTraining, SpellIds.TorchTossingPractice); + return ValidateSpellInfo(SpellTorchTossingTraining, SpellTorchTossingPractice, SpellTorchTossingTrainingSuccessAlliance, SpellTorchTossingTrainingSuccessHorde); } void HandleEffectApply(AuraEffect aurEff, AuraEffectHandleModes mode) { Player player = GetTarget().ToPlayer(); - if (!player) + if (player == null) return; - if ((player.HasAura(SpellIds.TorchTossingTraining) && GetStackAmount() == 8) || (player.HasAura(SpellIds.TorchTossingPractice) && GetStackAmount() == 20)) + if ((player.HasAura(SpellTorchTossingTraining) && GetStackAmount() == 8) || (player.HasAura(SpellTorchTossingPractice) && GetStackAmount() == 20)) { if (player.GetTeam() == Team.Alliance) - player.CastSpell(player, SpellIds.TorchTossingTrainingSuccessAlliance, true); + player.CastSpell(player, SpellTorchTossingTrainingSuccessAlliance, true); else if (player.GetTeam() == Team.Horde) - player.CastSpell(player, SpellIds.TorchTossingTrainingSuccessHorde, true); + player.CastSpell(player, SpellTorchTossingTrainingSuccessHorde, true); Remove(); } } public override void Register() { - AfterEffectApply.Add(new EffectApplyHandler(HandleEffectApply, 0, AuraType.Dummy, AuraEffectHandleModes.Reapply)); + AfterEffectApply.Add(new(HandleEffectApply, 0, AuraType.Dummy, AuraEffectHandleModes.Reapply)); } } [Script] // 45907 - Torch Target Picker class spell_midsummer_torch_target_picker : SpellScript { + const uint SpellTargetIndicatorCosmetic = 46901; + const uint SpellTargetIndicator = 45723; + public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.TargetIndicatorCosmetic, SpellIds.TargetIndicator); + return ValidateSpellInfo(SpellTargetIndicatorCosmetic, SpellTargetIndicator); } void HandleScript(uint effIndex) { Unit target = GetHitUnit(); - target.CastSpell(target, SpellIds.TargetIndicatorCosmetic, true); - target.CastSpell(target, SpellIds.TargetIndicator, true); + target.CastSpell(target, SpellTargetIndicatorCosmetic, true); + target.CastSpell(target, SpellTargetIndicator, true); } public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.Dummy)); + OnEffectHitTarget.Add(new(HandleScript, 0, SpellEffectName.Dummy)); } } [Script] // 46054 - Torch Toss (land) class spell_midsummer_torch_toss_land : SpellScript { + const uint SpellBraziersHit = 45724; + public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.BraziersHit); + return ValidateSpellInfo(SpellBraziersHit); } void HandleScript(uint effIndex) { - GetHitUnit().CastSpell(GetCaster(), SpellIds.BraziersHit, true); + GetHitUnit().CastSpell(GetCaster(), SpellBraziersHit, true); } public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); + OnEffectHitTarget.Add(new(HandleScript, 0, SpellEffectName.ScriptEffect)); } } [Script] // 29705, 29726, 29727 - Test Ribbon Pole Channel class spell_midsummer_test_ribbon_pole_channel : AuraScript { + const uint SpellHasFullMidsummerSet = 58933; + const uint SpellBurningHotPoleDance = 58934; + const uint SpellRibbonPolePeriodicVisual = 45406; + const uint SpellRibbonDance = 29175; + public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.RibbonPolePeriodicVisual, SpellIds.BurningHotPoleDance, SpellIds.HasFullMidsummerSet, SpellIds.RibbonDance); + return ValidateSpellInfo(SpellRibbonPolePeriodicVisual, SpellBurningHotPoleDance, SpellHasFullMidsummerSet, SpellRibbonDance); } void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode) { - GetTarget().RemoveAurasDueToSpell(SpellIds.RibbonPolePeriodicVisual); + GetTarget().RemoveAurasDueToSpell(SpellRibbonPolePeriodicVisual); } void PeriodicTick(AuraEffect aurEff) { Unit target = GetTarget(); - target.CastSpell(target, SpellIds.RibbonPolePeriodicVisual, true); + target.CastSpell(target, SpellRibbonPolePeriodicVisual, true); - Aura aur = target.GetAura(SpellIds.RibbonDance); + Aura aur = target.GetAura(SpellRibbonDance); if (aur != null) { aur.SetMaxDuration(Math.Min(3600000, aur.GetMaxDuration() + 180000)); aur.RefreshDuration(); - if (aur.GetMaxDuration() == 3600000 && target.HasAura(SpellIds.HasFullMidsummerSet)) - target.CastSpell(target, SpellIds.BurningHotPoleDance, true); + if (aur.GetMaxDuration() == 3600000 && target.HasAura(SpellHasFullMidsummerSet)) + target.CastSpell(target, SpellBurningHotPoleDance, true); } else - target.CastSpell(target, SpellIds.RibbonDance, true); + target.CastSpell(target, SpellRibbonDance, true); } public override void Register() { - AfterEffectRemove.Add(new EffectApplyHandler(HandleRemove, 1, AuraType.PeriodicTriggerSpell, AuraEffectHandleModes.Real)); - OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 1, AuraType.PeriodicTriggerSpell)); + AfterEffectRemove.Add(new(HandleRemove, 1, AuraType.PeriodicTriggerSpell, AuraEffectHandleModes.Real)); + OnEffectPeriodic.Add(new(PeriodicTick, 1, AuraType.PeriodicTriggerSpell)); } } [Script] // 45406 - Holiday - Midsummer, Ribbon Pole Periodic Visual class spell_midsummer_ribbon_pole_periodic_visual : AuraScript { + const uint SpellTestRibbonPole1 = 29705; + const uint SpellTestRibbonPole2 = 29726; + const uint SpellTestRibbonPole3 = 29727; + public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.TestRibbonPole1, SpellIds.TestRibbonPole2, SpellIds.TestRibbonPole3); + return ValidateSpellInfo(SpellTestRibbonPole1, SpellTestRibbonPole2, SpellTestRibbonPole3); } void PeriodicTick(AuraEffect aurEff) { Unit target = GetTarget(); - if (!target.HasAura(SpellIds.TestRibbonPole1) && !target.HasAura(SpellIds.TestRibbonPole2) && !target.HasAura(SpellIds.TestRibbonPole3)) + if (!target.HasAura(SpellTestRibbonPole1) && !target.HasAura(SpellTestRibbonPole2) && !target.HasAura(SpellTestRibbonPole3)) Remove(); } public override void Register() { - OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 0, AuraType.PeriodicDummy)); + OnEffectPeriodic.Add(new(PeriodicTick, 0, AuraType.PeriodicDummy)); } } + struct JugglingTorch + { + public const uint SpellJuggleTorchSlow = 45792; + public const uint SpellJuggleTorchMedium = 45806; + public const uint SpellJuggleTorchFast = 45816; + public const uint SpellJuggleTorchSelf = 45638; + + public const uint SpellJuggleTorchShadowSlow = 46120; + public const uint SpellJuggleTorchShadowMedium = 46118; + public const uint SpellJuggleTorchShadowFast = 46117; + public const uint SpellJuggleTorchShadowSelf = 46121; + public const uint SpellGiveTorch = 45280; + + public const uint QuestTorchCatchingA = 11657; + public const uint QuestTorchCatchingH = 11923; + public const uint QuestMoreTorchCatchingA = 11924; + public const uint QuestMoreTorchCatchingH = 11925; + } + [Script] // 45819 - Throw Torch class spell_midsummer_juggle_torch : SpellScript { public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.JuggleTorchSlow, SpellIds.JuggleTorchMedium, SpellIds.JuggleTorchFast, SpellIds.JuggleTorchSelf, - SpellIds.JuggleTorchShadowSlow, SpellIds.JuggleTorchShadowMedium, SpellIds.JuggleTorchShadowFast, SpellIds.JuggleTorchShadowSelf); + return ValidateSpellInfo(JugglingTorch.SpellJuggleTorchSlow, JugglingTorch.SpellJuggleTorchMedium, JugglingTorch.SpellJuggleTorchFast, JugglingTorch.SpellJuggleTorchSelf, + JugglingTorch.SpellJuggleTorchShadowSlow, JugglingTorch.SpellJuggleTorchShadowMedium, JugglingTorch.SpellJuggleTorchShadowFast, JugglingTorch.SpellJuggleTorchShadowSelf); } void HandleDummy(uint effIndex) @@ -206,38 +194,38 @@ namespace Scripts.Events.Midsummer Position spellDest = GetExplTargetDest(); float distance = GetCaster().GetExactDist2d(spellDest.GetPositionX(), spellDest.GetPositionY()); - uint torchSpellID = 0; - uint torchShadowSpellID = 0; + uint torchSpellID; + uint torchShadowSpellID; if (distance <= 1.5f) { - torchSpellID = SpellIds.JuggleTorchSelf; - torchShadowSpellID = SpellIds.JuggleTorchShadowSelf; + torchSpellID = JugglingTorch.SpellJuggleTorchSelf; + torchShadowSpellID = JugglingTorch.SpellJuggleTorchShadowSelf; spellDest = GetCaster().GetPosition(); } else if (distance <= 10.0f) { - torchSpellID = SpellIds.JuggleTorchSlow; - torchShadowSpellID = SpellIds.JuggleTorchShadowSlow; + torchSpellID = JugglingTorch.SpellJuggleTorchSlow; + torchShadowSpellID = JugglingTorch.SpellJuggleTorchShadowSlow; } else if (distance <= 20.0f) { - torchSpellID = SpellIds.JuggleTorchMedium; - torchShadowSpellID = SpellIds.JuggleTorchShadowMedium; + torchSpellID = JugglingTorch.SpellJuggleTorchMedium; + torchShadowSpellID = JugglingTorch.SpellJuggleTorchShadowMedium; } else { - torchSpellID = SpellIds.JuggleTorchFast; - torchShadowSpellID = SpellIds.JuggleTorchShadowFast; + torchSpellID = JugglingTorch.SpellJuggleTorchFast; + torchShadowSpellID = JugglingTorch.SpellJuggleTorchShadowFast; } - GetCaster().CastSpell(spellDest, torchSpellID, new CastSpellExtraArgs(false)); - GetCaster().CastSpell(spellDest, torchShadowSpellID, new CastSpellExtraArgs(false)); + GetCaster().CastSpell(spellDest, torchSpellID); + GetCaster().CastSpell(spellDest, torchShadowSpellID); } public override void Register() { - OnEffectHit.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); + OnEffectHit.Add(new(HandleDummy, 0, SpellEffectName.Dummy)); } } @@ -246,43 +234,56 @@ namespace Scripts.Events.Midsummer { public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.GiveTorch); + return ValidateSpellInfo(JugglingTorch.SpellGiveTorch); } void HandleDummy(uint effIndex) { Player player = GetHitPlayer(); - if (!player) + if (player == null) return; - if (player.GetQuestStatus(QuestIds.TorchCatchingA) == QuestStatus.Rewarded || player.GetQuestStatus(QuestIds.TorchCatchingH) == QuestStatus.Rewarded) - player.CastSpell(player, SpellIds.GiveTorch); + if (player.GetQuestStatus(JugglingTorch.QuestTorchCatchingA) == QuestStatus.Rewarded || player.GetQuestStatus(JugglingTorch.QuestTorchCatchingH) == QuestStatus.Rewarded) + player.CastSpell(player, JugglingTorch.SpellGiveTorch); } public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); + OnEffectHitTarget.Add(new(HandleDummy, 0, SpellEffectName.Dummy)); } } + struct FlingTorch + { + public const uint SpellFlingTorchTriggered = 45669; + public const uint SpellFlingTorchShadow = 46105; + public const uint SpellJuggleTorchMissed = 45676; + public const uint SpellTorchesCaught = 45693; + public const uint SpellTorchCatchingSuccessAlliance = 46081; + public const uint SpellTorchCatchingSuccessHorde = 46654; + public const uint SpellTorchCatchingRemoveTorches = 46084; + } + [Script] // 46747 - Fling torch class spell_midsummer_fling_torch : SpellScript { + + public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.FlingTorchTriggered, SpellIds.FlingTorchShadow); + return ValidateSpellInfo(FlingTorch.SpellFlingTorchTriggered, FlingTorch.SpellFlingTorchShadow); } void HandleDummy(uint effIndex) { - Position dest = GetCaster().GetFirstCollisionPosition(30.0f, (float)RandomHelper.NextDouble() * (2 * MathF.PI)); - GetCaster().CastSpell(dest, SpellIds.FlingTorchTriggered, new CastSpellExtraArgs(true)); - GetCaster().CastSpell(dest, SpellIds.FlingTorchShadow, new CastSpellExtraArgs(false)); + Position dest = GetCaster().GetFirstCollisionPosition(30.0f, (float)RandomHelper.NextDouble() * (float)(2 * MathF.PI)); + GetCaster().CastSpell(dest, FlingTorch.SpellFlingTorchTriggered, true); + GetCaster().CastSpell(dest, FlingTorch.SpellFlingTorchShadow); } public override void Register() { - OnEffectHit.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); + OnEffectHit.Add(new(HandleDummy, 0, SpellEffectName.Dummy)); } } @@ -291,26 +292,26 @@ namespace Scripts.Events.Midsummer { public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.JuggleTorchMissed); + return ValidateSpellInfo(FlingTorch.SpellJuggleTorchMissed); } void HandleTriggerMissile(uint effIndex) { Position pos = GetHitDest(); if (pos != null) - { + { if (GetCaster().GetExactDist2d(pos) > 3.0f) { PreventHitEffect(effIndex); - GetCaster().CastSpell(GetExplTargetDest(), SpellIds.JuggleTorchMissed, new CastSpellExtraArgs(false)); - GetCaster().RemoveAura(SpellIds.TorchesCaught); + GetCaster().CastSpell(GetExplTargetDest(), FlingTorch.SpellJuggleTorchMissed); + GetCaster().RemoveAura(FlingTorch.SpellTorchesCaught); } } } public override void Register() { - OnEffectHit.Add(new EffectHandler(HandleTriggerMissile, 0, SpellEffectName.TriggerMissile)); + OnEffectHit.Add(new(HandleTriggerMissile, 0, SpellEffectName.TriggerMissile)); } } @@ -319,13 +320,13 @@ namespace Scripts.Events.Midsummer { public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.FlingTorchTriggered, SpellIds.TorchCatchingSuccessAlliance, SpellIds.TorchCatchingSuccessHorde, SpellIds.TorchCatchingRemoveTorches, SpellIds.FlingTorchShadow); + return ValidateSpellInfo(FlingTorch.SpellFlingTorchTriggered, FlingTorch.SpellTorchCatchingSuccessAlliance, FlingTorch.SpellTorchCatchingSuccessHorde, FlingTorch.SpellTorchCatchingRemoveTorches, FlingTorch.SpellFlingTorchShadow); } void HandleScriptEffect(uint effIndex) { Player player = GetHitPlayer(); - if (!player) + if (player == null) return; if (GetExplTargetDest() == null) @@ -337,33 +338,33 @@ namespace Scripts.Events.Midsummer byte requiredCatches = 0; // Number of required catches depends on quest - 4 for the normal quest, 10 for the daily version - if (player.GetQuestStatus(QuestIds.TorchCatchingA) == QuestStatus.Incomplete || player.GetQuestStatus(QuestIds.TorchCatchingH) == QuestStatus.Incomplete) + if (player.GetQuestStatus(JugglingTorch.QuestTorchCatchingA) == QuestStatus.Incomplete || player.GetQuestStatus(JugglingTorch.QuestTorchCatchingH) == QuestStatus.Incomplete) requiredCatches = 3; - else if (player.GetQuestStatus(QuestIds.MoreTorchCatchingA) == QuestStatus.Incomplete || player.GetQuestStatus(QuestIds.MoreTorchCatchingH) == QuestStatus.Incomplete) + else if (player.GetQuestStatus(JugglingTorch.QuestMoreTorchCatchingA) == QuestStatus.Incomplete || player.GetQuestStatus(JugglingTorch.QuestMoreTorchCatchingH) == QuestStatus.Incomplete) requiredCatches = 9; // Used quest item without being on quest - do nothing if (requiredCatches == 0) return; - if (player.GetAuraCount(SpellIds.TorchesCaught) >= requiredCatches) + if (player.GetAuraCount(FlingTorch.SpellTorchesCaught) >= requiredCatches) { - player.CastSpell(player, (player.GetTeam() == Team.Alliance) ? SpellIds.TorchCatchingSuccessAlliance : SpellIds.TorchCatchingSuccessHorde); - player.CastSpell(player, SpellIds.TorchCatchingRemoveTorches); - player.RemoveAura(SpellIds.TorchesCaught); + player.CastSpell(player, (player.GetTeam() == Team.Alliance) ? FlingTorch.SpellTorchCatchingSuccessAlliance : FlingTorch.SpellTorchCatchingSuccessHorde); + player.CastSpell(player, FlingTorch.SpellTorchCatchingRemoveTorches); + player.RemoveAura(FlingTorch.SpellTorchesCaught); } else { - Position dest = player.GetFirstCollisionPosition(15.0f, (float)RandomHelper.NextDouble() * (2 * MathF.PI)); - player.CastSpell(player, SpellIds.TorchesCaught); - player.CastSpell(dest, SpellIds.FlingTorchTriggered, new CastSpellExtraArgs(true)); - player.CastSpell(dest, SpellIds.FlingTorchShadow, new CastSpellExtraArgs(false)); + Position dest = player.GetFirstCollisionPosition(15.0f, (float)RandomHelper.NextDouble() * (float)(2 * MathF.PI)); + player.CastSpell(player, FlingTorch.SpellTorchesCaught); + player.CastSpell(dest, FlingTorch.SpellFlingTorchTriggered, true); + player.CastSpell(dest, FlingTorch.SpellFlingTorchShadow); } } public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, 0, SpellEffectName.ScriptEffect)); + OnEffectHitTarget.Add(new(HandleScriptEffect, 0, SpellEffectName.ScriptEffect)); } } @@ -378,8 +379,8 @@ namespace Scripts.Events.Midsummer public override void Register() { - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 0, Targets.UnitDestAreaEntry)); - OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 2, Targets.UnitDestAreaEntry)); + OnObjectAreaTargetSelect.Add(new(FilterTargets, 0, Targets.UnitDestAreaEntry)); + OnObjectAreaTargetSelect.Add(new(FilterTargets, 2, Targets.UnitDestAreaEntry)); } } -} +} \ No newline at end of file diff --git a/Source/Scripts/Events/OperationGnomeregan.cs b/Source/Scripts/Events/OperationGnomeregan.cs new file mode 100644 index 000000000..f80c606c4 --- /dev/null +++ b/Source/Scripts/Events/OperationGnomeregan.cs @@ -0,0 +1,52 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using Framework.Constants; +using Game.Entities; +using Game.Scripting; +using Game.Spells; + +namespace Scripts.Events +{ + [Script] + class spell_operation_gnomeregan_basic_orders_emote : AuraScript + { + const uint SpellTestSalute = 73835; + const uint SpellTestRoar = 73836; + const uint SpellTestCheer = 73725; + const uint SpellTestDance = 73837; + const uint SpellTestStopDance = 73886; + + void HandlePeriodic(AuraEffect aurEff) + { + Unit target = GetTarget(); + + switch (GetId()) + { + case SpellTestSalute: + target.HandleEmoteCommand(Emote.OneshotSalute); + break; + case SpellTestRoar: + target.HandleEmoteCommand(Emote.OneshotRoar); + break; + case SpellTestCheer: + target.HandleEmoteCommand(Emote.OneshotCheer); + break; + case SpellTestDance: + target.SetEmoteState(Emote.StateDance); + break; + case SpellTestStopDance: + target.SetEmoteState(Emote.StateNone); + break; + default: + return; + } + Remove(); + } + + public override void Register() + { + OnEffectPeriodic.Add(new(HandlePeriodic, 0, AuraType.PeriodicDummy)); + } + } +} \ No newline at end of file diff --git a/Source/Scripts/Events/PilgrimsBounty.cs b/Source/Scripts/Events/PilgrimsBounty.cs index d294854f2..2ca5aa26a 100644 --- a/Source/Scripts/Events/PilgrimsBounty.cs +++ b/Source/Scripts/Events/PilgrimsBounty.cs @@ -1,25 +1,23 @@ -// Copyright (c) CypherCore All rights reserved. +// Copyright (c) CypherCore All rights reserved. // Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. using Framework.Constants; using Game.Entities; using Game.Scripting; using Game.Spells; -using System.Collections.Generic; -namespace Scripts.Events.PilgrimsBounty +namespace Scripts.Events { struct SpellIds { - //Pilgrims Bounty + // Pilgrims Bounty Buff Food public const uint WellFedApTrigger = 65414; public const uint WellFedZmTrigger = 65412; public const uint WellFedHitTrigger = 65416; public const uint WellFedHasteTrigger = 65410; public const uint WellFedSpiritTrigger = 65415; - //FeastOnSpells - //Feastonspells + // FeastSpells public const uint FeastOnTurkey = 61784; public const uint FeastOnCranberries = 61785; public const uint FeastOnSweetPotatoes = 61786; @@ -32,14 +30,14 @@ namespace Scripts.Events.PilgrimsBounty public const uint PieHelpins = 61845; public const uint OnPlateEatVisual = 61826; - //Theturkinator + // TheTurkinator public const uint KillCounterVisual = 62015; public const uint KillCounterVisualMax = 62021; - //Spiritofsharing + // SpiritOfSharing public const uint TheSpiritOfSharing = 61849; - //Bountifultablemisc + // BountifulTableMisc public const uint OnPlateTurkey = 61928; public const uint OnPlateCranberries = 61925; public const uint OnPlateStuffing = 61927; @@ -67,26 +65,19 @@ namespace Scripts.Events.PilgrimsBounty public const uint AServingOfPieChair = 61805; } - struct CreatureIds + struct Misc { - //BountifulTableMisc - public const uint BountifulTable = 32823; - } + // TheTurkinator + public const uint EmoteTurkeyHunter = 0; + public const uint EmoteTurkeyDomination = 1; + public const uint EmoteTurkeySlaughter = 2; + public const uint EmoteTurkeyTriumph = 3; - struct EmoteIds - { - //TheTurkinator - public const uint TurkeyHunter = 0; - public const uint TurkeyDomination = 1; - public const uint TurkeySlaughter = 2; - public const uint TurkeyTriumph = 3; - } + // BountifulTableMisc + public const sbyte SeatPlayer = 0; + public const sbyte SeatPlateHolder = 6; + public const uint NpcBountifulTable = 32823; - struct SeatIds - { - //BountifulTableMisc - public const sbyte Player = 0; - public const sbyte PlateHolder = 6; } [Script("spell_gen_slow_roasted_turkey", SpellIds.WellFedApTrigger)] @@ -96,10 +87,11 @@ namespace Scripts.Events.PilgrimsBounty [Script("spell_gen_candied_sweet_potato", SpellIds.WellFedHasteTrigger)] class spell_pilgrims_bounty_buff_food : AuraScript { + uint _triggeredSpellId; + public spell_pilgrims_bounty_buff_food(uint triggeredSpellId) { _triggeredSpellId = triggeredSpellId; - _handled = false; } void HandleTriggerSpell(AuraEffect aurEff) @@ -114,52 +106,36 @@ namespace Scripts.Events.PilgrimsBounty public override void Register() { - OnEffectPeriodic.Add(new EffectPeriodicHandler(HandleTriggerSpell, 2, AuraType.PeriodicTriggerSpell)); + OnEffectPeriodic.Add(new(HandleTriggerSpell, 2, AuraType.PeriodicTriggerSpell)); } - readonly uint _triggeredSpellId; - bool _handled; } - /* 61784 - Feast On Turkey - * 61785 - Feast On Cranberries - * 61786 - Feast On Sweet Potatoes - * 61787 - Feast On Pie - * 61788 - Feast On Stuffing */ [Script] - class spell_pilgrims_bounty_feast_on_SpellScript : SpellScript + class spell_pilgrims_bounty_feast_on : SpellScript { public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellEffect(spellInfo.Id, 0) && ValidateSpellEffect((uint)spellInfo.GetEffect(0).CalcValue(), 0); + return ValidateSpellEffect((spellInfo.Id, 0)) && ValidateSpellEffect(((uint)spellInfo.GetEffect(0).CalcValue(), 0)); } void HandleDummy(uint effIndex) { Unit caster = GetCaster(); - uint _spellId = 0; - switch (GetSpellInfo().Id) + uint spellId = GetSpellInfo().Id switch { - case SpellIds.FeastOnTurkey: - _spellId = SpellIds.TurkeyHelpins; - break; - case SpellIds.FeastOnCranberries: - _spellId = SpellIds.CranberryHelpins; - break; - case SpellIds.FeastOnSweetPotatoes: - _spellId = SpellIds.SweetPotatoHelpins; - break; - case SpellIds.FeastOnPie: - _spellId = SpellIds.PieHelpins; - break; - case SpellIds.FeastOnStuffing: - _spellId = SpellIds.StuffingHelpins; - break; - default: - return; - } + SpellIds.FeastOnTurkey => SpellIds.TurkeyHelpins, + SpellIds.FeastOnCranberries => SpellIds.CranberryHelpins, + SpellIds.FeastOnSweetPotatoes => SpellIds.SweetPotatoHelpins, + SpellIds.FeastOnPie => SpellIds.PieHelpins, + SpellIds.FeastOnStuffing => SpellIds.StuffingHelpins, + _ => 0 + }; + + if (spellId == 0) + return; Vehicle vehicle = caster.GetVehicleKit(); if (vehicle != null) @@ -171,7 +147,7 @@ namespace Scripts.Events.PilgrimsBounty if (player != null) { player.CastSpell(player, SpellIds.OnPlateEatVisual, true); - caster.CastSpell(player, _spellId, new CastSpellExtraArgs(TriggerCastFlags.FullMask) + caster.CastSpell(player, spellId, new CastSpellExtraArgs(TriggerCastFlags.FullMask) .SetOriginalCaster(player.GetGUID())); } } @@ -188,12 +164,12 @@ namespace Scripts.Events.PilgrimsBounty public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); + OnEffectHitTarget.Add(new(HandleDummy, 0, SpellEffectName.Dummy)); } } [Script] // 62014 - Turkey Tracker - class spell_pilgrims_bounty_turkey_tracker_SpellScript : SpellScript + class spell_pilgrims_bounty_turkey_tracker : SpellScript { public override bool Validate(SpellInfo spell) { @@ -213,20 +189,20 @@ namespace Scripts.Events.PilgrimsBounty Aura aura = target.GetAura(GetSpellInfo().Id); if (aura != null) - { + { switch (aura.GetStackAmount()) { case 10: - caster.GetAI().Talk(EmoteIds.TurkeyHunter, target); + caster.GetAI().Talk(Misc.EmoteTurkeyHunter, target); break; case 20: - caster.GetAI().Talk(EmoteIds.TurkeyDomination, target); + caster.GetAI().Talk(Misc.EmoteTurkeyDomination, target); break; case 30: - caster.GetAI().Talk(EmoteIds.TurkeySlaughter, target); + caster.GetAI().Talk(Misc.EmoteTurkeySlaughter, target); break; case 40: - caster.GetAI().Talk(EmoteIds.TurkeyTriumph, target); + caster.GetAI().Talk(Misc.EmoteTurkeyTriumph, target); target.CastSpell(target, SpellIds.KillCounterVisualMax, true); target.RemoveAurasDueToSpell(GetSpellInfo().Id); break; @@ -239,7 +215,7 @@ namespace Scripts.Events.PilgrimsBounty public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 1, SpellEffectName.ScriptEffect)); + OnEffectHitTarget.Add(new(HandleScript, 1, SpellEffectName.ScriptEffect)); } } @@ -248,15 +224,16 @@ namespace Scripts.Events.PilgrimsBounty [Script("spell_pilgrims_bounty_well_fed_stuffing", SpellIds.WellFedHitTrigger)] [Script("spell_pilgrims_bounty_well_fed_sweet_potatoes", SpellIds.WellFedHasteTrigger)] [Script("spell_pilgrims_bounty_well_fed_pie", SpellIds.WellFedSpiritTrigger)] - class spell_pilgrims_bounty_well_fed_SpellScript : SpellScript + class spell_pilgrims_bounty_well_fed : SpellScript { uint _triggeredSpellId; - public spell_pilgrims_bounty_well_fed_SpellScript(uint triggeredSpellId) + public spell_pilgrims_bounty_well_fed(uint triggeredSpellId) { _triggeredSpellId = triggeredSpellId; } + public override bool Validate(SpellInfo spell) { return ValidateSpellInfo(_triggeredSpellId); @@ -296,7 +273,7 @@ namespace Scripts.Events.PilgrimsBounty public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 1, SpellEffectName.ScriptEffect)); + OnEffectHitTarget.Add(new(HandleScript, 1, SpellEffectName.ScriptEffect)); } } @@ -305,14 +282,14 @@ namespace Scripts.Events.PilgrimsBounty [Script("spell_pilgrims_bounty_on_plate_stuffing", SpellIds.OnPlateStuffing, SpellIds.PassTheStuffing, SpellIds.OnPlateVisualStuffing, SpellIds.AServingOfStuffingChair)] [Script("spell_pilgrims_bounty_on_plate_sweet_potatoes", SpellIds.OnPlateSweetPotatoes, SpellIds.PassTheSweetPotatoes, SpellIds.OnPlateVisualPotatoes, SpellIds.AServingOfSweetPotatoesChair)] [Script("spell_pilgrims_bounty_on_plate_pie", SpellIds.OnPlatePie, SpellIds.PassThePie, SpellIds.OnPlateVisualPie, SpellIds.AServingOfPieChair)] - class spell_pilgrims_bounty_on_plate_SpellScript : SpellScript + class spell_pilgrims_bounty_on_plate : SpellScript { uint _triggeredSpellId1; uint _triggeredSpellId2; uint _triggeredSpellId3; uint _triggeredSpellId4; - public spell_pilgrims_bounty_on_plate_SpellScript(uint triggeredSpellId1, uint triggeredSpellId2, uint triggeredSpellId3, uint triggeredSpellId4) + public spell_pilgrims_bounty_on_plate(uint triggeredSpellId1, uint triggeredSpellId2, uint triggeredSpellId3, uint triggeredSpellId4) { _triggeredSpellId1 = triggeredSpellId1; _triggeredSpellId2 = triggeredSpellId2; @@ -334,7 +311,7 @@ namespace Scripts.Events.PilgrimsBounty { Vehicle table = vehBase.GetVehicle(); if (table != null) - if (table.GetCreatureEntry() == CreatureIds.BountifulTable) + if (table.GetCreatureEntry() == Misc.NpcBountifulTable) return table; } } @@ -342,7 +319,7 @@ namespace Scripts.Events.PilgrimsBounty { Vehicle veh = target.GetVehicle(); if (veh != null) - if (veh.GetCreatureEntry() == CreatureIds.BountifulTable) + if (veh.GetCreatureEntry() == Misc.NpcBountifulTable) return veh; } @@ -351,12 +328,16 @@ namespace Scripts.Events.PilgrimsBounty Unit GetPlateInSeat(Vehicle table, sbyte seat) { - Unit holderUnit = table.GetPassenger(SeatIds.PlateHolder); + Unit holderUnit = table.GetPassenger(Misc.SeatPlateHolder); if (holderUnit != null) { Vehicle holder = holderUnit.GetVehicleKit(); if (holder != null) - return holder.GetPassenger(seat); + { + Unit plate = holder.GetPassenger(seat); + if (plate != null) + return plate; + } } return null; @@ -366,17 +347,17 @@ namespace Scripts.Events.PilgrimsBounty { Unit caster = GetCaster(); Unit target = GetHitUnit(); - if (!target || caster == target) + if (target == null || caster == target) return; Vehicle table = GetTable(caster); - if (!table || table != GetTable(target)) + if (table == null || table != GetTable(target)) return; Vehicle casterChair = caster.GetVehicleKit(); if (casterChair != null) { - Unit casterPlr = casterChair.GetPassenger(SeatIds.Player); + Unit casterPlr = casterChair.GetPassenger(Misc.SeatPlayer); if (casterPlr != null) { if (casterPlr == target) @@ -385,7 +366,7 @@ namespace Scripts.Events.PilgrimsBounty casterPlr.CastSpell(casterPlr, _triggeredSpellId2, true); //Credit for Sharing is Caring(always) sbyte seat = target.GetTransSeat(); - if (target.IsPlayer() && target.GetVehicleBase()) + if (target.IsPlayer() && target.GetVehicleBase() != null) seat = target.GetVehicleBase().GetTransSeat(); Unit plate = GetPlateInSeat(table, seat); @@ -408,7 +389,7 @@ namespace Scripts.Events.PilgrimsBounty public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); + OnEffectHitTarget.Add(new(HandleDummy, 0, SpellEffectName.Dummy)); } } @@ -417,11 +398,11 @@ namespace Scripts.Events.PilgrimsBounty [Script("spell_pilgrims_bounty_a_serving_of_stuffing", SpellIds.AServingOfStuffingPlate)] [Script("spell_pilgrims_bounty_a_serving_of_potatoes", SpellIds.AServingOfSweetPotatoesPlate)] [Script("spell_pilgrims_bounty_a_serving_of_pie", SpellIds.AServingOfPiePlate)] - class spell_pilgrims_bounty_a_serving_of_AuraScript : AuraScript + class spell_pilgrims_bounty_a_serving_of : AuraScript { uint _triggeredSpellId; - public spell_pilgrims_bounty_a_serving_of_AuraScript(uint triggeredSpellId) + public spell_pilgrims_bounty_a_serving_of(uint triggeredSpellId) { _triggeredSpellId = triggeredSpellId; } @@ -450,7 +431,7 @@ namespace Scripts.Events.PilgrimsBounty Vehicle table = target.GetVehicle(); if (table != null) { - Unit holderUnit = table.GetPassenger(SeatIds.PlateHolder); + Unit holderUnit = table.GetPassenger(Misc.SeatPlateHolder); if (holderUnit != null) { Vehicle holder = holderUnit.GetVehicleKit(); @@ -471,8 +452,8 @@ namespace Scripts.Events.PilgrimsBounty public override void Register() { - AfterEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); - OnEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + AfterEffectApply.Add(new(OnApply, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + OnEffectRemove.Add(new(OnRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); } } -} +} \ No newline at end of file diff --git a/Source/Scripts/Events/WinterVeil.cs b/Source/Scripts/Events/WinterVeil.cs index 41bdd34e6..03338de66 100644 --- a/Source/Scripts/Events/WinterVeil.cs +++ b/Source/Scripts/Events/WinterVeil.cs @@ -1,73 +1,50 @@ -// Copyright (c) CypherCore All rights reserved. +// Copyright (c) CypherCore All rights reserved. // Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. using Framework.Constants; using Game.Entities; using Game.Scripting; using Game.Spells; +using System.Collections.Generic; -namespace Scripts.Events.WinterVeil +namespace Scripts.Events { - struct SpellIds - { - //Mistletoe - public const uint CreateMistletoe = 26206; - public const uint CreateHolly = 26207; - public const uint CreateSnowflakes = 45036; - - //Winter Wondervolt - public const uint Px238WinterWondervoltTransform1 = 26157; - public const uint Px238WinterWondervoltTransform2 = 26272; - public const uint Px238WinterWondervoltTransform3 = 26273; - public const uint Px238WinterWondervoltTransform4 = 26274; - - //Reindeertransformation - public const uint FlyingReindeer310 = 44827; - public const uint FlyingReindeer280 = 44825; - public const uint FlyingReindeer60 = 44824; - public const uint Reindeer100 = 25859; - public const uint Reindeer60 = 25858; - } - [Script] // 26218 - Mistletoe class spell_winter_veil_mistletoe : SpellScript { + const uint SpellCreateMistletoe = 26206; + const uint SpellCreateHolly = 26207; + const uint SpellCreateSnowflakes = 45036; + public override bool Validate(SpellInfo spell) { - return ValidateSpellInfo(SpellIds.CreateMistletoe, SpellIds.CreateHolly, SpellIds.CreateSnowflakes); + return ValidateSpellInfo(SpellCreateMistletoe, SpellCreateHolly, SpellCreateSnowflakes); } void HandleScript(uint effIndex) { Player target = GetHitPlayer(); - if (target) + if (target != null) { - uint spellId = RandomHelper.RAND(SpellIds.CreateHolly, SpellIds.CreateMistletoe, SpellIds.CreateSnowflakes); + uint spellId = RandomHelper.RAND(SpellCreateHolly, SpellCreateMistletoe, SpellCreateSnowflakes); GetCaster().CastSpell(target, spellId, true); } } public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); + OnEffectHitTarget.Add(new(HandleScript, 0, SpellEffectName.ScriptEffect)); } } - [Script] // 26275 - PX-238 Winter Wondervolt TRAP + [Script] // 26275 - Px-238 Winter Wondervolt Trap class spell_winter_veil_px_238_winter_wondervolt : SpellScript - { - static uint[] spells = - { - SpellIds.Px238WinterWondervoltTransform1, - SpellIds.Px238WinterWondervoltTransform2, - SpellIds.Px238WinterWondervoltTransform3, - SpellIds.Px238WinterWondervoltTransform4 - }; + { + uint[] WonderboltTransformSpells = { 26157, 26272, 26273, 26274 }; public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.Px238WinterWondervoltTransform1, SpellIds.Px238WinterWondervoltTransform2, - SpellIds.Px238WinterWondervoltTransform3, SpellIds.Px238WinterWondervoltTransform4); + return ValidateSpellInfo(WonderboltTransformSpells); } void HandleScript(uint effIndex) @@ -75,28 +52,34 @@ namespace Scripts.Events.WinterVeil PreventHitDefaultEffect(effIndex); Unit target = GetHitUnit(); - if (target) + if (target != null) { - for (byte i = 0; i < 4; ++i) - if (target.HasAura(spells[i])) + foreach (uint spell in WonderboltTransformSpells) + if (target.HasAura(spell)) return; - target.CastSpell(target, spells[RandomHelper.URand(0, 3)], true); + target.CastSpell(target, WonderboltTransformSpells.SelectRandom(), true); } } public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); + OnEffectHitTarget.Add(new(HandleScript, 0, SpellEffectName.ScriptEffect)); } } - [Script] - class spell_item_reindeer_transformation : SpellScript + [Script] // 25860 - Reindeer Transformation + class spell_winter_veil_reindeer_transformation : SpellScript { + const uint SpellFlyingReindeer310 = 44827; + const uint SpellFlyingReindeer280 = 44825; + const uint SpellFlyingReindeer60 = 44824; + const uint SpellReindeer100 = 25859; + const uint SpellReindeer60 = 25858; + public override bool Validate(SpellInfo spell) { - return ValidateSpellInfo(SpellIds.FlyingReindeer310, SpellIds.FlyingReindeer280, SpellIds.FlyingReindeer60, SpellIds.Reindeer100, SpellIds.Reindeer60); + return ValidateSpellInfo(SpellFlyingReindeer310, SpellFlyingReindeer280, SpellFlyingReindeer60, SpellReindeer100, SpellReindeer60); } void HandleDummy(uint effIndex) @@ -112,25 +95,25 @@ namespace Scripts.Events.WinterVeil if (flyspeed >= 4.1f) // Flying Reindeer - caster.CastSpell(caster, SpellIds.FlyingReindeer310, true); //310% flying Reindeer + caster.CastSpell(caster, SpellFlyingReindeer310, true); //310% flying Reindeer else if (flyspeed >= 3.8f) // Flying Reindeer - caster.CastSpell(caster, SpellIds.FlyingReindeer280, true); //280% flying Reindeer + caster.CastSpell(caster, SpellFlyingReindeer280, true); //280% flying Reindeer else if (flyspeed >= 1.6f) // Flying Reindeer - caster.CastSpell(caster, SpellIds.FlyingReindeer60, true); //60% flying Reindeer + caster.CastSpell(caster, SpellFlyingReindeer60, true); //60% flying Reindeer else if (speed >= 2.0f) // Reindeer - caster.CastSpell(caster, SpellIds.Reindeer100, true); //100% ground Reindeer + caster.CastSpell(caster, SpellReindeer100, true); //100% ground Reindeer else // Reindeer - caster.CastSpell(caster, SpellIds.Reindeer60, true); //60% ground Reindeer + caster.CastSpell(caster, SpellReindeer60, true); //60% ground Reindeer } } public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleDummy, 0, SpellEffectName.Dummy)); + OnEffectHit.Add(new(HandleDummy, 0, SpellEffectName.Dummy)); } } -} +} \ No newline at end of file diff --git a/Source/Scripts/Events/ZalazaneFall.cs b/Source/Scripts/Events/ZalazaneFall.cs new file mode 100644 index 000000000..28e85cdf9 --- /dev/null +++ b/Source/Scripts/Events/ZalazaneFall.cs @@ -0,0 +1,370 @@ +// 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.Configuration; +using Framework.Constants; +using Framework.Database; +using Framework.Networking; +using Game.Entities; +using System.Collections.Generic; +using Game.AI; +using Game.Scripting; +using Game.Spells; +using System; +using static Global; + +namespace Scripts.Events.ZalazaneFall +{ + struct TextIds + { + // Tiger Matriarch Credit + public const uint SayMatriarchAggro = 0; + + // Troll Volunteer + public const uint SayVolunteerStart = 0; + public const uint SayVolunteerEnd = 1; + } + + struct SpellIds + { + // Tiger Matriarch Credit + public const uint SummonMatriarch = 75187; + public const uint NoSummonAura = 75213; + public const uint DetectInvis = 75180; + public const uint SummonZentabraTrigger = 75212; + + // Tiger Matriarch + public const uint Pounce = 61184; + public const uint FuriousBite = 75164; + public const uint SummonZentabra = 75181; + public const uint SpiritOfTheTigerRider = 75166; + public const uint EjectPassengers = 50630; + + // Troll Volunteer + public const uint VolunteerAura = 75076; + public const uint PetactAura = 74071; + public const uint QuestCredit = 75106; + public const uint MountingCheck = 75420; + public const uint Turnin = 73953; + public const uint AoeTurnin = 75107; + + // Vol'jin War Drums + public const uint Motivate1 = 75088; + public const uint Motivate2 = 75086; + } + + struct CreatureIds + { + // Tiger Matriarch Credit + public const uint TigerVehicle = 40305; + + // Troll Volunteer + public const uint Uruzin = 40253; + public const uint Volunteer1 = 40264; + public const uint Volunteer2 = 40260; + + // Vol'jin War Drums + public const uint Citizen1 = 40256; + public const uint Citizen2 = 40257; + } + + struct Misc + { + public const uint PointUruzin = 4026400; + } + + [Script] + class npc_tiger_matriarch_credit : ScriptedAI + { + public npc_tiger_matriarch_credit(Creature creature) : base(creature) + { + SetCombatMovement(false); + _scheduler.Schedule(TimeSpan.FromSeconds(2), task => + { + List tigers = me.GetCreatureListWithEntryInGrid(CreatureIds.TigerVehicle, 15.0f); + if (!tigers.Empty()) + { + foreach (var creature in tigers) + { + if (!creature.IsSummon()) + continue; + + Unit summoner = creature.ToTempSummon().GetSummonerUnit(); + if (summoner != null && !summoner.HasAura(SpellIds.NoSummonAura) && !summoner.HasAura(SpellIds.SummonZentabraTrigger) && !summoner.IsInCombat()) + { + me.AddAura(SpellIds.NoSummonAura, summoner); + me.AddAura(SpellIds.DetectInvis, summoner); + summoner.CastSpell(summoner, SpellIds.SummonMatriarch, true); + Talk(TextIds.SayMatriarchAggro, summoner); + } + } + } + + task.Repeat(TimeSpan.FromSeconds(5)); + }); + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + } + + [Script] + class npc_tiger_matriarch : ScriptedAI + { + ObjectGuid _tigerGuid; + + public npc_tiger_matriarch(Creature creature) : base(creature) { } + + public override void JustEngagedWith(Unit target) + { + _scheduler.CancelAll(); + _scheduler.Schedule(TimeSpan.FromMilliseconds(100), task => + { + DoCastVictim(SpellIds.Pounce); + task.Repeat(TimeSpan.FromSeconds(30)); + }); + + _scheduler.Schedule(TimeSpan.FromSeconds(50), task => + { + Unit tiger = ObjAccessor.GetUnit(me, _tigerGuid); + if (tiger != null) + { + if (tiger.IsSummon()) + { + Unit vehSummoner = tiger.ToTempSummon().GetSummonerUnit(); + if (vehSummoner != null) + me.AddAura(SpellIds.NoSummonAura, vehSummoner); + } + } + task.Repeat(); + }); + } + + public override void IsSummonedBy(WorldObject summonerWO) + { + Player summoner = summonerWO.ToPlayer(); + if (summoner == null || summoner.GetVehicle() == null) + return; + + _tigerGuid = summoner.GetVehicle().GetBase().GetGUID(); + Unit tiger = ObjAccessor.GetUnit(me, _tigerGuid); + if (tiger != null) + { + AddThreat(tiger, 500000.0f); + DoCast(me, SpellIds.FuriousBite); + } + } + + public override void KilledUnit(Unit victim) + { + if (victim.GetTypeId() != TypeId.Unit || !victim.IsSummon()) + return; + + Unit vehSummoner = victim.ToTempSummon().GetSummonerUnit(); + if (vehSummoner != null) + { + vehSummoner.RemoveAurasDueToSpell(SpellIds.NoSummonAura); + vehSummoner.RemoveAurasDueToSpell(SpellIds.DetectInvis); + vehSummoner.RemoveAurasDueToSpell(SpellIds.SpiritOfTheTigerRider); + vehSummoner.RemoveAurasDueToSpell(SpellIds.SummonZentabraTrigger); + } + me.DespawnOrUnsummon(); + } + + public override void DamageTaken(Unit attacker, ref uint damage, DamageEffectType damageType, SpellInfo spellInfo = null) + { + if (attacker == null || !attacker.IsSummon()) + return; + + if (HealthBelowPct(20)) + { + damage = 0; + me.SetUnitFlag(UnitFlags.NonAttackable); + Unit vehSummoner = attacker.ToTempSummon().GetSummonerUnit(); + if (vehSummoner != null) + { + vehSummoner.AddAura(SpellIds.SummonZentabraTrigger, vehSummoner); + vehSummoner.CastSpell(vehSummoner, SpellIds.SummonZentabra, true); + attacker.CastSpell(attacker, SpellIds.EjectPassengers, true); + vehSummoner.RemoveAurasDueToSpell(SpellIds.NoSummonAura); + vehSummoner.RemoveAurasDueToSpell(SpellIds.DetectInvis); + vehSummoner.RemoveAurasDueToSpell(SpellIds.SpiritOfTheTigerRider); + vehSummoner.RemoveAurasDueToSpell(SpellIds.SummonZentabraTrigger); + } + + me.DespawnOrUnsummon(); + } + } + + public override void UpdateAI(uint diff) + { + if (!UpdateVictim()) + return; + + if (_tigerGuid.IsEmpty()) + return; + + _scheduler.Update(diff, DoMeleeAttackIfReady); + } + } + + [Script] + class npc_troll_volunteer : ScriptedAI + { + // These models was found in sniff. + // @todo generalize these models with race from dbc + uint[] trollmodel = + { + 11665, 11734, 11750, 12037, 12038, 12042, 12049, 12849, 13529, 14759, 15570, 15701, + 15702, 1882, 1897, 1976, 2025, 27286, 2734, 2735, 4084, 4085, 4087, 4089, 4231, 4357, + 4358, 4360, 4361, 4362, 4363, 4370, 4532, 4537, 4540, 4610, 6839, 7037, 9767, 9768 + }; + + uint _mountModel; + bool _complete; + + public npc_troll_volunteer(Creature creature) : base(creature) + { + Initialize(); + _mountModel = 0; + } + + void Initialize() + { + _complete = false; + } + + public override void InitializeAI() + { + if (me.IsDead() || me.GetOwner() == null) + return; + + Reset(); + + switch (RandomHelper.URand(0, 3)) + { + case 0: + _mountModel = 6471; + break; + case 1: + _mountModel = 6473; + break; + case 2: + _mountModel = 6469; + break; + default: + _mountModel = 6472; + break; + } + me.SetDisplayId(trollmodel[RandomHelper.URand(0, 39)]); + Player player = me.GetOwner().ToPlayer(); + if (player != null) + me.GetMotionMaster().MoveFollow(player, 5.0f, (float)(RandomHelper.NextDouble() + 1.0f) * (float)(MathF.PI) / 3.0f * 4.0f); + } + + public override void Reset() + { + Initialize(); + me.AddAura(SpellIds.VolunteerAura, me); + me.AddAura(SpellIds.MountingCheck, me); + DoCast(me, SpellIds.PetactAura); + me.SetReactState(ReactStates.Passive); + Talk(TextIds.SayVolunteerStart); + } + + // This is needed for mount check aura to know what mountmodel the npc got stored + public uint GetMountId() + { + return _mountModel; + } + + public override void MovementInform(MovementGeneratorType type, uint id) + { + if (type != MovementGeneratorType.Point) + return; + if (id == Misc.PointUruzin) + me.DespawnOrUnsummon(); + } + + public override void SpellHit(WorldObject caster, SpellInfo spellInfo) + { + if (spellInfo.Id == SpellIds.AoeTurnin && caster.GetEntry() == CreatureIds.Uruzin && !_complete) + { + _complete = true; // Preventing from giving credit twice + DoCast(me, SpellIds.Turnin); + DoCast(me, SpellIds.QuestCredit); + me.RemoveAurasDueToSpell(SpellIds.MountingCheck); + me.Dismount(); + Talk(TextIds.SayVolunteerEnd); + me.GetMotionMaster().MovePoint(Misc.PointUruzin, caster.GetPositionX(), caster.GetPositionY(), caster.GetPositionZ()); + } + } + } + + [Script] // 75420 - Mounting Check + class spell_mount_check : AuraScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.MountingCheck); + } + + void HandleEffectPeriodic(AuraEffect aurEff) + { + Unit target = GetTarget(); + Unit owner = target.GetOwner(); + + if (owner == null) + return; + + if (owner.IsMounted() && !target.IsMounted()) + { + npc_troll_volunteer volunteerAI = target.GetAI(); + if (volunteerAI != null) + target.Mount(volunteerAI.GetMountId()); + } + else if (!owner.IsMounted() && target.IsMounted()) + target.Dismount(); + + target.SetSpeedRate(UnitMoveType.Run, owner.GetSpeedRate(UnitMoveType.Run)); + target.SetSpeedRate(UnitMoveType.Walk, owner.GetSpeedRate(UnitMoveType.Walk)); + } + + public override void Register() + { + OnEffectPeriodic.Add(new(HandleEffectPeriodic, 0, AuraType.PeriodicDummy)); + } + } + + [Script] // 75102 - Vol'jin's War Drums + class spell_voljin_war_drums : SpellScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.Motivate1, SpellIds.Motivate2); + } + + void HandleDummy(uint effIndex) + { + Unit caster = GetCaster(); + Unit target = GetHitUnit(); + if (target != null) + { + uint motivate = 0; + if (target.GetEntry() == CreatureIds.Citizen1) + motivate = SpellIds.Motivate1; + else if (target.GetEntry() == CreatureIds.Citizen2) + motivate = SpellIds.Motivate2; + if (motivate != 0) + caster.CastSpell(target, motivate, false); + } + } + + public override void Register() + { + OnEffectHitTarget.Add(new(HandleDummy, 0, SpellEffectName.Dummy)); + } + } +} \ No newline at end of file diff --git a/Source/Scripts/World/Achievement.cs b/Source/Scripts/World/Achievement.cs index eba927035..1e4e5bf48 100644 --- a/Source/Scripts/World/Achievement.cs +++ b/Source/Scripts/World/Achievement.cs @@ -8,12 +8,14 @@ using Game.Scripting; namespace Scripts.World.Achievements { - [Script] + [Script("achievement_arena_2v2_kills", ArenaTypes.Team2v2)] + [Script("achievement_arena_3v3_kills", ArenaTypes.Team3v3)] + [Script("achievement_arena_5v5_kills", ArenaTypes.Team5v5)] class achievement_arena_kills : AchievementCriteriaScript { - byte _arenaType; + ArenaTypes _arenaType; - public achievement_arena_kills(string name, byte arenaType) : base(name) + public achievement_arena_kills(string name, ArenaTypes arenaType) : base(name) { _arenaType = arenaType; } @@ -24,7 +26,7 @@ namespace Scripts.World.Achievements if (!source.InArena()) return false; - return source.GetBattleground().GetArenaType() == (ArenaTypes)_arenaType; + return source.GetBattleground().GetArenaType() == _arenaType; } }