From c56e1752f5a45c136c5ef34946363296c14ffe3b Mon Sep 17 00:00:00 2001 From: hondacrx Date: Mon, 16 Oct 2023 12:35:26 -0400 Subject: [PATCH] More Scripts done. --- Source/Game/Entities/Unit/Unit.Movement.cs | 4 +- Source/Scripts/BattleField/WinterGrasp.cs | 1588 ----------------- .../Scripts/BattleField/WinterGraspConst.cs | 697 -------- .../Draenor/ZoneAssaultOnTheDarkPortal.cs | 47 + .../Draenor/ZoneDraenorShadowmoonValley.cs | 10 +- .../InstanceAberrusTheShadowedCrucible.cs | 183 ++ .../KazzaraTheHellforged.cs | 85 + .../AzureVault/InstanceAzureVault.cs | 119 ++ .../Scripts/DragonIsles/AzureVault/Leymor.cs | 478 +++++ .../RubyLifePools/InstanceRubyLifePools.cs | 31 +- .../DragonIsles/ZoneTheForbiddenReach.cs | 62 +- 11 files changed, 959 insertions(+), 2345 deletions(-) delete mode 100644 Source/Scripts/BattleField/WinterGrasp.cs delete mode 100644 Source/Scripts/BattleField/WinterGraspConst.cs create mode 100644 Source/Scripts/Draenor/ZoneAssaultOnTheDarkPortal.cs create mode 100644 Source/Scripts/DragonIsles/AberrusTheShadowedCrucible/InstanceAberrusTheShadowedCrucible.cs create mode 100644 Source/Scripts/DragonIsles/AberrusTheShadowedCrucible/KazzaraTheHellforged.cs create mode 100644 Source/Scripts/DragonIsles/AzureVault/InstanceAzureVault.cs create mode 100644 Source/Scripts/DragonIsles/AzureVault/Leymor.cs diff --git a/Source/Game/Entities/Unit/Unit.Movement.cs b/Source/Game/Entities/Unit/Unit.Movement.cs index 146856655..439f7f96c 100644 --- a/Source/Game/Entities/Unit/Unit.Movement.cs +++ b/Source/Game/Entities/Unit/Unit.Movement.cs @@ -1526,7 +1526,7 @@ namespace Game.Entities public MovementForces GetMovementForces() { return _movementForces; } - void ApplyMovementForce(ObjectGuid id, Vector3 origin, float magnitude, MovementForceType type, Vector3 direction, ObjectGuid transportGuid = default) + public void ApplyMovementForce(ObjectGuid id, Vector3 origin, float magnitude, MovementForceType type, Vector3 direction = default, ObjectGuid transportGuid = default) { if (_movementForces == null) _movementForces = new MovementForces(); @@ -1562,7 +1562,7 @@ namespace Game.Entities } } - void RemoveMovementForce(ObjectGuid id) + public void RemoveMovementForce(ObjectGuid id) { if (_movementForces == null) return; diff --git a/Source/Scripts/BattleField/WinterGrasp.cs b/Source/Scripts/BattleField/WinterGrasp.cs deleted file mode 100644 index b13e37508..000000000 --- a/Source/Scripts/BattleField/WinterGrasp.cs +++ /dev/null @@ -1,1588 +0,0 @@ -// 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.DataStorage; -using Game.Entities; -using Game.Maps; -using Game.Scripting; -using Game.Spells; -using System.Collections.Generic; - -namespace Game.BattleFields -{ - class BattlefieldWG : BattleField - { - public BattlefieldWG(Map map) : base(map) { } - - public override bool SetupBattlefield() - { - m_TypeId = (uint)BattleFieldTypes.WinterGrasp; // See enum BattlefieldTypes - m_BattleId = BattlefieldIds.WG; - m_ZoneId = (uint)AreaId.Wintergrasp; - - InitStalker(WGNpcs.Stalker, WGConst.WintergraspStalkerPos); - - m_MaxPlayer = WorldConfig.GetUIntValue(WorldCfg.WintergraspPlrMax); - m_IsEnabled = WorldConfig.GetBoolValue(WorldCfg.WintergraspEnable); - m_MinPlayer = WorldConfig.GetUIntValue(WorldCfg.WintergraspPlrMin); - m_MinLevel = WorldConfig.GetUIntValue(WorldCfg.WintergraspPlrMinLvl); - m_BattleTime = WorldConfig.GetUIntValue(WorldCfg.WintergraspBattletime) * Time.Minute * Time.InMilliseconds; - m_NoWarBattleTime = WorldConfig.GetUIntValue(WorldCfg.WintergraspNobattletime) * Time.Minute * Time.InMilliseconds; - m_RestartAfterCrash = WorldConfig.GetUIntValue(WorldCfg.WintergraspRestartAfterCrash) * Time.Minute * Time.InMilliseconds; - - m_TimeForAcceptInvite = 20; - m_StartGroupingTimer = 15 * Time.Minute * Time.InMilliseconds; - m_tenacityTeam = TeamId.Neutral; - - KickPosition = new WorldLocation(m_MapId, 5728.117f, 2714.346f, 697.733f, 0); - - RegisterZone(m_ZoneId); - - for (var team = 0; team < SharedConst.PvpTeamsCount; ++team) - { - DefenderPortalList[team] = new List(); - m_vehicles[team] = new List(); - } - - // Load from db - if (Global.WorldStateMgr.GetValue(WorldStates.BattlefieldWgShowTimeNextBattle, m_Map) == 0 && Global.WorldStateMgr.GetValue(WGConst.ClockWorldState[0], m_Map) == 0) - { - Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.BattlefieldWgShowTimeNextBattle, 0, false, m_Map); - Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.BattlefieldWgDefender, RandomHelper.IRand(0, 1), false, m_Map); - Global.WorldStateMgr.SetValueAndSaveInDb(WGConst.ClockWorldState[0], (int)(GameTime.GetGameTime() + m_NoWarBattleTime / Time.InMilliseconds), false, m_Map); - } - - m_isActive = Global.WorldStateMgr.GetValue(WorldStates.BattlefieldWgShowTimeNextBattle, m_Map) == 0; - m_DefenderTeam = (uint)Global.WorldStateMgr.GetValue(WorldStates.BattlefieldWgDefender, m_Map); - - m_Timer = (uint)(Global.WorldStateMgr.GetValue(WGConst.ClockWorldState[0], m_Map) - GameTime.GetGameTime()); - if (m_isActive) - { - m_isActive = false; - m_Timer = m_RestartAfterCrash; - } - - Global.WorldStateMgr.SetValue(WorldStates.BattlefieldWgAttacker, (int)GetAttackerTeam(), false, m_Map); - Global.WorldStateMgr.SetValue(WGConst.ClockWorldState[1], (int)(GameTime.GetGameTime() + m_Timer / Time.InMilliseconds), false, m_Map); - - foreach (var gy in WGConst.WGGraveyard) - { - BfGraveyardWG graveyard = new(this); - - // When between games, the graveyard is controlled by the defending team - if (gy.StartControl == TeamId.Neutral) - graveyard.Initialize(m_DefenderTeam, gy.GraveyardID); - else - graveyard.Initialize(gy.StartControl, gy.GraveyardID); - - graveyard.SetTextId(gy.TextId); - m_GraveyardList.Add(graveyard); - } - - - // Spawn workshop creatures and gameobjects - for (byte i = 0; i < WGConst.MaxWorkshops; i++) - { - WGWorkshop workshop = new(this, i); - if (i < WGWorkshopIds.Ne) - workshop.GiveControlTo(GetAttackerTeam(), true); - else - workshop.GiveControlTo(GetDefenderTeam(), true); - - // Note: Capture point is added once the gameobject is created. - Workshops.Add(workshop); - } - - // Spawn turrets and hide them per default - foreach (var turret in WGConst.WGTurret) - { - Position towerCannonPos = turret.GetPosition(); - Creature creature = SpawnCreature(WGNpcs.TowerCannon, towerCannonPos); - if (creature) - { - CanonList.Add(creature.GetGUID()); - HideNpc(creature); - } - } - - // Spawn all gameobjects - foreach (var build in WGConst.WGGameObjectBuilding) - { - GameObject go = SpawnGameObject(build.Entry, build.Pos, build.Rot); - if (go) - { - BfWGGameObjectBuilding b = new(this, build.BuildingType, build.WorldState); - b.Init(go); - if (!IsEnabled() && go.GetEntry() == WGGameObjects.VaultGate) - go.SetDestructibleState(GameObjectDestructibleState.Destroyed); - BuildingsInZone.Add(b); - } - } - - // Spawning portal defender - foreach (var teleporter in WGConst.WGPortalDefenderData) - { - GameObject go = SpawnGameObject(teleporter.AllianceEntry, teleporter.Pos, teleporter.Rot); - if (go) - { - DefenderPortalList[TeamId.Alliance].Add(go.GetGUID()); - go.SetRespawnTime((int)(GetDefenderTeam() == TeamId.Alliance ? BattlegroundConst.RespawnImmediately : BattlegroundConst.RespawnOneDay)); - } - go = SpawnGameObject(teleporter.HordeEntry, teleporter.Pos, teleporter.Rot); - if (go) - { - DefenderPortalList[TeamId.Horde].Add(go.GetGUID()); - go.SetRespawnTime((int)(GetDefenderTeam() == TeamId.Horde ? BattlegroundConst.RespawnImmediately : BattlegroundConst.RespawnOneDay)); - } - } - - UpdateCounterVehicle(true); - return true; - } - - public override void OnBattleStart() - { - // Spawn titan relic - GameObject relic = SpawnGameObject(WGGameObjects.TitanSRelic, WGConst.RelicPos, WGConst.RelicRot); - if (relic) - { - // Update faction of relic, only attacker can click on - relic.SetFaction(WGConst.WintergraspFaction[GetAttackerTeam()]); - // Set in use (not allow to click on before last door is broken) - relic.SetFlag(GameObjectFlags.InUse | GameObjectFlags.NotSelectable); - m_titansRelicGUID = relic.GetGUID(); - } - else - Log.outError(LogFilter.Battlefield, "WG: Failed to spawn titan relic."); - - Global.WorldStateMgr.SetValue(WorldStates.BattlefieldWgAttacker, (int)GetAttackerTeam(), false, m_Map); - Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.BattlefieldWgDefender, (int)GetDefenderTeam(), false, m_Map); - Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.BattlefieldWgShowTimeNextBattle, 0, false, m_Map); - Global.WorldStateMgr.SetValue(WorldStates.BattlefieldWgShowTimeBattleEnd, 1, false, m_Map); - Global.WorldStateMgr.SetValueAndSaveInDb(WGConst.ClockWorldState[0], (int)(GameTime.GetGameTime() + m_Timer / Time.InMilliseconds), false, m_Map); - - // Update tower visibility and update faction - foreach (var guid in CanonList) - { - Creature creature = GetCreature(guid); - if (creature) - { - ShowNpc(creature, true); - creature.SetFaction(WGConst.WintergraspFaction[GetDefenderTeam()]); - } - } - - // Rebuild all wall - foreach (var wall in BuildingsInZone) - { - if (wall != null) - { - wall.Rebuild(); - wall.UpdateTurretAttack(false); - } - } - - SetData(WGData.BrokenTowerAtt, 0); - SetData(WGData.BrokenTowerDef, 0); - SetData(WGData.DamagedTowerAtt, 0); - SetData(WGData.DamagedTowerDef, 0); - - // Update graveyard (in no war time all graveyard is to deffender, in war time, depend of base) - foreach (var workShop in Workshops) - { - if (workShop != null) - workShop.UpdateGraveyardAndWorkshop(); - } - - for (byte team = 0; team < SharedConst.PvpTeamsCount; ++team) - { - foreach (var guid in m_players[team]) - { - // Kick player in orb room, TODO: offline player ? - Player player = Global.ObjAccessor.FindPlayer(guid); - if (player) - { - float x, y, z; - player.GetPosition(out x, out y, out z); - if (5500 > x && x > 5392 && y < 2880 && y > 2800 && z < 480) - player.TeleportTo(571, 5349.8686f, 2838.481f, 409.240f, 0.046328f); - } - } - } - // Initialize vehicle counter - UpdateCounterVehicle(true); - // Send start warning to all players - SendWarning(WintergraspText.StartBattle); - } - - public void UpdateCounterVehicle(bool init) - { - if (init) - { - SetData(WGData.VehicleH, 0); - SetData(WGData.VehicleA, 0); - } - SetData(WGData.MaxVehicleH, 0); - SetData(WGData.MaxVehicleA, 0); - - foreach (var workshop in Workshops) - { - if (workshop.GetTeamControl() == TeamId.Alliance) - UpdateData(WGData.MaxVehicleA, 4); - else if (workshop.GetTeamControl() == TeamId.Horde) - UpdateData(WGData.MaxVehicleH, 4); - } - - UpdateVehicleCountWG(); - } - - public override void OnBattleEnd(bool endByTimer) - { - // Remove relic - if (!m_titansRelicGUID.IsEmpty()) - { - GameObject relic = GetGameObject(m_titansRelicGUID); - if (relic) - relic.RemoveFromWorld(); - } - m_titansRelicGUID.Clear(); - - // change collision wall state closed - foreach (BfWGGameObjectBuilding building in BuildingsInZone) - building.RebuildGate(); - - // update win statistics - { - WorldStates worldStateId; - // successful defense - if (endByTimer) - worldStateId = GetDefenderTeam() == TeamId.Horde ? WorldStates.BattlefieldWgDefendedH : WorldStates.BattlefieldWgDefendedA; - // successful attack (note that teams have already been swapped, so defender team is the one who won) - else - worldStateId = GetDefenderTeam() == TeamId.Horde ? WorldStates.BattlefieldWgAttackedH : WorldStates.BattlefieldWgAttackedA; - - Global.WorldStateMgr.SetValueAndSaveInDb(worldStateId, Global.WorldStateMgr.GetValue((int)worldStateId, m_Map) + 1, false, m_Map); - } - - Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.BattlefieldWgDefender, (int)GetDefenderTeam(), false, m_Map); - Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.BattlefieldWgShowTimeNextBattle, 1, false, m_Map); - Global.WorldStateMgr.SetValue(WorldStates.BattlefieldWgShowTimeBattleEnd, 0, false, m_Map); - Global.WorldStateMgr.SetValue(WGConst.ClockWorldState[1], (int)(GameTime.GetGameTime() + m_Timer / Time.InMilliseconds), false, m_Map); - - // Remove turret - foreach (var guid in CanonList) - { - Creature creature = GetCreature(guid); - if (creature) - { - if (!endByTimer) - creature.SetFaction(WGConst.WintergraspFaction[GetDefenderTeam()]); - HideNpc(creature); - } - } - - // Update all graveyard, control is to defender when no wartime - for (byte i = 0; i < WGGraveyardId.Horde; i++) - { - BfGraveyard graveyard = GetGraveyardById(i); - if (graveyard != null) - graveyard.GiveControlTo(GetDefenderTeam()); - } - - // Update portals - foreach (var guid in DefenderPortalList[GetDefenderTeam()]) - { - GameObject portal = GetGameObject(guid); - if (portal) - portal.SetRespawnTime((int)BattlegroundConst.RespawnImmediately); - } - - foreach (var guid in DefenderPortalList[GetAttackerTeam()]) - { - GameObject portal = GetGameObject(guid); - if (portal) - portal.SetRespawnTime((int)BattlegroundConst.RespawnOneDay); - } - - foreach (var guid in m_PlayersInWar[GetDefenderTeam()]) - { - Player player = Global.ObjAccessor.FindPlayer(guid); - if (player) - { - player.CastSpell(player, WGSpells.EssenceOfWintergrasp, true); - player.CastSpell(player, WGSpells.VictoryReward, true); - // Complete victory quests - player.AreaExploredOrEventHappens(WintergraspQuests.VictoryAlliance); - player.AreaExploredOrEventHappens(WintergraspQuests.VictoryHorde); - // Send Wintergrasp victory achievement - DoCompleteOrIncrementAchievement(WGAchievements.WinWg, player); - // Award achievement for succeeding in Wintergrasp in 10 minutes or less - if (!endByTimer && GetTimer() <= 10000) - DoCompleteOrIncrementAchievement(WGAchievements.WinWgTimer10, player); - } - } - - foreach (var guid in m_PlayersInWar[GetAttackerTeam()]) - { - Player player = Global.ObjAccessor.FindPlayer(guid); - if (player) - player.CastSpell(player, WGSpells.DefeatReward, true); - } - - for (byte team = 0; team < SharedConst.PvpTeamsCount; ++team) - { - foreach (var guid in m_PlayersInWar[team]) - { - Player player = Global.ObjAccessor.FindPlayer(guid); - if (player) - RemoveAurasFromPlayer(player); - } - - m_PlayersInWar[team].Clear(); - - foreach (var guid in m_vehicles[team]) - { - Creature creature = GetCreature(guid); - if (creature) - if (creature.IsVehicle()) - creature.DespawnOrUnsummon(); - } - - m_vehicles[team].Clear(); - } - - if (!endByTimer) - { - for (byte team = 0; team < SharedConst.PvpTeamsCount; ++team) - { - foreach (var guid in m_players[team]) - { - Player player = Global.ObjAccessor.FindPlayer(guid); - if (player) - { - player.RemoveAurasDueToSpell(m_DefenderTeam == TeamId.Alliance ? WGSpells.HordeControlPhaseShift : WGSpells.AllianceControlPhaseShift, player.GetGUID()); - player.AddAura(m_DefenderTeam == TeamId.Horde ? WGSpells.HordeControlPhaseShift : WGSpells.AllianceControlPhaseShift, player); - } - } - } - } - - if (!endByTimer) // win alli/horde - SendWarning((GetDefenderTeam() == TeamId.Alliance) ? WintergraspText.FortressCaptureAlliance : WintergraspText.FortressCaptureHorde); - else // defend alli/horde - SendWarning((GetDefenderTeam() == TeamId.Alliance) ? WintergraspText.FortressDefendAlliance : WintergraspText.FortressDefendHorde); - } - - public override void DoCompleteOrIncrementAchievement(uint achievement, Player player, byte incrementNumber = 1) - { - AchievementRecord achievementEntry = CliDB.AchievementStorage.LookupByKey(achievement); - if (achievementEntry == null) - return; - - switch (achievement) - { - //removed by TC - //case ACHIEVEMENTS_WIN_WG_100: - //{ - // player.UpdateAchievementCriteria(); - //} - default: - { - if (player) - player.CompletedAchievement(achievementEntry); - break; - } - } - } - - public override void OnStartGrouping() - { - SendWarning(WintergraspText.StartGrouping); - } - - uint GetSpiritGraveyardId(uint areaId) - { - switch ((AreaId)areaId) - { - case AreaId.WintergraspFortress: - return WGGraveyardId.Keep; - case AreaId.TheSunkenRing: - return WGGraveyardId.WorkshopNE; - case AreaId.TheBrokenTemplate: - return WGGraveyardId.WorkshopNW; - case AreaId.WestparkWorkshop: - return WGGraveyardId.WorkshopSW; - case AreaId.EastparkWorkshop: - return WGGraveyardId.WorkshopSE; - case AreaId.Wintergrasp: - return WGGraveyardId.Alliance; - case AreaId.TheChilledQuagmire: - return WGGraveyardId.Horde; - default: - Log.outError(LogFilter.Battlefield, "BattlefieldWG.GetSpiritGraveyardId: Unexpected Area Id {0}", areaId); - break; - } - - return 0; - } - - public override void OnCreatureCreate(Creature creature) - { - // Accessing to db spawned creatures - switch (creature.GetEntry()) - { - case WGNpcs.DwarvenSpiritGuide: - case WGNpcs.TaunkaSpiritGuide: - { - int teamIndex = (creature.GetEntry() == WGNpcs.DwarvenSpiritGuide ? TeamId.Alliance : TeamId.Horde); - byte graveyardId = (byte)GetSpiritGraveyardId(creature.GetAreaId()); - if (m_GraveyardList[graveyardId] != null) - m_GraveyardList[graveyardId].SetSpirit(creature, teamIndex); - break; - } - } - - // untested code - not sure if it is valid. - if (IsWarTime()) - { - switch (creature.GetEntry()) - { - case WGNpcs.SiegeEngineAlliance: - case WGNpcs.SiegeEngineHorde: - case WGNpcs.Catapult: - case WGNpcs.Demolisher: - { - if (!creature.ToTempSummon() || creature.ToTempSummon().GetSummonerGUID().IsEmpty() || !Global.ObjAccessor.FindPlayer(creature.ToTempSummon().GetSummonerGUID())) - { - creature.DespawnOrUnsummon(); - return; - } - - Player creator = Global.ObjAccessor.FindPlayer(creature.ToTempSummon().GetSummonerGUID()); - int teamIndex = creator.GetTeamId(); - if (teamIndex == TeamId.Horde) - { - if (GetData(WGData.VehicleH) < GetData(WGData.MaxVehicleH)) - { - UpdateData(WGData.VehicleH, 1); - creature.AddAura(WGSpells.HordeFlag, creature); - m_vehicles[teamIndex].Add(creature.GetGUID()); - UpdateVehicleCountWG(); - } - else - { - creature.DespawnOrUnsummon(); - return; - } - } - else - { - if (GetData(WGData.VehicleA) < GetData(WGData.MaxVehicleA)) - { - UpdateData(WGData.VehicleA, 1); - creature.AddAura(WGSpells.AllianceFlag, creature); - m_vehicles[teamIndex].Add(creature.GetGUID()); - UpdateVehicleCountWG(); - } - else - { - creature.DespawnOrUnsummon(); - return; - } - } - - creature.CastSpell(creator, WGSpells.GrabPassenger, true); - break; - } - } - } - } - - public override void OnCreatureRemove(Creature c) { } - - public override void OnGameObjectCreate(GameObject go) - { - uint workshopId; - - switch (go.GetEntry()) - { - case WGGameObjects.FactoryBannerNe: - workshopId = WGWorkshopIds.Ne; - break; - case WGGameObjects.FactoryBannerNw: - workshopId = WGWorkshopIds.Nw; - break; - case WGGameObjects.FactoryBannerSe: - workshopId = WGWorkshopIds.Se; - break; - case WGGameObjects.FactoryBannerSw: - workshopId = WGWorkshopIds.Sw; - break; - default: - return; - } - - foreach (var workshop in Workshops) - { - if (workshop.GetId() == workshopId) - { - WintergraspCapturePoint capturePoint = new(this, GetAttackerTeam()); - - capturePoint.SetCapturePointData(go); - capturePoint.LinkToWorkshop(workshop); - AddCapturePoint(capturePoint); - break; - } - } - } - - public override void HandleKill(Player killer, Unit victim) - { - if (killer == victim) - return; - - if (victim.IsTypeId(TypeId.Player)) - { - HandlePromotion(killer, victim); - // Allow to Skin non-released corpse - victim.SetUnitFlag(UnitFlags.Skinnable); - } - - // @todo Recent PvP activity worldstate - } - - bool FindAndRemoveVehicleFromList(Unit vehicle) - { - for (byte i = 0; i < SharedConst.PvpTeamsCount; ++i) - { - if (m_vehicles[i].Contains(vehicle.GetGUID())) - { - m_vehicles[i].Remove(vehicle.GetGUID()); - if (i == TeamId.Horde) - UpdateData(WGData.VehicleH, -1); - else - UpdateData(WGData.VehicleA, -1); - return true; - } - } - return false; - } - - public override void OnUnitDeath(Unit unit) - { - if (IsWarTime()) - if (unit.IsVehicle()) - if (FindAndRemoveVehicleFromList(unit)) - UpdateVehicleCountWG(); - } - - public void HandlePromotion(Player playerKiller, Unit unitKilled) - { - int teamId = playerKiller.GetTeamId(); - - foreach (var guid in m_PlayersInWar[teamId]) - { - Player player = Global.ObjAccessor.FindPlayer(guid); - if (player) - if (player.GetDistance2d(unitKilled) < 40.0f) - PromotePlayer(player); - } - } - - // Update rank for player - void PromotePlayer(Player killer) - { - if (!m_isActive) - return; - // Updating rank of player - Aura aur = killer.GetAura(WGSpells.Recruit); - if (aur != null) - { - if (aur.GetStackAmount() >= 5) - { - killer.RemoveAura(WGSpells.Recruit); - killer.CastSpell(killer, WGSpells.Corporal, true); - Creature stalker = GetCreature(StalkerGuid); - if (stalker) - Global.CreatureTextMgr.SendChat(stalker, WintergraspText.RankCorporal, killer, ChatMsg.Addon, Language.Addon, CreatureTextRange.Normal, 0, SoundKitPlayType.Normal, Team.Other, false, killer); - } - else - killer.CastSpell(killer, WGSpells.Recruit, true); - } - else if ((aur = killer.GetAura(WGSpells.Corporal)) != null) - { - if (aur.GetStackAmount() >= 5) - { - killer.RemoveAura(WGSpells.Corporal); - killer.CastSpell(killer, WGSpells.Lieutenant, true); - Creature stalker = GetCreature(StalkerGuid); - if (stalker) - Global.CreatureTextMgr.SendChat(stalker, WintergraspText.RankFirstLieutenant, killer, ChatMsg.Addon, Language.Addon, CreatureTextRange.Normal, 0, SoundKitPlayType.Normal, Team.Other, false, killer); - } - else - killer.CastSpell(killer, WGSpells.Corporal, true); - } - } - - void RemoveAurasFromPlayer(Player player) - { - player.RemoveAurasDueToSpell(WGSpells.Recruit); - player.RemoveAurasDueToSpell(WGSpells.Corporal); - player.RemoveAurasDueToSpell(WGSpells.Lieutenant); - player.RemoveAurasDueToSpell(WGSpells.TowerControl); - player.RemoveAurasDueToSpell(WGSpells.SpiritualImmunity); - player.RemoveAurasDueToSpell(WGSpells.Tenacity); - player.RemoveAurasDueToSpell(WGSpells.EssenceOfWintergrasp); - player.RemoveAurasDueToSpell(WGSpells.WintergraspRestrictedFlightArea); - } - - public override void OnPlayerJoinWar(Player player) - { - RemoveAurasFromPlayer(player); - - player.CastSpell(player, WGSpells.Recruit, true); - - if (player.GetZoneId() != m_ZoneId) - { - if (player.GetTeamId() == GetDefenderTeam()) - player.TeleportTo(571, 5345, 2842, 410, 3.14f); - else - { - if (player.GetTeamId() == TeamId.Horde) - player.TeleportTo(571, 5025.857422f, 3674.628906f, 362.737122f, 4.135169f); - else - player.TeleportTo(571, 5101.284f, 2186.564f, 373.549f, 3.812f); - } - } - - UpdateTenacity(); - - if (player.GetTeamId() == GetAttackerTeam()) - { - if (GetData(WGData.BrokenTowerAtt) < 3) - player.SetAuraStack(WGSpells.TowerControl, player, 3 - GetData(WGData.BrokenTowerAtt)); - } - else - { - if (GetData(WGData.BrokenTowerAtt) > 0) - player.SetAuraStack(WGSpells.TowerControl, player, GetData(WGData.BrokenTowerAtt)); - } - } - - public override void OnPlayerLeaveWar(Player player) - { - // Remove all aura from WG // @todo false we can go out of this zone on retail and keep Rank buff, remove on end of WG - if (!player.GetSession().PlayerLogout()) - { - Creature vehicle = player.GetVehicleCreatureBase(); - if (vehicle) // Remove vehicle of player if he go out. - vehicle.DespawnOrUnsummon(); - - RemoveAurasFromPlayer(player); - } - - player.RemoveAurasDueToSpell(WGSpells.HordeControlsFactoryPhaseShift); - player.RemoveAurasDueToSpell(WGSpells.AllianceControlsFactoryPhaseShift); - player.RemoveAurasDueToSpell(WGSpells.HordeControlPhaseShift); - player.RemoveAurasDueToSpell(WGSpells.AllianceControlPhaseShift); - UpdateTenacity(); - } - - public override void OnPlayerLeaveZone(Player player) - { - if (!m_isActive) - RemoveAurasFromPlayer(player); - - player.RemoveAurasDueToSpell(WGSpells.HordeControlsFactoryPhaseShift); - player.RemoveAurasDueToSpell(WGSpells.AllianceControlsFactoryPhaseShift); - player.RemoveAurasDueToSpell(WGSpells.HordeControlPhaseShift); - player.RemoveAurasDueToSpell(WGSpells.AllianceControlPhaseShift); - } - - public override void OnPlayerEnterZone(Player player) - { - if (!m_isActive) - RemoveAurasFromPlayer(player); - - player.AddAura(m_DefenderTeam == TeamId.Horde ? WGSpells.HordeControlPhaseShift : WGSpells.AllianceControlPhaseShift, player); - } - - public override uint GetData(uint data) - { - switch ((AreaId)data) - { - // Used to determine when the phasing spells must be cast - // See: SpellArea.IsFitToRequirements - case AreaId.TheSunkenRing: - case AreaId.TheBrokenTemplate: - case AreaId.WestparkWorkshop: - case AreaId.EastparkWorkshop: - // Graveyards and Workshops are controlled by the same team. - BfGraveyard graveyard = GetGraveyardById((int)GetSpiritGraveyardId(data)); - if (graveyard != null) - return graveyard.GetControlTeamId(); - break; - default: - break; - } - - return base.GetData(data); - } - - public void BrokenWallOrTower(uint team, BfWGGameObjectBuilding building) - { - if (team == GetDefenderTeam()) - { - foreach (var guid in m_PlayersInWar[GetAttackerTeam()]) - { - Player player = Global.ObjAccessor.FindPlayer(guid); - if (player) - if (player.GetDistance2d(GetGameObject(building.GetGUID())) < 50.0f) - player.KilledMonsterCredit(WintergraspQuests.CreditDefendSiege); - } - } - } - - // Called when a tower is broke - public void UpdatedDestroyedTowerCount(uint team) - { - // Southern tower - if (team == GetAttackerTeam()) - { - // Update counter - UpdateData(WGData.DamagedTowerAtt, -1); - UpdateData(WGData.BrokenTowerAtt, 1); - - // Remove buff stack on attackers - foreach (var guid in m_PlayersInWar[GetAttackerTeam()]) - { - Player player = Global.ObjAccessor.FindPlayer(guid); - if (player) - player.RemoveAuraFromStack(WGSpells.TowerControl); - } - - // Add buff stack to defenders and give achievement/quest credit - foreach (var guid in m_PlayersInWar[GetDefenderTeam()]) - { - Player player = Global.ObjAccessor.FindPlayer(guid); - if (player) - { - player.CastSpell(player, WGSpells.TowerControl, true); - player.KilledMonsterCredit(WintergraspQuests.CreditTowersDestroyed); - DoCompleteOrIncrementAchievement(WGAchievements.WgTowerDestroy, player); - } - } - - // If all three south towers are destroyed (ie. all attack towers), remove ten minutes from battle time - if (GetData(WGData.BrokenTowerAtt) == 3) - { - if ((int)(m_Timer - 600000) < 0) - m_Timer = 0; - else - m_Timer -= 600000; - - Global.WorldStateMgr.SetValue(WGConst.ClockWorldState[0], (int)(GameTime.GetGameTime() + m_Timer / Time.InMilliseconds), false, m_Map); - } - } - else // Keep tower - { - UpdateData(WGData.DamagedTowerDef, -1); - UpdateData(WGData.BrokenTowerDef, 1); - } - } - - public override void ProcessEvent(WorldObject obj, uint eventId, WorldObject invoker) - { - if (!obj || !IsWarTime()) - return; - - // We handle only gameobjects here - GameObject go = obj.ToGameObject(); - if (!go) - return; - - // On click on titan relic - if (go.GetEntry() == WGGameObjects.TitanSRelic) - { - GameObject relic = GetRelic(); - if (CanInteractWithRelic()) - EndBattle(false); - else if (relic) - relic.SetRespawnTime(0); - } - - // if destroy or damage event, search the wall/tower and update worldstate/send warning message - foreach (var building in BuildingsInZone) - { - if (go.GetGUID() == building.GetGUID()) - { - GameObject buildingGo = GetGameObject(building.GetGUID()); - if (buildingGo) - { - if (buildingGo.GetGoInfo().DestructibleBuilding.DamagedEvent == eventId) - building.Damaged(); - - if (buildingGo.GetGoInfo().DestructibleBuilding.DestroyedEvent == eventId) - building.Destroyed(); - - break; - } - } - } - } - - // Called when a tower is damaged, used for honor reward calcul - public void UpdateDamagedTowerCount(uint team) - { - if (team == GetAttackerTeam()) - UpdateData(WGData.DamagedTowerAtt, 1); - else - UpdateData(WGData.DamagedTowerDef, 1); - } - - // Update vehicle count WorldState to player - void UpdateVehicleCountWG() - { - Global.WorldStateMgr.SetValue(WorldStates.BattlefieldWgVehicleH, (int)GetData(WGData.VehicleH), false, m_Map); - Global.WorldStateMgr.SetValue(WorldStates.BattlefieldWgMaxVehicleH, (int)GetData(WGData.MaxVehicleH), false, m_Map); - Global.WorldStateMgr.SetValue(WorldStates.BattlefieldWgVehicleA, (int)GetData(WGData.VehicleA), false, m_Map); - Global.WorldStateMgr.SetValue(WorldStates.BattlefieldWgMaxVehicleA, (int)GetData(WGData.MaxVehicleA), false, m_Map); - } - - void UpdateTenacity() - { - int alliancePlayers = m_PlayersInWar[TeamId.Alliance].Count; - int hordePlayers = m_PlayersInWar[TeamId.Horde].Count; - int newStack = 0; - - if (alliancePlayers != 0 && hordePlayers != 0) - { - if (alliancePlayers < hordePlayers) - newStack = (int)((((float)hordePlayers / alliancePlayers) - 1) * 4); // positive, should cast on alliance - else if (alliancePlayers > hordePlayers) - newStack = (int)((1 - ((float)alliancePlayers / hordePlayers)) * 4); // negative, should cast on horde - } - - if (newStack == m_tenacityStack) - return; - - m_tenacityStack = (uint)newStack; - // Remove old buff - if (m_tenacityTeam != TeamId.Neutral) - { - foreach (var guid in m_players[m_tenacityTeam]) - { - Player player = Global.ObjAccessor.FindPlayer(guid); - if (player) - if (player.GetLevel() >= m_MinLevel) - player.RemoveAurasDueToSpell(WGSpells.Tenacity); - } - - foreach (var guid in m_vehicles[m_tenacityTeam]) - { - Creature creature = GetCreature(guid); - if (creature) - creature.RemoveAurasDueToSpell(WGSpells.TenacityVehicle); - } - } - - // Apply new buff - if (newStack != 0) - { - m_tenacityTeam = newStack > 0 ? TeamId.Alliance : TeamId.Horde; - - if (newStack < 0) - newStack = -newStack; - if (newStack > 20) - newStack = 20; - - uint buff_honor = WGSpells.GreatestHonor; - if (newStack < 15) - buff_honor = WGSpells.GreaterHonor; - if (newStack < 10) - buff_honor = WGSpells.GreatHonor; - if (newStack < 5) - buff_honor = 0; - - foreach (var guid in m_PlayersInWar[m_tenacityTeam]) - { - Player player = Global.ObjAccessor.FindPlayer(guid); - if (player) - player.SetAuraStack(WGSpells.Tenacity, player, (uint)newStack); - } - - foreach (var guid in m_vehicles[m_tenacityTeam]) - { - Creature creature = GetCreature(guid); - if (creature) - creature.SetAuraStack(WGSpells.TenacityVehicle, creature, (uint)newStack); - } - - if (buff_honor != 0) - { - foreach (var guid in m_PlayersInWar[m_tenacityTeam]) - { - Player player = Global.ObjAccessor.FindPlayer(guid); - if (player) - player.CastSpell(player, buff_honor, true); - } - - foreach (var guid in m_vehicles[m_tenacityTeam]) - { - Creature creature = GetCreature(guid); - if (creature) - creature.CastSpell(creature, buff_honor, true); - } - } - } - else - m_tenacityTeam = TeamId.Neutral; - } - - public GameObject GetRelic() { return GetGameObject(m_titansRelicGUID); } - - // Define relic object - void SetRelic(ObjectGuid relicGUID) { m_titansRelicGUID = relicGUID; } - - // Check if players can interact with the relic (Only if the last door has been broken) - bool CanInteractWithRelic() { return m_isRelicInteractible; } - - // Define if player can interact with the relic - public void SetRelicInteractible(bool allow) { m_isRelicInteractible = allow; } - - - bool m_isRelicInteractible; - - List Workshops = new(); - - List[] DefenderPortalList = new List[SharedConst.PvpTeamsCount]; - List BuildingsInZone = new(); - - List[] m_vehicles = new List[SharedConst.PvpTeamsCount]; - List CanonList = new(); - - int m_tenacityTeam; - uint m_tenacityStack; - - ObjectGuid m_titansRelicGUID; - } - - class BfWGGameObjectBuilding - { - public BfWGGameObjectBuilding(BattlefieldWG WG, WGGameObjectBuildingType type, uint worldState) - { - _wg = WG; - _teamControl = TeamId.Neutral; - _type = type; - _worldState = worldState; - _state = WGGameObjectState.None; - - for (var i = 0; i < 2; ++i) - { - m_GameObjectList[i] = new List(); - m_CreatureBottomList[i] = new List(); - m_CreatureTopList[i] = new List(); - } - } - - public void Rebuild() - { - switch (_type) - { - case WGGameObjectBuildingType.KeepTower: - case WGGameObjectBuildingType.DoorLast: - case WGGameObjectBuildingType.Door: - case WGGameObjectBuildingType.Wall: - _teamControl = _wg.GetDefenderTeam(); // Objects that are part of the keep should be the defender's - break; - case WGGameObjectBuildingType.Tower: - _teamControl = _wg.GetAttackerTeam(); // The towers in the south should be the attacker's - break; - default: - _teamControl = TeamId.Neutral; - break; - } - - GameObject build = _wg.GetGameObject(_buildGUID); - if (build) - { - // Rebuild gameobject - if (build.IsDestructibleBuilding()) - { - build.SetDestructibleState(GameObjectDestructibleState.Rebuilding, null, true); - if (build.GetEntry() == WGGameObjects.VaultGate) - { - GameObject go = build.FindNearestGameObject(WGGameObjects.KeepCollisionWall, 50.0f); - if (go) - go.SetGoState(GameObjectState.Active); - } - - // Update worldstate - _state = WGGameObjectState.AllianceIntact - ((int)_teamControl * 3); - Global.WorldStateMgr.SetValueAndSaveInDb((int)_worldState, (int)_state, false, _wg.GetMap()); - } - UpdateCreatureAndGo(); - build.SetFaction(WGConst.WintergraspFaction[_teamControl]); - } - } - - public void RebuildGate() - { - GameObject build = _wg.GetGameObject(_buildGUID); - if (build != null) - { - if (build.IsDestructibleBuilding() && build.GetEntry() == WGGameObjects.VaultGate) - { - GameObject go = build.FindNearestGameObject(WGGameObjects.KeepCollisionWall, 50.0f); - if (go != null) - go.SetGoState(GameObjectState.Ready); //not GO_STATE_ACTIVE - } - } - } - - // Called when associated gameobject is damaged - public void Damaged() - { - // Update worldstate - _state = WGGameObjectState.AllianceDamage - ((int)_teamControl * 3); - Global.WorldStateMgr.SetValueAndSaveInDb((int)_worldState, (int)_state, false, _wg.GetMap()); - - // Send warning message - if (_staticTowerInfo != null) // tower damage + name - _wg.SendWarning(_staticTowerInfo.DamagedTextId); - - foreach (var guid in m_CreatureTopList[_wg.GetAttackerTeam()]) - { - Creature creature = _wg.GetCreature(guid); - if (creature) - _wg.HideNpc(creature); - } - - foreach (var guid in m_TurretTopList) - { - Creature creature = _wg.GetCreature(guid); - if (creature) - _wg.HideNpc(creature); - } - - if (_type == WGGameObjectBuildingType.KeepTower) - _wg.UpdateDamagedTowerCount(_wg.GetDefenderTeam()); - else if (_type == WGGameObjectBuildingType.Tower) - _wg.UpdateDamagedTowerCount(_wg.GetAttackerTeam()); - } - - // Called when associated gameobject is destroyed - public void Destroyed() - { - // Update worldstate - _state = WGGameObjectState.AllianceDestroy - ((int)_teamControl * 3); - Global.WorldStateMgr.SetValueAndSaveInDb((int)_worldState, (int)_state, false, _wg.GetMap()); - - // Warn players - if (_staticTowerInfo != null) - _wg.SendWarning(_staticTowerInfo.DestroyedTextId); - - switch (_type) - { - // Inform the global wintergrasp script of the destruction of this object - case WGGameObjectBuildingType.Tower: - case WGGameObjectBuildingType.KeepTower: - _wg.UpdatedDestroyedTowerCount(_teamControl); - break; - case WGGameObjectBuildingType.DoorLast: - GameObject build = _wg.GetGameObject(_buildGUID); - if (build) - { - GameObject go = build.FindNearestGameObject(WGGameObjects.KeepCollisionWall, 50.0f); - if (go) - go.SetGoState(GameObjectState.Active); - } - _wg.SetRelicInteractible(true); - if (_wg.GetRelic()) - _wg.GetRelic().RemoveFlag(GameObjectFlags.InUse | GameObjectFlags.NotSelectable); - else - Log.outError(LogFilter.Server, "BattlefieldWG: Titan Relic not found."); - break; - } - - _wg.BrokenWallOrTower(_teamControl, this); - } - - public void Init(GameObject go) - { - if (!go) - return; - - // GameObject associated to object - _buildGUID = go.GetGUID(); - - switch (_type) - { - case WGGameObjectBuildingType.KeepTower: - case WGGameObjectBuildingType.DoorLast: - case WGGameObjectBuildingType.Door: - case WGGameObjectBuildingType.Wall: - _teamControl = _wg.GetDefenderTeam(); // Objects that are part of the keep should be the defender's - break; - case WGGameObjectBuildingType.Tower: - _teamControl = _wg.GetAttackerTeam(); // The towers in the south should be the attacker's - break; - default: - _teamControl = TeamId.Neutral; - break; - } - - _state = (WGGameObjectState)Global.WorldStateMgr.GetValue((int)_worldState, _wg.GetMap()); - if (_state == WGGameObjectState.None) - { - // set to default state based on type - switch (_teamControl) - { - case TeamId.Alliance: - _state = WGGameObjectState.AllianceIntact; - break; - case TeamId.Horde: - _state = WGGameObjectState.HordeIntact; - break; - case TeamId.Neutral: - _state = WGGameObjectState.NeutralIntact; - break; - default: - break; - } - Global.WorldStateMgr.SetValueAndSaveInDb((int)_worldState, (int)_state, false, _wg.GetMap()); - } - - switch (_state) - { - case WGGameObjectState.NeutralIntact: - case WGGameObjectState.AllianceIntact: - case WGGameObjectState.HordeIntact: - go.SetDestructibleState(GameObjectDestructibleState.Rebuilding, null, true); - break; - case WGGameObjectState.NeutralDestroy: - case WGGameObjectState.AllianceDestroy: - case WGGameObjectState.HordeDestroy: - go.SetDestructibleState(GameObjectDestructibleState.Destroyed); - break; - case WGGameObjectState.NeutralDamage: - case WGGameObjectState.AllianceDamage: - case WGGameObjectState.HordeDamage: - go.SetDestructibleState(GameObjectDestructibleState.Damaged); - break; - } - - int towerId = -1; - switch (go.GetEntry()) - { - case WGGameObjects.FortressTower1: - towerId = 0; - break; - case WGGameObjects.FortressTower2: - towerId = 1; - break; - case WGGameObjects.FortressTower3: - towerId = 2; - break; - case WGGameObjects.FortressTower4: - towerId = 3; - break; - case WGGameObjects.ShadowsightTower: - towerId = 4; - break; - case WGGameObjects.WinterSEdgeTower: - towerId = 5; - break; - case WGGameObjects.FlamewatchTower: - towerId = 6; - break; - } - - if (towerId > 3) // Attacker towers - { - // Spawn associate gameobjects - foreach (var gobData in WGConst.AttackTowers[towerId - 4].GameObject) - { - GameObject goHorde = _wg.SpawnGameObject(gobData.HordeEntry, gobData.Pos, gobData.Rot); - if (goHorde) - m_GameObjectList[TeamId.Horde].Add(goHorde.GetGUID()); - - GameObject goAlliance = _wg.SpawnGameObject(gobData.AllianceEntry, gobData.Pos, gobData.Rot); - if (goAlliance) - m_GameObjectList[TeamId.Alliance].Add(goAlliance.GetGUID()); - } - - // Spawn associate npc bottom - foreach (var creatureData in WGConst.AttackTowers[towerId - 4].CreatureBottom) - { - Creature creature = _wg.SpawnCreature(creatureData.HordeEntry, creatureData.Pos); - if (creature) - m_CreatureBottomList[TeamId.Horde].Add(creature.GetGUID()); - - creature = _wg.SpawnCreature(creatureData.AllianceEntry, creatureData.Pos); - if (creature) - m_CreatureBottomList[TeamId.Alliance].Add(creature.GetGUID()); - } - } - - if (towerId >= 0) - { - _staticTowerInfo = WGConst.TowerData[towerId]; - - // Spawn Turret bottom - foreach (var turretPos in WGConst.TowerCannon[towerId].TowerCannonBottom) - { - Creature turret = _wg.SpawnCreature(WGNpcs.TowerCannon, turretPos); - if (turret) - { - m_TowerCannonBottomList.Add(turret.GetGUID()); - switch (go.GetEntry()) - { - case WGGameObjects.FortressTower1: - case WGGameObjects.FortressTower2: - case WGGameObjects.FortressTower3: - case WGGameObjects.FortressTower4: - turret.SetFaction(WGConst.WintergraspFaction[_wg.GetDefenderTeam()]); - break; - case WGGameObjects.ShadowsightTower: - case WGGameObjects.WinterSEdgeTower: - case WGGameObjects.FlamewatchTower: - turret.SetFaction(WGConst.WintergraspFaction[_wg.GetAttackerTeam()]); - break; - } - _wg.HideNpc(turret); - } - } - - // Spawn Turret top - foreach (var towerCannonPos in WGConst.TowerCannon[towerId].TurretTop) - { - Creature turret = _wg.SpawnCreature(WGNpcs.TowerCannon, towerCannonPos); - if (turret) - { - m_TurretTopList.Add(turret.GetGUID()); - switch (go.GetEntry()) - { - case WGGameObjects.FortressTower1: - case WGGameObjects.FortressTower2: - case WGGameObjects.FortressTower3: - case WGGameObjects.FortressTower4: - turret.SetFaction(WGConst.WintergraspFaction[_wg.GetDefenderTeam()]); - break; - case WGGameObjects.ShadowsightTower: - case WGGameObjects.WinterSEdgeTower: - case WGGameObjects.FlamewatchTower: - turret.SetFaction(WGConst.WintergraspFaction[_wg.GetAttackerTeam()]); - break; - } - _wg.HideNpc(turret); - } - } - UpdateCreatureAndGo(); - } - } - - void UpdateCreatureAndGo() - { - foreach (var guid in m_CreatureTopList[_wg.GetDefenderTeam()]) - { - Creature creature = _wg.GetCreature(guid); - if (creature) - _wg.HideNpc(creature); - } - - foreach (var guid in m_CreatureTopList[_wg.GetAttackerTeam()]) - { - Creature creature = _wg.GetCreature(guid); - if (creature) - _wg.ShowNpc(creature, true); - } - - foreach (var guid in m_CreatureBottomList[_wg.GetDefenderTeam()]) - { - Creature creature = _wg.GetCreature(guid); - if (creature) - _wg.HideNpc(creature); - } - - foreach (var guid in m_CreatureBottomList[_wg.GetAttackerTeam()]) - { - Creature creature = _wg.GetCreature(guid); - if (creature) - _wg.ShowNpc(creature, true); - } - - foreach (var guid in m_GameObjectList[_wg.GetDefenderTeam()]) - { - GameObject obj = _wg.GetGameObject(guid); - if (obj) - obj.SetRespawnTime(Time.Day); - } - - foreach (var guid in m_GameObjectList[_wg.GetAttackerTeam()]) - { - GameObject obj = _wg.GetGameObject(guid); - if (obj) - obj.SetRespawnTime(0); - } - } - - public void UpdateTurretAttack(bool disable) - { - foreach (var guid in m_TowerCannonBottomList) - { - Creature creature = _wg.GetCreature(guid); - if (creature) - { - GameObject build = _wg.GetGameObject(_buildGUID); - if (build) - { - if (disable) - _wg.HideNpc(creature); - else - _wg.ShowNpc(creature, true); - - switch (build.GetEntry()) - { - case WGGameObjects.FortressTower1: - case WGGameObjects.FortressTower2: - case WGGameObjects.FortressTower3: - case WGGameObjects.FortressTower4: - { - creature.SetFaction(WGConst.WintergraspFaction[_wg.GetDefenderTeam()]); - break; - } - case WGGameObjects.ShadowsightTower: - case WGGameObjects.WinterSEdgeTower: - case WGGameObjects.FlamewatchTower: - { - creature.SetFaction(WGConst.WintergraspFaction[_wg.GetAttackerTeam()]); - break; - } - } - } - } - } - - foreach (var guid in m_TurretTopList) - { - Creature creature = _wg.GetCreature(guid); - if (creature) - { - GameObject build = _wg.GetGameObject(_buildGUID); - if (build) - { - if (disable) - _wg.HideNpc(creature); - else - _wg.ShowNpc(creature, true); - - switch (build.GetEntry()) - { - case WGGameObjects.FortressTower1: - case WGGameObjects.FortressTower2: - case WGGameObjects.FortressTower3: - case WGGameObjects.FortressTower4: - { - creature.SetFaction(WGConst.WintergraspFaction[_wg.GetDefenderTeam()]); - break; - } - case WGGameObjects.ShadowsightTower: - case WGGameObjects.WinterSEdgeTower: - case WGGameObjects.FlamewatchTower: - { - creature.SetFaction(WGConst.WintergraspFaction[_wg.GetAttackerTeam()]); - break; - } - } - } - } - } - } - - public ObjectGuid GetGUID() { return _buildGUID; } - - // WG object - BattlefieldWG _wg; - - // Linked gameobject - ObjectGuid _buildGUID; - - // the team that controls this point - uint _teamControl; - - WGGameObjectBuildingType _type; - uint _worldState; - - WGGameObjectState _state; - - StaticWintergraspTowerInfo _staticTowerInfo; - - // GameObject associations - List[] m_GameObjectList = new List[SharedConst.PvpTeamsCount]; - - // Creature associations - List[] m_CreatureBottomList = new List[SharedConst.PvpTeamsCount]; - List[] m_CreatureTopList = new List[SharedConst.PvpTeamsCount]; - List m_TowerCannonBottomList = new(); - List m_TurretTopList = new(); - } - - class WGWorkshop - { - public WGWorkshop(BattlefieldWG wg, byte type) - { - _wg = wg; - _state = WGGameObjectState.None; - _teamControl = TeamId.Neutral; - _staticInfo = WGConst.WorkshopData[type]; - } - - public byte GetId() - { - return _staticInfo.WorkshopId; - } - - public void GiveControlTo(uint teamId, bool init) - { - switch (teamId) - { - case TeamId.Neutral: - { - // Send warning message to all player to inform a faction attack to a workshop - // alliance / horde attacking a workshop - _wg.SendWarning(_teamControl != 0 ? _staticInfo.HordeAttackTextId : _staticInfo.AllianceAttackTextId); - break; - } - case TeamId.Alliance: - { - // Updating worldstate - _state = WGGameObjectState.AllianceIntact; - Global.WorldStateMgr.SetValueAndSaveInDb(_staticInfo.WorldStateId, (int)_state, false, _wg.GetMap()); - - // Warning message - if (!init) - _wg.SendWarning(_staticInfo.AllianceCaptureTextId); // workshop taken - alliance - - // Found associate graveyard and update it - if (_staticInfo.WorkshopId < WGWorkshopIds.KeepWest) - { - BfGraveyard gy = _wg.GetGraveyardById(_staticInfo.WorkshopId); - if (gy != null) - gy.GiveControlTo(TeamId.Alliance); - } - _teamControl = teamId; - break; - } - case TeamId.Horde: - { - // Update worldstate - _state = WGGameObjectState.HordeIntact; - Global.WorldStateMgr.SetValueAndSaveInDb(_staticInfo.WorldStateId, (int)_state, false, _wg.GetMap()); - - // Warning message - if (!init) - _wg.SendWarning(_staticInfo.HordeCaptureTextId); // workshop taken - horde - - // Update graveyard control - if (_staticInfo.WorkshopId < WGWorkshopIds.KeepWest) - { - BfGraveyard gy = _wg.GetGraveyardById(_staticInfo.WorkshopId); - if (gy != null) - gy.GiveControlTo(TeamId.Horde); - } - - _teamControl = teamId; - break; - } - } - - if (!init) - _wg.UpdateCounterVehicle(false); - } - - public void UpdateGraveyardAndWorkshop() - { - if (_staticInfo.WorkshopId < WGWorkshopIds.Ne) - GiveControlTo(_wg.GetAttackerTeam(), true); - else - GiveControlTo(_wg.GetDefenderTeam(), true); - } - - public uint GetTeamControl() { return _teamControl; } - - BattlefieldWG _wg; // Pointer to wintergrasp - //ObjectGuid _buildGUID; - WGGameObjectState _state; // For worldstate - uint _teamControl; // Team witch control the workshop - - StaticWintergraspWorkshopInfo _staticInfo; - } - - class WintergraspCapturePoint : BfCapturePoint - { - public WintergraspCapturePoint(BattlefieldWG battlefield, uint teamInControl) - : base(battlefield) - { - m_Bf = battlefield; - m_team = teamInControl; - } - - public void LinkToWorkshop(WGWorkshop workshop) { m_Workshop = workshop; } - - public override void ChangeTeam(uint oldteam) - { - Cypher.Assert(m_Workshop != null); - m_Workshop.GiveControlTo(m_team, false); - } - uint GetTeam() { return m_team; } - - protected WGWorkshop m_Workshop; - } - - class BfGraveyardWG : BfGraveyard - { - public BfGraveyardWG(BattlefieldWG battlefield) - : base(battlefield) - { - m_Bf = battlefield; - m_GossipTextId = 0; - } - - public void SetTextId(int textid) { m_GossipTextId = textid; } - int GetTextId() { return m_GossipTextId; } - - protected int m_GossipTextId; - } - - [Script] - class Battlefield_wintergrasp : BattlefieldScript - { - public Battlefield_wintergrasp() : base("battlefield_wg") { } - - public override BattleField GetBattlefield(Map map) - { - return new BattlefieldWG(map); - } - } - - [Script] - class npc_wg_give_promotion_credit : ScriptedAI - { - public npc_wg_give_promotion_credit(Creature creature) : base(creature) { } - - public override void JustDied(Unit killer) - { - if (!killer || !killer.IsPlayer()) - return; - - BattlefieldWG wintergrasp = (BattlefieldWG)Global.BattleFieldMgr.GetBattlefieldByBattleId(killer.GetMap(), BattlefieldIds.WG); - if (wintergrasp == null) - return; - - wintergrasp.HandlePromotion(killer.ToPlayer(), me); - } - } -} diff --git a/Source/Scripts/BattleField/WinterGraspConst.cs b/Source/Scripts/BattleField/WinterGraspConst.cs deleted file mode 100644 index 905857321..000000000 --- a/Source/Scripts/BattleField/WinterGraspConst.cs +++ /dev/null @@ -1,697 +0,0 @@ -// 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 System.Numerics; - -namespace Game.BattleFields -{ - static class WGConst - { - public const uint MapId = 571; // Northrend - - public const byte MaxOutsideNpcs = 14; - public const byte OutsideAllianceNpc = 7; - public const byte MaxWorkshops = 6; - - #region Data - public static BfWGCoordGY[] WGGraveyard = - { - new BfWGCoordGY(5104.750f, 2300.940f, 368.579f, 0.733038f, 1329, WGGossipText.GYNE, TeamId.Neutral), - new BfWGCoordGY(5099.120f, 3466.036f, 368.484f, 5.317802f, 1330, WGGossipText.GYNW, TeamId.Neutral), - new BfWGCoordGY(4314.648f, 2408.522f, 392.642f, 6.268125f, 1333, WGGossipText.GYSE, TeamId.Neutral), - new BfWGCoordGY(4331.716f, 3235.695f, 390.251f, 0.008500f, 1334, WGGossipText.GYSW, TeamId.Neutral), - new BfWGCoordGY(5537.986f, 2897.493f, 517.057f, 4.819249f, 1285, WGGossipText.GYKeep, TeamId.Neutral), - new BfWGCoordGY(5032.454f, 3711.382f, 372.468f, 3.971623f, 1331, WGGossipText.GYHorde, TeamId.Horde), - new BfWGCoordGY(5140.790f, 2179.120f, 390.950f, 1.972220f, 1332, WGGossipText.GYAlliance, TeamId.Alliance), - }; - - public static WorldStates[] ClockWorldState = { WorldStates.BattlefieldWgTimeBattleEnd, WorldStates.BattlefieldWgTimeNextBattle }; - public static uint[] WintergraspFaction = { 1732, 1735, 35 }; - - public static Position WintergraspStalkerPos = new(4948.985f, 2937.789f, 550.5172f, 1.815142f); - - public static Position RelicPos = new(5440.379f, 2840.493f, 430.2816f, -1.832595f); - public static Quaternion RelicRot = new(0.0f, 0.0f, -0.7933531f, 0.6087617f); - - //Destructible (Wall, Tower..) - public static WintergraspBuildingSpawnData[] WGGameObjectBuilding = - { - // Wall (Not spawned in db) - // Entry WS X Y Z O rX rY rZ rW Type - new WintergraspBuildingSpawnData(190219, 3749, 5371.457f, 3047.472f, 407.5710f, 3.14159300f, 0.0f, 0.0f, -1.000000000f, 0.00000000f, WGGameObjectBuildingType.Wall), - new WintergraspBuildingSpawnData(190220, 3750, 5331.264f, 3047.105f, 407.9228f, 0.05235888f, 0.0f, 0.0f, 0.026176450f, 0.99965730f, WGGameObjectBuildingType.Wall), - new WintergraspBuildingSpawnData(191795, 3764, 5385.841f, 2909.490f, 409.7127f, 0.00872424f, 0.0f, 0.0f, 0.004362106f, 0.99999050f, WGGameObjectBuildingType.Wall), - new WintergraspBuildingSpawnData(191796, 3772, 5384.452f, 2771.835f, 410.2704f, 3.14159300f, 0.0f, 0.0f, -1.000000000f, 0.00000000f, WGGameObjectBuildingType.Wall), - new WintergraspBuildingSpawnData(191799, 3762, 5371.436f, 2630.610f, 408.8163f, 3.13285800f, 0.0f, 0.0f, 0.999990500f, 0.00436732f, WGGameObjectBuildingType.Wall), - new WintergraspBuildingSpawnData(191800, 3766, 5301.838f, 2909.089f, 409.8661f, 0.00872424f, 0.0f, 0.0f, 0.004362106f, 0.99999050f, WGGameObjectBuildingType.Wall), - new WintergraspBuildingSpawnData(191801, 3770, 5301.063f, 2771.411f, 409.9014f, 3.14159300f, 0.0f, 0.0f, -1.000000000f, 0.00000000f, WGGameObjectBuildingType.Wall), - new WintergraspBuildingSpawnData(191802, 3751, 5280.197f, 2995.583f, 408.8249f, 1.61442800f, 0.0f, 0.0f, 0.722363500f, 0.69151360f, WGGameObjectBuildingType.Wall), - new WintergraspBuildingSpawnData(191803, 3752, 5279.136f, 2956.023f, 408.6041f, 1.57079600f, 0.0f, 0.0f, 0.707106600f, 0.70710690f, WGGameObjectBuildingType.Wall), - new WintergraspBuildingSpawnData(191804, 3767, 5278.685f, 2882.513f, 409.5388f, 1.57079600f, 0.0f, 0.0f, 0.707106600f, 0.70710690f, WGGameObjectBuildingType.Wall), - new WintergraspBuildingSpawnData(191806, 3769, 5279.502f, 2798.945f, 409.9983f, 1.57079600f, 0.0f, 0.0f, 0.707106600f, 0.70710690f, WGGameObjectBuildingType.Wall), - new WintergraspBuildingSpawnData(191807, 3759, 5279.937f, 2724.766f, 409.9452f, 1.56207000f, 0.0f, 0.0f, 0.704014800f, 0.71018530f, WGGameObjectBuildingType.Wall), - new WintergraspBuildingSpawnData(191808, 3760, 5279.601f, 2683.786f, 409.8488f, 1.55334100f, 0.0f, 0.0f, 0.700908700f, 0.71325110f, WGGameObjectBuildingType.Wall), - new WintergraspBuildingSpawnData(191809, 3761, 5330.955f, 2630.777f, 409.2826f, 3.13285800f, 0.0f, 0.0f, 0.999990500f, 0.00436732f, WGGameObjectBuildingType.Wall), - new WintergraspBuildingSpawnData(190369, 3753, 5256.085f, 2933.963f, 409.3571f, 3.13285800f, 0.0f, 0.0f, 0.999990500f, 0.00436732f, WGGameObjectBuildingType.Wall), - new WintergraspBuildingSpawnData(190370, 3758, 5257.463f, 2747.327f, 409.7427f, -3.13285800f, 0.0f, 0.0f, -0.999990500f, 0.00436732f, WGGameObjectBuildingType.Wall), - new WintergraspBuildingSpawnData(190371, 3754, 5214.960f, 2934.089f, 409.1905f, -0.00872424f, 0.0f, 0.0f, -0.004362106f, 0.99999050f, WGGameObjectBuildingType.Wall), - new WintergraspBuildingSpawnData(190372, 3757, 5215.821f, 2747.566f, 409.1884f, -3.13285800f, 0.0f, 0.0f, -0.999990500f, 0.00436732f, WGGameObjectBuildingType.Wall), - new WintergraspBuildingSpawnData(190374, 3755, 5162.273f, 2883.043f, 410.2556f, 1.57952200f, 0.0f, 0.0f, 0.710185100f, 0.70401500f, WGGameObjectBuildingType.Wall), - new WintergraspBuildingSpawnData(190376, 3756, 5163.724f, 2799.838f, 409.2270f, 1.57952200f, 0.0f, 0.0f, 0.710185100f, 0.70401500f, WGGameObjectBuildingType.Wall), - - // Tower of keep (Not spawned in db) - new WintergraspBuildingSpawnData(190221, 3711, 5281.154f, 3044.588f, 407.8434f, 3.115388f, 0.0f, 0.0f, 0.9999142f, 0.013101960f, WGGameObjectBuildingType.KeepTower), // NW - new WintergraspBuildingSpawnData(190373, 3713, 5163.757f, 2932.228f, 409.1904f, 3.124123f, 0.0f, 0.0f, 0.9999619f, 0.008734641f, WGGameObjectBuildingType.KeepTower), // SW - new WintergraspBuildingSpawnData(190377, 3714, 5166.397f, 2748.368f, 409.1884f, -1.570796f, 0.0f, 0.0f, -0.7071066f, 0.707106900f, WGGameObjectBuildingType.KeepTower), // SE - new WintergraspBuildingSpawnData(190378, 3712, 5281.192f, 2632.479f, 409.0985f, -1.588246f, 0.0f, 0.0f, -0.7132492f, 0.700910500f, WGGameObjectBuildingType.KeepTower), // NE - - // Wall (with passage) (Not spawned in db) - new WintergraspBuildingSpawnData(191797, 3765, 5343.290f, 2908.860f, 409.5757f, 0.00872424f, 0.0f, 0.0f, 0.004362106f, 0.9999905f, WGGameObjectBuildingType.Wall), - new WintergraspBuildingSpawnData(191798, 3771, 5342.719f, 2771.386f, 409.6249f, 3.14159300f, 0.0f, 0.0f, -1.000000000f, 0.0000000f, WGGameObjectBuildingType.Wall), - new WintergraspBuildingSpawnData(191805, 3768, 5279.126f, 2840.797f, 409.7826f, 1.57952200f, 0.0f, 0.0f, 0.710185100f, 0.7040150f, WGGameObjectBuildingType.Wall), - - // South tower (Not spawned in db) - new WintergraspBuildingSpawnData(190356, 3704, 4557.173f, 3623.943f, 395.8828f, 1.675516f, 0.0f, 0.0f, 0.7431450f, 0.669130400f, WGGameObjectBuildingType.Tower), // W - new WintergraspBuildingSpawnData(190357, 3705, 4398.172f, 2822.497f, 405.6270f, -3.124123f, 0.0f, 0.0f, -0.9999619f, 0.008734641f, WGGameObjectBuildingType.Tower), // S - new WintergraspBuildingSpawnData(190358, 3706, 4459.105f, 1944.326f, 434.9912f, -2.002762f, 0.0f, 0.0f, -0.8422165f, 0.539139500f, WGGameObjectBuildingType.Tower), // E - - // Door of forteress (Not spawned in db) - new WintergraspBuildingSpawnData(WGGameObjects.FortressGate, 3763, 5162.991f, 2841.232f, 410.1892f, -3.132858f, 0.0f, 0.0f, -0.9999905f, 0.00436732f, WGGameObjectBuildingType.Door), - - // Last door (Not spawned in db) - new WintergraspBuildingSpawnData(WGGameObjects.VaultGate, 3773, 5397.108f, 2841.54f, 425.9014f, 3.141593f, 0.0f, 0.0f, -1.0f, 0.0f, WGGameObjectBuildingType.DoorLast), - }; - - public static StaticWintergraspTowerInfo[] TowerData = - { - new StaticWintergraspTowerInfo(WintergraspTowerIds.FortressNW, WintergraspText.NwKeeptowerDamage, WintergraspText.NwKeeptowerDestroy), - new StaticWintergraspTowerInfo(WintergraspTowerIds.FortressSW,WintergraspText.SwKeeptowerDamage,WintergraspText.SwKeeptowerDestroy), - new StaticWintergraspTowerInfo(WintergraspTowerIds.FortressSE,WintergraspText.SeKeeptowerDamage,WintergraspText.SeKeeptowerDestroy), - new StaticWintergraspTowerInfo(WintergraspTowerIds.FortressNE,WintergraspText.NeKeeptowerDamage,WintergraspText.NeKeeptowerDestroy), - new StaticWintergraspTowerInfo(WintergraspTowerIds.Shadowsight,WintergraspText.WesternTowerDamage,WintergraspText.WesternTowerDestroy), - new StaticWintergraspTowerInfo(WintergraspTowerIds.WintersEdge,WintergraspText.SouthernTowerDamage,WintergraspText.SouthernTowerDestroy), - new StaticWintergraspTowerInfo(WintergraspTowerIds.Flamewatch,WintergraspText.EasternTowerDamage,WintergraspText.EasternTowerDestroy) - }; - - public static Position[] WGTurret = - { - new Position(5391.19f, 3060.8f, 419.616f, 1.69557f), - new Position(5266.75f, 2976.5f, 421.067f, 3.20354f), - new Position(5234.86f, 2948.8f, 420.88f, 1.61311f), - new Position(5323.05f, 2923.7f, 421.645f, 1.5817f), - new Position(5363.82f, 2923.87f, 421.709f, 1.60527f), - new Position(5264.04f, 2861.34f, 421.587f, 3.21142f), - new Position(5264.68f, 2819.78f, 421.656f, 3.15645f), - new Position(5322.16f, 2756.69f, 421.646f, 4.69978f), - new Position(5363.78f, 2756.77f, 421.629f, 4.78226f), - new Position(5236.2f, 2732.68f, 421.649f, 4.72336f), - new Position(5265.02f, 2704.63f, 421.7f, 3.12507f), - new Position(5350.87f, 2616.03f, 421.243f, 4.72729f), - new Position(5390.95f, 2615.5f, 421.126f, 4.6409f), - new Position(5148.8f, 2820.24f, 421.621f, 3.16043f), - new Position(5147.98f, 2861.93f, 421.63f, 3.18792f), - }; - - public static WintergraspGameObjectData[] WGPortalDefenderData = - { - // Player teleporter - new WintergraspGameObjectData(5153.408f, 2901.349f, 409.1913f, -0.06981169f, 0.0f, 0.0f, -0.03489876f, 0.9993908f, 190763, 191575), - new WintergraspGameObjectData(5268.698f, 2666.421f, 409.0985f, -0.71558490f, 0.0f, 0.0f, -0.35020730f, 0.9366722f, 190763, 191575), - new WintergraspGameObjectData(5197.050f, 2944.814f, 409.1913f, 2.33874000f, 0.0f, 0.0f, 0.92050460f, 0.3907318f, 190763, 191575), - new WintergraspGameObjectData(5196.671f, 2737.345f, 409.1892f, -2.93213900f, 0.0f, 0.0f, -0.99452110f, 0.1045355f, 190763, 191575), - new WintergraspGameObjectData(5314.580f, 3055.852f, 408.8620f, 0.54105060f, 0.0f, 0.0f, 0.26723770f, 0.9636307f, 190763, 191575), - new WintergraspGameObjectData(5391.277f, 2828.094f, 418.6752f, -2.16420600f, 0.0f, 0.0f, -0.88294700f, 0.4694727f, 190763, 191575), - new WintergraspGameObjectData(5153.931f, 2781.671f, 409.2455f, 1.65806200f, 0.0f, 0.0f, 0.73727700f, 0.6755905f, 190763, 191575), - new WintergraspGameObjectData(5311.445f, 2618.931f, 409.0916f, -2.37364400f, 0.0f, 0.0f, -0.92718320f, 0.3746083f, 190763, 191575), - new WintergraspGameObjectData(5269.208f, 3013.838f, 408.8276f, -1.76278200f, 0.0f, 0.0f, -0.77162460f, 0.6360782f, 190763, 191575), - - new WintergraspGameObjectData(5401.634f, 2853.667f, 418.6748f, 2.63544400f, 0.0f, 0.0f, 0.96814730f, 0.2503814f, 192819, 192819), // return portal inside fortress, neutral - - // Vehicle teleporter - new WintergraspGameObjectData(5314.515f, 2703.687f, 408.5502f, -0.89011660f, 0.0f, 0.0f, -0.43051050f, 0.9025856f, 192951, 192951), - new WintergraspGameObjectData(5316.252f, 2977.042f, 408.5385f, -0.82030330f, 0.0f, 0.0f, -0.39874840f, 0.9170604f, 192951, 192951) - }; - - public static WintergraspTowerData[] AttackTowers = - { - //West Tower - new WintergraspTowerData() - { - towerEntry = 190356, - GameObject = new WintergraspGameObjectData[] - { - new WintergraspGameObjectData(4559.113f, 3606.216f, 419.9992f, 4.799657f, 0.0f, 0.0f, -0.67558960f, 0.73727790f, 192488, 192501), // Flag on tower - new WintergraspGameObjectData(4539.420f, 3622.490f, 420.0342f, 3.211419f, 0.0f, 0.0f, -0.99939060f, 0.03490613f, 192488, 192501), // Flag on tower - new WintergraspGameObjectData(4555.258f, 3641.648f, 419.9740f, 1.675514f, 0.0f, 0.0f, 0.74314400f, 0.66913150f, 192488, 192501), // Flag on tower - new WintergraspGameObjectData(4574.872f, 3625.911f, 420.0792f, 0.087266f, 0.0f, 0.0f, 0.04361916f, 0.99904820f, 192488, 192501), // Flag on tower - new WintergraspGameObjectData(4433.899f, 3534.142f, 360.2750f, 4.433136f, 0.0f, 0.0f, -0.79863550f, 0.60181500f, 192269, 192278), // Flag near workshop - new WintergraspGameObjectData(4572.933f, 3475.519f, 363.0090f, 1.422443f, 0.0f, 0.0f, 0.65275960f, 0.75756520f, 192269, 192277) // Flag near bridge - }, - CreatureBottom = new WintergraspObjectPositionData[] - { - new WintergraspObjectPositionData(4418.688477f, 3506.251709f, 358.975494f, 4.293305f, WGNpcs.GuardH, WGNpcs.GuardA), // Roaming Guard - } - }, - - //South Tower - new WintergraspTowerData() - { - towerEntry = 190357, - GameObject = new WintergraspGameObjectData[] - { - new WintergraspGameObjectData(4416.004f, 2822.666f, 429.8512f, 6.2657330f, 0.0f, 0.0f, -0.00872612f, 0.99996190f, 192488, 192501), // Flag on tower - new WintergraspGameObjectData(4398.819f, 2804.698f, 429.7920f, 4.6949370f, 0.0f, 0.0f, -0.71325020f, 0.70090960f, 192488, 192501), // Flag on tower - new WintergraspGameObjectData(4387.622f, 2719.566f, 389.9351f, 4.7385700f, 0.0f, 0.0f, -0.69779010f, 0.71630230f, 192366, 192414), // Flag near tower - new WintergraspGameObjectData(4464.124f, 2855.453f, 406.1106f, 0.8290324f, 0.0f, 0.0f, 0.40274720f, 0.91531130f, 192366, 192429), // Flag near tower - new WintergraspGameObjectData(4526.457f, 2810.181f, 391.1997f, 3.2899610f, 0.0f, 0.0f, -0.99724960f, 0.07411628f, 192269, 192278) // Flag near bridge - }, - CreatureBottom = new WintergraspObjectPositionData[] - { - new WintergraspObjectPositionData(4452.859863f, 2808.870117f, 402.604004f, 6.056290f, WGNpcs.GuardH, WGNpcs.GuardA), // Standing Guard - new WintergraspObjectPositionData(4455.899902f, 2835.958008f, 401.122559f, 0.034907f, WGNpcs.GuardH, WGNpcs.GuardA), // Standing Guard - new WintergraspObjectPositionData(4412.649414f, 2953.792236f, 374.799957f, 0.980838f, WGNpcs.GuardH, WGNpcs.GuardA), // Roaming Guard - new WintergraspObjectPositionData(4362.089844f, 2811.510010f, 407.337006f, 3.193950f, WGNpcs.GuardH, WGNpcs.GuardA), // Standing Guard - new WintergraspObjectPositionData(4412.290039f, 2753.790039f, 401.015015f, 5.829400f, WGNpcs.GuardH, WGNpcs.GuardA), // Standing Guard - new WintergraspObjectPositionData(4421.939941f, 2773.189941f, 400.894989f, 5.707230f, WGNpcs.GuardH, WGNpcs.GuardA), // Standing Guard - } - }, - - //East Tower - new WintergraspTowerData() - { - towerEntry = 190358, - GameObject = new WintergraspGameObjectData[] - { - new WintergraspGameObjectData(4466.793f, 1960.418f, 459.1437f, 1.151916f, 0.0f, 0.0f, 0.5446386f, 0.8386708f, 192488, 192501), // Flag on tower - new WintergraspGameObjectData(4475.351f, 1937.031f, 459.0702f, 5.846854f, 0.0f, 0.0f, -0.2164392f, 0.9762961f, 192488, 192501), // Flag on tower - new WintergraspGameObjectData(4451.758f, 1928.104f, 459.0759f, 4.276057f, 0.0f, 0.0f, -0.8433914f, 0.5372996f, 192488, 192501), // Flag on tower - new WintergraspGameObjectData(4442.987f, 1951.898f, 459.0930f, 2.740162f, 0.0f, 0.0f, 0.9799242f, 0.1993704f, 192488, 192501) // Flag on tower - }, - CreatureBottom = new WintergraspObjectPositionData[] - { - new WintergraspObjectPositionData(4501.060059f, 1990.280029f, 431.157013f, 1.029740f, WGNpcs.GuardH, WGNpcs.GuardA), // Standing Guard - new WintergraspObjectPositionData(4463.830078f, 2015.180054f, 430.299988f, 1.431170f, WGNpcs.GuardH, WGNpcs.GuardA), // Standing Guard - new WintergraspObjectPositionData(4494.580078f, 1943.760010f, 435.627014f, 6.195920f, WGNpcs.GuardH, WGNpcs.GuardA), // Standing Guard - new WintergraspObjectPositionData(4450.149902f, 1897.579956f, 435.045013f, 4.398230f, WGNpcs.GuardH, WGNpcs.GuardA), // Standing Guard - new WintergraspObjectPositionData(4428.870117f, 1906.869995f, 432.648010f, 3.996800f, WGNpcs.GuardH, WGNpcs.GuardA), // Standing Guard - } - } - }; - - public static WintergraspTowerCannonData[] TowerCannon = - { - new WintergraspTowerCannonData() - { - towerEntry = 190221, - TurretTop = new Position[] - { - new Position(5255.88f, 3047.63f, 438.499f, 3.13677f), - new Position(5280.9f, 3071.32f, 438.499f, 1.62879f), - }, - }, - - new WintergraspTowerCannonData() - { - towerEntry = 190373, - TurretTop = new Position[] - { - new Position(5138.59f, 2935.16f, 439.845f, 3.11723f), - new Position(5163.06f, 2959.52f, 439.846f, 1.47258f), - }, - }, - - new WintergraspTowerCannonData() - { - towerEntry = 190377, - TurretTop = new Position[] - { - new Position(5163.84f, 2723.74f, 439.844f, 1.3994f), - new Position(5139.69f, 2747.4f, 439.844f, 3.17221f), - }, - }, - - new WintergraspTowerCannonData() - { - towerEntry = 190378, - TurretTop = new Position[] - { - new Position(5278.21f, 2607.23f, 439.755f, 4.71944f), - new Position(5255.01f, 2631.98f, 439.755f, 3.15257f), - }, - }, - - new WintergraspTowerCannonData() - { - towerEntry = 190356, - TowerCannonBottom = new Position[] - { - new Position(4537.380371f, 3599.531738f, 402.886993f, 3.998462f), - new Position(4581.497559f, 3604.087158f, 402.886963f, 5.651723f), - }, - TurretTop = new Position[] - { - new Position(4469.448242f, 1966.623779f, 465.647217f, 1.153573f), - new Position(4581.895996f, 3626.438477f, 426.539062f, 0.117806f), - }, - }, - - new WintergraspTowerCannonData() - { - towerEntry = 190357, - TowerCannonBottom = new Position[] - { - new Position(4421.640137f, 2799.935791f, 412.630920f, 5.459298f), - new Position(4420.263184f, 2845.340332f, 412.630951f, 0.742197f), - }, - TurretTop = new Position[] - { - new Position(4423.430664f, 2822.762939f, 436.283142f, 6.223487f), - new Position(4397.825684f, 2847.629639f, 436.283325f, 1.579430f), - new Position(4398.814941f, 2797.266357f, 436.283051f, 4.703747f), - }, - }, - - new WintergraspTowerCannonData() - { - towerEntry = 190358, - TowerCannonBottom = new Position[] - { - new Position(4448.138184f, 1974.998779f, 441.995911f, 1.967238f), - new Position(4448.713379f, 1955.148682f, 441.995178f, 0.380733f), - }, - TurretTop = new Position[] - { - new Position(4469.448242f, 1966.623779f, 465.647217f, 1.153573f), - new Position(4481.996582f, 1933.658325f, 465.647186f, 5.873029f), - }, - } - }; - - public static StaticWintergraspWorkshopInfo[] WorkshopData = - { - new StaticWintergraspWorkshopInfo() - { - WorkshopId = WGWorkshopIds.Ne, - WorldStateId = WorldStates.BattlefieldWgWorkshopNe, - AllianceCaptureTextId = WintergraspText.SunkenRingCaptureAlliance, - AllianceAttackTextId = WintergraspText.SunkenRingAttackAlliance, - HordeCaptureTextId = WintergraspText.SunkenRingCaptureHorde, - HordeAttackTextId = WintergraspText.SunkenRingAttackHorde - }, - new StaticWintergraspWorkshopInfo() - { - WorkshopId = WGWorkshopIds.Nw, - WorldStateId = WorldStates.BattlefieldWgWorkshopNw, - AllianceCaptureTextId = WintergraspText.BrokenTempleCaptureAlliance, - AllianceAttackTextId = WintergraspText.BrokenTempleAttackAlliance, - HordeCaptureTextId = WintergraspText.BrokenTempleCaptureHorde, - HordeAttackTextId = WintergraspText.BrokenTempleAttackHorde - }, - new StaticWintergraspWorkshopInfo() - { - WorkshopId = WGWorkshopIds.Se, - WorldStateId = WorldStates.BattlefieldWgWorkshopSe, - AllianceCaptureTextId = WintergraspText.EastsparkCaptureAlliance, - AllianceAttackTextId = WintergraspText.EastsparkAttackAlliance, - HordeCaptureTextId = WintergraspText.EastsparkCaptureHorde, - HordeAttackTextId = WintergraspText.EastsparkAttackHorde - }, - - new StaticWintergraspWorkshopInfo() - { - WorkshopId = WGWorkshopIds.Sw, - WorldStateId = WorldStates.BattlefieldWgWorkshopSw, - AllianceCaptureTextId = WintergraspText.WestsparkCaptureAlliance, - AllianceAttackTextId = WintergraspText.WestsparkAttackAlliance, - HordeCaptureTextId = WintergraspText.WestsparkCaptureHorde, - HordeAttackTextId = WintergraspText.WestsparkAttackHorde - }, - - // KEEP WORKSHOPS - It can't be taken, so it doesn't have a textids - new StaticWintergraspWorkshopInfo() - { - WorkshopId = WGWorkshopIds.KeepWest, - WorldStateId = WorldStates.BattlefieldWgWorkshopKW - }, - - new StaticWintergraspWorkshopInfo() - { - WorkshopId = WGWorkshopIds.KeepEast, - WorldStateId = WorldStates.BattlefieldWgWorkshopKE - } - }; - #endregion - } - - struct WGData - { - public const int DamagedTowerDef = 0; - public const int BrokenTowerDef = 1; - public const int DamagedTowerAtt = 2; - public const int BrokenTowerAtt = 3; - public const int MaxVehicleA = 4; - public const int MaxVehicleH = 5; - public const int VehicleA = 6; - public const int VehicleH = 7; - public const int Max = 8; - } - - struct WGAchievements - { - public const uint WinWg = 1717; - public const uint WinWg100 = 1718; // @Todo: Has To Be Implemented - public const uint WgGnomeslaughter = 1723; // @Todo: Has To Be Implemented - public const uint WgTowerDestroy = 1727; - public const uint DestructionDerbyA = 1737; // @Todo: Has To Be Implemented - public const uint WgTowerCannonKill = 1751; // @Todo: Has To Be Implemented - public const uint WgMasterA = 1752; // @Todo: Has To Be Implemented - public const uint WinWgTimer10 = 1755; - public const uint StoneKeeper50 = 2085; // @Todo: Has To Be Implemented - public const uint StoneKeeper100 = 2086; // @Todo: Has To Be Implemented - public const uint StoneKeeper250 = 2087; // @Todo: Has To Be Implemented - public const uint StoneKeeper500 = 2088; // @Todo: Has To Be Implemented - public const uint StoneKeeper1000 = 2089; // @Todo: Has To Be Implemented - public const uint WgRanger = 2199; // @Todo: Has To Be Implemented - public const uint DestructionDerbyH = 2476; // @Todo: Has To Be Implemented - public const uint WgMasterH = 2776; // @Todo: Has To Be Implemented - } - - struct WGSpells - { - // Wartime Auras - public const uint Recruit = 37795; - public const uint Corporal = 33280; - public const uint Lieutenant = 55629; - public const uint Tenacity = 58549; - public const uint TenacityVehicle = 59911; - public const uint TowerControl = 62064; - public const uint SpiritualImmunity = 58729; - public const uint GreatHonor = 58555; - public const uint GreaterHonor = 58556; - public const uint GreatestHonor = 58557; - public const uint AllianceFlag = 14268; - public const uint HordeFlag = 14267; - public const uint GrabPassenger = 61178; - - // Reward Spells - public const uint VictoryReward = 56902; - public const uint DefeatReward = 58494; - public const uint DamagedTower = 59135; - public const uint DestroyedTower = 59136; - public const uint DamagedBuilding = 59201; - public const uint IntactBuilding = 59203; - - public const uint TeleportBridge = 59096; - public const uint TeleportFortress = 60035; - - public const uint TeleportDalaran = 53360; - public const uint VictoryAura = 60044; - - // Other Spells - public const uint WintergraspWater = 36444; - public const uint EssenceOfWintergrasp = 58045; - public const uint WintergraspRestrictedFlightArea = 91604; - - // Phasing Spells - public const uint HordeControlsFactoryPhaseShift = 56618; // Adds Phase 16 - public const uint AllianceControlsFactoryPhaseShift = 56617; // Adds Phase 32 - - public const uint HordeControlPhaseShift = 55773; // Adds Phase 64 - public const uint AllianceControlPhaseShift = 55774; // Adds Phase 128 - } - - struct WGNpcs - { - public const uint GuardH = 30739; - public const uint GuardA = 30740; - public const uint Stalker = 15214; - - public const uint TaunkaSpiritGuide = 31841; // Horde Spirit Guide For Wintergrasp - public const uint DwarvenSpiritGuide = 31842; // Alliance Spirit Guide For Wintergrasp - - public const uint SiegeEngineAlliance = 28312; - public const uint SiegeEngineHorde = 32627; - public const uint Catapult = 27881; - public const uint Demolisher = 28094; - public const uint TowerCannon = 28366; - } - - struct WGGameObjects - { - public const uint FactoryBannerNe = 190475; - public const uint FactoryBannerNw = 190487; - public const uint FactoryBannerSe = 194959; - public const uint FactoryBannerSw = 194962; - - public const uint TitanSRelic = 192829; - - public const uint FortressTower1 = 190221; - public const uint FortressTower2 = 190373; - public const uint FortressTower3 = 190377; - public const uint FortressTower4 = 190378; - - public const uint ShadowsightTower = 190356; - public const uint WinterSEdgeTower = 190357; - public const uint FlamewatchTower = 190358; - - public const uint FortressGate = 190375; - public const uint VaultGate = 191810; - - public const uint KeepCollisionWall = 194323; - } - - struct WintergraspTowerIds - { - public const byte FortressNW = 0; - public const byte FortressSW = 1; - public const byte FortressSE = 2; - public const byte FortressNE = 3; - public const byte Shadowsight = 4; - public const byte WintersEdge = 5; - public const byte Flamewatch = 6; - } - - struct WGWorkshopIds - { - public const byte Se = 0; - public const byte Sw = 1; - public const byte Ne = 2; - public const byte Nw = 3; - public const byte KeepWest = 4; - public const byte KeepEast = 5; - } - - struct WGGossipText - { - public const int GYNE = 20071; - public const int GYNW = 20072; - public const int GYSE = 20074; - public const int GYSW = 20073; - public const int GYKeep = 20070; - public const int GYHorde = 20075; - public const int GYAlliance = 20076; - } - - struct WGGraveyardId - { - public const uint WorkshopNE = 0; - public const uint WorkshopNW = 1; - public const uint WorkshopSE = 2; - public const uint WorkshopSW = 3; - public const uint Keep = 4; - public const uint Horde = 5; - public const uint Alliance = 6; - public const uint Max = 7; - } - - struct WintergraspQuests - { - public const uint VictoryAlliance = 13181; - public const uint VictoryHorde = 13183; - public const uint CreditTowersDestroyed = 35074; - public const uint CreditDefendSiege = 31284; - } - - struct WintergraspText - { - // Invisible Stalker - public const byte SouthernTowerDamage = 1; - public const byte SouthernTowerDestroy = 2; - public const byte EasternTowerDamage = 3; - public const byte EasternTowerDestroy = 4; - public const byte WesternTowerDamage = 5; - public const byte WesternTowerDestroy = 6; - public const byte NwKeeptowerDamage = 7; - public const byte NwKeeptowerDestroy = 8; - public const byte SeKeeptowerDamage = 9; - public const byte SeKeeptowerDestroy = 10; - public const byte BrokenTempleAttackAlliance = 11; - public const byte BrokenTempleCaptureAlliance = 12; - public const byte BrokenTempleAttackHorde = 13; - public const byte BrokenTempleCaptureHorde = 14; - public const byte EastsparkAttackAlliance = 15; - public const byte EastsparkCaptureAlliance = 16; - public const byte EastsparkAttackHorde = 17; - public const byte EastsparkCaptureHorde = 18; - public const byte SunkenRingAttackAlliance = 19; - public const byte SunkenRingCaptureAlliance = 20; - public const byte SunkenRingAttackHorde = 21; - public const byte SunkenRingCaptureHorde = 22; - public const byte WestsparkAttackAlliance = 23; - public const byte WestsparkCaptureAlliance = 24; - public const byte WestsparkAttackHorde = 25; - public const byte WestsparkCaptureHorde = 26; - - public const byte StartGrouping = 27; - public const byte StartBattle = 28; - public const byte FortressDefendAlliance = 29; - public const byte FortressCaptureAlliance = 30; - public const byte FortressDefendHorde = 31; - public const byte FortressCaptureHorde = 32; - - public const byte NeKeeptowerDamage = 33; - public const byte NeKeeptowerDestroy = 34; - public const byte SwKeeptowerDamage = 35; - public const byte SwKeeptowerDestroy = 36; - - public const byte RankCorporal = 37; - public const byte RankFirstLieutenant = 38; - } - - enum WGGameObjectState - { - None, - NeutralIntact, - NeutralDamage, - NeutralDestroy, - HordeIntact, - HordeDamage, - HordeDestroy, - AllianceIntact, - AllianceDamage, - AllianceDestroy - } - - enum WGGameObjectBuildingType - { - Door, - Titanrelic, - Wall, - DoorLast, - KeepTower, - Tower - } - - //Data Structs - struct BfWGCoordGY - { - public BfWGCoordGY(float x, float y, float z, float o, uint graveyardId, int textId, uint startControl) - { - pos = new Position(x, y, z, o); - GraveyardID = graveyardId; - TextId = textId; - StartControl = startControl; - } - - public Position pos; - public uint GraveyardID; - public int TextId;// for gossip menu - public uint StartControl; - } - - struct WintergraspBuildingSpawnData - { - public WintergraspBuildingSpawnData(uint entry, uint worldstate, float x, float y, float z, float o, float rX, float rY, float rZ, float rW, WGGameObjectBuildingType type) - { - Entry = entry; - WorldState = worldstate; - Pos = new Position(x, y, z, o); - Rot = new Quaternion(rX, rY, rZ, rW); - BuildingType = type; - } - - public uint Entry; - public uint WorldState; - public Position Pos; - public Quaternion Rot; - public WGGameObjectBuildingType BuildingType; - } - - struct WintergraspGameObjectData - { - public WintergraspGameObjectData(float x, float y, float z, float o, float rX, float rY, float rZ, float rW, uint hordeEntry, uint allianceEntry) - { - Pos = new Position(x, y, z, o); - Rot = new Quaternion(rX, rY, rZ, rW); - HordeEntry = hordeEntry; - AllianceEntry = allianceEntry; - } - - public Position Pos; - public Quaternion Rot; - public uint HordeEntry; - public uint AllianceEntry; - } - - class WintergraspTowerData - { - public uint towerEntry; // Gameobject id of tower - public WintergraspGameObjectData[] GameObject = new WintergraspGameObjectData[6]; // Gameobject position and entry (Horde/Alliance) - - // Creature: Turrets and Guard // @todo: Killed on Tower destruction ? Tower damage ? Requires confirming - public WintergraspObjectPositionData[] CreatureBottom = new WintergraspObjectPositionData[9]; - } - - struct WintergraspObjectPositionData - { - public WintergraspObjectPositionData(float x, float y, float z, float o, uint hordeEntry, uint allianceEntry) - { - Pos = new Position(x, y, z, o); - HordeEntry = hordeEntry; - AllianceEntry = allianceEntry; - } - - public Position Pos; - public uint HordeEntry; - public uint AllianceEntry; - } - - class WintergraspTowerCannonData - { - public WintergraspTowerCannonData() - { - TowerCannonBottom = System.Array.Empty(); - TurretTop = System.Array.Empty(); - } - - public uint towerEntry; - public Position[] TowerCannonBottom; - public Position[] TurretTop; - } - - class StaticWintergraspWorkshopInfo - { - public byte WorkshopId; - public WorldStates WorldStateId; - public byte AllianceCaptureTextId; - public byte AllianceAttackTextId; - public byte HordeCaptureTextId; - public byte HordeAttackTextId; - } - - class StaticWintergraspTowerInfo - { - public StaticWintergraspTowerInfo(byte towerId, byte damagedTextId, byte destroyedTextId) - { - TowerId = towerId; - DamagedTextId = damagedTextId; - DestroyedTextId = destroyedTextId; - } - - public byte TowerId; - public byte DamagedTextId; - public byte DestroyedTextId; - } -} diff --git a/Source/Scripts/Draenor/ZoneAssaultOnTheDarkPortal.cs b/Source/Scripts/Draenor/ZoneAssaultOnTheDarkPortal.cs new file mode 100644 index 000000000..cf2b95e0d --- /dev/null +++ b/Source/Scripts/Draenor/ZoneAssaultOnTheDarkPortal.cs @@ -0,0 +1,47 @@ +// 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.Entities; +using Game.Scripting; + +namespace Scripts.Draenor.ZoneAssaultOnTheDarkPortal +{ + struct SpellIds + { + public const uint DarkPortalRunAway = 158985; + } + + [Script] // 621 - Dark Portal: Run away + class scene_dark_portal_run_away : SceneScript + { + public scene_dark_portal_run_away() : base("scene_dark_portal_run_away") { } + + public override void OnSceneComplete(Player player, uint sceneInstanceID, SceneTemplate sceneTemplate) + { + player.RemoveAurasDueToSpell(SpellIds.DarkPortalRunAway); + PhasingHandler.OnConditionChange(player); + } + } + + [Script] // 34420 - The Cost of War + class quest_the_cost_of_war : QuestScript + { + public quest_the_cost_of_war() : base("quest_the_cost_of_war") { } + + public override void OnQuestStatusChange(Player player, Quest quest, QuestStatus oldStatus, QuestStatus newStatus) + { + if (newStatus == QuestStatus.None) + { + player.RemoveAurasDueToSpell(SpellIds.DarkPortalRunAway); + PhasingHandler.OnConditionChange(player); + } + else if (newStatus == QuestStatus.Incomplete) + { + player.CastSpell(player, SpellIds.DarkPortalRunAway, TriggerCastFlags.FullMask); + PhasingHandler.OnConditionChange(player); + } + } + } +} diff --git a/Source/Scripts/Draenor/ZoneDraenorShadowmoonValley.cs b/Source/Scripts/Draenor/ZoneDraenorShadowmoonValley.cs index fcf4b22c6..6a0906a9f 100644 --- a/Source/Scripts/Draenor/ZoneDraenorShadowmoonValley.cs +++ b/Source/Scripts/Draenor/ZoneDraenorShadowmoonValley.cs @@ -1,13 +1,12 @@ // 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.Entities; using Game.Scripting; -namespace Scripts.Draenor +namespace Scripts.Draenor.ZoneDraenorShadowmoonValley { // 79243 - Baros Alexston struct MiscConst @@ -25,13 +24,14 @@ namespace Scripts.Draenor public const uint SpellQuest34586Killcredit = 161033; public const uint SpellCreateGarrisonShadowmoonValleyAlliance = 156020; public const uint SpellDespawnAllSummonsGarrisonIntroOnly = 160938; - - public static Position GarrisonLevelOneCreationPlayerPosition = new Position(1904.58f, 312.906f, 88.9542f, 4.303615f); } + [Script] class npc_baros_alexston : ScriptedAI { + Position GarrisonLevelOneCreationPlayerPosition = new(1904.58f, 312.906f, 88.9542f, 4.303615f); + public npc_baros_alexston(Creature creature) : base(creature) { } public override bool OnGossipSelect(Player player, uint menuId, uint gossipListId) @@ -42,7 +42,7 @@ namespace Scripts.Draenor player.CastSpell(player, MiscConst.SpellQuest34586Killcredit, true); player.CastSpell(player, MiscConst.SpellCreateGarrisonShadowmoonValleyAlliance, true); player.CastSpell(player, MiscConst.SpellDespawnAllSummonsGarrisonIntroOnly, true); - player.NearTeleportTo(MiscConst.GarrisonLevelOneCreationPlayerPosition); + player.NearTeleportTo(GarrisonLevelOneCreationPlayerPosition); PhasingHandler.OnConditionChange(player); } diff --git a/Source/Scripts/DragonIsles/AberrusTheShadowedCrucible/InstanceAberrusTheShadowedCrucible.cs b/Source/Scripts/DragonIsles/AberrusTheShadowedCrucible/InstanceAberrusTheShadowedCrucible.cs new file mode 100644 index 000000000..4cca92b22 --- /dev/null +++ b/Source/Scripts/DragonIsles/AberrusTheShadowedCrucible/InstanceAberrusTheShadowedCrucible.cs @@ -0,0 +1,183 @@ +// 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.Maps; +using Game.Scripting; + +namespace Scripts.DragonIsles.AberrusTheShadowedCrucible +{ + //uint EncounterCount = 9; + + struct DataTypes + { + // Encounters + public const uint KazzaraTheHellforged = 0; + public const uint TheAmalgamationChamber = 1; + public const uint TheForgottenExperiments = 2; + public const uint AssaultOfTheZaqali = 3; + public const uint RashokTheElder = 4; + public const uint ZskarnTheVigilantSteward = 5; + public const uint Magmorax = 6; + public const uint EchoOfNeltharion = 7; + public const uint ScalecommanderSarkareth = 8; + + // Additional public const uint + public const uint KazzaraGate = 9; + + // Misc + public const uint KazzaraIntroDone = 10; + } + + struct CreatureIds + { + // public const uint Bosses + public const uint BossKazzaraTheHellforged = 201261; + + public const uint BossEternalBlaze = 201773; + public const uint BossEssenceOfShadow = 201774; + public const uint BossShadowflameAmalgamation = 201934; + + public const uint BossNeldris = 200912; + public const uint BossThadrion = 200913; + public const uint BossRionthus = 200918; + + public const uint BossWarlordKagni = 199659; + public const uint BossRashokTheElder = 201320; + public const uint BossZskarnTheVigilantSteward = 202637; + public const uint BossMagmorax = 201579; + public const uint BossEchoOfNeltharion = 204223; + public const uint BossScalecommanderSarkareth = 205319; + + // Misc + public const uint SabellianAtAberrusEntrance = 201575; + public const uint ScalecommanderSarkarethAtKazzara = 202416; + } + + struct GameObjectIds + { + public const uint KazzaraDoor = 398742; + public const uint KazzaraGate = 397996; + public const uint InvisibleDoor = 398588; + } + + struct MiscConst + { + public const int ActionStartKazzaraIntro = 0; + + public const uint SpellAberrusEntranceRpConversation3 = 403409; // Winglord Dezran, Sarkareth and Zskarn (Kazzara Summon) + } + + [Script] + class instance_aberrus_the_shadowed_crucible : InstanceMapScript + { + static ObjectData[] creatureData = + { + new(CreatureIds.BossKazzaraTheHellforged, DataTypes.KazzaraTheHellforged), + new(CreatureIds.BossShadowflameAmalgamation, DataTypes.TheAmalgamationChamber), + new(CreatureIds.BossRionthus, DataTypes.TheForgottenExperiments), + new(CreatureIds.BossWarlordKagni, DataTypes.AssaultOfTheZaqali), + new(CreatureIds.BossRashokTheElder, DataTypes.RashokTheElder), + new(CreatureIds.BossZskarnTheVigilantSteward, DataTypes.ZskarnTheVigilantSteward), + new(CreatureIds.BossMagmorax, DataTypes.Magmorax), + new(CreatureIds.BossEchoOfNeltharion, DataTypes.EchoOfNeltharion), + new(CreatureIds.BossScalecommanderSarkareth, DataTypes.ScalecommanderSarkareth) + }; + + static DoorData[] doorData = + { + new (GameObjectIds.KazzaraDoor, DataTypes.KazzaraTheHellforged, DoorType.Room) + }; + + static ObjectData[] objData = + { + new (GameObjectIds.KazzaraGate, DataTypes.KazzaraGate) + }; + + static DungeonEncounterData[] encounters = + { + new(DataTypes.KazzaraTheHellforged, 2688), + new(DataTypes.TheAmalgamationChamber, 2687), + new(DataTypes.TheForgottenExperiments, 2693), + new(DataTypes.AssaultOfTheZaqali, 2682), + new(DataTypes.RashokTheElder, 2680), + new(DataTypes.ZskarnTheVigilantSteward, 2689), + new(DataTypes.Magmorax, 2683), + new(DataTypes.EchoOfNeltharion, 2684), + new(DataTypes.ScalecommanderSarkareth, 2685) + }; + + public instance_aberrus_the_shadowed_crucible() : base(nameof(instance_aberrus_the_shadowed_crucible), 2569) { } + + class instance_aberrus_the_shadowed_crucible_InstanceMapScript : InstanceScript + { + byte _deadSunderedMobs; + bool _kazzaraIntroDone; + + public instance_aberrus_the_shadowed_crucible_InstanceMapScript(InstanceMap map) : base(map) + { + SetHeaders("Aberrus"); + SetBossNumber(9); + LoadObjectData(creatureData, objData); + LoadDoorData(doorData); + LoadDungeonEncounterData(encounters); + + _kazzaraIntroDone = false; + _deadSunderedMobs = 0; + } + + public override uint GetData(uint dataId) + { + switch (dataId) + { + case DataTypes.KazzaraIntroDone: + return _kazzaraIntroDone ? 1 : 0u; + default: + break; + } + return 0; + } + + public override void SetData(uint dataId, uint value) + { + switch (dataId) + { + case DataTypes.KazzaraIntroDone: + _kazzaraIntroDone = true; // no need to pass value, it will never reset to false + break; + default: + break; + } + } + + public override void OnUnitDeath(Unit unit) + { + Creature creature = unit.ToCreature(); + if (creature == null) + return; + + if (creature.HasStringId("sundered_mob")) + { + if (_deadSunderedMobs >= 6) + return; + + _deadSunderedMobs++; + if (_deadSunderedMobs >= 6) + { + Creature sarkareth = creature.FindNearestCreature(CreatureIds.ScalecommanderSarkarethAtKazzara, 300.0f); + if (sarkareth == null) + return; + + sarkareth.CastSpell(null, MiscConst.SpellAberrusEntranceRpConversation3); + } + } + } + } + + public override InstanceScript GetInstanceScript(InstanceMap map) + { + return new instance_aberrus_the_shadowed_crucible_InstanceMapScript(map); + } + } +} \ No newline at end of file diff --git a/Source/Scripts/DragonIsles/AberrusTheShadowedCrucible/KazzaraTheHellforged.cs b/Source/Scripts/DragonIsles/AberrusTheShadowedCrucible/KazzaraTheHellforged.cs new file mode 100644 index 000000000..4061eef07 --- /dev/null +++ b/Source/Scripts/DragonIsles/AberrusTheShadowedCrucible/KazzaraTheHellforged.cs @@ -0,0 +1,85 @@ +// 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; + +namespace Scripts.DragonIsles.AberrusTheShadowedCrucible.KazzaraTheHellforged +{ + struct SpellIds + { + // Sundered NPCs + public const uint Fear = 220540; + + // Kazzara + public const uint DreadLanding = 411872; + public const uint KazzaraIntro = 410541; + } + + [Script] // 201261 - Kazzara the Hellforged + class boss_kazzara_the_hellforged : BossAI + { + public boss_kazzara_the_hellforged(Creature creature) : base(creature, DataTypes.KazzaraTheHellforged) { } + + public override void JustAppeared() + { + if (instance.GetData(DataTypes.KazzaraIntroDone) == 0) + { + me.SetUninteractible(true); + me.SetImmuneToAll(true); + me.SetVisible(false); + } + } + + public override void DoAction(int actionId) + { + switch (actionId) + { + case MiscConst.ActionStartKazzaraIntro: + { + GameObject gate = instance.GetGameObject(DataTypes.KazzaraGate); + if (gate != null) + { + gate.SetFlag(GameObjectFlags.InUse); + gate.SetGoState(GameObjectState.Ready); + } + + me.SetVisible(true); + + DoCast(SpellIds.DreadLanding); + DoCast(SpellIds.KazzaraIntro); + + _scheduler.Schedule(TimeSpan.FromSeconds(1) + TimeSpan.FromMilliseconds(500), _ => + { + List sunderedMobs = me.GetCreatureListWithOptionsInGrid(50.0f, new FindCreatureOptions() { StringId = "sundered_mob" }); + foreach (Creature sunderedMob in sunderedMobs) + { + if (!sunderedMob.IsAlive() || sunderedMob.IsInCombat()) + continue; + + sunderedMob.CastSpell(null, SpellIds.Fear, false); + } + }); + + _scheduler.Schedule(TimeSpan.FromSeconds(12), _ => + { + me.SetUninteractible(false); + me.SetImmuneToAll(false); + }); + break; + } + default: + break; + } + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff); + } + } +} \ No newline at end of file diff --git a/Source/Scripts/DragonIsles/AzureVault/InstanceAzureVault.cs b/Source/Scripts/DragonIsles/AzureVault/InstanceAzureVault.cs new file mode 100644 index 000000000..b6ab130c0 --- /dev/null +++ b/Source/Scripts/DragonIsles/AzureVault/InstanceAzureVault.cs @@ -0,0 +1,119 @@ +// 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.Maps; +using Game.Scripting; + +namespace Scripts.DragonIsles.AzureVault +{ + struct DataTypes + { + // Encounters + public const uint Leymor = 0; + public const uint Azureblade = 1; + public const uint TelashGreywing = 2; + public const uint Umbrelskul = 3; + + public const uint LeymorIntroDone = 4; + } + + struct CreatureIds + { + // Bosses + public const uint BossLeymor = 186644; + public const uint BossAzureblade = 186739; + public const uint BossTelashGreywing = 199614; + public const uint BossUmbrelskul = 186738; + + // Leymor + public const uint ArcaneTender = 191164; + } + + struct GameObjectIds + { + public const uint ArcaneVaultsDoorLeymorEntrance = 380536; + public const uint ArcaneVaultsDoorLeymorExit = 377951; + } + + [Script] + class instance_azure_vault : InstanceMapScript + { + static BossBoundaryEntry[] boundaries = + { + new(DataTypes.Leymor, new CircleBoundary(new Position(-5129.39f, 1253.30f), 75.0f)) + }; + + static ObjectData[] creatureData = + { + new(CreatureIds.BossLeymor, DataTypes.Leymor), + new(CreatureIds.BossAzureblade, DataTypes.Azureblade), + new(CreatureIds.BossTelashGreywing, DataTypes.TelashGreywing), + new(CreatureIds.BossUmbrelskul, DataTypes.Umbrelskul), + }; + + static DoorData[] doorData = + { + new(GameObjectIds.ArcaneVaultsDoorLeymorEntrance, DataTypes.Leymor, DoorType.Room), + new(GameObjectIds.ArcaneVaultsDoorLeymorExit, DataTypes.Leymor, DoorType.Passage), + }; + + static DungeonEncounterData[] encounters = + { + new(DataTypes.Leymor, 2582), + new(DataTypes.Azureblade, 2585), + new(DataTypes.TelashGreywing, 2583), + new(DataTypes.Umbrelskul, 2584) + }; + + public instance_azure_vault() : base(nameof(instance_azure_vault), 2515) { } + + class instance_azure_vault_InstanceMapScript : InstanceScript + { + public instance_azure_vault_InstanceMapScript(InstanceMap map) : base(map) + { + SetHeaders("AzureVault"); + SetBossNumber(4); + LoadObjectData(creatureData, null); + LoadDoorData(doorData); + LoadBossBoundaries(boundaries); + LoadDungeonEncounterData(encounters); + + _leymorIntroDone = false; + } + + public override uint GetData(uint dataId) + { + switch (dataId) + { + case DataTypes.LeymorIntroDone: + return _leymorIntroDone ? 1 : 0u; + default: + break; + } + return 0; + } + + public override void SetData(uint dataId, uint value) + { + switch (dataId) + { + case DataTypes.LeymorIntroDone: + _leymorIntroDone = true; // no need to pass value, it will never reset to false + break; + default: + break; + } + } + + + bool _leymorIntroDone; + } + + public override InstanceScript GetInstanceScript(InstanceMap map) + { + return new instance_azure_vault_InstanceMapScript(map); + } + } +} \ No newline at end of file diff --git a/Source/Scripts/DragonIsles/AzureVault/Leymor.cs b/Source/Scripts/DragonIsles/AzureVault/Leymor.cs new file mode 100644 index 000000000..20fd96284 --- /dev/null +++ b/Source/Scripts/DragonIsles/AzureVault/Leymor.cs @@ -0,0 +1,478 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using Framework.Constants; +using Game.AI; +using Game.Entities; +using Game.Scripting; +using Game.Spells; +using System; + +namespace Scripts.DragonIsles.AzureVault.Leymor +{ + struct SpellIds + { + // Leymor + public const uint Stasis = 375729; + public const uint ArcaneEruption = 375749; + public const uint LeyLineSprouts = 374364; + public const uint LeyLineSproutsMissile = 374362; + public const uint ConsumingStomp = 374720; + public const uint ConsumingStompDamage = 374731; + public const uint EruptingFissure = 386660; + public const uint EruptingFissureSproutSelector = 394154; + public const uint ExplosiveBrand = 374567; + public const uint ExplosiveBrandDamage = 374570; + public const uint ExplosiveBrandKnockback = 374582; + public const uint InfusedStrike = 374789; + + // Ley-Line Sprout + public const uint VolatileSapling = 388654; + public const uint LeyLineSproutAt = 374161; + public const uint ArcanePower = 374736; + + // Volatile Sapling + public const uint SappyBurst = 375591; + + // Arcane Tender + public const uint StasisRitual = 375732; + public const uint StasisRitualMissile = 375738; + public const uint ErraticGrowthChannel = 375596; + public const uint WildEruption = 375652; + public const uint WildEruptionMissile = 375650; + } + + struct MiscConst + { + public const uint SayAnnounceAwaken = 0; + + public const uint SpellVisualKitSproutDeath = 159239; + + public const uint NpcLeylineSprouts = 190509; + + public const int ActionArcaneTenderDeath = 1; + } + + [Script] // 186644 - Leymor + class boss_leymor : BossAI + { + int _killedArcaneTender; + + public boss_leymor(Creature creature) : base(creature, DataTypes.Leymor) { } + + public override void JustAppeared() + { + if (instance.GetData(DataTypes.LeymorIntroDone) != 0) + return; + + me.SetUnitFlag(UnitFlags.ImmuneToPc | UnitFlags.ImmuneToNpc); + DoCastSelf(SpellIds.Stasis); + } + + public override void DoAction(int action) + { + if (action == MiscConst.ActionArcaneTenderDeath) + { + _killedArcaneTender++; + if (_killedArcaneTender >= 3) + { + instance.SetData(DataTypes.LeymorIntroDone, 1); + + _scheduler.Schedule(TimeSpan.FromSeconds(1), _ => + { + me.RemoveAurasDueToSpell(SpellIds.Stasis); + me.RemoveUnitFlag(UnitFlags.ImmuneToPc | UnitFlags.ImmuneToNpc); + DoCastSelf(SpellIds.ArcaneEruption); + Talk(MiscConst.SayAnnounceAwaken); + }); + } + } + } + + public override void JustDied(Unit killer) + { + _JustDied(); + instance.SendEncounterUnit(EncounterFrameType.Disengage, me); + } + + public override void EnterEvadeMode(EvadeReason why) + { + instance.SendEncounterUnit(EncounterFrameType.Disengage, me); + + summons.DespawnAll(); + _EnterEvadeMode(); + _DespawnAtEvade(); + } + + public override void OnChannelFinished(SpellInfo spell) + { + if (spell.Id == SpellIds.ConsumingStomp) + DoCastAOE(SpellIds.ConsumingStompDamage, true); + } + + public override void JustEngagedWith(Unit who) + { + base.JustEngagedWith(who); + _scheduler.CancelAll(); + _scheduler.Schedule(TimeSpan.FromSeconds(3), task => + { + DoCastSelf(SpellIds.LeyLineSprouts); + task.Repeat(TimeSpan.FromSeconds(48)); + }); + _scheduler.Schedule(TimeSpan.FromSeconds(45), task => + { + DoCastSelf(SpellIds.ConsumingStomp); + task.Repeat(TimeSpan.FromSeconds(48)); + }); + _scheduler.Schedule(TimeSpan.FromSeconds(20), task => + { + DoCastVictim(SpellIds.EruptingFissure); + task.Repeat(TimeSpan.FromSeconds(48)); + }); + _scheduler.Schedule(TimeSpan.FromSeconds(31), task => + { + DoCastSelf(SpellIds.ExplosiveBrand); + task.Repeat(TimeSpan.FromSeconds(48)); + }); + _scheduler.Schedule(TimeSpan.FromSeconds(10), task => + { + DoCastVictim(SpellIds.InfusedStrike); + task.Repeat(TimeSpan.FromSeconds(48)); + }); + instance.SendEncounterUnit(EncounterFrameType.Engage, me, 1); + } + + public override void UpdateAI(uint diff) + { + _scheduler.Update(diff, DoMeleeAttackIfReady); + } + } + + [Script] // 191164 - Arcane Tender + class npc_arcane_tender : ScriptedAI + { + public npc_arcane_tender(Creature creature) : base(creature) { } + + public override void JustDied(Unit killer) + { + Creature leymor = me.GetInstanceScript().GetCreature(DataTypes.Leymor); + if (leymor == null) + return; + + if (!leymor.IsAIEnabled()) + return; + + leymor.GetAI().DoAction(MiscConst.ActionArcaneTenderDeath); + } + + public override void JustAppeared() + { + Creature leymor = me.GetInstanceScript().GetCreature(DataTypes.Leymor); + if (leymor == null) + return; + + DoCast(leymor, SpellIds.StasisRitual); + } + + public override void JustReachedHome() + { + JustAppeared(); + } + + public override void Reset() + { + _events.Reset(); + } + + public override void JustEngagedWith(Unit who) + { + _scheduler.Schedule(TimeSpan.FromSeconds(22), task => + { + DoCastAOE(SpellIds.ErraticGrowthChannel); + task.Repeat(); + }); + _scheduler.Schedule(TimeSpan.FromSeconds(12), task => + { + DoCastAOE(SpellIds.WildEruption); + task.Repeat(); + }); + } + + public override void UpdateAI(uint diff) + { + if (!UpdateVictim()) + return; + + _scheduler.Update(diff, DoMeleeAttackIfReady); + } + } + + [Script] // 190509 - Ley-Line Sprout + class npc_ley_line_sprouts : ScriptedAI + { + public npc_ley_line_sprouts(Creature creature) : base(creature) { } + + public override void JustAppeared() + { + DoCastSelf(SpellIds.LeyLineSproutAt); + + DoCastAOE(SpellIds.ArcanePower, true); + } + + public override void JustSummoned(Creature summon) + { + Creature leymor = me.GetInstanceScript().GetCreature(DataTypes.Leymor); + if (leymor == null) + return; + + if (!leymor.IsAIEnabled()) + return; + + leymor.GetAI().JustSummoned(summon); + } + + public override void JustDied(Unit killer) + { + if (GetDifficulty() == Difficulty.Mythic || GetDifficulty() == Difficulty.MythicKeystone) + DoCastAOE(SpellIds.VolatileSapling, true); + + TempSummon tempSummon = me.ToTempSummon(); + if (tempSummon != null) + { + Unit summoner = tempSummon.GetSummonerUnit(); + if (summoner != null) + { + Aura aura = summoner.GetAura(SpellIds.ArcanePower); + if (aura != null) + aura.ModStackAmount(-1); + } + } + } + + public override void SpellHit(WorldObject caster, SpellInfo spellInfo) + { + if (spellInfo.Id != SpellIds.ExplosiveBrandDamage && spellInfo.Id != SpellIds.EruptingFissureSproutSelector) + return; + + me.SendPlaySpellVisualKit(MiscConst.SpellVisualKitSproutDeath, 0, 0); + me.KillSelf(); + } + } + + [Script] // 196559 - Volatile Sapling + class npc_volatile_sapling : ScriptedAI + { + public npc_volatile_sapling(Creature creature) : base(creature) { } + + public override void DamageTaken(Unit attacker, ref uint damage, DamageEffectType damageType, SpellInfo spellInfo = null) + { + if (me.GetHealth() <= damage) + { + damage = (uint)(me.GetHealth() - 1); + + if (!_isSappyBurstCast) + { + me.CastSpell(null, SpellIds.SappyBurst, false); + _isSappyBurstCast = true; + } + } + } + + public override void OnSpellCast(SpellInfo spell) + { + if (spell.Id != SpellIds.SappyBurst) + return; + + me.KillSelf(); + } + + + bool _isSappyBurstCast; + } + + [Script] // 374364 - Ley-Line Sprouts + class spell_ley_line_sprouts : SpellScript + { + Position[] LeyLineSproutGroupOrigin = + { + new(-5129.39f, 1253.30f, 555.58f), + new(-5101.68f, 1253.71f, 555.90f), + new(-5114.70f, 1230.28f, 555.89f), + new(-5141.62f, 1230.33f, 555.83f), + new(-5155.62f, 1253.60f, 555.87f), + new(-5141.42f, 1276.70f, 555.89f), + new(-5114.78f, 1277.42f, 555.87f) + }; + + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.LeyLineSproutsMissile); + } + + void HandleHit(uint effIndex) + { + foreach (Position pos in LeyLineSproutGroupOrigin) + { + for (int i = 0; i < 2; i++) + GetCaster().CastSpell(pos, SpellIds.LeyLineSproutsMissile, true); + } + } + + public override void Register() + { + OnEffectHit.Add(new(HandleHit, 0, SpellEffectName.Dummy)); + } + } + + [Script] // 375732 - Stasis Ritual + class spell_stasis_ritual : AuraScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.StasisRitualMissile); + } + + void HandlePeriodic(AuraEffect aurEff) + { + Unit caster = GetCaster(); + if (caster != null) + caster.CastSpell(null, SpellIds.StasisRitualMissile, true); + } + + public override void Register() + { + OnEffectPeriodic.Add(new(HandlePeriodic, 0, AuraType.PeriodicDummy)); + } + } + + [Script] // 375652 - Wild Eruption + class spell_wild_eruption : SpellScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.WildEruptionMissile); + } + + void HandleHitTarget(uint effIndex) + { + GetCaster().CastSpell(GetHitDest(), SpellIds.WildEruptionMissile, true); + } + + public override void Register() + { + OnEffectHitTarget.Add(new(HandleHitTarget, 0, SpellEffectName.Dummy)); + } + } + + [Script] // 375749 - Arcane Eruption + class at_leymor_arcane_eruption : AreaTriggerAI + { + public at_leymor_arcane_eruption(AreaTrigger areatrigger) : base(areatrigger) { } + + public override void OnUnitEnter(Unit unit) + { + if (!unit.IsPlayer()) + return; + + unit.ApplyMovementForce(at.GetGUID(), at.GetPosition(), -20.0f, MovementForceType.Gravity); + } + + public override void OnUnitExit(Unit unit) + { + if (!unit.IsPlayer()) + return; + + unit.RemoveMovementForce(at.GetGUID()); + } + } + + [Script] // 374567 - Explosive Brand + class spell_explosive_brand : SpellScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.ExplosiveBrandKnockback); + } + + void HandleHit(uint effIndex) + { + GetCaster().CastSpell(null, SpellIds.ExplosiveBrandKnockback, true); + } + + public override void Register() + { + OnEffectHit.Add(new(HandleHit, 0, SpellEffectName.ApplyAura)); + } + } + + [Script] // 374567 - Explosive Brand + class spell_explosive_brand_AuraScript : AuraScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.ExplosiveBrandDamage); + } + + void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode) + { + if (GetTargetApplication().GetRemoveMode() != AuraRemoveMode.Expire) + return; + + Unit caster = GetCaster(); + if (caster != null) + caster.CastSpell(GetTarget(), SpellIds.ExplosiveBrandDamage, true); + } + + public override void Register() + { + AfterEffectRemove.Add(new(OnRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + } + } + + [Script] // 374720 - Consuming Stomp + class spell_consuming_stomp : AuraScript + { + void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode) + { + GetTarget().KillSelf(); + } + + public override void Register() + { + AfterEffectRemove.Add(new(OnRemove, 0, AuraType.PeriodicTriggerSpell, AuraEffectHandleModes.Real)); + } + } + + [Script] // 386660 - Erupting Fissure + class spell_erupting_fissure : SpellScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.EruptingFissureSproutSelector); + } + + void HandleHit(uint effIndex) + { + GetCaster().CastSpell(GetHitDest(), SpellIds.EruptingFissureSproutSelector, true); + } + + public override void Register() + { + OnEffectHit.Add(new(HandleHit, 0, SpellEffectName.Dummy)); + } + } + + [Script] // 375591 - Sappy Burst + class spell_sappy_burst : SpellScript + { + void HandleHitTarget(uint effIndex) + { + GetCaster().KillSelf(); + } + + public override void Register() + { + OnEffectHitTarget.Add(new(HandleHitTarget, 2, SpellEffectName.ScriptEffect)); + } + } +} \ No newline at end of file diff --git a/Source/Scripts/DragonIsles/RubyLifePools/InstanceRubyLifePools.cs b/Source/Scripts/DragonIsles/RubyLifePools/InstanceRubyLifePools.cs index 53a1b4ac2..2915bf33e 100644 --- a/Source/Scripts/DragonIsles/RubyLifePools/InstanceRubyLifePools.cs +++ b/Source/Scripts/DragonIsles/RubyLifePools/InstanceRubyLifePools.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; @@ -18,9 +18,9 @@ namespace Scripts.DragonIsles.RubyLifePools struct CreatureIds { // Bosses - public const uint MelidrussaChillworn = 188252; - public const uint KokiaBlazehoof = 189232; - public const uint Kyrakka = 190484; + public const uint BossMelidrussaChillworn = 188252; + public const uint BossKokiaBlazehoof = 189232; + public const uint BossKyrakka = 190484; } struct GameObjectIds @@ -28,26 +28,25 @@ namespace Scripts.DragonIsles.RubyLifePools public const uint FireWall = 377194; } - [Script] class instance_ruby_life_pools : InstanceMapScript { - public static ObjectData[] creatureData = + static ObjectData[] creatureData = { - new ObjectData(CreatureIds.MelidrussaChillworn, DataTypes.MelidrussaChillworn), - new ObjectData(CreatureIds.KokiaBlazehoof, DataTypes.KokiaBlazehoof), - new ObjectData(CreatureIds.Kyrakka, DataTypes.KyrakkaAndErkhartStormvein), + new(CreatureIds.BossMelidrussaChillworn, DataTypes.MelidrussaChillworn), + new(CreatureIds.BossKokiaBlazehoof, DataTypes.KokiaBlazehoof), + new(CreatureIds.BossKyrakka, DataTypes.KyrakkaAndErkhartStormvein) }; - public static DoorData[] doorData = + static DoorData[] doorData = { - new DoorData(GameObjectIds.FireWall, DataTypes.KokiaBlazehoof, DoorType.Passage), + new(GameObjectIds.FireWall, DataTypes.KokiaBlazehoof, DoorType.Passage) }; - public static DungeonEncounterData[] encounters = + static DungeonEncounterData[] encounters = { - new DungeonEncounterData(DataTypes.MelidrussaChillworn, 2609 ), - new DungeonEncounterData(DataTypes.KokiaBlazehoof, 2606 ), - new DungeonEncounterData(DataTypes.KyrakkaAndErkhartStormvein, 2623 ) + new(DataTypes.MelidrussaChillworn, 2609), + new(DataTypes.KokiaBlazehoof, 2606), + new(DataTypes.KyrakkaAndErkhartStormvein, 2623) }; public instance_ruby_life_pools() : base(nameof(instance_ruby_life_pools), 2521) { } @@ -69,4 +68,4 @@ namespace Scripts.DragonIsles.RubyLifePools return new instance_ruby_life_pools_InstanceMapScript(map); } } -} +} \ No newline at end of file diff --git a/Source/Scripts/DragonIsles/ZoneTheForbiddenReach.cs b/Source/Scripts/DragonIsles/ZoneTheForbiddenReach.cs index 5667a729b..cb972e858 100644 --- a/Source/Scripts/DragonIsles/ZoneTheForbiddenReach.cs +++ b/Source/Scripts/DragonIsles/ZoneTheForbiddenReach.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; @@ -6,75 +6,63 @@ using Game; using Game.Entities; using Game.Scripting; using Game.Spells; -using System; -namespace Scripts.DragonIsles +namespace Scripts.DragonIsles.ZoneTheForbiddenReach { - struct SpellIds - { - // Spells - public const uint DracthyrLogin = 369728; // teleports to random room, plays scene for the room, binds the home position - public const uint Stasis1 = 369735; // triggers 366620 - public const uint Stasis2 = 366620; // triggers 366636 - public const uint Stasis3 = 366636; // removes 365560, sends first quest (64864) - public const uint Stasis4 = 365560; // freeze the target - public const uint DracthyrMovieRoom01 = 394245; // scene for room 1 - public const uint DracthyrMovieRoom02 = 394279; // scene for room 2 - public const uint DracthyrMovieRoom03 = 394281; // scene for room 3 - public const uint DracthyrMovieRoom04 = 394282; // scene for room 4 - //public const uint DracthyrMovieRoom05 = 394283, // scene for room 5 (only plays sound, unused?) - } - - struct MiscConst - { - public static Tuple[] LoginRoomData = - { - Tuple.Create(SpellIds.DracthyrMovieRoom01, new Position(5725.32f, -3024.26f, 251.047f, 0.01745329238474369f)), - Tuple.Create(SpellIds.DracthyrMovieRoom02, new Position( 5743.03f, -3067.28f, 251.047f, 0.798488140106201171f)), - Tuple.Create(SpellIds.DracthyrMovieRoom03, new Position(5787.1597f, -3083.3906f, 251.04698f, 1.570796370506286621f)), - Tuple.Create(SpellIds.DracthyrMovieRoom04, new Position(5829.32f, -3064.49f, 251.047f, 2.364955902099609375f)) - }; - } - [Script] // 369728 - Dracthyr Login class spell_dracthyr_login : SpellScript { + const uint SpellDracthyrMovieRoom01 = 394245; // scene for room 1 + const uint SpellDracthyrMovieRoom02 = 394279; // scene for room 2 + const uint SpellDracthyrMovieRoom03 = 394281; // scene for room 3 + const uint SpellDracthyrMovieRoom04 = 394282; // scene for room 4 + + (uint, Position)[] LoginRoomData = + { + (SpellDracthyrMovieRoom01, new(5725.32f, -3024.26f, 251.047f, 0.01745329238474369f)), + (SpellDracthyrMovieRoom02, new(5743.03f, -3067.28f, 251.047f, 0.798488140106201171f)), + (SpellDracthyrMovieRoom03, new(5787.1597f, -3083.3906f, 251.04698f, 1.570796370506286621f)), + (SpellDracthyrMovieRoom04, new(5829.32f, -3064.49f, 251.047f, 2.364955902099609375f)) + }; + public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.DracthyrMovieRoom01, SpellIds.DracthyrMovieRoom02, SpellIds.DracthyrMovieRoom03, SpellIds.DracthyrMovieRoom04); + return ValidateSpellInfo(SpellDracthyrMovieRoom01, SpellDracthyrMovieRoom02, SpellDracthyrMovieRoom03, SpellDracthyrMovieRoom04); } void HandleTeleport(uint effIndex) { - var room = MiscConst.LoginRoomData[RandomHelper.URand(0, 3)]; + var (spellId, pos) = LoginRoomData[RandomHelper.URand(0, 3)]; WorldLocation dest = GetHitUnit().GetWorldLocation(); SetExplTargetDest(dest); - GetHitDest().Relocate(room.Item2); + GetHitDest().Relocate(pos); - GetCaster().CastSpell(GetHitUnit(), room.Item1, true); + GetCaster().CastSpell(GetHitUnit(), spellId, true); } public override void Register() { - OnEffectHitTarget.Add(new EffectHandler(HandleTeleport, 0, SpellEffectName.TeleportUnits)); + OnEffectHitTarget.Add(new(HandleTeleport, 0, SpellEffectName.TeleportUnits)); } } [Script] // 3730 - Dracthyr Evoker Intro (Post Movie) class scene_dracthyr_evoker_intro : SceneScript { + const uint SpellStasis1 = 369735; // triggers 366620' + public scene_dracthyr_evoker_intro() : base("scene_dracthyr_evoker_intro") { } public override void OnSceneComplete(Player player, uint sceneInstanceID, SceneTemplate sceneTemplate) { - player.CastSpell(player, SpellIds.Stasis1, true); + player.CastSpell(player, SpellStasis1, true); } public override void OnSceneCancel(Player player, uint sceneInstanceID, SceneTemplate sceneTemplate) { - player.CastSpell(player, SpellIds.Stasis1, true); + player.CastSpell(player, SpellStasis1, true); } } -} +} \ No newline at end of file