diff --git a/Source/Framework/Constants/SharedConst.cs b/Source/Framework/Constants/SharedConst.cs index 79db682b4..3bfd7013b 100644 --- a/Source/Framework/Constants/SharedConst.cs +++ b/Source/Framework/Constants/SharedConst.cs @@ -500,7 +500,7 @@ namespace Framework.Constants Max } - public struct BatttleGroundTeamId + public struct BattleGroundTeamId { public const int Alliance = 0; public const int Horde = 1; diff --git a/Source/Game/Achievements/CriteriaHandler.cs b/Source/Game/Achievements/CriteriaHandler.cs index 1a594d9ba..4e525d98f 100644 --- a/Source/Game/Achievements/CriteriaHandler.cs +++ b/Source/Game/Achievements/CriteriaHandler.cs @@ -4592,7 +4592,7 @@ namespace Game.Achievements if (bg == null) return false; - int score = (int)bg.GetTeamScore(bg.GetPlayerTeam(source.GetGUID()) == Team.Alliance ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance); + int score = (int)bg.GetTeamScore(bg.GetPlayerTeam(source.GetGUID()) == Team.Alliance ? BattleGroundTeamId.Horde : BattleGroundTeamId.Alliance); return score >= BattlegroundScore.Min && score <= BattlegroundScore.Max; } case CriteriaDataType.InstanceScript: diff --git a/Source/Game/Arenas/Arena.cs b/Source/Game/Arenas/Arena.cs index 3ec2d5913..441ba79fc 100644 --- a/Source/Game/Arenas/Arena.cs +++ b/Source/Game/Arenas/Arena.cs @@ -179,7 +179,7 @@ namespace Game.Arenas _arenaTeamScores[loserTeam].Assign(loserTeamRating, (uint)(loserTeamRating + loserChange), loserMatchmakerRating, GetArenaMatchmakerRating(GetOtherTeam(winner))); Log.outDebug(LogFilter.Arena, "Arena match Type: {0} for Team1Id: {1} - Team2Id: {2} ended. WinnerTeamId: {3}. Winner rating: +{4}, Loser rating: {5}", - GetArenaType(), GetArenaTeamIdByIndex(BatttleGroundTeamId.Alliance), GetArenaTeamIdByIndex(BatttleGroundTeamId.Horde), winnerArenaTeam.GetId(), winnerChange, loserChange); + GetArenaType(), GetArenaTeamIdByIndex(BattleGroundTeamId.Alliance), GetArenaTeamIdByIndex(BattleGroundTeamId.Horde), winnerArenaTeam.GetId(), winnerChange, loserChange); if (WorldConfig.GetBoolValue(WorldCfg.ArenaLogExtendedInfo)) { diff --git a/Source/Game/Arenas/Zones/DalaranSewers.cs b/Source/Game/Arenas/Zones/DalaranSewers.cs index 732bef85e..d21078030 100644 --- a/Source/Game/Arenas/Zones/DalaranSewers.cs +++ b/Source/Game/Arenas/Zones/DalaranSewers.cs @@ -76,9 +76,9 @@ namespace Game.Arenas result &= AddObject(DalaranSewersObjectTypes.Water1, DalaranSewersGameObjects.Water1, 1291.56f, 790.837f, 7.1f, 3.14238f, 0, 0, 0.694215f, -0.719768f, 120); result &= AddObject(DalaranSewersObjectTypes.Water2, DalaranSewersGameObjects.Water2, 1291.56f, 790.837f, 7.1f, 3.14238f, 0, 0, 0.694215f, -0.719768f, 120); - result &= AddCreature(DalaranSewersData.NpcWaterSpout, DalaranSewersCreatureTypes.WaterfallKnockback, 1292.587f, 790.2205f, 7.19796f, 3.054326f, BatttleGroundTeamId.Neutral, BattlegroundConst.RespawnImmediately) != null; - result &= AddCreature(DalaranSewersData.NpcWaterSpout, DalaranSewersCreatureTypes.PipeKnockback1, 1369.977f, 817.2882f, 16.08718f, 3.106686f, BatttleGroundTeamId.Neutral, BattlegroundConst.RespawnImmediately) != null; - result &= AddCreature(DalaranSewersData.NpcWaterSpout, DalaranSewersCreatureTypes.PipeKnockback2, 1212.833f, 765.3871f, 16.09484f, 0.0f, BatttleGroundTeamId.Neutral, BattlegroundConst.RespawnImmediately) != null; + result &= AddCreature(DalaranSewersData.NpcWaterSpout, DalaranSewersCreatureTypes.WaterfallKnockback, 1292.587f, 790.2205f, 7.19796f, 3.054326f, BattleGroundTeamId.Neutral, BattlegroundConst.RespawnImmediately) != null; + result &= AddCreature(DalaranSewersData.NpcWaterSpout, DalaranSewersCreatureTypes.PipeKnockback1, 1369.977f, 817.2882f, 16.08718f, 3.106686f, BattleGroundTeamId.Neutral, BattlegroundConst.RespawnImmediately) != null; + result &= AddCreature(DalaranSewersData.NpcWaterSpout, DalaranSewersCreatureTypes.PipeKnockback2, 1212.833f, 765.3871f, 16.09484f, 0.0f, BattleGroundTeamId.Neutral, BattlegroundConst.RespawnImmediately) != null; if (!result) { Log.outError(LogFilter.Sql, "DalaranSewersArena: Failed to spawn collision object!"); diff --git a/Source/Game/BattleFields/BattleField.cs b/Source/Game/BattleFields/BattleField.cs index 2476408d2..c1490e0c5 100644 --- a/Source/Game/BattleFields/BattleField.cs +++ b/Source/Game/BattleFields/BattleField.cs @@ -25,7 +25,7 @@ namespace Game.BattleFields public BattleField(Map map) { m_IsEnabled = true; - m_DefenderTeam = BatttleGroundTeamId.Neutral; + m_DefenderTeam = BattleGroundTeamId.Neutral; m_TimeForAcceptInvite = 20; m_uiKickDontAcceptTimer = 1000; @@ -705,7 +705,7 @@ namespace Game.BattleFields // Battlefield - generic methods public uint GetDefenderTeam() { return m_DefenderTeam; } public uint GetAttackerTeam() { return 1 - m_DefenderTeam; } - public int GetOtherTeam(int teamIndex) { return (teamIndex == BatttleGroundTeamId.Horde ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde); } + public int GetOtherTeam(int teamIndex) { return (teamIndex == BattleGroundTeamId.Horde ? BattleGroundTeamId.Alliance : BattleGroundTeamId.Horde); } void SetDefenderTeam(uint team) { m_DefenderTeam = team; } // Called on start @@ -790,7 +790,7 @@ namespace Game.BattleFields { m_Bf = battlefield; m_GraveyardId = 0; - m_ControlTeam = BatttleGroundTeamId.Neutral; + m_ControlTeam = BattleGroundTeamId.Neutral; m_SpiritGuide[0] = ObjectGuid.Empty; m_SpiritGuide[1] = ObjectGuid.Empty; } @@ -838,14 +838,14 @@ namespace Game.BattleFields public bool HasNpc(ObjectGuid guid) { - if (m_SpiritGuide[BatttleGroundTeamId.Alliance].IsEmpty() || m_SpiritGuide[BatttleGroundTeamId.Horde].IsEmpty()) + if (m_SpiritGuide[BattleGroundTeamId.Alliance].IsEmpty() || m_SpiritGuide[BattleGroundTeamId.Horde].IsEmpty()) return false; - if (m_Bf.GetCreature(m_SpiritGuide[BatttleGroundTeamId.Alliance]) == null || - m_Bf.GetCreature(m_SpiritGuide[BatttleGroundTeamId.Horde]) == null) + if (m_Bf.GetCreature(m_SpiritGuide[BattleGroundTeamId.Alliance]) == null || + m_Bf.GetCreature(m_SpiritGuide[BattleGroundTeamId.Horde]) == null) return false; - return (m_SpiritGuide[BatttleGroundTeamId.Alliance] == guid || m_SpiritGuide[BatttleGroundTeamId.Horde] == guid); + return (m_SpiritGuide[BattleGroundTeamId.Alliance] == guid || m_SpiritGuide[BattleGroundTeamId.Horde] == guid); } // Get the graveyard's ID. diff --git a/Source/Game/BattleGrounds/BattleGround.cs b/Source/Game/BattleGrounds/BattleGround.cs index 5e055ac34..ddff1b7d7 100644 --- a/Source/Game/BattleGrounds/BattleGround.cs +++ b/Source/Game/BattleGrounds/BattleGround.cs @@ -451,7 +451,7 @@ namespace Game.BattleGrounds public WorldSafeLocsEntry GetTeamStartPosition(int teamId) { - Cypher.Assert(teamId < BatttleGroundTeamId.Neutral); + Cypher.Assert(teamId < BattleGroundTeamId.Neutral); return _battlegroundTemplate.StartLocation[teamId]; } @@ -573,6 +573,11 @@ namespace Game.BattleGrounds Global.WorldStateMgr.SetValue((int)worldStateId, value, hidden, GetBgMap()); } + public void UpdateWorldState(int worldStateId, bool value, bool hidden = false) + { + Global.WorldStateMgr.SetValue(worldStateId, value ? 1 : 0, hidden, GetBgMap()); + } + public virtual void EndBattleground(Team winner) { RemoveFromBGFreeSlotQueue(); @@ -905,7 +910,7 @@ namespace Game.BattleGrounds Global.BattlegroundMgr.AddBattleground(this); if (m_IsRated) - Log.outDebug(LogFilter.Arena, "Arena match type: {0} for Team1Id: {1} - Team2Id: {2} started.", m_ArenaType, m_ArenaTeamIds[BatttleGroundTeamId.Alliance], m_ArenaTeamIds[BatttleGroundTeamId.Horde]); + Log.outDebug(LogFilter.Arena, "Arena match type: {0} for Team1Id: {1} - Team2Id: {2} started.", m_ArenaType, m_ArenaTeamIds[BattleGroundTeamId.Alliance], m_ArenaTeamIds[BattleGroundTeamId.Horde]); } public void TeleportPlayerToExploitLocation(Player player) @@ -1400,7 +1405,7 @@ namespace Game.BattleGrounds } } - public virtual Creature AddCreature(uint entry, uint type, float x, float y, float z, float o, int teamIndex = BatttleGroundTeamId.Neutral, uint respawntime = 0, Transport transport = null) + public virtual Creature AddCreature(uint entry, uint type, float x, float y, float z, float o, int teamIndex = BattleGroundTeamId.Neutral, uint respawntime = 0, Transport transport = null) { Map map = FindBgMap(); if (map == null) @@ -1447,7 +1452,7 @@ namespace Game.BattleGrounds return creature; } - public Creature AddCreature(uint entry, uint type, Position pos, int teamIndex = BatttleGroundTeamId.Neutral, uint respawntime = 0, Transport transport = null) + public Creature AddCreature(uint entry, uint type, Position pos, int teamIndex = BattleGroundTeamId.Neutral, uint respawntime = 0, Transport transport = null) { return AddCreature(entry, type, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teamIndex, respawntime, transport); } @@ -1506,7 +1511,7 @@ namespace Game.BattleGrounds public bool AddSpiritGuide(uint type, float x, float y, float z, float o, int teamIndex) { - uint entry = (uint)(teamIndex == BatttleGroundTeamId.Alliance ? BattlegroundCreatures.A_SpiritGuide : BattlegroundCreatures.H_SpiritGuide); + uint entry = (uint)(teamIndex == BattleGroundTeamId.Alliance ? BattlegroundCreatures.A_SpiritGuide : BattlegroundCreatures.H_SpiritGuide); if (AddCreature(entry, type, x, y, z, o) != null) return true; @@ -1516,7 +1521,7 @@ namespace Game.BattleGrounds return false; } - public bool AddSpiritGuide(uint type, Position pos, int teamIndex = BatttleGroundTeamId.Neutral) + public bool AddSpiritGuide(uint type, Position pos, int teamIndex = BattleGroundTeamId.Neutral) { return AddSpiritGuide(type, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teamIndex); } @@ -1702,7 +1707,7 @@ namespace Game.BattleGrounds public uint GetTeamScore(int teamIndex) { - if (teamIndex == BatttleGroundTeamId.Alliance || teamIndex == BatttleGroundTeamId.Horde) + if (teamIndex == BattleGroundTeamId.Alliance || teamIndex == BattleGroundTeamId.Horde) return m_TeamScores[teamIndex]; Log.outError(LogFilter.Battleground, "GetTeamScore with wrong Team {0} for BG {1}", teamIndex, GetTypeID()); @@ -1855,7 +1860,7 @@ namespace Game.BattleGrounds Group GetBgRaid(Team team) { return m_BgRaids[GetTeamIndexByTeamId(team)]; } - public static int GetTeamIndexByTeamId(Team team) { return team == Team.Alliance ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde; } + public static int GetTeamIndexByTeamId(Team team) { return team == Team.Alliance ? BattleGroundTeamId.Alliance : BattleGroundTeamId.Horde; } public uint GetPlayersCountByTeam(Team team) { return m_PlayersCount[GetTeamIndexByTeamId(team)]; } void UpdatePlayersCountByTeam(Team team, bool remove) { diff --git a/Source/Game/BattleGrounds/BattleGroundManager.cs b/Source/Game/BattleGrounds/BattleGroundManager.cs index 4a4435136..b09d86640 100644 --- a/Source/Game/BattleGrounds/BattleGroundManager.cs +++ b/Source/Game/BattleGrounds/BattleGroundManager.cs @@ -8,6 +8,7 @@ using Game.BattleGrounds.Zones.AlteracValley; using Game.BattleGrounds.Zones.ArathisBasin; using Game.BattleGrounds.Zones.EyeofStorm; using Game.BattleGrounds.Zones.WarsongGluch; +using Game.BattleGrounds.Zones.StrandOfAncients; using Game.DataStorage; using Game.Entities; using Game.Networking.Packets; @@ -147,7 +148,7 @@ namespace Game.BattleGrounds battlefieldStatus = new BattlefieldStatusActive(); BuildBattlegroundStatusHeader(battlefieldStatus.Hdr, player, ticketId, joinTime, queueId); battlefieldStatus.ShutdownTimer = bg.GetRemainingTime(); - battlefieldStatus.ArenaFaction = (byte)(player.GetBGTeam() == Team.Horde ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance); + battlefieldStatus.ArenaFaction = (byte)(player.GetBGTeam() == Team.Horde ? BattleGroundTeamId.Horde : BattleGroundTeamId.Alliance); battlefieldStatus.LeftEarly = false; battlefieldStatus.StartTimer = bg.GetElapsedTime(); battlefieldStatus.Mapid = bg.GetMapId(); @@ -353,8 +354,8 @@ namespace Game.BattleGrounds uint startId = result.Read(1); WorldSafeLocsEntry start = Global.ObjectMgr.GetWorldSafeLoc(startId); if (start != null) - bgTemplate.StartLocation[BatttleGroundTeamId.Alliance] = start; - else if (bgTemplate.StartLocation[BatttleGroundTeamId.Alliance] != null) // reload case + bgTemplate.StartLocation[BattleGroundTeamId.Alliance] = start; + else if (bgTemplate.StartLocation[BattleGroundTeamId.Alliance] != null) // reload case Log.outError(LogFilter.Sql, $"Table `battleground_template` for id {bgTemplate.Id} contains a non-existing WorldSafeLocs.dbc id {startId} in field `AllianceStartLoc`. Ignoring."); else { @@ -365,8 +366,8 @@ namespace Game.BattleGrounds startId = result.Read(2); start = Global.ObjectMgr.GetWorldSafeLoc(startId); if (start != null) - bgTemplate.StartLocation[BatttleGroundTeamId.Horde] = start; - else if (bgTemplate.StartLocation[BatttleGroundTeamId.Horde] != null) // reload case + bgTemplate.StartLocation[BattleGroundTeamId.Horde] = start; + else if (bgTemplate.StartLocation[BattleGroundTeamId.Horde] != null) // reload case Log.outError(LogFilter.Sql, $"Table `battleground_template` for id {bgTemplate.Id} contains a non-existing WorldSafeLocs.dbc id {startId} in field `HordeStartLoc`. Ignoring."); else { diff --git a/Source/Game/BattleGrounds/BattleGroundQueue.cs b/Source/Game/BattleGrounds/BattleGroundQueue.cs index 5a2157df7..b59132773 100644 --- a/Source/Game/BattleGrounds/BattleGroundQueue.cs +++ b/Source/Game/BattleGrounds/BattleGroundQueue.cs @@ -153,16 +153,16 @@ namespace Game.BattleGrounds void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo ginfo, BattlegroundBracketId bracket_id) { uint timeInQueue = Time.GetMSTimeDiff(ginfo.JoinTime, GameTime.GetGameTimeMS()); - uint team_index = BatttleGroundTeamId.Alliance; //default set to TeamIndex.Alliance - or non rated arenas! + uint team_index = BattleGroundTeamId.Alliance; //default set to TeamIndex.Alliance - or non rated arenas! if (m_queueId.TeamSize == 0) { if (ginfo.Team == Team.Horde) - team_index = BatttleGroundTeamId.Horde; + team_index = BattleGroundTeamId.Horde; } else { if (m_queueId.Rated) - team_index = BatttleGroundTeamId.Horde; //for rated arenas use TeamIndex.Horde + team_index = BattleGroundTeamId.Horde; //for rated arenas use TeamIndex.Horde } //store pointer to arrayindex of player that was added first @@ -180,16 +180,16 @@ namespace Game.BattleGrounds public uint GetAverageQueueWaitTime(GroupQueueInfo ginfo, BattlegroundBracketId bracket_id) { - uint team_index = BatttleGroundTeamId.Alliance; //default set to TeamIndex.Alliance - or non rated arenas! + uint team_index = BattleGroundTeamId.Alliance; //default set to TeamIndex.Alliance - or non rated arenas! if (m_queueId.TeamSize == 0) { if (ginfo.Team == Team.Horde) - team_index = BatttleGroundTeamId.Horde; + team_index = BattleGroundTeamId.Horde; } else { if (m_queueId.Rated) - team_index = BatttleGroundTeamId.Horde; //for rated arenas use TeamIndex.Horde + team_index = BattleGroundTeamId.Horde; //for rated arenas use TeamIndex.Horde } //check if there is enought values(we always add values > 0) if (m_WaitTimes[team_index][(int)bracket_id][SharedConst.CountOfPlayersToAverageWaitTime - 1] != 0) @@ -453,7 +453,7 @@ namespace Game.BattleGrounds { int listIndex = 0; var info = m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalAlliance].FirstOrDefault(); - for (; alyIndex < aliCount && m_SelectionPools[BatttleGroundTeamId.Alliance].AddGroup(info, aliFree); alyIndex++) + for (; alyIndex < aliCount && m_SelectionPools[BattleGroundTeamId.Alliance].AddGroup(info, aliFree); alyIndex++) info = m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalAlliance][listIndex++]; } @@ -462,7 +462,7 @@ namespace Game.BattleGrounds { int listIndex = 0; var info = m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalHorde].FirstOrDefault(); - for (; hordeIndex < hordeCount && m_SelectionPools[BatttleGroundTeamId.Horde].AddGroup(info, hordeFree); hordeIndex++) + for (; hordeIndex < hordeCount && m_SelectionPools[BattleGroundTeamId.Horde].AddGroup(info, hordeFree); hordeIndex++) info = m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalHorde][listIndex++]; } @@ -478,45 +478,45 @@ namespace Game.BattleGrounds */ // At first we need to compare free space in bg and our selection pool - int diffAli = (int)(aliFree - m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount()); - int diffHorde = (int)(hordeFree - m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount()); - while (Math.Abs(diffAli - diffHorde) > 1 && (m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() > 0 || m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount() > 0)) + int diffAli = (int)(aliFree - m_SelectionPools[BattleGroundTeamId.Alliance].GetPlayerCount()); + int diffHorde = (int)(hordeFree - m_SelectionPools[BattleGroundTeamId.Horde].GetPlayerCount()); + while (Math.Abs(diffAli - diffHorde) > 1 && (m_SelectionPools[BattleGroundTeamId.Horde].GetPlayerCount() > 0 || m_SelectionPools[BattleGroundTeamId.Alliance].GetPlayerCount() > 0)) { //each cycle execution we need to kick at least 1 group if (diffAli < diffHorde) { //kick alliance group, add to pool new group if needed - if (m_SelectionPools[BatttleGroundTeamId.Alliance].KickGroup((uint)(diffHorde - diffAli))) + if (m_SelectionPools[BattleGroundTeamId.Alliance].KickGroup((uint)(diffHorde - diffAli))) { - for (; alyIndex < aliCount && m_SelectionPools[BatttleGroundTeamId.Alliance].AddGroup(m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalAlliance][alyIndex], (uint)((aliFree >= diffHorde) ? aliFree - diffHorde : 0)); alyIndex++) + for (; alyIndex < aliCount && m_SelectionPools[BattleGroundTeamId.Alliance].AddGroup(m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalAlliance][alyIndex], (uint)((aliFree >= diffHorde) ? aliFree - diffHorde : 0)); alyIndex++) ++alyIndex; } //if ali selection is already empty, then kick horde group, but if there are less horde than ali in bg - break; - if (m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount() == 0) + if (m_SelectionPools[BattleGroundTeamId.Alliance].GetPlayerCount() == 0) { if (aliFree <= diffHorde + 1) break; - m_SelectionPools[BatttleGroundTeamId.Horde].KickGroup((uint)(diffHorde - diffAli)); + m_SelectionPools[BattleGroundTeamId.Horde].KickGroup((uint)(diffHorde - diffAli)); } } else { //kick horde group, add to pool new group if needed - if (m_SelectionPools[BatttleGroundTeamId.Horde].KickGroup((uint)(diffAli - diffHorde))) + if (m_SelectionPools[BattleGroundTeamId.Horde].KickGroup((uint)(diffAli - diffHorde))) { - for (; hordeIndex < hordeCount && m_SelectionPools[BatttleGroundTeamId.Horde].AddGroup(m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalHorde][hordeIndex], (uint)((hordeFree >= diffAli) ? hordeFree - diffAli : 0)); hordeIndex++) + for (; hordeIndex < hordeCount && m_SelectionPools[BattleGroundTeamId.Horde].AddGroup(m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalHorde][hordeIndex], (uint)((hordeFree >= diffAli) ? hordeFree - diffAli : 0)); hordeIndex++) ++hordeIndex; } - if (m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() == 0) + if (m_SelectionPools[BattleGroundTeamId.Horde].GetPlayerCount() == 0) { if (hordeFree <= diffAli + 1) break; - m_SelectionPools[BatttleGroundTeamId.Alliance].KickGroup((uint)(diffAli - diffHorde)); + m_SelectionPools[BattleGroundTeamId.Alliance].KickGroup((uint)(diffAli - diffHorde)); } } //count diffs after small update - diffAli = (int)(aliFree - m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount()); - diffHorde = (int)(hordeFree - m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount()); + diffAli = (int)(aliFree - m_SelectionPools[BattleGroundTeamId.Alliance].GetPlayerCount()); + diffHorde = (int)(hordeFree - m_SelectionPools[BattleGroundTeamId.Horde].GetPlayerCount()); } } @@ -547,10 +547,10 @@ namespace Game.BattleGrounds if (ali_group != null && horde_group != null) { - m_SelectionPools[BatttleGroundTeamId.Alliance].AddGroup(ali_group, MaxPlayersPerTeam); - m_SelectionPools[BatttleGroundTeamId.Horde].AddGroup(horde_group, MaxPlayersPerTeam); + m_SelectionPools[BattleGroundTeamId.Alliance].AddGroup(ali_group, MaxPlayersPerTeam); + m_SelectionPools[BattleGroundTeamId.Horde].AddGroup(horde_group, MaxPlayersPerTeam); //add groups/players from normal queue to size of bigger group - uint maxPlayers = Math.Min(m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount(), m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount()); + uint maxPlayers = Math.Min(m_SelectionPools[BattleGroundTeamId.Alliance].GetPlayerCount(), m_SelectionPools[BattleGroundTeamId.Horde].GetPlayerCount()); for (uint i = 0; i < SharedConst.PvpTeamsCount; i++) { foreach (var groupQueueInfo in m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalAlliance + i]) @@ -605,12 +605,12 @@ namespace Game.BattleGrounds } } //try to invite same number of players - this cycle may cause longer wait time even if there are enough players in queue, but we want ballanced bg - uint j = BatttleGroundTeamId.Alliance; - if (m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() < m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount()) - j = BatttleGroundTeamId.Horde; + uint j = BattleGroundTeamId.Alliance; + if (m_SelectionPools[BattleGroundTeamId.Horde].GetPlayerCount() < m_SelectionPools[BattleGroundTeamId.Alliance].GetPlayerCount()) + j = BattleGroundTeamId.Horde; if (WorldConfig.GetIntValue(WorldCfg.BattlegroundInvitationType) != (int)BattlegroundQueueInvitationType.NoBalance - && m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() >= minPlayers && m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount() >= minPlayers) + && m_SelectionPools[BattleGroundTeamId.Horde].GetPlayerCount() >= minPlayers && m_SelectionPools[BattleGroundTeamId.Alliance].GetPlayerCount() >= minPlayers) { //we will try to invite more groups to team with less players indexed by j ++(teamIndex[j]); //this will not cause a crash, because for cycle above reached break; @@ -622,29 +622,29 @@ namespace Game.BattleGrounds break; } // do not allow to start bg with more than 2 players more on 1 faction - if (Math.Abs((m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() - m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount())) > 2) + if (Math.Abs((m_SelectionPools[BattleGroundTeamId.Horde].GetPlayerCount() - m_SelectionPools[BattleGroundTeamId.Alliance].GetPlayerCount())) > 2) return false; } //allow 1v0 if debug bg - if (Global.BattlegroundMgr.IsTesting() && (m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount() != 0 || m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() != 0)) + if (Global.BattlegroundMgr.IsTesting() && (m_SelectionPools[BattleGroundTeamId.Alliance].GetPlayerCount() != 0 || m_SelectionPools[BattleGroundTeamId.Horde].GetPlayerCount() != 0)) return true; //return true if there are enough players in selection pools - enable to work .debug bg command correctly - return m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount() >= minPlayers && m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() >= minPlayers; + return m_SelectionPools[BattleGroundTeamId.Alliance].GetPlayerCount() >= minPlayers && m_SelectionPools[BattleGroundTeamId.Horde].GetPlayerCount() >= minPlayers; } // this method will check if we can invite players to same faction skirmish match bool CheckSkirmishForSameFaction(BattlegroundBracketId bracket_id, uint minPlayersPerTeam) { - if (m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount() < minPlayersPerTeam && m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() < minPlayersPerTeam) + if (m_SelectionPools[BattleGroundTeamId.Alliance].GetPlayerCount() < minPlayersPerTeam && m_SelectionPools[BattleGroundTeamId.Horde].GetPlayerCount() < minPlayersPerTeam) return false; - uint teamIndex = BatttleGroundTeamId.Alliance; - uint otherTeam = BatttleGroundTeamId.Horde; + uint teamIndex = BattleGroundTeamId.Alliance; + uint otherTeam = BattleGroundTeamId.Horde; Team otherTeamId = Team.Horde; - if (m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() == minPlayersPerTeam) + if (m_SelectionPools[BattleGroundTeamId.Horde].GetPlayerCount() == minPlayersPerTeam) { - teamIndex = BatttleGroundTeamId.Horde; - otherTeam = BatttleGroundTeamId.Alliance; + teamIndex = BattleGroundTeamId.Horde; + otherTeam = BattleGroundTeamId.Alliance; otherTeamId = Team.Alliance; } //clear other team's selection @@ -744,17 +744,17 @@ namespace Game.BattleGrounds bg.GetStatus() > BattlegroundStatus.WaitQueue && bg.GetStatus() < BattlegroundStatus.WaitLeave) { // clear selection pools - m_SelectionPools[BatttleGroundTeamId.Alliance].Init(); - m_SelectionPools[BatttleGroundTeamId.Horde].Init(); + m_SelectionPools[BattleGroundTeamId.Alliance].Init(); + m_SelectionPools[BattleGroundTeamId.Horde].Init(); // call a function that does the job for us FillPlayersToBG(bg, bracket_id); // now everything is set, invite players - foreach (var queueInfo in m_SelectionPools[BatttleGroundTeamId.Alliance].SelectedGroups) + foreach (var queueInfo in m_SelectionPools[BattleGroundTeamId.Alliance].SelectedGroups) InviteGroupToBG(queueInfo, bg, queueInfo.Team); - foreach (var queueInfo in m_SelectionPools[BatttleGroundTeamId.Horde].SelectedGroups) + foreach (var queueInfo in m_SelectionPools[BattleGroundTeamId.Horde].SelectedGroups) InviteGroupToBG(queueInfo, bg, queueInfo.Team); if (!bg.HasFreeSlots()) @@ -777,8 +777,8 @@ namespace Game.BattleGrounds else if (Global.BattlegroundMgr.IsTesting()) MinPlayersPerTeam = 1; - m_SelectionPools[BatttleGroundTeamId.Alliance].Init(); - m_SelectionPools[BatttleGroundTeamId.Horde].Init(); + m_SelectionPools[BattleGroundTeamId.Alliance].Init(); + m_SelectionPools[BattleGroundTeamId.Horde].Init(); if (!bg_template.IsArena()) { @@ -793,13 +793,13 @@ namespace Game.BattleGrounds } // invite those selection pools for (uint i = 0; i < SharedConst.PvpTeamsCount; i++) - foreach (var queueInfo in m_SelectionPools[BatttleGroundTeamId.Alliance + i].SelectedGroups) + foreach (var queueInfo in m_SelectionPools[BattleGroundTeamId.Alliance + i].SelectedGroups) InviteGroupToBG(queueInfo, bg2, queueInfo.Team); bg2.StartBattleground(); //clear structures - m_SelectionPools[BatttleGroundTeamId.Alliance].Init(); - m_SelectionPools[BatttleGroundTeamId.Horde].Init(); + m_SelectionPools[BattleGroundTeamId.Alliance].Init(); + m_SelectionPools[BattleGroundTeamId.Horde].Init(); } } @@ -821,7 +821,7 @@ namespace Game.BattleGrounds // invite those selection pools for (uint i = 0; i < SharedConst.PvpTeamsCount; i++) { - foreach (var queueInfo in m_SelectionPools[BatttleGroundTeamId.Alliance + i].SelectedGroups) + foreach (var queueInfo in m_SelectionPools[BattleGroundTeamId.Alliance + i].SelectedGroups) InviteGroupToBG(queueInfo, bg2, queueInfo.Team); } // start bg @@ -908,8 +908,8 @@ namespace Game.BattleGrounds //if we have 2 teams, then start new arena and invite players! if (found == 2) { - GroupQueueInfo aTeam = queueArray[BatttleGroundTeamId.Alliance]; - GroupQueueInfo hTeam = queueArray[BatttleGroundTeamId.Horde]; + GroupQueueInfo aTeam = queueArray[BattleGroundTeamId.Alliance]; + GroupQueueInfo hTeam = queueArray[BattleGroundTeamId.Horde]; Battleground arena = Global.BattlegroundMgr.CreateNewBattleground(m_queueId, bracket_id); if (arena == null) { @@ -928,12 +928,12 @@ namespace Game.BattleGrounds if (aTeam.Team != Team.Alliance) { m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueuePremadeAlliance].Insert(0, aTeam); - m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueuePremadeHorde].Remove(queueArray[BatttleGroundTeamId.Alliance]); + m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueuePremadeHorde].Remove(queueArray[BattleGroundTeamId.Alliance]); } if (hTeam.Team != Team.Horde) { m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueuePremadeHorde].Insert(0, hTeam); - m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueuePremadeAlliance].Remove(queueArray[BatttleGroundTeamId.Horde]); + m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueuePremadeAlliance].Remove(queueArray[BattleGroundTeamId.Horde]); } arena.SetArenaMatchmakerRating(Team.Alliance, aTeam.ArenaMatchmakerRating); diff --git a/Source/Game/BattleGrounds/Zones/AlteracValley.cs b/Source/Game/BattleGrounds/Zones/AlteracValley.cs index 3e585661e..a8492208f 100644 --- a/Source/Game/BattleGrounds/Zones/AlteracValley.cs +++ b/Source/Game/BattleGrounds/Zones/AlteracValley.cs @@ -199,7 +199,7 @@ namespace Game.BattleGrounds.Zones.AlteracValley m_Team_QuestStatus[teamIndex][4]++; if (m_Team_QuestStatus[teamIndex][4] >= 200) Log.outDebug(LogFilter.Battleground, "BG_AV Quest {} completed (need to implement some events here", questid); - UpdateWorldState((int)(teamIndex == BatttleGroundTeamId.Alliance ? WorldStateIds.IvusStormCrystalCount : WorldStateIds.LokholarStormpikeSoldiersBloodCount), (int)m_Team_QuestStatus[teamIndex][4]); + UpdateWorldState((int)(teamIndex == BattleGroundTeamId.Alliance ? WorldStateIds.IvusStormCrystalCount : WorldStateIds.LokholarStormpikeSoldiersBloodCount), (int)m_Team_QuestStatus[teamIndex][4]); break; case QuestIds.ANearMine: case QuestIds.HNearMine: @@ -253,17 +253,17 @@ namespace Game.BattleGrounds.Zones.AlteracValley int teamindex = GetTeamIndexByTeamId(team); _teamResources[teamindex] += points; - UpdateWorldState((int)(teamindex == BatttleGroundTeamId.Horde ? WorldStateIds.HordeReinforcements : WorldStateIds.AllianceReinforcements), _teamResources[teamindex]); + UpdateWorldState((int)(teamindex == BattleGroundTeamId.Horde ? WorldStateIds.HordeReinforcements : WorldStateIds.AllianceReinforcements), _teamResources[teamindex]); if (points < 0) { if (_teamResources[teamindex] < 1) { _teamResources[teamindex] = 0; - EndBattleground(teamindex == BatttleGroundTeamId.Horde ? Team.Alliance : Team.Horde); + EndBattleground(teamindex == BattleGroundTeamId.Horde ? Team.Alliance : Team.Horde); } else if (!_isInformedNearVictory[teamindex] && _teamResources[teamindex] < MiscConst.NearLosePoints) { - if (teamindex == BatttleGroundTeamId.Alliance) + if (teamindex == BattleGroundTeamId.Alliance) SendBroadcastText((uint)BroadcastTextIds.AllianceNearLose, ChatMsg.BgSystemAlliance); else SendBroadcastText((uint)BroadcastTextIds.HordeNearLose, ChatMsg.BgSystemHorde); @@ -292,7 +292,7 @@ namespace Game.BattleGrounds.Zones.AlteracValley _mineResourceTimer.Reset(MiscConst.MineResourceTimer); } - for (byte i = BatttleGroundTeamId.Alliance; i <= BatttleGroundTeamId.Horde; i++) + for (byte i = BattleGroundTeamId.Alliance; i <= BattleGroundTeamId.Horde; i++) { if (!IsCaptainAlive(i)) continue; @@ -322,9 +322,9 @@ namespace Game.BattleGrounds.Zones.AlteracValley bool IsCaptainAlive(uint teamId) { - if (teamId == BatttleGroundTeamId.Horde) + if (teamId == BattleGroundTeamId.Horde) return GetBgMap().GetWorldStateValue((int)WorldStateIds.GalvagarAlive) == 1; - else if (teamId == BatttleGroundTeamId.Alliance) + else if (teamId == BattleGroundTeamId.Alliance) return GetBgMap().GetWorldStateValue((int)WorldStateIds.BalindaAlive) == 1; return false; @@ -365,18 +365,18 @@ namespace Game.BattleGrounds.Zones.AlteracValley { if (_nodes[i].Owner == Team.Alliance) { - rep[BatttleGroundTeamId.Alliance] += MiscConst.RepGainSurvivingTower; - kills[BatttleGroundTeamId.Alliance] += MiscConst.HonorKillBonusSurvivingTower; + rep[BattleGroundTeamId.Alliance] += MiscConst.RepGainSurvivingTower; + kills[BattleGroundTeamId.Alliance] += MiscConst.HonorKillBonusSurvivingTower; } else { - rep[BatttleGroundTeamId.Horde] += MiscConst.RepGainSurvivingTower; - kills[BatttleGroundTeamId.Horde] += MiscConst.HonorKillBonusSurvivingTower; + rep[BattleGroundTeamId.Horde] += MiscConst.RepGainSurvivingTower; + kills[BattleGroundTeamId.Horde] += MiscConst.HonorKillBonusSurvivingTower; } } } - for (byte i = BatttleGroundTeamId.Alliance; i <= BatttleGroundTeamId.Horde; ++i) + for (byte i = BattleGroundTeamId.Alliance; i <= BattleGroundTeamId.Horde; ++i) { if (IsCaptainAlive(i)) { @@ -713,24 +713,24 @@ namespace Game.BattleGrounds.Zones.AlteracValley Team owner = _nodes[(int)node].Owner; AVStates state = _nodes[(int)node].State; - UpdateWorldState(nodeInfo.AllianceAssault, (owner == Team.Alliance && state == AVStates.PointAssaulted) ? 1 : 0); - UpdateWorldState(nodeInfo.AllianceControl, (owner == Team.Alliance && state >= AVStates.PointDestroyed) ? 1 : 0); - UpdateWorldState(nodeInfo.HordeAssault, (owner == Team.Horde && state == AVStates.PointAssaulted) ? 1 : 0); - UpdateWorldState(nodeInfo.HordeControl, (owner == Team.Horde && state >= AVStates.PointDestroyed) ? 1 : 0); + UpdateWorldState(nodeInfo.AllianceAssault, owner == Team.Alliance && state == AVStates.PointAssaulted); + UpdateWorldState(nodeInfo.AllianceControl, owner == Team.Alliance && state >= AVStates.PointDestroyed); + UpdateWorldState(nodeInfo.HordeAssault, owner == Team.Horde && state == AVStates.PointAssaulted); + UpdateWorldState(nodeInfo.HordeControl, owner == Team.Horde && state >= AVStates.PointDestroyed); if (nodeInfo.Owner != 0) UpdateWorldState(nodeInfo.Owner, owner == Team.Horde ? 2 : owner == Team.Alliance ? 1 : 0); } if (node == AVNodes.SnowfallGrave) - UpdateWorldState((int)WorldStateIds.SnowfallGraveyardUncontrolled, _nodes[(int)node].Owner == Team.Other ? 1 : 0); + UpdateWorldState((int)WorldStateIds.SnowfallGraveyardUncontrolled, _nodes[(int)node].Owner == Team.Other); } void SendMineWorldStates(AlteracValleyMine mine) { AlteracValleyMineInfo mineInfo = _mineInfo[(byte)mine]; - UpdateWorldState(mineInfo.StaticInfo.WorldStateHordeControlled, mineInfo.Owner == Team.Horde ? 1 : 0); - UpdateWorldState(mineInfo.StaticInfo.WorldStateAllianceControlled, mineInfo.Owner == Team.Alliance ? 1 : 0); - UpdateWorldState(mineInfo.StaticInfo.WorldStateNeutralControlled, mineInfo.Owner == Team.Other ? 1 : 0); + UpdateWorldState(mineInfo.StaticInfo.WorldStateHordeControlled, mineInfo.Owner == Team.Horde); + UpdateWorldState(mineInfo.StaticInfo.WorldStateAllianceControlled, mineInfo.Owner == Team.Alliance); + UpdateWorldState(mineInfo.StaticInfo.WorldStateNeutralControlled, mineInfo.Owner == Team.Other); UpdateWorldState(mineInfo.StaticInfo.WorldStateOwner, mineInfo.Owner == Team.Horde ? 2 : mineInfo.Owner == Team.Alliance ? 1 : 0); } @@ -842,9 +842,9 @@ namespace Game.BattleGrounds.Zones.AlteracValley switch (dataId) { case MiscConst.DataDefenderTierAlliance: - return (uint)getDefenderTierForTeam(BatttleGroundTeamId.Alliance); + return (uint)getDefenderTierForTeam(BattleGroundTeamId.Alliance); case MiscConst.DataDefenderTierHorde: - return (uint)getDefenderTierForTeam(BatttleGroundTeamId.Horde); + return (uint)getDefenderTierForTeam(BattleGroundTeamId.Horde); default: return base.GetData(dataId); } diff --git a/Source/Game/BattleGrounds/Zones/ArathiBasin.cs b/Source/Game/BattleGrounds/Zones/ArathiBasin.cs index 6f5f6fac2..6ec5d1a38 100644 --- a/Source/Game/BattleGrounds/Zones/ArathiBasin.cs +++ b/Source/Game/BattleGrounds/Zones/ArathiBasin.cs @@ -62,7 +62,7 @@ namespace Game.BattleGrounds.Zones.ArathisBasin if (m_ReputationScoreTics[team] >= m_ReputationTics) { - if (team == BatttleGroundTeamId.Alliance) + if (team == BattleGroundTeamId.Alliance) RewardReputationToTeam(509, 10, Team.Alliance); else RewardReputationToTeam(510, 10, Team.Horde); @@ -72,13 +72,13 @@ namespace Game.BattleGrounds.Zones.ArathisBasin if (m_HonorScoreTics[team] >= m_HonorTics) { - RewardHonorToTeam(GetBonusHonorFromKill(1), (team == BatttleGroundTeamId.Alliance) ? Team.Alliance : Team.Horde); + RewardHonorToTeam(GetBonusHonorFromKill(1), (team == BattleGroundTeamId.Alliance) ? Team.Alliance : Team.Horde); m_HonorScoreTics[team] -= m_HonorTics; } if (!m_IsInformedNearVictory && m_TeamScores[team] > MiscConst.WarningNearVictoryScore) { - if (team == BatttleGroundTeamId.Alliance) + if (team == BattleGroundTeamId.Alliance) { SendBroadcastText((uint)ABBattlegroundBroadcastTexts.AllianceNearVictory, ChatMsg.BgSystemNeutral); PlaySoundToAll((uint)SoundIds.NearVictoryAlliance); @@ -94,7 +94,7 @@ namespace Game.BattleGrounds.Zones.ArathisBasin if (m_TeamScores[team] > MiscConst.MaxTeamScore) m_TeamScores[team] = MiscConst.MaxTeamScore; - if (team == BatttleGroundTeamId.Alliance) + if (team == BattleGroundTeamId.Alliance) UpdateWorldState(WorldStateIds.ResourcesAlly, (int)m_TeamScores[team]); else UpdateWorldState(WorldStateIds.ResourcesHorde, (int)m_TeamScores[team]); @@ -103,7 +103,7 @@ namespace Game.BattleGrounds.Zones.ArathisBasin int otherTeam = (team + 1) % SharedConst.PvpTeamsCount; if (m_TeamScores[team] > m_TeamScores[otherTeam] + 500) { - if (team == BatttleGroundTeamId.Alliance) + if (team == BattleGroundTeamId.Alliance) UpdateWorldState(WorldStateIds.Had500DisadvantageHorde, 1); else UpdateWorldState(WorldStateIds.Had500DisadvantageAlliance, 1); @@ -115,9 +115,9 @@ namespace Game.BattleGrounds.Zones.ArathisBasin } // Test win condition - if (m_TeamScores[BatttleGroundTeamId.Alliance] >= MiscConst.MaxTeamScore) + if (m_TeamScores[BattleGroundTeamId.Alliance] >= MiscConst.MaxTeamScore) EndBattleground(Team.Alliance); - else if (m_TeamScores[BatttleGroundTeamId.Horde] >= MiscConst.MaxTeamScore) + else if (m_TeamScores[BattleGroundTeamId.Horde] >= MiscConst.MaxTeamScore) EndBattleground(Team.Horde); } } diff --git a/Source/Game/BattleGrounds/Zones/EyeofStorm.cs b/Source/Game/BattleGrounds/Zones/EyeofStorm.cs index 51b7b1f44..e2b4a3310 100644 --- a/Source/Game/BattleGrounds/Zones/EyeofStorm.cs +++ b/Source/Game/BattleGrounds/Zones/EyeofStorm.cs @@ -48,8 +48,8 @@ namespace Game.BattleGrounds.Zones.EyeofStorm { _pointsTimer.Reset(MiscConst.PointsTickTime); - byte baseCountAlliance = GetControlledBaseCount(BatttleGroundTeamId.Alliance); - byte baseCountHorde = GetControlledBaseCount(BatttleGroundTeamId.Horde); + byte baseCountAlliance = GetControlledBaseCount(BattleGroundTeamId.Alliance); + byte baseCountHorde = GetControlledBaseCount(BattleGroundTeamId.Horde); if (baseCountAlliance > 0) AddPoints(Team.Alliance, MiscConst.TickPoints[baseCountAlliance - 1]); if (baseCountHorde > 0) @@ -108,11 +108,11 @@ namespace Game.BattleGrounds.Zones.EyeofStorm uint point = controlZoneHandler.Value.GetPoint(); switch (teamId) { - case BatttleGroundTeamId.Alliance: + case BattleGroundTeamId.Alliance: if (GetBgMap().GetWorldStateValue(MiscConst.m_PointsIconStruct[point].WorldStateAllianceControlledIndex) == 1) baseCount++; break; - case BatttleGroundTeamId.Horde: + case BattleGroundTeamId.Horde: if (GetBgMap().GetWorldStateValue(MiscConst.m_PointsIconStruct[point].WorldStateHordeControlledIndex) == 1) baseCount++; break; @@ -177,13 +177,13 @@ namespace Game.BattleGrounds.Zones.EyeofStorm if (score >= ScoreIds.MaxTeamScore) { score = ScoreIds.MaxTeamScore; - if (team == BatttleGroundTeamId.Alliance) + if (team == BattleGroundTeamId.Alliance) EndBattleground(Team.Alliance); else EndBattleground(Team.Horde); } - if (team == BatttleGroundTeamId.Alliance) + if (team == BattleGroundTeamId.Alliance) UpdateWorldState(WorldStateIds.AllianceResources, (int)score); else UpdateWorldState(WorldStateIds.HordeResources, (int)score); @@ -206,10 +206,10 @@ namespace Game.BattleGrounds.Zones.EyeofStorm void UpdatePointsCount(uint teamId) { - if (teamId == BatttleGroundTeamId.Alliance) - UpdateWorldState(WorldStateIds.AllianceBase, GetControlledBaseCount(BatttleGroundTeamId.Alliance)); + if (teamId == BattleGroundTeamId.Alliance) + UpdateWorldState(WorldStateIds.AllianceBase, GetControlledBaseCount(BattleGroundTeamId.Alliance)); else - UpdateWorldState(WorldStateIds.HordeBase, GetControlledBaseCount(BatttleGroundTeamId.Horde)); + UpdateWorldState(WorldStateIds.HordeBase, GetControlledBaseCount(BattleGroundTeamId.Horde)); } public override void OnGameObjectCreate(GameObject gameobject) @@ -358,8 +358,8 @@ namespace Game.BattleGrounds.Zones.EyeofStorm //call parent's class reset base.Reset(); - m_TeamScores[BatttleGroundTeamId.Alliance] = 0; - m_TeamScores[BatttleGroundTeamId.Horde] = 0; + m_TeamScores[BattleGroundTeamId.Alliance] = 0; + m_TeamScores[BattleGroundTeamId.Horde] = 0; m_HonorScoreTics = [0, 0]; m_FlagCapturedBgObjectType = 0; bool isBGWeekend = Global.BattlegroundMgr.IsBGWeekend(GetTypeID()); @@ -377,12 +377,12 @@ namespace Game.BattleGrounds.Zones.EyeofStorm public void EventTeamLostPoint(uint teamId, uint point, WorldObject controlZone) { - if (teamId == BatttleGroundTeamId.Alliance) + if (teamId == BattleGroundTeamId.Alliance) { SendBroadcastText(MiscConst.m_LosingPointTypes[point].MessageIdAlliance, ChatMsg.BgSystemAlliance, controlZone); UpdateWorldState(MiscConst.m_PointsIconStruct[point].WorldStateAllianceControlledIndex, 0); } - else if (teamId == BatttleGroundTeamId.Horde) + else if (teamId == BattleGroundTeamId.Horde) { SendBroadcastText(MiscConst.m_LosingPointTypes[point].MessageIdHorde, ChatMsg.BgSystemHorde, controlZone); UpdateWorldState(MiscConst.m_PointsIconStruct[point].WorldStateHordeControlledIndex, 0); @@ -394,12 +394,12 @@ namespace Game.BattleGrounds.Zones.EyeofStorm public void EventTeamCapturedPoint(uint teamId, uint point, WorldObject controlZone) { - if (teamId == BatttleGroundTeamId.Alliance) + if (teamId == BattleGroundTeamId.Alliance) { SendBroadcastText(MiscConst.m_CapturingPointTypes[point].MessageIdAlliance, ChatMsg.BgSystemAlliance, controlZone); UpdateWorldState(MiscConst.m_PointsIconStruct[point].WorldStateAllianceControlledIndex, 1); } - else if (teamId == BatttleGroundTeamId.Horde) + else if (teamId == BattleGroundTeamId.Horde) { SendBroadcastText(MiscConst.m_CapturingPointTypes[point].MessageIdHorde, ChatMsg.BgSystemHorde, controlZone); UpdateWorldState(MiscConst.m_PointsIconStruct[point].WorldStateHordeControlledIndex, 1); @@ -416,9 +416,9 @@ namespace Game.BattleGrounds.Zones.EyeofStorm public override Team GetPrematureWinner() { - if (GetTeamScore(BatttleGroundTeamId.Alliance) > GetTeamScore(BatttleGroundTeamId.Horde)) + if (GetTeamScore(BattleGroundTeamId.Alliance) > GetTeamScore(BattleGroundTeamId.Horde)) return Team.Alliance; - else if (GetTeamScore(BatttleGroundTeamId.Horde) > GetTeamScore(BatttleGroundTeamId.Alliance)) + else if (GetTeamScore(BattleGroundTeamId.Horde) > GetTeamScore(BattleGroundTeamId.Alliance)) return Team.Horde; return base.GetPrematureWinner(); @@ -526,22 +526,22 @@ namespace Game.BattleGrounds.Zones.EyeofStorm public override void HandleProgressEventHorde(GameObject controlZone) { - _battleground.EventTeamCapturedPoint(BatttleGroundTeamId.Horde, _point, controlZone); + _battleground.EventTeamCapturedPoint(BattleGroundTeamId.Horde, _point, controlZone); } public override void HandleProgressEventAlliance(GameObject controlZone) { - _battleground.EventTeamCapturedPoint(BatttleGroundTeamId.Alliance, _point, controlZone); + _battleground.EventTeamCapturedPoint(BattleGroundTeamId.Alliance, _point, controlZone); } public override void HandleNeutralEventHorde(GameObject controlZone) { - _battleground.EventTeamLostPoint(BatttleGroundTeamId.Horde, _point, controlZone); + _battleground.EventTeamLostPoint(BattleGroundTeamId.Horde, _point, controlZone); } public override void HandleNeutralEventAlliance(GameObject controlZone) { - _battleground.EventTeamLostPoint(BatttleGroundTeamId.Alliance, _point, controlZone); + _battleground.EventTeamLostPoint(BattleGroundTeamId.Alliance, _point, controlZone); } public uint GetPoint() { return _point; } diff --git a/Source/Game/BattleGrounds/Zones/StrandofAncients.cs b/Source/Game/BattleGrounds/Zones/StrandofAncients.cs index 50fb5fd39..7e37daec6 100644 --- a/Source/Game/BattleGrounds/Zones/StrandofAncients.cs +++ b/Source/Game/BattleGrounds/Zones/StrandofAncients.cs @@ -3,262 +3,132 @@ using Framework.Constants; using Game.Entities; -using Game.Networking.Packets; +using Game.Maps; +using System; using System.Collections.Generic; -using System.Numerics; -namespace Game.BattleGrounds.Zones +namespace Game.BattleGrounds.Zones.StrandOfAncients { public class BgStrandOfAncients : Battleground { + /// Id of attacker team + int Attackers; + /// Totale elapsed time of current round + uint TotalTime; + /// Max time of round + uint EndRoundTimer; + /// For know if boats has start moving or not yet + bool ShipsStarted; + /// Statu of battle (Start or not, and what round) + SAStatus Status; + /// Score of each round + RoundScore[] RoundScores = new RoundScore[2]; + /// used for know we are in timer phase or not (used for worldstate update) + bool TimerEnabled; + /// 5secs before starting the 1min countdown for second round + uint UpdateWaitTimer; + /// for know if warning about second round start has been sent + bool SignaledRoundTwo; + /// for know if warning about second round start has been sent + bool SignaledRoundTwoHalfMin; + /// for know if second round has been init + bool InitSecondRound; + + // [team][boat_idx] + ObjectGuid[][] _boatGUIDs = new ObjectGuid[SharedConst.PvpTeamsCount][]; + List[] _staticBombGUIDs = new List[SharedConst.PvpTeamsCount]; // bombs ready to be picked up + List _dynamicBombGUIDs = new(); // bombs thrown by players, ready to explode/disarm + + ObjectGuid _graveyardWest; + ObjectGuid _graveyardEast; + ObjectGuid _graveyardCentral; + List _gateGUIDs = new(); + ObjectGuid _collisionDoorGUID; + ObjectGuid _kanrethadGUID; + ObjectGuid _titanRelicGUID; + public BgStrandOfAncients(BattlegroundTemplate battlegroundTemplate) : base(battlegroundTemplate) { StartMessageIds[BattlegroundConst.EventIdFourth] = 0; - BgObjects = new ObjectGuid[SAObjectTypes.MaxObj]; - BgCreatures = new ObjectGuid[SACreatureTypes.Max + SAGraveyards.Max]; - TimerEnabled = false; - UpdateWaitTimer = 0; - SignaledRoundTwo = false; - SignaledRoundTwoHalfMin = false; - InitSecondRound = false; - Attackers = BatttleGroundTeamId.Alliance; - TotalTime = 0; - EndRoundTimer = 0; - ShipsStarted = false; - Status = SAStatus.NotStarted; + Attackers = RandomHelper.IRand(BattleGroundTeamId.Alliance, BattleGroundTeamId.Horde); - for (byte i = 0; i < GateStatus.Length; ++i) - GateStatus[i] = SAGateState.HordeGateOk; - - for (byte i = 0; i < 2; i++) + for (var i = 0; i < SharedConst.PvpTeamsCount; ++i) { - RoundScores[i].winner = BatttleGroundTeamId.Alliance; - RoundScores[i].time = 0; + _boatGUIDs[i] = new ObjectGuid[2]; + _staticBombGUIDs[i] = new(); } } public override void Reset() { TotalTime = 0; - Attackers = (RandomHelper.URand(0, 1) != 0 ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde); - for (byte i = 0; i <= 5; i++) - GateStatus[i] = SAGateState.HordeGateOk; ShipsStarted = false; Status = SAStatus.Warmup; } public override bool SetupBattleground() { - return ResetObjs(); + return true; } bool ResetObjs() { - foreach (var pair in GetPlayers()) + foreach (ObjectGuid bombGuid in _dynamicBombGUIDs) { - Player player = Global.ObjAccessor.FindPlayer(pair.Key); - if (player != null) - SendTransportsRemove(player); + GameObject bomb = GetBgMap().GetGameObject(bombGuid); + if (bomb != null) + bomb.Delete(); } - uint atF = SAMiscConst.Factions[Attackers]; - uint defF = SAMiscConst.Factions[Attackers != 0 ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde]; + _dynamicBombGUIDs.Clear(); - for (byte i = 0; i < SAObjectTypes.MaxObj; i++) - DelObject(i); - - for (byte i = 0; i < SACreatureTypes.Max; i++) - DelCreature(i); - - for (byte i = SACreatureTypes.Max; i < SACreatureTypes.Max + SAGraveyards.Max; i++) - DelCreature(i); - - for (byte i = 0; i < GateStatus.Length; ++i) - GateStatus[i] = Attackers == BatttleGroundTeamId.Horde ? SAGateState.AllianceGateOk : SAGateState.HordeGateOk; - - if (AddCreature(SAMiscConst.NpcEntries[SACreatureTypes.Kanrethad], SACreatureTypes.Kanrethad, SAMiscConst.NpcSpawnlocs[SACreatureTypes.Kanrethad]) == null) - { - Log.outError(LogFilter.Battleground, $"SOTA: couldn't spawn Kanrethad, aborted. Entry: {SAMiscConst.NpcEntries[SACreatureTypes.Kanrethad]}"); - return false; - } - - for (byte i = 0; i <= SAObjectTypes.PortalDeffenderRed; i++) - { - if (!AddObject(i, SAMiscConst.ObjEntries[i], SAMiscConst.ObjSpawnlocs[i], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay)) - { - Log.outError(LogFilter.Battleground, $"SOTA: couldn't spawn BG_SA_PORTAL_DEFFENDER_RED, Entry: {SAMiscConst.ObjEntries[i]}"); - continue; - } - } - - for (int i = SAObjectTypes.BoatOne; i <= SAObjectTypes.BoatTwo; i++) - { - uint boatid = 0; - switch (i) - { - case SAObjectTypes.BoatOne: - boatid = Attackers != 0 ? SAGameObjectIds.BoatOneH : SAGameObjectIds.BoatOneA; - break; - case SAObjectTypes.BoatTwo: - boatid = Attackers != 0 ? SAGameObjectIds.BoatTwoH : SAGameObjectIds.BoatTwoA; - break; - default: - break; - } - if (!AddObject(i, boatid, SAMiscConst.ObjSpawnlocs[i].GetPositionX(), - SAMiscConst.ObjSpawnlocs[i].GetPositionY(), - SAMiscConst.ObjSpawnlocs[i].GetPositionZ() + (Attackers != 0 ? -3.750f : 0), - SAMiscConst.ObjSpawnlocs[i].GetOrientation(), 0, 0, 0, 0, BattlegroundConst.RespawnOneDay)) - { - Log.outError(LogFilter.Battleground, $"SOTA: couldn't spawn one of the BG_SA_BOAT, Entry: {boatid}"); - continue; - } - } - - for (byte i = SAObjectTypes.Sigil1; i <= SAObjectTypes.LeftFlagpole; i++) - { - if (!AddObject(i, SAMiscConst.ObjEntries[i], SAMiscConst.ObjSpawnlocs[i], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay)) - { - Log.outError(LogFilter.Battleground, $"SOTA: couldn't spawn Sigil, Entry: {SAMiscConst.ObjEntries[i]}"); - continue; - } - } - - // MAD props for Kiper for discovering those values - 4 hours of his work. - GetBGObject(SAObjectTypes.BoatOne).SetParentRotation(new Quaternion(0.0f, 0.0f, 1.0f, 0.0002f)); - GetBGObject(SAObjectTypes.BoatTwo).SetParentRotation(new Quaternion(0.0f, 0.0f, 1.0f, 0.00001f)); - SpawnBGObject(SAObjectTypes.BoatOne, BattlegroundConst.RespawnImmediately); - SpawnBGObject(SAObjectTypes.BoatTwo, BattlegroundConst.RespawnImmediately); - - //Cannons and demolishers - NPCs are spawned - //By capturing GYs. - for (byte i = 0; i < SACreatureTypes.Demolisher5; i++) - { - if (AddCreature(SAMiscConst.NpcEntries[i], i, SAMiscConst.NpcSpawnlocs[i], Attackers == BatttleGroundTeamId.Alliance ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance, 600) == null) - { - Log.outError(LogFilter.Battleground, $"SOTA: couldn't spawn Cannon or demolisher, Entry: {SAMiscConst.NpcEntries[i]}, Attackers: {(Attackers == BatttleGroundTeamId.Alliance ? "Horde(1)" : "Alliance(0)")}"); - continue; - } - } - - OverrideGunFaction(); - DemolisherStartState(true); - - for (byte i = 0; i <= SAObjectTypes.PortalDeffenderRed; i++) - { - SpawnBGObject(i, BattlegroundConst.RespawnImmediately); - GetBGObject(i).SetFaction(defF); - } - - GetBGObject(SAObjectTypes.TitanRelic).SetFaction(atF); - GetBGObject(SAObjectTypes.TitanRelic).Refresh(); + int defenders = Attackers == BattleGroundTeamId.Alliance ? BattleGroundTeamId.Horde : BattleGroundTeamId.Alliance; TotalTime = 0; ShipsStarted = false; - //Graveyards - for (uint i = 0; i < SAGraveyards.Max; i++) - { - WorldSafeLocsEntry sg = Global.ObjectMgr.GetWorldSafeLoc(SAMiscConst.GYEntries[i]); - if (sg == null) - { - Log.outError(LogFilter.Battleground, $"SOTA: Can't find GY entry {SAMiscConst.GYEntries[i]}"); - return false; - } + UpdateWorldState((int)WorldStateIds.AllyAttacks, Attackers == BattleGroundTeamId.Alliance); + UpdateWorldState((int)WorldStateIds.HordeAttacks, Attackers == BattleGroundTeamId.Horde); - if (i == SAGraveyards.BeachGy) - { - GraveyardStatus[i] = Attackers; - AddSpiritGuide(i + SACreatureTypes.Max, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), SAMiscConst.GYOrientation[i], Attackers); - } - else - { - GraveyardStatus[i] = ((Attackers == BatttleGroundTeamId.Horde) ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde); - if (!AddSpiritGuide(i + SACreatureTypes.Max, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), SAMiscConst.GYOrientation[i], Attackers == BatttleGroundTeamId.Horde ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde)) - Log.outError(LogFilter.Battleground, $"SOTA: couldn't spawn GY: {i}"); - } + UpdateWorldState((int)WorldStateIds.RightAttTokenAll, Attackers == BattleGroundTeamId.Alliance); + UpdateWorldState((int)WorldStateIds.LeftAttTokenAll, Attackers == BattleGroundTeamId.Alliance); + + UpdateWorldState((int)WorldStateIds.RightAttTokenHrd, Attackers == BattleGroundTeamId.Horde); + UpdateWorldState((int)WorldStateIds.LeftAttTokenHrd, Attackers == BattleGroundTeamId.Horde); + + UpdateWorldState((int)WorldStateIds.HordeDefenceToken, defenders == BattleGroundTeamId.Horde); + UpdateWorldState((int)WorldStateIds.AllianceDefenceToken, defenders == BattleGroundTeamId.Alliance); + + CaptureGraveyard(StrandOfTheAncientsGraveyard.Central, defenders); + CaptureGraveyard(StrandOfTheAncientsGraveyard.West, defenders); + CaptureGraveyard(StrandOfTheAncientsGraveyard.East, defenders); + + UpdateWorldState((int)WorldStateIds.AttackerTeam, Attackers); + + foreach (ObjectGuid guid in _gateGUIDs) + { + GameObject gate = GetBgMap().GetGameObject(guid); + if (gate != null) + gate.SetDestructibleState(GameObjectDestructibleState.Intact, null, true); } - //GY capture points - for (byte i = SAObjectTypes.CentralFlag; i <= SAObjectTypes.LeftFlag; i++) - { - if (!AddObject(i, (SAMiscConst.ObjEntries[i] - (Attackers == BatttleGroundTeamId.Alliance ? 1u : 0)), SAMiscConst.ObjSpawnlocs[i], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay)) - { - Log.outError(LogFilter.Battleground, $"SOTA: couldn't spawn Central Flag Entry: {SAMiscConst.ObjEntries[i] - (Attackers == BatttleGroundTeamId.Alliance ? 1 : 0)}"); - continue; - } - GetBGObject(i).SetFaction(atF); - } + int state = (int)(Attackers == BattleGroundTeamId.Alliance ? GateState.HordeGateOk : GateState.AllianceGateOk); + UpdateWorldState((int)WorldStateIds.PurpleGate, state); + UpdateWorldState((int)WorldStateIds.RedGate, state); + UpdateWorldState((int)WorldStateIds.BlueGate, state); + UpdateWorldState((int)WorldStateIds.GreenGate, state); + UpdateWorldState((int)WorldStateIds.YellowGate, state); + UpdateWorldState((int)WorldStateIds.AncientGate, state); - UpdateObjectInteractionFlags(); + GetBgMap().UpdateSpawnGroupConditions(); - for (byte i = SAObjectTypes.Bomb; i < SAObjectTypes.MaxObj; i++) - { - if (!AddObject(i, SAMiscConst.ObjEntries[SAObjectTypes.Bomb], SAMiscConst.ObjSpawnlocs[i], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay)) - { - Log.outError(LogFilter.Battleground, $"SOTA: couldn't spawn SA Bomb Entry: {SAMiscConst.ObjEntries[SAObjectTypes.Bomb] + i}"); - continue; - } - GetBGObject(i).SetFaction(atF); - } + GameObject door = GetBgMap().GetGameObject(_collisionDoorGUID); + if (door != null) + door.ResetDoorOrButton(); - //Player may enter BEFORE we set up BG - lets update his worldstates anyway... - UpdateWorldState(SAWorldStateIds.RightGyHorde, GraveyardStatus[SAGraveyards.RightCapturableGy] == BatttleGroundTeamId.Horde ? 1 : 0); - UpdateWorldState(SAWorldStateIds.LeftGyHorde, GraveyardStatus[SAGraveyards.LeftCapturableGy] == BatttleGroundTeamId.Horde ? 1 : 0); - UpdateWorldState(SAWorldStateIds.CenterGyHorde, GraveyardStatus[SAGraveyards.CentralCapturableGy] == BatttleGroundTeamId.Horde ? 1 : 0); - - UpdateWorldState(SAWorldStateIds.RightGyAlliance, GraveyardStatus[SAGraveyards.RightCapturableGy] == BatttleGroundTeamId.Alliance ? 1 : 0); - UpdateWorldState(SAWorldStateIds.LeftGyAlliance, GraveyardStatus[SAGraveyards.LeftCapturableGy] == BatttleGroundTeamId.Alliance ? 1 : 0); - UpdateWorldState(SAWorldStateIds.CenterGyAlliance, GraveyardStatus[SAGraveyards.CentralCapturableGy] == BatttleGroundTeamId.Alliance ? 1 : 0); - - if (Attackers == BatttleGroundTeamId.Alliance) - { - UpdateWorldState(SAWorldStateIds.AllyAttacks, 1); - UpdateWorldState(SAWorldStateIds.HordeAttacks, 0); - - UpdateWorldState(SAWorldStateIds.RightAttTokenAll, 1); - UpdateWorldState(SAWorldStateIds.LeftAttTokenAll, 1); - UpdateWorldState(SAWorldStateIds.RightAttTokenHrd, 0); - UpdateWorldState(SAWorldStateIds.LeftAttTokenHrd, 0); - - UpdateWorldState(SAWorldStateIds.HordeDefenceToken, 1); - UpdateWorldState(SAWorldStateIds.AllianceDefenceToken, 0); - } - else - { - UpdateWorldState(SAWorldStateIds.HordeAttacks, 1); - UpdateWorldState(SAWorldStateIds.AllyAttacks, 0); - - UpdateWorldState(SAWorldStateIds.RightAttTokenAll, 0); - UpdateWorldState(SAWorldStateIds.LeftAttTokenAll, 0); - UpdateWorldState(SAWorldStateIds.RightAttTokenHrd, 1); - UpdateWorldState(SAWorldStateIds.LeftAttTokenHrd, 1); - - UpdateWorldState(SAWorldStateIds.HordeDefenceToken, 0); - UpdateWorldState(SAWorldStateIds.AllianceDefenceToken, 1); - } - - UpdateWorldState(SAWorldStateIds.AttackerTeam, Attackers); - UpdateWorldState(SAWorldStateIds.PurpleGate, 1); - UpdateWorldState(SAWorldStateIds.RedGate, 1); - UpdateWorldState(SAWorldStateIds.BlueGate, 1); - UpdateWorldState(SAWorldStateIds.GreenGate, 1); - UpdateWorldState(SAWorldStateIds.YellowGate, 1); - UpdateWorldState(SAWorldStateIds.AncientGate, 1); - - for (int i = SAObjectTypes.BoatOne; i <= SAObjectTypes.BoatTwo; i++) - { - foreach (var pair in GetPlayers()) - { - Player player = Global.ObjAccessor.FindPlayer(pair.Key); - if (player != null) - SendTransportInit(player); - } - } - - // set status manually so preparation is cast correctly in 2nd round too SetStatus(BattlegroundStatus.WaitJoin); + GetBgMap().DoOnPlayers(SendTransportInit); TeleportPlayers(); return true; @@ -269,22 +139,24 @@ namespace Game.BattleGrounds.Zones if (ShipsStarted) return; - GetBGObject(SAObjectTypes.BoatOne).SetGoState(GameObjectState.TransportStopped); - GetBGObject(SAObjectTypes.BoatTwo).SetGoState(GameObjectState.TransportStopped); - - for (int i = SAObjectTypes.BoatOne; i <= SAObjectTypes.BoatTwo; i++) + foreach (ObjectGuid guid in _boatGUIDs[Attackers]) { - foreach (var pair in GetPlayers()) + GameObject boat = GetBgMap().GetGameObject(guid); + if (boat != null) { - Player player = Global.ObjAccessor.FindPlayer(pair.Key); - if (player != null) - { - UpdateData data = new(player.GetMapId()); - GetBGObject(i).BuildValuesUpdateBlockForPlayer(data, player); + boat.SetGoState(GameObjectState.TransportStopped); - UpdateObject pkt; - data.BuildPacket(out pkt); - player.SendPacket(pkt); + foreach (var (playerGuid, _) in GetPlayers()) + { + Player player = Global.ObjAccessor.FindPlayer(playerGuid); + if (player != null) + { + UpdateData data = new(player.GetMapId()); + boat.BuildValuesUpdateBlockForPlayer(data, player); + + data.BuildPacket(out var pkt); + player.SendPacket(pkt); + } } } } @@ -301,7 +173,7 @@ namespace Game.BattleGrounds.Zones { SignaledRoundTwo = true; InitSecondRound = false; - SendBroadcastText(SABroadcastTexts.RoundTwoStartOneMinute, ChatMsg.BgSystemNeutral); + SendBroadcastText((uint)BroadcastTextIds.RoundTwoStartOneMinute, ChatMsg.BgSystemNeutral); } } else @@ -314,48 +186,46 @@ namespace Game.BattleGrounds.Zones if (Status == SAStatus.Warmup) { - EndRoundTimer = SATimers.RoundLength; - UpdateWorldState(SAWorldStateIds.Timer, (int)(GameTime.GetGameTime() + EndRoundTimer)); - if (TotalTime >= SATimers.WarmupLength) + EndRoundTimer = MiscConst.RoundlengthTimer; + UpdateWorldState((int)WorldStateIds.Timer, (int)(GameTime.GetGameTime() + EndRoundTimer)); + if (TotalTime >= MiscConst.WarmuplengthTimer) { - Creature creature = GetBGCreature(SACreatureTypes.Kanrethad); + Creature creature = FindKanrethad(); if (creature != null) - SendChatMessage(creature, SATextIds.RoundStarted); + SendChatMessage(creature, (byte)TextIds.RoundStarted); TotalTime = 0; ToggleTimer(); - DemolisherStartState(false); Status = SAStatus.RoundOne; - TriggerGameEvent(Attackers == BatttleGroundTeamId.Alliance ? 23748 : 21702u); + TriggerGameEvent(Attackers == BattleGroundTeamId.Alliance ? 23748 : 21702u); } - if (TotalTime >= SATimers.BoatStart) + if (TotalTime >= MiscConst.BoatStartTimer) StartShips(); return; } else if (Status == SAStatus.SecondWarmup) { - if (RoundScores[0].time < SATimers.RoundLength) + if (RoundScores[0].time < MiscConst.RoundlengthTimer) EndRoundTimer = RoundScores[0].time; else - EndRoundTimer = SATimers.RoundLength; + EndRoundTimer = MiscConst.RoundlengthTimer; - UpdateWorldState(SAWorldStateIds.Timer, (int)(GameTime.GetGameTime() + EndRoundTimer)); + UpdateWorldState((int)WorldStateIds.Timer, (int)(GameTime.GetGameTime() + EndRoundTimer / 1000)); if (TotalTime >= 60000) { - Creature creature = GetBGCreature(SACreatureTypes.Kanrethad); + Creature creature = FindKanrethad(); if (creature != null) - SendChatMessage(creature, SATextIds.RoundStarted); + SendChatMessage(creature, (byte)TextIds.RoundStarted); TotalTime = 0; ToggleTimer(); - DemolisherStartState(false); Status = SAStatus.RoundTwo; - TriggerGameEvent(Attackers == BatttleGroundTeamId.Alliance ? 23748 : 21702u); + TriggerGameEvent(Attackers == BattleGroundTeamId.Alliance ? 23748 : 21702u); // status was set to STATUS_WAIT_JOIN manually for Preparation, set it back now SetStatus(BattlegroundStatus.InProgress); - foreach (var pair in GetPlayers()) + foreach (var (playerGuid, _) in GetPlayers()) { - Player player = Global.ObjAccessor.FindPlayer(pair.Key); + Player player = Global.ObjAccessor.FindPlayer(playerGuid); if (player != null) player.RemoveAurasDueToSpell(BattlegroundConst.SpellPreparation); } @@ -365,7 +235,7 @@ namespace Game.BattleGrounds.Zones if (!SignaledRoundTwoHalfMin) { SignaledRoundTwoHalfMin = true; - SendBroadcastText(SABroadcastTexts.RoundTwoStartHalfMinute, ChatMsg.BgSystemNeutral); + SendBroadcastText((uint)BroadcastTextIds.RoundTwoStartHalfMinute, ChatMsg.BgSystemNeutral); } } StartShips(); @@ -375,22 +245,9 @@ namespace Game.BattleGrounds.Zones { if (Status == SAStatus.RoundOne) { - if (TotalTime >= SATimers.RoundLength) + if (TotalTime >= MiscConst.RoundlengthTimer) { - CastSpellOnTeam(SASpellIds.EndOfRound, Team.Alliance); - CastSpellOnTeam(SASpellIds.EndOfRound, Team.Horde); - RoundScores[0].winner = (uint)Attackers; - RoundScores[0].time = SATimers.RoundLength; - TotalTime = 0; - Status = SAStatus.SecondWarmup; - Attackers = (Attackers == BatttleGroundTeamId.Alliance) ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance; - UpdateWaitTimer = 5000; - SignaledRoundTwo = false; - SignaledRoundTwoHalfMin = false; - InitSecondRound = true; - ToggleTimer(); - ResetObjs(); - GetBgMap().UpdateAreaDependentAuras(); + EndRound(); return; } } @@ -398,21 +255,19 @@ namespace Game.BattleGrounds.Zones { if (TotalTime >= EndRoundTimer) { - CastSpellOnTeam(SASpellIds.EndOfRound, Team.Alliance); - CastSpellOnTeam(SASpellIds.EndOfRound, Team.Horde); - RoundScores[1].time = SATimers.RoundLength; - RoundScores[1].winner = (uint)((Attackers == BatttleGroundTeamId.Alliance) ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance); + CastSpellOnTeam((uint)SpellIds.EndOfRound, Team.Alliance); + CastSpellOnTeam((uint)SpellIds.EndOfRound, Team.Horde); + RoundScores[1].time = MiscConst.RoundlengthTimer; + RoundScores[1].winner = (uint)((Attackers == BattleGroundTeamId.Alliance) ? BattleGroundTeamId.Horde : BattleGroundTeamId.Alliance); if (RoundScores[0].time == RoundScores[1].time) - EndBattleground(0); + EndBattleground(Team.Other); else if (RoundScores[0].time < RoundScores[1].time) - EndBattleground(RoundScores[0].winner == BatttleGroundTeamId.Alliance ? Team.Alliance : Team.Horde); + EndBattleground(RoundScores[0].winner == BattleGroundTeamId.Alliance ? Team.Alliance : Team.Horde); else - EndBattleground(RoundScores[1].winner == BatttleGroundTeamId.Alliance ? Team.Alliance : Team.Horde); + EndBattleground(RoundScores[1].winner == BattleGroundTeamId.Alliance ? Team.Alliance : Team.Horde); return; } } - if (Status == SAStatus.RoundOne || Status == SAStatus.RoundTwo) - UpdateDemolisherSpawns(); } } @@ -431,9 +286,9 @@ namespace Game.BattleGrounds.Zones void TeleportPlayers() { - foreach (var pair in GetPlayers()) + foreach (var (playerGuid, _) in GetPlayers()) { - Player player = Global.ObjAccessor.FindPlayer(pair.Key); + Player player = Global.ObjAccessor.FindPlayer(playerGuid); if (player != null) { // should remove spirit of redemption @@ -460,83 +315,120 @@ namespace Game.BattleGrounds.Zones { if (GetTeamIndexByTeamId(GetPlayerTeam(player.GetGUID())) == Attackers) { - if (!ShipsStarted) + ObjectGuid boatGUID = _boatGUIDs[Attackers][RandomHelper.URand(0, 1)]; + GameObject boat = GetBgMap().GetGameObject(boatGUID); + if (boat != null) { - // player.AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT); + ITransport transport = boat.ToTransportBase(); + if (transport != null) + { + player.Relocate(MiscConst.spawnPositionOnTransport[Attackers]); + transport.AddPassenger(player); + player.m_movementInfo.transport.pos.Relocate(MiscConst.spawnPositionOnTransport[Attackers]); + MiscConst.spawnPositionOnTransport[Attackers].GetPosition(out float x, out float y, out float z, out float o); + transport.CalculatePassengerPosition(ref x, ref y, ref z, ref o); + player.Relocate(x, y, z, o); - if (RandomHelper.URand(0, 1) != 0) - player.TeleportTo(607, 2682.936f, -830.368f, 15.0f, 2.895f, 0); - else - player.TeleportTo(607, 2577.003f, 980.261f, 15.0f, 0.807f, 0); + if (player.IsInWorld) + player.NearTeleportTo(x, y, z, o); + } } - else - player.TeleportTo(607, 1600.381f, -106.263f, 8.8745f, 3.78f, 0); } else - player.TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0); + { + WorldSafeLocsEntry defenderSpawn = Global.ObjectMgr.GetWorldSafeLoc(MiscConst.SpawnDefenders); + if (defenderSpawn != null) + { + if (player.IsInWorld) + player.TeleportTo(defenderSpawn.Loc); + else + player.WorldRelocate(defenderSpawn.Loc); + } + } } public override void ProcessEvent(WorldObject obj, uint eventId, WorldObject invoker = null) { - GameObject go = obj.ToGameObject(); + switch (eventId) + { + case MiscConst.EventAllianceAssaultStarted: + foreach (ObjectGuid bombGuid in _staticBombGUIDs[BattleGroundTeamId.Alliance]) + { + GameObject bomb = GetBgMap().GetGameObject(bombGuid); + if (bomb != null) + bomb.RemoveFlag(GameObjectFlags.NotSelectable); + } + break; + case MiscConst.EventHordeAssaultStarted: + foreach (ObjectGuid bombGuid in _staticBombGUIDs[BattleGroundTeamId.Horde]) + { + GameObject bomb = GetBgMap().GetGameObject(bombGuid); + if (bomb != null) + bomb.RemoveFlag(GameObjectFlags.NotSelectable); + } + break; + default: + break; + } + + GameObject go = obj?.ToGameObject(); if (go != null) { switch (go.GetGoType()) { case GameObjectTypes.Goober: if (invoker != null) - if (eventId == (uint)SAEventIds.BG_SA_EVENT_TITAN_RELIC_ACTIVATED) + if (eventId == (uint)MiscConst.EventTitanRelicActivated) TitanRelicActivated(invoker.ToPlayer()); break; case GameObjectTypes.DestructibleBuilding: { - SAGateInfo gate = GetGate(obj.GetEntry()); + GateInfo gate = GetGate(obj.GetEntry()); if (gate != null) { - uint gateId = gate.GateId; + uint gateId = gate.GameObjectId; // damaged if (eventId == go.GetGoInfo().DestructibleBuilding.DamagedEvent) { - GateStatus[gateId] = Attackers == BatttleGroundTeamId.Horde ? SAGateState.AllianceGateDamaged : SAGateState.HordeGateDamaged; + GateState gateState = Attackers == BattleGroundTeamId.Horde ? GateState.AllianceGateDamaged : GateState.HordeGateDamaged; Creature creature = obj.FindNearestCreature(SharedConst.WorldTrigger, 500.0f); if (creature != null) SendChatMessage(creature, (byte)gate.DamagedText, invoker); - PlaySoundToAll(Attackers == BatttleGroundTeamId.Alliance ? SASoundIds.WallAttackedAlliance : SASoundIds.WallAttackedHorde); + PlaySoundToAll((uint)(Attackers == BattleGroundTeamId.Alliance ? SoundIds.WallAttackedAlliance : SoundIds.WallAttackedHorde)); + + UpdateWorldState(gate.WorldState, (int)gateState); } // destroyed else if (eventId == go.GetGoInfo().DestructibleBuilding.DestroyedEvent) { - GateStatus[gate.GateId] = Attackers == BatttleGroundTeamId.Horde ? SAGateState.AllianceGateDestroyed : SAGateState.HordeGateDestroyed; - - if (gateId < 5) - DelObject((int)gateId + 14); + GateState gateState = Attackers == BattleGroundTeamId.Horde ? GateState.AllianceGateDestroyed : GateState.HordeGateDestroyed; Creature creature = obj.FindNearestCreature(SharedConst.WorldTrigger, 500.0f); if (creature != null) SendChatMessage(creature, (byte)gate.DestroyedText, invoker); - PlaySoundToAll(Attackers == BatttleGroundTeamId.Alliance ? SASoundIds.WallDestroyedAlliance : SASoundIds.WallDestroyedHorde); + PlaySoundToAll((uint)(Attackers == BattleGroundTeamId.Alliance ? SoundIds.WallDestroyedAlliance : SoundIds.WallDestroyedHorde)); bool rewardHonor = true; - switch (gateId) + switch ((GameObjectIds)gateId) { - case SAObjectTypes.GreenGate: - if (IsGateDestroyed(SAObjectTypes.BlueGate)) + case GameObjectIds.GateOfTheGreenEmerald: + if (IsGateDestroyed(GetGate((uint)GameObjectIds.GateOfTheBlueSapphire))) rewardHonor = false; break; - case SAObjectTypes.BlueGate: - if (IsGateDestroyed(SAObjectTypes.GreenGate)) + case GameObjectIds.GateOfTheBlueSapphire: + if (IsGateDestroyed(GetGate((uint)GameObjectIds.GateOfTheGreenEmerald))) rewardHonor = false; break; - case SAObjectTypes.RedGate: - if (IsGateDestroyed(SAObjectTypes.PurpleGate)) + case GameObjectIds.GateOfTheRedSun: + if (IsGateDestroyed(GetGate((uint)GameObjectIds.GateOfThePurpleAmethyst))) rewardHonor = false; break; - case SAObjectTypes.PurpleGate: - if (IsGateDestroyed(SAObjectTypes.RedGate)) + case GameObjectIds.GateOfThePurpleAmethyst: + if (IsGateDestroyed(GetGate((uint)GameObjectIds.GateOfTheRedSun))) rewardHonor = false; break; default: @@ -551,19 +443,19 @@ namespace Game.BattleGrounds.Zones Player player = unit.GetCharmerOrOwnerPlayerOrPlayerItself(); if (player != null) { - UpdatePvpStat(player, (uint)StrandOfTheAncientsPvpStats.GatesDestroyed, 1); + UpdatePvpStat(player, MiscConst.PvPStatGatesDestroyed, 1); if (rewardHonor) UpdatePlayerScore(player, ScoreType.BonusHonor, GetBonusHonorFromKill(1)); } } } - UpdateObjectInteractionFlags(); - } - else - break; + if (rewardHonor) + MakeObjectsInteractable(gate.LineOfDefense); - UpdateWorldState(gate.WorldState, (int)GateStatus[gateId]); + UpdateWorldState(gate.WorldState, (int)gateState); + GetBgMap().UpdateSpawnGroupConditions(); + } } break; } @@ -575,264 +467,40 @@ namespace Game.BattleGrounds.Zones public override void HandleKillUnit(Creature creature, Unit killer) { - if (creature.GetEntry() == SACreatureIds.Demolisher) + if (creature.GetEntry() == (uint)CreatureIds.Demolisher) { Player killerPlayer = killer.GetCharmerOrOwnerPlayerOrPlayerItself(); if (killerPlayer != null) - UpdatePvpStat(killerPlayer, (uint)StrandOfTheAncientsPvpStats.DemolishersDestroyed, 1); + UpdatePvpStat(killerPlayer, MiscConst.PvpStatDemolishersDestroyed, 1); - uint worldStateId = Attackers == BatttleGroundTeamId.Horde ? SAWorldStateIds.DestroyedHordeVehicles : SAWorldStateIds.DestroyedAllianceVehicles; - int currentDestroyedVehicles = Global.WorldStateMgr.GetValue((int)worldStateId, GetBgMap()); + int worldStateId = (int)(Attackers == BattleGroundTeamId.Horde ? WorldStateIds.DestroyedHordeVehicles : WorldStateIds.DestroyedAllianceVehicles); + int currentDestroyedVehicles = Global.WorldStateMgr.GetValue(worldStateId, GetBgMap()); UpdateWorldState(worldStateId, currentDestroyedVehicles + 1); } } - /* - You may ask what the fuck does it do? - Prevents owner overwriting guns faction with own. - */ - void OverrideGunFaction() + public override void DestroyGate(Player player, GameObject go) { } + + void CaptureGraveyard(StrandOfTheAncientsGraveyard graveyard, int teamId) { - if (BgCreatures[0].IsEmpty()) - return; - - for (byte i = SACreatureTypes.Gun1; i <= SACreatureTypes.Gun10; i++) + switch (graveyard) { - Creature gun = GetBGCreature(i); - if (gun != null) - gun.SetFaction(SAMiscConst.Factions[Attackers != 0 ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde]); - } + case StrandOfTheAncientsGraveyard.West: + UpdateWorldState((int)WorldStateIds.LeftGyAlliance, teamId == BattleGroundTeamId.Alliance); + UpdateWorldState((int)WorldStateIds.LeftGyHorde, teamId == BattleGroundTeamId.Horde); + break; + case StrandOfTheAncientsGraveyard.East: + UpdateWorldState((int)WorldStateIds.RightGyAlliance, teamId == BattleGroundTeamId.Alliance); + UpdateWorldState((int)WorldStateIds.RightGyHorde, teamId == BattleGroundTeamId.Horde); + break; + case StrandOfTheAncientsGraveyard.Central: + UpdateWorldState((int)WorldStateIds.CenterGyAlliance, teamId == BattleGroundTeamId.Alliance); + UpdateWorldState((int)WorldStateIds.CenterGyHorde, teamId == BattleGroundTeamId.Horde); - for (byte i = SACreatureTypes.Demolisher1; i <= SACreatureTypes.Demolisher4; i++) - { - Creature dem = GetBGCreature(i); - if (dem != null) - dem.SetFaction(SAMiscConst.Factions[Attackers]); - } - } - - void DemolisherStartState(bool start) - { - if (BgCreatures[0].IsEmpty()) - return; - - // set flags only for the demolishers on the beach, factory ones dont need it - for (byte i = SACreatureTypes.Demolisher1; i <= SACreatureTypes.Demolisher4; i++) - { - Creature dem = GetBGCreature(i); - if (dem != null) - { - if (start) - { - dem.SetUnitFlag(UnitFlags.NonAttackable); - dem.SetUninteractible(true); - } - else - { - dem.RemoveUnitFlag(UnitFlags.NonAttackable); - dem.SetUninteractible(false); - } - } - } - } - - public override void DestroyGate(Player player, GameObject go) - { - } - - public override WorldSafeLocsEntry GetClosestGraveyard(Player player) - { - uint safeloc; - - int teamId = GetTeamIndexByTeamId(GetPlayerTeam(player.GetGUID())); - if (teamId == Attackers) - safeloc = SAMiscConst.GYEntries[SAGraveyards.BeachGy]; - else - safeloc = SAMiscConst.GYEntries[SAGraveyards.DefenderLastGy]; - - WorldSafeLocsEntry closest = Global.ObjectMgr.GetWorldSafeLoc(safeloc); - float nearest = player.GetExactDistSq(closest.Loc); - - for (byte i = SAGraveyards.RightCapturableGy; i < SAGraveyards.Max; i++) - { - if (GraveyardStatus[i] != teamId) - continue; - - WorldSafeLocsEntry ret = Global.ObjectMgr.GetWorldSafeLoc(SAMiscConst.GYEntries[i]); - float dist = player.GetExactDistSq(ret.Loc); - if (dist < nearest) - { - closest = ret; - nearest = dist; - } - } - - return closest; - } - - bool CanInteractWithObject(uint objectId) - { - switch (objectId) - { - case SAObjectTypes.TitanRelic: - if (!IsGateDestroyed(SAObjectTypes.AncientGate) || !IsGateDestroyed(SAObjectTypes.YellowGate)) - return false; - goto case SAObjectTypes.CentralFlag; - case SAObjectTypes.CentralFlag: - if (!IsGateDestroyed(SAObjectTypes.RedGate) && !IsGateDestroyed(SAObjectTypes.PurpleGate)) - return false; - goto case SAObjectTypes.LeftFlag; - case SAObjectTypes.LeftFlag: - case SAObjectTypes.RightFlag: - if (!IsGateDestroyed(SAObjectTypes.GreenGate) && !IsGateDestroyed(SAObjectTypes.BlueGate)) - return false; + CaptureGraveyard(StrandOfTheAncientsGraveyard.East, teamId); + CaptureGraveyard(StrandOfTheAncientsGraveyard.West, teamId); break; default: - //ABORT(); - break; - } - - return true; - } - - void UpdateObjectInteractionFlags(uint objectId) - { - GameObject go = GetBGObject((int)objectId); - if (go != null) - { - if (CanInteractWithObject(objectId)) - go.RemoveFlag(GameObjectFlags.NotSelectable); - else - go.SetFlag(GameObjectFlags.NotSelectable); - } - } - - void UpdateObjectInteractionFlags() - { - for (byte i = SAObjectTypes.CentralFlag; i <= SAObjectTypes.LeftFlag; ++i) - UpdateObjectInteractionFlags(i); - UpdateObjectInteractionFlags(SAObjectTypes.TitanRelic); - } - - public override void EventPlayerClickedOnFlag(Player source, GameObject go) - { - switch (go.GetEntry()) - { - case 191307: - case 191308: - if (CanInteractWithObject(SAObjectTypes.LeftFlag)) - CaptureGraveyard(SAGraveyards.LeftCapturableGy, source); - break; - case 191305: - case 191306: - if (CanInteractWithObject(SAObjectTypes.RightFlag)) - CaptureGraveyard(SAGraveyards.RightCapturableGy, source); - break; - case 191310: - case 191309: - if (CanInteractWithObject(SAObjectTypes.CentralFlag)) - CaptureGraveyard(SAGraveyards.CentralCapturableGy, source); - break; - default: - return; - } - } - - void CaptureGraveyard(uint i, Player source) - { - if (GraveyardStatus[i] == Attackers) - return; - - DelCreature(SACreatureTypes.Max + i); - int teamId = GetTeamIndexByTeamId(GetPlayerTeam(source.GetGUID())); - GraveyardStatus[i] = teamId; - WorldSafeLocsEntry sg = Global.ObjectMgr.GetWorldSafeLoc(SAMiscConst.GYEntries[i]); - if (sg == null) - { - Log.outError(LogFilter.Battleground, $"CaptureGraveyard: non-existant GY entry: {SAMiscConst.GYEntries[i]}"); - return; - } - - AddSpiritGuide(i + SACreatureTypes.Max, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), SAMiscConst.GYOrientation[i], GraveyardStatus[i]); - - uint npc; - int flag; - switch (i) - { - case SAGraveyards.LeftCapturableGy: - { - flag = SAObjectTypes.LeftFlag; - DelObject(flag); - AddObject(flag, (SAMiscConst.ObjEntries[flag] - (teamId == BatttleGroundTeamId.Alliance ? 0 : 1u)), - SAMiscConst.ObjSpawnlocs[flag], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay); - - npc = SACreatureTypes.Rigspark; - Creature rigspark = AddCreature(SAMiscConst.NpcEntries[npc], npc, SAMiscConst.NpcSpawnlocs[npc], Attackers); - if (rigspark != null) - rigspark.GetAI().Talk(SATextIds.SparklightRigsparkSpawn); - - for (byte j = SACreatureTypes.Demolisher7; j <= SACreatureTypes.Demolisher8; j++) - { - AddCreature(SAMiscConst.NpcEntries[j], j, SAMiscConst.NpcSpawnlocs[j], (Attackers == BatttleGroundTeamId.Alliance ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance), 600); - Creature dem = GetBGCreature(j); - if (dem != null) - dem.SetFaction(SAMiscConst.Factions[Attackers]); - } - - UpdateWorldState(SAWorldStateIds.LeftGyAlliance, GraveyardStatus[i] == BatttleGroundTeamId.Alliance ? 1 : 0); - UpdateWorldState(SAWorldStateIds.LeftGyHorde, GraveyardStatus[i] == BatttleGroundTeamId.Horde ? 1 : 0); - - Creature creature = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f); - if (creature != null) - SendChatMessage(creature, teamId == BatttleGroundTeamId.Alliance ? SATextIds.WestGraveyardCapturedA : SATextIds.WestGraveyardCapturedH, source); - } - break; - case SAGraveyards.RightCapturableGy: - { - flag = SAObjectTypes.RightFlag; - DelObject(flag); - AddObject(flag, (SAMiscConst.ObjEntries[flag] - (teamId == BatttleGroundTeamId.Alliance ? 0 : 1u)), - SAMiscConst.ObjSpawnlocs[flag], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay); - - npc = SACreatureTypes.Sparklight; - Creature sparklight = AddCreature(SAMiscConst.NpcEntries[npc], npc, SAMiscConst.NpcSpawnlocs[npc], Attackers); - if (sparklight != null) - sparklight.GetAI().Talk(SATextIds.SparklightRigsparkSpawn); - - for (byte j = SACreatureTypes.Demolisher5; j <= SACreatureTypes.Demolisher6; j++) - { - AddCreature(SAMiscConst.NpcEntries[j], j, SAMiscConst.NpcSpawnlocs[j], Attackers == BatttleGroundTeamId.Alliance ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance, 600); - - Creature dem = GetBGCreature(j); - if (dem != null) - dem.SetFaction(SAMiscConst.Factions[Attackers]); - } - - UpdateWorldState(SAWorldStateIds.RightGyAlliance, GraveyardStatus[i] == BatttleGroundTeamId.Alliance ? 1 : 0); - UpdateWorldState(SAWorldStateIds.RightGyHorde, GraveyardStatus[i] == BatttleGroundTeamId.Horde ? 1 : 0); - - Creature creature = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f); - if (creature != null) - SendChatMessage(creature, teamId == BatttleGroundTeamId.Alliance ? SATextIds.EastGraveyardCapturedA : SATextIds.EastGraveyardCapturedH, source); - } - break; - case SAGraveyards.CentralCapturableGy: - { - flag = SAObjectTypes.CentralFlag; - DelObject(flag); - AddObject(flag, (SAMiscConst.ObjEntries[flag] - (teamId == BatttleGroundTeamId.Alliance ? 0 : 1u)), - SAMiscConst.ObjSpawnlocs[flag], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay); - - UpdateWorldState(SAWorldStateIds.CenterGyAlliance, GraveyardStatus[i] == BatttleGroundTeamId.Alliance ? 1 : 0); - UpdateWorldState(SAWorldStateIds.CenterGyHorde, GraveyardStatus[i] == BatttleGroundTeamId.Horde ? 1 : 0); - - Creature creature = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f); - if (creature != null) - SendChatMessage(creature, teamId == BatttleGroundTeamId.Alliance ? SATextIds.SouthGraveyardCapturedA : SATextIds.SouthGraveyardCapturedH, source); - } - break; - default: - //ABORT(); break; } } @@ -842,68 +510,50 @@ namespace Game.BattleGrounds.Zones if (clicker == null) return; - if (CanInteractWithObject(SAObjectTypes.TitanRelic)) + int clickerTeamId = GetTeamIndexByTeamId(GetPlayerTeam(clicker.GetGUID())); + if (clickerTeamId == Attackers) { - int clickerTeamId = GetTeamIndexByTeamId(GetPlayerTeam(clicker.GetGUID())); - if (clickerTeamId == Attackers) + if (clickerTeamId == BattleGroundTeamId.Alliance) + SendBroadcastText((uint)BroadcastTextIds.AllianceCapturedTitanPortal, ChatMsg.BgSystemNeutral); + else + SendBroadcastText((uint)BroadcastTextIds.HordeCapturedTitanPortal, ChatMsg.BgSystemNeutral); + + if (Status == SAStatus.RoundOne) { - if (clickerTeamId == BatttleGroundTeamId.Alliance) - SendBroadcastText(SABroadcastTexts.AllianceCapturedTitanPortal, ChatMsg.BgSystemNeutral); + EndRound(); + // Achievement Storm the Beach (1310) + foreach (var (playerGuid, _) in GetPlayers()) + { + Player player = Global.ObjAccessor.FindPlayer(playerGuid); + if (player != null) + if (GetTeamIndexByTeamId(GetPlayerTeam(player.GetGUID())) == Attackers) + player.UpdateCriteria(CriteriaType.BeSpellTarget, 65246); + } + + Creature creature = FindKanrethad(); + if (creature != null) + SendChatMessage(creature, (byte)TextIds.Round1Finished); + } + else if (Status == SAStatus.RoundTwo) + { + RoundScores[1].winner = (uint)Attackers; + RoundScores[1].time = TotalTime; + ToggleTimer(); + // Achievement Storm the Beach (1310) + foreach (var (playerGuid, _) in GetPlayers()) + { + Player player = Global.ObjAccessor.FindPlayer(playerGuid); + if (player != null) + if (GetTeamIndexByTeamId(GetPlayerTeam(player.GetGUID())) == Attackers && RoundScores[1].winner == Attackers) + player.UpdateCriteria(CriteriaType.BeSpellTarget, 65246); + } + + if (RoundScores[0].time == RoundScores[1].time) + EndBattleground(Team.Other); + else if (RoundScores[0].time < RoundScores[1].time) + EndBattleground(RoundScores[0].winner == BattleGroundTeamId.Alliance ? Team.Alliance : Team.Horde); else - SendBroadcastText(SABroadcastTexts.HordeCapturedTitanPortal, ChatMsg.BgSystemNeutral); - - if (Status == SAStatus.RoundOne) - { - RoundScores[0].winner = (uint)Attackers; - RoundScores[0].time = TotalTime; - // Achievement Storm the Beach (1310) - foreach (var pair in GetPlayers()) - { - Player player = Global.ObjAccessor.FindPlayer(pair.Key); - if (player != null) - if (GetTeamIndexByTeamId(GetPlayerTeam(player.GetGUID())) == Attackers) - player.UpdateCriteria(CriteriaType.BeSpellTarget, 65246); - } - - Attackers = (Attackers == BatttleGroundTeamId.Alliance) ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance; - Status = SAStatus.SecondWarmup; - TotalTime = 0; - ToggleTimer(); - - Creature creature = GetBGCreature(SACreatureTypes.Kanrethad); - if (creature != null) - SendChatMessage(creature, SATextIds.Round1Finished); - - UpdateWaitTimer = 5000; - SignaledRoundTwo = false; - SignaledRoundTwoHalfMin = false; - InitSecondRound = true; - ResetObjs(); - GetBgMap().UpdateAreaDependentAuras(); - CastSpellOnTeam(SASpellIds.EndOfRound, Team.Alliance); - CastSpellOnTeam(SASpellIds.EndOfRound, Team.Horde); - } - else if (Status == SAStatus.RoundTwo) - { - RoundScores[1].winner = (uint)Attackers; - RoundScores[1].time = TotalTime; - ToggleTimer(); - // Achievement Storm the Beach (1310) - foreach (var pair in GetPlayers()) - { - Player player = Global.ObjAccessor.FindPlayer(pair.Key); - if (player != null) - if (GetTeamIndexByTeamId(GetPlayerTeam(player.GetGUID())) == Attackers && RoundScores[1].winner == Attackers) - player.UpdateCriteria(CriteriaType.BeSpellTarget, 65246); - } - - if (RoundScores[0].time == RoundScores[1].time) - EndBattleground(0); - else if (RoundScores[0].time < RoundScores[1].time) - EndBattleground(RoundScores[0].winner == BatttleGroundTeamId.Alliance ? Team.Alliance : Team.Horde); - else - EndBattleground(RoundScores[1].winner == BatttleGroundTeamId.Alliance ? Team.Alliance : Team.Horde); - } + EndBattleground(RoundScores[1].winner == BattleGroundTeamId.Alliance ? Team.Alliance : Team.Horde); } } } @@ -911,7 +561,7 @@ namespace Game.BattleGrounds.Zones void ToggleTimer() { TimerEnabled = !TimerEnabled; - UpdateWorldState(SAWorldStateIds.EnableTimer, TimerEnabled ? 1 : 0); + UpdateWorldState((int)WorldStateIds.EnableTimer, TimerEnabled); } public override void EndBattleground(Team winner) @@ -929,383 +579,321 @@ namespace Game.BattleGrounds.Zones base.EndBattleground(winner); } - void UpdateDemolisherSpawns() - { - for (byte i = SACreatureTypes.Demolisher1; i <= SACreatureTypes.Demolisher8; i++) - { - if (!BgCreatures[i].IsEmpty()) - { - Creature demolisher = GetBGCreature(i); - if (demolisher != null) - { - if (demolisher.IsDead()) - { - // Demolisher is not in list - if (!DemoliserRespawnList.ContainsKey(i)) - { - DemoliserRespawnList[i] = GameTime.GetGameTimeMS() + 30000; - } - else - { - if (DemoliserRespawnList[i] < GameTime.GetGameTimeMS()) - { - demolisher.Relocate(SAMiscConst.NpcSpawnlocs[i]); - demolisher.Respawn(); - DemoliserRespawnList.Remove(i); - } - } - } - } - } - } - } - void SendTransportInit(Player player) { - if (!BgObjects[SAObjectTypes.BoatOne].IsEmpty() || !BgObjects[SAObjectTypes.BoatTwo].IsEmpty()) + UpdateData transData = new(player.GetMapId()); + foreach (ObjectGuid boatGuid in _boatGUIDs[Attackers]) { - UpdateData transData = new(player.GetMapId()); - if (!BgObjects[SAObjectTypes.BoatOne].IsEmpty()) - GetBGObject(SAObjectTypes.BoatOne).BuildCreateUpdateBlockForPlayer(transData, player); - - if (!BgObjects[SAObjectTypes.BoatTwo].IsEmpty()) - GetBGObject(SAObjectTypes.BoatTwo).BuildCreateUpdateBlockForPlayer(transData, player); - - UpdateObject packet; - transData.BuildPacket(out packet); - player.SendPacket(packet); + GameObject boat = GetBgMap().GetGameObject(boatGuid); + if (boat != null) + boat.BuildCreateUpdateBlockForPlayer(transData, player); } + + transData.BuildPacket(out var packet); + player.SendPacket(packet); } void SendTransportsRemove(Player player) { - if (!BgObjects[SAObjectTypes.BoatOne].IsEmpty() || !BgObjects[SAObjectTypes.BoatTwo].IsEmpty()) + UpdateData transData = new(player.GetMapId()); + foreach (ObjectGuid boatGuid in _boatGUIDs[Attackers]) { - UpdateData transData = new(player.GetMapId()); - if (!BgObjects[SAObjectTypes.BoatOne].IsEmpty()) - GetBGObject(SAObjectTypes.BoatOne).BuildOutOfRangeUpdateBlock(transData); - if (!BgObjects[SAObjectTypes.BoatTwo].IsEmpty()) - GetBGObject(SAObjectTypes.BoatTwo).BuildOutOfRangeUpdateBlock(transData); - - UpdateObject packet; - transData.BuildPacket(out packet); - player.SendPacket(packet); + GameObject boat = GetBgMap().GetGameObject(boatGuid); + if (boat != null) + boat.BuildOutOfRangeUpdateBlock(transData); } + + transData.BuildPacket(out var packet); + player.SendPacket(packet); } - bool IsGateDestroyed(uint gateId) + bool IsGateDestroyed(GateInfo gateInfo) { - Cypher.Assert(gateId < SAMiscConst.Gates.Length); - return GateStatus[gateId] == SAGateState.AllianceGateDestroyed || GateStatus[gateId] == SAGateState.HordeGateDestroyed; + if (gateInfo == null) + return false; + + int value = GetBgMap().GetWorldStateValue(gateInfo.WorldState); + return value == (int)GateState.AllianceGateDestroyed || value == (int)GateState.HordeGateDestroyed; } - public override bool IsSpellAllowed(uint spellId, Player player) + void HandleCaptureGraveyardAction(GameObject graveyardBanner, Player player) { - switch (spellId) + if (graveyardBanner == null || player == null) + return; + + int teamId = GetTeamIndexByTeamId(GetPlayerTeam(player.GetGUID())); + // Only attackers can capture graveyard by gameobject action + if (teamId != Attackers) + return; + + switch ((GameObjectIds)graveyardBanner.GetEntry()) { - case SASpellIds.AllianceControlPhaseShift: - return Attackers == BatttleGroundTeamId.Horde; - case SASpellIds.HordeControlPhaseShift: - return Attackers == BatttleGroundTeamId.Alliance; - case BattlegroundConst.SpellPreparation: - return Status == SAStatus.Warmup || Status == SAStatus.SecondWarmup; + case GameObjectIds.GraveyardWestA: + case GameObjectIds.GraveyardWestH: + CaptureGraveyard(StrandOfTheAncientsGraveyard.West, teamId); + break; + case GameObjectIds.GraveyardEastA: + case GameObjectIds.GraveyardEastH: + CaptureGraveyard(StrandOfTheAncientsGraveyard.East, teamId); + break; + case GameObjectIds.GraveyardCentralA: + case GameObjectIds.GraveyardCentralH: + CaptureGraveyard(StrandOfTheAncientsGraveyard.Central, teamId); + break; default: break; } - - return true; } - SAGateInfo GetGate(uint entry) + void MakeObjectsInteractable(DefenseLine defenseLine) { - foreach (var gate in SAMiscConst.Gates) + var makeInteractable = (ObjectGuid guid) => + { + GameObject gameObject = GetBgMap().GetGameObject(guid); + if (gameObject != null) + gameObject.RemoveFlag(GameObjectFlags.NotSelectable); + }; + + switch (defenseLine) + { + case DefenseLine.First: + makeInteractable(_graveyardWest); + makeInteractable(_graveyardEast); + break; + case DefenseLine.Second: + makeInteractable(_graveyardCentral); + break; + case DefenseLine.Third: + break; + case DefenseLine.Last: + // make titan orb interactable + GameObject door = GetBgMap().GetGameObject(_collisionDoorGUID); + if (door != null) + door.UseDoorOrButton(); + + makeInteractable(_titanRelicGUID); + break; + default: + break; + } + } + + Creature FindKanrethad() + { + return GetBgMap().GetCreature(_kanrethadGUID); + } + + void EndRound() + { + RoundScores[0].winner = (uint)Attackers; + RoundScores[0].time = Math.Min(TotalTime, MiscConst.RoundlengthTimer); + + Attackers = (Attackers == BattleGroundTeamId.Alliance) ? BattleGroundTeamId.Horde : BattleGroundTeamId.Alliance; + Status = SAStatus.SecondWarmup; + TotalTime = 0; + ToggleTimer(); + + UpdateWaitTimer = 5000; + SignaledRoundTwo = false; + SignaledRoundTwoHalfMin = false; + InitSecondRound = true; + ResetObjs(); + GetBgMap().UpdateAreaDependentAuras(); + + CastSpellOnTeam((uint)SpellIds.EndOfRound, Team.Alliance); + CastSpellOnTeam((uint)SpellIds.EndOfRound, Team.Horde); + + RemoveAuraOnTeam((uint)SpellIds.CarryingSeaforiumCharge, Team.Horde); + RemoveAuraOnTeam((uint)SpellIds.CarryingSeaforiumCharge, Team.Alliance); + } + + public override void OnGameObjectCreate(GameObject gameobject) + { + base.OnGameObjectCreate(gameobject); + + if (gameobject.GetGoType() == GameObjectTypes.DestructibleBuilding) + _gateGUIDs.Add(gameobject.GetGUID()); + + switch ((GameObjectIds)gameobject.GetEntry()) + { + case GameObjectIds.BoatOneA: + _boatGUIDs[BattleGroundTeamId.Alliance][0] = gameobject.GetGUID(); + break; + case GameObjectIds.BoatTwoA: + _boatGUIDs[BattleGroundTeamId.Alliance][1] = gameobject.GetGUID(); + break; + case GameObjectIds.BoatOneH: + _boatGUIDs[BattleGroundTeamId.Horde][0] = gameobject.GetGUID(); + break; + case GameObjectIds.BoatTwoH: + _boatGUIDs[BattleGroundTeamId.Horde][1] = gameobject.GetGUID(); + break; + case GameObjectIds.SeaforiumBombA: + _staticBombGUIDs[BattleGroundTeamId.Alliance].Add(gameobject.GetGUID()); + if (Status != SAStatus.SecondWarmup && Status != SAStatus.Warmup) + gameobject.RemoveFlag(GameObjectFlags.NotSelectable); + break; + case GameObjectIds.SeaforiumBombH: + _staticBombGUIDs[BattleGroundTeamId.Horde].Add(gameobject.GetGUID()); + if (Status != SAStatus.SecondWarmup && Status != SAStatus.Warmup) + gameobject.RemoveFlag(GameObjectFlags.NotSelectable); + break; + case GameObjectIds.SeaforiumChargeA: + case GameObjectIds.SeaforiumChargeH: + _dynamicBombGUIDs.Add(gameobject.GetGUID()); + break; + case GameObjectIds.GraveyardEastA: + case GameObjectIds.GraveyardEastH: + _graveyardEast = gameobject.GetGUID(); + break; + case GameObjectIds.GraveyardWestA: + case GameObjectIds.GraveyardWestH: + _graveyardWest = gameobject.GetGUID(); + break; + case GameObjectIds.GraveyardCentralA: + case GameObjectIds.GraveyardCentralH: + _graveyardCentral = gameobject.GetGUID(); + break; + case GameObjectIds.CollisionDoor: + _collisionDoorGUID = gameobject.GetGUID(); + break; + case GameObjectIds.TitanRelicA: + case GameObjectIds.TitanRelicH: + _titanRelicGUID = gameobject.GetGUID(); + break; + default: + break; + } + } + + public override void DoAction(uint actionId, WorldObject source = null, WorldObject target = null) + { + switch (actionId) + { + case 0: + HandleCaptureGraveyardAction(target?.ToGameObject(), source?.ToPlayer()); + break; + default: + break; + } + } + + public override void OnCreatureCreate(Creature creature) + { + base.OnCreatureCreate(creature); + + switch ((CreatureIds)creature.GetEntry()) + { + case CreatureIds.Demolisher: + creature.SetFaction(MiscConst.Factions[Attackers]); + break; + case CreatureIds.AntipersonnelCannon: + creature.SetFaction(MiscConst.Factions[Attackers == BattleGroundTeamId.Horde ? BattleGroundTeamId.Alliance : BattleGroundTeamId.Horde]); + break; + case CreatureIds.Kanrethad: + _kanrethadGUID = creature.GetGUID(); + break; + case CreatureIds.RiggerSparklight: + case CreatureIds.GorgrilRigspark: + creature.GetAI().Talk((uint)TextIds.SparklightRigsparkSpawn); + break; + default: + break; + } + } + + public override void OnMapSet(BattlegroundMap map) + { + base.OnMapSet(map); + ResetObjs(); + } + + public override uint GetData(uint dataId) + { + switch (dataId) + { + case MiscConst.DataAttackers: + return (uint)Attackers; + case MiscConst.DataStatus: + return (uint)Status; + default: + return base.GetData(dataId); + } + } + + // Return GateInfo, relative to bg data, according to gameobject entry + GateInfo GetGate(uint entry) + { + foreach (GateInfo gate in MiscConst.Gates) if (gate.GameObjectId == entry) return gate; return null; } - - /// Id of attacker team - int Attackers; - - // Totale elapsed time of current round - uint TotalTime; - // Max time of round - uint EndRoundTimer; - // For know if boats has start moving or not yet - bool ShipsStarted; - // Status of each gate (Destroy/Damage/Intact) - SAGateState[] GateStatus = new SAGateState[SAMiscConst.Gates.Length]; - // Statu of battle (Start or not, and what round) - SAStatus Status; - // Team witch conntrol each graveyard - int[] GraveyardStatus = new int[SAGraveyards.Max]; - // Score of each round - SARoundScore[] RoundScores = new SARoundScore[2]; - // used for know we are in timer phase or not (used for worldstate update) - bool TimerEnabled; - // 5secs before starting the 1min countdown for second round - uint UpdateWaitTimer; - // for know if warning about second round start has been sent - bool SignaledRoundTwo; - // for know if warning about second round start has been sent - bool SignaledRoundTwoHalfMin; - // for know if second round has been init - bool InitSecondRound; - Dictionary DemoliserRespawnList = new(); } - struct SARoundScore + struct RoundScore { public uint winner; public uint time; } - class SAGateInfo + class GateInfo { - public SAGateInfo(uint gateId, uint gameObjectId, uint worldState, uint damagedText, uint destroyedText) + public GateInfo(GameObjectIds gameObjectId, WorldStateIds worldState, TextIds damagedText, TextIds destroyedText, DefenseLine defenseLine) { - GateId = gateId; - GameObjectId = gameObjectId; - WorldState = worldState; - DamagedText = damagedText; - DestroyedText = destroyedText; + GameObjectId = (uint)gameObjectId; + WorldState = (int)worldState; + DamagedText = (uint)damagedText; + DestroyedText = (uint)destroyedText; + LineOfDefense = defenseLine; } - public uint GateId; public uint GameObjectId; - public uint WorldState; + public int WorldState; public uint DamagedText; public uint DestroyedText; + public DefenseLine LineOfDefense; } #region Consts - struct SAMiscConst + struct MiscConst { - public static uint[] NpcEntries = - { - SACreatureIds.AntiPersonnalCannon, - SACreatureIds.AntiPersonnalCannon, - SACreatureIds.AntiPersonnalCannon, - SACreatureIds.AntiPersonnalCannon, - SACreatureIds.AntiPersonnalCannon, - SACreatureIds.AntiPersonnalCannon, - SACreatureIds.AntiPersonnalCannon, - SACreatureIds.AntiPersonnalCannon, - SACreatureIds.AntiPersonnalCannon, - SACreatureIds.AntiPersonnalCannon, - // 4 beach demolishers - SACreatureIds.Demolisher, - SACreatureIds.Demolisher, - SACreatureIds.Demolisher, - SACreatureIds.Demolisher, - // 4 factory demolishers - SACreatureIds.Demolisher, - SACreatureIds.Demolisher, - SACreatureIds.Demolisher, - SACreatureIds.Demolisher, - // Used Demolisher Salesman - SACreatureIds.RiggerSparklight, - SACreatureIds.GorgrilRigspark, - // Kanrethad - SACreatureIds.Kanrethad - }; - - public static Position[] NpcSpawnlocs = - { - // Cannons - new Position(1436.429f, 110.05f, 41.407f, 5.4f), - new Position(1404.9023f, 84.758f, 41.183f, 5.46f), - new Position(1068.693f, -86.951f, 93.81f, 0.02f), - new Position(1068.83f, -127.56f, 96.45f, 0.0912f), - new Position(1422.115f, -196.433f, 42.1825f, 1.0222f), - new Position(1454.887f, -220.454f, 41.956f, 0.9627f), - new Position(1232.345f, -187.517f, 66.945f, 0.45f), - new Position(1249.634f, -224.189f, 66.72f, 0.635f), - new Position(1236.213f, 92.287f, 64.965f, 5.751f), - new Position(1215.11f, 57.772f, 64.739f, 5.78f), - // Demolishers - new Position(1611.597656f, -117.270073f, 8.719355f, 2.513274f), - new Position(1575.562500f, -158.421875f, 5.024450f, 2.129302f), - new Position(1618.047729f, 61.424641f, 7.248210f, 3.979351f), - new Position(1575.103149f, 98.873344f, 2.830360f, 3.752458f), - // Demolishers 2 - new Position(1371.055786f, -317.071136f, 35.007359f, 1.947460f), - new Position(1424.034912f, -260.195190f, 31.084425f, 2.820013f), - new Position(1353.139893f, 223.745438f, 35.265411f, 4.343684f), - new Position(1404.809570f, 197.027237f, 32.046032f, 3.605401f), - // Npcs - new Position(1348.644165f, -298.786469f, 31.080130f, 1.710423f), - new Position(1358.191040f, 195.527786f, 31.018187f, 4.171337f), - new Position(841.921f, -134.194f, 196.838f, 6.23082f) - }; - - public static Position[] ObjSpawnlocs = - { - new Position(1411.57f, 108.163f, 28.692f, 5.441f), - new Position(1055.452f, -108.1f, 82.134f, 0.034f), - new Position(1431.3413f, -219.437f, 30.893f, 0.9736f), - new Position(1227.667f, -212.555f, 55.372f, 0.5023f), - new Position(1214.681f, 81.21f, 53.413f, 5.745f), - new Position(878.555f, -108.2f, 117.845f, 0.0f), - new Position(836.5f, -108.8f, 120.219f, 0.0f), - // Portal - new Position(1468.380005f, -225.798996f, 30.896200f, 0.0f), //blue - new Position(1394.270020f, 72.551399f, 31.054300f, 0.0f), //green - new Position(1065.260010f, -89.79501f, 81.073402f, 0.0f), //yellow - new Position(1216.069946f, 47.904301f, 54.278198f, 0.0f), //purple - new Position(1255.569946f, -233.548996f, 56.43699f, 0.0f), //red - // Ships - new Position(2679.696777f, -826.891235f, 3.712860f, 5.78367f), //rot2 1 rot3 0.0002f - new Position(2574.003662f, 981.261475f, 2.603424f, 0.807696f), - // Sigils - new Position(1414.054f, 106.72f, 41.442f, 5.441f), - new Position(1060.63f, -107.8f, 94.7f, 0.034f), - new Position(1433.383f, -216.4f, 43.642f, 0.9736f), - new Position(1230.75f, -210.724f, 67.611f, 0.5023f), - new Position(1217.8f, 79.532f, 66.58f, 5.745f), - // Flagpoles - new Position(1215.114258f, -65.711861f, 70.084267f, -3.124123f), - new Position(1338.863892f, -153.336533f, 30.895121f, -2.530723f), - new Position(1309.124268f, 9.410645f, 30.893402f, -1.623156f), - // Flags - new Position(1215.108032f, -65.715767f, 70.084267f, -3.124123f), - new Position(1338.859253f, -153.327316f, 30.895077f, -2.530723f), - new Position(1309.192017f, 9.416233f, 30.893402f, 1.518436f), - // Bombs - new Position(1333.45f, 211.354f, 31.0538f, 5.03666f), - new Position(1334.29f, 209.582f, 31.0532f, 1.28088f), - new Position(1332.72f, 210.049f, 31.0532f, 1.28088f), - new Position(1334.28f, 210.78f, 31.0538f, 3.85856f), - new Position(1332.64f, 211.39f, 31.0532f, 1.29266f), - new Position(1371.41f, 194.028f, 31.5107f, 0.753095f), - new Position(1372.39f, 194.951f, 31.4679f, 0.753095f), - new Position(1371.58f, 196.942f, 30.9349f, 1.01777f), - new Position(1370.43f, 196.614f, 30.9349f, 0.957299f), - new Position(1369.46f, 196.877f, 30.9351f, 2.45348f), - new Position(1370.35f, 197.361f, 30.9349f, 1.08689f), - new Position(1369.47f, 197.941f, 30.9349f, 0.984787f), - new Position(1592.49f, 47.5969f, 7.52271f, 4.63218f), - new Position(1593.91f, 47.8036f, 7.65856f, 4.63218f), - new Position(1593.13f, 46.8106f, 7.54073f, 4.63218f), - new Position(1589.22f, 36.3616f, 7.45975f, 4.64396f), - new Position(1588.24f, 35.5842f, 7.55613f, 4.79564f), - new Position(1588.14f, 36.7611f, 7.49675f, 4.79564f), - new Position(1595.74f, 35.5278f, 7.46602f, 4.90246f), - new Position(1596, 36.6475f, 7.47991f, 4.90246f), - new Position(1597.03f, 36.2356f, 7.48631f, 4.90246f), - new Position(1597.93f, 37.1214f, 7.51725f, 4.90246f), - new Position(1598.16f, 35.888f, 7.50018f, 4.90246f), - new Position(1579.6f, -98.0917f, 8.48478f, 1.37996f), - new Position(1581.2f, -98.401f, 8.47483f, 1.37996f), - new Position(1580.38f, -98.9556f, 8.4772f, 1.38781f), - new Position(1585.68f, -104.966f, 8.88551f, 0.493246f), - new Position(1586.15f, -106.033f, 9.10616f, 0.493246f), - new Position(1584.88f, -105.394f, 8.82985f, 0.493246f), - new Position(1581.87f, -100.899f, 8.46164f, 0.929142f), - new Position(1581.48f, -99.4657f, 8.46926f, 0.929142f), - new Position(1583.2f, -91.2291f, 8.49227f, 1.40038f), - new Position(1581.94f, -91.0119f, 8.49977f, 1.40038f), - new Position(1582.33f, -91.951f, 8.49353f, 1.1844f), - new Position(1342.06f, -304.049f, 30.9532f, 5.59507f), - new Position(1340.96f, -304.536f, 30.9458f, 1.28323f), - new Position(1341.22f, -303.316f, 30.9413f, 0.486051f), - new Position(1342.22f, -302.939f, 30.986f, 4.87643f), - new Position(1382.16f, -287.466f, 32.3063f, 4.80968f), - new Position(1381, -287.58f, 32.2805f, 4.80968f), - new Position(1381.55f, -286.536f, 32.3929f, 2.84225f), - new Position(1382.75f, -286.354f, 32.4099f, 1.00442f), - new Position(1379.92f, -287.34f, 32.2872f, 3.81615f), - new Position(1100.52f, -2.41391f, 70.2984f, 0.131054f), - new Position(1099.35f, -2.13851f, 70.3375f, 4.4586f), - new Position(1099.59f, -1.00329f, 70.238f, 2.49903f), - new Position(1097.79f, 0.571316f, 70.159f, 4.00307f), - new Position(1098.74f, -7.23252f, 70.7972f, 4.1523f), - new Position(1098.46f, -5.91443f, 70.6715f, 4.1523f), - new Position(1097.53f, -7.39704f, 70.7959f, 4.1523f), - new Position(1097.32f, -6.64233f, 70.7424f, 4.1523f), - new Position(1096.45f, -5.96664f, 70.7242f, 4.1523f), - new Position(971.725f, 0.496763f, 86.8467f, 2.09233f), - new Position(973.589f, 0.119518f, 86.7985f, 3.17225f), - new Position(972.524f, 1.25333f, 86.8351f, 5.28497f), - new Position(971.993f, 2.05668f, 86.8584f, 5.28497f), - new Position(973.635f, 2.11805f, 86.8197f, 2.36722f), - new Position(974.791f, 1.74679f, 86.7942f, 1.5936f), - new Position(974.771f, 3.0445f, 86.8125f, 0.647199f), - new Position(979.554f, 3.6037f, 86.7923f, 1.69178f), - new Position(979.758f, 2.57519f, 86.7748f, 1.76639f), - new Position(980.769f, 3.48904f, 86.7939f, 1.76639f), - new Position(979.122f, 2.87109f, 86.7794f, 1.76639f), - new Position(986.167f, 4.85363f, 86.8439f, 1.5779f), - new Position(986.176f, 3.50367f, 86.8217f, 1.5779f), - new Position(987.33f, 4.67389f, 86.8486f, 1.5779f), - new Position(985.23f, 4.65898f, 86.8368f, 1.5779f), - new Position(984.556f, 3.54097f, 86.8137f, 1.5779f), - }; - - public static uint[] ObjEntries = - { - 190722, - 190727, - 190724, - 190726, - 190723, - 192549, - 192834, - 192819, - 192819, - 192819, - 192819, - 192819, - 0, // Boat - 0, // Boat - 192687, - 192685, - 192689, - 192690, - 192691, - 191311, - 191311, - 191311, - 191310, - 191306, - 191308, - 190753 - }; - public static uint[] Factions = { 1732, 1735, }; - public static uint[] GYEntries = { 1350, 1349, 1347, 1346, 1348, }; - - public static float[] GYOrientation = + public static GateInfo[] Gates = { - 6.202f, - 1.926f, // right capturable GY - 3.917f, // left capturable GY - 3.104f, // center, capturable - 6.148f, // defender last GY + new GateInfo(GameObjectIds.GateOfTheGreenEmerald, WorldStateIds.GreenGate, TextIds.GreenGateUnderAttack, TextIds.GreenGateDestroyed, DefenseLine.First), + new GateInfo(GameObjectIds.GateOfTheYellowMoon, WorldStateIds.YellowGate, TextIds.YellowGateUnderAttack, TextIds.YellowGateDestroyed, DefenseLine.Third), + new GateInfo(GameObjectIds.GateOfTheBlueSapphire, WorldStateIds.BlueGate, TextIds.BlueGateUnderAttack, TextIds.BlueGateDestroyed, DefenseLine.First), + new GateInfo(GameObjectIds.GateOfTheRedSun, WorldStateIds.RedGate, TextIds.RedGateUnderAttack, TextIds.RedGateDestroyed, DefenseLine.Second), + new GateInfo(GameObjectIds.GateOfThePurpleAmethyst, WorldStateIds.PurpleGate, TextIds.PurpleGateUnderAttack, TextIds.PurpleGateDestroyed, DefenseLine.Second), + new GateInfo(GameObjectIds.ChamberOfAncientRelics, WorldStateIds.AncientGate, TextIds.AncientGateUnderAttack, TextIds.AncientGateDestroyed, DefenseLine.Last) }; - public static SAGateInfo[] Gates = + public const uint PvPStatGatesDestroyed = 231; + public const uint PvpStatDemolishersDestroyed = 232; + + public const uint EventHordeAssaultStarted = 21702; + public const uint EventAllianceAssaultStarted = 23748; + public const uint EventTitanRelicActivated = 20572; + + public const uint SpawnDefenders = 1399; + + public const uint DataAttackers = 1; + public const uint DataStatus = 2; + + public const uint BoatStartTimer = 60 * Time.InMilliseconds; + public const uint WarmuplengthTimer = 120 * Time.InMilliseconds; + public const uint RoundlengthTimer = 600 * Time.InMilliseconds; + + public static Position[] spawnPositionOnTransport = { - new SAGateInfo(SAObjectTypes.GreenGate, SAGameObjectIds.GateOfTheGreenEmerald, SAWorldStateIds.GreenGate, SATextIds.GreenGateUnderAttack, SATextIds.GreenGateDestroyed), - new SAGateInfo(SAObjectTypes.YellowGate, SAGameObjectIds.GateOfTheYellowMoon, SAWorldStateIds.YellowGate, SATextIds.YellowGateUnderAttack, SATextIds.YellowGateDestroyed), - new SAGateInfo(SAObjectTypes.BlueGate, SAGameObjectIds.GateOfTheBlueSapphire, SAWorldStateIds.BlueGate, SATextIds.BlueGateUnderAttack, SATextIds.BlueGateDestroyed), - new SAGateInfo(SAObjectTypes.RedGate, SAGameObjectIds.GateOfTheRedSun, SAWorldStateIds.RedGate, SATextIds.RedGateUnderAttack, SATextIds.RedGateDestroyed), - new SAGateInfo(SAObjectTypes.PurpleGate, SAGameObjectIds.GateOfThePurpleAmethyst, SAWorldStateIds.PurpleGate, SATextIds.PurpleGateUnderAttack, SATextIds.PurpleGateDestroyed), - new SAGateInfo(SAObjectTypes.AncientGate, SAGameObjectIds.ChamberOfAncientRelics, SAWorldStateIds.AncientGate, SATextIds.AncientGateUnderAttack, SATextIds.AncientGateDestroyed) + new Position(0.0f, 5.0f, 9.6f, 3.14f), + new Position(-6.0f, -3.0f, 8.6f, 0.0f) }; } - struct SABroadcastTexts - { - public const uint AllianceCapturedTitanPortal = 28944; - public const uint HordeCapturedTitanPortal = 28945; - - public const uint RoundTwoStartOneMinute = 29448; - public const uint RoundTwoStartHalfMinute = 29449; - } - enum SAStatus { NotStarted = 0, @@ -1316,231 +904,174 @@ namespace Game.BattleGrounds.Zones BonusRound } - enum SAGateState + enum GateState { - // alliance is defender + // Alliance Is Defender AllianceGateOk = 1, AllianceGateDamaged = 2, AllianceGateDestroyed = 3, - // horde is defender + // Horde Is Defender HordeGateOk = 4, HordeGateDamaged = 5, HordeGateDestroyed = 6, } - enum SAEventIds + enum GameObjectIds { - BG_SA_EVENT_BLUE_GATE_DAMAGED = 19040, - BG_SA_EVENT_BLUE_GATE_DESTROYED = 19045, + SeaforiumBombH = 194086, // Used By Horde Players + SeaforiumBombA = 190753, // Used By Alliance Players + SeaforiumChargeH = 257572, + SeaforiumChargeA = 257565, - BG_SA_EVENT_GREEN_GATE_DAMAGED = 19041, - BG_SA_EVENT_GREEN_GATE_DESTROYED = 19046, + GraveyardWestH = 191307, + GraveyardWestA = 191308, - BG_SA_EVENT_RED_GATE_DAMAGED = 19042, - BG_SA_EVENT_RED_GATE_DESTROYED = 19047, + GraveyardEastH = 191305, + GraveyardEastA = 191306, - BG_SA_EVENT_PURPLE_GATE_DAMAGED = 19043, - BG_SA_EVENT_PURPLE_GATE_DESTROYED = 19048, + GraveyardCentralH = 191309, + GraveyardCentralA = 191310, - BG_SA_EVENT_YELLOW_GATE_DAMAGED = 19044, - BG_SA_EVENT_YELLOW_GATE_DESTROYED = 19049, + CollisionDoor = 194162, + TitanRelicA = 194083, + TitanRelicH = 194082, - BG_SA_EVENT_ANCIENT_GATE_DAMAGED = 19836, - BG_SA_EVENT_ANCIENT_GATE_DESTROYED = 19837, + GateOfTheGreenEmerald = 190722, + GateOfThePurpleAmethyst = 190723, + GateOfTheBlueSapphire = 190724, + GateOfTheRedSun = 190726, + GateOfTheYellowMoon = 190727, + ChamberOfAncientRelics = 192549, - BG_SA_EVENT_TITAN_RELIC_ACTIVATED = 22097 + BoatOneA = 208000, + BoatTwoH = 208001, + BoatOneH = 193184, + BoatTwoA = 193185 } - struct SASpellIds + enum SoundIds { - public const uint TeleportDefender = 52364; - public const uint TeleportAttackers = 60178; - public const uint EndOfRound = 52459; - public const uint RemoveSeaforium = 59077; - public const uint AllianceControlPhaseShift = 60027; - public const uint HordeControlPhaseShift = 60028; + GraveyardTakenHorde = 8174, + GraveyardTakenAlliance = 8212, + DefeatHorde = 15905, + VictoryHorde = 15906, + VictoryAlliance = 15907, + DefeatAlliance = 15908, + WallDestroyedAlliance = 15909, + WallDestroyedHorde = 15910, + WallAttackedHorde = 15911, + WallAttackedAlliance = 15912 } - struct SACreatureIds - { - public const uint Kanrethad = 29; - public const uint InvisibleStalker = 15214; - public const uint WorldTrigger = 22515; - public const uint WorldTriggerLargeAoiNotImmunePcNpc = 23472; - - public const uint AntiPersonnalCannon = 27894; - public const uint Demolisher = 28781; - public const uint RiggerSparklight = 29260; - public const uint GorgrilRigspark = 29262; - } - - struct SAGameObjectIds - { - public const uint GateOfTheGreenEmerald = 190722; - public const uint GateOfThePurpleAmethyst = 190723; - public const uint GateOfTheBlueSapphire = 190724; - public const uint GateOfTheRedSun = 190726; - public const uint GateOfTheYellowMoon = 190727; - public const uint ChamberOfAncientRelics = 192549; - - public const uint BoatOneA = 208000; - public const uint BoatTwoA = 193185; - public const uint BoatOneH = 193184; - public const uint BoatTwoH = 208001; - } - - struct SATimers - { - public const uint BoatStart = 60 * Time.InMilliseconds; - public const uint WarmupLength = 120 * Time.InMilliseconds; - public const uint RoundLength = 600 * Time.InMilliseconds; - } - - struct SASoundIds - { - public const uint GraveyardTakenHorde = 8174; - public const uint GraveyardTakenAlliance = 8212; - public const uint DefeatHorde = 15905; - public const uint VictoryHorde = 15906; - public const uint VictoryAlliance = 15907; - public const uint DefeatAlliance = 15908; - public const uint WallDestroyedAlliance = 15909; - public const uint WallDestroyedHorde = 15910; - public const uint WallAttackedHorde = 15911; - public const uint WallAttackedAlliance = 15912; - } - - struct SATextIds + enum TextIds { // Kanrethad - public const byte RoundStarted = 1; - public const byte Round1Finished = 2; + RoundStarted = 1, + Round1Finished = 2, // Rigger Sparklight / Gorgril Rigspark - public const byte SparklightRigsparkSpawn = 1; + SparklightRigsparkSpawn = 1, // World Trigger - public const byte BlueGateUnderAttack = 1; - public const byte GreenGateUnderAttack = 2; - public const byte RedGateUnderAttack = 3; - public const byte PurpleGateUnderAttack = 4; - public const byte YellowGateUnderAttack = 5; - public const byte YellowGateDestroyed = 6; - public const byte PurpleGateDestroyed = 7; - public const byte RedGateDestroyed = 8; - public const byte GreenGateDestroyed = 9; - public const byte BlueGateDestroyed = 10; - public const byte EastGraveyardCapturedA = 11; - public const byte WestGraveyardCapturedA = 12; - public const byte SouthGraveyardCapturedA = 13; - public const byte EastGraveyardCapturedH = 14; - public const byte WestGraveyardCapturedH = 15; - public const byte SouthGraveyardCapturedH = 16; - public const byte AncientGateUnderAttack = 17; - public const byte AncientGateDestroyed = 18; + BlueGateUnderAttack = 1, + GreenGateUnderAttack = 2, + RedGateUnderAttack = 3, + PurpleGateUnderAttack = 4, + YellowGateUnderAttack = 5, + YellowGateDestroyed = 6, + PurpleGateDestroyed = 7, + RedGateDestroyed = 8, + GreenGateDestroyed = 9, + BlueGateDestroyed = 10, + EastGraveyardCapturedA = 11, + WestGraveyardCapturedA = 12, + SouthGraveyardCapturedA = 13, + EastGraveyardCapturedH = 14, + WestGraveyardCapturedH = 15, + SouthGraveyardCapturedH = 16, + AncientGateUnderAttack = 17, + AncientGateDestroyed = 18 } - struct SAWorldStateIds + enum WorldStateIds { - public const uint Timer = 3557; - public const uint AllyAttacks = 4352; - public const uint HordeAttacks = 4353; - public const uint PurpleGate = 3614; - public const uint RedGate = 3617; - public const uint BlueGate = 3620; - public const uint GreenGate = 3623; - public const uint YellowGate = 3638; - public const uint AncientGate = 3849; - public const uint LeftGyAlliance = 3635; - public const uint RightGyAlliance = 3636; - public const uint CenterGyAlliance = 3637; - public const uint RightAttTokenAll = 3627; - public const uint LeftAttTokenAll = 3626; - public const uint LeftAttTokenHrd = 3629; - public const uint RightAttTokenHrd = 3628; - public const uint HordeDefenceToken = 3631; - public const uint AllianceDefenceToken = 3630; - public const uint RightGyHorde = 3632; - public const uint LeftGyHorde = 3633; - public const uint CenterGyHorde = 3634; - public const uint BonusTimer = 3571; - public const uint EnableTimer = 3564; - public const uint AttackerTeam = 3690; - public const uint DestroyedAllianceVehicles = 3955; - public const uint DestroyedHordeVehicles = 3956; + Timer = 3557, + AllyAttacks = 4352, + HordeAttacks = 4353, + PurpleGate = 3614, + RedGate = 3617, + BlueGate = 3620, + GreenGate = 3623, + YellowGate = 3638, + AncientGate = 3849, + + LeftGyAlliance = 3635, + RightGyAlliance = 3636, + CenterGyAlliance = 3637, + + RightAttTokenAll = 3627, + LeftAttTokenAll = 3626, + LeftAttTokenHrd = 3629, + RightAttTokenHrd = 3628, + HordeDefenceToken = 3631, + AllianceDefenceToken = 3630, + + RightGyHorde = 3632, + LeftGyHorde = 3633, + CenterGyHorde = 3634, + + BonusTimer = 3571, + + EnableTimer = 3564, + AttackerTeam = 3690, + DestroyedAllianceVehicles = 3955, + DestroyedHordeVehicles = 3956, } - struct SACreatureTypes + enum StrandOfTheAncientsGraveyard { - public const int Gun1 = 0; - public const int Gun2 = 1; - public const int Gun3 = 2; - public const int Gun4 = 3; - public const int Gun5 = 4; - public const int Gun6 = 5; - public const int Gun7 = 6; - public const int Gun8 = 7; - public const int Gun9 = 8; - public const int Gun10 = 9; - public const int Demolisher1 = 10; - public const int Demolisher2 = 11; - public const int Demolisher3 = 12; - public const int Demolisher4 = 13; - public const int Demolisher5 = 14; - public const int Demolisher6 = 15; - public const int Demolisher7 = 16; - public const int Demolisher8 = 17; - public const int Sparklight = 18; - public const int Rigspark = 19; - public const int Kanrethad = 20; - public const int Max = 21; + West, + East, + Central } - struct SAObjectTypes + enum BroadcastTextIds { - public const int GreenGate = 0; - public const int YellowGate = 1; - public const int BlueGate = 2; - public const int RedGate = 3; - public const int PurpleGate = 4; - public const int AncientGate = 5; - public const int TitanRelic = 6; - public const int PortalDeffenderBlue = 7; - public const int PortalDeffenderGreen = 8; - public const int PortalDeffenderYellow = 9; - public const int PortalDeffenderPurple = 10; - public const int PortalDeffenderRed = 11; - public const int BoatOne = 12; - public const int BoatTwo = 13; - public const int Sigil1 = 14; - public const int Sigil2 = 15; - public const int Sigil3 = 16; - public const int Sigil4 = 17; - public const int Sigil5 = 18; - public const int CentralFlagpole = 19; - public const int RightFlagpole = 20; - public const int LeftFlagpole = 21; - public const int CentralFlag = 22; - public const int RightFlag = 23; - public const int LeftFlag = 24; - public const int Bomb = 25; - public const int MaxObj = Bomb + 68; + AllianceCapturedTitanPortal = 28944, + HordeCapturedTitanPortal = 28945, + + RoundTwoStartOneMinute = 29448, + RoundTwoStartHalfMinute = 29449 } - struct SAGraveyards + enum DefenseLine { - public const int BeachGy = 0; - public const int DefenderLastGy = 1; - public const int RightCapturableGy = 2; - public const int LeftCapturableGy = 3; - public const int CentralCapturableGy = 4; - public const int Max = 5; + First, + Second, + Third, + Last } - enum StrandOfTheAncientsPvpStats + enum CreatureIds { - GatesDestroyed = 231, - DemolishersDestroyed = 232 + Kanrethad = 29, + Demolisher = 28781, + AntipersonnelCannon = 27894, + RiggerSparklight = 29260, + GorgrilRigspark = 29262, + WorldTrigger = 22515, + DemolisherSa = 28781 + } + + enum SpellIds + { + TeleportDefender = 52364, + TeleportAttackers = 60178, + EndOfRound = 52459, + RemoveSeaforium = 59077, + AllianceControlPhaseShift = 60027, + HordeControlPhaseShift = 60028, + CarryingSeaforiumCharge = 52415 } #endregion } diff --git a/Source/Game/BattleGrounds/Zones/WarsongGluch.cs b/Source/Game/BattleGrounds/Zones/WarsongGluch.cs index bf3b9ec29..009681ce3 100644 --- a/Source/Game/BattleGrounds/Zones/WarsongGluch.cs +++ b/Source/Game/BattleGrounds/Zones/WarsongGluch.cs @@ -41,18 +41,18 @@ namespace Game.BattleGrounds.Zones.WarsongGluch { if (GetElapsedTime() >= 17 * Time.Minute * Time.InMilliseconds) { - if (GetTeamScore(BatttleGroundTeamId.Alliance) == 0) + if (GetTeamScore(BattleGroundTeamId.Alliance) == 0) { - if (GetTeamScore(BatttleGroundTeamId.Horde) == 0) // No one scored - result is tie + if (GetTeamScore(BattleGroundTeamId.Horde) == 0) // No one scored - result is tie EndBattleground(Team.Other); else // Horde has more points and thus wins EndBattleground(Team.Horde); } - else if (GetTeamScore(BatttleGroundTeamId.Horde) == 0) + else if (GetTeamScore(BattleGroundTeamId.Horde) == 0) EndBattleground(Team.Alliance); // Alliance has > 0, Horde has 0, alliance wins - else if (GetTeamScore(BatttleGroundTeamId.Horde) == GetTeamScore(BatttleGroundTeamId.Alliance)) // Team score equal, winner is team that scored the last flag + else if (GetTeamScore(BattleGroundTeamId.Horde) == GetTeamScore(BattleGroundTeamId.Alliance)) // Team score equal, winner is team that scored the last flag EndBattleground((Team)_lastFlagCaptureTeam); - else if (GetTeamScore(BatttleGroundTeamId.Horde) > GetTeamScore(BatttleGroundTeamId.Alliance)) // Last but not least, check who has the higher score + else if (GetTeamScore(BattleGroundTeamId.Horde) > GetTeamScore(BattleGroundTeamId.Alliance)) // Last but not least, check who has the higher score EndBattleground(Team.Horde); else EndBattleground(Team.Alliance); @@ -205,7 +205,7 @@ namespace Game.BattleGrounds.Zones.WarsongGluch void UpdateTeamScore(int team) { - if (team == BatttleGroundTeamId.Alliance) + if (team == BattleGroundTeamId.Alliance) UpdateWorldState((int)WorldStateIds.FlagCapturesAlliance, (int)GetTeamScore(team)); else UpdateWorldState((int)WorldStateIds.FlagCapturesHorde, (int)GetTeamScore(team)); @@ -221,8 +221,8 @@ namespace Game.BattleGrounds.Zones.WarsongGluch //call parent's class reset base.Reset(); - m_TeamScores[BatttleGroundTeamId.Alliance] = 0; - m_TeamScores[BatttleGroundTeamId.Horde] = 0; + m_TeamScores[BattleGroundTeamId.Alliance] = 0; + m_TeamScores[BattleGroundTeamId.Horde] = 0; if (Global.BattlegroundMgr.IsBGWeekend(GetTypeID())) { @@ -284,9 +284,9 @@ namespace Game.BattleGrounds.Zones.WarsongGluch public override Team GetPrematureWinner() { - if (GetTeamScore(BatttleGroundTeamId.Alliance) > GetTeamScore(BatttleGroundTeamId.Horde)) + if (GetTeamScore(BattleGroundTeamId.Alliance) > GetTeamScore(BattleGroundTeamId.Horde)) return Team.Alliance; - else if (GetTeamScore(BatttleGroundTeamId.Horde) > GetTeamScore(BatttleGroundTeamId.Alliance)) + else if (GetTeamScore(BattleGroundTeamId.Horde) > GetTeamScore(BattleGroundTeamId.Alliance)) return Team.Horde; return base.GetPrematureWinner(); @@ -305,10 +305,10 @@ namespace Game.BattleGrounds.Zones.WarsongGluch _doors.Add(gameObject.GetGUID()); break; case GameobjectIds.AllianceFlagInBase: - _flags[BatttleGroundTeamId.Alliance] = gameObject.GetGUID(); + _flags[BattleGroundTeamId.Alliance] = gameObject.GetGUID(); break; case GameobjectIds.HordeFlagInBase: - _flags[BatttleGroundTeamId.Horde] = gameObject.GetGUID(); + _flags[BattleGroundTeamId.Horde] = gameObject.GetGUID(); break; default: break; @@ -323,10 +323,10 @@ namespace Game.BattleGrounds.Zones.WarsongGluch switch (areaTrigger.GetEntry()) { case MiscConst.AtCapturePointAlliance: - _capturePointAreaTriggers[BatttleGroundTeamId.Alliance] = areaTrigger.GetGUID(); + _capturePointAreaTriggers[BattleGroundTeamId.Alliance] = areaTrigger.GetGUID(); break; case MiscConst.AtCapturePointHorde: - _capturePointAreaTriggers[BatttleGroundTeamId.Horde] = areaTrigger.GetGUID(); + _capturePointAreaTriggers[BattleGroundTeamId.Horde] = areaTrigger.GetGUID(); break; default: break; diff --git a/Source/Game/Chat/Commands/DebugCommands.cs b/Source/Game/Chat/Commands/DebugCommands.cs index 9b1680ef6..63c9ef459 100644 --- a/Source/Game/Chat/Commands/DebugCommands.cs +++ b/Source/Game/Chat/Commands/DebugCommands.cs @@ -811,13 +811,13 @@ namespace Game.Chat switch (command) { case "alliance": - Global.WorldMgr.SetForcedWarModeFactionBalanceState(BatttleGroundTeamId.Alliance, rewardValue.GetValueOrDefault(0)); + Global.WorldMgr.SetForcedWarModeFactionBalanceState(BattleGroundTeamId.Alliance, rewardValue.GetValueOrDefault(0)); break; case "horde": - Global.WorldMgr.SetForcedWarModeFactionBalanceState(BatttleGroundTeamId.Horde, rewardValue.GetValueOrDefault(0)); + Global.WorldMgr.SetForcedWarModeFactionBalanceState(BattleGroundTeamId.Horde, rewardValue.GetValueOrDefault(0)); break; case "neutral": - Global.WorldMgr.SetForcedWarModeFactionBalanceState(BatttleGroundTeamId.Neutral); + Global.WorldMgr.SetForcedWarModeFactionBalanceState(BattleGroundTeamId.Neutral); break; case "off": Global.WorldMgr.DisableForcedWarModeFactionBalanceState(); @@ -1300,13 +1300,13 @@ namespace Game.Chat handler.SendSysMessage(CypherStrings.BadValue); return false; case "alliance": - Global.WorldMgr.SetForcedWarModeFactionBalanceState(BatttleGroundTeamId.Alliance, rewardValue); + Global.WorldMgr.SetForcedWarModeFactionBalanceState(BattleGroundTeamId.Alliance, rewardValue); break; case "horde": - Global.WorldMgr.SetForcedWarModeFactionBalanceState(BatttleGroundTeamId.Horde, rewardValue); + Global.WorldMgr.SetForcedWarModeFactionBalanceState(BattleGroundTeamId.Horde, rewardValue); break; case "neutral": - Global.WorldMgr.SetForcedWarModeFactionBalanceState(BatttleGroundTeamId.Neutral); + Global.WorldMgr.SetForcedWarModeFactionBalanceState(BattleGroundTeamId.Neutral); break; case "off": Global.WorldMgr.DisableForcedWarModeFactionBalanceState(); diff --git a/Source/Game/Entities/GameObject/GameObject.cs b/Source/Game/Entities/GameObject/GameObject.cs index 6a80d0b3e..93a08f193 100644 --- a/Source/Game/Entities/GameObject/GameObject.cs +++ b/Source/Game/Entities/GameObject/GameObject.cs @@ -342,7 +342,7 @@ namespace Game.Entities case GameObjectTypes.CapturePoint: SetUpdateFieldValue(m_values.ModifyValue(m_gameObjectData).ModifyValue(m_gameObjectData.SpellVisualID), m_goInfo.CapturePoint.SpellVisual1); m_goValue.CapturePoint.AssaultTimer = 0; - m_goValue.CapturePoint.LastTeamCapture = BatttleGroundTeamId.Neutral; + m_goValue.CapturePoint.LastTeamCapture = BattleGroundTeamId.Neutral; m_goValue.CapturePoint.State = BattlegroundCapturePointState.Neutral; UpdateCapturePoint(); if (map.Instanceable()) @@ -679,7 +679,7 @@ namespace Game.Entities } } - m_goValue.CapturePoint.LastTeamCapture = hordeCapturing ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance; + m_goValue.CapturePoint.LastTeamCapture = hordeCapturing ? BattleGroundTeamId.Horde : BattleGroundTeamId.Alliance; UpdateCapturePoint(); } else @@ -3462,7 +3462,7 @@ namespace Game.Entities if (player.GetBGTeam() == Team.Horde) { - if (m_goValue.CapturePoint.LastTeamCapture == BatttleGroundTeamId.Horde) + if (m_goValue.CapturePoint.LastTeamCapture == BattleGroundTeamId.Horde) { // defended. capture instantly. m_goValue.CapturePoint.State = BattlegroundCapturePointState.HordeCaptured; @@ -3491,7 +3491,7 @@ namespace Game.Entities } else { - if (m_goValue.CapturePoint.LastTeamCapture == BatttleGroundTeamId.Alliance) + if (m_goValue.CapturePoint.LastTeamCapture == BattleGroundTeamId.Alliance) { // defended. capture instantly. m_goValue.CapturePoint.State = BattlegroundCapturePointState.AllianceCaptured; @@ -4549,12 +4549,12 @@ namespace Game.Entities int GetControllingTeam() { if (_value < GetMaxHordeValue()) - return BatttleGroundTeamId.Horde; + return BattleGroundTeamId.Horde; if (_value > GetMinAllianceValue()) - return BatttleGroundTeamId.Alliance; + return BattleGroundTeamId.Alliance; - return BatttleGroundTeamId.Neutral; + return BattleGroundTeamId.Neutral; } public List GetInsidePlayers() { return _insidePlayers; } @@ -4601,31 +4601,31 @@ namespace Game.Entities return; int newControllingTeam = GetControllingTeam(); - int assaultingTeam = pointsGained > 0 ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde; + int assaultingTeam = pointsGained > 0 ? BattleGroundTeamId.Alliance : BattleGroundTeamId.Horde; if (oldControllingTeam != newControllingTeam) _contestedTriggered = false; - if (oldControllingTeam != BatttleGroundTeamId.Alliance && newControllingTeam == BatttleGroundTeamId.Alliance) + if (oldControllingTeam != BattleGroundTeamId.Alliance && newControllingTeam == BattleGroundTeamId.Alliance) TriggerEvent(_owner.GetGoInfo().ControlZone.ProgressEventAlliance); - else if (oldControllingTeam != BatttleGroundTeamId.Horde && newControllingTeam == BatttleGroundTeamId.Horde) + else if (oldControllingTeam != BattleGroundTeamId.Horde && newControllingTeam == BattleGroundTeamId.Horde) TriggerEvent(_owner.GetGoInfo().ControlZone.ProgressEventHorde); - else if (oldControllingTeam == BatttleGroundTeamId.Horde && newControllingTeam == BatttleGroundTeamId.Neutral) + else if (oldControllingTeam == BattleGroundTeamId.Horde && newControllingTeam == BattleGroundTeamId.Neutral) TriggerEvent(_owner.GetGoInfo().ControlZone.NeutralEventHorde); - else if (oldControllingTeam == BatttleGroundTeamId.Alliance && newControllingTeam == BatttleGroundTeamId.Neutral) + else if (oldControllingTeam == BattleGroundTeamId.Alliance && newControllingTeam == BattleGroundTeamId.Neutral) TriggerEvent(_owner.GetGoInfo().ControlZone.NeutralEventAlliance); - if (roundedValue == 100 && newControllingTeam == BatttleGroundTeamId.Alliance && assaultingTeam == BatttleGroundTeamId.Alliance) + if (roundedValue == 100 && newControllingTeam == BattleGroundTeamId.Alliance && assaultingTeam == BattleGroundTeamId.Alliance) TriggerEvent(_owner.GetGoInfo().ControlZone.CaptureEventAlliance); - else if (roundedValue == 0 && newControllingTeam == BatttleGroundTeamId.Horde && assaultingTeam == BatttleGroundTeamId.Horde) + else if (roundedValue == 0 && newControllingTeam == BattleGroundTeamId.Horde && assaultingTeam == BattleGroundTeamId.Horde) TriggerEvent(_owner.GetGoInfo().ControlZone.CaptureEventHorde); - if (oldRoundedValue == 100 && assaultingTeam == BatttleGroundTeamId.Horde && !_contestedTriggered) + if (oldRoundedValue == 100 && assaultingTeam == BattleGroundTeamId.Horde && !_contestedTriggered) { TriggerEvent(_owner.GetGoInfo().ControlZone.ContestedEventHorde); _contestedTriggered = true; } - else if (oldRoundedValue == 0 && assaultingTeam == BatttleGroundTeamId.Alliance && !_contestedTriggered) + else if (oldRoundedValue == 0 && assaultingTeam == BattleGroundTeamId.Alliance && !_contestedTriggered) { TriggerEvent(_owner.GetGoInfo().ControlZone.ContestedEventAlliance); _contestedTriggered = true; diff --git a/Source/Game/Entities/Player/Player.cs b/Source/Game/Entities/Player/Player.cs index b71493071..748241e23 100644 --- a/Source/Game/Entities/Player/Player.cs +++ b/Source/Game/Entities/Player/Player.cs @@ -5149,13 +5149,13 @@ namespace Game.Entities return (uint)rEntry.Alliance; Log.outError(LogFilter.Player, "Race ({0}) not found in DBC: wrong DBC files?", race); - return BatttleGroundTeamId.Neutral; + return BattleGroundTeamId.Neutral; } public Team GetTeam() { return m_team; } - public int GetTeamId() { return m_team == Team.Alliance ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde; } + public int GetTeamId() { return m_team == Team.Alliance ? BattleGroundTeamId.Alliance : BattleGroundTeamId.Horde; } public Team GetEffectiveTeam() { return HasPlayerFlagEx(PlayerFlagsEx.MercenaryMode) ? (GetTeam() == Team.Alliance ? Team.Horde : Team.Alliance) : GetTeam(); } - public int GetEffectiveTeamId() { return GetEffectiveTeam() == Team.Alliance ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde; } + public int GetEffectiveTeamId() { return GetEffectiveTeam() == Team.Alliance ? BattleGroundTeamId.Alliance : BattleGroundTeamId.Horde; } //Money public ulong GetMoney() { return m_activePlayerData.Coinage; } diff --git a/Source/Game/Handlers/CharacterHandler.cs b/Source/Game/Handlers/CharacterHandler.cs index f23d34f75..ad071b030 100644 --- a/Source/Game/Handlers/CharacterHandler.cs +++ b/Source/Game/Handlers/CharacterHandler.cs @@ -278,13 +278,13 @@ namespace Game uint team = Player.TeamIdForRace(charCreate.CreateInfo.RaceId); switch (team) { - case BatttleGroundTeamId.Alliance: + case BattleGroundTeamId.Alliance: disabled = Convert.ToBoolean(mask & (1 << 0)); break; - case BatttleGroundTeamId.Horde: + case BattleGroundTeamId.Horde: disabled = Convert.ToBoolean(mask & (1 << 1)); break; - case BatttleGroundTeamId.Neutral: + case BattleGroundTeamId.Neutral: disabled = Convert.ToBoolean(mask & (1 << 2)); break; } @@ -1771,7 +1771,7 @@ namespace Game } uint newTeamId = Player.TeamIdForRace(factionChangeInfo.RaceID); - if (newTeamId == BatttleGroundTeamId.Neutral) + if (newTeamId == BattleGroundTeamId.Neutral) { SendCharFactionChange(ResponseCodes.CharCreateRestrictedRaceclass, factionChangeInfo); return; @@ -1890,7 +1890,7 @@ namespace Game stmt.AddValue(0, lowGuid); // Faction specific languages - if (newTeamId == BatttleGroundTeamId.Horde) + if (newTeamId == BattleGroundTeamId.Horde) stmt.AddValue(1, 109); else stmt.AddValue(1, 98); @@ -1979,7 +1979,7 @@ namespace Game string taximaskstream = ""; - var factionMask = newTeamId == BatttleGroundTeamId.Horde ? CliDB.HordeTaxiNodesMask : CliDB.AllianceTaxiNodesMask; + var factionMask = newTeamId == BattleGroundTeamId.Horde ? CliDB.HordeTaxiNodesMask : CliDB.AllianceTaxiNodesMask; for (int i = 0; i < factionMask.Length; ++i) { // i = (315 - 1) / 8 = 39 @@ -2033,7 +2033,7 @@ namespace Game WorldLocation loc; ushort zoneId = 0; - if (newTeamId == BatttleGroundTeamId.Alliance) + if (newTeamId == BattleGroundTeamId.Alliance) { loc = new WorldLocation(0, -8867.68f, 673.373f, 97.9034f, 0.0f); zoneId = 1519; @@ -2060,19 +2060,19 @@ namespace Game uint achiev_horde = it.Value; stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT); - stmt.AddValue(0, (ushort)(newTeamId == BatttleGroundTeamId.Alliance ? achiev_alliance : achiev_horde)); + stmt.AddValue(0, (ushort)(newTeamId == BattleGroundTeamId.Alliance ? achiev_alliance : achiev_horde)); stmt.AddValue(1, lowGuid); trans.Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_ACHIEVEMENT); - stmt.AddValue(0, (ushort)(newTeamId == BatttleGroundTeamId.Alliance ? achiev_alliance : achiev_horde)); - stmt.AddValue(1, (ushort)(newTeamId == BatttleGroundTeamId.Alliance ? achiev_horde : achiev_alliance)); + stmt.AddValue(0, (ushort)(newTeamId == BattleGroundTeamId.Alliance ? achiev_alliance : achiev_horde)); + stmt.AddValue(1, (ushort)(newTeamId == BattleGroundTeamId.Alliance ? achiev_horde : achiev_alliance)); stmt.AddValue(2, lowGuid); trans.Append(stmt); } // Item conversion - var itemConversionMap = newTeamId == BatttleGroundTeamId.Alliance ? Global.ObjectMgr.FactionChangeItemsHordeToAlliance : Global.ObjectMgr.FactionChangeItemsAllianceToHorde; + var itemConversionMap = newTeamId == BattleGroundTeamId.Alliance ? Global.ObjectMgr.FactionChangeItemsHordeToAlliance : Global.ObjectMgr.FactionChangeItemsAllianceToHorde; foreach (var it in itemConversionMap) { uint oldItemId = it.Key; @@ -2098,12 +2098,12 @@ namespace Game stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST); stmt.AddValue(0, lowGuid); - stmt.AddValue(1, (newTeamId == BatttleGroundTeamId.Alliance ? quest_alliance : quest_horde)); + stmt.AddValue(1, (newTeamId == BattleGroundTeamId.Alliance ? quest_alliance : quest_horde)); trans.Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_QUESTSTATUS_REWARDED_FACTION_CHANGE); - stmt.AddValue(0, (newTeamId == BatttleGroundTeamId.Alliance ? quest_alliance : quest_horde)); - stmt.AddValue(1, (newTeamId == BatttleGroundTeamId.Alliance ? quest_horde : quest_alliance)); + stmt.AddValue(0, (newTeamId == BattleGroundTeamId.Alliance ? quest_alliance : quest_horde)); + stmt.AddValue(1, (newTeamId == BattleGroundTeamId.Alliance ? quest_horde : quest_alliance)); stmt.AddValue(2, lowGuid); trans.Append(stmt); } @@ -2118,7 +2118,7 @@ namespace Game var questTemplates = Global.ObjectMgr.GetQuestTemplates(); foreach (Quest quest in questTemplates.Values) { - RaceMask newRaceMask = newTeamId == BatttleGroundTeamId.Alliance ? RaceMask.Alliance : RaceMask.Horde; + RaceMask newRaceMask = newTeamId == BattleGroundTeamId.Alliance ? RaceMask.Alliance : RaceMask.Horde; if (quest.AllowableRaces.RawValue != unchecked((ulong)-1) && (quest.AllowableRaces & newRaceMask).IsEmpty()) { stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE_BY_QUEST); @@ -2136,13 +2136,13 @@ namespace Game uint spell_horde = it.Value; stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_SPELL_BY_SPELL); - stmt.AddValue(0, (newTeamId == BatttleGroundTeamId.Alliance ? spell_alliance : spell_horde)); + stmt.AddValue(0, (newTeamId == BattleGroundTeamId.Alliance ? spell_alliance : spell_horde)); stmt.AddValue(1, lowGuid); trans.Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_SPELL_FACTION_CHANGE); - stmt.AddValue(0, (newTeamId == BatttleGroundTeamId.Alliance ? spell_alliance : spell_horde)); - stmt.AddValue(1, (newTeamId == BatttleGroundTeamId.Alliance ? spell_horde : spell_alliance)); + stmt.AddValue(0, (newTeamId == BattleGroundTeamId.Alliance ? spell_alliance : spell_horde)); + stmt.AddValue(1, (newTeamId == BattleGroundTeamId.Alliance ? spell_horde : spell_alliance)); stmt.AddValue(2, lowGuid); trans.Append(stmt); } @@ -2152,8 +2152,8 @@ namespace Game { uint reputation_alliance = it.Key; uint reputation_horde = it.Value; - uint newReputation = (newTeamId == BatttleGroundTeamId.Alliance) ? reputation_alliance : reputation_horde; - uint oldReputation = (newTeamId == BatttleGroundTeamId.Alliance) ? reputation_horde : reputation_alliance; + uint newReputation = (newTeamId == BattleGroundTeamId.Alliance) ? reputation_alliance : reputation_horde; + uint oldReputation = (newTeamId == BattleGroundTeamId.Alliance) ? reputation_horde : reputation_alliance; // select old standing set in db stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_REP_BY_FACTION); @@ -2210,7 +2210,7 @@ namespace Game CharTitlesRecord atitleInfo = CliDB.CharTitlesStorage.LookupByKey(title_alliance); CharTitlesRecord htitleInfo = CliDB.CharTitlesStorage.LookupByKey(title_horde); // new team - if (newTeamId == BatttleGroundTeamId.Alliance) + if (newTeamId == BattleGroundTeamId.Alliance) { uint maskID = htitleInfo.MaskID; int index = (int)maskID / 32; diff --git a/Source/Game/Maps/Instances/InstanceScript.cs b/Source/Game/Maps/Instances/InstanceScript.cs index c84d392eb..762c434ad 100644 --- a/Source/Game/Maps/Instances/InstanceScript.cs +++ b/Source/Game/Maps/Instances/InstanceScript.cs @@ -216,8 +216,8 @@ namespace Game.Maps if (((1 << (int)GetBossState(info.BossStateId)) & info.BossStates) == 0) continue; - if (((instance.GetTeamIdInInstance() == BatttleGroundTeamId.Alliance) && info.Flags.HasFlag(InstanceSpawnGroupFlags.HordeOnly)) - || ((instance.GetTeamIdInInstance() == BatttleGroundTeamId.Horde) && info.Flags.HasFlag(InstanceSpawnGroupFlags.AllianceOnly))) + if (((instance.GetTeamIdInInstance() == BattleGroundTeamId.Alliance) && info.Flags.HasFlag(InstanceSpawnGroupFlags.HordeOnly)) + || ((instance.GetTeamIdInInstance() == BattleGroundTeamId.Horde) && info.Flags.HasFlag(InstanceSpawnGroupFlags.AllianceOnly))) continue; if (info.Flags.HasAnyFlag(InstanceSpawnGroupFlags.BlockSpawn)) diff --git a/Source/Game/Maps/Map.cs b/Source/Game/Maps/Map.cs index ee955015b..67f92239b 100644 --- a/Source/Game/Maps/Map.cs +++ b/Source/Game/Maps/Map.cs @@ -4801,8 +4801,8 @@ namespace Game.Maps // this make sure it gets unloaded if for some reason no player joins m_unloadTimer = (uint)Math.Max(WorldConfig.GetIntValue(WorldCfg.InstanceUnloadDelay), 1); - Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceAlliance, instanceTeam == BatttleGroundTeamId.Alliance ? 1 : 0, false, this); - Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceHorde, instanceTeam == BatttleGroundTeamId.Horde ? 1 : 0, false, this); + Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceAlliance, instanceTeam == BattleGroundTeamId.Alliance ? 1 : 0, false, this); + Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceHorde, instanceTeam == BattleGroundTeamId.Horde ? 1 : 0, false, this); if (i_instanceLock != null) { @@ -5181,13 +5181,13 @@ namespace Game.Maps public int GetTeamIdInInstance() { if (Global.WorldStateMgr.GetValue(WorldStates.TeamInInstanceAlliance, this) != 0) - return BatttleGroundTeamId.Alliance; + return BattleGroundTeamId.Alliance; if (Global.WorldStateMgr.GetValue(WorldStates.TeamInInstanceHorde, this) != 0) - return BatttleGroundTeamId.Horde; - return BatttleGroundTeamId.Neutral; + return BattleGroundTeamId.Horde; + return BattleGroundTeamId.Neutral; } - public Team GetTeamInInstance() { return GetTeamIdInInstance() == BatttleGroundTeamId.Alliance ? Team.Alliance : Team.Horde; } + public Team GetTeamInInstance() { return GetTeamIdInInstance() == BattleGroundTeamId.Alliance ? Team.Alliance : Team.Horde; } public uint GetScriptId() { diff --git a/Source/Game/Maps/MapManager.cs b/Source/Game/Maps/MapManager.cs index 84f24704f..63d66e90b 100644 --- a/Source/Game/Maps/MapManager.cs +++ b/Source/Game/Maps/MapManager.cs @@ -502,8 +502,8 @@ namespace Game.Entities public override void OnCreate(Map map) { - Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceAlliance, map.GetInstanceId() == BatttleGroundTeamId.Alliance ? 1 : 0, false, map); - Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceHorde, map.GetInstanceId() == BatttleGroundTeamId.Horde ? 1 : 0, false, map); + Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceAlliance, map.GetInstanceId() == BattleGroundTeamId.Alliance ? 1 : 0, false, map); + Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceHorde, map.GetInstanceId() == BattleGroundTeamId.Horde ? 1 : 0, false, map); } } } diff --git a/Source/Game/OutdoorPVP/OutdoorPvP.cs b/Source/Game/OutdoorPVP/OutdoorPvP.cs index 21e47df1c..c12706095 100644 --- a/Source/Game/OutdoorPVP/OutdoorPvP.cs +++ b/Source/Game/OutdoorPVP/OutdoorPvP.cs @@ -160,7 +160,7 @@ namespace Game.PvP public void TeamApplyBuff(uint teamIndex, uint spellId, uint spellId2) { TeamCastSpell(teamIndex, (int)spellId); - TeamCastSpell((uint)(teamIndex == BatttleGroundTeamId.Alliance ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance), spellId2 != 0 ? -(int)spellId2 : -(int)spellId); + TeamCastSpell((uint)(teamIndex == BattleGroundTeamId.Alliance ? BattleGroundTeamId.Horde : BattleGroundTeamId.Alliance), spellId2 != 0 ? -(int)spellId2 : -(int)spellId); } public void SendDefenseMessage(uint zoneId, uint id) @@ -254,7 +254,7 @@ namespace Game.PvP public OPvPCapturePoint(OutdoorPvP pvp) { - m_team = BatttleGroundTeamId.Neutral; + m_team = BattleGroundTeamId.Neutral; OldState = ObjectiveStates.Neutral; State = ObjectiveStates.Neutral; PvP = pvp; diff --git a/Source/Game/OutdoorPVP/Zones/HellfirePeninsulaPvP.cs b/Source/Game/OutdoorPVP/Zones/HellfirePeninsulaPvP.cs index eb502ddaf..89ebe0500 100644 --- a/Source/Game/OutdoorPVP/Zones/HellfirePeninsulaPvP.cs +++ b/Source/Game/OutdoorPVP/Zones/HellfirePeninsulaPvP.cs @@ -121,13 +121,13 @@ namespace Game.PvP.HellfirePeninsula base.Update(diff); if (m_AllianceTowersControlled == 3) - TeamApplyBuff(BatttleGroundTeamId.Alliance, SpellIds.AllianceBuff, SpellIds.HordeBuff); + TeamApplyBuff(BattleGroundTeamId.Alliance, SpellIds.AllianceBuff, SpellIds.HordeBuff); else if (m_HordeTowersControlled == 3) - TeamApplyBuff(BatttleGroundTeamId.Horde, SpellIds.HordeBuff, SpellIds.AllianceBuff); + TeamApplyBuff(BattleGroundTeamId.Horde, SpellIds.HordeBuff, SpellIds.AllianceBuff); else { - TeamCastSpell(BatttleGroundTeamId.Alliance, -(int)SpellIds.AllianceBuff); - TeamCastSpell(BatttleGroundTeamId.Horde, -(int)SpellIds.HordeBuff); + TeamCastSpell(BattleGroundTeamId.Alliance, -(int)SpellIds.AllianceBuff); + TeamCastSpell(BattleGroundTeamId.Horde, -(int)SpellIds.HordeBuff); } SetWorldState(WorldStateIds.CountA, (int)m_AllianceTowersControlled); diff --git a/Source/Game/Scenarios/ScenarioManager.cs b/Source/Game/Scenarios/ScenarioManager.cs index a0e292c1d..85faf7acc 100644 --- a/Source/Game/Scenarios/ScenarioManager.cs +++ b/Source/Game/Scenarios/ScenarioManager.cs @@ -24,10 +24,10 @@ namespace Game.Scenarios uint scenarioID = 0; switch (team) { - case BatttleGroundTeamId.Alliance: + case BattleGroundTeamId.Alliance: scenarioID = dbData.Scenario_A; break; - case BatttleGroundTeamId.Horde: + case BattleGroundTeamId.Horde: scenarioID = dbData.Scenario_H; break; default: diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index 5612b139a..036423477 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -2631,7 +2631,7 @@ namespace Game.Spells { Battleground bg = player.GetBattleground(); if (bg != null) - bg.SetDroppedFlagGUID(go.GetGUID(), bg.GetPlayerTeam(player.GetGUID()) == Team.Alliance ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance); + bg.SetDroppedFlagGUID(go.GetGUID(), bg.GetPlayerTeam(player.GetGUID()) == Team.Alliance ? BattleGroundTeamId.Horde : BattleGroundTeamId.Alliance); } } diff --git a/Source/Game/Spells/SpellManager.cs b/Source/Game/Spells/SpellManager.cs index 3145026ea..7a0ba70c5 100644 --- a/Source/Game/Spells/SpellManager.cs +++ b/Source/Game/Spells/SpellManager.cs @@ -5044,9 +5044,9 @@ namespace Game.Entities // team that controls the workshop in the specified area uint team = bf.GetData(newArea); - if (team == BatttleGroundTeamId.Horde) + if (team == BattleGroundTeamId.Horde) return spellId == 56618; - else if (team == BatttleGroundTeamId.Alliance) + else if (team == BattleGroundTeamId.Alliance) return spellId == 56617; break; } diff --git a/Source/Game/World/WorldManager.cs b/Source/Game/World/WorldManager.cs index 8d84a6dbe..d6884f8ec 100644 --- a/Source/Game/World/WorldManager.cs +++ b/Source/Game/World/WorldManager.cs @@ -1265,8 +1265,8 @@ namespace Game public void SetForcedWarModeFactionBalanceState(int team, int reward = 0) { - Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.WarModeHordeBuffValue, 10 + (team == BatttleGroundTeamId.Alliance ? reward : 0), false, null); - Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.WarModeAllianceBuffValue, 10 + (team == BatttleGroundTeamId.Horde ? reward : 0), false, null); + Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.WarModeHordeBuffValue, 10 + (team == BattleGroundTeamId.Alliance ? reward : 0), false, null); + Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.WarModeAllianceBuffValue, 10 + (team == BattleGroundTeamId.Horde ? reward : 0), false, null); } public void DisableForcedWarModeFactionBalanceState() @@ -2477,9 +2477,9 @@ namespace Game if (raceFaction != null) { if ((raceFaction.FactionGroup & (byte)FactionMasks.Alliance) != 0) - warModeEnabledFaction[BatttleGroundTeamId.Alliance] += result.Read(1); + warModeEnabledFaction[BattleGroundTeamId.Alliance] += result.Read(1); else if ((raceFaction.FactionGroup & (byte)FactionMasks.Horde) != 0) - warModeEnabledFaction[BatttleGroundTeamId.Horde] += result.Read(1); + warModeEnabledFaction[BattleGroundTeamId.Horde] += result.Read(1); } } @@ -2487,19 +2487,19 @@ namespace Game } - int dominantFaction = BatttleGroundTeamId.Alliance; + int dominantFaction = BattleGroundTeamId.Alliance; int outnumberedFactionReward = 0; if (warModeEnabledFaction.Any(val => val != 0)) { - long dominantFactionCount = warModeEnabledFaction[BatttleGroundTeamId.Alliance]; - if (warModeEnabledFaction[BatttleGroundTeamId.Alliance] < warModeEnabledFaction[BatttleGroundTeamId.Horde]) + long dominantFactionCount = warModeEnabledFaction[BattleGroundTeamId.Alliance]; + if (warModeEnabledFaction[BattleGroundTeamId.Alliance] < warModeEnabledFaction[BattleGroundTeamId.Horde]) { - dominantFactionCount = warModeEnabledFaction[BatttleGroundTeamId.Horde]; - dominantFaction = BatttleGroundTeamId.Horde; + dominantFactionCount = warModeEnabledFaction[BattleGroundTeamId.Horde]; + dominantFaction = BattleGroundTeamId.Horde; } - double total = warModeEnabledFaction[BatttleGroundTeamId.Alliance] + warModeEnabledFaction[BatttleGroundTeamId.Horde]; + double total = warModeEnabledFaction[BattleGroundTeamId.Alliance] + warModeEnabledFaction[BattleGroundTeamId.Horde]; double pct = dominantFactionCount / total; if (pct >= WorldConfig.GetFloatValue(WorldCfg.CallToArms20Pct)) @@ -2510,8 +2510,8 @@ namespace Game outnumberedFactionReward = 5; } - Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.WarModeHordeBuffValue, 10 + (dominantFaction == BatttleGroundTeamId.Alliance ? outnumberedFactionReward : 0), false, null); - Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.WarModeAllianceBuffValue, 10 + (dominantFaction == BatttleGroundTeamId.Horde ? outnumberedFactionReward : 0), false, null); + Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.WarModeHordeBuffValue, 10 + (dominantFaction == BattleGroundTeamId.Alliance ? outnumberedFactionReward : 0), false, null); + Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.WarModeAllianceBuffValue, 10 + (dominantFaction == BattleGroundTeamId.Horde ? outnumberedFactionReward : 0), false, null); } public uint GetVirtualRealmAddress() diff --git a/Source/Scripts/Spells/Generic.cs b/Source/Scripts/Spells/Generic.cs index 3d35250c4..0b08e99f4 100644 --- a/Source/Scripts/Spells/Generic.cs +++ b/Source/Scripts/Spells/Generic.cs @@ -4469,10 +4469,10 @@ namespace Scripts.Spells.Generic switch (target.GetTeamId()) { - case BatttleGroundTeamId.Alliance: + case BattleGroundTeamId.Alliance: amount = WorldStateMgr.GetValue(WorldStates.WarModeAllianceBuffValue, target.GetMap()); break; - case BatttleGroundTeamId.Horde: + case BattleGroundTeamId.Horde: amount = WorldStateMgr.GetValue(WorldStates.WarModeHordeBuffValue, target.GetMap()); break; default: