Core/Battlegrounds: Clean up some Team/TeamId parameters to use enums instead of raw integer types
Port From (https://github.com/TrinityCore/TrinityCore/commit/1ef0c045202a6af33fb991f2ff765fa183ce976f)
This commit is contained in:
@@ -108,7 +108,7 @@ namespace Game.BattleGrounds
|
||||
{
|
||||
if (GetElapsedTime() >= 47 * Time.Minute * Time.InMilliseconds)
|
||||
{
|
||||
EndBattleground(0);
|
||||
EndBattleground(Team.Other);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -212,7 +212,7 @@ namespace Game.BattleGrounds
|
||||
|
||||
public virtual Team GetPrematureWinner()
|
||||
{
|
||||
Team winner = 0;
|
||||
Team winner = Team.Other;
|
||||
if (GetPlayersCountByTeam(Team.Alliance) >= GetMinPlayersPerTeam())
|
||||
winner = Team.Alliance;
|
||||
else if (GetPlayersCountByTeam(Team.Horde) >= GetMinPlayersPerTeam())
|
||||
@@ -447,15 +447,15 @@ namespace Game.BattleGrounds
|
||||
return _GetPlayer(pair.Key, pair.Value.OfflineRemoveTime != 0, context);
|
||||
}
|
||||
|
||||
Player _GetPlayerForTeam(Team teamId, KeyValuePair<ObjectGuid, BattlegroundPlayer> pair, string context)
|
||||
Player _GetPlayerForTeam(Team team, KeyValuePair<ObjectGuid, BattlegroundPlayer> pair, string context)
|
||||
{
|
||||
Player player = _GetPlayer(pair, context);
|
||||
if (player != null)
|
||||
{
|
||||
Team team = pair.Value.Team;
|
||||
if (team == 0)
|
||||
team = player.GetEffectiveTeam();
|
||||
if (team != teamId)
|
||||
Team playerTeam = pair.Value.Team;
|
||||
if (playerTeam == 0)
|
||||
playerTeam = player.GetEffectiveTeam();
|
||||
if (playerTeam != team)
|
||||
player = null;
|
||||
}
|
||||
return player;
|
||||
@@ -469,7 +469,7 @@ namespace Game.BattleGrounds
|
||||
|
||||
public WorldSafeLocsEntry GetTeamStartPosition(int teamId)
|
||||
{
|
||||
Cypher.Assert(teamId < TeamId.Neutral);
|
||||
Cypher.Assert(teamId < BatttleGroundTeamId.Neutral);
|
||||
return _battlegroundTemplate.StartLocation[teamId];
|
||||
}
|
||||
|
||||
@@ -539,7 +539,7 @@ namespace Game.BattleGrounds
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveAuraOnTeam(uint SpellID, Team team)
|
||||
public void RemoveAuraOnTeam(uint SpellID, Team team)
|
||||
{
|
||||
foreach (var pair in m_Players)
|
||||
{
|
||||
@@ -874,7 +874,7 @@ namespace Game.BattleGrounds
|
||||
// Do next only if found in Battleground
|
||||
player.SetBattlegroundId(0, BattlegroundTypeId.None); // We're not in BG.
|
||||
// reset destination bg team
|
||||
player.SetBGTeam(0);
|
||||
player.SetBGTeam(Team.Other);
|
||||
|
||||
// remove all criterias on bg leave
|
||||
player.FailCriteria(CriteriaFailEvent.LeaveBattleground, 0);
|
||||
@@ -923,7 +923,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[TeamId.Alliance], m_ArenaTeamIds[TeamId.Horde]);
|
||||
Log.outDebug(LogFilter.Arena, "Arena match type: {0} for Team1Id: {1} - Team2Id: {2} started.", m_ArenaType, m_ArenaTeamIds[BatttleGroundTeamId.Alliance], m_ArenaTeamIds[BatttleGroundTeamId.Horde]);
|
||||
}
|
||||
|
||||
public void TeleportPlayerToExploitLocation(Player player)
|
||||
@@ -1149,11 +1149,11 @@ namespace Game.BattleGrounds
|
||||
|
||||
// get the number of free slots for team
|
||||
// returns the number how many players can join Battleground to MaxPlayersPerTeam
|
||||
public uint GetFreeSlotsForTeam(Team Team)
|
||||
public uint GetFreeSlotsForTeam(Team team)
|
||||
{
|
||||
// if BG is starting and WorldCfg.BattlegroundInvitationType == BattlegroundQueueInvitationTypeB.NoBalance, invite anyone
|
||||
if (GetStatus() == BattlegroundStatus.WaitJoin && WorldConfig.GetIntValue(WorldCfg.BattlegroundInvitationType) == (int)BattlegroundQueueInvitationType.NoBalance)
|
||||
return (GetInvitedCount(Team) < GetMaxPlayersPerTeam()) ? GetMaxPlayersPerTeam() - GetInvitedCount(Team) : 0;
|
||||
return (GetInvitedCount(team) < GetMaxPlayersPerTeam()) ? GetMaxPlayersPerTeam() - GetInvitedCount(team) : 0;
|
||||
|
||||
// if BG is already started or WorldCfg.BattlegroundInvitationType != BattlegroundQueueInvitationType.NoBalance, do not allow to join too much players of one faction
|
||||
uint otherTeamInvitedCount;
|
||||
@@ -1161,7 +1161,7 @@ namespace Game.BattleGrounds
|
||||
uint otherTeamPlayersCount;
|
||||
uint thisTeamPlayersCount;
|
||||
|
||||
if (Team == Team.Alliance)
|
||||
if (team == Team.Alliance)
|
||||
{
|
||||
thisTeamInvitedCount = GetInvitedCount(Team.Alliance);
|
||||
otherTeamInvitedCount = GetInvitedCount(Team.Horde);
|
||||
@@ -1420,7 +1420,7 @@ namespace Game.BattleGrounds
|
||||
}
|
||||
}
|
||||
|
||||
public virtual Creature AddCreature(uint entry, uint type, float x, float y, float z, float o, int teamIndex = TeamId.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 = BatttleGroundTeamId.Neutral, uint respawntime = 0, Transport transport = null)
|
||||
{
|
||||
Map map = FindBgMap();
|
||||
if (map == null)
|
||||
@@ -1467,7 +1467,7 @@ namespace Game.BattleGrounds
|
||||
return creature;
|
||||
}
|
||||
|
||||
public Creature AddCreature(uint entry, uint type, Position pos, int teamIndex = TeamId.Neutral, uint respawntime = 0, Transport transport = null)
|
||||
public Creature AddCreature(uint entry, uint type, Position pos, int teamIndex = BatttleGroundTeamId.Neutral, uint respawntime = 0, Transport transport = null)
|
||||
{
|
||||
return AddCreature(entry, type, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teamIndex, respawntime, transport);
|
||||
}
|
||||
@@ -1526,7 +1526,7 @@ namespace Game.BattleGrounds
|
||||
|
||||
public bool AddSpiritGuide(uint type, float x, float y, float z, float o, int teamIndex)
|
||||
{
|
||||
uint entry = (uint)(teamIndex == TeamId.Alliance ? BattlegroundCreatures.A_SpiritGuide : BattlegroundCreatures.H_SpiritGuide);
|
||||
uint entry = (uint)(teamIndex == BatttleGroundTeamId.Alliance ? BattlegroundCreatures.A_SpiritGuide : BattlegroundCreatures.H_SpiritGuide);
|
||||
|
||||
if (AddCreature(entry, type, x, y, z, o) != null)
|
||||
return true;
|
||||
@@ -1536,7 +1536,7 @@ namespace Game.BattleGrounds
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool AddSpiritGuide(uint type, Position pos, int teamIndex = TeamId.Neutral)
|
||||
public bool AddSpiritGuide(uint type, Position pos, int teamIndex = BatttleGroundTeamId.Neutral)
|
||||
{
|
||||
return AddSpiritGuide(type, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teamIndex);
|
||||
}
|
||||
@@ -1623,20 +1623,12 @@ namespace Game.BattleGrounds
|
||||
var player = m_Players.LookupByKey(guid);
|
||||
if (player != null)
|
||||
return player.Team;
|
||||
return 0;
|
||||
return Team.Other;
|
||||
}
|
||||
|
||||
public Team GetOtherTeam(Team teamId)
|
||||
public Team GetOtherTeam(Team team)
|
||||
{
|
||||
switch (teamId)
|
||||
{
|
||||
case Team.Alliance:
|
||||
return Team.Horde;
|
||||
case Team.Horde:
|
||||
return Team.Alliance;
|
||||
default:
|
||||
return Team.Other;
|
||||
}
|
||||
return team != 0 ? ((team == Team.Alliance) ? Team.Horde : Team.Alliance) : Team.Other;
|
||||
}
|
||||
|
||||
public bool IsPlayerInBattleground(ObjectGuid guid)
|
||||
@@ -1665,12 +1657,12 @@ namespace Game.BattleGrounds
|
||||
player.SendPacket(pvpMatchStatistics);
|
||||
}
|
||||
|
||||
public uint GetAlivePlayersCountByTeam(Team Team)
|
||||
public uint GetAlivePlayersCountByTeam(Team team)
|
||||
{
|
||||
uint count = 0;
|
||||
foreach (var pair in m_Players)
|
||||
{
|
||||
if (pair.Value.Team == Team)
|
||||
if (pair.Value.Team == team)
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(pair.Key);
|
||||
if (player != null && player.IsAlive())
|
||||
@@ -1680,7 +1672,7 @@ namespace Game.BattleGrounds
|
||||
return count;
|
||||
}
|
||||
|
||||
int GetObjectType(ObjectGuid guid)
|
||||
public int GetObjectType(ObjectGuid guid)
|
||||
{
|
||||
for (int i = 0; i < BgObjects.Length; ++i)
|
||||
if (BgObjects[i] == guid)
|
||||
@@ -1689,7 +1681,7 @@ namespace Game.BattleGrounds
|
||||
return -1;
|
||||
}
|
||||
|
||||
void SetBgRaid(Team team, Group bg_raid)
|
||||
public void SetBgRaid(Team team, Group bg_raid)
|
||||
{
|
||||
Group old_raid = m_BgRaids[GetTeamIndexByTeamId(team)];
|
||||
if (old_raid != null)
|
||||
@@ -1729,7 +1721,7 @@ namespace Game.BattleGrounds
|
||||
|
||||
public uint GetTeamScore(int teamIndex)
|
||||
{
|
||||
if (teamIndex == TeamId.Alliance || teamIndex == TeamId.Horde)
|
||||
if (teamIndex == BatttleGroundTeamId.Alliance || teamIndex == BatttleGroundTeamId.Horde)
|
||||
return m_TeamScores[teamIndex];
|
||||
|
||||
Log.outError(LogFilter.Battleground, "GetTeamScore with wrong Team {0} for BG {1}", teamIndex, GetTypeID());
|
||||
@@ -1879,7 +1871,7 @@ namespace Game.BattleGrounds
|
||||
|
||||
Group GetBgRaid(Team team) { return m_BgRaids[GetTeamIndexByTeamId(team)]; }
|
||||
|
||||
public static int GetTeamIndexByTeamId(Team team) { return team == Team.Alliance ? TeamId.Alliance : TeamId.Horde; }
|
||||
public static int GetTeamIndexByTeamId(Team team) { return team == Team.Alliance ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde; }
|
||||
public uint GetPlayersCountByTeam(Team team) { return m_PlayersCount[GetTeamIndexByTeamId(team)]; }
|
||||
void UpdatePlayersCountByTeam(Team team, bool remove)
|
||||
{
|
||||
|
||||
@@ -145,7 +145,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 ? TeamId.Horde : TeamId.Alliance);
|
||||
battlefieldStatus.ArenaFaction = (byte)(player.GetBGTeam() == Team.Horde ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance);
|
||||
battlefieldStatus.LeftEarly = false;
|
||||
battlefieldStatus.StartTimer = bg.GetElapsedTime();
|
||||
battlefieldStatus.Mapid = bg.GetMapId();
|
||||
@@ -350,8 +350,8 @@ namespace Game.BattleGrounds
|
||||
uint startId = result.Read<uint>(1);
|
||||
WorldSafeLocsEntry start = Global.ObjectMgr.GetWorldSafeLoc(startId);
|
||||
if (start != null)
|
||||
bgTemplate.StartLocation[TeamId.Alliance] = start;
|
||||
else if (bgTemplate.StartLocation[TeamId.Alliance] != null) // reload case
|
||||
bgTemplate.StartLocation[BatttleGroundTeamId.Alliance] = start;
|
||||
else if (bgTemplate.StartLocation[BatttleGroundTeamId.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
|
||||
{
|
||||
@@ -362,8 +362,8 @@ namespace Game.BattleGrounds
|
||||
startId = result.Read<uint>(2);
|
||||
start = Global.ObjectMgr.GetWorldSafeLoc(startId);
|
||||
if (start != null)
|
||||
bgTemplate.StartLocation[TeamId.Horde] = start;
|
||||
else if (bgTemplate.StartLocation[TeamId.Horde] != null) // reload case
|
||||
bgTemplate.StartLocation[BatttleGroundTeamId.Horde] = start;
|
||||
else if (bgTemplate.StartLocation[BatttleGroundTeamId.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
|
||||
{
|
||||
|
||||
@@ -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 = TeamId.Alliance; //default set to TeamIndex.Alliance - or non rated arenas!
|
||||
uint team_index = BatttleGroundTeamId.Alliance; //default set to TeamIndex.Alliance - or non rated arenas!
|
||||
if (m_queueId.TeamSize == 0)
|
||||
{
|
||||
if (ginfo.Team == Team.Horde)
|
||||
team_index = TeamId.Horde;
|
||||
team_index = BatttleGroundTeamId.Horde;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_queueId.Rated)
|
||||
team_index = TeamId.Horde; //for rated arenas use TeamIndex.Horde
|
||||
team_index = BatttleGroundTeamId.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 = TeamId.Alliance; //default set to TeamIndex.Alliance - or non rated arenas!
|
||||
uint team_index = BatttleGroundTeamId.Alliance; //default set to TeamIndex.Alliance - or non rated arenas!
|
||||
if (m_queueId.TeamSize == 0)
|
||||
{
|
||||
if (ginfo.Team == Team.Horde)
|
||||
team_index = TeamId.Horde;
|
||||
team_index = BatttleGroundTeamId.Horde;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_queueId.Rated)
|
||||
team_index = TeamId.Horde; //for rated arenas use TeamIndex.Horde
|
||||
team_index = BatttleGroundTeamId.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[TeamId.Alliance].AddGroup(info, aliFree); alyIndex++)
|
||||
for (; alyIndex < aliCount && m_SelectionPools[BatttleGroundTeamId.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[TeamId.Horde].AddGroup(info, hordeFree); hordeIndex++)
|
||||
for (; hordeIndex < hordeCount && m_SelectionPools[BatttleGroundTeamId.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[TeamId.Alliance].GetPlayerCount());
|
||||
int diffHorde = (int)(hordeFree - m_SelectionPools[TeamId.Horde].GetPlayerCount());
|
||||
while (Math.Abs(diffAli - diffHorde) > 1 && (m_SelectionPools[TeamId.Horde].GetPlayerCount() > 0 || m_SelectionPools[TeamId.Alliance].GetPlayerCount() > 0))
|
||||
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))
|
||||
{
|
||||
//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[TeamId.Alliance].KickGroup((uint)(diffHorde - diffAli)))
|
||||
if (m_SelectionPools[BatttleGroundTeamId.Alliance].KickGroup((uint)(diffHorde - diffAli)))
|
||||
{
|
||||
for (; alyIndex < aliCount && m_SelectionPools[TeamId.Alliance].AddGroup(m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalAlliance][alyIndex], (uint)((aliFree >= diffHorde) ? aliFree - diffHorde : 0)); alyIndex++)
|
||||
for (; alyIndex < aliCount && m_SelectionPools[BatttleGroundTeamId.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[TeamId.Alliance].GetPlayerCount() == 0)
|
||||
if (m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount() == 0)
|
||||
{
|
||||
if (aliFree <= diffHorde + 1)
|
||||
break;
|
||||
m_SelectionPools[TeamId.Horde].KickGroup((uint)(diffHorde - diffAli));
|
||||
m_SelectionPools[BatttleGroundTeamId.Horde].KickGroup((uint)(diffHorde - diffAli));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//kick horde group, add to pool new group if needed
|
||||
if (m_SelectionPools[TeamId.Horde].KickGroup((uint)(diffAli - diffHorde)))
|
||||
if (m_SelectionPools[BatttleGroundTeamId.Horde].KickGroup((uint)(diffAli - diffHorde)))
|
||||
{
|
||||
for (; hordeIndex < hordeCount && m_SelectionPools[TeamId.Horde].AddGroup(m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalHorde][hordeIndex], (uint)((hordeFree >= diffAli) ? hordeFree - diffAli : 0)); hordeIndex++)
|
||||
for (; hordeIndex < hordeCount && m_SelectionPools[BatttleGroundTeamId.Horde].AddGroup(m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalHorde][hordeIndex], (uint)((hordeFree >= diffAli) ? hordeFree - diffAli : 0)); hordeIndex++)
|
||||
++hordeIndex;
|
||||
}
|
||||
if (m_SelectionPools[TeamId.Horde].GetPlayerCount() == 0)
|
||||
if (m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() == 0)
|
||||
{
|
||||
if (hordeFree <= diffAli + 1)
|
||||
break;
|
||||
m_SelectionPools[TeamId.Alliance].KickGroup((uint)(diffAli - diffHorde));
|
||||
m_SelectionPools[BatttleGroundTeamId.Alliance].KickGroup((uint)(diffAli - diffHorde));
|
||||
}
|
||||
}
|
||||
//count diffs after small update
|
||||
diffAli = (int)(aliFree - m_SelectionPools[TeamId.Alliance].GetPlayerCount());
|
||||
diffHorde = (int)(hordeFree - m_SelectionPools[TeamId.Horde].GetPlayerCount());
|
||||
diffAli = (int)(aliFree - m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount());
|
||||
diffHorde = (int)(hordeFree - m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -547,10 +547,10 @@ namespace Game.BattleGrounds
|
||||
|
||||
if (ali_group != null && horde_group != null)
|
||||
{
|
||||
m_SelectionPools[TeamId.Alliance].AddGroup(ali_group, MaxPlayersPerTeam);
|
||||
m_SelectionPools[TeamId.Horde].AddGroup(horde_group, MaxPlayersPerTeam);
|
||||
m_SelectionPools[BatttleGroundTeamId.Alliance].AddGroup(ali_group, MaxPlayersPerTeam);
|
||||
m_SelectionPools[BatttleGroundTeamId.Horde].AddGroup(horde_group, MaxPlayersPerTeam);
|
||||
//add groups/players from normal queue to size of bigger group
|
||||
uint maxPlayers = Math.Min(m_SelectionPools[TeamId.Alliance].GetPlayerCount(), m_SelectionPools[TeamId.Horde].GetPlayerCount());
|
||||
uint maxPlayers = Math.Min(m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount(), m_SelectionPools[BatttleGroundTeamId.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 = TeamId.Alliance;
|
||||
if (m_SelectionPools[TeamId.Horde].GetPlayerCount() < m_SelectionPools[TeamId.Alliance].GetPlayerCount())
|
||||
j = TeamId.Horde;
|
||||
uint j = BatttleGroundTeamId.Alliance;
|
||||
if (m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() < m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount())
|
||||
j = BatttleGroundTeamId.Horde;
|
||||
|
||||
if (WorldConfig.GetIntValue(WorldCfg.BattlegroundInvitationType) != (int)BattlegroundQueueInvitationType.NoBalance
|
||||
&& m_SelectionPools[TeamId.Horde].GetPlayerCount() >= minPlayers && m_SelectionPools[TeamId.Alliance].GetPlayerCount() >= minPlayers)
|
||||
&& m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() >= minPlayers && m_SelectionPools[BatttleGroundTeamId.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[TeamId.Horde].GetPlayerCount() - m_SelectionPools[TeamId.Alliance].GetPlayerCount())) > 2)
|
||||
if (Math.Abs((m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() - m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount())) > 2)
|
||||
return false;
|
||||
}
|
||||
//allow 1v0 if debug bg
|
||||
if (Global.BattlegroundMgr.IsTesting() && (m_SelectionPools[TeamId.Alliance].GetPlayerCount() != 0 || m_SelectionPools[TeamId.Horde].GetPlayerCount() != 0))
|
||||
if (Global.BattlegroundMgr.IsTesting() && (m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount() != 0 || m_SelectionPools[BatttleGroundTeamId.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[TeamId.Alliance].GetPlayerCount() >= minPlayers && m_SelectionPools[TeamId.Horde].GetPlayerCount() >= minPlayers;
|
||||
return m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount() >= minPlayers && m_SelectionPools[BatttleGroundTeamId.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[TeamId.Alliance].GetPlayerCount() < minPlayersPerTeam && m_SelectionPools[TeamId.Horde].GetPlayerCount() < minPlayersPerTeam)
|
||||
if (m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount() < minPlayersPerTeam && m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() < minPlayersPerTeam)
|
||||
return false;
|
||||
|
||||
uint teamIndex = TeamId.Alliance;
|
||||
uint otherTeam = TeamId.Horde;
|
||||
uint teamIndex = BatttleGroundTeamId.Alliance;
|
||||
uint otherTeam = BatttleGroundTeamId.Horde;
|
||||
Team otherTeamId = Team.Horde;
|
||||
if (m_SelectionPools[TeamId.Horde].GetPlayerCount() == minPlayersPerTeam)
|
||||
if (m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() == minPlayersPerTeam)
|
||||
{
|
||||
teamIndex = TeamId.Horde;
|
||||
otherTeam = TeamId.Alliance;
|
||||
teamIndex = BatttleGroundTeamId.Horde;
|
||||
otherTeam = BatttleGroundTeamId.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[TeamId.Alliance].Init();
|
||||
m_SelectionPools[TeamId.Horde].Init();
|
||||
m_SelectionPools[BatttleGroundTeamId.Alliance].Init();
|
||||
m_SelectionPools[BatttleGroundTeamId.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[TeamId.Alliance].SelectedGroups)
|
||||
foreach (var queueInfo in m_SelectionPools[BatttleGroundTeamId.Alliance].SelectedGroups)
|
||||
InviteGroupToBG(queueInfo, bg, queueInfo.Team);
|
||||
|
||||
foreach (var queueInfo in m_SelectionPools[TeamId.Horde].SelectedGroups)
|
||||
foreach (var queueInfo in m_SelectionPools[BatttleGroundTeamId.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[TeamId.Alliance].Init();
|
||||
m_SelectionPools[TeamId.Horde].Init();
|
||||
m_SelectionPools[BatttleGroundTeamId.Alliance].Init();
|
||||
m_SelectionPools[BatttleGroundTeamId.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[TeamId.Alliance + i].SelectedGroups)
|
||||
foreach (var queueInfo in m_SelectionPools[BatttleGroundTeamId.Alliance + i].SelectedGroups)
|
||||
InviteGroupToBG(queueInfo, bg2, queueInfo.Team);
|
||||
|
||||
bg2.StartBattleground();
|
||||
//clear structures
|
||||
m_SelectionPools[TeamId.Alliance].Init();
|
||||
m_SelectionPools[TeamId.Horde].Init();
|
||||
m_SelectionPools[BatttleGroundTeamId.Alliance].Init();
|
||||
m_SelectionPools[BatttleGroundTeamId.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[TeamId.Alliance + i].SelectedGroups)
|
||||
foreach (var queueInfo in m_SelectionPools[BatttleGroundTeamId.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[TeamId.Alliance];
|
||||
GroupQueueInfo hTeam = queueArray[TeamId.Horde];
|
||||
GroupQueueInfo aTeam = queueArray[BatttleGroundTeamId.Alliance];
|
||||
GroupQueueInfo hTeam = queueArray[BatttleGroundTeamId.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[TeamId.Alliance]);
|
||||
m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueuePremadeHorde].Remove(queueArray[BatttleGroundTeamId.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[TeamId.Horde]);
|
||||
m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueuePremadeAlliance].Remove(queueArray[BatttleGroundTeamId.Horde]);
|
||||
}
|
||||
|
||||
arena.SetArenaMatchmakerRating(Team.Alliance, aTeam.ArenaMatchmakerRating);
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace Game.BattleGrounds.Zones
|
||||
// create new occupied banner
|
||||
_CreateBanner(node, ABNodeStatus.Occupied, teamIndex, true);
|
||||
_SendNodeUpdate(node);
|
||||
_NodeOccupied(node, (teamIndex == TeamId.Alliance) ? Team.Alliance : Team.Horde);
|
||||
_NodeOccupied(node, (teamIndex == BatttleGroundTeamId.Alliance) ? Team.Alliance : Team.Horde);
|
||||
// Message to chatlog
|
||||
|
||||
if (teamIndex == 0)
|
||||
@@ -114,7 +114,7 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
if (m_ReputationScoreTics[team] >= m_ReputationTics)
|
||||
{
|
||||
if (team == TeamId.Alliance)
|
||||
if (team == BatttleGroundTeamId.Alliance)
|
||||
RewardReputationToTeam(509, 10, Team.Alliance);
|
||||
else
|
||||
RewardReputationToTeam(510, 10, Team.Horde);
|
||||
@@ -124,13 +124,13 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
if (m_HonorScoreTics[team] >= m_HonorTics)
|
||||
{
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), (team == TeamId.Alliance) ? Team.Alliance : Team.Horde);
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), (team == BatttleGroundTeamId.Alliance) ? Team.Alliance : Team.Horde);
|
||||
m_HonorScoreTics[team] -= m_HonorTics;
|
||||
}
|
||||
|
||||
if (!m_IsInformedNearVictory && m_TeamScores[team] > WarningNearVictoryScore)
|
||||
{
|
||||
if (team == TeamId.Alliance)
|
||||
if (team == BatttleGroundTeamId.Alliance)
|
||||
{
|
||||
SendBroadcastText(ABBattlegroundBroadcastTexts.AllianceNearVictory, ChatMsg.BgSystemNeutral);
|
||||
PlaySoundToAll(SoundNearVictoryAlliance);
|
||||
@@ -146,7 +146,7 @@ namespace Game.BattleGrounds.Zones
|
||||
if (m_TeamScores[team] > MaxTeamScore)
|
||||
m_TeamScores[team] = MaxTeamScore;
|
||||
|
||||
if (team == TeamId.Alliance)
|
||||
if (team == BatttleGroundTeamId.Alliance)
|
||||
UpdateWorldState(ABWorldStates.ResourcesAlly, (int)m_TeamScores[team]);
|
||||
else
|
||||
UpdateWorldState(ABWorldStates.ResourcesHorde, (int)m_TeamScores[team]);
|
||||
@@ -155,7 +155,7 @@ namespace Game.BattleGrounds.Zones
|
||||
int otherTeam = (team + 1) % SharedConst.PvpTeamsCount;
|
||||
if (m_TeamScores[team] > m_TeamScores[otherTeam] + 500)
|
||||
{
|
||||
if (team == TeamId.Alliance)
|
||||
if (team == BatttleGroundTeamId.Alliance)
|
||||
UpdateWorldState(ABWorldStates.Had500DisadvantageHorde, 1);
|
||||
else
|
||||
UpdateWorldState(ABWorldStates.Had500DisadvantageAlliance, 1);
|
||||
@@ -164,9 +164,9 @@ namespace Game.BattleGrounds.Zones
|
||||
}
|
||||
|
||||
// Test win condition
|
||||
if (m_TeamScores[TeamId.Alliance] >= MaxTeamScore)
|
||||
if (m_TeamScores[BatttleGroundTeamId.Alliance] >= MaxTeamScore)
|
||||
EndBattleground(Team.Alliance);
|
||||
else if (m_TeamScores[TeamId.Horde] >= MaxTeamScore)
|
||||
else if (m_TeamScores[BatttleGroundTeamId.Horde] >= MaxTeamScore)
|
||||
EndBattleground(Team.Horde);
|
||||
}
|
||||
}
|
||||
@@ -411,7 +411,7 @@ namespace Game.BattleGrounds.Zones
|
||||
m_NodeTimers[node] = FlagCapturingTime;
|
||||
|
||||
// FIXME: team and node names not localized
|
||||
if (teamIndex == TeamId.Alliance)
|
||||
if (teamIndex == BatttleGroundTeamId.Alliance)
|
||||
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextAllianceClaims, ChatMsg.BgSystemAlliance, source);
|
||||
else
|
||||
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextHordeClaims, ChatMsg.BgSystemHorde, source);
|
||||
@@ -434,7 +434,7 @@ namespace Game.BattleGrounds.Zones
|
||||
_SendNodeUpdate(node);
|
||||
m_NodeTimers[node] = FlagCapturingTime;
|
||||
|
||||
if (teamIndex == TeamId.Alliance)
|
||||
if (teamIndex == BatttleGroundTeamId.Alliance)
|
||||
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextAllianceAssaulted, ChatMsg.BgSystemAlliance, source);
|
||||
else
|
||||
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextHordeAssaulted, ChatMsg.BgSystemHorde, source);
|
||||
@@ -451,14 +451,14 @@ namespace Game.BattleGrounds.Zones
|
||||
_CreateBanner(node, ABNodeStatus.Occupied, (byte)teamIndex, true);
|
||||
_SendNodeUpdate(node);
|
||||
m_NodeTimers[node] = 0;
|
||||
_NodeOccupied(node, (teamIndex == TeamId.Alliance) ? Team.Alliance : Team.Horde);
|
||||
_NodeOccupied(node, (teamIndex == BatttleGroundTeamId.Alliance) ? Team.Alliance : Team.Horde);
|
||||
|
||||
if (teamIndex == TeamId.Alliance)
|
||||
if (teamIndex == BatttleGroundTeamId.Alliance)
|
||||
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextAllianceDefended, ChatMsg.BgSystemAlliance, source);
|
||||
else
|
||||
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextHordeDefended, ChatMsg.BgSystemHorde, source);
|
||||
}
|
||||
sound = (teamIndex == TeamId.Alliance) ? SoundAssaultedAlliance : SoundAssaultedHorde;
|
||||
sound = (teamIndex == BatttleGroundTeamId.Alliance) ? SoundAssaultedAlliance : SoundAssaultedHorde;
|
||||
}
|
||||
// If node is occupied, change to enemy-contested
|
||||
else
|
||||
@@ -474,19 +474,19 @@ namespace Game.BattleGrounds.Zones
|
||||
_NodeDeOccupied(node);
|
||||
m_NodeTimers[node] = FlagCapturingTime;
|
||||
|
||||
if (teamIndex == TeamId.Alliance)
|
||||
if (teamIndex == BatttleGroundTeamId.Alliance)
|
||||
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextAllianceAssaulted, ChatMsg.BgSystemAlliance, source);
|
||||
else
|
||||
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextHordeAssaulted, ChatMsg.BgSystemHorde, source);
|
||||
|
||||
sound = (teamIndex == TeamId.Alliance) ? SoundAssaultedAlliance : SoundAssaultedHorde;
|
||||
sound = (teamIndex == BatttleGroundTeamId.Alliance) ? SoundAssaultedAlliance : SoundAssaultedHorde;
|
||||
}
|
||||
|
||||
// If node is occupied again, send "X has taken the Y" msg.
|
||||
if (m_Nodes[node] >= ABNodeStatus.Occupied)
|
||||
{
|
||||
// FIXME: team and node names not localized
|
||||
if (teamIndex == TeamId.Alliance)
|
||||
if (teamIndex == BatttleGroundTeamId.Alliance)
|
||||
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextAllianceTaken, ChatMsg.BgSystemAlliance);
|
||||
else
|
||||
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextHordeTaken, ChatMsg.BgSystemHorde);
|
||||
|
||||
@@ -19,10 +19,10 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
|
||||
m_Points_Trigger[Points.BloodElf] = PointsTrigger.BloodElfBuff;
|
||||
m_Points_Trigger[Points.DraeneiRuins] = PointsTrigger.DraeneiRuinsBuff;
|
||||
m_Points_Trigger[Points.MageTower] = PointsTrigger.MageTowerBuff;
|
||||
m_HonorScoreTics[TeamId.Alliance] = 0;
|
||||
m_HonorScoreTics[TeamId.Horde] = 0;
|
||||
m_TeamPointsCount[TeamId.Alliance] = 0;
|
||||
m_TeamPointsCount[TeamId.Horde] = 0;
|
||||
m_HonorScoreTics[BatttleGroundTeamId.Alliance] = 0;
|
||||
m_HonorScoreTics[BatttleGroundTeamId.Horde] = 0;
|
||||
m_TeamPointsCount[BatttleGroundTeamId.Alliance] = 0;
|
||||
m_TeamPointsCount[BatttleGroundTeamId.Horde] = 0;
|
||||
m_FlagKeeper.Clear();
|
||||
m_DroppedFlagGUID.Clear();
|
||||
m_FlagCapturedBgObjectType = 0;
|
||||
@@ -55,10 +55,10 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
|
||||
if (m_PointAddingTimer <= 0)
|
||||
{
|
||||
m_PointAddingTimer = Misc.FPointsTickTime;
|
||||
if (m_TeamPointsCount[TeamId.Alliance] > 0)
|
||||
AddPoints(Team.Alliance, Misc.TickPoints[m_TeamPointsCount[TeamId.Alliance] - 1]);
|
||||
if (m_TeamPointsCount[TeamId.Horde] > 0)
|
||||
AddPoints(Team.Horde, Misc.TickPoints[m_TeamPointsCount[TeamId.Horde] - 1]);
|
||||
if (m_TeamPointsCount[BatttleGroundTeamId.Alliance] > 0)
|
||||
AddPoints(Team.Alliance, Misc.TickPoints[m_TeamPointsCount[BatttleGroundTeamId.Alliance] - 1]);
|
||||
if (m_TeamPointsCount[BatttleGroundTeamId.Horde] > 0)
|
||||
AddPoints(Team.Horde, Misc.TickPoints[m_TeamPointsCount[BatttleGroundTeamId.Horde] - 1]);
|
||||
}
|
||||
|
||||
if (m_FlagState == FlagState.WaitRespawn || m_FlagState == FlagState.OnGround)
|
||||
@@ -140,13 +140,13 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
|
||||
if (score >= ScoreIds.MaxTeamScore)
|
||||
{
|
||||
score = ScoreIds.MaxTeamScore;
|
||||
if (team == TeamId.Alliance)
|
||||
if (team == BatttleGroundTeamId.Alliance)
|
||||
EndBattleground(Team.Alliance);
|
||||
else
|
||||
EndBattleground(Team.Horde);
|
||||
}
|
||||
|
||||
if (team == TeamId.Alliance)
|
||||
if (team == BatttleGroundTeamId.Alliance)
|
||||
UpdateWorldState(WorldStateIds.AllianceResources, (int)score);
|
||||
else
|
||||
UpdateWorldState(WorldStateIds.HordeResources, (int)score);
|
||||
@@ -169,9 +169,9 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
|
||||
void UpdatePointsCount(Team team)
|
||||
{
|
||||
if (team == Team.Alliance)
|
||||
UpdateWorldState(WorldStateIds.AllianceBase, (int)m_TeamPointsCount[TeamId.Alliance]);
|
||||
UpdateWorldState(WorldStateIds.AllianceBase, (int)m_TeamPointsCount[BatttleGroundTeamId.Alliance]);
|
||||
else
|
||||
UpdateWorldState(WorldStateIds.HordeBase, (int)m_TeamPointsCount[TeamId.Horde]);
|
||||
UpdateWorldState(WorldStateIds.HordeBase, (int)m_TeamPointsCount[BatttleGroundTeamId.Horde]);
|
||||
}
|
||||
|
||||
void UpdatePointsIcons(Team team, uint Point)
|
||||
@@ -342,14 +342,14 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
|
||||
}
|
||||
|
||||
WorldSafeLocsEntry sg = Global.ObjectMgr.GetWorldSafeLoc(GaveyardIds.MainAlliance);
|
||||
if (sg == null || !AddSpiritGuide(CreaturesTypes.SpiritMainAlliance, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), 3.124139f, TeamId.Alliance))
|
||||
if (sg == null || !AddSpiritGuide(CreaturesTypes.SpiritMainAlliance, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), 3.124139f, BatttleGroundTeamId.Alliance))
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "BatteGroundEY: Failed to spawn spirit guide. The battleground was not created.");
|
||||
return false;
|
||||
}
|
||||
|
||||
sg = Global.ObjectMgr.GetWorldSafeLoc(GaveyardIds.MainHorde);
|
||||
if (sg == null || !AddSpiritGuide(CreaturesTypes.SpiritMainHorde, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), 3.193953f, TeamId.Horde))
|
||||
if (sg == null || !AddSpiritGuide(CreaturesTypes.SpiritMainHorde, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), 3.193953f, BatttleGroundTeamId.Horde))
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "BatteGroundEY: Failed to spawn spirit guide. The battleground was not created.");
|
||||
return false;
|
||||
@@ -368,12 +368,12 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
|
||||
//call parent's class reset
|
||||
base.Reset();
|
||||
|
||||
m_TeamScores[TeamId.Alliance] = 0;
|
||||
m_TeamScores[TeamId.Horde] = 0;
|
||||
m_TeamPointsCount[TeamId.Alliance] = 0;
|
||||
m_TeamPointsCount[TeamId.Horde] = 0;
|
||||
m_HonorScoreTics[TeamId.Alliance] = 0;
|
||||
m_HonorScoreTics[TeamId.Horde] = 0;
|
||||
m_TeamScores[BatttleGroundTeamId.Alliance] = 0;
|
||||
m_TeamScores[BatttleGroundTeamId.Horde] = 0;
|
||||
m_TeamPointsCount[BatttleGroundTeamId.Alliance] = 0;
|
||||
m_TeamPointsCount[BatttleGroundTeamId.Horde] = 0;
|
||||
m_HonorScoreTics[BatttleGroundTeamId.Alliance] = 0;
|
||||
m_HonorScoreTics[BatttleGroundTeamId.Horde] = 0;
|
||||
m_FlagState = FlagState.OnBase;
|
||||
m_FlagCapturedBgObjectType = 0;
|
||||
m_FlagKeeper.Clear();
|
||||
@@ -511,14 +511,14 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
|
||||
|
||||
if (team == Team.Alliance)
|
||||
{
|
||||
m_TeamPointsCount[TeamId.Alliance]--;
|
||||
m_TeamPointsCount[BatttleGroundTeamId.Alliance]--;
|
||||
SpawnBGObject(Misc.m_LosingPointTypes[point].DespawnObjectTypeAlliance, BattlegroundConst.RespawnOneDay);
|
||||
SpawnBGObject(Misc.m_LosingPointTypes[point].DespawnObjectTypeAlliance + 1, BattlegroundConst.RespawnOneDay);
|
||||
SpawnBGObject(Misc.m_LosingPointTypes[point].DespawnObjectTypeAlliance + 2, BattlegroundConst.RespawnOneDay);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_TeamPointsCount[TeamId.Horde]--;
|
||||
m_TeamPointsCount[BatttleGroundTeamId.Horde]--;
|
||||
SpawnBGObject(Misc.m_LosingPointTypes[point].DespawnObjectTypeHorde, BattlegroundConst.RespawnOneDay);
|
||||
SpawnBGObject(Misc.m_LosingPointTypes[point].DespawnObjectTypeHorde + 1, BattlegroundConst.RespawnOneDay);
|
||||
SpawnBGObject(Misc.m_LosingPointTypes[point].DespawnObjectTypeHorde + 2, BattlegroundConst.RespawnOneDay);
|
||||
@@ -557,14 +557,14 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
|
||||
|
||||
if (team == Team.Alliance)
|
||||
{
|
||||
m_TeamPointsCount[TeamId.Alliance]++;
|
||||
m_TeamPointsCount[BatttleGroundTeamId.Alliance]++;
|
||||
SpawnBGObject(Misc.m_CapturingPointTypes[point].SpawnObjectTypeAlliance, BattlegroundConst.RespawnImmediately);
|
||||
SpawnBGObject(Misc.m_CapturingPointTypes[point].SpawnObjectTypeAlliance + 1, BattlegroundConst.RespawnImmediately);
|
||||
SpawnBGObject(Misc.m_CapturingPointTypes[point].SpawnObjectTypeAlliance + 2, BattlegroundConst.RespawnImmediately);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_TeamPointsCount[TeamId.Horde]++;
|
||||
m_TeamPointsCount[BatttleGroundTeamId.Horde]++;
|
||||
SpawnBGObject(Misc.m_CapturingPointTypes[point].SpawnObjectTypeHorde, BattlegroundConst.RespawnImmediately);
|
||||
SpawnBGObject(Misc.m_CapturingPointTypes[point].SpawnObjectTypeHorde + 1, BattlegroundConst.RespawnImmediately);
|
||||
SpawnBGObject(Misc.m_CapturingPointTypes[point].SpawnObjectTypeHorde + 2, BattlegroundConst.RespawnImmediately);
|
||||
@@ -707,9 +707,9 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
|
||||
|
||||
public override Team GetPrematureWinner()
|
||||
{
|
||||
if (GetTeamScore(TeamId.Alliance) > GetTeamScore(TeamId.Horde))
|
||||
if (GetTeamScore(BatttleGroundTeamId.Alliance) > GetTeamScore(BatttleGroundTeamId.Horde))
|
||||
return Team.Alliance;
|
||||
else if (GetTeamScore(TeamId.Horde) > GetTeamScore(TeamId.Alliance))
|
||||
else if (GetTeamScore(BatttleGroundTeamId.Horde) > GetTeamScore(BatttleGroundTeamId.Alliance))
|
||||
return Team.Horde;
|
||||
|
||||
return base.GetPrematureWinner();
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Game.BattleGrounds.Zones
|
||||
SignaledRoundTwo = false;
|
||||
SignaledRoundTwoHalfMin = false;
|
||||
InitSecondRound = false;
|
||||
Attackers = TeamId.Alliance;
|
||||
Attackers = BatttleGroundTeamId.Alliance;
|
||||
TotalTime = 0;
|
||||
EndRoundTimer = 0;
|
||||
ShipsStarted = false;
|
||||
@@ -33,7 +33,7 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
for (byte i = 0; i < 2; i++)
|
||||
{
|
||||
RoundScores[i].winner = TeamId.Alliance;
|
||||
RoundScores[i].winner = BatttleGroundTeamId.Alliance;
|
||||
RoundScores[i].time = 0;
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ namespace Game.BattleGrounds.Zones
|
||||
public override void Reset()
|
||||
{
|
||||
TotalTime = 0;
|
||||
Attackers = (RandomHelper.URand(0, 1) != 0 ? TeamId.Alliance : TeamId.Horde);
|
||||
Attackers = (RandomHelper.URand(0, 1) != 0 ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde);
|
||||
for (byte i = 0; i <= 5; i++)
|
||||
GateStatus[i] = SAGateState.HordeGateOk;
|
||||
ShipsStarted = false;
|
||||
@@ -63,7 +63,7 @@ namespace Game.BattleGrounds.Zones
|
||||
}
|
||||
|
||||
uint atF = SAMiscConst.Factions[Attackers];
|
||||
uint defF = SAMiscConst.Factions[Attackers != 0 ? TeamId.Alliance : TeamId.Horde];
|
||||
uint defF = SAMiscConst.Factions[Attackers != 0 ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde];
|
||||
|
||||
for (byte i = 0; i < SAObjectTypes.MaxObj; i++)
|
||||
DelObject(i);
|
||||
@@ -75,7 +75,7 @@ namespace Game.BattleGrounds.Zones
|
||||
DelCreature(i);
|
||||
|
||||
for (byte i = 0; i < GateStatus.Length; ++i)
|
||||
GateStatus[i] = Attackers == TeamId.Horde ? SAGateState.AllianceGateOk : SAGateState.HordeGateOk;
|
||||
GateStatus[i] = Attackers == BatttleGroundTeamId.Horde ? SAGateState.AllianceGateOk : SAGateState.HordeGateOk;
|
||||
|
||||
if (AddCreature(SAMiscConst.NpcEntries[SACreatureTypes.Kanrethad], SACreatureTypes.Kanrethad, SAMiscConst.NpcSpawnlocs[SACreatureTypes.Kanrethad]) == null)
|
||||
{
|
||||
@@ -135,9 +135,9 @@ namespace Game.BattleGrounds.Zones
|
||||
//By capturing GYs.
|
||||
for (byte i = 0; i < SACreatureTypes.Demolisher5; i++)
|
||||
{
|
||||
if (AddCreature(SAMiscConst.NpcEntries[i], i, SAMiscConst.NpcSpawnlocs[i], Attackers == TeamId.Alliance ? TeamId.Horde : TeamId.Alliance, 600) == null)
|
||||
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 == TeamId.Alliance ? "Horde(1)" : "Alliance(0)")}");
|
||||
Log.outError(LogFilter.Battleground, $"SOTA: couldn't spawn Cannon or demolisher, Entry: {SAMiscConst.NpcEntries[i]}, Attackers: {(Attackers == BatttleGroundTeamId.Alliance ? "Horde(1)" : "Alliance(0)")}");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -174,8 +174,8 @@ namespace Game.BattleGrounds.Zones
|
||||
}
|
||||
else
|
||||
{
|
||||
GraveyardStatus[i] = ((Attackers == TeamId.Horde) ? TeamId.Alliance : TeamId.Horde);
|
||||
if (!AddSpiritGuide(i + SACreatureTypes.Max, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), SAMiscConst.GYOrientation[i], Attackers == TeamId.Horde ? TeamId.Alliance : TeamId.Horde))
|
||||
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}");
|
||||
}
|
||||
}
|
||||
@@ -183,9 +183,9 @@ namespace Game.BattleGrounds.Zones
|
||||
//GY capture points
|
||||
for (byte i = SAObjectTypes.CentralFlag; i <= SAObjectTypes.LeftFlag; i++)
|
||||
{
|
||||
if (!AddObject(i, (SAMiscConst.ObjEntries[i] - (Attackers == TeamId.Alliance ? 1u : 0)), SAMiscConst.ObjSpawnlocs[i], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay))
|
||||
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 == TeamId.Alliance ? 1 : 0)}");
|
||||
Log.outError(LogFilter.Battleground, $"SOTA: couldn't spawn Central Flag Entry: {SAMiscConst.ObjEntries[i] - (Attackers == BatttleGroundTeamId.Alliance ? 1 : 0)}");
|
||||
continue;
|
||||
}
|
||||
GetBGObject(i).SetFaction(atF);
|
||||
@@ -204,15 +204,15 @@ namespace Game.BattleGrounds.Zones
|
||||
}
|
||||
|
||||
//Player may enter BEFORE we set up BG - lets update his worldstates anyway...
|
||||
UpdateWorldState(SAWorldStateIds.RightGyHorde, GraveyardStatus[SAGraveyards.RightCapturableGy] == TeamId.Horde ? 1 : 0);
|
||||
UpdateWorldState(SAWorldStateIds.LeftGyHorde, GraveyardStatus[SAGraveyards.LeftCapturableGy] == TeamId.Horde ? 1 : 0);
|
||||
UpdateWorldState(SAWorldStateIds.CenterGyHorde, GraveyardStatus[SAGraveyards.CentralCapturableGy] == TeamId.Horde ? 1 : 0);
|
||||
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] == TeamId.Alliance ? 1 : 0);
|
||||
UpdateWorldState(SAWorldStateIds.LeftGyAlliance, GraveyardStatus[SAGraveyards.LeftCapturableGy] == TeamId.Alliance ? 1 : 0);
|
||||
UpdateWorldState(SAWorldStateIds.CenterGyAlliance, GraveyardStatus[SAGraveyards.CentralCapturableGy] == TeamId.Alliance ? 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 == TeamId.Alliance)
|
||||
if (Attackers == BatttleGroundTeamId.Alliance)
|
||||
{
|
||||
UpdateWorldState(SAWorldStateIds.AllyAttacks, 1);
|
||||
UpdateWorldState(SAWorldStateIds.HordeAttacks, 0);
|
||||
@@ -326,7 +326,7 @@ namespace Game.BattleGrounds.Zones
|
||||
ToggleTimer();
|
||||
DemolisherStartState(false);
|
||||
Status = SAStatus.RoundOne;
|
||||
TriggerGameEvent(Attackers == TeamId.Alliance ? 23748 : 21702u);
|
||||
TriggerGameEvent(Attackers == BatttleGroundTeamId.Alliance ? 23748 : 21702u);
|
||||
}
|
||||
if (TotalTime >= SATimers.BoatStart)
|
||||
StartShips();
|
||||
@@ -350,7 +350,7 @@ namespace Game.BattleGrounds.Zones
|
||||
ToggleTimer();
|
||||
DemolisherStartState(false);
|
||||
Status = SAStatus.RoundTwo;
|
||||
TriggerGameEvent(Attackers == TeamId.Alliance ? 23748 : 21702u);
|
||||
TriggerGameEvent(Attackers == BatttleGroundTeamId.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())
|
||||
@@ -383,7 +383,7 @@ namespace Game.BattleGrounds.Zones
|
||||
RoundScores[0].time = SATimers.RoundLength;
|
||||
TotalTime = 0;
|
||||
Status = SAStatus.SecondWarmup;
|
||||
Attackers = (Attackers == TeamId.Alliance) ? TeamId.Horde : TeamId.Alliance;
|
||||
Attackers = (Attackers == BatttleGroundTeamId.Alliance) ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance;
|
||||
UpdateWaitTimer = 5000;
|
||||
SignaledRoundTwo = false;
|
||||
SignaledRoundTwoHalfMin = false;
|
||||
@@ -401,13 +401,13 @@ namespace Game.BattleGrounds.Zones
|
||||
CastSpellOnTeam(SASpellIds.EndOfRound, Team.Alliance);
|
||||
CastSpellOnTeam(SASpellIds.EndOfRound, Team.Horde);
|
||||
RoundScores[1].time = SATimers.RoundLength;
|
||||
RoundScores[1].winner = (uint)((Attackers == TeamId.Alliance) ? TeamId.Horde : TeamId.Alliance);
|
||||
RoundScores[1].winner = (uint)((Attackers == BatttleGroundTeamId.Alliance) ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance);
|
||||
if (RoundScores[0].time == RoundScores[1].time)
|
||||
EndBattleground(0);
|
||||
else if (RoundScores[0].time < RoundScores[1].time)
|
||||
EndBattleground(RoundScores[0].winner == TeamId.Alliance ? Team.Alliance : Team.Horde);
|
||||
EndBattleground(RoundScores[0].winner == BatttleGroundTeamId.Alliance ? Team.Alliance : Team.Horde);
|
||||
else
|
||||
EndBattleground(RoundScores[1].winner == TeamId.Alliance ? Team.Alliance : Team.Horde);
|
||||
EndBattleground(RoundScores[1].winner == BatttleGroundTeamId.Alliance ? Team.Alliance : Team.Horde);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -505,18 +505,18 @@ namespace Game.BattleGrounds.Zones
|
||||
// damaged
|
||||
if (eventId == go.GetGoInfo().DestructibleBuilding.DamagedEvent)
|
||||
{
|
||||
GateStatus[gateId] = Attackers == TeamId.Horde ? SAGateState.AllianceGateDamaged : SAGateState.HordeGateDamaged;
|
||||
GateStatus[gateId] = Attackers == BatttleGroundTeamId.Horde ? SAGateState.AllianceGateDamaged : SAGateState.HordeGateDamaged;
|
||||
|
||||
Creature creature = obj.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (creature != null)
|
||||
SendChatMessage(creature, (byte)gate.DamagedText, invoker);
|
||||
|
||||
PlaySoundToAll(Attackers == TeamId.Alliance ? SASoundIds.WallAttackedAlliance : SASoundIds.WallAttackedHorde);
|
||||
PlaySoundToAll(Attackers == BatttleGroundTeamId.Alliance ? SASoundIds.WallAttackedAlliance : SASoundIds.WallAttackedHorde);
|
||||
}
|
||||
// destroyed
|
||||
else if (eventId == go.GetGoInfo().DestructibleBuilding.DestroyedEvent)
|
||||
{
|
||||
GateStatus[gate.GateId] = Attackers == TeamId.Horde ? SAGateState.AllianceGateDestroyed : SAGateState.HordeGateDestroyed;
|
||||
GateStatus[gate.GateId] = Attackers == BatttleGroundTeamId.Horde ? SAGateState.AllianceGateDestroyed : SAGateState.HordeGateDestroyed;
|
||||
|
||||
if (gateId < 5)
|
||||
DelObject((int)gateId + 14);
|
||||
@@ -525,7 +525,7 @@ namespace Game.BattleGrounds.Zones
|
||||
if (creature != null)
|
||||
SendChatMessage(creature, (byte)gate.DestroyedText, invoker);
|
||||
|
||||
PlaySoundToAll(Attackers == TeamId.Alliance ? SASoundIds.WallDestroyedAlliance : SASoundIds.WallDestroyedHorde);
|
||||
PlaySoundToAll(Attackers == BatttleGroundTeamId.Alliance ? SASoundIds.WallDestroyedAlliance : SASoundIds.WallDestroyedHorde);
|
||||
|
||||
bool rewardHonor = true;
|
||||
switch (gateId)
|
||||
@@ -585,7 +585,7 @@ namespace Game.BattleGrounds.Zones
|
||||
if (creature.GetEntry() == SACreatureIds.Demolisher)
|
||||
{
|
||||
UpdatePvpStat(killer, (uint)StrandOfTheAncientsPvpStats.DemolishersDestroyed, 1);
|
||||
uint worldStateId = Attackers == TeamId.Horde ? SAWorldStateIds.DestroyedHordeVehicles : SAWorldStateIds.DestroyedAllianceVehicles;
|
||||
uint worldStateId = Attackers == BatttleGroundTeamId.Horde ? SAWorldStateIds.DestroyedHordeVehicles : SAWorldStateIds.DestroyedAllianceVehicles;
|
||||
int currentDestroyedVehicles = Global.WorldStateMgr.GetValue((int)worldStateId, GetBgMap());
|
||||
UpdateWorldState(worldStateId, currentDestroyedVehicles + 1);
|
||||
}
|
||||
@@ -604,7 +604,7 @@ namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
Creature gun = GetBGCreature(i);
|
||||
if (gun != null)
|
||||
gun.SetFaction(SAMiscConst.Factions[Attackers != 0 ? TeamId.Alliance : TeamId.Horde]);
|
||||
gun.SetFaction(SAMiscConst.Factions[Attackers != 0 ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde]);
|
||||
}
|
||||
|
||||
for (byte i = SACreatureTypes.Demolisher1; i <= SACreatureTypes.Demolisher4; i++)
|
||||
@@ -767,7 +767,7 @@ namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
flag = SAObjectTypes.LeftFlag;
|
||||
DelObject(flag);
|
||||
AddObject(flag, (SAMiscConst.ObjEntries[flag] - (teamId == TeamId.Alliance ? 0 : 1u)),
|
||||
AddObject(flag, (SAMiscConst.ObjEntries[flag] - (teamId == BatttleGroundTeamId.Alliance ? 0 : 1u)),
|
||||
SAMiscConst.ObjSpawnlocs[flag], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay);
|
||||
|
||||
npc = SACreatureTypes.Rigspark;
|
||||
@@ -777,25 +777,25 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
for (byte j = SACreatureTypes.Demolisher7; j <= SACreatureTypes.Demolisher8; j++)
|
||||
{
|
||||
AddCreature(SAMiscConst.NpcEntries[j], j, SAMiscConst.NpcSpawnlocs[j], (Attackers == TeamId.Alliance ? TeamId.Horde : TeamId.Alliance), 600);
|
||||
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] == TeamId.Alliance ? 1 : 0);
|
||||
UpdateWorldState(SAWorldStateIds.LeftGyHorde, GraveyardStatus[i] == TeamId.Horde ? 1 : 0);
|
||||
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 == TeamId.Alliance ? SATextIds.WestGraveyardCapturedA : SATextIds.WestGraveyardCapturedH, source);
|
||||
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 == TeamId.Alliance ? 0 : 1u)),
|
||||
AddObject(flag, (SAMiscConst.ObjEntries[flag] - (teamId == BatttleGroundTeamId.Alliance ? 0 : 1u)),
|
||||
SAMiscConst.ObjSpawnlocs[flag], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay);
|
||||
|
||||
npc = SACreatureTypes.Sparklight;
|
||||
@@ -805,34 +805,34 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
for (byte j = SACreatureTypes.Demolisher5; j <= SACreatureTypes.Demolisher6; j++)
|
||||
{
|
||||
AddCreature(SAMiscConst.NpcEntries[j], j, SAMiscConst.NpcSpawnlocs[j], Attackers == TeamId.Alliance ? TeamId.Horde : TeamId.Alliance, 600);
|
||||
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] == TeamId.Alliance ? 1 : 0);
|
||||
UpdateWorldState(SAWorldStateIds.RightGyHorde, GraveyardStatus[i] == TeamId.Horde ? 1 : 0);
|
||||
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 == TeamId.Alliance ? SATextIds.EastGraveyardCapturedA : SATextIds.EastGraveyardCapturedH, source);
|
||||
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 == TeamId.Alliance ? 0 : 1u)),
|
||||
AddObject(flag, (SAMiscConst.ObjEntries[flag] - (teamId == BatttleGroundTeamId.Alliance ? 0 : 1u)),
|
||||
SAMiscConst.ObjSpawnlocs[flag], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay);
|
||||
|
||||
UpdateWorldState(SAWorldStateIds.CenterGyAlliance, GraveyardStatus[i] == TeamId.Alliance ? 1 : 0);
|
||||
UpdateWorldState(SAWorldStateIds.CenterGyHorde, GraveyardStatus[i] == TeamId.Horde ? 1 : 0);
|
||||
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 == TeamId.Alliance ? SATextIds.SouthGraveyardCapturedA : SATextIds.SouthGraveyardCapturedH, source);
|
||||
SendChatMessage(creature, teamId == BatttleGroundTeamId.Alliance ? SATextIds.SouthGraveyardCapturedA : SATextIds.SouthGraveyardCapturedH, source);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -851,7 +851,7 @@ namespace Game.BattleGrounds.Zones
|
||||
int clickerTeamId = GetTeamIndexByTeamId(GetPlayerTeam(clicker.GetGUID()));
|
||||
if (clickerTeamId == Attackers)
|
||||
{
|
||||
if (clickerTeamId == TeamId.Alliance)
|
||||
if (clickerTeamId == BatttleGroundTeamId.Alliance)
|
||||
SendBroadcastText(SABroadcastTexts.AllianceCapturedTitanPortal, ChatMsg.BgSystemNeutral);
|
||||
else
|
||||
SendBroadcastText(SABroadcastTexts.HordeCapturedTitanPortal, ChatMsg.BgSystemNeutral);
|
||||
@@ -869,7 +869,7 @@ namespace Game.BattleGrounds.Zones
|
||||
player.UpdateCriteria(CriteriaType.BeSpellTarget, 65246);
|
||||
}
|
||||
|
||||
Attackers = (Attackers == TeamId.Alliance) ? TeamId.Horde : TeamId.Alliance;
|
||||
Attackers = (Attackers == BatttleGroundTeamId.Alliance) ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance;
|
||||
Status = SAStatus.SecondWarmup;
|
||||
TotalTime = 0;
|
||||
ToggleTimer();
|
||||
@@ -904,9 +904,9 @@ namespace Game.BattleGrounds.Zones
|
||||
if (RoundScores[0].time == RoundScores[1].time)
|
||||
EndBattleground(0);
|
||||
else if (RoundScores[0].time < RoundScores[1].time)
|
||||
EndBattleground(RoundScores[0].winner == TeamId.Alliance ? Team.Alliance : Team.Horde);
|
||||
EndBattleground(RoundScores[0].winner == BatttleGroundTeamId.Alliance ? Team.Alliance : Team.Horde);
|
||||
else
|
||||
EndBattleground(RoundScores[1].winner == TeamId.Alliance ? Team.Alliance : Team.Horde);
|
||||
EndBattleground(RoundScores[1].winner == BatttleGroundTeamId.Alliance ? Team.Alliance : Team.Horde);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1008,9 +1008,9 @@ namespace Game.BattleGrounds.Zones
|
||||
switch (spellId)
|
||||
{
|
||||
case SASpellIds.AllianceControlPhaseShift:
|
||||
return Attackers == TeamId.Horde;
|
||||
return Attackers == BatttleGroundTeamId.Horde;
|
||||
case SASpellIds.HordeControlPhaseShift:
|
||||
return Attackers == TeamId.Alliance;
|
||||
return Attackers == BatttleGroundTeamId.Alliance;
|
||||
case BattlegroundConst.SpellPreparation:
|
||||
return Status == SAStatus.Warmup || Status == SAStatus.SecondWarmup;
|
||||
default:
|
||||
|
||||
@@ -27,64 +27,64 @@ namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
if (GetElapsedTime() >= 17 * Time.Minute * Time.InMilliseconds)
|
||||
{
|
||||
if (GetTeamScore(TeamId.Alliance) == 0)
|
||||
if (GetTeamScore(BatttleGroundTeamId.Alliance) == 0)
|
||||
{
|
||||
if (GetTeamScore(TeamId.Horde) == 0) // No one scored - result is tie
|
||||
if (GetTeamScore(BatttleGroundTeamId.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(TeamId.Horde) == 0)
|
||||
else if (GetTeamScore(BatttleGroundTeamId.Horde) == 0)
|
||||
EndBattleground(Team.Alliance); // Alliance has > 0, Horde has 0, alliance wins
|
||||
else if (GetTeamScore(TeamId.Horde) == GetTeamScore(TeamId.Alliance)) // Team score equal, winner is team that scored the last flag
|
||||
else if (GetTeamScore(BatttleGroundTeamId.Horde) == GetTeamScore(BatttleGroundTeamId.Alliance)) // Team score equal, winner is team that scored the last flag
|
||||
EndBattleground((Team)_lastFlagCaptureTeam);
|
||||
else if (GetTeamScore(TeamId.Horde) > GetTeamScore(TeamId.Alliance)) // Last but not least, check who has the higher score
|
||||
else if (GetTeamScore(BatttleGroundTeamId.Horde) > GetTeamScore(BatttleGroundTeamId.Alliance)) // Last but not least, check who has the higher score
|
||||
EndBattleground(Team.Horde);
|
||||
else
|
||||
EndBattleground(Team.Alliance);
|
||||
}
|
||||
|
||||
if (_flagState[TeamId.Alliance] == WSGFlagState.WaitRespawn)
|
||||
if (_flagState[BatttleGroundTeamId.Alliance] == WSGFlagState.WaitRespawn)
|
||||
{
|
||||
_flagsTimer[TeamId.Alliance] -= (int)diff;
|
||||
_flagsTimer[BatttleGroundTeamId.Alliance] -= (int)diff;
|
||||
|
||||
if (_flagsTimer[TeamId.Alliance] < 0)
|
||||
if (_flagsTimer[BatttleGroundTeamId.Alliance] < 0)
|
||||
{
|
||||
_flagsTimer[TeamId.Alliance] = 0;
|
||||
_flagsTimer[BatttleGroundTeamId.Alliance] = 0;
|
||||
RespawnFlag(Team.Alliance, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (_flagState[TeamId.Alliance] == WSGFlagState.OnGround)
|
||||
if (_flagState[BatttleGroundTeamId.Alliance] == WSGFlagState.OnGround)
|
||||
{
|
||||
_flagsDropTimer[TeamId.Alliance] -= (int)diff;
|
||||
_flagsDropTimer[BatttleGroundTeamId.Alliance] -= (int)diff;
|
||||
|
||||
if (_flagsDropTimer[TeamId.Alliance] < 0)
|
||||
if (_flagsDropTimer[BatttleGroundTeamId.Alliance] < 0)
|
||||
{
|
||||
_flagsDropTimer[TeamId.Alliance] = 0;
|
||||
_flagsDropTimer[BatttleGroundTeamId.Alliance] = 0;
|
||||
RespawnFlagAfterDrop(Team.Alliance);
|
||||
_bothFlagsKept = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (_flagState[TeamId.Horde] == WSGFlagState.WaitRespawn)
|
||||
if (_flagState[BatttleGroundTeamId.Horde] == WSGFlagState.WaitRespawn)
|
||||
{
|
||||
_flagsTimer[TeamId.Horde] -= (int)diff;
|
||||
_flagsTimer[BatttleGroundTeamId.Horde] -= (int)diff;
|
||||
|
||||
if (_flagsTimer[TeamId.Horde] < 0)
|
||||
if (_flagsTimer[BatttleGroundTeamId.Horde] < 0)
|
||||
{
|
||||
_flagsTimer[TeamId.Horde] = 0;
|
||||
_flagsTimer[BatttleGroundTeamId.Horde] = 0;
|
||||
RespawnFlag(Team.Horde, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (_flagState[TeamId.Horde] == WSGFlagState.OnGround)
|
||||
if (_flagState[BatttleGroundTeamId.Horde] == WSGFlagState.OnGround)
|
||||
{
|
||||
_flagsDropTimer[TeamId.Horde] -= (int)diff;
|
||||
_flagsDropTimer[BatttleGroundTeamId.Horde] -= (int)diff;
|
||||
|
||||
if (_flagsDropTimer[TeamId.Horde] < 0)
|
||||
if (_flagsDropTimer[BatttleGroundTeamId.Horde] < 0)
|
||||
{
|
||||
_flagsDropTimer[TeamId.Horde] = 0;
|
||||
_flagsDropTimer[BatttleGroundTeamId.Horde] = 0;
|
||||
RespawnFlagAfterDrop(Team.Horde);
|
||||
_bothFlagsKept = false;
|
||||
}
|
||||
@@ -125,8 +125,8 @@ namespace Game.BattleGrounds.Zones
|
||||
_flagDebuffState = 2;
|
||||
}
|
||||
}
|
||||
else if ((_flagState[TeamId.Alliance] == WSGFlagState.OnBase || _flagState[TeamId.Alliance] == WSGFlagState.WaitRespawn) &&
|
||||
(_flagState[TeamId.Horde] == WSGFlagState.OnBase || _flagState[TeamId.Horde] == WSGFlagState.WaitRespawn))
|
||||
else if ((_flagState[BatttleGroundTeamId.Alliance] == WSGFlagState.OnBase || _flagState[BatttleGroundTeamId.Alliance] == WSGFlagState.WaitRespawn) &&
|
||||
(_flagState[BatttleGroundTeamId.Horde] == WSGFlagState.OnBase || _flagState[BatttleGroundTeamId.Horde] == WSGFlagState.WaitRespawn))
|
||||
{
|
||||
// Both flags are in base or awaiting respawn.
|
||||
// Remove assault debuffs, reset timers
|
||||
@@ -189,12 +189,12 @@ namespace Game.BattleGrounds.Zones
|
||||
if (Team == Team.Alliance)
|
||||
{
|
||||
Log.outDebug(LogFilter.Battleground, "Respawn Alliance flag");
|
||||
_flagState[TeamId.Alliance] = WSGFlagState.OnBase;
|
||||
_flagState[BatttleGroundTeamId.Alliance] = WSGFlagState.OnBase;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.outDebug(LogFilter.Battleground, "Respawn Horde flag");
|
||||
_flagState[TeamId.Horde] = WSGFlagState.OnBase;
|
||||
_flagState[BatttleGroundTeamId.Horde] = WSGFlagState.OnBase;
|
||||
}
|
||||
|
||||
if (captured)
|
||||
@@ -231,7 +231,7 @@ namespace Game.BattleGrounds.Zones
|
||||
SetDroppedFlagGUID(ObjectGuid.Empty, GetTeamIndexByTeamId(team));
|
||||
_bothFlagsKept = false;
|
||||
// Check opposing flag if it is in capture zone; if so, capture it
|
||||
HandleFlagRoomCapturePoint(team == Team.Alliance ? TeamId.Horde : TeamId.Alliance);
|
||||
HandleFlagRoomCapturePoint(team == Team.Alliance ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance);
|
||||
}
|
||||
|
||||
void EventPlayerCapturedFlag(Player player)
|
||||
@@ -249,7 +249,7 @@ namespace Game.BattleGrounds.Zones
|
||||
return;
|
||||
SetHordeFlagPicker(ObjectGuid.Empty); // must be before aura remove to prevent 2 events (drop+capture) at the same time
|
||||
// horde flag in base (but not respawned yet)
|
||||
_flagState[TeamId.Horde] = WSGFlagState.WaitRespawn;
|
||||
_flagState[BatttleGroundTeamId.Horde] = WSGFlagState.WaitRespawn;
|
||||
// Drop Horde Flag from Player
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.WarsongFlag);
|
||||
if (_flagDebuffState == 1)
|
||||
@@ -257,7 +257,7 @@ namespace Game.BattleGrounds.Zones
|
||||
else if (_flagDebuffState == 2)
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.BrutalAssault);
|
||||
|
||||
if (GetTeamScore(TeamId.Alliance) < WSGTimerOrScore.MaxTeamScore)
|
||||
if (GetTeamScore(BatttleGroundTeamId.Alliance) < WSGTimerOrScore.MaxTeamScore)
|
||||
AddPoint(Team.Alliance, 1);
|
||||
PlaySoundToAll(WSGSound.FlagCapturedAlliance);
|
||||
RewardReputationToTeam(890, m_ReputationCapture, Team.Alliance);
|
||||
@@ -268,7 +268,7 @@ namespace Game.BattleGrounds.Zones
|
||||
return;
|
||||
SetAllianceFlagPicker(ObjectGuid.Empty); // must be before aura remove to prevent 2 events (drop+capture) at the same time
|
||||
// alliance flag in base (but not respawned yet)
|
||||
_flagState[TeamId.Alliance] = WSGFlagState.WaitRespawn;
|
||||
_flagState[BatttleGroundTeamId.Alliance] = WSGFlagState.WaitRespawn;
|
||||
// Drop Alliance Flag from Player
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.SilverwingFlag);
|
||||
if (_flagDebuffState == 1)
|
||||
@@ -276,7 +276,7 @@ namespace Game.BattleGrounds.Zones
|
||||
else if (_flagDebuffState == 2)
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.BrutalAssault);
|
||||
|
||||
if (GetTeamScore(TeamId.Horde) < WSGTimerOrScore.MaxTeamScore)
|
||||
if (GetTeamScore(BatttleGroundTeamId.Horde) < WSGTimerOrScore.MaxTeamScore)
|
||||
AddPoint(Team.Horde, 1);
|
||||
PlaySoundToAll(WSGSound.FlagCapturedHorde);
|
||||
RewardReputationToTeam(889, m_ReputationCapture, Team.Horde);
|
||||
@@ -300,10 +300,10 @@ namespace Game.BattleGrounds.Zones
|
||||
// update last flag capture to be used if teamscore is equal
|
||||
SetLastFlagCapture(team);
|
||||
|
||||
if (GetTeamScore(TeamId.Alliance) == WSGTimerOrScore.MaxTeamScore)
|
||||
if (GetTeamScore(BatttleGroundTeamId.Alliance) == WSGTimerOrScore.MaxTeamScore)
|
||||
winner = Team.Alliance;
|
||||
|
||||
if (GetTeamScore(TeamId.Horde) == WSGTimerOrScore.MaxTeamScore)
|
||||
if (GetTeamScore(BatttleGroundTeamId.Horde) == WSGTimerOrScore.MaxTeamScore)
|
||||
winner = Team.Horde;
|
||||
|
||||
if (winner != 0)
|
||||
@@ -324,7 +324,7 @@ namespace Game.BattleGrounds.Zones
|
||||
void HandleFlagRoomCapturePoint(int team)
|
||||
{
|
||||
Player flagCarrier = Global.ObjAccessor.GetPlayer(GetBgMap(), GetFlagPickerGUID(team));
|
||||
uint areaTrigger = team == TeamId.Alliance ? 3647 : 3646u;
|
||||
uint areaTrigger = team == BatttleGroundTeamId.Alliance ? 3647 : 3646u;
|
||||
if (flagCarrier != null && flagCarrier.IsInAreaTriggerRadius(CliDB.AreaTriggerStorage.LookupByKey(areaTrigger)))
|
||||
EventPlayerCapturedFlag(flagCarrier);
|
||||
}
|
||||
@@ -341,7 +341,7 @@ namespace Game.BattleGrounds.Zones
|
||||
if (!IsHordeFlagPickedup())
|
||||
return;
|
||||
|
||||
if (GetFlagPickerGUID(TeamId.Horde) == player.GetGUID())
|
||||
if (GetFlagPickerGUID(BatttleGroundTeamId.Horde) == player.GetGUID())
|
||||
{
|
||||
SetHordeFlagPicker(ObjectGuid.Empty);
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.WarsongFlag);
|
||||
@@ -352,7 +352,7 @@ namespace Game.BattleGrounds.Zones
|
||||
if (!IsAllianceFlagPickedup())
|
||||
return;
|
||||
|
||||
if (GetFlagPickerGUID(TeamId.Alliance) == player.GetGUID())
|
||||
if (GetFlagPickerGUID(BatttleGroundTeamId.Alliance) == player.GetGUID())
|
||||
{
|
||||
SetAllianceFlagPicker(ObjectGuid.Empty);
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.SilverwingFlag);
|
||||
@@ -367,7 +367,7 @@ namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
if (!IsHordeFlagPickedup())
|
||||
return;
|
||||
if (GetFlagPickerGUID(TeamId.Horde) == player.GetGUID())
|
||||
if (GetFlagPickerGUID(BatttleGroundTeamId.Horde) == player.GetGUID())
|
||||
{
|
||||
SetHordeFlagPicker(ObjectGuid.Empty);
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.WarsongFlag);
|
||||
@@ -375,7 +375,7 @@ namespace Game.BattleGrounds.Zones
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.FocusedAssault);
|
||||
else if (_flagDebuffState == 2)
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.BrutalAssault);
|
||||
_flagState[TeamId.Horde] = WSGFlagState.OnGround;
|
||||
_flagState[BatttleGroundTeamId.Horde] = WSGFlagState.OnGround;
|
||||
player.CastSpell(player, WSGSpellId.WarsongFlagDropped, true);
|
||||
set = true;
|
||||
}
|
||||
@@ -384,7 +384,7 @@ namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
if (!IsAllianceFlagPickedup())
|
||||
return;
|
||||
if (GetFlagPickerGUID(TeamId.Alliance) == player.GetGUID())
|
||||
if (GetFlagPickerGUID(BatttleGroundTeamId.Alliance) == player.GetGUID())
|
||||
{
|
||||
SetAllianceFlagPicker(ObjectGuid.Empty);
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.SilverwingFlag);
|
||||
@@ -392,7 +392,7 @@ namespace Game.BattleGrounds.Zones
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.FocusedAssault);
|
||||
else if (_flagDebuffState == 2)
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.BrutalAssault);
|
||||
_flagState[TeamId.Alliance] = WSGFlagState.OnGround;
|
||||
_flagState[BatttleGroundTeamId.Alliance] = WSGFlagState.OnGround;
|
||||
player.CastSpell(player, WSGSpellId.SilverwingFlagDropped, true);
|
||||
set = true;
|
||||
}
|
||||
@@ -427,7 +427,7 @@ namespace Game.BattleGrounds.Zones
|
||||
PlaySoundToAll(WSGSound.AllianceFlagPickedUp);
|
||||
SpawnBGObject(WSGObjectTypes.AFlag, BattlegroundConst.RespawnOneDay);
|
||||
SetAllianceFlagPicker(player.GetGUID());
|
||||
_flagState[TeamId.Alliance] = WSGFlagState.OnPlayer;
|
||||
_flagState[BatttleGroundTeamId.Alliance] = WSGFlagState.OnPlayer;
|
||||
//update world state to show correct flag carrier
|
||||
UpdateFlagState(Team.Horde, WSGFlagState.OnPlayer);
|
||||
player.CastSpell(player, WSGSpellId.SilverwingFlag, true);
|
||||
@@ -449,7 +449,7 @@ namespace Game.BattleGrounds.Zones
|
||||
PlaySoundToAll(WSGSound.HordeFlagPickedUp);
|
||||
SpawnBGObject(WSGObjectTypes.HFlag, BattlegroundConst.RespawnOneDay);
|
||||
SetHordeFlagPicker(player.GetGUID());
|
||||
_flagState[TeamId.Horde] = WSGFlagState.OnPlayer;
|
||||
_flagState[BatttleGroundTeamId.Horde] = WSGFlagState.OnPlayer;
|
||||
//update world state to show correct flag carrier
|
||||
UpdateFlagState(Team.Alliance, WSGFlagState.OnPlayer);
|
||||
player.CastSpell(player, WSGSpellId.WarsongFlag, true);
|
||||
@@ -477,7 +477,7 @@ namespace Game.BattleGrounds.Zones
|
||||
UpdatePvpStat(player, (uint)WarsongGulchPvpStats.FlagReturns, 1);
|
||||
_bothFlagsKept = false;
|
||||
|
||||
HandleFlagRoomCapturePoint(TeamId.Horde); // Check Horde flag if it is in capture zone; if so, capture it
|
||||
HandleFlagRoomCapturePoint(BatttleGroundTeamId.Horde); // Check Horde flag if it is in capture zone; if so, capture it
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -486,7 +486,7 @@ namespace Game.BattleGrounds.Zones
|
||||
SpawnBGObject(WSGObjectTypes.AFlag, BattlegroundConst.RespawnOneDay);
|
||||
SetAllianceFlagPicker(player.GetGUID());
|
||||
player.CastSpell(player, WSGSpellId.SilverwingFlag, true);
|
||||
_flagState[TeamId.Alliance] = WSGFlagState.OnPlayer;
|
||||
_flagState[BatttleGroundTeamId.Alliance] = WSGFlagState.OnPlayer;
|
||||
UpdateFlagState(Team.Horde, WSGFlagState.OnPlayer);
|
||||
if (_flagDebuffState == 1)
|
||||
player.CastSpell(player, WSGSpellId.FocusedAssault, true);
|
||||
@@ -511,7 +511,7 @@ namespace Game.BattleGrounds.Zones
|
||||
UpdatePvpStat(player, (uint)WarsongGulchPvpStats.FlagReturns, 1);
|
||||
_bothFlagsKept = false;
|
||||
|
||||
HandleFlagRoomCapturePoint(TeamId.Alliance); // Check Alliance flag if it is in capture zone; if so, capture it
|
||||
HandleFlagRoomCapturePoint(BatttleGroundTeamId.Alliance); // Check Alliance flag if it is in capture zone; if so, capture it
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -520,7 +520,7 @@ namespace Game.BattleGrounds.Zones
|
||||
SpawnBGObject(WSGObjectTypes.HFlag, BattlegroundConst.RespawnOneDay);
|
||||
SetHordeFlagPicker(player.GetGUID());
|
||||
player.CastSpell(player, WSGSpellId.WarsongFlag, true);
|
||||
_flagState[TeamId.Horde] = WSGFlagState.OnPlayer;
|
||||
_flagState[BatttleGroundTeamId.Horde] = WSGFlagState.OnPlayer;
|
||||
UpdateFlagState(Team.Alliance, WSGFlagState.OnPlayer);
|
||||
if (_flagDebuffState == 1)
|
||||
player.CastSpell(player, WSGSpellId.FocusedAssault, true);
|
||||
@@ -537,7 +537,7 @@ namespace Game.BattleGrounds.Zones
|
||||
public override void RemovePlayer(Player player, ObjectGuid guid, Team team)
|
||||
{
|
||||
// sometimes flag aura not removed :(
|
||||
if (IsAllianceFlagPickedup() && m_FlagKeepers[TeamId.Alliance] == guid)
|
||||
if (IsAllianceFlagPickedup() && m_FlagKeepers[BatttleGroundTeamId.Alliance] == guid)
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
@@ -548,7 +548,7 @@ namespace Game.BattleGrounds.Zones
|
||||
else
|
||||
EventPlayerDroppedFlag(player);
|
||||
}
|
||||
if (IsHordeFlagPickedup() && m_FlagKeepers[TeamId.Horde] == guid)
|
||||
if (IsHordeFlagPickedup() && m_FlagKeepers[BatttleGroundTeamId.Horde] == guid)
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
@@ -592,7 +592,7 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
void UpdateTeamScore(int team)
|
||||
{
|
||||
if (team == TeamId.Alliance)
|
||||
if (team == BatttleGroundTeamId.Alliance)
|
||||
UpdateWorldState(WSGWorldStates.FlagCapturesAlliance, (int)GetTeamScore(team));
|
||||
else
|
||||
UpdateWorldState(WSGWorldStates.FlagCapturesHorde, (int)GetTeamScore(team));
|
||||
@@ -628,13 +628,13 @@ namespace Game.BattleGrounds.Zones
|
||||
//buff_guid = BgObjects[BG_WS_OBJECT_BERSERKBUFF_2];
|
||||
break;
|
||||
case 3646: // Alliance Flag spawn
|
||||
if (_flagState[TeamId.Horde] != 0 && _flagState[TeamId.Alliance] == 0)
|
||||
if (GetFlagPickerGUID(TeamId.Horde) == player.GetGUID())
|
||||
if (_flagState[BatttleGroundTeamId.Horde] != 0 && _flagState[BatttleGroundTeamId.Alliance] == 0)
|
||||
if (GetFlagPickerGUID(BatttleGroundTeamId.Horde) == player.GetGUID())
|
||||
EventPlayerCapturedFlag(player);
|
||||
break;
|
||||
case 3647: // Horde Flag spawn
|
||||
if (_flagState[TeamId.Alliance] != 0 && _flagState[TeamId.Horde] == 0)
|
||||
if (GetFlagPickerGUID(TeamId.Alliance) == player.GetGUID())
|
||||
if (_flagState[BatttleGroundTeamId.Alliance] != 0 && _flagState[BatttleGroundTeamId.Horde] == 0)
|
||||
if (GetFlagPickerGUID(BatttleGroundTeamId.Alliance) == player.GetGUID())
|
||||
EventPlayerCapturedFlag(player);
|
||||
break;
|
||||
case 3649: // unk1
|
||||
@@ -694,14 +694,14 @@ namespace Game.BattleGrounds.Zones
|
||||
}
|
||||
|
||||
WorldSafeLocsEntry sg = Global.ObjectMgr.GetWorldSafeLoc(WSGGraveyards.MainAlliance);
|
||||
if (sg == null || !AddSpiritGuide(WSGCreatureTypes.SpiritMainAlliance, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), 3.124139f, TeamId.Alliance))
|
||||
if (sg == null || !AddSpiritGuide(WSGCreatureTypes.SpiritMainAlliance, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), 3.124139f, BatttleGroundTeamId.Alliance))
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "BgWarsongGluch: Failed to spawn Alliance spirit guide! Battleground not created!");
|
||||
return false;
|
||||
}
|
||||
|
||||
sg = Global.ObjectMgr.GetWorldSafeLoc(WSGGraveyards.MainHorde);
|
||||
if (sg == null || !AddSpiritGuide(WSGCreatureTypes.SpiritMainHorde, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), 3.193953f, TeamId.Horde))
|
||||
if (sg == null || !AddSpiritGuide(WSGCreatureTypes.SpiritMainHorde, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), 3.193953f, BatttleGroundTeamId.Horde))
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "BgWarsongGluch: Failed to spawn Horde spirit guide! Battleground not created!");
|
||||
return false;
|
||||
@@ -715,14 +715,14 @@ namespace Game.BattleGrounds.Zones
|
||||
//call parent's class reset
|
||||
base.Reset();
|
||||
|
||||
m_FlagKeepers[TeamId.Alliance].Clear();
|
||||
m_FlagKeepers[TeamId.Horde].Clear();
|
||||
m_DroppedFlagGUID[TeamId.Alliance] = ObjectGuid.Empty;
|
||||
m_DroppedFlagGUID[TeamId.Horde] = ObjectGuid.Empty;
|
||||
_flagState[TeamId.Alliance] = WSGFlagState.OnBase;
|
||||
_flagState[TeamId.Horde] = WSGFlagState.OnBase;
|
||||
m_TeamScores[TeamId.Alliance] = 0;
|
||||
m_TeamScores[TeamId.Horde] = 0;
|
||||
m_FlagKeepers[BatttleGroundTeamId.Alliance].Clear();
|
||||
m_FlagKeepers[BatttleGroundTeamId.Horde].Clear();
|
||||
m_DroppedFlagGUID[BatttleGroundTeamId.Alliance] = ObjectGuid.Empty;
|
||||
m_DroppedFlagGUID[BatttleGroundTeamId.Horde] = ObjectGuid.Empty;
|
||||
_flagState[BatttleGroundTeamId.Alliance] = WSGFlagState.OnBase;
|
||||
_flagState[BatttleGroundTeamId.Horde] = WSGFlagState.OnBase;
|
||||
m_TeamScores[BatttleGroundTeamId.Alliance] = 0;
|
||||
m_TeamScores[BatttleGroundTeamId.Horde] = 0;
|
||||
|
||||
if (Global.BattlegroundMgr.IsBGWeekend(GetTypeID()))
|
||||
{
|
||||
@@ -740,10 +740,10 @@ namespace Game.BattleGrounds.Zones
|
||||
_bothFlagsKept = false;
|
||||
_flagDebuffState = 0;
|
||||
_flagSpellForceTimer = 0;
|
||||
_flagsDropTimer[TeamId.Alliance] = 0;
|
||||
_flagsDropTimer[TeamId.Horde] = 0;
|
||||
_flagsTimer[TeamId.Alliance] = 0;
|
||||
_flagsTimer[TeamId.Horde] = 0;
|
||||
_flagsDropTimer[BatttleGroundTeamId.Alliance] = 0;
|
||||
_flagsDropTimer[BatttleGroundTeamId.Horde] = 0;
|
||||
_flagsTimer[BatttleGroundTeamId.Alliance] = 0;
|
||||
_flagsTimer[BatttleGroundTeamId.Horde] = 0;
|
||||
}
|
||||
|
||||
public override void EndBattleground(Team winner)
|
||||
@@ -800,9 +800,9 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
public override Team GetPrematureWinner()
|
||||
{
|
||||
if (GetTeamScore(TeamId.Alliance) > GetTeamScore(TeamId.Horde))
|
||||
if (GetTeamScore(BatttleGroundTeamId.Alliance) > GetTeamScore(BatttleGroundTeamId.Horde))
|
||||
return Team.Alliance;
|
||||
else if (GetTeamScore(TeamId.Horde) > GetTeamScore(TeamId.Alliance))
|
||||
else if (GetTeamScore(BatttleGroundTeamId.Horde) > GetTeamScore(BatttleGroundTeamId.Alliance))
|
||||
return Team.Horde;
|
||||
|
||||
return base.GetPrematureWinner();
|
||||
@@ -810,22 +810,22 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
public override ObjectGuid GetFlagPickerGUID(int team = -1)
|
||||
{
|
||||
if (team == TeamId.Alliance || team == TeamId.Horde)
|
||||
if (team == BatttleGroundTeamId.Alliance || team == BatttleGroundTeamId.Horde)
|
||||
return m_FlagKeepers[team];
|
||||
|
||||
return ObjectGuid.Empty;
|
||||
}
|
||||
|
||||
void SetAllianceFlagPicker(ObjectGuid guid) { m_FlagKeepers[TeamId.Alliance] = guid; }
|
||||
void SetHordeFlagPicker(ObjectGuid guid) { m_FlagKeepers[TeamId.Horde] = guid; }
|
||||
bool IsAllianceFlagPickedup() { return !m_FlagKeepers[TeamId.Alliance].IsEmpty(); }
|
||||
bool IsHordeFlagPickedup() { return !m_FlagKeepers[TeamId.Horde].IsEmpty(); }
|
||||
void SetAllianceFlagPicker(ObjectGuid guid) { m_FlagKeepers[BatttleGroundTeamId.Alliance] = guid; }
|
||||
void SetHordeFlagPicker(ObjectGuid guid) { m_FlagKeepers[BatttleGroundTeamId.Horde] = guid; }
|
||||
bool IsAllianceFlagPickedup() { return !m_FlagKeepers[BatttleGroundTeamId.Alliance].IsEmpty(); }
|
||||
bool IsHordeFlagPickedup() { return !m_FlagKeepers[BatttleGroundTeamId.Horde].IsEmpty(); }
|
||||
WSGFlagState GetFlagState(Team team) { return _flagState[GetTeamIndexByTeamId(team)]; }
|
||||
|
||||
void SetLastFlagCapture(Team team) { _lastFlagCaptureTeam = (uint)team; }
|
||||
public override void SetDroppedFlagGUID(ObjectGuid guid, int team = -1)
|
||||
{
|
||||
if (team == TeamId.Alliance || team == TeamId.Horde)
|
||||
if (team == BatttleGroundTeamId.Alliance || team == BatttleGroundTeamId.Horde)
|
||||
m_DroppedFlagGUID[team] = guid;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user