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:
@@ -500,7 +500,7 @@ namespace Framework.Constants
|
|||||||
Max
|
Max
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct TeamId
|
public struct BatttleGroundTeamId
|
||||||
{
|
{
|
||||||
public const int Alliance = 0;
|
public const int Alliance = 0;
|
||||||
public const int Horde = 1;
|
public const int Horde = 1;
|
||||||
|
|||||||
@@ -4599,7 +4599,7 @@ namespace Game.Achievements
|
|||||||
case CriteriaDataType.TTeam:
|
case CriteriaDataType.TTeam:
|
||||||
if (target == null || !target.IsTypeId(TypeId.Player))
|
if (target == null || !target.IsTypeId(TypeId.Player))
|
||||||
return false;
|
return false;
|
||||||
return (uint)target.ToPlayer().GetTeam() == TeamId.Team;
|
return target.ToPlayer().GetTeam() == (Team)TeamId.Team;
|
||||||
case CriteriaDataType.SDrunk:
|
case CriteriaDataType.SDrunk:
|
||||||
return Player.GetDrunkenstateByValue(source.GetDrunkValue()) >= (DrunkenState)Drunk.State;
|
return Player.GetDrunkenstateByValue(source.GetDrunkValue()) >= (DrunkenState)Drunk.State;
|
||||||
case CriteriaDataType.Holiday:
|
case CriteriaDataType.Holiday:
|
||||||
@@ -4612,7 +4612,7 @@ namespace Game.Achievements
|
|||||||
if (bg == null)
|
if (bg == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int score = (int)bg.GetTeamScore(bg.GetPlayerTeam(source.GetGUID()) == Team.Alliance ? Framework.Constants.TeamId.Horde : Framework.Constants.TeamId.Alliance);
|
int score = (int)bg.GetTeamScore(bg.GetPlayerTeam(source.GetGUID()) == Team.Alliance ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance);
|
||||||
return score >= BattlegroundScore.Min && score <= BattlegroundScore.Max;
|
return score >= BattlegroundScore.Min && score <= BattlegroundScore.Max;
|
||||||
}
|
}
|
||||||
case CriteriaDataType.InstanceScript:
|
case CriteriaDataType.InstanceScript:
|
||||||
|
|||||||
@@ -146,17 +146,17 @@ namespace Game.Arenas
|
|||||||
|
|
||||||
// In case of arena draw, follow this logic:
|
// In case of arena draw, follow this logic:
|
||||||
// winnerArenaTeam => ALLIANCE, loserArenaTeam => HORDE
|
// winnerArenaTeam => ALLIANCE, loserArenaTeam => HORDE
|
||||||
ArenaTeam winnerArenaTeam = Global.ArenaTeamMgr.GetArenaTeamById(GetArenaTeamIdForTeam(winner == 0 ? Team.Alliance : winner));
|
ArenaTeam winnerArenaTeam = Global.ArenaTeamMgr.GetArenaTeamById(GetArenaTeamIdForTeam(winner == Team.Other ? Team.Alliance : winner));
|
||||||
ArenaTeam loserArenaTeam = Global.ArenaTeamMgr.GetArenaTeamById(GetArenaTeamIdForTeam(winner == 0 ? Team.Horde : GetOtherTeam(winner)));
|
ArenaTeam loserArenaTeam = Global.ArenaTeamMgr.GetArenaTeamById(GetArenaTeamIdForTeam(winner == Team.Other ? Team.Horde : GetOtherTeam(winner)));
|
||||||
|
|
||||||
if (winnerArenaTeam != null && loserArenaTeam != null && winnerArenaTeam != loserArenaTeam)
|
if (winnerArenaTeam != null && loserArenaTeam != null && winnerArenaTeam != loserArenaTeam)
|
||||||
{
|
{
|
||||||
// In case of arena draw, follow this logic:
|
// In case of arena draw, follow this logic:
|
||||||
// winnerMatchmakerRating => ALLIANCE, loserMatchmakerRating => HORDE
|
// winnerMatchmakerRating => ALLIANCE, loserMatchmakerRating => HORDE
|
||||||
loserTeamRating = loserArenaTeam.GetRating();
|
loserTeamRating = loserArenaTeam.GetRating();
|
||||||
loserMatchmakerRating = GetArenaMatchmakerRating(winner == 0 ? Team.Horde : GetOtherTeam(winner));
|
loserMatchmakerRating = GetArenaMatchmakerRating(winner == Team.Other ? Team.Horde : GetOtherTeam(winner));
|
||||||
winnerTeamRating = winnerArenaTeam.GetRating();
|
winnerTeamRating = winnerArenaTeam.GetRating();
|
||||||
winnerMatchmakerRating = GetArenaMatchmakerRating(winner == 0 ? Team.Alliance : winner);
|
winnerMatchmakerRating = GetArenaMatchmakerRating(winner == Team.Other ? Team.Alliance : winner);
|
||||||
|
|
||||||
if (winner != 0)
|
if (winner != 0)
|
||||||
{
|
{
|
||||||
@@ -179,7 +179,7 @@ namespace Game.Arenas
|
|||||||
_arenaTeamScores[loserTeam].Assign(loserTeamRating, (uint)(loserTeamRating + loserChange), loserMatchmakerRating, GetArenaMatchmakerRating(GetOtherTeam(winner)));
|
_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}",
|
Log.outDebug(LogFilter.Arena, "Arena match Type: {0} for Team1Id: {1} - Team2Id: {2} ended. WinnerTeamId: {3}. Winner rating: +{4}, Loser rating: {5}",
|
||||||
GetArenaType(), GetArenaTeamIdByIndex(TeamId.Alliance), GetArenaTeamIdByIndex(TeamId.Horde), winnerArenaTeam.GetId(), winnerChange, loserChange);
|
GetArenaType(), GetArenaTeamIdByIndex(BatttleGroundTeamId.Alliance), GetArenaTeamIdByIndex(BatttleGroundTeamId.Horde), winnerArenaTeam.GetId(), winnerChange, loserChange);
|
||||||
|
|
||||||
if (WorldConfig.GetBoolValue(WorldCfg.ArenaLogExtendedInfo))
|
if (WorldConfig.GetBoolValue(WorldCfg.ArenaLogExtendedInfo))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -92,9 +92,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.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 &= 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, TeamId.Neutral, BattlegroundConst.RespawnImmediately) != null;
|
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, TeamId.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, TeamId.Neutral, BattlegroundConst.RespawnImmediately) != null;
|
result &= AddCreature(DalaranSewersData.NpcWaterSpout, DalaranSewersCreatureTypes.PipeKnockback2, 1212.833f, 765.3871f, 16.09484f, 0.0f, BatttleGroundTeamId.Neutral, BattlegroundConst.RespawnImmediately) != null;
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "DalaranSewersArena: Failed to spawn collision object!");
|
Log.outError(LogFilter.Sql, "DalaranSewersArena: Failed to spawn collision object!");
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Game.BattleFields
|
|||||||
public BattleField(Map map)
|
public BattleField(Map map)
|
||||||
{
|
{
|
||||||
m_IsEnabled = true;
|
m_IsEnabled = true;
|
||||||
m_DefenderTeam = TeamId.Neutral;
|
m_DefenderTeam = BatttleGroundTeamId.Neutral;
|
||||||
|
|
||||||
m_TimeForAcceptInvite = 20;
|
m_TimeForAcceptInvite = 20;
|
||||||
m_uiKickDontAcceptTimer = 1000;
|
m_uiKickDontAcceptTimer = 1000;
|
||||||
@@ -705,7 +705,7 @@ namespace Game.BattleFields
|
|||||||
// Battlefield - generic methods
|
// Battlefield - generic methods
|
||||||
public uint GetDefenderTeam() { return m_DefenderTeam; }
|
public uint GetDefenderTeam() { return m_DefenderTeam; }
|
||||||
public uint GetAttackerTeam() { return 1 - m_DefenderTeam; }
|
public uint GetAttackerTeam() { return 1 - m_DefenderTeam; }
|
||||||
public int GetOtherTeam(int teamIndex) { return (teamIndex == TeamId.Horde ? TeamId.Alliance : TeamId.Horde); }
|
public int GetOtherTeam(int teamIndex) { return (teamIndex == BatttleGroundTeamId.Horde ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde); }
|
||||||
void SetDefenderTeam(uint team) { m_DefenderTeam = team; }
|
void SetDefenderTeam(uint team) { m_DefenderTeam = team; }
|
||||||
|
|
||||||
// Called on start
|
// Called on start
|
||||||
@@ -790,7 +790,7 @@ namespace Game.BattleFields
|
|||||||
{
|
{
|
||||||
m_Bf = battlefield;
|
m_Bf = battlefield;
|
||||||
m_GraveyardId = 0;
|
m_GraveyardId = 0;
|
||||||
m_ControlTeam = TeamId.Neutral;
|
m_ControlTeam = BatttleGroundTeamId.Neutral;
|
||||||
m_SpiritGuide[0] = ObjectGuid.Empty;
|
m_SpiritGuide[0] = ObjectGuid.Empty;
|
||||||
m_SpiritGuide[1] = ObjectGuid.Empty;
|
m_SpiritGuide[1] = ObjectGuid.Empty;
|
||||||
}
|
}
|
||||||
@@ -838,14 +838,14 @@ namespace Game.BattleFields
|
|||||||
|
|
||||||
public bool HasNpc(ObjectGuid guid)
|
public bool HasNpc(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
if (m_SpiritGuide[TeamId.Alliance].IsEmpty() || m_SpiritGuide[TeamId.Horde].IsEmpty())
|
if (m_SpiritGuide[BatttleGroundTeamId.Alliance].IsEmpty() || m_SpiritGuide[BatttleGroundTeamId.Horde].IsEmpty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (m_Bf.GetCreature(m_SpiritGuide[TeamId.Alliance]) == null ||
|
if (m_Bf.GetCreature(m_SpiritGuide[BatttleGroundTeamId.Alliance]) == null ||
|
||||||
m_Bf.GetCreature(m_SpiritGuide[TeamId.Horde]) == null)
|
m_Bf.GetCreature(m_SpiritGuide[BatttleGroundTeamId.Horde]) == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return (m_SpiritGuide[TeamId.Alliance] == guid || m_SpiritGuide[TeamId.Horde] == guid);
|
return (m_SpiritGuide[BatttleGroundTeamId.Alliance] == guid || m_SpiritGuide[BatttleGroundTeamId.Horde] == guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the graveyard's ID.
|
// Get the graveyard's ID.
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ namespace Game.BattleGrounds
|
|||||||
{
|
{
|
||||||
if (GetElapsedTime() >= 47 * Time.Minute * Time.InMilliseconds)
|
if (GetElapsedTime() >= 47 * Time.Minute * Time.InMilliseconds)
|
||||||
{
|
{
|
||||||
EndBattleground(0);
|
EndBattleground(Team.Other);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,7 @@ namespace Game.BattleGrounds
|
|||||||
|
|
||||||
public virtual Team GetPrematureWinner()
|
public virtual Team GetPrematureWinner()
|
||||||
{
|
{
|
||||||
Team winner = 0;
|
Team winner = Team.Other;
|
||||||
if (GetPlayersCountByTeam(Team.Alliance) >= GetMinPlayersPerTeam())
|
if (GetPlayersCountByTeam(Team.Alliance) >= GetMinPlayersPerTeam())
|
||||||
winner = Team.Alliance;
|
winner = Team.Alliance;
|
||||||
else if (GetPlayersCountByTeam(Team.Horde) >= GetMinPlayersPerTeam())
|
else if (GetPlayersCountByTeam(Team.Horde) >= GetMinPlayersPerTeam())
|
||||||
@@ -447,15 +447,15 @@ namespace Game.BattleGrounds
|
|||||||
return _GetPlayer(pair.Key, pair.Value.OfflineRemoveTime != 0, context);
|
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);
|
Player player = _GetPlayer(pair, context);
|
||||||
if (player != null)
|
if (player != null)
|
||||||
{
|
{
|
||||||
Team team = pair.Value.Team;
|
Team playerTeam = pair.Value.Team;
|
||||||
if (team == 0)
|
if (playerTeam == 0)
|
||||||
team = player.GetEffectiveTeam();
|
playerTeam = player.GetEffectiveTeam();
|
||||||
if (team != teamId)
|
if (playerTeam != team)
|
||||||
player = null;
|
player = null;
|
||||||
}
|
}
|
||||||
return player;
|
return player;
|
||||||
@@ -469,7 +469,7 @@ namespace Game.BattleGrounds
|
|||||||
|
|
||||||
public WorldSafeLocsEntry GetTeamStartPosition(int teamId)
|
public WorldSafeLocsEntry GetTeamStartPosition(int teamId)
|
||||||
{
|
{
|
||||||
Cypher.Assert(teamId < TeamId.Neutral);
|
Cypher.Assert(teamId < BatttleGroundTeamId.Neutral);
|
||||||
return _battlegroundTemplate.StartLocation[teamId];
|
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)
|
foreach (var pair in m_Players)
|
||||||
{
|
{
|
||||||
@@ -874,7 +874,7 @@ namespace Game.BattleGrounds
|
|||||||
// Do next only if found in Battleground
|
// Do next only if found in Battleground
|
||||||
player.SetBattlegroundId(0, BattlegroundTypeId.None); // We're not in BG.
|
player.SetBattlegroundId(0, BattlegroundTypeId.None); // We're not in BG.
|
||||||
// reset destination bg team
|
// reset destination bg team
|
||||||
player.SetBGTeam(0);
|
player.SetBGTeam(Team.Other);
|
||||||
|
|
||||||
// remove all criterias on bg leave
|
// remove all criterias on bg leave
|
||||||
player.FailCriteria(CriteriaFailEvent.LeaveBattleground, 0);
|
player.FailCriteria(CriteriaFailEvent.LeaveBattleground, 0);
|
||||||
@@ -923,7 +923,7 @@ namespace Game.BattleGrounds
|
|||||||
Global.BattlegroundMgr.AddBattleground(this);
|
Global.BattlegroundMgr.AddBattleground(this);
|
||||||
|
|
||||||
if (m_IsRated)
|
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)
|
public void TeleportPlayerToExploitLocation(Player player)
|
||||||
@@ -1149,11 +1149,11 @@ namespace Game.BattleGrounds
|
|||||||
|
|
||||||
// get the number of free slots for team
|
// get the number of free slots for team
|
||||||
// returns the number how many players can join Battleground to MaxPlayersPerTeam
|
// 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 BG is starting and WorldCfg.BattlegroundInvitationType == BattlegroundQueueInvitationTypeB.NoBalance, invite anyone
|
||||||
if (GetStatus() == BattlegroundStatus.WaitJoin && WorldConfig.GetIntValue(WorldCfg.BattlegroundInvitationType) == (int)BattlegroundQueueInvitationType.NoBalance)
|
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
|
// if BG is already started or WorldCfg.BattlegroundInvitationType != BattlegroundQueueInvitationType.NoBalance, do not allow to join too much players of one faction
|
||||||
uint otherTeamInvitedCount;
|
uint otherTeamInvitedCount;
|
||||||
@@ -1161,7 +1161,7 @@ namespace Game.BattleGrounds
|
|||||||
uint otherTeamPlayersCount;
|
uint otherTeamPlayersCount;
|
||||||
uint thisTeamPlayersCount;
|
uint thisTeamPlayersCount;
|
||||||
|
|
||||||
if (Team == Team.Alliance)
|
if (team == Team.Alliance)
|
||||||
{
|
{
|
||||||
thisTeamInvitedCount = GetInvitedCount(Team.Alliance);
|
thisTeamInvitedCount = GetInvitedCount(Team.Alliance);
|
||||||
otherTeamInvitedCount = GetInvitedCount(Team.Horde);
|
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();
|
Map map = FindBgMap();
|
||||||
if (map == null)
|
if (map == null)
|
||||||
@@ -1467,7 +1467,7 @@ namespace Game.BattleGrounds
|
|||||||
return creature;
|
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);
|
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)
|
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)
|
if (AddCreature(entry, type, x, y, z, o) != null)
|
||||||
return true;
|
return true;
|
||||||
@@ -1536,7 +1536,7 @@ namespace Game.BattleGrounds
|
|||||||
return false;
|
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);
|
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);
|
var player = m_Players.LookupByKey(guid);
|
||||||
if (player != null)
|
if (player != null)
|
||||||
return player.Team;
|
return player.Team;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Team GetOtherTeam(Team teamId)
|
|
||||||
{
|
|
||||||
switch (teamId)
|
|
||||||
{
|
|
||||||
case Team.Alliance:
|
|
||||||
return Team.Horde;
|
|
||||||
case Team.Horde:
|
|
||||||
return Team.Alliance;
|
|
||||||
default:
|
|
||||||
return Team.Other;
|
return Team.Other;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Team GetOtherTeam(Team team)
|
||||||
|
{
|
||||||
|
return team != 0 ? ((team == Team.Alliance) ? Team.Horde : Team.Alliance) : Team.Other;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsPlayerInBattleground(ObjectGuid guid)
|
public bool IsPlayerInBattleground(ObjectGuid guid)
|
||||||
@@ -1665,12 +1657,12 @@ namespace Game.BattleGrounds
|
|||||||
player.SendPacket(pvpMatchStatistics);
|
player.SendPacket(pvpMatchStatistics);
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint GetAlivePlayersCountByTeam(Team Team)
|
public uint GetAlivePlayersCountByTeam(Team team)
|
||||||
{
|
{
|
||||||
uint count = 0;
|
uint count = 0;
|
||||||
foreach (var pair in m_Players)
|
foreach (var pair in m_Players)
|
||||||
{
|
{
|
||||||
if (pair.Value.Team == Team)
|
if (pair.Value.Team == team)
|
||||||
{
|
{
|
||||||
Player player = Global.ObjAccessor.FindPlayer(pair.Key);
|
Player player = Global.ObjAccessor.FindPlayer(pair.Key);
|
||||||
if (player != null && player.IsAlive())
|
if (player != null && player.IsAlive())
|
||||||
@@ -1680,7 +1672,7 @@ namespace Game.BattleGrounds
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetObjectType(ObjectGuid guid)
|
public int GetObjectType(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < BgObjects.Length; ++i)
|
for (int i = 0; i < BgObjects.Length; ++i)
|
||||||
if (BgObjects[i] == guid)
|
if (BgObjects[i] == guid)
|
||||||
@@ -1689,7 +1681,7 @@ namespace Game.BattleGrounds
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetBgRaid(Team team, Group bg_raid)
|
public void SetBgRaid(Team team, Group bg_raid)
|
||||||
{
|
{
|
||||||
Group old_raid = m_BgRaids[GetTeamIndexByTeamId(team)];
|
Group old_raid = m_BgRaids[GetTeamIndexByTeamId(team)];
|
||||||
if (old_raid != null)
|
if (old_raid != null)
|
||||||
@@ -1729,7 +1721,7 @@ namespace Game.BattleGrounds
|
|||||||
|
|
||||||
public uint GetTeamScore(int teamIndex)
|
public uint GetTeamScore(int teamIndex)
|
||||||
{
|
{
|
||||||
if (teamIndex == TeamId.Alliance || teamIndex == TeamId.Horde)
|
if (teamIndex == BatttleGroundTeamId.Alliance || teamIndex == BatttleGroundTeamId.Horde)
|
||||||
return m_TeamScores[teamIndex];
|
return m_TeamScores[teamIndex];
|
||||||
|
|
||||||
Log.outError(LogFilter.Battleground, "GetTeamScore with wrong Team {0} for BG {1}", teamIndex, GetTypeID());
|
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)]; }
|
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)]; }
|
public uint GetPlayersCountByTeam(Team team) { return m_PlayersCount[GetTeamIndexByTeamId(team)]; }
|
||||||
void UpdatePlayersCountByTeam(Team team, bool remove)
|
void UpdatePlayersCountByTeam(Team team, bool remove)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ namespace Game.BattleGrounds
|
|||||||
battlefieldStatus = new BattlefieldStatusActive();
|
battlefieldStatus = new BattlefieldStatusActive();
|
||||||
BuildBattlegroundStatusHeader(battlefieldStatus.Hdr, player, ticketId, joinTime, queueId);
|
BuildBattlegroundStatusHeader(battlefieldStatus.Hdr, player, ticketId, joinTime, queueId);
|
||||||
battlefieldStatus.ShutdownTimer = bg.GetRemainingTime();
|
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.LeftEarly = false;
|
||||||
battlefieldStatus.StartTimer = bg.GetElapsedTime();
|
battlefieldStatus.StartTimer = bg.GetElapsedTime();
|
||||||
battlefieldStatus.Mapid = bg.GetMapId();
|
battlefieldStatus.Mapid = bg.GetMapId();
|
||||||
@@ -350,8 +350,8 @@ namespace Game.BattleGrounds
|
|||||||
uint startId = result.Read<uint>(1);
|
uint startId = result.Read<uint>(1);
|
||||||
WorldSafeLocsEntry start = Global.ObjectMgr.GetWorldSafeLoc(startId);
|
WorldSafeLocsEntry start = Global.ObjectMgr.GetWorldSafeLoc(startId);
|
||||||
if (start != null)
|
if (start != null)
|
||||||
bgTemplate.StartLocation[TeamId.Alliance] = start;
|
bgTemplate.StartLocation[BatttleGroundTeamId.Alliance] = start;
|
||||||
else if (bgTemplate.StartLocation[TeamId.Alliance] != null) // reload case
|
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.");
|
Log.outError(LogFilter.Sql, $"Table `battleground_template` for id {bgTemplate.Id} contains a non-existing WorldSafeLocs.dbc id {startId} in field `AllianceStartLoc`. Ignoring.");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -362,8 +362,8 @@ namespace Game.BattleGrounds
|
|||||||
startId = result.Read<uint>(2);
|
startId = result.Read<uint>(2);
|
||||||
start = Global.ObjectMgr.GetWorldSafeLoc(startId);
|
start = Global.ObjectMgr.GetWorldSafeLoc(startId);
|
||||||
if (start != null)
|
if (start != null)
|
||||||
bgTemplate.StartLocation[TeamId.Horde] = start;
|
bgTemplate.StartLocation[BatttleGroundTeamId.Horde] = start;
|
||||||
else if (bgTemplate.StartLocation[TeamId.Horde] != null) // reload case
|
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.");
|
Log.outError(LogFilter.Sql, $"Table `battleground_template` for id {bgTemplate.Id} contains a non-existing WorldSafeLocs.dbc id {startId} in field `HordeStartLoc`. Ignoring.");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -153,16 +153,16 @@ namespace Game.BattleGrounds
|
|||||||
void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo ginfo, BattlegroundBracketId bracket_id)
|
void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo ginfo, BattlegroundBracketId bracket_id)
|
||||||
{
|
{
|
||||||
uint timeInQueue = Time.GetMSTimeDiff(ginfo.JoinTime, GameTime.GetGameTimeMS());
|
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 (m_queueId.TeamSize == 0)
|
||||||
{
|
{
|
||||||
if (ginfo.Team == Team.Horde)
|
if (ginfo.Team == Team.Horde)
|
||||||
team_index = TeamId.Horde;
|
team_index = BatttleGroundTeamId.Horde;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_queueId.Rated)
|
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
|
//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)
|
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 (m_queueId.TeamSize == 0)
|
||||||
{
|
{
|
||||||
if (ginfo.Team == Team.Horde)
|
if (ginfo.Team == Team.Horde)
|
||||||
team_index = TeamId.Horde;
|
team_index = BatttleGroundTeamId.Horde;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_queueId.Rated)
|
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)
|
//check if there is enought values(we always add values > 0)
|
||||||
if (m_WaitTimes[team_index][(int)bracket_id][SharedConst.CountOfPlayersToAverageWaitTime - 1] != 0)
|
if (m_WaitTimes[team_index][(int)bracket_id][SharedConst.CountOfPlayersToAverageWaitTime - 1] != 0)
|
||||||
@@ -453,7 +453,7 @@ namespace Game.BattleGrounds
|
|||||||
{
|
{
|
||||||
int listIndex = 0;
|
int listIndex = 0;
|
||||||
var info = m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalAlliance].FirstOrDefault();
|
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++];
|
info = m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalAlliance][listIndex++];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -462,7 +462,7 @@ namespace Game.BattleGrounds
|
|||||||
{
|
{
|
||||||
int listIndex = 0;
|
int listIndex = 0;
|
||||||
var info = m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalHorde].FirstOrDefault();
|
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++];
|
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
|
// At first we need to compare free space in bg and our selection pool
|
||||||
int diffAli = (int)(aliFree - m_SelectionPools[TeamId.Alliance].GetPlayerCount());
|
int diffAli = (int)(aliFree - m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount());
|
||||||
int diffHorde = (int)(hordeFree - m_SelectionPools[TeamId.Horde].GetPlayerCount());
|
int diffHorde = (int)(hordeFree - m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount());
|
||||||
while (Math.Abs(diffAli - diffHorde) > 1 && (m_SelectionPools[TeamId.Horde].GetPlayerCount() > 0 || m_SelectionPools[TeamId.Alliance].GetPlayerCount() > 0))
|
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
|
//each cycle execution we need to kick at least 1 group
|
||||||
if (diffAli < diffHorde)
|
if (diffAli < diffHorde)
|
||||||
{
|
{
|
||||||
//kick alliance group, add to pool new group if needed
|
//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;
|
++alyIndex;
|
||||||
}
|
}
|
||||||
//if ali selection is already empty, then kick horde group, but if there are less horde than ali in bg - break;
|
//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)
|
if (aliFree <= diffHorde + 1)
|
||||||
break;
|
break;
|
||||||
m_SelectionPools[TeamId.Horde].KickGroup((uint)(diffHorde - diffAli));
|
m_SelectionPools[BatttleGroundTeamId.Horde].KickGroup((uint)(diffHorde - diffAli));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//kick horde group, add to pool new group if needed
|
//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;
|
++hordeIndex;
|
||||||
}
|
}
|
||||||
if (m_SelectionPools[TeamId.Horde].GetPlayerCount() == 0)
|
if (m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() == 0)
|
||||||
{
|
{
|
||||||
if (hordeFree <= diffAli + 1)
|
if (hordeFree <= diffAli + 1)
|
||||||
break;
|
break;
|
||||||
m_SelectionPools[TeamId.Alliance].KickGroup((uint)(diffAli - diffHorde));
|
m_SelectionPools[BatttleGroundTeamId.Alliance].KickGroup((uint)(diffAli - diffHorde));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//count diffs after small update
|
//count diffs after small update
|
||||||
diffAli = (int)(aliFree - m_SelectionPools[TeamId.Alliance].GetPlayerCount());
|
diffAli = (int)(aliFree - m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount());
|
||||||
diffHorde = (int)(hordeFree - m_SelectionPools[TeamId.Horde].GetPlayerCount());
|
diffHorde = (int)(hordeFree - m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -547,10 +547,10 @@ namespace Game.BattleGrounds
|
|||||||
|
|
||||||
if (ali_group != null && horde_group != null)
|
if (ali_group != null && horde_group != null)
|
||||||
{
|
{
|
||||||
m_SelectionPools[TeamId.Alliance].AddGroup(ali_group, MaxPlayersPerTeam);
|
m_SelectionPools[BatttleGroundTeamId.Alliance].AddGroup(ali_group, MaxPlayersPerTeam);
|
||||||
m_SelectionPools[TeamId.Horde].AddGroup(horde_group, MaxPlayersPerTeam);
|
m_SelectionPools[BatttleGroundTeamId.Horde].AddGroup(horde_group, MaxPlayersPerTeam);
|
||||||
//add groups/players from normal queue to size of bigger group
|
//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++)
|
for (uint i = 0; i < SharedConst.PvpTeamsCount; i++)
|
||||||
{
|
{
|
||||||
foreach (var groupQueueInfo in m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalAlliance + 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
|
//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;
|
uint j = BatttleGroundTeamId.Alliance;
|
||||||
if (m_SelectionPools[TeamId.Horde].GetPlayerCount() < m_SelectionPools[TeamId.Alliance].GetPlayerCount())
|
if (m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() < m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount())
|
||||||
j = TeamId.Horde;
|
j = BatttleGroundTeamId.Horde;
|
||||||
|
|
||||||
if (WorldConfig.GetIntValue(WorldCfg.BattlegroundInvitationType) != (int)BattlegroundQueueInvitationType.NoBalance
|
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
|
//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;
|
++(teamIndex[j]); //this will not cause a crash, because for cycle above reached break;
|
||||||
@@ -622,29 +622,29 @@ namespace Game.BattleGrounds
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// do not allow to start bg with more than 2 players more on 1 faction
|
// 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;
|
return false;
|
||||||
}
|
}
|
||||||
//allow 1v0 if debug bg
|
//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;
|
||||||
//return true if there are enough players in selection pools - enable to work .debug bg command correctly
|
//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
|
// this method will check if we can invite players to same faction skirmish match
|
||||||
bool CheckSkirmishForSameFaction(BattlegroundBracketId bracket_id, uint minPlayersPerTeam)
|
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;
|
return false;
|
||||||
|
|
||||||
uint teamIndex = TeamId.Alliance;
|
uint teamIndex = BatttleGroundTeamId.Alliance;
|
||||||
uint otherTeam = TeamId.Horde;
|
uint otherTeam = BatttleGroundTeamId.Horde;
|
||||||
Team otherTeamId = Team.Horde;
|
Team otherTeamId = Team.Horde;
|
||||||
if (m_SelectionPools[TeamId.Horde].GetPlayerCount() == minPlayersPerTeam)
|
if (m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() == minPlayersPerTeam)
|
||||||
{
|
{
|
||||||
teamIndex = TeamId.Horde;
|
teamIndex = BatttleGroundTeamId.Horde;
|
||||||
otherTeam = TeamId.Alliance;
|
otherTeam = BatttleGroundTeamId.Alliance;
|
||||||
otherTeamId = Team.Alliance;
|
otherTeamId = Team.Alliance;
|
||||||
}
|
}
|
||||||
//clear other team's selection
|
//clear other team's selection
|
||||||
@@ -744,17 +744,17 @@ namespace Game.BattleGrounds
|
|||||||
bg.GetStatus() > BattlegroundStatus.WaitQueue && bg.GetStatus() < BattlegroundStatus.WaitLeave)
|
bg.GetStatus() > BattlegroundStatus.WaitQueue && bg.GetStatus() < BattlegroundStatus.WaitLeave)
|
||||||
{
|
{
|
||||||
// clear selection pools
|
// clear selection pools
|
||||||
m_SelectionPools[TeamId.Alliance].Init();
|
m_SelectionPools[BatttleGroundTeamId.Alliance].Init();
|
||||||
m_SelectionPools[TeamId.Horde].Init();
|
m_SelectionPools[BatttleGroundTeamId.Horde].Init();
|
||||||
|
|
||||||
// call a function that does the job for us
|
// call a function that does the job for us
|
||||||
FillPlayersToBG(bg, bracket_id);
|
FillPlayersToBG(bg, bracket_id);
|
||||||
|
|
||||||
// now everything is set, invite players
|
// 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);
|
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);
|
InviteGroupToBG(queueInfo, bg, queueInfo.Team);
|
||||||
|
|
||||||
if (!bg.HasFreeSlots())
|
if (!bg.HasFreeSlots())
|
||||||
@@ -777,8 +777,8 @@ namespace Game.BattleGrounds
|
|||||||
else if (Global.BattlegroundMgr.IsTesting())
|
else if (Global.BattlegroundMgr.IsTesting())
|
||||||
MinPlayersPerTeam = 1;
|
MinPlayersPerTeam = 1;
|
||||||
|
|
||||||
m_SelectionPools[TeamId.Alliance].Init();
|
m_SelectionPools[BatttleGroundTeamId.Alliance].Init();
|
||||||
m_SelectionPools[TeamId.Horde].Init();
|
m_SelectionPools[BatttleGroundTeamId.Horde].Init();
|
||||||
|
|
||||||
if (!bg_template.IsArena())
|
if (!bg_template.IsArena())
|
||||||
{
|
{
|
||||||
@@ -793,13 +793,13 @@ namespace Game.BattleGrounds
|
|||||||
}
|
}
|
||||||
// invite those selection pools
|
// invite those selection pools
|
||||||
for (uint i = 0; i < SharedConst.PvpTeamsCount; i++)
|
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);
|
InviteGroupToBG(queueInfo, bg2, queueInfo.Team);
|
||||||
|
|
||||||
bg2.StartBattleground();
|
bg2.StartBattleground();
|
||||||
//clear structures
|
//clear structures
|
||||||
m_SelectionPools[TeamId.Alliance].Init();
|
m_SelectionPools[BatttleGroundTeamId.Alliance].Init();
|
||||||
m_SelectionPools[TeamId.Horde].Init();
|
m_SelectionPools[BatttleGroundTeamId.Horde].Init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -821,7 +821,7 @@ namespace Game.BattleGrounds
|
|||||||
// invite those selection pools
|
// invite those selection pools
|
||||||
for (uint i = 0; i < SharedConst.PvpTeamsCount; i++)
|
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);
|
InviteGroupToBG(queueInfo, bg2, queueInfo.Team);
|
||||||
}
|
}
|
||||||
// start bg
|
// start bg
|
||||||
@@ -908,8 +908,8 @@ namespace Game.BattleGrounds
|
|||||||
//if we have 2 teams, then start new arena and invite players!
|
//if we have 2 teams, then start new arena and invite players!
|
||||||
if (found == 2)
|
if (found == 2)
|
||||||
{
|
{
|
||||||
GroupQueueInfo aTeam = queueArray[TeamId.Alliance];
|
GroupQueueInfo aTeam = queueArray[BatttleGroundTeamId.Alliance];
|
||||||
GroupQueueInfo hTeam = queueArray[TeamId.Horde];
|
GroupQueueInfo hTeam = queueArray[BatttleGroundTeamId.Horde];
|
||||||
Battleground arena = Global.BattlegroundMgr.CreateNewBattleground(m_queueId, bracket_id);
|
Battleground arena = Global.BattlegroundMgr.CreateNewBattleground(m_queueId, bracket_id);
|
||||||
if (arena == null)
|
if (arena == null)
|
||||||
{
|
{
|
||||||
@@ -928,12 +928,12 @@ namespace Game.BattleGrounds
|
|||||||
if (aTeam.Team != Team.Alliance)
|
if (aTeam.Team != Team.Alliance)
|
||||||
{
|
{
|
||||||
m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueuePremadeAlliance].Insert(0, aTeam);
|
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)
|
if (hTeam.Team != Team.Horde)
|
||||||
{
|
{
|
||||||
m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueuePremadeHorde].Insert(0, hTeam);
|
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);
|
arena.SetArenaMatchmakerRating(Team.Alliance, aTeam.ArenaMatchmakerRating);
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
// create new occupied banner
|
// create new occupied banner
|
||||||
_CreateBanner(node, ABNodeStatus.Occupied, teamIndex, true);
|
_CreateBanner(node, ABNodeStatus.Occupied, teamIndex, true);
|
||||||
_SendNodeUpdate(node);
|
_SendNodeUpdate(node);
|
||||||
_NodeOccupied(node, (teamIndex == TeamId.Alliance) ? Team.Alliance : Team.Horde);
|
_NodeOccupied(node, (teamIndex == BatttleGroundTeamId.Alliance) ? Team.Alliance : Team.Horde);
|
||||||
// Message to chatlog
|
// Message to chatlog
|
||||||
|
|
||||||
if (teamIndex == 0)
|
if (teamIndex == 0)
|
||||||
@@ -114,7 +114,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
|
|
||||||
if (m_ReputationScoreTics[team] >= m_ReputationTics)
|
if (m_ReputationScoreTics[team] >= m_ReputationTics)
|
||||||
{
|
{
|
||||||
if (team == TeamId.Alliance)
|
if (team == BatttleGroundTeamId.Alliance)
|
||||||
RewardReputationToTeam(509, 10, Team.Alliance);
|
RewardReputationToTeam(509, 10, Team.Alliance);
|
||||||
else
|
else
|
||||||
RewardReputationToTeam(510, 10, Team.Horde);
|
RewardReputationToTeam(510, 10, Team.Horde);
|
||||||
@@ -124,13 +124,13 @@ namespace Game.BattleGrounds.Zones
|
|||||||
|
|
||||||
if (m_HonorScoreTics[team] >= m_HonorTics)
|
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;
|
m_HonorScoreTics[team] -= m_HonorTics;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_IsInformedNearVictory && m_TeamScores[team] > WarningNearVictoryScore)
|
if (!m_IsInformedNearVictory && m_TeamScores[team] > WarningNearVictoryScore)
|
||||||
{
|
{
|
||||||
if (team == TeamId.Alliance)
|
if (team == BatttleGroundTeamId.Alliance)
|
||||||
{
|
{
|
||||||
SendBroadcastText(ABBattlegroundBroadcastTexts.AllianceNearVictory, ChatMsg.BgSystemNeutral);
|
SendBroadcastText(ABBattlegroundBroadcastTexts.AllianceNearVictory, ChatMsg.BgSystemNeutral);
|
||||||
PlaySoundToAll(SoundNearVictoryAlliance);
|
PlaySoundToAll(SoundNearVictoryAlliance);
|
||||||
@@ -146,7 +146,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
if (m_TeamScores[team] > MaxTeamScore)
|
if (m_TeamScores[team] > MaxTeamScore)
|
||||||
m_TeamScores[team] = MaxTeamScore;
|
m_TeamScores[team] = MaxTeamScore;
|
||||||
|
|
||||||
if (team == TeamId.Alliance)
|
if (team == BatttleGroundTeamId.Alliance)
|
||||||
UpdateWorldState(ABWorldStates.ResourcesAlly, (int)m_TeamScores[team]);
|
UpdateWorldState(ABWorldStates.ResourcesAlly, (int)m_TeamScores[team]);
|
||||||
else
|
else
|
||||||
UpdateWorldState(ABWorldStates.ResourcesHorde, (int)m_TeamScores[team]);
|
UpdateWorldState(ABWorldStates.ResourcesHorde, (int)m_TeamScores[team]);
|
||||||
@@ -155,7 +155,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
int otherTeam = (team + 1) % SharedConst.PvpTeamsCount;
|
int otherTeam = (team + 1) % SharedConst.PvpTeamsCount;
|
||||||
if (m_TeamScores[team] > m_TeamScores[otherTeam] + 500)
|
if (m_TeamScores[team] > m_TeamScores[otherTeam] + 500)
|
||||||
{
|
{
|
||||||
if (team == TeamId.Alliance)
|
if (team == BatttleGroundTeamId.Alliance)
|
||||||
UpdateWorldState(ABWorldStates.Had500DisadvantageHorde, 1);
|
UpdateWorldState(ABWorldStates.Had500DisadvantageHorde, 1);
|
||||||
else
|
else
|
||||||
UpdateWorldState(ABWorldStates.Had500DisadvantageAlliance, 1);
|
UpdateWorldState(ABWorldStates.Had500DisadvantageAlliance, 1);
|
||||||
@@ -164,9 +164,9 @@ namespace Game.BattleGrounds.Zones
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Test win condition
|
// Test win condition
|
||||||
if (m_TeamScores[TeamId.Alliance] >= MaxTeamScore)
|
if (m_TeamScores[BatttleGroundTeamId.Alliance] >= MaxTeamScore)
|
||||||
EndBattleground(Team.Alliance);
|
EndBattleground(Team.Alliance);
|
||||||
else if (m_TeamScores[TeamId.Horde] >= MaxTeamScore)
|
else if (m_TeamScores[BatttleGroundTeamId.Horde] >= MaxTeamScore)
|
||||||
EndBattleground(Team.Horde);
|
EndBattleground(Team.Horde);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -411,7 +411,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
m_NodeTimers[node] = FlagCapturingTime;
|
m_NodeTimers[node] = FlagCapturingTime;
|
||||||
|
|
||||||
// FIXME: team and node names not localized
|
// FIXME: team and node names not localized
|
||||||
if (teamIndex == TeamId.Alliance)
|
if (teamIndex == BatttleGroundTeamId.Alliance)
|
||||||
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextAllianceClaims, ChatMsg.BgSystemAlliance, source);
|
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextAllianceClaims, ChatMsg.BgSystemAlliance, source);
|
||||||
else
|
else
|
||||||
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextHordeClaims, ChatMsg.BgSystemHorde, source);
|
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextHordeClaims, ChatMsg.BgSystemHorde, source);
|
||||||
@@ -434,7 +434,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
_SendNodeUpdate(node);
|
_SendNodeUpdate(node);
|
||||||
m_NodeTimers[node] = FlagCapturingTime;
|
m_NodeTimers[node] = FlagCapturingTime;
|
||||||
|
|
||||||
if (teamIndex == TeamId.Alliance)
|
if (teamIndex == BatttleGroundTeamId.Alliance)
|
||||||
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextAllianceAssaulted, ChatMsg.BgSystemAlliance, source);
|
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextAllianceAssaulted, ChatMsg.BgSystemAlliance, source);
|
||||||
else
|
else
|
||||||
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextHordeAssaulted, ChatMsg.BgSystemHorde, source);
|
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextHordeAssaulted, ChatMsg.BgSystemHorde, source);
|
||||||
@@ -451,14 +451,14 @@ namespace Game.BattleGrounds.Zones
|
|||||||
_CreateBanner(node, ABNodeStatus.Occupied, (byte)teamIndex, true);
|
_CreateBanner(node, ABNodeStatus.Occupied, (byte)teamIndex, true);
|
||||||
_SendNodeUpdate(node);
|
_SendNodeUpdate(node);
|
||||||
m_NodeTimers[node] = 0;
|
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);
|
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextAllianceDefended, ChatMsg.BgSystemAlliance, source);
|
||||||
else
|
else
|
||||||
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextHordeDefended, ChatMsg.BgSystemHorde, source);
|
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
|
// If node is occupied, change to enemy-contested
|
||||||
else
|
else
|
||||||
@@ -474,19 +474,19 @@ namespace Game.BattleGrounds.Zones
|
|||||||
_NodeDeOccupied(node);
|
_NodeDeOccupied(node);
|
||||||
m_NodeTimers[node] = FlagCapturingTime;
|
m_NodeTimers[node] = FlagCapturingTime;
|
||||||
|
|
||||||
if (teamIndex == TeamId.Alliance)
|
if (teamIndex == BatttleGroundTeamId.Alliance)
|
||||||
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextAllianceAssaulted, ChatMsg.BgSystemAlliance, source);
|
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextAllianceAssaulted, ChatMsg.BgSystemAlliance, source);
|
||||||
else
|
else
|
||||||
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextHordeAssaulted, ChatMsg.BgSystemHorde, source);
|
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 node is occupied again, send "X has taken the Y" msg.
|
||||||
if (m_Nodes[node] >= ABNodeStatus.Occupied)
|
if (m_Nodes[node] >= ABNodeStatus.Occupied)
|
||||||
{
|
{
|
||||||
// FIXME: team and node names not localized
|
// FIXME: team and node names not localized
|
||||||
if (teamIndex == TeamId.Alliance)
|
if (teamIndex == BatttleGroundTeamId.Alliance)
|
||||||
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextAllianceTaken, ChatMsg.BgSystemAlliance);
|
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextAllianceTaken, ChatMsg.BgSystemAlliance);
|
||||||
else
|
else
|
||||||
SendBroadcastText(ABBattlegroundBroadcastTexts.ABNodes[node].TextHordeTaken, ChatMsg.BgSystemHorde);
|
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.BloodElf] = PointsTrigger.BloodElfBuff;
|
||||||
m_Points_Trigger[Points.DraeneiRuins] = PointsTrigger.DraeneiRuinsBuff;
|
m_Points_Trigger[Points.DraeneiRuins] = PointsTrigger.DraeneiRuinsBuff;
|
||||||
m_Points_Trigger[Points.MageTower] = PointsTrigger.MageTowerBuff;
|
m_Points_Trigger[Points.MageTower] = PointsTrigger.MageTowerBuff;
|
||||||
m_HonorScoreTics[TeamId.Alliance] = 0;
|
m_HonorScoreTics[BatttleGroundTeamId.Alliance] = 0;
|
||||||
m_HonorScoreTics[TeamId.Horde] = 0;
|
m_HonorScoreTics[BatttleGroundTeamId.Horde] = 0;
|
||||||
m_TeamPointsCount[TeamId.Alliance] = 0;
|
m_TeamPointsCount[BatttleGroundTeamId.Alliance] = 0;
|
||||||
m_TeamPointsCount[TeamId.Horde] = 0;
|
m_TeamPointsCount[BatttleGroundTeamId.Horde] = 0;
|
||||||
m_FlagKeeper.Clear();
|
m_FlagKeeper.Clear();
|
||||||
m_DroppedFlagGUID.Clear();
|
m_DroppedFlagGUID.Clear();
|
||||||
m_FlagCapturedBgObjectType = 0;
|
m_FlagCapturedBgObjectType = 0;
|
||||||
@@ -55,10 +55,10 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
|
|||||||
if (m_PointAddingTimer <= 0)
|
if (m_PointAddingTimer <= 0)
|
||||||
{
|
{
|
||||||
m_PointAddingTimer = Misc.FPointsTickTime;
|
m_PointAddingTimer = Misc.FPointsTickTime;
|
||||||
if (m_TeamPointsCount[TeamId.Alliance] > 0)
|
if (m_TeamPointsCount[BatttleGroundTeamId.Alliance] > 0)
|
||||||
AddPoints(Team.Alliance, Misc.TickPoints[m_TeamPointsCount[TeamId.Alliance] - 1]);
|
AddPoints(Team.Alliance, Misc.TickPoints[m_TeamPointsCount[BatttleGroundTeamId.Alliance] - 1]);
|
||||||
if (m_TeamPointsCount[TeamId.Horde] > 0)
|
if (m_TeamPointsCount[BatttleGroundTeamId.Horde] > 0)
|
||||||
AddPoints(Team.Horde, Misc.TickPoints[m_TeamPointsCount[TeamId.Horde] - 1]);
|
AddPoints(Team.Horde, Misc.TickPoints[m_TeamPointsCount[BatttleGroundTeamId.Horde] - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_FlagState == FlagState.WaitRespawn || m_FlagState == FlagState.OnGround)
|
if (m_FlagState == FlagState.WaitRespawn || m_FlagState == FlagState.OnGround)
|
||||||
@@ -140,13 +140,13 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
|
|||||||
if (score >= ScoreIds.MaxTeamScore)
|
if (score >= ScoreIds.MaxTeamScore)
|
||||||
{
|
{
|
||||||
score = ScoreIds.MaxTeamScore;
|
score = ScoreIds.MaxTeamScore;
|
||||||
if (team == TeamId.Alliance)
|
if (team == BatttleGroundTeamId.Alliance)
|
||||||
EndBattleground(Team.Alliance);
|
EndBattleground(Team.Alliance);
|
||||||
else
|
else
|
||||||
EndBattleground(Team.Horde);
|
EndBattleground(Team.Horde);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (team == TeamId.Alliance)
|
if (team == BatttleGroundTeamId.Alliance)
|
||||||
UpdateWorldState(WorldStateIds.AllianceResources, (int)score);
|
UpdateWorldState(WorldStateIds.AllianceResources, (int)score);
|
||||||
else
|
else
|
||||||
UpdateWorldState(WorldStateIds.HordeResources, (int)score);
|
UpdateWorldState(WorldStateIds.HordeResources, (int)score);
|
||||||
@@ -169,9 +169,9 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
|
|||||||
void UpdatePointsCount(Team team)
|
void UpdatePointsCount(Team team)
|
||||||
{
|
{
|
||||||
if (team == Team.Alliance)
|
if (team == Team.Alliance)
|
||||||
UpdateWorldState(WorldStateIds.AllianceBase, (int)m_TeamPointsCount[TeamId.Alliance]);
|
UpdateWorldState(WorldStateIds.AllianceBase, (int)m_TeamPointsCount[BatttleGroundTeamId.Alliance]);
|
||||||
else
|
else
|
||||||
UpdateWorldState(WorldStateIds.HordeBase, (int)m_TeamPointsCount[TeamId.Horde]);
|
UpdateWorldState(WorldStateIds.HordeBase, (int)m_TeamPointsCount[BatttleGroundTeamId.Horde]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdatePointsIcons(Team team, uint Point)
|
void UpdatePointsIcons(Team team, uint Point)
|
||||||
@@ -342,14 +342,14 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
|
|||||||
}
|
}
|
||||||
|
|
||||||
WorldSafeLocsEntry sg = Global.ObjectMgr.GetWorldSafeLoc(GaveyardIds.MainAlliance);
|
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.");
|
Log.outError(LogFilter.Sql, "BatteGroundEY: Failed to spawn spirit guide. The battleground was not created.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
sg = Global.ObjectMgr.GetWorldSafeLoc(GaveyardIds.MainHorde);
|
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.");
|
Log.outError(LogFilter.Sql, "BatteGroundEY: Failed to spawn spirit guide. The battleground was not created.");
|
||||||
return false;
|
return false;
|
||||||
@@ -368,12 +368,12 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
|
|||||||
//call parent's class reset
|
//call parent's class reset
|
||||||
base.Reset();
|
base.Reset();
|
||||||
|
|
||||||
m_TeamScores[TeamId.Alliance] = 0;
|
m_TeamScores[BatttleGroundTeamId.Alliance] = 0;
|
||||||
m_TeamScores[TeamId.Horde] = 0;
|
m_TeamScores[BatttleGroundTeamId.Horde] = 0;
|
||||||
m_TeamPointsCount[TeamId.Alliance] = 0;
|
m_TeamPointsCount[BatttleGroundTeamId.Alliance] = 0;
|
||||||
m_TeamPointsCount[TeamId.Horde] = 0;
|
m_TeamPointsCount[BatttleGroundTeamId.Horde] = 0;
|
||||||
m_HonorScoreTics[TeamId.Alliance] = 0;
|
m_HonorScoreTics[BatttleGroundTeamId.Alliance] = 0;
|
||||||
m_HonorScoreTics[TeamId.Horde] = 0;
|
m_HonorScoreTics[BatttleGroundTeamId.Horde] = 0;
|
||||||
m_FlagState = FlagState.OnBase;
|
m_FlagState = FlagState.OnBase;
|
||||||
m_FlagCapturedBgObjectType = 0;
|
m_FlagCapturedBgObjectType = 0;
|
||||||
m_FlagKeeper.Clear();
|
m_FlagKeeper.Clear();
|
||||||
@@ -511,14 +511,14 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
|
|||||||
|
|
||||||
if (team == Team.Alliance)
|
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, BattlegroundConst.RespawnOneDay);
|
||||||
SpawnBGObject(Misc.m_LosingPointTypes[point].DespawnObjectTypeAlliance + 1, BattlegroundConst.RespawnOneDay);
|
SpawnBGObject(Misc.m_LosingPointTypes[point].DespawnObjectTypeAlliance + 1, BattlegroundConst.RespawnOneDay);
|
||||||
SpawnBGObject(Misc.m_LosingPointTypes[point].DespawnObjectTypeAlliance + 2, BattlegroundConst.RespawnOneDay);
|
SpawnBGObject(Misc.m_LosingPointTypes[point].DespawnObjectTypeAlliance + 2, BattlegroundConst.RespawnOneDay);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_TeamPointsCount[TeamId.Horde]--;
|
m_TeamPointsCount[BatttleGroundTeamId.Horde]--;
|
||||||
SpawnBGObject(Misc.m_LosingPointTypes[point].DespawnObjectTypeHorde, BattlegroundConst.RespawnOneDay);
|
SpawnBGObject(Misc.m_LosingPointTypes[point].DespawnObjectTypeHorde, BattlegroundConst.RespawnOneDay);
|
||||||
SpawnBGObject(Misc.m_LosingPointTypes[point].DespawnObjectTypeHorde + 1, BattlegroundConst.RespawnOneDay);
|
SpawnBGObject(Misc.m_LosingPointTypes[point].DespawnObjectTypeHorde + 1, BattlegroundConst.RespawnOneDay);
|
||||||
SpawnBGObject(Misc.m_LosingPointTypes[point].DespawnObjectTypeHorde + 2, BattlegroundConst.RespawnOneDay);
|
SpawnBGObject(Misc.m_LosingPointTypes[point].DespawnObjectTypeHorde + 2, BattlegroundConst.RespawnOneDay);
|
||||||
@@ -557,14 +557,14 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
|
|||||||
|
|
||||||
if (team == Team.Alliance)
|
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, BattlegroundConst.RespawnImmediately);
|
||||||
SpawnBGObject(Misc.m_CapturingPointTypes[point].SpawnObjectTypeAlliance + 1, BattlegroundConst.RespawnImmediately);
|
SpawnBGObject(Misc.m_CapturingPointTypes[point].SpawnObjectTypeAlliance + 1, BattlegroundConst.RespawnImmediately);
|
||||||
SpawnBGObject(Misc.m_CapturingPointTypes[point].SpawnObjectTypeAlliance + 2, BattlegroundConst.RespawnImmediately);
|
SpawnBGObject(Misc.m_CapturingPointTypes[point].SpawnObjectTypeAlliance + 2, BattlegroundConst.RespawnImmediately);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_TeamPointsCount[TeamId.Horde]++;
|
m_TeamPointsCount[BatttleGroundTeamId.Horde]++;
|
||||||
SpawnBGObject(Misc.m_CapturingPointTypes[point].SpawnObjectTypeHorde, BattlegroundConst.RespawnImmediately);
|
SpawnBGObject(Misc.m_CapturingPointTypes[point].SpawnObjectTypeHorde, BattlegroundConst.RespawnImmediately);
|
||||||
SpawnBGObject(Misc.m_CapturingPointTypes[point].SpawnObjectTypeHorde + 1, BattlegroundConst.RespawnImmediately);
|
SpawnBGObject(Misc.m_CapturingPointTypes[point].SpawnObjectTypeHorde + 1, BattlegroundConst.RespawnImmediately);
|
||||||
SpawnBGObject(Misc.m_CapturingPointTypes[point].SpawnObjectTypeHorde + 2, BattlegroundConst.RespawnImmediately);
|
SpawnBGObject(Misc.m_CapturingPointTypes[point].SpawnObjectTypeHorde + 2, BattlegroundConst.RespawnImmediately);
|
||||||
@@ -707,9 +707,9 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
|
|||||||
|
|
||||||
public override Team GetPrematureWinner()
|
public override Team GetPrematureWinner()
|
||||||
{
|
{
|
||||||
if (GetTeamScore(TeamId.Alliance) > GetTeamScore(TeamId.Horde))
|
if (GetTeamScore(BatttleGroundTeamId.Alliance) > GetTeamScore(BatttleGroundTeamId.Horde))
|
||||||
return Team.Alliance;
|
return Team.Alliance;
|
||||||
else if (GetTeamScore(TeamId.Horde) > GetTeamScore(TeamId.Alliance))
|
else if (GetTeamScore(BatttleGroundTeamId.Horde) > GetTeamScore(BatttleGroundTeamId.Alliance))
|
||||||
return Team.Horde;
|
return Team.Horde;
|
||||||
|
|
||||||
return base.GetPrematureWinner();
|
return base.GetPrematureWinner();
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
SignaledRoundTwo = false;
|
SignaledRoundTwo = false;
|
||||||
SignaledRoundTwoHalfMin = false;
|
SignaledRoundTwoHalfMin = false;
|
||||||
InitSecondRound = false;
|
InitSecondRound = false;
|
||||||
Attackers = TeamId.Alliance;
|
Attackers = BatttleGroundTeamId.Alliance;
|
||||||
TotalTime = 0;
|
TotalTime = 0;
|
||||||
EndRoundTimer = 0;
|
EndRoundTimer = 0;
|
||||||
ShipsStarted = false;
|
ShipsStarted = false;
|
||||||
@@ -33,7 +33,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
|
|
||||||
for (byte i = 0; i < 2; i++)
|
for (byte i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
RoundScores[i].winner = TeamId.Alliance;
|
RoundScores[i].winner = BatttleGroundTeamId.Alliance;
|
||||||
RoundScores[i].time = 0;
|
RoundScores[i].time = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
public override void Reset()
|
public override void Reset()
|
||||||
{
|
{
|
||||||
TotalTime = 0;
|
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++)
|
for (byte i = 0; i <= 5; i++)
|
||||||
GateStatus[i] = SAGateState.HordeGateOk;
|
GateStatus[i] = SAGateState.HordeGateOk;
|
||||||
ShipsStarted = false;
|
ShipsStarted = false;
|
||||||
@@ -63,7 +63,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint atF = SAMiscConst.Factions[Attackers];
|
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++)
|
for (byte i = 0; i < SAObjectTypes.MaxObj; i++)
|
||||||
DelObject(i);
|
DelObject(i);
|
||||||
@@ -75,7 +75,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
DelCreature(i);
|
DelCreature(i);
|
||||||
|
|
||||||
for (byte i = 0; i < GateStatus.Length; ++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)
|
if (AddCreature(SAMiscConst.NpcEntries[SACreatureTypes.Kanrethad], SACreatureTypes.Kanrethad, SAMiscConst.NpcSpawnlocs[SACreatureTypes.Kanrethad]) == null)
|
||||||
{
|
{
|
||||||
@@ -135,9 +135,9 @@ namespace Game.BattleGrounds.Zones
|
|||||||
//By capturing GYs.
|
//By capturing GYs.
|
||||||
for (byte i = 0; i < SACreatureTypes.Demolisher5; i++)
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,8 +174,8 @@ namespace Game.BattleGrounds.Zones
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GraveyardStatus[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 == TeamId.Horde ? TeamId.Alliance : TeamId.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}");
|
Log.outError(LogFilter.Battleground, $"SOTA: couldn't spawn GY: {i}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -183,9 +183,9 @@ namespace Game.BattleGrounds.Zones
|
|||||||
//GY capture points
|
//GY capture points
|
||||||
for (byte i = SAObjectTypes.CentralFlag; i <= SAObjectTypes.LeftFlag; i++)
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
GetBGObject(i).SetFaction(atF);
|
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...
|
//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.RightGyHorde, GraveyardStatus[SAGraveyards.RightCapturableGy] == BatttleGroundTeamId.Horde ? 1 : 0);
|
||||||
UpdateWorldState(SAWorldStateIds.LeftGyHorde, GraveyardStatus[SAGraveyards.LeftCapturableGy] == TeamId.Horde ? 1 : 0);
|
UpdateWorldState(SAWorldStateIds.LeftGyHorde, GraveyardStatus[SAGraveyards.LeftCapturableGy] == BatttleGroundTeamId.Horde ? 1 : 0);
|
||||||
UpdateWorldState(SAWorldStateIds.CenterGyHorde, GraveyardStatus[SAGraveyards.CentralCapturableGy] == TeamId.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.RightGyAlliance, GraveyardStatus[SAGraveyards.RightCapturableGy] == BatttleGroundTeamId.Alliance ? 1 : 0);
|
||||||
UpdateWorldState(SAWorldStateIds.LeftGyAlliance, GraveyardStatus[SAGraveyards.LeftCapturableGy] == TeamId.Alliance ? 1 : 0);
|
UpdateWorldState(SAWorldStateIds.LeftGyAlliance, GraveyardStatus[SAGraveyards.LeftCapturableGy] == BatttleGroundTeamId.Alliance ? 1 : 0);
|
||||||
UpdateWorldState(SAWorldStateIds.CenterGyAlliance, GraveyardStatus[SAGraveyards.CentralCapturableGy] == TeamId.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.AllyAttacks, 1);
|
||||||
UpdateWorldState(SAWorldStateIds.HordeAttacks, 0);
|
UpdateWorldState(SAWorldStateIds.HordeAttacks, 0);
|
||||||
@@ -326,7 +326,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
ToggleTimer();
|
ToggleTimer();
|
||||||
DemolisherStartState(false);
|
DemolisherStartState(false);
|
||||||
Status = SAStatus.RoundOne;
|
Status = SAStatus.RoundOne;
|
||||||
TriggerGameEvent(Attackers == TeamId.Alliance ? 23748 : 21702u);
|
TriggerGameEvent(Attackers == BatttleGroundTeamId.Alliance ? 23748 : 21702u);
|
||||||
}
|
}
|
||||||
if (TotalTime >= SATimers.BoatStart)
|
if (TotalTime >= SATimers.BoatStart)
|
||||||
StartShips();
|
StartShips();
|
||||||
@@ -350,7 +350,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
ToggleTimer();
|
ToggleTimer();
|
||||||
DemolisherStartState(false);
|
DemolisherStartState(false);
|
||||||
Status = SAStatus.RoundTwo;
|
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
|
// status was set to STATUS_WAIT_JOIN manually for Preparation, set it back now
|
||||||
SetStatus(BattlegroundStatus.InProgress);
|
SetStatus(BattlegroundStatus.InProgress);
|
||||||
foreach (var pair in GetPlayers())
|
foreach (var pair in GetPlayers())
|
||||||
@@ -383,7 +383,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
RoundScores[0].time = SATimers.RoundLength;
|
RoundScores[0].time = SATimers.RoundLength;
|
||||||
TotalTime = 0;
|
TotalTime = 0;
|
||||||
Status = SAStatus.SecondWarmup;
|
Status = SAStatus.SecondWarmup;
|
||||||
Attackers = (Attackers == TeamId.Alliance) ? TeamId.Horde : TeamId.Alliance;
|
Attackers = (Attackers == BatttleGroundTeamId.Alliance) ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance;
|
||||||
UpdateWaitTimer = 5000;
|
UpdateWaitTimer = 5000;
|
||||||
SignaledRoundTwo = false;
|
SignaledRoundTwo = false;
|
||||||
SignaledRoundTwoHalfMin = false;
|
SignaledRoundTwoHalfMin = false;
|
||||||
@@ -401,13 +401,13 @@ namespace Game.BattleGrounds.Zones
|
|||||||
CastSpellOnTeam(SASpellIds.EndOfRound, Team.Alliance);
|
CastSpellOnTeam(SASpellIds.EndOfRound, Team.Alliance);
|
||||||
CastSpellOnTeam(SASpellIds.EndOfRound, Team.Horde);
|
CastSpellOnTeam(SASpellIds.EndOfRound, Team.Horde);
|
||||||
RoundScores[1].time = SATimers.RoundLength;
|
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)
|
if (RoundScores[0].time == RoundScores[1].time)
|
||||||
EndBattleground(0);
|
EndBattleground(0);
|
||||||
else if (RoundScores[0].time < RoundScores[1].time)
|
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
|
else
|
||||||
EndBattleground(RoundScores[1].winner == TeamId.Alliance ? Team.Alliance : Team.Horde);
|
EndBattleground(RoundScores[1].winner == BatttleGroundTeamId.Alliance ? Team.Alliance : Team.Horde);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -505,18 +505,18 @@ namespace Game.BattleGrounds.Zones
|
|||||||
// damaged
|
// damaged
|
||||||
if (eventId == go.GetGoInfo().DestructibleBuilding.DamagedEvent)
|
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);
|
Creature creature = obj.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||||
if (creature != null)
|
if (creature != null)
|
||||||
SendChatMessage(creature, (byte)gate.DamagedText, invoker);
|
SendChatMessage(creature, (byte)gate.DamagedText, invoker);
|
||||||
|
|
||||||
PlaySoundToAll(Attackers == TeamId.Alliance ? SASoundIds.WallAttackedAlliance : SASoundIds.WallAttackedHorde);
|
PlaySoundToAll(Attackers == BatttleGroundTeamId.Alliance ? SASoundIds.WallAttackedAlliance : SASoundIds.WallAttackedHorde);
|
||||||
}
|
}
|
||||||
// destroyed
|
// destroyed
|
||||||
else if (eventId == go.GetGoInfo().DestructibleBuilding.DestroyedEvent)
|
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)
|
if (gateId < 5)
|
||||||
DelObject((int)gateId + 14);
|
DelObject((int)gateId + 14);
|
||||||
@@ -525,7 +525,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
if (creature != null)
|
if (creature != null)
|
||||||
SendChatMessage(creature, (byte)gate.DestroyedText, invoker);
|
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;
|
bool rewardHonor = true;
|
||||||
switch (gateId)
|
switch (gateId)
|
||||||
@@ -585,7 +585,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
if (creature.GetEntry() == SACreatureIds.Demolisher)
|
if (creature.GetEntry() == SACreatureIds.Demolisher)
|
||||||
{
|
{
|
||||||
UpdatePvpStat(killer, (uint)StrandOfTheAncientsPvpStats.DemolishersDestroyed, 1);
|
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());
|
int currentDestroyedVehicles = Global.WorldStateMgr.GetValue((int)worldStateId, GetBgMap());
|
||||||
UpdateWorldState(worldStateId, currentDestroyedVehicles + 1);
|
UpdateWorldState(worldStateId, currentDestroyedVehicles + 1);
|
||||||
}
|
}
|
||||||
@@ -604,7 +604,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
{
|
{
|
||||||
Creature gun = GetBGCreature(i);
|
Creature gun = GetBGCreature(i);
|
||||||
if (gun != null)
|
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++)
|
for (byte i = SACreatureTypes.Demolisher1; i <= SACreatureTypes.Demolisher4; i++)
|
||||||
@@ -767,7 +767,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
{
|
{
|
||||||
flag = SAObjectTypes.LeftFlag;
|
flag = SAObjectTypes.LeftFlag;
|
||||||
DelObject(flag);
|
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);
|
SAMiscConst.ObjSpawnlocs[flag], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay);
|
||||||
|
|
||||||
npc = SACreatureTypes.Rigspark;
|
npc = SACreatureTypes.Rigspark;
|
||||||
@@ -777,25 +777,25 @@ namespace Game.BattleGrounds.Zones
|
|||||||
|
|
||||||
for (byte j = SACreatureTypes.Demolisher7; j <= SACreatureTypes.Demolisher8; j++)
|
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);
|
Creature dem = GetBGCreature(j);
|
||||||
if (dem != null)
|
if (dem != null)
|
||||||
dem.SetFaction(SAMiscConst.Factions[Attackers]);
|
dem.SetFaction(SAMiscConst.Factions[Attackers]);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateWorldState(SAWorldStateIds.LeftGyAlliance, GraveyardStatus[i] == TeamId.Alliance ? 1 : 0);
|
UpdateWorldState(SAWorldStateIds.LeftGyAlliance, GraveyardStatus[i] == BatttleGroundTeamId.Alliance ? 1 : 0);
|
||||||
UpdateWorldState(SAWorldStateIds.LeftGyHorde, GraveyardStatus[i] == TeamId.Horde ? 1 : 0);
|
UpdateWorldState(SAWorldStateIds.LeftGyHorde, GraveyardStatus[i] == BatttleGroundTeamId.Horde ? 1 : 0);
|
||||||
|
|
||||||
Creature creature = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
Creature creature = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||||
if (creature != null)
|
if (creature != null)
|
||||||
SendChatMessage(creature, teamId == TeamId.Alliance ? SATextIds.WestGraveyardCapturedA : SATextIds.WestGraveyardCapturedH, source);
|
SendChatMessage(creature, teamId == BatttleGroundTeamId.Alliance ? SATextIds.WestGraveyardCapturedA : SATextIds.WestGraveyardCapturedH, source);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SAGraveyards.RightCapturableGy:
|
case SAGraveyards.RightCapturableGy:
|
||||||
{
|
{
|
||||||
flag = SAObjectTypes.RightFlag;
|
flag = SAObjectTypes.RightFlag;
|
||||||
DelObject(flag);
|
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);
|
SAMiscConst.ObjSpawnlocs[flag], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay);
|
||||||
|
|
||||||
npc = SACreatureTypes.Sparklight;
|
npc = SACreatureTypes.Sparklight;
|
||||||
@@ -805,34 +805,34 @@ namespace Game.BattleGrounds.Zones
|
|||||||
|
|
||||||
for (byte j = SACreatureTypes.Demolisher5; j <= SACreatureTypes.Demolisher6; j++)
|
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);
|
Creature dem = GetBGCreature(j);
|
||||||
if (dem != null)
|
if (dem != null)
|
||||||
dem.SetFaction(SAMiscConst.Factions[Attackers]);
|
dem.SetFaction(SAMiscConst.Factions[Attackers]);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateWorldState(SAWorldStateIds.RightGyAlliance, GraveyardStatus[i] == TeamId.Alliance ? 1 : 0);
|
UpdateWorldState(SAWorldStateIds.RightGyAlliance, GraveyardStatus[i] == BatttleGroundTeamId.Alliance ? 1 : 0);
|
||||||
UpdateWorldState(SAWorldStateIds.RightGyHorde, GraveyardStatus[i] == TeamId.Horde ? 1 : 0);
|
UpdateWorldState(SAWorldStateIds.RightGyHorde, GraveyardStatus[i] == BatttleGroundTeamId.Horde ? 1 : 0);
|
||||||
|
|
||||||
Creature creature = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
Creature creature = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||||
if (creature != null)
|
if (creature != null)
|
||||||
SendChatMessage(creature, teamId == TeamId.Alliance ? SATextIds.EastGraveyardCapturedA : SATextIds.EastGraveyardCapturedH, source);
|
SendChatMessage(creature, teamId == BatttleGroundTeamId.Alliance ? SATextIds.EastGraveyardCapturedA : SATextIds.EastGraveyardCapturedH, source);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SAGraveyards.CentralCapturableGy:
|
case SAGraveyards.CentralCapturableGy:
|
||||||
{
|
{
|
||||||
flag = SAObjectTypes.CentralFlag;
|
flag = SAObjectTypes.CentralFlag;
|
||||||
DelObject(flag);
|
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);
|
SAMiscConst.ObjSpawnlocs[flag], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay);
|
||||||
|
|
||||||
UpdateWorldState(SAWorldStateIds.CenterGyAlliance, GraveyardStatus[i] == TeamId.Alliance ? 1 : 0);
|
UpdateWorldState(SAWorldStateIds.CenterGyAlliance, GraveyardStatus[i] == BatttleGroundTeamId.Alliance ? 1 : 0);
|
||||||
UpdateWorldState(SAWorldStateIds.CenterGyHorde, GraveyardStatus[i] == TeamId.Horde ? 1 : 0);
|
UpdateWorldState(SAWorldStateIds.CenterGyHorde, GraveyardStatus[i] == BatttleGroundTeamId.Horde ? 1 : 0);
|
||||||
|
|
||||||
Creature creature = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
Creature creature = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||||
if (creature != null)
|
if (creature != null)
|
||||||
SendChatMessage(creature, teamId == TeamId.Alliance ? SATextIds.SouthGraveyardCapturedA : SATextIds.SouthGraveyardCapturedH, source);
|
SendChatMessage(creature, teamId == BatttleGroundTeamId.Alliance ? SATextIds.SouthGraveyardCapturedA : SATextIds.SouthGraveyardCapturedH, source);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -851,7 +851,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
int clickerTeamId = GetTeamIndexByTeamId(GetPlayerTeam(clicker.GetGUID()));
|
int clickerTeamId = GetTeamIndexByTeamId(GetPlayerTeam(clicker.GetGUID()));
|
||||||
if (clickerTeamId == Attackers)
|
if (clickerTeamId == Attackers)
|
||||||
{
|
{
|
||||||
if (clickerTeamId == TeamId.Alliance)
|
if (clickerTeamId == BatttleGroundTeamId.Alliance)
|
||||||
SendBroadcastText(SABroadcastTexts.AllianceCapturedTitanPortal, ChatMsg.BgSystemNeutral);
|
SendBroadcastText(SABroadcastTexts.AllianceCapturedTitanPortal, ChatMsg.BgSystemNeutral);
|
||||||
else
|
else
|
||||||
SendBroadcastText(SABroadcastTexts.HordeCapturedTitanPortal, ChatMsg.BgSystemNeutral);
|
SendBroadcastText(SABroadcastTexts.HordeCapturedTitanPortal, ChatMsg.BgSystemNeutral);
|
||||||
@@ -869,7 +869,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
player.UpdateCriteria(CriteriaType.BeSpellTarget, 65246);
|
player.UpdateCriteria(CriteriaType.BeSpellTarget, 65246);
|
||||||
}
|
}
|
||||||
|
|
||||||
Attackers = (Attackers == TeamId.Alliance) ? TeamId.Horde : TeamId.Alliance;
|
Attackers = (Attackers == BatttleGroundTeamId.Alliance) ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance;
|
||||||
Status = SAStatus.SecondWarmup;
|
Status = SAStatus.SecondWarmup;
|
||||||
TotalTime = 0;
|
TotalTime = 0;
|
||||||
ToggleTimer();
|
ToggleTimer();
|
||||||
@@ -904,9 +904,9 @@ namespace Game.BattleGrounds.Zones
|
|||||||
if (RoundScores[0].time == RoundScores[1].time)
|
if (RoundScores[0].time == RoundScores[1].time)
|
||||||
EndBattleground(0);
|
EndBattleground(0);
|
||||||
else if (RoundScores[0].time < RoundScores[1].time)
|
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
|
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)
|
switch (spellId)
|
||||||
{
|
{
|
||||||
case SASpellIds.AllianceControlPhaseShift:
|
case SASpellIds.AllianceControlPhaseShift:
|
||||||
return Attackers == TeamId.Horde;
|
return Attackers == BatttleGroundTeamId.Horde;
|
||||||
case SASpellIds.HordeControlPhaseShift:
|
case SASpellIds.HordeControlPhaseShift:
|
||||||
return Attackers == TeamId.Alliance;
|
return Attackers == BatttleGroundTeamId.Alliance;
|
||||||
case BattlegroundConst.SpellPreparation:
|
case BattlegroundConst.SpellPreparation:
|
||||||
return Status == SAStatus.Warmup || Status == SAStatus.SecondWarmup;
|
return Status == SAStatus.Warmup || Status == SAStatus.SecondWarmup;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -27,64 +27,64 @@ namespace Game.BattleGrounds.Zones
|
|||||||
{
|
{
|
||||||
if (GetElapsedTime() >= 17 * Time.Minute * Time.InMilliseconds)
|
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);
|
EndBattleground(Team.Other);
|
||||||
else // Horde has more points and thus wins
|
else // Horde has more points and thus wins
|
||||||
EndBattleground(Team.Horde);
|
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
|
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);
|
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);
|
EndBattleground(Team.Horde);
|
||||||
else
|
else
|
||||||
EndBattleground(Team.Alliance);
|
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);
|
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);
|
RespawnFlagAfterDrop(Team.Alliance);
|
||||||
_bothFlagsKept = false;
|
_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);
|
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);
|
RespawnFlagAfterDrop(Team.Horde);
|
||||||
_bothFlagsKept = false;
|
_bothFlagsKept = false;
|
||||||
}
|
}
|
||||||
@@ -125,8 +125,8 @@ namespace Game.BattleGrounds.Zones
|
|||||||
_flagDebuffState = 2;
|
_flagDebuffState = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((_flagState[TeamId.Alliance] == WSGFlagState.OnBase || _flagState[TeamId.Alliance] == WSGFlagState.WaitRespawn) &&
|
else if ((_flagState[BatttleGroundTeamId.Alliance] == WSGFlagState.OnBase || _flagState[BatttleGroundTeamId.Alliance] == WSGFlagState.WaitRespawn) &&
|
||||||
(_flagState[TeamId.Horde] == WSGFlagState.OnBase || _flagState[TeamId.Horde] == WSGFlagState.WaitRespawn))
|
(_flagState[BatttleGroundTeamId.Horde] == WSGFlagState.OnBase || _flagState[BatttleGroundTeamId.Horde] == WSGFlagState.WaitRespawn))
|
||||||
{
|
{
|
||||||
// Both flags are in base or awaiting respawn.
|
// Both flags are in base or awaiting respawn.
|
||||||
// Remove assault debuffs, reset timers
|
// Remove assault debuffs, reset timers
|
||||||
@@ -189,12 +189,12 @@ namespace Game.BattleGrounds.Zones
|
|||||||
if (Team == Team.Alliance)
|
if (Team == Team.Alliance)
|
||||||
{
|
{
|
||||||
Log.outDebug(LogFilter.Battleground, "Respawn Alliance flag");
|
Log.outDebug(LogFilter.Battleground, "Respawn Alliance flag");
|
||||||
_flagState[TeamId.Alliance] = WSGFlagState.OnBase;
|
_flagState[BatttleGroundTeamId.Alliance] = WSGFlagState.OnBase;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.outDebug(LogFilter.Battleground, "Respawn Horde flag");
|
Log.outDebug(LogFilter.Battleground, "Respawn Horde flag");
|
||||||
_flagState[TeamId.Horde] = WSGFlagState.OnBase;
|
_flagState[BatttleGroundTeamId.Horde] = WSGFlagState.OnBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (captured)
|
if (captured)
|
||||||
@@ -231,7 +231,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
SetDroppedFlagGUID(ObjectGuid.Empty, GetTeamIndexByTeamId(team));
|
SetDroppedFlagGUID(ObjectGuid.Empty, GetTeamIndexByTeamId(team));
|
||||||
_bothFlagsKept = false;
|
_bothFlagsKept = false;
|
||||||
// Check opposing flag if it is in capture zone; if so, capture it
|
// 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)
|
void EventPlayerCapturedFlag(Player player)
|
||||||
@@ -249,7 +249,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
return;
|
return;
|
||||||
SetHordeFlagPicker(ObjectGuid.Empty); // must be before aura remove to prevent 2 events (drop+capture) at the same time
|
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)
|
// horde flag in base (but not respawned yet)
|
||||||
_flagState[TeamId.Horde] = WSGFlagState.WaitRespawn;
|
_flagState[BatttleGroundTeamId.Horde] = WSGFlagState.WaitRespawn;
|
||||||
// Drop Horde Flag from Player
|
// Drop Horde Flag from Player
|
||||||
player.RemoveAurasDueToSpell(WSGSpellId.WarsongFlag);
|
player.RemoveAurasDueToSpell(WSGSpellId.WarsongFlag);
|
||||||
if (_flagDebuffState == 1)
|
if (_flagDebuffState == 1)
|
||||||
@@ -257,7 +257,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
else if (_flagDebuffState == 2)
|
else if (_flagDebuffState == 2)
|
||||||
player.RemoveAurasDueToSpell(WSGSpellId.BrutalAssault);
|
player.RemoveAurasDueToSpell(WSGSpellId.BrutalAssault);
|
||||||
|
|
||||||
if (GetTeamScore(TeamId.Alliance) < WSGTimerOrScore.MaxTeamScore)
|
if (GetTeamScore(BatttleGroundTeamId.Alliance) < WSGTimerOrScore.MaxTeamScore)
|
||||||
AddPoint(Team.Alliance, 1);
|
AddPoint(Team.Alliance, 1);
|
||||||
PlaySoundToAll(WSGSound.FlagCapturedAlliance);
|
PlaySoundToAll(WSGSound.FlagCapturedAlliance);
|
||||||
RewardReputationToTeam(890, m_ReputationCapture, Team.Alliance);
|
RewardReputationToTeam(890, m_ReputationCapture, Team.Alliance);
|
||||||
@@ -268,7 +268,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
return;
|
return;
|
||||||
SetAllianceFlagPicker(ObjectGuid.Empty); // must be before aura remove to prevent 2 events (drop+capture) at the same time
|
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)
|
// alliance flag in base (but not respawned yet)
|
||||||
_flagState[TeamId.Alliance] = WSGFlagState.WaitRespawn;
|
_flagState[BatttleGroundTeamId.Alliance] = WSGFlagState.WaitRespawn;
|
||||||
// Drop Alliance Flag from Player
|
// Drop Alliance Flag from Player
|
||||||
player.RemoveAurasDueToSpell(WSGSpellId.SilverwingFlag);
|
player.RemoveAurasDueToSpell(WSGSpellId.SilverwingFlag);
|
||||||
if (_flagDebuffState == 1)
|
if (_flagDebuffState == 1)
|
||||||
@@ -276,7 +276,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
else if (_flagDebuffState == 2)
|
else if (_flagDebuffState == 2)
|
||||||
player.RemoveAurasDueToSpell(WSGSpellId.BrutalAssault);
|
player.RemoveAurasDueToSpell(WSGSpellId.BrutalAssault);
|
||||||
|
|
||||||
if (GetTeamScore(TeamId.Horde) < WSGTimerOrScore.MaxTeamScore)
|
if (GetTeamScore(BatttleGroundTeamId.Horde) < WSGTimerOrScore.MaxTeamScore)
|
||||||
AddPoint(Team.Horde, 1);
|
AddPoint(Team.Horde, 1);
|
||||||
PlaySoundToAll(WSGSound.FlagCapturedHorde);
|
PlaySoundToAll(WSGSound.FlagCapturedHorde);
|
||||||
RewardReputationToTeam(889, m_ReputationCapture, Team.Horde);
|
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
|
// update last flag capture to be used if teamscore is equal
|
||||||
SetLastFlagCapture(team);
|
SetLastFlagCapture(team);
|
||||||
|
|
||||||
if (GetTeamScore(TeamId.Alliance) == WSGTimerOrScore.MaxTeamScore)
|
if (GetTeamScore(BatttleGroundTeamId.Alliance) == WSGTimerOrScore.MaxTeamScore)
|
||||||
winner = Team.Alliance;
|
winner = Team.Alliance;
|
||||||
|
|
||||||
if (GetTeamScore(TeamId.Horde) == WSGTimerOrScore.MaxTeamScore)
|
if (GetTeamScore(BatttleGroundTeamId.Horde) == WSGTimerOrScore.MaxTeamScore)
|
||||||
winner = Team.Horde;
|
winner = Team.Horde;
|
||||||
|
|
||||||
if (winner != 0)
|
if (winner != 0)
|
||||||
@@ -324,7 +324,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
void HandleFlagRoomCapturePoint(int team)
|
void HandleFlagRoomCapturePoint(int team)
|
||||||
{
|
{
|
||||||
Player flagCarrier = Global.ObjAccessor.GetPlayer(GetBgMap(), GetFlagPickerGUID(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)))
|
if (flagCarrier != null && flagCarrier.IsInAreaTriggerRadius(CliDB.AreaTriggerStorage.LookupByKey(areaTrigger)))
|
||||||
EventPlayerCapturedFlag(flagCarrier);
|
EventPlayerCapturedFlag(flagCarrier);
|
||||||
}
|
}
|
||||||
@@ -341,7 +341,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
if (!IsHordeFlagPickedup())
|
if (!IsHordeFlagPickedup())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (GetFlagPickerGUID(TeamId.Horde) == player.GetGUID())
|
if (GetFlagPickerGUID(BatttleGroundTeamId.Horde) == player.GetGUID())
|
||||||
{
|
{
|
||||||
SetHordeFlagPicker(ObjectGuid.Empty);
|
SetHordeFlagPicker(ObjectGuid.Empty);
|
||||||
player.RemoveAurasDueToSpell(WSGSpellId.WarsongFlag);
|
player.RemoveAurasDueToSpell(WSGSpellId.WarsongFlag);
|
||||||
@@ -352,7 +352,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
if (!IsAllianceFlagPickedup())
|
if (!IsAllianceFlagPickedup())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (GetFlagPickerGUID(TeamId.Alliance) == player.GetGUID())
|
if (GetFlagPickerGUID(BatttleGroundTeamId.Alliance) == player.GetGUID())
|
||||||
{
|
{
|
||||||
SetAllianceFlagPicker(ObjectGuid.Empty);
|
SetAllianceFlagPicker(ObjectGuid.Empty);
|
||||||
player.RemoveAurasDueToSpell(WSGSpellId.SilverwingFlag);
|
player.RemoveAurasDueToSpell(WSGSpellId.SilverwingFlag);
|
||||||
@@ -367,7 +367,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
{
|
{
|
||||||
if (!IsHordeFlagPickedup())
|
if (!IsHordeFlagPickedup())
|
||||||
return;
|
return;
|
||||||
if (GetFlagPickerGUID(TeamId.Horde) == player.GetGUID())
|
if (GetFlagPickerGUID(BatttleGroundTeamId.Horde) == player.GetGUID())
|
||||||
{
|
{
|
||||||
SetHordeFlagPicker(ObjectGuid.Empty);
|
SetHordeFlagPicker(ObjectGuid.Empty);
|
||||||
player.RemoveAurasDueToSpell(WSGSpellId.WarsongFlag);
|
player.RemoveAurasDueToSpell(WSGSpellId.WarsongFlag);
|
||||||
@@ -375,7 +375,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
player.RemoveAurasDueToSpell(WSGSpellId.FocusedAssault);
|
player.RemoveAurasDueToSpell(WSGSpellId.FocusedAssault);
|
||||||
else if (_flagDebuffState == 2)
|
else if (_flagDebuffState == 2)
|
||||||
player.RemoveAurasDueToSpell(WSGSpellId.BrutalAssault);
|
player.RemoveAurasDueToSpell(WSGSpellId.BrutalAssault);
|
||||||
_flagState[TeamId.Horde] = WSGFlagState.OnGround;
|
_flagState[BatttleGroundTeamId.Horde] = WSGFlagState.OnGround;
|
||||||
player.CastSpell(player, WSGSpellId.WarsongFlagDropped, true);
|
player.CastSpell(player, WSGSpellId.WarsongFlagDropped, true);
|
||||||
set = true;
|
set = true;
|
||||||
}
|
}
|
||||||
@@ -384,7 +384,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
{
|
{
|
||||||
if (!IsAllianceFlagPickedup())
|
if (!IsAllianceFlagPickedup())
|
||||||
return;
|
return;
|
||||||
if (GetFlagPickerGUID(TeamId.Alliance) == player.GetGUID())
|
if (GetFlagPickerGUID(BatttleGroundTeamId.Alliance) == player.GetGUID())
|
||||||
{
|
{
|
||||||
SetAllianceFlagPicker(ObjectGuid.Empty);
|
SetAllianceFlagPicker(ObjectGuid.Empty);
|
||||||
player.RemoveAurasDueToSpell(WSGSpellId.SilverwingFlag);
|
player.RemoveAurasDueToSpell(WSGSpellId.SilverwingFlag);
|
||||||
@@ -392,7 +392,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
player.RemoveAurasDueToSpell(WSGSpellId.FocusedAssault);
|
player.RemoveAurasDueToSpell(WSGSpellId.FocusedAssault);
|
||||||
else if (_flagDebuffState == 2)
|
else if (_flagDebuffState == 2)
|
||||||
player.RemoveAurasDueToSpell(WSGSpellId.BrutalAssault);
|
player.RemoveAurasDueToSpell(WSGSpellId.BrutalAssault);
|
||||||
_flagState[TeamId.Alliance] = WSGFlagState.OnGround;
|
_flagState[BatttleGroundTeamId.Alliance] = WSGFlagState.OnGround;
|
||||||
player.CastSpell(player, WSGSpellId.SilverwingFlagDropped, true);
|
player.CastSpell(player, WSGSpellId.SilverwingFlagDropped, true);
|
||||||
set = true;
|
set = true;
|
||||||
}
|
}
|
||||||
@@ -427,7 +427,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
PlaySoundToAll(WSGSound.AllianceFlagPickedUp);
|
PlaySoundToAll(WSGSound.AllianceFlagPickedUp);
|
||||||
SpawnBGObject(WSGObjectTypes.AFlag, BattlegroundConst.RespawnOneDay);
|
SpawnBGObject(WSGObjectTypes.AFlag, BattlegroundConst.RespawnOneDay);
|
||||||
SetAllianceFlagPicker(player.GetGUID());
|
SetAllianceFlagPicker(player.GetGUID());
|
||||||
_flagState[TeamId.Alliance] = WSGFlagState.OnPlayer;
|
_flagState[BatttleGroundTeamId.Alliance] = WSGFlagState.OnPlayer;
|
||||||
//update world state to show correct flag carrier
|
//update world state to show correct flag carrier
|
||||||
UpdateFlagState(Team.Horde, WSGFlagState.OnPlayer);
|
UpdateFlagState(Team.Horde, WSGFlagState.OnPlayer);
|
||||||
player.CastSpell(player, WSGSpellId.SilverwingFlag, true);
|
player.CastSpell(player, WSGSpellId.SilverwingFlag, true);
|
||||||
@@ -449,7 +449,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
PlaySoundToAll(WSGSound.HordeFlagPickedUp);
|
PlaySoundToAll(WSGSound.HordeFlagPickedUp);
|
||||||
SpawnBGObject(WSGObjectTypes.HFlag, BattlegroundConst.RespawnOneDay);
|
SpawnBGObject(WSGObjectTypes.HFlag, BattlegroundConst.RespawnOneDay);
|
||||||
SetHordeFlagPicker(player.GetGUID());
|
SetHordeFlagPicker(player.GetGUID());
|
||||||
_flagState[TeamId.Horde] = WSGFlagState.OnPlayer;
|
_flagState[BatttleGroundTeamId.Horde] = WSGFlagState.OnPlayer;
|
||||||
//update world state to show correct flag carrier
|
//update world state to show correct flag carrier
|
||||||
UpdateFlagState(Team.Alliance, WSGFlagState.OnPlayer);
|
UpdateFlagState(Team.Alliance, WSGFlagState.OnPlayer);
|
||||||
player.CastSpell(player, WSGSpellId.WarsongFlag, true);
|
player.CastSpell(player, WSGSpellId.WarsongFlag, true);
|
||||||
@@ -477,7 +477,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
UpdatePvpStat(player, (uint)WarsongGulchPvpStats.FlagReturns, 1);
|
UpdatePvpStat(player, (uint)WarsongGulchPvpStats.FlagReturns, 1);
|
||||||
_bothFlagsKept = false;
|
_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
|
else
|
||||||
{
|
{
|
||||||
@@ -486,7 +486,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
SpawnBGObject(WSGObjectTypes.AFlag, BattlegroundConst.RespawnOneDay);
|
SpawnBGObject(WSGObjectTypes.AFlag, BattlegroundConst.RespawnOneDay);
|
||||||
SetAllianceFlagPicker(player.GetGUID());
|
SetAllianceFlagPicker(player.GetGUID());
|
||||||
player.CastSpell(player, WSGSpellId.SilverwingFlag, true);
|
player.CastSpell(player, WSGSpellId.SilverwingFlag, true);
|
||||||
_flagState[TeamId.Alliance] = WSGFlagState.OnPlayer;
|
_flagState[BatttleGroundTeamId.Alliance] = WSGFlagState.OnPlayer;
|
||||||
UpdateFlagState(Team.Horde, WSGFlagState.OnPlayer);
|
UpdateFlagState(Team.Horde, WSGFlagState.OnPlayer);
|
||||||
if (_flagDebuffState == 1)
|
if (_flagDebuffState == 1)
|
||||||
player.CastSpell(player, WSGSpellId.FocusedAssault, true);
|
player.CastSpell(player, WSGSpellId.FocusedAssault, true);
|
||||||
@@ -511,7 +511,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
UpdatePvpStat(player, (uint)WarsongGulchPvpStats.FlagReturns, 1);
|
UpdatePvpStat(player, (uint)WarsongGulchPvpStats.FlagReturns, 1);
|
||||||
_bothFlagsKept = false;
|
_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
|
else
|
||||||
{
|
{
|
||||||
@@ -520,7 +520,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
SpawnBGObject(WSGObjectTypes.HFlag, BattlegroundConst.RespawnOneDay);
|
SpawnBGObject(WSGObjectTypes.HFlag, BattlegroundConst.RespawnOneDay);
|
||||||
SetHordeFlagPicker(player.GetGUID());
|
SetHordeFlagPicker(player.GetGUID());
|
||||||
player.CastSpell(player, WSGSpellId.WarsongFlag, true);
|
player.CastSpell(player, WSGSpellId.WarsongFlag, true);
|
||||||
_flagState[TeamId.Horde] = WSGFlagState.OnPlayer;
|
_flagState[BatttleGroundTeamId.Horde] = WSGFlagState.OnPlayer;
|
||||||
UpdateFlagState(Team.Alliance, WSGFlagState.OnPlayer);
|
UpdateFlagState(Team.Alliance, WSGFlagState.OnPlayer);
|
||||||
if (_flagDebuffState == 1)
|
if (_flagDebuffState == 1)
|
||||||
player.CastSpell(player, WSGSpellId.FocusedAssault, true);
|
player.CastSpell(player, WSGSpellId.FocusedAssault, true);
|
||||||
@@ -537,7 +537,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
public override void RemovePlayer(Player player, ObjectGuid guid, Team team)
|
public override void RemovePlayer(Player player, ObjectGuid guid, Team team)
|
||||||
{
|
{
|
||||||
// sometimes flag aura not removed :(
|
// sometimes flag aura not removed :(
|
||||||
if (IsAllianceFlagPickedup() && m_FlagKeepers[TeamId.Alliance] == guid)
|
if (IsAllianceFlagPickedup() && m_FlagKeepers[BatttleGroundTeamId.Alliance] == guid)
|
||||||
{
|
{
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
@@ -548,7 +548,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
else
|
else
|
||||||
EventPlayerDroppedFlag(player);
|
EventPlayerDroppedFlag(player);
|
||||||
}
|
}
|
||||||
if (IsHordeFlagPickedup() && m_FlagKeepers[TeamId.Horde] == guid)
|
if (IsHordeFlagPickedup() && m_FlagKeepers[BatttleGroundTeamId.Horde] == guid)
|
||||||
{
|
{
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
@@ -592,7 +592,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
|
|
||||||
void UpdateTeamScore(int team)
|
void UpdateTeamScore(int team)
|
||||||
{
|
{
|
||||||
if (team == TeamId.Alliance)
|
if (team == BatttleGroundTeamId.Alliance)
|
||||||
UpdateWorldState(WSGWorldStates.FlagCapturesAlliance, (int)GetTeamScore(team));
|
UpdateWorldState(WSGWorldStates.FlagCapturesAlliance, (int)GetTeamScore(team));
|
||||||
else
|
else
|
||||||
UpdateWorldState(WSGWorldStates.FlagCapturesHorde, (int)GetTeamScore(team));
|
UpdateWorldState(WSGWorldStates.FlagCapturesHorde, (int)GetTeamScore(team));
|
||||||
@@ -628,13 +628,13 @@ namespace Game.BattleGrounds.Zones
|
|||||||
//buff_guid = BgObjects[BG_WS_OBJECT_BERSERKBUFF_2];
|
//buff_guid = BgObjects[BG_WS_OBJECT_BERSERKBUFF_2];
|
||||||
break;
|
break;
|
||||||
case 3646: // Alliance Flag spawn
|
case 3646: // Alliance Flag spawn
|
||||||
if (_flagState[TeamId.Horde] != 0 && _flagState[TeamId.Alliance] == 0)
|
if (_flagState[BatttleGroundTeamId.Horde] != 0 && _flagState[BatttleGroundTeamId.Alliance] == 0)
|
||||||
if (GetFlagPickerGUID(TeamId.Horde) == player.GetGUID())
|
if (GetFlagPickerGUID(BatttleGroundTeamId.Horde) == player.GetGUID())
|
||||||
EventPlayerCapturedFlag(player);
|
EventPlayerCapturedFlag(player);
|
||||||
break;
|
break;
|
||||||
case 3647: // Horde Flag spawn
|
case 3647: // Horde Flag spawn
|
||||||
if (_flagState[TeamId.Alliance] != 0 && _flagState[TeamId.Horde] == 0)
|
if (_flagState[BatttleGroundTeamId.Alliance] != 0 && _flagState[BatttleGroundTeamId.Horde] == 0)
|
||||||
if (GetFlagPickerGUID(TeamId.Alliance) == player.GetGUID())
|
if (GetFlagPickerGUID(BatttleGroundTeamId.Alliance) == player.GetGUID())
|
||||||
EventPlayerCapturedFlag(player);
|
EventPlayerCapturedFlag(player);
|
||||||
break;
|
break;
|
||||||
case 3649: // unk1
|
case 3649: // unk1
|
||||||
@@ -694,14 +694,14 @@ namespace Game.BattleGrounds.Zones
|
|||||||
}
|
}
|
||||||
|
|
||||||
WorldSafeLocsEntry sg = Global.ObjectMgr.GetWorldSafeLoc(WSGGraveyards.MainAlliance);
|
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!");
|
Log.outError(LogFilter.Sql, "BgWarsongGluch: Failed to spawn Alliance spirit guide! Battleground not created!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
sg = Global.ObjectMgr.GetWorldSafeLoc(WSGGraveyards.MainHorde);
|
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!");
|
Log.outError(LogFilter.Sql, "BgWarsongGluch: Failed to spawn Horde spirit guide! Battleground not created!");
|
||||||
return false;
|
return false;
|
||||||
@@ -715,14 +715,14 @@ namespace Game.BattleGrounds.Zones
|
|||||||
//call parent's class reset
|
//call parent's class reset
|
||||||
base.Reset();
|
base.Reset();
|
||||||
|
|
||||||
m_FlagKeepers[TeamId.Alliance].Clear();
|
m_FlagKeepers[BatttleGroundTeamId.Alliance].Clear();
|
||||||
m_FlagKeepers[TeamId.Horde].Clear();
|
m_FlagKeepers[BatttleGroundTeamId.Horde].Clear();
|
||||||
m_DroppedFlagGUID[TeamId.Alliance] = ObjectGuid.Empty;
|
m_DroppedFlagGUID[BatttleGroundTeamId.Alliance] = ObjectGuid.Empty;
|
||||||
m_DroppedFlagGUID[TeamId.Horde] = ObjectGuid.Empty;
|
m_DroppedFlagGUID[BatttleGroundTeamId.Horde] = ObjectGuid.Empty;
|
||||||
_flagState[TeamId.Alliance] = WSGFlagState.OnBase;
|
_flagState[BatttleGroundTeamId.Alliance] = WSGFlagState.OnBase;
|
||||||
_flagState[TeamId.Horde] = WSGFlagState.OnBase;
|
_flagState[BatttleGroundTeamId.Horde] = WSGFlagState.OnBase;
|
||||||
m_TeamScores[TeamId.Alliance] = 0;
|
m_TeamScores[BatttleGroundTeamId.Alliance] = 0;
|
||||||
m_TeamScores[TeamId.Horde] = 0;
|
m_TeamScores[BatttleGroundTeamId.Horde] = 0;
|
||||||
|
|
||||||
if (Global.BattlegroundMgr.IsBGWeekend(GetTypeID()))
|
if (Global.BattlegroundMgr.IsBGWeekend(GetTypeID()))
|
||||||
{
|
{
|
||||||
@@ -740,10 +740,10 @@ namespace Game.BattleGrounds.Zones
|
|||||||
_bothFlagsKept = false;
|
_bothFlagsKept = false;
|
||||||
_flagDebuffState = 0;
|
_flagDebuffState = 0;
|
||||||
_flagSpellForceTimer = 0;
|
_flagSpellForceTimer = 0;
|
||||||
_flagsDropTimer[TeamId.Alliance] = 0;
|
_flagsDropTimer[BatttleGroundTeamId.Alliance] = 0;
|
||||||
_flagsDropTimer[TeamId.Horde] = 0;
|
_flagsDropTimer[BatttleGroundTeamId.Horde] = 0;
|
||||||
_flagsTimer[TeamId.Alliance] = 0;
|
_flagsTimer[BatttleGroundTeamId.Alliance] = 0;
|
||||||
_flagsTimer[TeamId.Horde] = 0;
|
_flagsTimer[BatttleGroundTeamId.Horde] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void EndBattleground(Team winner)
|
public override void EndBattleground(Team winner)
|
||||||
@@ -800,9 +800,9 @@ namespace Game.BattleGrounds.Zones
|
|||||||
|
|
||||||
public override Team GetPrematureWinner()
|
public override Team GetPrematureWinner()
|
||||||
{
|
{
|
||||||
if (GetTeamScore(TeamId.Alliance) > GetTeamScore(TeamId.Horde))
|
if (GetTeamScore(BatttleGroundTeamId.Alliance) > GetTeamScore(BatttleGroundTeamId.Horde))
|
||||||
return Team.Alliance;
|
return Team.Alliance;
|
||||||
else if (GetTeamScore(TeamId.Horde) > GetTeamScore(TeamId.Alliance))
|
else if (GetTeamScore(BatttleGroundTeamId.Horde) > GetTeamScore(BatttleGroundTeamId.Alliance))
|
||||||
return Team.Horde;
|
return Team.Horde;
|
||||||
|
|
||||||
return base.GetPrematureWinner();
|
return base.GetPrematureWinner();
|
||||||
@@ -810,22 +810,22 @@ namespace Game.BattleGrounds.Zones
|
|||||||
|
|
||||||
public override ObjectGuid GetFlagPickerGUID(int team = -1)
|
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 m_FlagKeepers[team];
|
||||||
|
|
||||||
return ObjectGuid.Empty;
|
return ObjectGuid.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetAllianceFlagPicker(ObjectGuid guid) { m_FlagKeepers[TeamId.Alliance] = guid; }
|
void SetAllianceFlagPicker(ObjectGuid guid) { m_FlagKeepers[BatttleGroundTeamId.Alliance] = guid; }
|
||||||
void SetHordeFlagPicker(ObjectGuid guid) { m_FlagKeepers[TeamId.Horde] = guid; }
|
void SetHordeFlagPicker(ObjectGuid guid) { m_FlagKeepers[BatttleGroundTeamId.Horde] = guid; }
|
||||||
bool IsAllianceFlagPickedup() { return !m_FlagKeepers[TeamId.Alliance].IsEmpty(); }
|
bool IsAllianceFlagPickedup() { return !m_FlagKeepers[BatttleGroundTeamId.Alliance].IsEmpty(); }
|
||||||
bool IsHordeFlagPickedup() { return !m_FlagKeepers[TeamId.Horde].IsEmpty(); }
|
bool IsHordeFlagPickedup() { return !m_FlagKeepers[BatttleGroundTeamId.Horde].IsEmpty(); }
|
||||||
WSGFlagState GetFlagState(Team team) { return _flagState[GetTeamIndexByTeamId(team)]; }
|
WSGFlagState GetFlagState(Team team) { return _flagState[GetTeamIndexByTeamId(team)]; }
|
||||||
|
|
||||||
void SetLastFlagCapture(Team team) { _lastFlagCaptureTeam = (uint)team; }
|
void SetLastFlagCapture(Team team) { _lastFlagCaptureTeam = (uint)team; }
|
||||||
public override void SetDroppedFlagGUID(ObjectGuid guid, int team = -1)
|
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;
|
m_DroppedFlagGUID[team] = guid;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ namespace Game.Cache
|
|||||||
{
|
{
|
||||||
var characterCacheEntry = _characterCacheStore.LookupByKey(guid);
|
var characterCacheEntry = _characterCacheStore.LookupByKey(guid);
|
||||||
if (characterCacheEntry == null)
|
if (characterCacheEntry == null)
|
||||||
return 0;
|
return Team.Other;
|
||||||
|
|
||||||
return Player.TeamForRace(characterCacheEntry.RaceId);
|
return Player.TeamForRace(characterCacheEntry.RaceId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -730,7 +730,7 @@ namespace Game.Chat
|
|||||||
{
|
{
|
||||||
void HandleDebugObjectCountMap(Map map)
|
void HandleDebugObjectCountMap(Map map)
|
||||||
{
|
{
|
||||||
handler.SendSysMessage($"Map Id: {map.GetId()} Name: '{map.GetMapName()}' Instance Id: {map.GetInstanceId()} Creatures: {map.GetObjectsStore().OfType<Creature>().Count()} GameObjects: {map.GetObjectsStore().OfType<GameObject>().Count()} SetActive Objects: {map.GetActiveNonPlayersCount()}");
|
handler.SendSysMessage($"Map Id: {map.GetId()} Name: '{map.GetMapName()}' Instance Id: {map.GetInstanceId()} Creatures: {map.GetObjectsStore().Values.OfType<Creature>().Count()} GameObjects: {map.GetObjectsStore().Values.OfType<GameObject>().Count()} SetActive Objects: {map.GetActiveNonPlayersCount()}");
|
||||||
|
|
||||||
Dictionary<uint, uint> creatureIds = new();
|
Dictionary<uint, uint> creatureIds = new();
|
||||||
foreach (var p in map.GetObjectsStore())
|
foreach (var p in map.GetObjectsStore())
|
||||||
@@ -811,13 +811,13 @@ namespace Game.Chat
|
|||||||
switch (command)
|
switch (command)
|
||||||
{
|
{
|
||||||
case "alliance":
|
case "alliance":
|
||||||
Global.WorldMgr.SetForcedWarModeFactionBalanceState(TeamId.Alliance, rewardValue.GetValueOrDefault(0));
|
Global.WorldMgr.SetForcedWarModeFactionBalanceState(BatttleGroundTeamId.Alliance, rewardValue.GetValueOrDefault(0));
|
||||||
break;
|
break;
|
||||||
case "horde":
|
case "horde":
|
||||||
Global.WorldMgr.SetForcedWarModeFactionBalanceState(TeamId.Horde, rewardValue.GetValueOrDefault(0));
|
Global.WorldMgr.SetForcedWarModeFactionBalanceState(BatttleGroundTeamId.Horde, rewardValue.GetValueOrDefault(0));
|
||||||
break;
|
break;
|
||||||
case "neutral":
|
case "neutral":
|
||||||
Global.WorldMgr.SetForcedWarModeFactionBalanceState(TeamId.Neutral);
|
Global.WorldMgr.SetForcedWarModeFactionBalanceState(BatttleGroundTeamId.Neutral);
|
||||||
break;
|
break;
|
||||||
case "off":
|
case "off":
|
||||||
Global.WorldMgr.DisableForcedWarModeFactionBalanceState();
|
Global.WorldMgr.DisableForcedWarModeFactionBalanceState();
|
||||||
@@ -1300,13 +1300,13 @@ namespace Game.Chat
|
|||||||
handler.SendSysMessage(CypherStrings.BadValue);
|
handler.SendSysMessage(CypherStrings.BadValue);
|
||||||
return false;
|
return false;
|
||||||
case "alliance":
|
case "alliance":
|
||||||
Global.WorldMgr.SetForcedWarModeFactionBalanceState(TeamId.Alliance, rewardValue);
|
Global.WorldMgr.SetForcedWarModeFactionBalanceState(BatttleGroundTeamId.Alliance, rewardValue);
|
||||||
break;
|
break;
|
||||||
case "horde":
|
case "horde":
|
||||||
Global.WorldMgr.SetForcedWarModeFactionBalanceState(TeamId.Horde, rewardValue);
|
Global.WorldMgr.SetForcedWarModeFactionBalanceState(BatttleGroundTeamId.Horde, rewardValue);
|
||||||
break;
|
break;
|
||||||
case "neutral":
|
case "neutral":
|
||||||
Global.WorldMgr.SetForcedWarModeFactionBalanceState(TeamId.Neutral);
|
Global.WorldMgr.SetForcedWarModeFactionBalanceState(BatttleGroundTeamId.Neutral);
|
||||||
break;
|
break;
|
||||||
case "off":
|
case "off":
|
||||||
Global.WorldMgr.DisableForcedWarModeFactionBalanceState();
|
Global.WorldMgr.DisableForcedWarModeFactionBalanceState();
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ namespace Game.Conditions
|
|||||||
break;
|
break;
|
||||||
case ConditionTypes.Team:
|
case ConditionTypes.Team:
|
||||||
if (player != null)
|
if (player != null)
|
||||||
condMeets = (uint)player.GetTeam() == ConditionValue1;
|
condMeets = player.GetTeam() == (Team)ConditionValue1;
|
||||||
break;
|
break;
|
||||||
case ConditionTypes.Class:
|
case ConditionTypes.Class:
|
||||||
if (unit != null)
|
if (unit != null)
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ namespace Game.Entities
|
|||||||
case GameObjectTypes.CapturePoint:
|
case GameObjectTypes.CapturePoint:
|
||||||
SetUpdateFieldValue(m_values.ModifyValue(m_gameObjectData).ModifyValue(m_gameObjectData.SpellVisualID), m_goInfo.CapturePoint.SpellVisual1);
|
SetUpdateFieldValue(m_values.ModifyValue(m_gameObjectData).ModifyValue(m_gameObjectData.SpellVisualID), m_goInfo.CapturePoint.SpellVisual1);
|
||||||
m_goValue.CapturePoint.AssaultTimer = 0;
|
m_goValue.CapturePoint.AssaultTimer = 0;
|
||||||
m_goValue.CapturePoint.LastTeamCapture = TeamId.Neutral;
|
m_goValue.CapturePoint.LastTeamCapture = BatttleGroundTeamId.Neutral;
|
||||||
m_goValue.CapturePoint.State = BattlegroundCapturePointState.Neutral;
|
m_goValue.CapturePoint.State = BattlegroundCapturePointState.Neutral;
|
||||||
UpdateCapturePoint();
|
UpdateCapturePoint();
|
||||||
if (map.Instanceable())
|
if (map.Instanceable())
|
||||||
@@ -679,7 +679,7 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_goValue.CapturePoint.LastTeamCapture = hordeCapturing ? TeamId.Horde : TeamId.Alliance;
|
m_goValue.CapturePoint.LastTeamCapture = hordeCapturing ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance;
|
||||||
UpdateCapturePoint();
|
UpdateCapturePoint();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -3462,7 +3462,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
if (player.GetBGTeam() == Team.Horde)
|
if (player.GetBGTeam() == Team.Horde)
|
||||||
{
|
{
|
||||||
if (m_goValue.CapturePoint.LastTeamCapture == TeamId.Horde)
|
if (m_goValue.CapturePoint.LastTeamCapture == BatttleGroundTeamId.Horde)
|
||||||
{
|
{
|
||||||
// defended. capture instantly.
|
// defended. capture instantly.
|
||||||
m_goValue.CapturePoint.State = BattlegroundCapturePointState.HordeCaptured;
|
m_goValue.CapturePoint.State = BattlegroundCapturePointState.HordeCaptured;
|
||||||
@@ -3491,7 +3491,7 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_goValue.CapturePoint.LastTeamCapture == TeamId.Alliance)
|
if (m_goValue.CapturePoint.LastTeamCapture == BatttleGroundTeamId.Alliance)
|
||||||
{
|
{
|
||||||
// defended. capture instantly.
|
// defended. capture instantly.
|
||||||
m_goValue.CapturePoint.State = BattlegroundCapturePointState.AllianceCaptured;
|
m_goValue.CapturePoint.State = BattlegroundCapturePointState.AllianceCaptured;
|
||||||
@@ -4549,12 +4549,12 @@ namespace Game.Entities
|
|||||||
int GetControllingTeam()
|
int GetControllingTeam()
|
||||||
{
|
{
|
||||||
if (_value < GetMaxHordeValue())
|
if (_value < GetMaxHordeValue())
|
||||||
return TeamId.Horde;
|
return BatttleGroundTeamId.Horde;
|
||||||
|
|
||||||
if (_value > GetMinAllianceValue())
|
if (_value > GetMinAllianceValue())
|
||||||
return TeamId.Alliance;
|
return BatttleGroundTeamId.Alliance;
|
||||||
|
|
||||||
return TeamId.Neutral;
|
return BatttleGroundTeamId.Neutral;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ObjectGuid> GetInsidePlayers() { return _insidePlayers; }
|
public List<ObjectGuid> GetInsidePlayers() { return _insidePlayers; }
|
||||||
@@ -4601,31 +4601,31 @@ namespace Game.Entities
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int newControllingTeam = GetControllingTeam();
|
int newControllingTeam = GetControllingTeam();
|
||||||
int assaultingTeam = pointsGained > 0 ? TeamId.Alliance : TeamId.Horde;
|
int assaultingTeam = pointsGained > 0 ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde;
|
||||||
|
|
||||||
if (oldControllingTeam != newControllingTeam)
|
if (oldControllingTeam != newControllingTeam)
|
||||||
_contestedTriggered = false;
|
_contestedTriggered = false;
|
||||||
|
|
||||||
if (oldControllingTeam != TeamId.Alliance && newControllingTeam == TeamId.Alliance)
|
if (oldControllingTeam != BatttleGroundTeamId.Alliance && newControllingTeam == BatttleGroundTeamId.Alliance)
|
||||||
TriggerEvent(_owner.GetGoInfo().ControlZone.ProgressEventAlliance);
|
TriggerEvent(_owner.GetGoInfo().ControlZone.ProgressEventAlliance);
|
||||||
else if (oldControllingTeam != TeamId.Horde && newControllingTeam == TeamId.Horde)
|
else if (oldControllingTeam != BatttleGroundTeamId.Horde && newControllingTeam == BatttleGroundTeamId.Horde)
|
||||||
TriggerEvent(_owner.GetGoInfo().ControlZone.ProgressEventHorde);
|
TriggerEvent(_owner.GetGoInfo().ControlZone.ProgressEventHorde);
|
||||||
else if (oldControllingTeam == TeamId.Horde && newControllingTeam == TeamId.Neutral)
|
else if (oldControllingTeam == BatttleGroundTeamId.Horde && newControllingTeam == BatttleGroundTeamId.Neutral)
|
||||||
TriggerEvent(_owner.GetGoInfo().ControlZone.NeutralEventHorde);
|
TriggerEvent(_owner.GetGoInfo().ControlZone.NeutralEventHorde);
|
||||||
else if (oldControllingTeam == TeamId.Alliance && newControllingTeam == TeamId.Neutral)
|
else if (oldControllingTeam == BatttleGroundTeamId.Alliance && newControllingTeam == BatttleGroundTeamId.Neutral)
|
||||||
TriggerEvent(_owner.GetGoInfo().ControlZone.NeutralEventAlliance);
|
TriggerEvent(_owner.GetGoInfo().ControlZone.NeutralEventAlliance);
|
||||||
|
|
||||||
if (roundedValue == 100 && newControllingTeam == TeamId.Alliance && assaultingTeam == TeamId.Alliance)
|
if (roundedValue == 100 && newControllingTeam == BatttleGroundTeamId.Alliance && assaultingTeam == BatttleGroundTeamId.Alliance)
|
||||||
TriggerEvent(_owner.GetGoInfo().ControlZone.CaptureEventAlliance);
|
TriggerEvent(_owner.GetGoInfo().ControlZone.CaptureEventAlliance);
|
||||||
else if (roundedValue == 0 && newControllingTeam == TeamId.Horde && assaultingTeam == TeamId.Horde)
|
else if (roundedValue == 0 && newControllingTeam == BatttleGroundTeamId.Horde && assaultingTeam == BatttleGroundTeamId.Horde)
|
||||||
TriggerEvent(_owner.GetGoInfo().ControlZone.CaptureEventHorde);
|
TriggerEvent(_owner.GetGoInfo().ControlZone.CaptureEventHorde);
|
||||||
|
|
||||||
if (oldRoundedValue == 100 && assaultingTeam == TeamId.Horde && !_contestedTriggered)
|
if (oldRoundedValue == 100 && assaultingTeam == BatttleGroundTeamId.Horde && !_contestedTriggered)
|
||||||
{
|
{
|
||||||
TriggerEvent(_owner.GetGoInfo().ControlZone.ContestedEventHorde);
|
TriggerEvent(_owner.GetGoInfo().ControlZone.ContestedEventHorde);
|
||||||
_contestedTriggered = true;
|
_contestedTriggered = true;
|
||||||
}
|
}
|
||||||
else if (oldRoundedValue == 0 && assaultingTeam == TeamId.Alliance && !_contestedTriggered)
|
else if (oldRoundedValue == 0 && assaultingTeam == BatttleGroundTeamId.Alliance && !_contestedTriggered)
|
||||||
{
|
{
|
||||||
TriggerEvent(_owner.GetGoInfo().ControlZone.ContestedEventAlliance);
|
TriggerEvent(_owner.GetGoInfo().ControlZone.ContestedEventAlliance);
|
||||||
_contestedTriggered = true;
|
_contestedTriggered = true;
|
||||||
|
|||||||
@@ -1623,7 +1623,7 @@ namespace Game.Entities
|
|||||||
// 0 1 2 3 4 5 6 7 8 9 10
|
// 0 1 2 3 4 5 6 7 8 9 10
|
||||||
// SELECT instanceId, team, joinX, joinY, joinZ, joinO, joinMapId, taxiStart, taxiEnd, mountSpell, queueTypeId FROM character_Battleground_data WHERE guid = ?
|
// SELECT instanceId, team, joinX, joinY, joinZ, joinO, joinMapId, taxiStart, taxiEnd, mountSpell, queueTypeId FROM character_Battleground_data WHERE guid = ?
|
||||||
m_bgData.bgInstanceID = result.Read<uint>(0);
|
m_bgData.bgInstanceID = result.Read<uint>(0);
|
||||||
m_bgData.bgTeam = result.Read<ushort>(1);
|
m_bgData.bgTeam = (Team)result.Read<ushort>(1);
|
||||||
m_bgData.joinPos = new WorldLocation(result.Read<ushort>(6), result.Read<float>(2), result.Read<float>(3), result.Read<float>(4), result.Read<float>(5));
|
m_bgData.joinPos = new WorldLocation(result.Read<ushort>(6), result.Read<float>(2), result.Read<float>(3), result.Read<float>(4), result.Read<float>(5));
|
||||||
m_bgData.taxiPath[0] = result.Read<uint>(7);
|
m_bgData.taxiPath[0] = result.Read<uint>(7);
|
||||||
m_bgData.taxiPath[1] = result.Read<uint>(8);
|
m_bgData.taxiPath[1] = result.Read<uint>(8);
|
||||||
@@ -2784,7 +2784,7 @@ namespace Game.Entities
|
|||||||
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_PLAYER_BGDATA);
|
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_PLAYER_BGDATA);
|
||||||
stmt.AddValue(0, GetGUID().GetCounter());
|
stmt.AddValue(0, GetGUID().GetCounter());
|
||||||
stmt.AddValue(1, m_bgData.bgInstanceID);
|
stmt.AddValue(1, m_bgData.bgInstanceID);
|
||||||
stmt.AddValue(2, m_bgData.bgTeam);
|
stmt.AddValue(2, (ushort)m_bgData.bgTeam);
|
||||||
stmt.AddValue(3, m_bgData.joinPos.GetPositionX());
|
stmt.AddValue(3, m_bgData.joinPos.GetPositionX());
|
||||||
stmt.AddValue(4, m_bgData.joinPos.GetPositionY());
|
stmt.AddValue(4, m_bgData.joinPos.GetPositionY());
|
||||||
stmt.AddValue(5, m_bgData.joinPos.GetPositionZ());
|
stmt.AddValue(5, m_bgData.joinPos.GetPositionZ());
|
||||||
|
|||||||
@@ -578,7 +578,7 @@ namespace Game.Entities
|
|||||||
public byte bgAfkReportedCount;
|
public byte bgAfkReportedCount;
|
||||||
public long bgAfkReportedTimer;
|
public long bgAfkReportedTimer;
|
||||||
|
|
||||||
public uint bgTeam; //< What side the player will be added to
|
public Team bgTeam; //< What side the player will be added to
|
||||||
|
|
||||||
public uint mountSpell;
|
public uint mountSpell;
|
||||||
public uint[] taxiPath = new uint[2];
|
public uint[] taxiPath = new uint[2];
|
||||||
|
|||||||
@@ -580,13 +580,13 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void SetBGTeam(Team team)
|
public void SetBGTeam(Team team)
|
||||||
{
|
{
|
||||||
m_bgData.bgTeam = (uint)team;
|
m_bgData.bgTeam = team;
|
||||||
SetArenaFaction((byte)(team == Team.Alliance ? 1 : 0));
|
SetArenaFaction((byte)(team == Team.Alliance ? 1 : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Team GetBGTeam()
|
public Team GetBGTeam()
|
||||||
{
|
{
|
||||||
return m_bgData.bgTeam != 0 ? (Team)m_bgData.bgTeam : GetTeam();
|
return m_bgData.bgTeam != 0 ? m_bgData.bgTeam : GetTeam();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LeaveBattleground(bool teleportToEntryPoint = true)
|
public void LeaveBattleground(bool teleportToEntryPoint = true)
|
||||||
|
|||||||
@@ -5179,13 +5179,13 @@ namespace Game.Entities
|
|||||||
return (uint)rEntry.Alliance;
|
return (uint)rEntry.Alliance;
|
||||||
|
|
||||||
Log.outError(LogFilter.Player, "Race ({0}) not found in DBC: wrong DBC files?", race);
|
Log.outError(LogFilter.Player, "Race ({0}) not found in DBC: wrong DBC files?", race);
|
||||||
return TeamId.Neutral;
|
return BatttleGroundTeamId.Neutral;
|
||||||
}
|
}
|
||||||
public Team GetTeam() { return m_team; }
|
public Team GetTeam() { return m_team; }
|
||||||
public int GetTeamId() { return m_team == Team.Alliance ? TeamId.Alliance : TeamId.Horde; }
|
public int GetTeamId() { return m_team == Team.Alliance ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde; }
|
||||||
|
|
||||||
public Team GetEffectiveTeam() { return HasPlayerFlagEx(PlayerFlagsEx.MercenaryMode) ? (GetTeam() == Team.Alliance ? Team.Horde : Team.Alliance) : GetTeam(); }
|
public Team GetEffectiveTeam() { return HasPlayerFlagEx(PlayerFlagsEx.MercenaryMode) ? (GetTeam() == Team.Alliance ? Team.Horde : Team.Alliance) : GetTeam(); }
|
||||||
public int GetEffectiveTeamId() { return GetEffectiveTeam() == Team.Alliance ? TeamId.Alliance : TeamId.Horde; }
|
public int GetEffectiveTeamId() { return GetEffectiveTeam() == Team.Alliance ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde; }
|
||||||
|
|
||||||
//Money
|
//Money
|
||||||
public ulong GetMoney() { return m_activePlayerData.Coinage; }
|
public ulong GetMoney() { return m_activePlayerData.Coinage; }
|
||||||
|
|||||||
@@ -278,13 +278,13 @@ namespace Game
|
|||||||
uint team = Player.TeamIdForRace(charCreate.CreateInfo.RaceId);
|
uint team = Player.TeamIdForRace(charCreate.CreateInfo.RaceId);
|
||||||
switch (team)
|
switch (team)
|
||||||
{
|
{
|
||||||
case TeamId.Alliance:
|
case BatttleGroundTeamId.Alliance:
|
||||||
disabled = Convert.ToBoolean(mask & (1 << 0));
|
disabled = Convert.ToBoolean(mask & (1 << 0));
|
||||||
break;
|
break;
|
||||||
case TeamId.Horde:
|
case BatttleGroundTeamId.Horde:
|
||||||
disabled = Convert.ToBoolean(mask & (1 << 1));
|
disabled = Convert.ToBoolean(mask & (1 << 1));
|
||||||
break;
|
break;
|
||||||
case TeamId.Neutral:
|
case BatttleGroundTeamId.Neutral:
|
||||||
disabled = Convert.ToBoolean(mask & (1 << 2));
|
disabled = Convert.ToBoolean(mask & (1 << 2));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1771,7 +1771,7 @@ namespace Game
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint newTeamId = Player.TeamIdForRace(factionChangeInfo.RaceID);
|
uint newTeamId = Player.TeamIdForRace(factionChangeInfo.RaceID);
|
||||||
if (newTeamId == TeamId.Neutral)
|
if (newTeamId == BatttleGroundTeamId.Neutral)
|
||||||
{
|
{
|
||||||
SendCharFactionChange(ResponseCodes.CharCreateRestrictedRaceclass, factionChangeInfo);
|
SendCharFactionChange(ResponseCodes.CharCreateRestrictedRaceclass, factionChangeInfo);
|
||||||
return;
|
return;
|
||||||
@@ -1890,7 +1890,7 @@ namespace Game
|
|||||||
stmt.AddValue(0, lowGuid);
|
stmt.AddValue(0, lowGuid);
|
||||||
|
|
||||||
// Faction specific languages
|
// Faction specific languages
|
||||||
if (newTeamId == TeamId.Horde)
|
if (newTeamId == BatttleGroundTeamId.Horde)
|
||||||
stmt.AddValue(1, 109);
|
stmt.AddValue(1, 109);
|
||||||
else
|
else
|
||||||
stmt.AddValue(1, 98);
|
stmt.AddValue(1, 98);
|
||||||
@@ -1965,7 +1965,7 @@ namespace Game
|
|||||||
string taximaskstream = "";
|
string taximaskstream = "";
|
||||||
|
|
||||||
|
|
||||||
var factionMask = newTeamId == TeamId.Horde ? CliDB.HordeTaxiNodesMask : CliDB.AllianceTaxiNodesMask;
|
var factionMask = newTeamId == BatttleGroundTeamId.Horde ? CliDB.HordeTaxiNodesMask : CliDB.AllianceTaxiNodesMask;
|
||||||
for (int i = 0; i < factionMask.Length; ++i)
|
for (int i = 0; i < factionMask.Length; ++i)
|
||||||
{
|
{
|
||||||
// i = (315 - 1) / 8 = 39
|
// i = (315 - 1) / 8 = 39
|
||||||
@@ -2019,7 +2019,7 @@ namespace Game
|
|||||||
|
|
||||||
WorldLocation loc;
|
WorldLocation loc;
|
||||||
ushort zoneId = 0;
|
ushort zoneId = 0;
|
||||||
if (newTeamId == TeamId.Alliance)
|
if (newTeamId == BatttleGroundTeamId.Alliance)
|
||||||
{
|
{
|
||||||
loc = new WorldLocation(0, -8867.68f, 673.373f, 97.9034f, 0.0f);
|
loc = new WorldLocation(0, -8867.68f, 673.373f, 97.9034f, 0.0f);
|
||||||
zoneId = 1519;
|
zoneId = 1519;
|
||||||
@@ -2046,19 +2046,19 @@ namespace Game
|
|||||||
uint achiev_horde = it.Value;
|
uint achiev_horde = it.Value;
|
||||||
|
|
||||||
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT);
|
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT);
|
||||||
stmt.AddValue(0, (ushort)(newTeamId == TeamId.Alliance ? achiev_alliance : achiev_horde));
|
stmt.AddValue(0, (ushort)(newTeamId == BatttleGroundTeamId.Alliance ? achiev_alliance : achiev_horde));
|
||||||
stmt.AddValue(1, lowGuid);
|
stmt.AddValue(1, lowGuid);
|
||||||
trans.Append(stmt);
|
trans.Append(stmt);
|
||||||
|
|
||||||
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_ACHIEVEMENT);
|
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_ACHIEVEMENT);
|
||||||
stmt.AddValue(0, (ushort)(newTeamId == TeamId.Alliance ? achiev_alliance : achiev_horde));
|
stmt.AddValue(0, (ushort)(newTeamId == BatttleGroundTeamId.Alliance ? achiev_alliance : achiev_horde));
|
||||||
stmt.AddValue(1, (ushort)(newTeamId == TeamId.Alliance ? achiev_horde : achiev_alliance));
|
stmt.AddValue(1, (ushort)(newTeamId == BatttleGroundTeamId.Alliance ? achiev_horde : achiev_alliance));
|
||||||
stmt.AddValue(2, lowGuid);
|
stmt.AddValue(2, lowGuid);
|
||||||
trans.Append(stmt);
|
trans.Append(stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Item conversion
|
// Item conversion
|
||||||
var itemConversionMap = newTeamId == TeamId.Alliance ? Global.ObjectMgr.FactionChangeItemsHordeToAlliance : Global.ObjectMgr.FactionChangeItemsAllianceToHorde;
|
var itemConversionMap = newTeamId == BatttleGroundTeamId.Alliance ? Global.ObjectMgr.FactionChangeItemsHordeToAlliance : Global.ObjectMgr.FactionChangeItemsAllianceToHorde;
|
||||||
foreach (var it in itemConversionMap)
|
foreach (var it in itemConversionMap)
|
||||||
{
|
{
|
||||||
uint oldItemId = it.Key;
|
uint oldItemId = it.Key;
|
||||||
@@ -2084,12 +2084,12 @@ namespace Game
|
|||||||
|
|
||||||
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST);
|
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST);
|
||||||
stmt.AddValue(0, lowGuid);
|
stmt.AddValue(0, lowGuid);
|
||||||
stmt.AddValue(1, (newTeamId == TeamId.Alliance ? quest_alliance : quest_horde));
|
stmt.AddValue(1, (newTeamId == BatttleGroundTeamId.Alliance ? quest_alliance : quest_horde));
|
||||||
trans.Append(stmt);
|
trans.Append(stmt);
|
||||||
|
|
||||||
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_QUESTSTATUS_REWARDED_FACTION_CHANGE);
|
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_QUESTSTATUS_REWARDED_FACTION_CHANGE);
|
||||||
stmt.AddValue(0, (newTeamId == TeamId.Alliance ? quest_alliance : quest_horde));
|
stmt.AddValue(0, (newTeamId == BatttleGroundTeamId.Alliance ? quest_alliance : quest_horde));
|
||||||
stmt.AddValue(1, (newTeamId == TeamId.Alliance ? quest_horde : quest_alliance));
|
stmt.AddValue(1, (newTeamId == BatttleGroundTeamId.Alliance ? quest_horde : quest_alliance));
|
||||||
stmt.AddValue(2, lowGuid);
|
stmt.AddValue(2, lowGuid);
|
||||||
trans.Append(stmt);
|
trans.Append(stmt);
|
||||||
}
|
}
|
||||||
@@ -2104,7 +2104,7 @@ namespace Game
|
|||||||
var questTemplates = Global.ObjectMgr.GetQuestTemplates();
|
var questTemplates = Global.ObjectMgr.GetQuestTemplates();
|
||||||
foreach (Quest quest in questTemplates.Values)
|
foreach (Quest quest in questTemplates.Values)
|
||||||
{
|
{
|
||||||
RaceMask<ulong> newRaceMask = newTeamId == TeamId.Alliance ? RaceMask.Alliance : RaceMask.Horde;
|
RaceMask<ulong> newRaceMask = newTeamId == BatttleGroundTeamId.Alliance ? RaceMask.Alliance : RaceMask.Horde;
|
||||||
if (quest.AllowableRaces.RawValue != unchecked((ulong)-1) && (quest.AllowableRaces & newRaceMask).IsEmpty())
|
if (quest.AllowableRaces.RawValue != unchecked((ulong)-1) && (quest.AllowableRaces & newRaceMask).IsEmpty())
|
||||||
{
|
{
|
||||||
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE_BY_QUEST);
|
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE_BY_QUEST);
|
||||||
@@ -2122,13 +2122,13 @@ namespace Game
|
|||||||
uint spell_horde = it.Value;
|
uint spell_horde = it.Value;
|
||||||
|
|
||||||
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_SPELL_BY_SPELL);
|
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_SPELL_BY_SPELL);
|
||||||
stmt.AddValue(0, (newTeamId == TeamId.Alliance ? spell_alliance : spell_horde));
|
stmt.AddValue(0, (newTeamId == BatttleGroundTeamId.Alliance ? spell_alliance : spell_horde));
|
||||||
stmt.AddValue(1, lowGuid);
|
stmt.AddValue(1, lowGuid);
|
||||||
trans.Append(stmt);
|
trans.Append(stmt);
|
||||||
|
|
||||||
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_SPELL_FACTION_CHANGE);
|
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_SPELL_FACTION_CHANGE);
|
||||||
stmt.AddValue(0, (newTeamId == TeamId.Alliance ? spell_alliance : spell_horde));
|
stmt.AddValue(0, (newTeamId == BatttleGroundTeamId.Alliance ? spell_alliance : spell_horde));
|
||||||
stmt.AddValue(1, (newTeamId == TeamId.Alliance ? spell_horde : spell_alliance));
|
stmt.AddValue(1, (newTeamId == BatttleGroundTeamId.Alliance ? spell_horde : spell_alliance));
|
||||||
stmt.AddValue(2, lowGuid);
|
stmt.AddValue(2, lowGuid);
|
||||||
trans.Append(stmt);
|
trans.Append(stmt);
|
||||||
}
|
}
|
||||||
@@ -2138,8 +2138,8 @@ namespace Game
|
|||||||
{
|
{
|
||||||
uint reputation_alliance = it.Key;
|
uint reputation_alliance = it.Key;
|
||||||
uint reputation_horde = it.Value;
|
uint reputation_horde = it.Value;
|
||||||
uint newReputation = (newTeamId == TeamId.Alliance) ? reputation_alliance : reputation_horde;
|
uint newReputation = (newTeamId == BatttleGroundTeamId.Alliance) ? reputation_alliance : reputation_horde;
|
||||||
uint oldReputation = (newTeamId == TeamId.Alliance) ? reputation_horde : reputation_alliance;
|
uint oldReputation = (newTeamId == BatttleGroundTeamId.Alliance) ? reputation_horde : reputation_alliance;
|
||||||
|
|
||||||
// select old standing set in db
|
// select old standing set in db
|
||||||
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_REP_BY_FACTION);
|
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_REP_BY_FACTION);
|
||||||
@@ -2196,7 +2196,7 @@ namespace Game
|
|||||||
CharTitlesRecord atitleInfo = CliDB.CharTitlesStorage.LookupByKey(title_alliance);
|
CharTitlesRecord atitleInfo = CliDB.CharTitlesStorage.LookupByKey(title_alliance);
|
||||||
CharTitlesRecord htitleInfo = CliDB.CharTitlesStorage.LookupByKey(title_horde);
|
CharTitlesRecord htitleInfo = CliDB.CharTitlesStorage.LookupByKey(title_horde);
|
||||||
// new team
|
// new team
|
||||||
if (newTeamId == TeamId.Alliance)
|
if (newTeamId == BatttleGroundTeamId.Alliance)
|
||||||
{
|
{
|
||||||
uint maskID = htitleInfo.MaskID;
|
uint maskID = htitleInfo.MaskID;
|
||||||
int index = (int)maskID / 32;
|
int index = (int)maskID / 32;
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ namespace Game
|
|||||||
// We're not in BG
|
// We're not in BG
|
||||||
player.SetBattlegroundId(0, BattlegroundTypeId.None);
|
player.SetBattlegroundId(0, BattlegroundTypeId.None);
|
||||||
// reset destination bg team
|
// reset destination bg team
|
||||||
player.SetBGTeam(0);
|
player.SetBGTeam(Team.Other);
|
||||||
}
|
}
|
||||||
// join to bg case
|
// join to bg case
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -216,8 +216,8 @@ namespace Game.Maps
|
|||||||
if (((1 << (int)GetBossState(info.BossStateId)) & info.BossStates) == 0)
|
if (((1 << (int)GetBossState(info.BossStateId)) & info.BossStates) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (((instance.GetTeamIdInInstance() == TeamId.Alliance) && info.Flags.HasFlag(InstanceSpawnGroupFlags.HordeOnly))
|
if (((instance.GetTeamIdInInstance() == BatttleGroundTeamId.Alliance) && info.Flags.HasFlag(InstanceSpawnGroupFlags.HordeOnly))
|
||||||
|| ((instance.GetTeamIdInInstance() == TeamId.Horde) && info.Flags.HasFlag(InstanceSpawnGroupFlags.AllianceOnly)))
|
|| ((instance.GetTeamIdInInstance() == BatttleGroundTeamId.Horde) && info.Flags.HasFlag(InstanceSpawnGroupFlags.AllianceOnly)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (info.Flags.HasAnyFlag(InstanceSpawnGroupFlags.BlockSpawn))
|
if (info.Flags.HasAnyFlag(InstanceSpawnGroupFlags.BlockSpawn))
|
||||||
|
|||||||
@@ -4795,8 +4795,8 @@ namespace Game.Maps
|
|||||||
// this make sure it gets unloaded if for some reason no player joins
|
// this make sure it gets unloaded if for some reason no player joins
|
||||||
m_unloadTimer = (uint)Math.Max(WorldConfig.GetIntValue(WorldCfg.InstanceUnloadDelay), 1);
|
m_unloadTimer = (uint)Math.Max(WorldConfig.GetIntValue(WorldCfg.InstanceUnloadDelay), 1);
|
||||||
|
|
||||||
Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceAlliance, instanceTeam == TeamId.Alliance ? 1 : 0, false, this);
|
Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceAlliance, instanceTeam == BatttleGroundTeamId.Alliance ? 1 : 0, false, this);
|
||||||
Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceHorde, instanceTeam == TeamId.Horde ? 1 : 0, false, this);
|
Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceHorde, instanceTeam == BatttleGroundTeamId.Horde ? 1 : 0, false, this);
|
||||||
|
|
||||||
if (i_instanceLock != null)
|
if (i_instanceLock != null)
|
||||||
{
|
{
|
||||||
@@ -5175,13 +5175,13 @@ namespace Game.Maps
|
|||||||
public int GetTeamIdInInstance()
|
public int GetTeamIdInInstance()
|
||||||
{
|
{
|
||||||
if (Global.WorldStateMgr.GetValue(WorldStates.TeamInInstanceAlliance, this) != 0)
|
if (Global.WorldStateMgr.GetValue(WorldStates.TeamInInstanceAlliance, this) != 0)
|
||||||
return TeamId.Alliance;
|
return BatttleGroundTeamId.Alliance;
|
||||||
if (Global.WorldStateMgr.GetValue(WorldStates.TeamInInstanceHorde, this) != 0)
|
if (Global.WorldStateMgr.GetValue(WorldStates.TeamInInstanceHorde, this) != 0)
|
||||||
return TeamId.Horde;
|
return BatttleGroundTeamId.Horde;
|
||||||
return TeamId.Neutral;
|
return BatttleGroundTeamId.Neutral;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Team GetTeamInInstance() { return GetTeamIdInInstance() == TeamId.Alliance ? Team.Alliance : Team.Horde; }
|
public Team GetTeamInInstance() { return GetTeamIdInInstance() == BatttleGroundTeamId.Alliance ? Team.Alliance : Team.Horde; }
|
||||||
|
|
||||||
public uint GetScriptId()
|
public uint GetScriptId()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -502,8 +502,8 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public override void OnCreate(Map map)
|
public override void OnCreate(Map map)
|
||||||
{
|
{
|
||||||
Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceAlliance, map.GetInstanceId() == TeamId.Alliance ? 1 : 0, false, map);
|
Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceAlliance, map.GetInstanceId() == BatttleGroundTeamId.Alliance ? 1 : 0, false, map);
|
||||||
Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceHorde, map.GetInstanceId() == TeamId.Horde ? 1 : 0, false, map);
|
Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceHorde, map.GetInstanceId() == BatttleGroundTeamId.Horde ? 1 : 0, false, map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ namespace Game.PvP
|
|||||||
public void TeamApplyBuff(uint teamIndex, uint spellId, uint spellId2)
|
public void TeamApplyBuff(uint teamIndex, uint spellId, uint spellId2)
|
||||||
{
|
{
|
||||||
TeamCastSpell(teamIndex, (int)spellId);
|
TeamCastSpell(teamIndex, (int)spellId);
|
||||||
TeamCastSpell((uint)(teamIndex == TeamId.Alliance ? TeamId.Horde : TeamId.Alliance), spellId2 != 0 ? -(int)spellId2 : -(int)spellId);
|
TeamCastSpell((uint)(teamIndex == BatttleGroundTeamId.Alliance ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance), spellId2 != 0 ? -(int)spellId2 : -(int)spellId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendDefenseMessage(uint zoneId, uint id)
|
public void SendDefenseMessage(uint zoneId, uint id)
|
||||||
@@ -254,7 +254,7 @@ namespace Game.PvP
|
|||||||
|
|
||||||
public OPvPCapturePoint(OutdoorPvP pvp)
|
public OPvPCapturePoint(OutdoorPvP pvp)
|
||||||
{
|
{
|
||||||
m_team = TeamId.Neutral;
|
m_team = BatttleGroundTeamId.Neutral;
|
||||||
OldState = ObjectiveStates.Neutral;
|
OldState = ObjectiveStates.Neutral;
|
||||||
State = ObjectiveStates.Neutral;
|
State = ObjectiveStates.Neutral;
|
||||||
PvP = pvp;
|
PvP = pvp;
|
||||||
|
|||||||
@@ -121,13 +121,13 @@ namespace Game.PvP.HellfirePeninsula
|
|||||||
base.Update(diff);
|
base.Update(diff);
|
||||||
|
|
||||||
if (m_AllianceTowersControlled == 3)
|
if (m_AllianceTowersControlled == 3)
|
||||||
TeamApplyBuff(TeamId.Alliance, SpellIds.AllianceBuff, SpellIds.HordeBuff);
|
TeamApplyBuff(BatttleGroundTeamId.Alliance, SpellIds.AllianceBuff, SpellIds.HordeBuff);
|
||||||
else if (m_HordeTowersControlled == 3)
|
else if (m_HordeTowersControlled == 3)
|
||||||
TeamApplyBuff(TeamId.Horde, SpellIds.HordeBuff, SpellIds.AllianceBuff);
|
TeamApplyBuff(BatttleGroundTeamId.Horde, SpellIds.HordeBuff, SpellIds.AllianceBuff);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TeamCastSpell(TeamId.Alliance, -(int)SpellIds.AllianceBuff);
|
TeamCastSpell(BatttleGroundTeamId.Alliance, -(int)SpellIds.AllianceBuff);
|
||||||
TeamCastSpell(TeamId.Horde, -(int)SpellIds.HordeBuff);
|
TeamCastSpell(BatttleGroundTeamId.Horde, -(int)SpellIds.HordeBuff);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetWorldState(WorldStateIds.CountA, (int)m_AllianceTowersControlled);
|
SetWorldState(WorldStateIds.CountA, (int)m_AllianceTowersControlled);
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ namespace Game.Scenarios
|
|||||||
uint scenarioID = 0;
|
uint scenarioID = 0;
|
||||||
switch (team)
|
switch (team)
|
||||||
{
|
{
|
||||||
case TeamId.Alliance:
|
case BatttleGroundTeamId.Alliance:
|
||||||
scenarioID = dbData.Scenario_A;
|
scenarioID = dbData.Scenario_A;
|
||||||
break;
|
break;
|
||||||
case TeamId.Horde:
|
case BatttleGroundTeamId.Horde:
|
||||||
scenarioID = dbData.Scenario_H;
|
scenarioID = dbData.Scenario_H;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -2634,7 +2634,7 @@ namespace Game.Spells
|
|||||||
{
|
{
|
||||||
Battleground bg = player.GetBattleground();
|
Battleground bg = player.GetBattleground();
|
||||||
if (bg != null)
|
if (bg != null)
|
||||||
bg.SetDroppedFlagGUID(go.GetGUID(), bg.GetPlayerTeam(player.GetGUID()) == Team.Alliance ? TeamId.Horde : TeamId.Alliance);
|
bg.SetDroppedFlagGUID(go.GetGUID(), bg.GetPlayerTeam(player.GetGUID()) == Team.Alliance ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4995,9 +4995,9 @@ namespace Game.Entities
|
|||||||
// team that controls the workshop in the specified area
|
// team that controls the workshop in the specified area
|
||||||
uint team = bf.GetData(newArea);
|
uint team = bf.GetData(newArea);
|
||||||
|
|
||||||
if (team == TeamId.Horde)
|
if (team == BatttleGroundTeamId.Horde)
|
||||||
return spellId == 56618;
|
return spellId == 56618;
|
||||||
else if (team == TeamId.Alliance)
|
else if (team == BatttleGroundTeamId.Alliance)
|
||||||
return spellId == 56617;
|
return spellId == 56617;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1254,8 +1254,8 @@ namespace Game
|
|||||||
|
|
||||||
public void SetForcedWarModeFactionBalanceState(int team, int reward = 0)
|
public void SetForcedWarModeFactionBalanceState(int team, int reward = 0)
|
||||||
{
|
{
|
||||||
Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.WarModeHordeBuffValue, 10 + (team == TeamId.Alliance ? reward : 0), false, null);
|
Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.WarModeHordeBuffValue, 10 + (team == BatttleGroundTeamId.Alliance ? reward : 0), false, null);
|
||||||
Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.WarModeAllianceBuffValue, 10 + (team == TeamId.Horde ? reward : 0), false, null);
|
Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.WarModeAllianceBuffValue, 10 + (team == BatttleGroundTeamId.Horde ? reward : 0), false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DisableForcedWarModeFactionBalanceState()
|
public void DisableForcedWarModeFactionBalanceState()
|
||||||
@@ -1574,13 +1574,13 @@ namespace Game
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send a packet to all players (or players selected team) in the zone (except self if mentioned)
|
// Send a packet to all players (or players selected team) in the zone (except self if mentioned)
|
||||||
public bool SendZoneMessage(uint zone, ServerPacket packet, WorldSession self = null, uint team = 0)
|
public bool SendZoneMessage(uint zone, ServerPacket packet, WorldSession self = null, Team team = 0)
|
||||||
{
|
{
|
||||||
bool foundPlayerToSend = false;
|
bool foundPlayerToSend = false;
|
||||||
foreach (var session in m_sessions.Values)
|
foreach (var session in m_sessions.Values)
|
||||||
{
|
{
|
||||||
if (session != null && session.GetPlayer() != null && session.GetPlayer().IsInWorld &&
|
if (session != null && session.GetPlayer() != null && session.GetPlayer().IsInWorld &&
|
||||||
session.GetPlayer().GetZoneId() == zone && session != self && (team == 0 || (uint)session.GetPlayer().GetTeam() == team))
|
session.GetPlayer().GetZoneId() == zone && session != self && (team == 0 || session.GetPlayer().GetTeam() == team))
|
||||||
{
|
{
|
||||||
session.SendPacket(packet);
|
session.SendPacket(packet);
|
||||||
foundPlayerToSend = true;
|
foundPlayerToSend = true;
|
||||||
@@ -1591,7 +1591,7 @@ namespace Game
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send a System Message to all players in the zone (except self if mentioned)
|
// Send a System Message to all players in the zone (except self if mentioned)
|
||||||
public void SendZoneText(uint zone, string text, WorldSession self = null, uint team = 0)
|
public void SendZoneText(uint zone, string text, WorldSession self = null, Team team = 0)
|
||||||
{
|
{
|
||||||
ChatPkt data = new();
|
ChatPkt data = new();
|
||||||
data.Initialize(ChatMsg.System, Language.Universal, null, null, text);
|
data.Initialize(ChatMsg.System, Language.Universal, null, null, text);
|
||||||
@@ -2487,9 +2487,9 @@ namespace Game
|
|||||||
if (raceFaction != null)
|
if (raceFaction != null)
|
||||||
{
|
{
|
||||||
if ((raceFaction.FactionGroup & (byte)FactionMasks.Alliance) != 0)
|
if ((raceFaction.FactionGroup & (byte)FactionMasks.Alliance) != 0)
|
||||||
warModeEnabledFaction[TeamId.Alliance] += result.Read<long>(1);
|
warModeEnabledFaction[BatttleGroundTeamId.Alliance] += result.Read<long>(1);
|
||||||
else if ((raceFaction.FactionGroup & (byte)FactionMasks.Horde) != 0)
|
else if ((raceFaction.FactionGroup & (byte)FactionMasks.Horde) != 0)
|
||||||
warModeEnabledFaction[TeamId.Horde] += result.Read<long>(1);
|
warModeEnabledFaction[BatttleGroundTeamId.Horde] += result.Read<long>(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2497,19 +2497,19 @@ namespace Game
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int dominantFaction = TeamId.Alliance;
|
int dominantFaction = BatttleGroundTeamId.Alliance;
|
||||||
int outnumberedFactionReward = 0;
|
int outnumberedFactionReward = 0;
|
||||||
|
|
||||||
if (warModeEnabledFaction.Any(val => val != 0))
|
if (warModeEnabledFaction.Any(val => val != 0))
|
||||||
{
|
{
|
||||||
long dominantFactionCount = warModeEnabledFaction[TeamId.Alliance];
|
long dominantFactionCount = warModeEnabledFaction[BatttleGroundTeamId.Alliance];
|
||||||
if (warModeEnabledFaction[TeamId.Alliance] < warModeEnabledFaction[TeamId.Horde])
|
if (warModeEnabledFaction[BatttleGroundTeamId.Alliance] < warModeEnabledFaction[BatttleGroundTeamId.Horde])
|
||||||
{
|
{
|
||||||
dominantFactionCount = warModeEnabledFaction[TeamId.Horde];
|
dominantFactionCount = warModeEnabledFaction[BatttleGroundTeamId.Horde];
|
||||||
dominantFaction = TeamId.Horde;
|
dominantFaction = BatttleGroundTeamId.Horde;
|
||||||
}
|
}
|
||||||
|
|
||||||
double total = warModeEnabledFaction[TeamId.Alliance] + warModeEnabledFaction[TeamId.Horde];
|
double total = warModeEnabledFaction[BatttleGroundTeamId.Alliance] + warModeEnabledFaction[BatttleGroundTeamId.Horde];
|
||||||
double pct = dominantFactionCount / total;
|
double pct = dominantFactionCount / total;
|
||||||
|
|
||||||
if (pct >= WorldConfig.GetFloatValue(WorldCfg.CallToArms20Pct))
|
if (pct >= WorldConfig.GetFloatValue(WorldCfg.CallToArms20Pct))
|
||||||
@@ -2520,8 +2520,8 @@ namespace Game
|
|||||||
outnumberedFactionReward = 5;
|
outnumberedFactionReward = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.WarModeHordeBuffValue, 10 + (dominantFaction == TeamId.Alliance ? outnumberedFactionReward : 0), false, null);
|
Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.WarModeHordeBuffValue, 10 + (dominantFaction == BatttleGroundTeamId.Alliance ? outnumberedFactionReward : 0), false, null);
|
||||||
Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.WarModeAllianceBuffValue, 10 + (dominantFaction == TeamId.Horde ? outnumberedFactionReward : 0), false, null);
|
Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.WarModeAllianceBuffValue, 10 + (dominantFaction == BatttleGroundTeamId.Horde ? outnumberedFactionReward : 0), false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint GetVirtualRealmAddress()
|
public uint GetVirtualRealmAddress()
|
||||||
|
|||||||
@@ -4468,10 +4468,10 @@ namespace Scripts.Spells.Generic
|
|||||||
|
|
||||||
switch (target.GetTeamId())
|
switch (target.GetTeamId())
|
||||||
{
|
{
|
||||||
case TeamId.Alliance:
|
case BatttleGroundTeamId.Alliance:
|
||||||
amount = WorldStateMgr.GetValue(WorldStates.WarModeAllianceBuffValue, target.GetMap());
|
amount = WorldStateMgr.GetValue(WorldStates.WarModeAllianceBuffValue, target.GetMap());
|
||||||
break;
|
break;
|
||||||
case TeamId.Horde:
|
case BatttleGroundTeamId.Horde:
|
||||||
amount = WorldStateMgr.GetValue(WorldStates.WarModeHordeBuffValue, target.GetMap());
|
amount = WorldStateMgr.GetValue(WorldStates.WarModeHordeBuffValue, target.GetMap());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user