Core/Battlegrounds: Strand of the Ancients Rework

Port From (https://github.com/TrinityCore/TrinityCore/commit/3d56cdc08413a0682299136a763e13e67d38818b)
This commit is contained in:
hondacrx
2024-03-06 17:19:02 -05:00
parent faab7ba1f1
commit 69d144c399
27 changed files with 876 additions and 1339 deletions
+1 -1
View File
@@ -500,7 +500,7 @@ namespace Framework.Constants
Max Max
} }
public struct BatttleGroundTeamId public struct BattleGroundTeamId
{ {
public const int Alliance = 0; public const int Alliance = 0;
public const int Horde = 1; public const int Horde = 1;
+1 -1
View File
@@ -4592,7 +4592,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 ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance); int score = (int)bg.GetTeamScore(bg.GetPlayerTeam(source.GetGUID()) == Team.Alliance ? BattleGroundTeamId.Horde : BattleGroundTeamId.Alliance);
return score >= BattlegroundScore.Min && score <= BattlegroundScore.Max; return score >= BattlegroundScore.Min && score <= BattlegroundScore.Max;
} }
case CriteriaDataType.InstanceScript: case CriteriaDataType.InstanceScript:
+1 -1
View File
@@ -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(BatttleGroundTeamId.Alliance), GetArenaTeamIdByIndex(BatttleGroundTeamId.Horde), winnerArenaTeam.GetId(), winnerChange, loserChange); GetArenaType(), GetArenaTeamIdByIndex(BattleGroundTeamId.Alliance), GetArenaTeamIdByIndex(BattleGroundTeamId.Horde), winnerArenaTeam.GetId(), winnerChange, loserChange);
if (WorldConfig.GetBoolValue(WorldCfg.ArenaLogExtendedInfo)) if (WorldConfig.GetBoolValue(WorldCfg.ArenaLogExtendedInfo))
{ {
+3 -3
View File
@@ -76,9 +76,9 @@ namespace Game.Arenas
result &= AddObject(DalaranSewersObjectTypes.Water1, DalaranSewersGameObjects.Water1, 1291.56f, 790.837f, 7.1f, 3.14238f, 0, 0, 0.694215f, -0.719768f, 120); result &= AddObject(DalaranSewersObjectTypes.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, BatttleGroundTeamId.Neutral, BattlegroundConst.RespawnImmediately) != null; result &= AddCreature(DalaranSewersData.NpcWaterSpout, DalaranSewersCreatureTypes.WaterfallKnockback, 1292.587f, 790.2205f, 7.19796f, 3.054326f, BattleGroundTeamId.Neutral, BattlegroundConst.RespawnImmediately) != null;
result &= AddCreature(DalaranSewersData.NpcWaterSpout, DalaranSewersCreatureTypes.PipeKnockback1, 1369.977f, 817.2882f, 16.08718f, 3.106686f, BatttleGroundTeamId.Neutral, BattlegroundConst.RespawnImmediately) != null; result &= AddCreature(DalaranSewersData.NpcWaterSpout, DalaranSewersCreatureTypes.PipeKnockback1, 1369.977f, 817.2882f, 16.08718f, 3.106686f, BattleGroundTeamId.Neutral, BattlegroundConst.RespawnImmediately) != null;
result &= AddCreature(DalaranSewersData.NpcWaterSpout, DalaranSewersCreatureTypes.PipeKnockback2, 1212.833f, 765.3871f, 16.09484f, 0.0f, BatttleGroundTeamId.Neutral, BattlegroundConst.RespawnImmediately) != null; result &= AddCreature(DalaranSewersData.NpcWaterSpout, DalaranSewersCreatureTypes.PipeKnockback2, 1212.833f, 765.3871f, 16.09484f, 0.0f, BattleGroundTeamId.Neutral, BattlegroundConst.RespawnImmediately) != null;
if (!result) if (!result)
{ {
Log.outError(LogFilter.Sql, "DalaranSewersArena: Failed to spawn collision object!"); Log.outError(LogFilter.Sql, "DalaranSewersArena: Failed to spawn collision object!");
+7 -7
View File
@@ -25,7 +25,7 @@ namespace Game.BattleFields
public BattleField(Map map) public BattleField(Map map)
{ {
m_IsEnabled = true; m_IsEnabled = true;
m_DefenderTeam = BatttleGroundTeamId.Neutral; m_DefenderTeam = BattleGroundTeamId.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 == BatttleGroundTeamId.Horde ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde); } public int GetOtherTeam(int teamIndex) { return (teamIndex == BattleGroundTeamId.Horde ? BattleGroundTeamId.Alliance : BattleGroundTeamId.Horde); }
void SetDefenderTeam(uint team) { m_DefenderTeam = team; } 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 = BatttleGroundTeamId.Neutral; m_ControlTeam = BattleGroundTeamId.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[BatttleGroundTeamId.Alliance].IsEmpty() || m_SpiritGuide[BatttleGroundTeamId.Horde].IsEmpty()) if (m_SpiritGuide[BattleGroundTeamId.Alliance].IsEmpty() || m_SpiritGuide[BattleGroundTeamId.Horde].IsEmpty())
return false; return false;
if (m_Bf.GetCreature(m_SpiritGuide[BatttleGroundTeamId.Alliance]) == null || if (m_Bf.GetCreature(m_SpiritGuide[BattleGroundTeamId.Alliance]) == null ||
m_Bf.GetCreature(m_SpiritGuide[BatttleGroundTeamId.Horde]) == null) m_Bf.GetCreature(m_SpiritGuide[BattleGroundTeamId.Horde]) == null)
return false; return false;
return (m_SpiritGuide[BatttleGroundTeamId.Alliance] == guid || m_SpiritGuide[BatttleGroundTeamId.Horde] == guid); return (m_SpiritGuide[BattleGroundTeamId.Alliance] == guid || m_SpiritGuide[BattleGroundTeamId.Horde] == guid);
} }
// Get the graveyard's ID. // Get the graveyard's ID.
+13 -8
View File
@@ -451,7 +451,7 @@ namespace Game.BattleGrounds
public WorldSafeLocsEntry GetTeamStartPosition(int teamId) public WorldSafeLocsEntry GetTeamStartPosition(int teamId)
{ {
Cypher.Assert(teamId < BatttleGroundTeamId.Neutral); Cypher.Assert(teamId < BattleGroundTeamId.Neutral);
return _battlegroundTemplate.StartLocation[teamId]; return _battlegroundTemplate.StartLocation[teamId];
} }
@@ -573,6 +573,11 @@ namespace Game.BattleGrounds
Global.WorldStateMgr.SetValue((int)worldStateId, value, hidden, GetBgMap()); Global.WorldStateMgr.SetValue((int)worldStateId, value, hidden, GetBgMap());
} }
public void UpdateWorldState(int worldStateId, bool value, bool hidden = false)
{
Global.WorldStateMgr.SetValue(worldStateId, value ? 1 : 0, hidden, GetBgMap());
}
public virtual void EndBattleground(Team winner) public virtual void EndBattleground(Team winner)
{ {
RemoveFromBGFreeSlotQueue(); RemoveFromBGFreeSlotQueue();
@@ -905,7 +910,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[BatttleGroundTeamId.Alliance], m_ArenaTeamIds[BatttleGroundTeamId.Horde]); Log.outDebug(LogFilter.Arena, "Arena match type: {0} for Team1Id: {1} - Team2Id: {2} started.", m_ArenaType, m_ArenaTeamIds[BattleGroundTeamId.Alliance], m_ArenaTeamIds[BattleGroundTeamId.Horde]);
} }
public void TeleportPlayerToExploitLocation(Player player) public void TeleportPlayerToExploitLocation(Player player)
@@ -1400,7 +1405,7 @@ namespace Game.BattleGrounds
} }
} }
public virtual Creature AddCreature(uint entry, uint type, float x, float y, float z, float o, int teamIndex = BatttleGroundTeamId.Neutral, uint respawntime = 0, Transport transport = null) public virtual Creature AddCreature(uint entry, uint type, float x, float y, float z, float o, int teamIndex = BattleGroundTeamId.Neutral, uint respawntime = 0, Transport transport = null)
{ {
Map map = FindBgMap(); Map map = FindBgMap();
if (map == null) if (map == null)
@@ -1447,7 +1452,7 @@ namespace Game.BattleGrounds
return creature; return creature;
} }
public Creature AddCreature(uint entry, uint type, Position pos, int teamIndex = BatttleGroundTeamId.Neutral, uint respawntime = 0, Transport transport = null) public Creature AddCreature(uint entry, uint type, Position pos, int teamIndex = BattleGroundTeamId.Neutral, uint respawntime = 0, Transport transport = null)
{ {
return AddCreature(entry, type, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teamIndex, respawntime, transport); return AddCreature(entry, type, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teamIndex, respawntime, transport);
} }
@@ -1506,7 +1511,7 @@ namespace Game.BattleGrounds
public bool AddSpiritGuide(uint type, float x, float y, float z, float o, int teamIndex) public bool AddSpiritGuide(uint type, float x, float y, float z, float o, int teamIndex)
{ {
uint entry = (uint)(teamIndex == BatttleGroundTeamId.Alliance ? BattlegroundCreatures.A_SpiritGuide : BattlegroundCreatures.H_SpiritGuide); uint entry = (uint)(teamIndex == BattleGroundTeamId.Alliance ? BattlegroundCreatures.A_SpiritGuide : BattlegroundCreatures.H_SpiritGuide);
if (AddCreature(entry, type, x, y, z, o) != null) if (AddCreature(entry, type, x, y, z, o) != null)
return true; return true;
@@ -1516,7 +1521,7 @@ namespace Game.BattleGrounds
return false; return false;
} }
public bool AddSpiritGuide(uint type, Position pos, int teamIndex = BatttleGroundTeamId.Neutral) public bool AddSpiritGuide(uint type, Position pos, int teamIndex = BattleGroundTeamId.Neutral)
{ {
return AddSpiritGuide(type, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teamIndex); return AddSpiritGuide(type, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teamIndex);
} }
@@ -1702,7 +1707,7 @@ namespace Game.BattleGrounds
public uint GetTeamScore(int teamIndex) public uint GetTeamScore(int teamIndex)
{ {
if (teamIndex == BatttleGroundTeamId.Alliance || teamIndex == BatttleGroundTeamId.Horde) if (teamIndex == BattleGroundTeamId.Alliance || teamIndex == BattleGroundTeamId.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());
@@ -1855,7 +1860,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 ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde; } public static int GetTeamIndexByTeamId(Team team) { return team == Team.Alliance ? BattleGroundTeamId.Alliance : BattleGroundTeamId.Horde; }
public uint GetPlayersCountByTeam(Team team) { return m_PlayersCount[GetTeamIndexByTeamId(team)]; } public uint GetPlayersCountByTeam(Team team) { return m_PlayersCount[GetTeamIndexByTeamId(team)]; }
void UpdatePlayersCountByTeam(Team team, bool remove) void UpdatePlayersCountByTeam(Team team, bool remove)
{ {
@@ -8,6 +8,7 @@ using Game.BattleGrounds.Zones.AlteracValley;
using Game.BattleGrounds.Zones.ArathisBasin; using Game.BattleGrounds.Zones.ArathisBasin;
using Game.BattleGrounds.Zones.EyeofStorm; using Game.BattleGrounds.Zones.EyeofStorm;
using Game.BattleGrounds.Zones.WarsongGluch; using Game.BattleGrounds.Zones.WarsongGluch;
using Game.BattleGrounds.Zones.StrandOfAncients;
using Game.DataStorage; using Game.DataStorage;
using Game.Entities; using Game.Entities;
using Game.Networking.Packets; using Game.Networking.Packets;
@@ -147,7 +148,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 ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance); battlefieldStatus.ArenaFaction = (byte)(player.GetBGTeam() == Team.Horde ? BattleGroundTeamId.Horde : BattleGroundTeamId.Alliance);
battlefieldStatus.LeftEarly = false; battlefieldStatus.LeftEarly = false;
battlefieldStatus.StartTimer = bg.GetElapsedTime(); battlefieldStatus.StartTimer = bg.GetElapsedTime();
battlefieldStatus.Mapid = bg.GetMapId(); battlefieldStatus.Mapid = bg.GetMapId();
@@ -353,8 +354,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[BatttleGroundTeamId.Alliance] = start; bgTemplate.StartLocation[BattleGroundTeamId.Alliance] = start;
else if (bgTemplate.StartLocation[BatttleGroundTeamId.Alliance] != null) // reload case else if (bgTemplate.StartLocation[BattleGroundTeamId.Alliance] != null) // reload case
Log.outError(LogFilter.Sql, $"Table `battleground_template` for id {bgTemplate.Id} contains a non-existing WorldSafeLocs.dbc id {startId} in field `AllianceStartLoc`. Ignoring."); 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
{ {
@@ -365,8 +366,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[BatttleGroundTeamId.Horde] = start; bgTemplate.StartLocation[BattleGroundTeamId.Horde] = start;
else if (bgTemplate.StartLocation[BatttleGroundTeamId.Horde] != null) // reload case else if (bgTemplate.StartLocation[BattleGroundTeamId.Horde] != null) // reload case
Log.outError(LogFilter.Sql, $"Table `battleground_template` for id {bgTemplate.Id} contains a non-existing WorldSafeLocs.dbc id {startId} in field `HordeStartLoc`. Ignoring."); 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
{ {
+51 -51
View File
@@ -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 = BatttleGroundTeamId.Alliance; //default set to TeamIndex.Alliance - or non rated arenas! uint team_index = BattleGroundTeamId.Alliance; //default set to TeamIndex.Alliance - or non rated arenas!
if (m_queueId.TeamSize == 0) if (m_queueId.TeamSize == 0)
{ {
if (ginfo.Team == Team.Horde) if (ginfo.Team == Team.Horde)
team_index = BatttleGroundTeamId.Horde; team_index = BattleGroundTeamId.Horde;
} }
else else
{ {
if (m_queueId.Rated) if (m_queueId.Rated)
team_index = BatttleGroundTeamId.Horde; //for rated arenas use TeamIndex.Horde team_index = BattleGroundTeamId.Horde; //for rated arenas use TeamIndex.Horde
} }
//store pointer to arrayindex of player that was added first //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 = BatttleGroundTeamId.Alliance; //default set to TeamIndex.Alliance - or non rated arenas! uint team_index = BattleGroundTeamId.Alliance; //default set to TeamIndex.Alliance - or non rated arenas!
if (m_queueId.TeamSize == 0) if (m_queueId.TeamSize == 0)
{ {
if (ginfo.Team == Team.Horde) if (ginfo.Team == Team.Horde)
team_index = BatttleGroundTeamId.Horde; team_index = BattleGroundTeamId.Horde;
} }
else else
{ {
if (m_queueId.Rated) if (m_queueId.Rated)
team_index = BatttleGroundTeamId.Horde; //for rated arenas use TeamIndex.Horde team_index = BattleGroundTeamId.Horde; //for rated arenas use TeamIndex.Horde
} }
//check if there is enought values(we always add values > 0) //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[BatttleGroundTeamId.Alliance].AddGroup(info, aliFree); alyIndex++) for (; alyIndex < aliCount && m_SelectionPools[BattleGroundTeamId.Alliance].AddGroup(info, aliFree); alyIndex++)
info = m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalAlliance][listIndex++]; 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[BatttleGroundTeamId.Horde].AddGroup(info, hordeFree); hordeIndex++) for (; hordeIndex < hordeCount && m_SelectionPools[BattleGroundTeamId.Horde].AddGroup(info, hordeFree); hordeIndex++)
info = m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalHorde][listIndex++]; 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[BatttleGroundTeamId.Alliance].GetPlayerCount()); int diffAli = (int)(aliFree - m_SelectionPools[BattleGroundTeamId.Alliance].GetPlayerCount());
int diffHorde = (int)(hordeFree - m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount()); int diffHorde = (int)(hordeFree - m_SelectionPools[BattleGroundTeamId.Horde].GetPlayerCount());
while (Math.Abs(diffAli - diffHorde) > 1 && (m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() > 0 || m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount() > 0)) while (Math.Abs(diffAli - diffHorde) > 1 && (m_SelectionPools[BattleGroundTeamId.Horde].GetPlayerCount() > 0 || m_SelectionPools[BattleGroundTeamId.Alliance].GetPlayerCount() > 0))
{ {
//each cycle execution we need to kick at least 1 group //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[BatttleGroundTeamId.Alliance].KickGroup((uint)(diffHorde - diffAli))) if (m_SelectionPools[BattleGroundTeamId.Alliance].KickGroup((uint)(diffHorde - diffAli)))
{ {
for (; alyIndex < aliCount && m_SelectionPools[BatttleGroundTeamId.Alliance].AddGroup(m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalAlliance][alyIndex], (uint)((aliFree >= diffHorde) ? aliFree - diffHorde : 0)); alyIndex++) for (; alyIndex < aliCount && m_SelectionPools[BattleGroundTeamId.Alliance].AddGroup(m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalAlliance][alyIndex], (uint)((aliFree >= diffHorde) ? aliFree - diffHorde : 0)); alyIndex++)
++alyIndex; ++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[BatttleGroundTeamId.Alliance].GetPlayerCount() == 0) if (m_SelectionPools[BattleGroundTeamId.Alliance].GetPlayerCount() == 0)
{ {
if (aliFree <= diffHorde + 1) if (aliFree <= diffHorde + 1)
break; break;
m_SelectionPools[BatttleGroundTeamId.Horde].KickGroup((uint)(diffHorde - diffAli)); m_SelectionPools[BattleGroundTeamId.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[BatttleGroundTeamId.Horde].KickGroup((uint)(diffAli - diffHorde))) if (m_SelectionPools[BattleGroundTeamId.Horde].KickGroup((uint)(diffAli - diffHorde)))
{ {
for (; hordeIndex < hordeCount && m_SelectionPools[BatttleGroundTeamId.Horde].AddGroup(m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalHorde][hordeIndex], (uint)((hordeFree >= diffAli) ? hordeFree - diffAli : 0)); hordeIndex++) for (; hordeIndex < hordeCount && m_SelectionPools[BattleGroundTeamId.Horde].AddGroup(m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalHorde][hordeIndex], (uint)((hordeFree >= diffAli) ? hordeFree - diffAli : 0)); hordeIndex++)
++hordeIndex; ++hordeIndex;
} }
if (m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() == 0) if (m_SelectionPools[BattleGroundTeamId.Horde].GetPlayerCount() == 0)
{ {
if (hordeFree <= diffAli + 1) if (hordeFree <= diffAli + 1)
break; break;
m_SelectionPools[BatttleGroundTeamId.Alliance].KickGroup((uint)(diffAli - diffHorde)); m_SelectionPools[BattleGroundTeamId.Alliance].KickGroup((uint)(diffAli - diffHorde));
} }
} }
//count diffs after small update //count diffs after small update
diffAli = (int)(aliFree - m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount()); diffAli = (int)(aliFree - m_SelectionPools[BattleGroundTeamId.Alliance].GetPlayerCount());
diffHorde = (int)(hordeFree - m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount()); diffHorde = (int)(hordeFree - m_SelectionPools[BattleGroundTeamId.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[BatttleGroundTeamId.Alliance].AddGroup(ali_group, MaxPlayersPerTeam); m_SelectionPools[BattleGroundTeamId.Alliance].AddGroup(ali_group, MaxPlayersPerTeam);
m_SelectionPools[BatttleGroundTeamId.Horde].AddGroup(horde_group, MaxPlayersPerTeam); m_SelectionPools[BattleGroundTeamId.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[BatttleGroundTeamId.Alliance].GetPlayerCount(), m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount()); uint maxPlayers = Math.Min(m_SelectionPools[BattleGroundTeamId.Alliance].GetPlayerCount(), m_SelectionPools[BattleGroundTeamId.Horde].GetPlayerCount());
for (uint i = 0; i < SharedConst.PvpTeamsCount; i++) 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 = BatttleGroundTeamId.Alliance; uint j = BattleGroundTeamId.Alliance;
if (m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() < m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount()) if (m_SelectionPools[BattleGroundTeamId.Horde].GetPlayerCount() < m_SelectionPools[BattleGroundTeamId.Alliance].GetPlayerCount())
j = BatttleGroundTeamId.Horde; j = BattleGroundTeamId.Horde;
if (WorldConfig.GetIntValue(WorldCfg.BattlegroundInvitationType) != (int)BattlegroundQueueInvitationType.NoBalance if (WorldConfig.GetIntValue(WorldCfg.BattlegroundInvitationType) != (int)BattlegroundQueueInvitationType.NoBalance
&& m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() >= minPlayers && m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount() >= minPlayers) && m_SelectionPools[BattleGroundTeamId.Horde].GetPlayerCount() >= minPlayers && m_SelectionPools[BattleGroundTeamId.Alliance].GetPlayerCount() >= minPlayers)
{ {
//we will try to invite more groups to team with less players indexed by j //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[BatttleGroundTeamId.Horde].GetPlayerCount() - m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount())) > 2) if (Math.Abs((m_SelectionPools[BattleGroundTeamId.Horde].GetPlayerCount() - m_SelectionPools[BattleGroundTeamId.Alliance].GetPlayerCount())) > 2)
return false; return false;
} }
//allow 1v0 if debug bg //allow 1v0 if debug bg
if (Global.BattlegroundMgr.IsTesting() && (m_SelectionPools[BatttleGroundTeamId.Alliance].GetPlayerCount() != 0 || m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() != 0)) if (Global.BattlegroundMgr.IsTesting() && (m_SelectionPools[BattleGroundTeamId.Alliance].GetPlayerCount() != 0 || m_SelectionPools[BattleGroundTeamId.Horde].GetPlayerCount() != 0))
return true; return true;
//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[BatttleGroundTeamId.Alliance].GetPlayerCount() >= minPlayers && m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() >= minPlayers; return m_SelectionPools[BattleGroundTeamId.Alliance].GetPlayerCount() >= minPlayers && m_SelectionPools[BattleGroundTeamId.Horde].GetPlayerCount() >= minPlayers;
} }
// this method will check if we can invite players to same faction skirmish match // 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[BatttleGroundTeamId.Alliance].GetPlayerCount() < minPlayersPerTeam && m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() < minPlayersPerTeam) if (m_SelectionPools[BattleGroundTeamId.Alliance].GetPlayerCount() < minPlayersPerTeam && m_SelectionPools[BattleGroundTeamId.Horde].GetPlayerCount() < minPlayersPerTeam)
return false; return false;
uint teamIndex = BatttleGroundTeamId.Alliance; uint teamIndex = BattleGroundTeamId.Alliance;
uint otherTeam = BatttleGroundTeamId.Horde; uint otherTeam = BattleGroundTeamId.Horde;
Team otherTeamId = Team.Horde; Team otherTeamId = Team.Horde;
if (m_SelectionPools[BatttleGroundTeamId.Horde].GetPlayerCount() == minPlayersPerTeam) if (m_SelectionPools[BattleGroundTeamId.Horde].GetPlayerCount() == minPlayersPerTeam)
{ {
teamIndex = BatttleGroundTeamId.Horde; teamIndex = BattleGroundTeamId.Horde;
otherTeam = BatttleGroundTeamId.Alliance; otherTeam = BattleGroundTeamId.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[BatttleGroundTeamId.Alliance].Init(); m_SelectionPools[BattleGroundTeamId.Alliance].Init();
m_SelectionPools[BatttleGroundTeamId.Horde].Init(); m_SelectionPools[BattleGroundTeamId.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[BatttleGroundTeamId.Alliance].SelectedGroups) foreach (var queueInfo in m_SelectionPools[BattleGroundTeamId.Alliance].SelectedGroups)
InviteGroupToBG(queueInfo, bg, queueInfo.Team); InviteGroupToBG(queueInfo, bg, queueInfo.Team);
foreach (var queueInfo in m_SelectionPools[BatttleGroundTeamId.Horde].SelectedGroups) foreach (var queueInfo in m_SelectionPools[BattleGroundTeamId.Horde].SelectedGroups)
InviteGroupToBG(queueInfo, bg, queueInfo.Team); 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[BatttleGroundTeamId.Alliance].Init(); m_SelectionPools[BattleGroundTeamId.Alliance].Init();
m_SelectionPools[BatttleGroundTeamId.Horde].Init(); m_SelectionPools[BattleGroundTeamId.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[BatttleGroundTeamId.Alliance + i].SelectedGroups) foreach (var queueInfo in m_SelectionPools[BattleGroundTeamId.Alliance + i].SelectedGroups)
InviteGroupToBG(queueInfo, bg2, queueInfo.Team); InviteGroupToBG(queueInfo, bg2, queueInfo.Team);
bg2.StartBattleground(); bg2.StartBattleground();
//clear structures //clear structures
m_SelectionPools[BatttleGroundTeamId.Alliance].Init(); m_SelectionPools[BattleGroundTeamId.Alliance].Init();
m_SelectionPools[BatttleGroundTeamId.Horde].Init(); m_SelectionPools[BattleGroundTeamId.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[BatttleGroundTeamId.Alliance + i].SelectedGroups) foreach (var queueInfo in m_SelectionPools[BattleGroundTeamId.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[BatttleGroundTeamId.Alliance]; GroupQueueInfo aTeam = queueArray[BattleGroundTeamId.Alliance];
GroupQueueInfo hTeam = queueArray[BatttleGroundTeamId.Horde]; GroupQueueInfo hTeam = queueArray[BattleGroundTeamId.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[BatttleGroundTeamId.Alliance]); m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueuePremadeHorde].Remove(queueArray[BattleGroundTeamId.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[BatttleGroundTeamId.Horde]); m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueuePremadeAlliance].Remove(queueArray[BattleGroundTeamId.Horde]);
} }
arena.SetArenaMatchmakerRating(Team.Alliance, aTeam.ArenaMatchmakerRating); arena.SetArenaMatchmakerRating(Team.Alliance, aTeam.ArenaMatchmakerRating);
@@ -199,7 +199,7 @@ namespace Game.BattleGrounds.Zones.AlteracValley
m_Team_QuestStatus[teamIndex][4]++; m_Team_QuestStatus[teamIndex][4]++;
if (m_Team_QuestStatus[teamIndex][4] >= 200) if (m_Team_QuestStatus[teamIndex][4] >= 200)
Log.outDebug(LogFilter.Battleground, "BG_AV Quest {} completed (need to implement some events here", questid); Log.outDebug(LogFilter.Battleground, "BG_AV Quest {} completed (need to implement some events here", questid);
UpdateWorldState((int)(teamIndex == BatttleGroundTeamId.Alliance ? WorldStateIds.IvusStormCrystalCount : WorldStateIds.LokholarStormpikeSoldiersBloodCount), (int)m_Team_QuestStatus[teamIndex][4]); UpdateWorldState((int)(teamIndex == BattleGroundTeamId.Alliance ? WorldStateIds.IvusStormCrystalCount : WorldStateIds.LokholarStormpikeSoldiersBloodCount), (int)m_Team_QuestStatus[teamIndex][4]);
break; break;
case QuestIds.ANearMine: case QuestIds.ANearMine:
case QuestIds.HNearMine: case QuestIds.HNearMine:
@@ -253,17 +253,17 @@ namespace Game.BattleGrounds.Zones.AlteracValley
int teamindex = GetTeamIndexByTeamId(team); int teamindex = GetTeamIndexByTeamId(team);
_teamResources[teamindex] += points; _teamResources[teamindex] += points;
UpdateWorldState((int)(teamindex == BatttleGroundTeamId.Horde ? WorldStateIds.HordeReinforcements : WorldStateIds.AllianceReinforcements), _teamResources[teamindex]); UpdateWorldState((int)(teamindex == BattleGroundTeamId.Horde ? WorldStateIds.HordeReinforcements : WorldStateIds.AllianceReinforcements), _teamResources[teamindex]);
if (points < 0) if (points < 0)
{ {
if (_teamResources[teamindex] < 1) if (_teamResources[teamindex] < 1)
{ {
_teamResources[teamindex] = 0; _teamResources[teamindex] = 0;
EndBattleground(teamindex == BatttleGroundTeamId.Horde ? Team.Alliance : Team.Horde); EndBattleground(teamindex == BattleGroundTeamId.Horde ? Team.Alliance : Team.Horde);
} }
else if (!_isInformedNearVictory[teamindex] && _teamResources[teamindex] < MiscConst.NearLosePoints) else if (!_isInformedNearVictory[teamindex] && _teamResources[teamindex] < MiscConst.NearLosePoints)
{ {
if (teamindex == BatttleGroundTeamId.Alliance) if (teamindex == BattleGroundTeamId.Alliance)
SendBroadcastText((uint)BroadcastTextIds.AllianceNearLose, ChatMsg.BgSystemAlliance); SendBroadcastText((uint)BroadcastTextIds.AllianceNearLose, ChatMsg.BgSystemAlliance);
else else
SendBroadcastText((uint)BroadcastTextIds.HordeNearLose, ChatMsg.BgSystemHorde); SendBroadcastText((uint)BroadcastTextIds.HordeNearLose, ChatMsg.BgSystemHorde);
@@ -292,7 +292,7 @@ namespace Game.BattleGrounds.Zones.AlteracValley
_mineResourceTimer.Reset(MiscConst.MineResourceTimer); _mineResourceTimer.Reset(MiscConst.MineResourceTimer);
} }
for (byte i = BatttleGroundTeamId.Alliance; i <= BatttleGroundTeamId.Horde; i++) for (byte i = BattleGroundTeamId.Alliance; i <= BattleGroundTeamId.Horde; i++)
{ {
if (!IsCaptainAlive(i)) if (!IsCaptainAlive(i))
continue; continue;
@@ -322,9 +322,9 @@ namespace Game.BattleGrounds.Zones.AlteracValley
bool IsCaptainAlive(uint teamId) bool IsCaptainAlive(uint teamId)
{ {
if (teamId == BatttleGroundTeamId.Horde) if (teamId == BattleGroundTeamId.Horde)
return GetBgMap().GetWorldStateValue((int)WorldStateIds.GalvagarAlive) == 1; return GetBgMap().GetWorldStateValue((int)WorldStateIds.GalvagarAlive) == 1;
else if (teamId == BatttleGroundTeamId.Alliance) else if (teamId == BattleGroundTeamId.Alliance)
return GetBgMap().GetWorldStateValue((int)WorldStateIds.BalindaAlive) == 1; return GetBgMap().GetWorldStateValue((int)WorldStateIds.BalindaAlive) == 1;
return false; return false;
@@ -365,18 +365,18 @@ namespace Game.BattleGrounds.Zones.AlteracValley
{ {
if (_nodes[i].Owner == Team.Alliance) if (_nodes[i].Owner == Team.Alliance)
{ {
rep[BatttleGroundTeamId.Alliance] += MiscConst.RepGainSurvivingTower; rep[BattleGroundTeamId.Alliance] += MiscConst.RepGainSurvivingTower;
kills[BatttleGroundTeamId.Alliance] += MiscConst.HonorKillBonusSurvivingTower; kills[BattleGroundTeamId.Alliance] += MiscConst.HonorKillBonusSurvivingTower;
} }
else else
{ {
rep[BatttleGroundTeamId.Horde] += MiscConst.RepGainSurvivingTower; rep[BattleGroundTeamId.Horde] += MiscConst.RepGainSurvivingTower;
kills[BatttleGroundTeamId.Horde] += MiscConst.HonorKillBonusSurvivingTower; kills[BattleGroundTeamId.Horde] += MiscConst.HonorKillBonusSurvivingTower;
} }
} }
} }
for (byte i = BatttleGroundTeamId.Alliance; i <= BatttleGroundTeamId.Horde; ++i) for (byte i = BattleGroundTeamId.Alliance; i <= BattleGroundTeamId.Horde; ++i)
{ {
if (IsCaptainAlive(i)) if (IsCaptainAlive(i))
{ {
@@ -713,24 +713,24 @@ namespace Game.BattleGrounds.Zones.AlteracValley
Team owner = _nodes[(int)node].Owner; Team owner = _nodes[(int)node].Owner;
AVStates state = _nodes[(int)node].State; AVStates state = _nodes[(int)node].State;
UpdateWorldState(nodeInfo.AllianceAssault, (owner == Team.Alliance && state == AVStates.PointAssaulted) ? 1 : 0); UpdateWorldState(nodeInfo.AllianceAssault, owner == Team.Alliance && state == AVStates.PointAssaulted);
UpdateWorldState(nodeInfo.AllianceControl, (owner == Team.Alliance && state >= AVStates.PointDestroyed) ? 1 : 0); UpdateWorldState(nodeInfo.AllianceControl, owner == Team.Alliance && state >= AVStates.PointDestroyed);
UpdateWorldState(nodeInfo.HordeAssault, (owner == Team.Horde && state == AVStates.PointAssaulted) ? 1 : 0); UpdateWorldState(nodeInfo.HordeAssault, owner == Team.Horde && state == AVStates.PointAssaulted);
UpdateWorldState(nodeInfo.HordeControl, (owner == Team.Horde && state >= AVStates.PointDestroyed) ? 1 : 0); UpdateWorldState(nodeInfo.HordeControl, owner == Team.Horde && state >= AVStates.PointDestroyed);
if (nodeInfo.Owner != 0) if (nodeInfo.Owner != 0)
UpdateWorldState(nodeInfo.Owner, owner == Team.Horde ? 2 : owner == Team.Alliance ? 1 : 0); UpdateWorldState(nodeInfo.Owner, owner == Team.Horde ? 2 : owner == Team.Alliance ? 1 : 0);
} }
if (node == AVNodes.SnowfallGrave) if (node == AVNodes.SnowfallGrave)
UpdateWorldState((int)WorldStateIds.SnowfallGraveyardUncontrolled, _nodes[(int)node].Owner == Team.Other ? 1 : 0); UpdateWorldState((int)WorldStateIds.SnowfallGraveyardUncontrolled, _nodes[(int)node].Owner == Team.Other);
} }
void SendMineWorldStates(AlteracValleyMine mine) void SendMineWorldStates(AlteracValleyMine mine)
{ {
AlteracValleyMineInfo mineInfo = _mineInfo[(byte)mine]; AlteracValleyMineInfo mineInfo = _mineInfo[(byte)mine];
UpdateWorldState(mineInfo.StaticInfo.WorldStateHordeControlled, mineInfo.Owner == Team.Horde ? 1 : 0); UpdateWorldState(mineInfo.StaticInfo.WorldStateHordeControlled, mineInfo.Owner == Team.Horde);
UpdateWorldState(mineInfo.StaticInfo.WorldStateAllianceControlled, mineInfo.Owner == Team.Alliance ? 1 : 0); UpdateWorldState(mineInfo.StaticInfo.WorldStateAllianceControlled, mineInfo.Owner == Team.Alliance);
UpdateWorldState(mineInfo.StaticInfo.WorldStateNeutralControlled, mineInfo.Owner == Team.Other ? 1 : 0); UpdateWorldState(mineInfo.StaticInfo.WorldStateNeutralControlled, mineInfo.Owner == Team.Other);
UpdateWorldState(mineInfo.StaticInfo.WorldStateOwner, mineInfo.Owner == Team.Horde ? 2 : mineInfo.Owner == Team.Alliance ? 1 : 0); UpdateWorldState(mineInfo.StaticInfo.WorldStateOwner, mineInfo.Owner == Team.Horde ? 2 : mineInfo.Owner == Team.Alliance ? 1 : 0);
} }
@@ -842,9 +842,9 @@ namespace Game.BattleGrounds.Zones.AlteracValley
switch (dataId) switch (dataId)
{ {
case MiscConst.DataDefenderTierAlliance: case MiscConst.DataDefenderTierAlliance:
return (uint)getDefenderTierForTeam(BatttleGroundTeamId.Alliance); return (uint)getDefenderTierForTeam(BattleGroundTeamId.Alliance);
case MiscConst.DataDefenderTierHorde: case MiscConst.DataDefenderTierHorde:
return (uint)getDefenderTierForTeam(BatttleGroundTeamId.Horde); return (uint)getDefenderTierForTeam(BattleGroundTeamId.Horde);
default: default:
return base.GetData(dataId); return base.GetData(dataId);
} }
@@ -62,7 +62,7 @@ namespace Game.BattleGrounds.Zones.ArathisBasin
if (m_ReputationScoreTics[team] >= m_ReputationTics) if (m_ReputationScoreTics[team] >= m_ReputationTics)
{ {
if (team == BatttleGroundTeamId.Alliance) if (team == BattleGroundTeamId.Alliance)
RewardReputationToTeam(509, 10, Team.Alliance); RewardReputationToTeam(509, 10, Team.Alliance);
else else
RewardReputationToTeam(510, 10, Team.Horde); RewardReputationToTeam(510, 10, Team.Horde);
@@ -72,13 +72,13 @@ namespace Game.BattleGrounds.Zones.ArathisBasin
if (m_HonorScoreTics[team] >= m_HonorTics) if (m_HonorScoreTics[team] >= m_HonorTics)
{ {
RewardHonorToTeam(GetBonusHonorFromKill(1), (team == BatttleGroundTeamId.Alliance) ? Team.Alliance : Team.Horde); RewardHonorToTeam(GetBonusHonorFromKill(1), (team == BattleGroundTeamId.Alliance) ? Team.Alliance : Team.Horde);
m_HonorScoreTics[team] -= m_HonorTics; m_HonorScoreTics[team] -= m_HonorTics;
} }
if (!m_IsInformedNearVictory && m_TeamScores[team] > MiscConst.WarningNearVictoryScore) if (!m_IsInformedNearVictory && m_TeamScores[team] > MiscConst.WarningNearVictoryScore)
{ {
if (team == BatttleGroundTeamId.Alliance) if (team == BattleGroundTeamId.Alliance)
{ {
SendBroadcastText((uint)ABBattlegroundBroadcastTexts.AllianceNearVictory, ChatMsg.BgSystemNeutral); SendBroadcastText((uint)ABBattlegroundBroadcastTexts.AllianceNearVictory, ChatMsg.BgSystemNeutral);
PlaySoundToAll((uint)SoundIds.NearVictoryAlliance); PlaySoundToAll((uint)SoundIds.NearVictoryAlliance);
@@ -94,7 +94,7 @@ namespace Game.BattleGrounds.Zones.ArathisBasin
if (m_TeamScores[team] > MiscConst.MaxTeamScore) if (m_TeamScores[team] > MiscConst.MaxTeamScore)
m_TeamScores[team] = MiscConst.MaxTeamScore; m_TeamScores[team] = MiscConst.MaxTeamScore;
if (team == BatttleGroundTeamId.Alliance) if (team == BattleGroundTeamId.Alliance)
UpdateWorldState(WorldStateIds.ResourcesAlly, (int)m_TeamScores[team]); UpdateWorldState(WorldStateIds.ResourcesAlly, (int)m_TeamScores[team]);
else else
UpdateWorldState(WorldStateIds.ResourcesHorde, (int)m_TeamScores[team]); UpdateWorldState(WorldStateIds.ResourcesHorde, (int)m_TeamScores[team]);
@@ -103,7 +103,7 @@ namespace Game.BattleGrounds.Zones.ArathisBasin
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 == BatttleGroundTeamId.Alliance) if (team == BattleGroundTeamId.Alliance)
UpdateWorldState(WorldStateIds.Had500DisadvantageHorde, 1); UpdateWorldState(WorldStateIds.Had500DisadvantageHorde, 1);
else else
UpdateWorldState(WorldStateIds.Had500DisadvantageAlliance, 1); UpdateWorldState(WorldStateIds.Had500DisadvantageAlliance, 1);
@@ -115,9 +115,9 @@ namespace Game.BattleGrounds.Zones.ArathisBasin
} }
// Test win condition // Test win condition
if (m_TeamScores[BatttleGroundTeamId.Alliance] >= MiscConst.MaxTeamScore) if (m_TeamScores[BattleGroundTeamId.Alliance] >= MiscConst.MaxTeamScore)
EndBattleground(Team.Alliance); EndBattleground(Team.Alliance);
else if (m_TeamScores[BatttleGroundTeamId.Horde] >= MiscConst.MaxTeamScore) else if (m_TeamScores[BattleGroundTeamId.Horde] >= MiscConst.MaxTeamScore)
EndBattleground(Team.Horde); EndBattleground(Team.Horde);
} }
} }
+21 -21
View File
@@ -48,8 +48,8 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
{ {
_pointsTimer.Reset(MiscConst.PointsTickTime); _pointsTimer.Reset(MiscConst.PointsTickTime);
byte baseCountAlliance = GetControlledBaseCount(BatttleGroundTeamId.Alliance); byte baseCountAlliance = GetControlledBaseCount(BattleGroundTeamId.Alliance);
byte baseCountHorde = GetControlledBaseCount(BatttleGroundTeamId.Horde); byte baseCountHorde = GetControlledBaseCount(BattleGroundTeamId.Horde);
if (baseCountAlliance > 0) if (baseCountAlliance > 0)
AddPoints(Team.Alliance, MiscConst.TickPoints[baseCountAlliance - 1]); AddPoints(Team.Alliance, MiscConst.TickPoints[baseCountAlliance - 1]);
if (baseCountHorde > 0) if (baseCountHorde > 0)
@@ -108,11 +108,11 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
uint point = controlZoneHandler.Value.GetPoint(); uint point = controlZoneHandler.Value.GetPoint();
switch (teamId) switch (teamId)
{ {
case BatttleGroundTeamId.Alliance: case BattleGroundTeamId.Alliance:
if (GetBgMap().GetWorldStateValue(MiscConst.m_PointsIconStruct[point].WorldStateAllianceControlledIndex) == 1) if (GetBgMap().GetWorldStateValue(MiscConst.m_PointsIconStruct[point].WorldStateAllianceControlledIndex) == 1)
baseCount++; baseCount++;
break; break;
case BatttleGroundTeamId.Horde: case BattleGroundTeamId.Horde:
if (GetBgMap().GetWorldStateValue(MiscConst.m_PointsIconStruct[point].WorldStateHordeControlledIndex) == 1) if (GetBgMap().GetWorldStateValue(MiscConst.m_PointsIconStruct[point].WorldStateHordeControlledIndex) == 1)
baseCount++; baseCount++;
break; break;
@@ -177,13 +177,13 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
if (score >= ScoreIds.MaxTeamScore) if (score >= ScoreIds.MaxTeamScore)
{ {
score = ScoreIds.MaxTeamScore; score = ScoreIds.MaxTeamScore;
if (team == BatttleGroundTeamId.Alliance) if (team == BattleGroundTeamId.Alliance)
EndBattleground(Team.Alliance); EndBattleground(Team.Alliance);
else else
EndBattleground(Team.Horde); EndBattleground(Team.Horde);
} }
if (team == BatttleGroundTeamId.Alliance) if (team == BattleGroundTeamId.Alliance)
UpdateWorldState(WorldStateIds.AllianceResources, (int)score); UpdateWorldState(WorldStateIds.AllianceResources, (int)score);
else else
UpdateWorldState(WorldStateIds.HordeResources, (int)score); UpdateWorldState(WorldStateIds.HordeResources, (int)score);
@@ -206,10 +206,10 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
void UpdatePointsCount(uint teamId) void UpdatePointsCount(uint teamId)
{ {
if (teamId == BatttleGroundTeamId.Alliance) if (teamId == BattleGroundTeamId.Alliance)
UpdateWorldState(WorldStateIds.AllianceBase, GetControlledBaseCount(BatttleGroundTeamId.Alliance)); UpdateWorldState(WorldStateIds.AllianceBase, GetControlledBaseCount(BattleGroundTeamId.Alliance));
else else
UpdateWorldState(WorldStateIds.HordeBase, GetControlledBaseCount(BatttleGroundTeamId.Horde)); UpdateWorldState(WorldStateIds.HordeBase, GetControlledBaseCount(BattleGroundTeamId.Horde));
} }
public override void OnGameObjectCreate(GameObject gameobject) public override void OnGameObjectCreate(GameObject gameobject)
@@ -358,8 +358,8 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
//call parent's class reset //call parent's class reset
base.Reset(); base.Reset();
m_TeamScores[BatttleGroundTeamId.Alliance] = 0; m_TeamScores[BattleGroundTeamId.Alliance] = 0;
m_TeamScores[BatttleGroundTeamId.Horde] = 0; m_TeamScores[BattleGroundTeamId.Horde] = 0;
m_HonorScoreTics = [0, 0]; m_HonorScoreTics = [0, 0];
m_FlagCapturedBgObjectType = 0; m_FlagCapturedBgObjectType = 0;
bool isBGWeekend = Global.BattlegroundMgr.IsBGWeekend(GetTypeID()); bool isBGWeekend = Global.BattlegroundMgr.IsBGWeekend(GetTypeID());
@@ -377,12 +377,12 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
public void EventTeamLostPoint(uint teamId, uint point, WorldObject controlZone) public void EventTeamLostPoint(uint teamId, uint point, WorldObject controlZone)
{ {
if (teamId == BatttleGroundTeamId.Alliance) if (teamId == BattleGroundTeamId.Alliance)
{ {
SendBroadcastText(MiscConst.m_LosingPointTypes[point].MessageIdAlliance, ChatMsg.BgSystemAlliance, controlZone); SendBroadcastText(MiscConst.m_LosingPointTypes[point].MessageIdAlliance, ChatMsg.BgSystemAlliance, controlZone);
UpdateWorldState(MiscConst.m_PointsIconStruct[point].WorldStateAllianceControlledIndex, 0); UpdateWorldState(MiscConst.m_PointsIconStruct[point].WorldStateAllianceControlledIndex, 0);
} }
else if (teamId == BatttleGroundTeamId.Horde) else if (teamId == BattleGroundTeamId.Horde)
{ {
SendBroadcastText(MiscConst.m_LosingPointTypes[point].MessageIdHorde, ChatMsg.BgSystemHorde, controlZone); SendBroadcastText(MiscConst.m_LosingPointTypes[point].MessageIdHorde, ChatMsg.BgSystemHorde, controlZone);
UpdateWorldState(MiscConst.m_PointsIconStruct[point].WorldStateHordeControlledIndex, 0); UpdateWorldState(MiscConst.m_PointsIconStruct[point].WorldStateHordeControlledIndex, 0);
@@ -394,12 +394,12 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
public void EventTeamCapturedPoint(uint teamId, uint point, WorldObject controlZone) public void EventTeamCapturedPoint(uint teamId, uint point, WorldObject controlZone)
{ {
if (teamId == BatttleGroundTeamId.Alliance) if (teamId == BattleGroundTeamId.Alliance)
{ {
SendBroadcastText(MiscConst.m_CapturingPointTypes[point].MessageIdAlliance, ChatMsg.BgSystemAlliance, controlZone); SendBroadcastText(MiscConst.m_CapturingPointTypes[point].MessageIdAlliance, ChatMsg.BgSystemAlliance, controlZone);
UpdateWorldState(MiscConst.m_PointsIconStruct[point].WorldStateAllianceControlledIndex, 1); UpdateWorldState(MiscConst.m_PointsIconStruct[point].WorldStateAllianceControlledIndex, 1);
} }
else if (teamId == BatttleGroundTeamId.Horde) else if (teamId == BattleGroundTeamId.Horde)
{ {
SendBroadcastText(MiscConst.m_CapturingPointTypes[point].MessageIdHorde, ChatMsg.BgSystemHorde, controlZone); SendBroadcastText(MiscConst.m_CapturingPointTypes[point].MessageIdHorde, ChatMsg.BgSystemHorde, controlZone);
UpdateWorldState(MiscConst.m_PointsIconStruct[point].WorldStateHordeControlledIndex, 1); UpdateWorldState(MiscConst.m_PointsIconStruct[point].WorldStateHordeControlledIndex, 1);
@@ -416,9 +416,9 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
public override Team GetPrematureWinner() public override Team GetPrematureWinner()
{ {
if (GetTeamScore(BatttleGroundTeamId.Alliance) > GetTeamScore(BatttleGroundTeamId.Horde)) if (GetTeamScore(BattleGroundTeamId.Alliance) > GetTeamScore(BattleGroundTeamId.Horde))
return Team.Alliance; return Team.Alliance;
else if (GetTeamScore(BatttleGroundTeamId.Horde) > GetTeamScore(BatttleGroundTeamId.Alliance)) else if (GetTeamScore(BattleGroundTeamId.Horde) > GetTeamScore(BattleGroundTeamId.Alliance))
return Team.Horde; return Team.Horde;
return base.GetPrematureWinner(); return base.GetPrematureWinner();
@@ -526,22 +526,22 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
public override void HandleProgressEventHorde(GameObject controlZone) public override void HandleProgressEventHorde(GameObject controlZone)
{ {
_battleground.EventTeamCapturedPoint(BatttleGroundTeamId.Horde, _point, controlZone); _battleground.EventTeamCapturedPoint(BattleGroundTeamId.Horde, _point, controlZone);
} }
public override void HandleProgressEventAlliance(GameObject controlZone) public override void HandleProgressEventAlliance(GameObject controlZone)
{ {
_battleground.EventTeamCapturedPoint(BatttleGroundTeamId.Alliance, _point, controlZone); _battleground.EventTeamCapturedPoint(BattleGroundTeamId.Alliance, _point, controlZone);
} }
public override void HandleNeutralEventHorde(GameObject controlZone) public override void HandleNeutralEventHorde(GameObject controlZone)
{ {
_battleground.EventTeamLostPoint(BatttleGroundTeamId.Horde, _point, controlZone); _battleground.EventTeamLostPoint(BattleGroundTeamId.Horde, _point, controlZone);
} }
public override void HandleNeutralEventAlliance(GameObject controlZone) public override void HandleNeutralEventAlliance(GameObject controlZone)
{ {
_battleground.EventTeamLostPoint(BatttleGroundTeamId.Alliance, _point, controlZone); _battleground.EventTeamLostPoint(BattleGroundTeamId.Alliance, _point, controlZone);
} }
public uint GetPoint() { return _point; } public uint GetPoint() { return _point; }
File diff suppressed because it is too large Load Diff
+14 -14
View File
@@ -41,18 +41,18 @@ namespace Game.BattleGrounds.Zones.WarsongGluch
{ {
if (GetElapsedTime() >= 17 * Time.Minute * Time.InMilliseconds) if (GetElapsedTime() >= 17 * Time.Minute * Time.InMilliseconds)
{ {
if (GetTeamScore(BatttleGroundTeamId.Alliance) == 0) if (GetTeamScore(BattleGroundTeamId.Alliance) == 0)
{ {
if (GetTeamScore(BatttleGroundTeamId.Horde) == 0) // No one scored - result is tie if (GetTeamScore(BattleGroundTeamId.Horde) == 0) // No one scored - result is tie
EndBattleground(Team.Other); 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(BatttleGroundTeamId.Horde) == 0) else if (GetTeamScore(BattleGroundTeamId.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(BatttleGroundTeamId.Horde) == GetTeamScore(BatttleGroundTeamId.Alliance)) // Team score equal, winner is team that scored the last flag else if (GetTeamScore(BattleGroundTeamId.Horde) == GetTeamScore(BattleGroundTeamId.Alliance)) // Team score equal, winner is team that scored the last flag
EndBattleground((Team)_lastFlagCaptureTeam); EndBattleground((Team)_lastFlagCaptureTeam);
else if (GetTeamScore(BatttleGroundTeamId.Horde) > GetTeamScore(BatttleGroundTeamId.Alliance)) // Last but not least, check who has the higher score else if (GetTeamScore(BattleGroundTeamId.Horde) > GetTeamScore(BattleGroundTeamId.Alliance)) // Last but not least, check who has the higher score
EndBattleground(Team.Horde); EndBattleground(Team.Horde);
else else
EndBattleground(Team.Alliance); EndBattleground(Team.Alliance);
@@ -205,7 +205,7 @@ namespace Game.BattleGrounds.Zones.WarsongGluch
void UpdateTeamScore(int team) void UpdateTeamScore(int team)
{ {
if (team == BatttleGroundTeamId.Alliance) if (team == BattleGroundTeamId.Alliance)
UpdateWorldState((int)WorldStateIds.FlagCapturesAlliance, (int)GetTeamScore(team)); UpdateWorldState((int)WorldStateIds.FlagCapturesAlliance, (int)GetTeamScore(team));
else else
UpdateWorldState((int)WorldStateIds.FlagCapturesHorde, (int)GetTeamScore(team)); UpdateWorldState((int)WorldStateIds.FlagCapturesHorde, (int)GetTeamScore(team));
@@ -221,8 +221,8 @@ namespace Game.BattleGrounds.Zones.WarsongGluch
//call parent's class reset //call parent's class reset
base.Reset(); base.Reset();
m_TeamScores[BatttleGroundTeamId.Alliance] = 0; m_TeamScores[BattleGroundTeamId.Alliance] = 0;
m_TeamScores[BatttleGroundTeamId.Horde] = 0; m_TeamScores[BattleGroundTeamId.Horde] = 0;
if (Global.BattlegroundMgr.IsBGWeekend(GetTypeID())) if (Global.BattlegroundMgr.IsBGWeekend(GetTypeID()))
{ {
@@ -284,9 +284,9 @@ namespace Game.BattleGrounds.Zones.WarsongGluch
public override Team GetPrematureWinner() public override Team GetPrematureWinner()
{ {
if (GetTeamScore(BatttleGroundTeamId.Alliance) > GetTeamScore(BatttleGroundTeamId.Horde)) if (GetTeamScore(BattleGroundTeamId.Alliance) > GetTeamScore(BattleGroundTeamId.Horde))
return Team.Alliance; return Team.Alliance;
else if (GetTeamScore(BatttleGroundTeamId.Horde) > GetTeamScore(BatttleGroundTeamId.Alliance)) else if (GetTeamScore(BattleGroundTeamId.Horde) > GetTeamScore(BattleGroundTeamId.Alliance))
return Team.Horde; return Team.Horde;
return base.GetPrematureWinner(); return base.GetPrematureWinner();
@@ -305,10 +305,10 @@ namespace Game.BattleGrounds.Zones.WarsongGluch
_doors.Add(gameObject.GetGUID()); _doors.Add(gameObject.GetGUID());
break; break;
case GameobjectIds.AllianceFlagInBase: case GameobjectIds.AllianceFlagInBase:
_flags[BatttleGroundTeamId.Alliance] = gameObject.GetGUID(); _flags[BattleGroundTeamId.Alliance] = gameObject.GetGUID();
break; break;
case GameobjectIds.HordeFlagInBase: case GameobjectIds.HordeFlagInBase:
_flags[BatttleGroundTeamId.Horde] = gameObject.GetGUID(); _flags[BattleGroundTeamId.Horde] = gameObject.GetGUID();
break; break;
default: default:
break; break;
@@ -323,10 +323,10 @@ namespace Game.BattleGrounds.Zones.WarsongGluch
switch (areaTrigger.GetEntry()) switch (areaTrigger.GetEntry())
{ {
case MiscConst.AtCapturePointAlliance: case MiscConst.AtCapturePointAlliance:
_capturePointAreaTriggers[BatttleGroundTeamId.Alliance] = areaTrigger.GetGUID(); _capturePointAreaTriggers[BattleGroundTeamId.Alliance] = areaTrigger.GetGUID();
break; break;
case MiscConst.AtCapturePointHorde: case MiscConst.AtCapturePointHorde:
_capturePointAreaTriggers[BatttleGroundTeamId.Horde] = areaTrigger.GetGUID(); _capturePointAreaTriggers[BattleGroundTeamId.Horde] = areaTrigger.GetGUID();
break; break;
default: default:
break; break;
+6 -6
View File
@@ -811,13 +811,13 @@ namespace Game.Chat
switch (command) switch (command)
{ {
case "alliance": case "alliance":
Global.WorldMgr.SetForcedWarModeFactionBalanceState(BatttleGroundTeamId.Alliance, rewardValue.GetValueOrDefault(0)); Global.WorldMgr.SetForcedWarModeFactionBalanceState(BattleGroundTeamId.Alliance, rewardValue.GetValueOrDefault(0));
break; break;
case "horde": case "horde":
Global.WorldMgr.SetForcedWarModeFactionBalanceState(BatttleGroundTeamId.Horde, rewardValue.GetValueOrDefault(0)); Global.WorldMgr.SetForcedWarModeFactionBalanceState(BattleGroundTeamId.Horde, rewardValue.GetValueOrDefault(0));
break; break;
case "neutral": case "neutral":
Global.WorldMgr.SetForcedWarModeFactionBalanceState(BatttleGroundTeamId.Neutral); Global.WorldMgr.SetForcedWarModeFactionBalanceState(BattleGroundTeamId.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(BatttleGroundTeamId.Alliance, rewardValue); Global.WorldMgr.SetForcedWarModeFactionBalanceState(BattleGroundTeamId.Alliance, rewardValue);
break; break;
case "horde": case "horde":
Global.WorldMgr.SetForcedWarModeFactionBalanceState(BatttleGroundTeamId.Horde, rewardValue); Global.WorldMgr.SetForcedWarModeFactionBalanceState(BattleGroundTeamId.Horde, rewardValue);
break; break;
case "neutral": case "neutral":
Global.WorldMgr.SetForcedWarModeFactionBalanceState(BatttleGroundTeamId.Neutral); Global.WorldMgr.SetForcedWarModeFactionBalanceState(BattleGroundTeamId.Neutral);
break; break;
case "off": case "off":
Global.WorldMgr.DisableForcedWarModeFactionBalanceState(); Global.WorldMgr.DisableForcedWarModeFactionBalanceState();
+16 -16
View File
@@ -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 = BatttleGroundTeamId.Neutral; m_goValue.CapturePoint.LastTeamCapture = BattleGroundTeamId.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 ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance; m_goValue.CapturePoint.LastTeamCapture = hordeCapturing ? BattleGroundTeamId.Horde : BattleGroundTeamId.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 == BatttleGroundTeamId.Horde) if (m_goValue.CapturePoint.LastTeamCapture == BattleGroundTeamId.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 == BatttleGroundTeamId.Alliance) if (m_goValue.CapturePoint.LastTeamCapture == BattleGroundTeamId.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 BatttleGroundTeamId.Horde; return BattleGroundTeamId.Horde;
if (_value > GetMinAllianceValue()) if (_value > GetMinAllianceValue())
return BatttleGroundTeamId.Alliance; return BattleGroundTeamId.Alliance;
return BatttleGroundTeamId.Neutral; return BattleGroundTeamId.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 ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde; int assaultingTeam = pointsGained > 0 ? BattleGroundTeamId.Alliance : BattleGroundTeamId.Horde;
if (oldControllingTeam != newControllingTeam) if (oldControllingTeam != newControllingTeam)
_contestedTriggered = false; _contestedTriggered = false;
if (oldControllingTeam != BatttleGroundTeamId.Alliance && newControllingTeam == BatttleGroundTeamId.Alliance) if (oldControllingTeam != BattleGroundTeamId.Alliance && newControllingTeam == BattleGroundTeamId.Alliance)
TriggerEvent(_owner.GetGoInfo().ControlZone.ProgressEventAlliance); TriggerEvent(_owner.GetGoInfo().ControlZone.ProgressEventAlliance);
else if (oldControllingTeam != BatttleGroundTeamId.Horde && newControllingTeam == BatttleGroundTeamId.Horde) else if (oldControllingTeam != BattleGroundTeamId.Horde && newControllingTeam == BattleGroundTeamId.Horde)
TriggerEvent(_owner.GetGoInfo().ControlZone.ProgressEventHorde); TriggerEvent(_owner.GetGoInfo().ControlZone.ProgressEventHorde);
else if (oldControllingTeam == BatttleGroundTeamId.Horde && newControllingTeam == BatttleGroundTeamId.Neutral) else if (oldControllingTeam == BattleGroundTeamId.Horde && newControllingTeam == BattleGroundTeamId.Neutral)
TriggerEvent(_owner.GetGoInfo().ControlZone.NeutralEventHorde); TriggerEvent(_owner.GetGoInfo().ControlZone.NeutralEventHorde);
else if (oldControllingTeam == BatttleGroundTeamId.Alliance && newControllingTeam == BatttleGroundTeamId.Neutral) else if (oldControllingTeam == BattleGroundTeamId.Alliance && newControllingTeam == BattleGroundTeamId.Neutral)
TriggerEvent(_owner.GetGoInfo().ControlZone.NeutralEventAlliance); TriggerEvent(_owner.GetGoInfo().ControlZone.NeutralEventAlliance);
if (roundedValue == 100 && newControllingTeam == BatttleGroundTeamId.Alliance && assaultingTeam == BatttleGroundTeamId.Alliance) if (roundedValue == 100 && newControllingTeam == BattleGroundTeamId.Alliance && assaultingTeam == BattleGroundTeamId.Alliance)
TriggerEvent(_owner.GetGoInfo().ControlZone.CaptureEventAlliance); TriggerEvent(_owner.GetGoInfo().ControlZone.CaptureEventAlliance);
else if (roundedValue == 0 && newControllingTeam == BatttleGroundTeamId.Horde && assaultingTeam == BatttleGroundTeamId.Horde) else if (roundedValue == 0 && newControllingTeam == BattleGroundTeamId.Horde && assaultingTeam == BattleGroundTeamId.Horde)
TriggerEvent(_owner.GetGoInfo().ControlZone.CaptureEventHorde); TriggerEvent(_owner.GetGoInfo().ControlZone.CaptureEventHorde);
if (oldRoundedValue == 100 && assaultingTeam == BatttleGroundTeamId.Horde && !_contestedTriggered) if (oldRoundedValue == 100 && assaultingTeam == BattleGroundTeamId.Horde && !_contestedTriggered)
{ {
TriggerEvent(_owner.GetGoInfo().ControlZone.ContestedEventHorde); TriggerEvent(_owner.GetGoInfo().ControlZone.ContestedEventHorde);
_contestedTriggered = true; _contestedTriggered = true;
} }
else if (oldRoundedValue == 0 && assaultingTeam == BatttleGroundTeamId.Alliance && !_contestedTriggered) else if (oldRoundedValue == 0 && assaultingTeam == BattleGroundTeamId.Alliance && !_contestedTriggered)
{ {
TriggerEvent(_owner.GetGoInfo().ControlZone.ContestedEventAlliance); TriggerEvent(_owner.GetGoInfo().ControlZone.ContestedEventAlliance);
_contestedTriggered = true; _contestedTriggered = true;
+3 -3
View File
@@ -5149,13 +5149,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 BatttleGroundTeamId.Neutral; return BattleGroundTeamId.Neutral;
} }
public Team GetTeam() { return m_team; } public Team GetTeam() { return m_team; }
public int GetTeamId() { return m_team == Team.Alliance ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde; } public int GetTeamId() { return m_team == Team.Alliance ? BattleGroundTeamId.Alliance : BattleGroundTeamId.Horde; }
public Team GetEffectiveTeam() { return HasPlayerFlagEx(PlayerFlagsEx.MercenaryMode) ? (GetTeam() == Team.Alliance ? Team.Horde : Team.Alliance) : GetTeam(); } public Team GetEffectiveTeam() { return HasPlayerFlagEx(PlayerFlagsEx.MercenaryMode) ? (GetTeam() == Team.Alliance ? Team.Horde : Team.Alliance) : GetTeam(); }
public int GetEffectiveTeamId() { return GetEffectiveTeam() == Team.Alliance ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde; } public int GetEffectiveTeamId() { return GetEffectiveTeam() == Team.Alliance ? BattleGroundTeamId.Alliance : BattleGroundTeamId.Horde; }
//Money //Money
public ulong GetMoney() { return m_activePlayerData.Coinage; } public ulong GetMoney() { return m_activePlayerData.Coinage; }
+21 -21
View File
@@ -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 BatttleGroundTeamId.Alliance: case BattleGroundTeamId.Alliance:
disabled = Convert.ToBoolean(mask & (1 << 0)); disabled = Convert.ToBoolean(mask & (1 << 0));
break; break;
case BatttleGroundTeamId.Horde: case BattleGroundTeamId.Horde:
disabled = Convert.ToBoolean(mask & (1 << 1)); disabled = Convert.ToBoolean(mask & (1 << 1));
break; break;
case BatttleGroundTeamId.Neutral: case BattleGroundTeamId.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 == BatttleGroundTeamId.Neutral) if (newTeamId == BattleGroundTeamId.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 == BatttleGroundTeamId.Horde) if (newTeamId == BattleGroundTeamId.Horde)
stmt.AddValue(1, 109); stmt.AddValue(1, 109);
else else
stmt.AddValue(1, 98); stmt.AddValue(1, 98);
@@ -1979,7 +1979,7 @@ namespace Game
string taximaskstream = ""; string taximaskstream = "";
var factionMask = newTeamId == BatttleGroundTeamId.Horde ? CliDB.HordeTaxiNodesMask : CliDB.AllianceTaxiNodesMask; var factionMask = newTeamId == BattleGroundTeamId.Horde ? CliDB.HordeTaxiNodesMask : CliDB.AllianceTaxiNodesMask;
for (int i = 0; i < factionMask.Length; ++i) for (int i = 0; i < factionMask.Length; ++i)
{ {
// i = (315 - 1) / 8 = 39 // i = (315 - 1) / 8 = 39
@@ -2033,7 +2033,7 @@ namespace Game
WorldLocation loc; WorldLocation loc;
ushort zoneId = 0; ushort zoneId = 0;
if (newTeamId == BatttleGroundTeamId.Alliance) if (newTeamId == BattleGroundTeamId.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;
@@ -2060,19 +2060,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 == BatttleGroundTeamId.Alliance ? achiev_alliance : achiev_horde)); stmt.AddValue(0, (ushort)(newTeamId == BattleGroundTeamId.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 == BatttleGroundTeamId.Alliance ? achiev_alliance : achiev_horde)); stmt.AddValue(0, (ushort)(newTeamId == BattleGroundTeamId.Alliance ? achiev_alliance : achiev_horde));
stmt.AddValue(1, (ushort)(newTeamId == BatttleGroundTeamId.Alliance ? achiev_horde : achiev_alliance)); stmt.AddValue(1, (ushort)(newTeamId == BattleGroundTeamId.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 == BatttleGroundTeamId.Alliance ? Global.ObjectMgr.FactionChangeItemsHordeToAlliance : Global.ObjectMgr.FactionChangeItemsAllianceToHorde; var itemConversionMap = newTeamId == BattleGroundTeamId.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;
@@ -2098,12 +2098,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 == BatttleGroundTeamId.Alliance ? quest_alliance : quest_horde)); stmt.AddValue(1, (newTeamId == BattleGroundTeamId.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 == BatttleGroundTeamId.Alliance ? quest_alliance : quest_horde)); stmt.AddValue(0, (newTeamId == BattleGroundTeamId.Alliance ? quest_alliance : quest_horde));
stmt.AddValue(1, (newTeamId == BatttleGroundTeamId.Alliance ? quest_horde : quest_alliance)); stmt.AddValue(1, (newTeamId == BattleGroundTeamId.Alliance ? quest_horde : quest_alliance));
stmt.AddValue(2, lowGuid); stmt.AddValue(2, lowGuid);
trans.Append(stmt); trans.Append(stmt);
} }
@@ -2118,7 +2118,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 == BatttleGroundTeamId.Alliance ? RaceMask.Alliance : RaceMask.Horde; RaceMask<ulong> newRaceMask = newTeamId == BattleGroundTeamId.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);
@@ -2136,13 +2136,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 == BatttleGroundTeamId.Alliance ? spell_alliance : spell_horde)); stmt.AddValue(0, (newTeamId == BattleGroundTeamId.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 == BatttleGroundTeamId.Alliance ? spell_alliance : spell_horde)); stmt.AddValue(0, (newTeamId == BattleGroundTeamId.Alliance ? spell_alliance : spell_horde));
stmt.AddValue(1, (newTeamId == BatttleGroundTeamId.Alliance ? spell_horde : spell_alliance)); stmt.AddValue(1, (newTeamId == BattleGroundTeamId.Alliance ? spell_horde : spell_alliance));
stmt.AddValue(2, lowGuid); stmt.AddValue(2, lowGuid);
trans.Append(stmt); trans.Append(stmt);
} }
@@ -2152,8 +2152,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 == BatttleGroundTeamId.Alliance) ? reputation_alliance : reputation_horde; uint newReputation = (newTeamId == BattleGroundTeamId.Alliance) ? reputation_alliance : reputation_horde;
uint oldReputation = (newTeamId == BatttleGroundTeamId.Alliance) ? reputation_horde : reputation_alliance; uint oldReputation = (newTeamId == BattleGroundTeamId.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);
@@ -2210,7 +2210,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 == BatttleGroundTeamId.Alliance) if (newTeamId == BattleGroundTeamId.Alliance)
{ {
uint maskID = htitleInfo.MaskID; uint maskID = htitleInfo.MaskID;
int index = (int)maskID / 32; int index = (int)maskID / 32;
+2 -2
View File
@@ -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() == BatttleGroundTeamId.Alliance) && info.Flags.HasFlag(InstanceSpawnGroupFlags.HordeOnly)) if (((instance.GetTeamIdInInstance() == BattleGroundTeamId.Alliance) && info.Flags.HasFlag(InstanceSpawnGroupFlags.HordeOnly))
|| ((instance.GetTeamIdInInstance() == BatttleGroundTeamId.Horde) && info.Flags.HasFlag(InstanceSpawnGroupFlags.AllianceOnly))) || ((instance.GetTeamIdInInstance() == BattleGroundTeamId.Horde) && info.Flags.HasFlag(InstanceSpawnGroupFlags.AllianceOnly)))
continue; continue;
if (info.Flags.HasAnyFlag(InstanceSpawnGroupFlags.BlockSpawn)) if (info.Flags.HasAnyFlag(InstanceSpawnGroupFlags.BlockSpawn))
+6 -6
View File
@@ -4801,8 +4801,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 == BatttleGroundTeamId.Alliance ? 1 : 0, false, this); Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceAlliance, instanceTeam == BattleGroundTeamId.Alliance ? 1 : 0, false, this);
Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceHorde, instanceTeam == BatttleGroundTeamId.Horde ? 1 : 0, false, this); Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceHorde, instanceTeam == BattleGroundTeamId.Horde ? 1 : 0, false, this);
if (i_instanceLock != null) if (i_instanceLock != null)
{ {
@@ -5181,13 +5181,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 BatttleGroundTeamId.Alliance; return BattleGroundTeamId.Alliance;
if (Global.WorldStateMgr.GetValue(WorldStates.TeamInInstanceHorde, this) != 0) if (Global.WorldStateMgr.GetValue(WorldStates.TeamInInstanceHorde, this) != 0)
return BatttleGroundTeamId.Horde; return BattleGroundTeamId.Horde;
return BatttleGroundTeamId.Neutral; return BattleGroundTeamId.Neutral;
} }
public Team GetTeamInInstance() { return GetTeamIdInInstance() == BatttleGroundTeamId.Alliance ? Team.Alliance : Team.Horde; } public Team GetTeamInInstance() { return GetTeamIdInInstance() == BattleGroundTeamId.Alliance ? Team.Alliance : Team.Horde; }
public uint GetScriptId() public uint GetScriptId()
{ {
+2 -2
View File
@@ -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() == BatttleGroundTeamId.Alliance ? 1 : 0, false, map); Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceAlliance, map.GetInstanceId() == BattleGroundTeamId.Alliance ? 1 : 0, false, map);
Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceHorde, map.GetInstanceId() == BatttleGroundTeamId.Horde ? 1 : 0, false, map); Global.WorldStateMgr.SetValue(WorldStates.TeamInInstanceHorde, map.GetInstanceId() == BattleGroundTeamId.Horde ? 1 : 0, false, map);
} }
} }
} }
+2 -2
View File
@@ -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 == BatttleGroundTeamId.Alliance ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance), spellId2 != 0 ? -(int)spellId2 : -(int)spellId); TeamCastSpell((uint)(teamIndex == BattleGroundTeamId.Alliance ? BattleGroundTeamId.Horde : BattleGroundTeamId.Alliance), spellId2 != 0 ? -(int)spellId2 : -(int)spellId);
} }
public void SendDefenseMessage(uint zoneId, uint id) public void SendDefenseMessage(uint zoneId, uint id)
@@ -254,7 +254,7 @@ namespace Game.PvP
public OPvPCapturePoint(OutdoorPvP pvp) public OPvPCapturePoint(OutdoorPvP pvp)
{ {
m_team = BatttleGroundTeamId.Neutral; m_team = BattleGroundTeamId.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(BatttleGroundTeamId.Alliance, SpellIds.AllianceBuff, SpellIds.HordeBuff); TeamApplyBuff(BattleGroundTeamId.Alliance, SpellIds.AllianceBuff, SpellIds.HordeBuff);
else if (m_HordeTowersControlled == 3) else if (m_HordeTowersControlled == 3)
TeamApplyBuff(BatttleGroundTeamId.Horde, SpellIds.HordeBuff, SpellIds.AllianceBuff); TeamApplyBuff(BattleGroundTeamId.Horde, SpellIds.HordeBuff, SpellIds.AllianceBuff);
else else
{ {
TeamCastSpell(BatttleGroundTeamId.Alliance, -(int)SpellIds.AllianceBuff); TeamCastSpell(BattleGroundTeamId.Alliance, -(int)SpellIds.AllianceBuff);
TeamCastSpell(BatttleGroundTeamId.Horde, -(int)SpellIds.HordeBuff); TeamCastSpell(BattleGroundTeamId.Horde, -(int)SpellIds.HordeBuff);
} }
SetWorldState(WorldStateIds.CountA, (int)m_AllianceTowersControlled); SetWorldState(WorldStateIds.CountA, (int)m_AllianceTowersControlled);
+2 -2
View File
@@ -24,10 +24,10 @@ namespace Game.Scenarios
uint scenarioID = 0; uint scenarioID = 0;
switch (team) switch (team)
{ {
case BatttleGroundTeamId.Alliance: case BattleGroundTeamId.Alliance:
scenarioID = dbData.Scenario_A; scenarioID = dbData.Scenario_A;
break; break;
case BatttleGroundTeamId.Horde: case BattleGroundTeamId.Horde:
scenarioID = dbData.Scenario_H; scenarioID = dbData.Scenario_H;
break; break;
default: default:
+1 -1
View File
@@ -2631,7 +2631,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 ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance); bg.SetDroppedFlagGUID(go.GetGUID(), bg.GetPlayerTeam(player.GetGUID()) == Team.Alliance ? BattleGroundTeamId.Horde : BattleGroundTeamId.Alliance);
} }
} }
+2 -2
View File
@@ -5044,9 +5044,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 == BatttleGroundTeamId.Horde) if (team == BattleGroundTeamId.Horde)
return spellId == 56618; return spellId == 56618;
else if (team == BatttleGroundTeamId.Alliance) else if (team == BattleGroundTeamId.Alliance)
return spellId == 56617; return spellId == 56617;
break; break;
} }
+12 -12
View File
@@ -1265,8 +1265,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 == BatttleGroundTeamId.Alliance ? reward : 0), false, null); Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.WarModeHordeBuffValue, 10 + (team == BattleGroundTeamId.Alliance ? reward : 0), false, null);
Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.WarModeAllianceBuffValue, 10 + (team == BatttleGroundTeamId.Horde ? reward : 0), false, null); Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.WarModeAllianceBuffValue, 10 + (team == BattleGroundTeamId.Horde ? reward : 0), false, null);
} }
public void DisableForcedWarModeFactionBalanceState() public void DisableForcedWarModeFactionBalanceState()
@@ -2477,9 +2477,9 @@ namespace Game
if (raceFaction != null) if (raceFaction != null)
{ {
if ((raceFaction.FactionGroup & (byte)FactionMasks.Alliance) != 0) if ((raceFaction.FactionGroup & (byte)FactionMasks.Alliance) != 0)
warModeEnabledFaction[BatttleGroundTeamId.Alliance] += result.Read<long>(1); warModeEnabledFaction[BattleGroundTeamId.Alliance] += result.Read<long>(1);
else if ((raceFaction.FactionGroup & (byte)FactionMasks.Horde) != 0) else if ((raceFaction.FactionGroup & (byte)FactionMasks.Horde) != 0)
warModeEnabledFaction[BatttleGroundTeamId.Horde] += result.Read<long>(1); warModeEnabledFaction[BattleGroundTeamId.Horde] += result.Read<long>(1);
} }
} }
@@ -2487,19 +2487,19 @@ namespace Game
} }
int dominantFaction = BatttleGroundTeamId.Alliance; int dominantFaction = BattleGroundTeamId.Alliance;
int outnumberedFactionReward = 0; int outnumberedFactionReward = 0;
if (warModeEnabledFaction.Any(val => val != 0)) if (warModeEnabledFaction.Any(val => val != 0))
{ {
long dominantFactionCount = warModeEnabledFaction[BatttleGroundTeamId.Alliance]; long dominantFactionCount = warModeEnabledFaction[BattleGroundTeamId.Alliance];
if (warModeEnabledFaction[BatttleGroundTeamId.Alliance] < warModeEnabledFaction[BatttleGroundTeamId.Horde]) if (warModeEnabledFaction[BattleGroundTeamId.Alliance] < warModeEnabledFaction[BattleGroundTeamId.Horde])
{ {
dominantFactionCount = warModeEnabledFaction[BatttleGroundTeamId.Horde]; dominantFactionCount = warModeEnabledFaction[BattleGroundTeamId.Horde];
dominantFaction = BatttleGroundTeamId.Horde; dominantFaction = BattleGroundTeamId.Horde;
} }
double total = warModeEnabledFaction[BatttleGroundTeamId.Alliance] + warModeEnabledFaction[BatttleGroundTeamId.Horde]; double total = warModeEnabledFaction[BattleGroundTeamId.Alliance] + warModeEnabledFaction[BattleGroundTeamId.Horde];
double pct = dominantFactionCount / total; double pct = dominantFactionCount / total;
if (pct >= WorldConfig.GetFloatValue(WorldCfg.CallToArms20Pct)) if (pct >= WorldConfig.GetFloatValue(WorldCfg.CallToArms20Pct))
@@ -2510,8 +2510,8 @@ namespace Game
outnumberedFactionReward = 5; outnumberedFactionReward = 5;
} }
Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.WarModeHordeBuffValue, 10 + (dominantFaction == BatttleGroundTeamId.Alliance ? outnumberedFactionReward : 0), false, null); Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.WarModeHordeBuffValue, 10 + (dominantFaction == BattleGroundTeamId.Alliance ? outnumberedFactionReward : 0), false, null);
Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.WarModeAllianceBuffValue, 10 + (dominantFaction == BatttleGroundTeamId.Horde ? outnumberedFactionReward : 0), false, null); Global.WorldStateMgr.SetValueAndSaveInDb(WorldStates.WarModeAllianceBuffValue, 10 + (dominantFaction == BattleGroundTeamId.Horde ? outnumberedFactionReward : 0), false, null);
} }
public uint GetVirtualRealmAddress() public uint GetVirtualRealmAddress()
+2 -2
View File
@@ -4469,10 +4469,10 @@ namespace Scripts.Spells.Generic
switch (target.GetTeamId()) switch (target.GetTeamId())
{ {
case BatttleGroundTeamId.Alliance: case BattleGroundTeamId.Alliance:
amount = WorldStateMgr.GetValue(WorldStates.WarModeAllianceBuffValue, target.GetMap()); amount = WorldStateMgr.GetValue(WorldStates.WarModeAllianceBuffValue, target.GetMap());
break; break;
case BatttleGroundTeamId.Horde: case BattleGroundTeamId.Horde:
amount = WorldStateMgr.GetValue(WorldStates.WarModeHordeBuffValue, target.GetMap()); amount = WorldStateMgr.GetValue(WorldStates.WarModeHordeBuffValue, target.GetMap());
break; break;
default: default: