Misc fixes.

This commit is contained in:
hondacrx
2021-11-15 23:35:21 -05:00
parent 0292bb9c09
commit a7936eb46c
15 changed files with 77 additions and 97 deletions
@@ -255,7 +255,7 @@ namespace Framework.Constants
BgStartL70etc = 11803 BgStartL70etc = 11803
} }
public enum BattlegroundTeamId public enum PvPTeamId
{ {
Horde = 0, // Battleground: Horde, Arena: Green Horde = 0, // Battleground: Horde, Arena: Green
Alliance = 1, // Battleground: Alliance, Arena: Gold Alliance = 1, // Battleground: Alliance, Arena: Gold
-24
View File
@@ -752,30 +752,6 @@ namespace Framework.Constants
ChannelCity = 819, ChannelCity = 819,
NpcinfoGossip = 820,
NpcinfoQuestgiver = 821,
NpcinfoTrainerClass = 822,
NpcinfoTrainerProfession = 823,
NpcinfoVendorAmmo = 824,
NpcinfoVendorFood = 825,
NpcinfoVendorPoison = 826,
NpcinfoVendorReagent = 827,
NpcinfoRepair = 828,
NpcinfoFlightmaster = 829,
NpcinfoSpirithealer = 830,
NpcinfoSpiritguide = 831,
NpcinfoInnkeeper = 832,
NpcinfoBanker = 833,
NpcinfoPetitioner = 834,
NpcinfoTabarddesigner = 835,
NpcinfoBattlemaster = 836,
NpcinfoAuctioneer = 837,
NpcinfoStablemaster = 838,
NpcinfoGuildBanker = 839,
NpcinfoSpellclick = 840,
NpcinfoMailbox = 841,
NpcinfoPlayerVehicle = 842,
// Pinfo Commands // Pinfo Commands
PinfoPlayer = 453, PinfoPlayer = 453,
PinfoGmActive = 548, PinfoGmActive = 548,
+1 -1
View File
@@ -123,7 +123,7 @@ namespace Framework.Constants
/// <summary> /// <summary>
/// BGs / Arena Const /// BGs / Arena Const
/// </summary> /// </summary>
public const int BGTeamsCount = 2; public const int PvpTeamsCount = 2;
public const uint CountOfPlayersToAverageWaitTime = 10; public const uint CountOfPlayersToAverageWaitTime = 10;
public const uint MaxPlayerBGQueues = 2; public const uint MaxPlayerBGQueues = 2;
public const uint BGAwardArenaPointsMinLevel = 71; public const uint BGAwardArenaPointsMinLevel = 71;
+6 -6
View File
@@ -103,7 +103,7 @@ namespace Game.Arenas
{ {
pvpLogData.Ratings.HasValue = true; pvpLogData.Ratings.HasValue = true;
for (byte i = 0; i < SharedConst.BGTeamsCount; ++i) for (byte i = 0; i < SharedConst.PvpTeamsCount; ++i)
{ {
pvpLogData.Ratings.Value.Postmatch[i] = _arenaTeamScores[i].PostMatchRating; pvpLogData.Ratings.Value.Postmatch[i] = _arenaTeamScores[i].PostMatchRating;
pvpLogData.Ratings.Value.Prematch[i] = _arenaTeamScores[i].PreMatchRating; pvpLogData.Ratings.Value.Prematch[i] = _arenaTeamScores[i].PreMatchRating;
@@ -191,8 +191,8 @@ namespace Game.Arenas
// bg team that the client expects is different to TeamId // bg team that the client expects is different to TeamId
// alliance 1, horde 0 // alliance 1, horde 0
byte winnerTeam = (byte)(winner == Team.Alliance ? BattlegroundTeamId.Alliance : BattlegroundTeamId.Horde); byte winnerTeam = (byte)(winner == Team.Alliance ? PvPTeamId.Alliance : PvPTeamId.Horde);
byte loserTeam = (byte)(winner == Team.Alliance ? BattlegroundTeamId.Horde : BattlegroundTeamId.Alliance); byte loserTeam = (byte)(winner == Team.Alliance ? PvPTeamId.Horde : PvPTeamId.Alliance);
_arenaTeamScores[winnerTeam].Assign(winnerTeamRating, (uint)(winnerTeamRating + winnerChange), winnerMatchmakerRating, GetArenaMatchmakerRating(winner)); _arenaTeamScores[winnerTeam].Assign(winnerTeamRating, (uint)(winnerTeamRating + winnerChange), winnerMatchmakerRating, GetArenaMatchmakerRating(winner));
_arenaTeamScores[loserTeam].Assign(loserTeamRating, (uint)(loserTeamRating + loserChange), loserMatchmakerRating, GetArenaMatchmakerRating(GetOtherTeam(winner))); _arenaTeamScores[loserTeam].Assign(loserTeamRating, (uint)(loserTeamRating + loserChange), loserMatchmakerRating, GetArenaMatchmakerRating(GetOtherTeam(winner)));
@@ -217,8 +217,8 @@ namespace Game.Arenas
// Deduct 16 points from each teams arena-rating if there are no winners after 45+2 minutes // Deduct 16 points from each teams arena-rating if there are no winners after 45+2 minutes
else else
{ {
_arenaTeamScores[(int)BattlegroundTeamId.Alliance].Assign(winnerTeamRating, (uint)(winnerTeamRating + SharedConst.ArenaTimeLimitPointsLoss), winnerMatchmakerRating, GetArenaMatchmakerRating(Team.Alliance)); _arenaTeamScores[(int)PvPTeamId.Alliance].Assign(winnerTeamRating, (uint)(winnerTeamRating + SharedConst.ArenaTimeLimitPointsLoss), winnerMatchmakerRating, GetArenaMatchmakerRating(Team.Alliance));
_arenaTeamScores[(int)BattlegroundTeamId.Horde].Assign(loserTeamRating, (uint)(loserTeamRating + SharedConst.ArenaTimeLimitPointsLoss), loserMatchmakerRating, GetArenaMatchmakerRating(Team.Horde)); _arenaTeamScores[(int)PvPTeamId.Horde].Assign(loserTeamRating, (uint)(loserTeamRating + SharedConst.ArenaTimeLimitPointsLoss), loserMatchmakerRating, GetArenaMatchmakerRating(Team.Horde));
winnerArenaTeam.FinishGame(SharedConst.ArenaTimeLimitPointsLoss); winnerArenaTeam.FinishGame(SharedConst.ArenaTimeLimitPointsLoss);
loserArenaTeam.FinishGame(SharedConst.ArenaTimeLimitPointsLoss); loserArenaTeam.FinishGame(SharedConst.ArenaTimeLimitPointsLoss);
@@ -300,7 +300,7 @@ namespace Game.Arenas
base.EndBattleground(winner); base.EndBattleground(winner);
} }
public ArenaTeamScore[] _arenaTeamScores = new ArenaTeamScore[SharedConst.BGTeamsCount]; public ArenaTeamScore[] _arenaTeamScores = new ArenaTeamScore[SharedConst.PvpTeamsCount];
} }
struct ArenaWorldStates struct ArenaWorldStates
+1 -1
View File
@@ -26,7 +26,7 @@ namespace Game.Arenas
{ {
public ArenaScore(ObjectGuid playerGuid, Team team) : base(playerGuid, team) public ArenaScore(ObjectGuid playerGuid, Team team) : base(playerGuid, team)
{ {
TeamId = (int)(team == Team.Alliance ? BattlegroundTeamId.Alliance : BattlegroundTeamId.Horde); TeamId = (int)(team == Team.Alliance ? PvPTeamId.Alliance : PvPTeamId.Horde);
} }
public override void BuildPvPLogPlayerDataPacket(out PVPMatchStatistics.PVPMatchPlayerStatistics playerData) public override void BuildPvPLogPlayerDataPacket(out PVPMatchStatistics.PVPMatchPlayerStatistics playerData)
+7 -7
View File
@@ -150,7 +150,7 @@ namespace Game.BattleFields
if (m_uiKickDontAcceptTimer <= diff) if (m_uiKickDontAcceptTimer <= diff)
{ {
long now = GameTime.GetGameTime(); long now = GameTime.GetGameTime();
for (int team = 0; team < SharedConst.BGTeamsCount; team++) for (int team = 0; team < SharedConst.PvpTeamsCount; team++)
{ {
foreach (var pair in m_InvitedPlayers[team]) foreach (var pair in m_InvitedPlayers[team])
if (pair.Value <= now) if (pair.Value <= now)
@@ -158,7 +158,7 @@ namespace Game.BattleFields
} }
InvitePlayersInZoneToWar(); InvitePlayersInZoneToWar();
for (int team = 0; team < SharedConst.BGTeamsCount; team++) for (int team = 0; team < SharedConst.PvpTeamsCount; team++)
{ {
foreach (var pair in m_PlayersWillBeKick[team]) foreach (var pair in m_PlayersWillBeKick[team])
if (pair.Value <= now) if (pair.Value <= now)
@@ -191,7 +191,7 @@ namespace Game.BattleFields
void InvitePlayersInZoneToQueue() void InvitePlayersInZoneToQueue()
{ {
for (byte team = 0; team < SharedConst.BGTeamsCount; ++team) for (byte team = 0; team < SharedConst.PvpTeamsCount; ++team)
{ {
foreach (var guid in m_players[team]) foreach (var guid in m_players[team])
{ {
@@ -992,7 +992,7 @@ namespace Game.BattleFields
uint m_ControlTeam; uint m_ControlTeam;
uint m_GraveyardId; uint m_GraveyardId;
ObjectGuid[] m_SpiritGuide = new ObjectGuid[SharedConst.BGTeamsCount]; ObjectGuid[] m_SpiritGuide = new ObjectGuid[SharedConst.PvpTeamsCount];
List<ObjectGuid> m_ResurrectQueue = new(); List<ObjectGuid> m_ResurrectQueue = new();
protected BattleField m_Bf; protected BattleField m_Bf;
} }
@@ -1131,7 +1131,7 @@ namespace Game.BattleFields
{ {
float radius = capturePoint.GetGoInfo().ControlZone.radius; float radius = capturePoint.GetGoInfo().ControlZone.radius;
for (byte team = 0; team < SharedConst.BGTeamsCount; ++team) for (byte team = 0; team < SharedConst.PvpTeamsCount; ++team)
{ {
foreach (var guid in m_activePlayers[team]) foreach (var guid in m_activePlayers[team])
{ {
@@ -1246,7 +1246,7 @@ namespace Game.BattleFields
void SendUpdateWorldState(uint field, uint value) void SendUpdateWorldState(uint field, uint value)
{ {
for (byte team = 0; team < SharedConst.BGTeamsCount; ++team) for (byte team = 0; team < SharedConst.PvpTeamsCount; ++team)
{ {
foreach (var guid in m_activePlayers[team]) // send to all players present in the area foreach (var guid in m_activePlayers[team]) // send to all players present in the area
{ {
@@ -1292,7 +1292,7 @@ namespace Game.BattleFields
uint GetTeamId() { return m_team; } uint GetTeamId() { return m_team; }
// active Players in the area of the objective, 0 - alliance, 1 - horde // active Players in the area of the objective, 0 - alliance, 1 - horde
HashSet<ObjectGuid>[] m_activePlayers = new HashSet<ObjectGuid>[SharedConst.BGTeamsCount]; HashSet<ObjectGuid>[] m_activePlayers = new HashSet<ObjectGuid>[SharedConst.PvpTeamsCount];
// Total shift needed to capture the objective // Total shift needed to capture the objective
float m_maxValue; float m_maxValue;
+11 -11
View File
@@ -52,7 +52,7 @@ namespace Game.BattleFields
RegisterZone(m_ZoneId); RegisterZone(m_ZoneId);
for (var team = 0; team < SharedConst.BGTeamsCount; ++team) for (var team = 0; team < SharedConst.PvpTeamsCount; ++team)
{ {
DefenderPortalList[team] = new List<ObjectGuid>(); DefenderPortalList[team] = new List<ObjectGuid>();
m_vehicles[team] = new List<ObjectGuid>(); m_vehicles[team] = new List<ObjectGuid>();
@@ -227,7 +227,7 @@ namespace Game.BattleFields
workShop.UpdateGraveyardAndWorkshop(); workShop.UpdateGraveyardAndWorkshop();
} }
for (byte team = 0; team < SharedConst.BGTeamsCount; ++team) for (byte team = 0; team < SharedConst.PvpTeamsCount; ++team)
{ {
foreach (var guid in m_players[team]) foreach (var guid in m_players[team])
{ {
@@ -358,7 +358,7 @@ namespace Game.BattleFields
player.CastSpell(player, WGSpells.DefeatReward, true); player.CastSpell(player, WGSpells.DefeatReward, true);
} }
for (byte team = 0; team < SharedConst.BGTeamsCount; ++team) for (byte team = 0; team < SharedConst.PvpTeamsCount; ++team)
{ {
foreach (var guid in m_PlayersInWar[team]) foreach (var guid in m_PlayersInWar[team])
{ {
@@ -382,7 +382,7 @@ namespace Game.BattleFields
if (!endByTimer) if (!endByTimer)
{ {
for (byte team = 0; team < SharedConst.BGTeamsCount; ++team) for (byte team = 0; team < SharedConst.PvpTeamsCount; ++team)
{ {
foreach (var guid in m_players[team]) foreach (var guid in m_players[team])
{ {
@@ -582,7 +582,7 @@ namespace Game.BattleFields
bool FindAndRemoveVehicleFromList(Unit vehicle) bool FindAndRemoveVehicleFromList(Unit vehicle)
{ {
for (byte i = 0; i < SharedConst.BGTeamsCount; ++i) for (byte i = 0; i < SharedConst.PvpTeamsCount; ++i)
{ {
if (m_vehicles[i].Contains(vehicle.GetGUID())) if (m_vehicles[i].Contains(vehicle.GetGUID()))
{ {
@@ -798,7 +798,7 @@ namespace Game.BattleFields
public override void SendInitWorldStatesToAll() public override void SendInitWorldStatesToAll()
{ {
for (byte team = 0; team < SharedConst.BGTeamsCount; team++) for (byte team = 0; team < SharedConst.PvpTeamsCount; team++)
{ {
foreach (var guid in m_players[team]) foreach (var guid in m_players[team])
{ {
@@ -1034,10 +1034,10 @@ namespace Game.BattleFields
List<WGWorkshop> Workshops = new(); List<WGWorkshop> Workshops = new();
List<ObjectGuid>[] DefenderPortalList = new List<ObjectGuid>[SharedConst.BGTeamsCount]; List<ObjectGuid>[] DefenderPortalList = new List<ObjectGuid>[SharedConst.PvpTeamsCount];
List<BfWGGameObjectBuilding> BuildingsInZone = new(); List<BfWGGameObjectBuilding> BuildingsInZone = new();
List<ObjectGuid>[] m_vehicles = new List<ObjectGuid>[SharedConst.BGTeamsCount]; List<ObjectGuid>[] m_vehicles = new List<ObjectGuid>[SharedConst.PvpTeamsCount];
List<ObjectGuid> CanonList = new(); List<ObjectGuid> CanonList = new();
int m_tenacityTeam; int m_tenacityTeam;
@@ -1489,11 +1489,11 @@ namespace Game.BattleFields
StaticWintergraspTowerInfo _staticTowerInfo; StaticWintergraspTowerInfo _staticTowerInfo;
// GameObject associations // GameObject associations
List<ObjectGuid>[] m_GameObjectList = new List<ObjectGuid>[SharedConst.BGTeamsCount]; List<ObjectGuid>[] m_GameObjectList = new List<ObjectGuid>[SharedConst.PvpTeamsCount];
// Creature associations // Creature associations
List<ObjectGuid>[] m_CreatureBottomList = new List<ObjectGuid>[SharedConst.BGTeamsCount]; List<ObjectGuid>[] m_CreatureBottomList = new List<ObjectGuid>[SharedConst.PvpTeamsCount];
List<ObjectGuid>[] m_CreatureTopList = new List<ObjectGuid>[SharedConst.BGTeamsCount]; List<ObjectGuid>[] m_CreatureTopList = new List<ObjectGuid>[SharedConst.PvpTeamsCount];
List<ObjectGuid> m_TowerCannonBottomList = new(); List<ObjectGuid> m_TowerCannonBottomList = new();
List<ObjectGuid> m_TurretTopList = new(); List<ObjectGuid> m_TurretTopList = new();
} }
+16 -16
View File
@@ -40,7 +40,7 @@ namespace Game.BattleGrounds
_battlegroundTemplate = battlegroundTemplate; _battlegroundTemplate = battlegroundTemplate;
m_RandomTypeID = BattlegroundTypeId.None; m_RandomTypeID = BattlegroundTypeId.None;
m_Status = BattlegroundStatus.None; m_Status = BattlegroundStatus.None;
_winnerTeamId = BattlegroundTeamId.Neutral; _winnerTeamId = PvPTeamId.Neutral;
m_HonorMode = BGHonorMode.Normal; m_HonorMode = BGHonorMode.Normal;
@@ -662,7 +662,7 @@ namespace Game.BattleGrounds
SendBroadcastText(BattlegroundBroadcastTexts.AllianceWins, ChatMsg.BgSystemNeutral); SendBroadcastText(BattlegroundBroadcastTexts.AllianceWins, ChatMsg.BgSystemNeutral);
PlaySoundToAll((uint)BattlegroundSounds.AllianceWins); PlaySoundToAll((uint)BattlegroundSounds.AllianceWins);
SetWinner(BattlegroundTeamId.Alliance); SetWinner(PvPTeamId.Alliance);
} }
else if (winner == Team.Horde) else if (winner == Team.Horde)
{ {
@@ -670,11 +670,11 @@ namespace Game.BattleGrounds
SendBroadcastText(BattlegroundBroadcastTexts.HordeWins, ChatMsg.BgSystemNeutral); SendBroadcastText(BattlegroundBroadcastTexts.HordeWins, ChatMsg.BgSystemNeutral);
PlaySoundToAll((uint)BattlegroundSounds.HordeWins); PlaySoundToAll((uint)BattlegroundSounds.HordeWins);
SetWinner(BattlegroundTeamId.Horde); SetWinner(PvPTeamId.Horde);
} }
else else
{ {
SetWinner(BattlegroundTeamId.Neutral); SetWinner(PvPTeamId.Neutral);
} }
PreparedStatement stmt; PreparedStatement stmt;
@@ -932,7 +932,7 @@ namespace Game.BattleGrounds
// this method is called when no players remains in Battleground // this method is called when no players remains in Battleground
public virtual void Reset() public virtual void Reset()
{ {
SetWinner(BattlegroundTeamId.Neutral); SetWinner(PvPTeamId.Neutral);
SetStatus(BattlegroundStatus.WaitQueue); SetStatus(BattlegroundStatus.WaitQueue);
SetElapsedTime(0); SetElapsedTime(0);
SetRemainingTime(0); SetRemainingTime(0);
@@ -1027,7 +1027,7 @@ namespace Game.BattleGrounds
pvpMatchInitialize.Duration = (int)(GetElapsedTime() - (int)BattlegroundStartTimeIntervals.Delay2m) / Time.InMilliseconds; pvpMatchInitialize.Duration = (int)(GetElapsedTime() - (int)BattlegroundStartTimeIntervals.Delay2m) / Time.InMilliseconds;
pvpMatchInitialize.StartTime = GameTime.GetGameTime() - pvpMatchInitialize.Duration; pvpMatchInitialize.StartTime = GameTime.GetGameTime() - pvpMatchInitialize.Duration;
} }
pvpMatchInitialize.ArenaFaction = (byte)(player.GetBGTeam() == Team.Horde ? BattlegroundTeamId.Horde : BattlegroundTeamId.Alliance); pvpMatchInitialize.ArenaFaction = (byte)(player.GetBGTeam() == Team.Horde ? PvPTeamId.Horde : PvPTeamId.Alliance);
pvpMatchInitialize.BattlemasterListID = (uint)GetTypeID(); pvpMatchInitialize.BattlemasterListID = (uint)GetTypeID();
pvpMatchInitialize.Registered = false; pvpMatchInitialize.Registered = false;
pvpMatchInitialize.AffectsRating = IsRated(); pvpMatchInitialize.AffectsRating = IsRated();
@@ -1272,8 +1272,8 @@ namespace Game.BattleGrounds
pvpLogData.Statistics.Add(playerData); pvpLogData.Statistics.Add(playerData);
} }
pvpLogData.PlayerCount[(int)BattlegroundTeamId.Horde] = (sbyte)GetPlayersCountByTeam(Team.Horde); pvpLogData.PlayerCount[(int)PvPTeamId.Horde] = (sbyte)GetPlayersCountByTeam(Team.Horde);
pvpLogData.PlayerCount[(int)BattlegroundTeamId.Alliance] = (sbyte)GetPlayersCountByTeam(Team.Alliance); pvpLogData.PlayerCount[(int)PvPTeamId.Alliance] = (sbyte)GetPlayersCountByTeam(Team.Alliance);
} }
public virtual bool UpdatePlayerScore(Player player, ScoreType type, uint value, bool doAddHonor = true) public virtual bool UpdatePlayerScore(Player player, ScoreType type, uint value, bool doAddHonor = true)
@@ -1908,7 +1908,7 @@ namespace Game.BattleGrounds
int GetStartDelayTime() { return m_StartDelayTime; } int GetStartDelayTime() { return m_StartDelayTime; }
public ArenaTypes GetArenaType() { return m_ArenaType; } public ArenaTypes GetArenaType() { return m_ArenaType; }
BattlegroundTeamId GetWinner() { return _winnerTeamId; } PvPTeamId GetWinner() { return _winnerTeamId; }
public bool IsRandom() { return m_IsRandom; } public bool IsRandom() { return m_IsRandom; }
public void SetQueueId(BattlegroundQueueTypeId queueId) { m_queueId = queueId; } public void SetQueueId(BattlegroundQueueTypeId queueId) { m_queueId = queueId; }
@@ -1922,7 +1922,7 @@ namespace Game.BattleGrounds
public void SetLastResurrectTime(uint Time) { m_LastResurrectTime = Time; } public void SetLastResurrectTime(uint Time) { m_LastResurrectTime = Time; }
public void SetRated(bool state) { m_IsRated = state; } public void SetRated(bool state) { m_IsRated = state; }
public void SetArenaType(ArenaTypes type) { m_ArenaType = type; } public void SetArenaType(ArenaTypes type) { m_ArenaType = type; }
public void SetWinner(BattlegroundTeamId winnerTeamId) { _winnerTeamId = winnerTeamId; } public void SetWinner(PvPTeamId winnerTeamId) { _winnerTeamId = winnerTeamId; }
void ModifyStartDelayTime(int diff) { m_StartDelayTime -= diff; } void ModifyStartDelayTime(int diff) { m_StartDelayTime -= diff; }
void SetStartDelayTime(BattlegroundStartTimeIntervals Time) { m_StartDelayTime = (int)Time; } void SetStartDelayTime(BattlegroundStartTimeIntervals Time) { m_StartDelayTime = (int)Time; }
@@ -2041,7 +2041,7 @@ namespace Game.BattleGrounds
bool m_IsRandom; bool m_IsRandom;
public BGHonorMode m_HonorMode; public BGHonorMode m_HonorMode;
public uint[] m_TeamScores = new uint[SharedConst.BGTeamsCount]; public uint[] m_TeamScores = new uint[SharedConst.PvpTeamsCount];
protected ObjectGuid[] BgObjects;// = new Dictionary<int, ObjectGuid>(); protected ObjectGuid[] BgObjects;// = new Dictionary<int, ObjectGuid>();
protected ObjectGuid[] BgCreatures;// = new Dictionary<int, ObjectGuid>(); protected ObjectGuid[] BgCreatures;// = new Dictionary<int, ObjectGuid>();
@@ -2063,7 +2063,7 @@ namespace Game.BattleGrounds
ArenaTypes m_ArenaType; // 2=2v2, 3=3v3, 5=5v5 ArenaTypes m_ArenaType; // 2=2v2, 3=3v3, 5=5v5
bool m_InBGFreeSlotQueue; // used to make sure that BG is only once inserted into the BattlegroundMgr.BGFreeSlotQueue[bgTypeId] deque bool m_InBGFreeSlotQueue; // used to make sure that BG is only once inserted into the BattlegroundMgr.BGFreeSlotQueue[bgTypeId] deque
bool m_SetDeleteThis; // used for safe deletion of the bg after end / all players leave bool m_SetDeleteThis; // used for safe deletion of the bg after end / all players leave
BattlegroundTeamId _winnerTeamId; PvPTeamId _winnerTeamId;
int m_StartDelayTime; int m_StartDelayTime;
bool m_IsRated; // is this battle rated? bool m_IsRated; // is this battle rated?
bool m_PrematureCountDown; bool m_PrematureCountDown;
@@ -2081,15 +2081,15 @@ namespace Game.BattleGrounds
uint m_InvitedHorde; uint m_InvitedHorde;
// Raid Group // Raid Group
Group[] m_BgRaids = new Group[SharedConst.BGTeamsCount]; // 0 - Team.Alliance, 1 - Team.Horde Group[] m_BgRaids = new Group[SharedConst.PvpTeamsCount]; // 0 - Team.Alliance, 1 - Team.Horde
// Players count by team // Players count by team
uint[] m_PlayersCount = new uint[SharedConst.BGTeamsCount]; uint[] m_PlayersCount = new uint[SharedConst.PvpTeamsCount];
// Arena team ids by team // Arena team ids by team
uint[] m_ArenaTeamIds = new uint[SharedConst.BGTeamsCount]; uint[] m_ArenaTeamIds = new uint[SharedConst.PvpTeamsCount];
uint[] m_ArenaTeamMMR = new uint[SharedConst.BGTeamsCount]; uint[] m_ArenaTeamMMR = new uint[SharedConst.PvpTeamsCount];
// Start location // Start location
BattlegroundMap m_Map; BattlegroundMap m_Map;
@@ -843,7 +843,7 @@ namespace Game.BattleGrounds
public class BattlegroundTemplate public class BattlegroundTemplate
{ {
public BattlegroundTypeId Id; public BattlegroundTypeId Id;
public WorldSafeLocsEntry[] StartLocation = new WorldSafeLocsEntry[SharedConst.BGTeamsCount]; public WorldSafeLocsEntry[] StartLocation = new WorldSafeLocsEntry[SharedConst.PvpTeamsCount];
public float MaxStartDistSq; public float MaxStartDistSq;
public byte Weight; public byte Weight;
public uint ScriptId; public uint ScriptId;
+17 -17
View File
@@ -42,7 +42,7 @@ namespace Game.BattleGrounds
m_QueuedGroups[i][c] = new List<GroupQueueInfo>(); m_QueuedGroups[i][c] = new List<GroupQueueInfo>();
} }
for (var i = 0; i < SharedConst.BGTeamsCount; ++i) for (var i = 0; i < SharedConst.PvpTeamsCount; ++i)
{ {
m_WaitTimes[i] = new uint[(int)BattlegroundBracketId.Max][]; m_WaitTimes[i] = new uint[(int)BattlegroundBracketId.Max][];
for (var c = 0; c < (int)BattlegroundBracketId.Max; ++c) for (var c = 0; c < (int)BattlegroundBracketId.Max; ++c)
@@ -78,7 +78,7 @@ namespace Game.BattleGrounds
//compute index (if group is premade or joined a rated match) to queues //compute index (if group is premade or joined a rated match) to queues
uint index = 0; uint index = 0;
if (!m_queueId.Rated && !isPremade) if (!m_queueId.Rated && !isPremade)
index += SharedConst.BGTeamsCount; index += SharedConst.PvpTeamsCount;
if (ginfo.Team == Team.Horde) if (ginfo.Team == Team.Horde)
index++; index++;
Log.outDebug(LogFilter.Battleground, "Adding Group to BattlegroundQueue bgTypeId : {0}, bracket_id : {1}, index : {2}", m_queueId.BattlemasterListId, bracketId, index); Log.outDebug(LogFilter.Battleground, "Adding Group to BattlegroundQueue bgTypeId : {0}, bracket_id : {1}, index : {2}", m_queueId.BattlemasterListId, bracketId, index);
@@ -243,7 +243,7 @@ namespace Game.BattleGrounds
{ {
//we must check premade and normal team's queue - because when players from premade are joining bg, //we must check premade and normal team's queue - because when players from premade are joining bg,
//they leave groupinfo so we can't use its players size to find out index //they leave groupinfo so we can't use its players size to find out index
for (uint j = index; j < BattlegroundConst.BgQueueTypesCount; j += SharedConst.BGTeamsCount) for (uint j = index; j < BattlegroundConst.BgQueueTypesCount; j += SharedConst.PvpTeamsCount)
{ {
foreach (var k in m_QueuedGroups[bracket_id_tmp][j]) foreach (var k in m_QueuedGroups[bracket_id_tmp][j])
{ {
@@ -567,7 +567,7 @@ namespace Game.BattleGrounds
m_SelectionPools[TeamId.Horde].AddGroup(horde_group, MaxPlayersPerTeam); m_SelectionPools[TeamId.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[TeamId.Alliance].GetPlayerCount(), m_SelectionPools[TeamId.Horde].GetPlayerCount());
for (uint i = 0; i < SharedConst.BGTeamsCount; 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])
{ {
@@ -585,7 +585,7 @@ namespace Game.BattleGrounds
// if first is invited to BG and seconds timer expired, but we can ignore it, because players have only 80 seconds to click to enter bg // if first is invited to BG and seconds timer expired, but we can ignore it, because players have only 80 seconds to click to enter bg
// and when they click or after 80 seconds the queue info is removed from queue // and when they click or after 80 seconds the queue info is removed from queue
uint time_before = (uint)(GameTime.GetGameTimeMS() - WorldConfig.GetIntValue(WorldCfg.BattlegroundPremadeGroupWaitForMatch)); uint time_before = (uint)(GameTime.GetGameTimeMS() - WorldConfig.GetIntValue(WorldCfg.BattlegroundPremadeGroupWaitForMatch));
for (uint i = 0; i < SharedConst.BGTeamsCount; i++) for (uint i = 0; i < SharedConst.PvpTeamsCount; i++)
{ {
if (!m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueuePremadeAlliance + i].Empty()) if (!m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueuePremadeAlliance + i].Empty())
{ {
@@ -605,8 +605,8 @@ namespace Game.BattleGrounds
// this method tries to create Battleground or arena with MinPlayersPerTeam against MinPlayersPerTeam // this method tries to create Battleground or arena with MinPlayersPerTeam against MinPlayersPerTeam
bool CheckNormalMatch(Battleground bg_template, BattlegroundBracketId bracket_id, uint minPlayers, uint maxPlayers) bool CheckNormalMatch(Battleground bg_template, BattlegroundBracketId bracket_id, uint minPlayers, uint maxPlayers)
{ {
int[] teamIndex = new int[SharedConst.BGTeamsCount]; int[] teamIndex = new int[SharedConst.PvpTeamsCount];
for (uint i = 0; i < SharedConst.BGTeamsCount; i++) for (uint i = 0; i < SharedConst.PvpTeamsCount; i++)
{ {
teamIndex[i] = 0; teamIndex[i] = 0;
for (; teamIndex[i] != m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalAlliance + i].Count; ++teamIndex[i]) for (; teamIndex[i] != m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalAlliance + i].Count; ++teamIndex[i])
@@ -634,7 +634,7 @@ namespace Game.BattleGrounds
{ {
var groupQueueInfo = m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalAlliance + j][teamIndex[j]]; var groupQueueInfo = m_QueuedGroups[(int)bracket_id][BattlegroundConst.BgQueueNormalAlliance + j][teamIndex[j]];
if (groupQueueInfo.IsInvitedToBGInstanceGUID == 0) if (groupQueueInfo.IsInvitedToBGInstanceGUID == 0)
if (!m_SelectionPools[j].AddGroup(groupQueueInfo, m_SelectionPools[(j + 1) % SharedConst.BGTeamsCount].GetPlayerCount())) if (!m_SelectionPools[j].AddGroup(groupQueueInfo, m_SelectionPools[(j + 1) % SharedConst.PvpTeamsCount].GetPlayerCount()))
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
@@ -808,7 +808,7 @@ namespace Game.BattleGrounds
return; return;
} }
// invite those selection pools // invite those selection pools
for (uint i = 0; i < SharedConst.BGTeamsCount; 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[TeamId.Alliance + i].SelectedGroups)
InviteGroupToBG(queueInfo, bg2, queueInfo.Team); InviteGroupToBG(queueInfo, bg2, queueInfo.Team);
@@ -835,7 +835,7 @@ namespace Game.BattleGrounds
} }
// invite those selection pools // invite those selection pools
for (uint i = 0; i < SharedConst.BGTeamsCount; 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[TeamId.Alliance + i].SelectedGroups)
InviteGroupToBG(queueInfo, bg2, queueInfo.Team); InviteGroupToBG(queueInfo, bg2, queueInfo.Team);
@@ -882,7 +882,7 @@ namespace Game.BattleGrounds
int discardTime = (int)(GameTime.GetGameTimeMS() - Global.BattlegroundMgr.GetRatingDiscardTimer()); int discardTime = (int)(GameTime.GetGameTimeMS() - Global.BattlegroundMgr.GetRatingDiscardTimer());
// we need to find 2 teams which will play next game // we need to find 2 teams which will play next game
GroupQueueInfo[] queueArray = new GroupQueueInfo[SharedConst.BGTeamsCount]; GroupQueueInfo[] queueArray = new GroupQueueInfo[SharedConst.PvpTeamsCount];
byte found = 0; byte found = 0;
byte team = 0; byte team = 0;
@@ -980,14 +980,14 @@ namespace Game.BattleGrounds
/// </summary> /// </summary>
List<GroupQueueInfo>[][] m_QueuedGroups = new List<GroupQueueInfo>[(int)BattlegroundBracketId.Max][]; List<GroupQueueInfo>[][] m_QueuedGroups = new List<GroupQueueInfo>[(int)BattlegroundBracketId.Max][];
uint[][][] m_WaitTimes = new uint[SharedConst.BGTeamsCount][][]; uint[][][] m_WaitTimes = new uint[SharedConst.PvpTeamsCount][][];
uint[][] m_WaitTimeLastPlayer = new uint[SharedConst.BGTeamsCount][]; uint[][] m_WaitTimeLastPlayer = new uint[SharedConst.PvpTeamsCount][];
uint[][] m_SumOfWaitTimes = new uint[SharedConst.BGTeamsCount][]; uint[][] m_SumOfWaitTimes = new uint[SharedConst.PvpTeamsCount][];
// Event handler // Event handler
EventSystem m_events = new(); EventSystem m_events = new();
SelectionPool[] m_SelectionPools = new SelectionPool[SharedConst.BGTeamsCount]; SelectionPool[] m_SelectionPools = new SelectionPool[SharedConst.PvpTeamsCount];
// class to select and invite groups to bg // class to select and invite groups to bg
class SelectionPool class SelectionPool
{ {
@@ -1182,7 +1182,7 @@ namespace Game.BattleGrounds
BattlegroundQueueTypeId bgQueueTypeId = bg.GetQueueId(); BattlegroundQueueTypeId bgQueueTypeId = bg.GetQueueId();
uint queueSlot = player.GetBattlegroundQueueIndex(bgQueueTypeId); uint queueSlot = player.GetBattlegroundQueueIndex(bgQueueTypeId);
if (queueSlot < SharedConst.BGTeamsCount) // player is in queue or in Battleground if (queueSlot < SharedConst.PvpTeamsCount) // player is in queue or in Battleground
{ {
// check if player is invited to this bg // check if player is invited to this bg
BattlegroundQueue bgQueue = Global.BattlegroundMgr.GetBattlegroundQueue(bgQueueTypeId); BattlegroundQueue bgQueue = Global.BattlegroundMgr.GetBattlegroundQueue(bgQueueTypeId);
@@ -1232,7 +1232,7 @@ namespace Game.BattleGrounds
//bg pointer can be NULL! so use it carefully! //bg pointer can be NULL! so use it carefully!
uint queueSlot = player.GetBattlegroundQueueIndex(m_BgQueueTypeId); uint queueSlot = player.GetBattlegroundQueueIndex(m_BgQueueTypeId);
if (queueSlot < SharedConst.BGTeamsCount) // player is in queue, or in Battleground if (queueSlot < SharedConst.PvpTeamsCount) // player is in queue, or in Battleground
{ {
// check if player is in queue for this BG and if we are removing his invite event // check if player is in queue for this BG and if we are removing his invite event
BattlegroundQueue bgQueue = Global.BattlegroundMgr.GetBattlegroundQueue(m_BgQueueTypeId); BattlegroundQueue bgQueue = Global.BattlegroundMgr.GetBattlegroundQueue(m_BgQueueTypeId);
@@ -26,7 +26,7 @@ namespace Game.BattleGrounds
public BattlegroundScore(ObjectGuid playerGuid, Team team) public BattlegroundScore(ObjectGuid playerGuid, Team team)
{ {
PlayerGuid = playerGuid; PlayerGuid = playerGuid;
TeamId = (int)(team == Team.Alliance ? BattlegroundTeamId.Alliance : BattlegroundTeamId.Horde); TeamId = (int)(team == Team.Alliance ? PvPTeamId.Alliance : PvPTeamId.Horde);
} }
public virtual void UpdateScore(ScoreType type, uint value) public virtual void UpdateScore(ScoreType type, uint value)
@@ -42,7 +42,7 @@ namespace Game.BattleGrounds.Zones
m_BannerTimers[i].teamIndex = 0; m_BannerTimers[i].teamIndex = 0;
} }
for (byte i = 0; i < SharedConst.BGTeamsCount; ++i) for (byte i = 0; i < SharedConst.PvpTeamsCount; ++i)
{ {
m_lastTick[i] = 0; m_lastTick[i] = 0;
m_HonorScoreTics[i] = 0; m_HonorScoreTics[i] = 0;
@@ -107,13 +107,13 @@ namespace Game.BattleGrounds.Zones
} }
} }
for (int team = 0; team < SharedConst.BGTeamsCount; ++team) for (int team = 0; team < SharedConst.PvpTeamsCount; ++team)
if (m_Nodes[node] == team + ABNodeStatus.Occupied) if (m_Nodes[node] == team + ABNodeStatus.Occupied)
++team_points[team]; ++team_points[team];
} }
// Accumulate points // Accumulate points
for (int team = 0; team < SharedConst.BGTeamsCount; ++team) for (int team = 0; team < SharedConst.PvpTeamsCount; ++team)
{ {
int points = team_points[team]; int points = team_points[team];
if (points == 0) if (points == 0)
@@ -163,7 +163,7 @@ namespace Game.BattleGrounds.Zones
UpdateWorldState(ABWorldStates.ResourcesHorde, m_TeamScores[team]); UpdateWorldState(ABWorldStates.ResourcesHorde, m_TeamScores[team]);
// update achievement flags // update achievement flags
// we increased m_TeamScores[team] so we just need to check if it is 500 more than other teams resources // we increased m_TeamScores[team] so we just need to check if it is 500 more than other teams resources
int otherTeam = (team + 1) % SharedConst.BGTeamsCount; int otherTeam = (team + 1) % SharedConst.PvpTeamsCount;
if (m_TeamScores[team] > m_TeamScores[otherTeam] + 500) if (m_TeamScores[team] > m_TeamScores[otherTeam] + 500)
m_TeamScores500Disadvantage[otherTeam] = true; m_TeamScores500Disadvantage[otherTeam] = true;
} }
@@ -593,7 +593,7 @@ namespace Game.BattleGrounds.Zones
//call parent's class reset //call parent's class reset
base.Reset(); base.Reset();
for (var i = 0; i < SharedConst.BGTeamsCount; ++i) for (var i = 0; i < SharedConst.PvpTeamsCount; ++i)
{ {
m_TeamScores[i] = 0; m_TeamScores[i] = 0;
m_lastTick[i] = 0; m_lastTick[i] = 0;
@@ -727,14 +727,14 @@ namespace Game.BattleGrounds.Zones
ABNodeStatus[] m_prevNodes = new ABNodeStatus[ABBattlegroundNodes.DynamicNodesCount]; ABNodeStatus[] m_prevNodes = new ABNodeStatus[ABBattlegroundNodes.DynamicNodesCount];
BannerTimer[] m_BannerTimers = new BannerTimer[ABBattlegroundNodes.DynamicNodesCount]; BannerTimer[] m_BannerTimers = new BannerTimer[ABBattlegroundNodes.DynamicNodesCount];
uint[] m_NodeTimers = new uint[ABBattlegroundNodes.DynamicNodesCount]; uint[] m_NodeTimers = new uint[ABBattlegroundNodes.DynamicNodesCount];
uint[] m_lastTick = new uint[SharedConst.BGTeamsCount]; uint[] m_lastTick = new uint[SharedConst.PvpTeamsCount];
uint[] m_HonorScoreTics = new uint[SharedConst.BGTeamsCount]; uint[] m_HonorScoreTics = new uint[SharedConst.PvpTeamsCount];
uint[] m_ReputationScoreTics = new uint[SharedConst.BGTeamsCount]; uint[] m_ReputationScoreTics = new uint[SharedConst.PvpTeamsCount];
bool m_IsInformedNearVictory; bool m_IsInformedNearVictory;
uint m_HonorTics; uint m_HonorTics;
uint m_ReputationTics; uint m_ReputationTics;
// need for achievements // need for achievements
bool[] m_TeamScores500Disadvantage = new bool[SharedConst.BGTeamsCount]; bool[] m_TeamScores500Disadvantage = new bool[SharedConst.PvpTeamsCount];
//Const //Const
public const uint NotABBGWeekendHonorTicks = 260; public const uint NotABBGWeekendHonorTicks = 260;
@@ -1148,7 +1148,7 @@ namespace Game.BattleGrounds.Zones
bool _gateDestroyed; bool _gateDestroyed;
// Achievement: Not Even a Scratch // Achievement: Not Even a Scratch
bool[] _allVehiclesAlive = new bool[SharedConst.BGTeamsCount]; bool[] _allVehiclesAlive = new bool[SharedConst.PvpTeamsCount];
} }
class BattlegroundSAScore : BattlegroundScore class BattlegroundSAScore : BattlegroundScore
+1 -1
View File
@@ -252,7 +252,7 @@ namespace Game.PvP
void BroadcastWorker(IDoWork<Player> _worker, uint zoneId) void BroadcastWorker(IDoWork<Player> _worker, uint zoneId)
{ {
for (uint i = 0; i < SharedConst.BGTeamsCount; ++i) for (uint i = 0; i < SharedConst.PvpTeamsCount; ++i)
{ {
foreach (var guid in m_players[i]) foreach (var guid in m_players[i])
{ {
+4
View File
@@ -84,6 +84,10 @@ namespace Game
Values[WorldCfg.RateXpBgKill] = GetDefaultValue("Rate.XP.BattlegroundKill", 1.0f); Values[WorldCfg.RateXpBgKill] = GetDefaultValue("Rate.XP.BattlegroundKill", 1.0f);
Values[WorldCfg.RateXpQuest] = GetDefaultValue("Rate.XP.Quest", 1.0f); Values[WorldCfg.RateXpQuest] = GetDefaultValue("Rate.XP.Quest", 1.0f);
Values[WorldCfg.RateXpExplore] = GetDefaultValue("Rate.XP.Explore", 1.0f); Values[WorldCfg.RateXpExplore] = GetDefaultValue("Rate.XP.Explore", 1.0f);
Values[CONFIG_XP_BOOST_DAYMASK] = GetDefaultValue("XP.Boost.Daymask", 0);
Values[RATE_XP_BOOST] = GetDefaultValue("XP.Boost.Rate", 2.0f);
Values[WorldCfg.RateRepaircost] = GetDefaultValue("Rate.RepairCost", 1.0f); Values[WorldCfg.RateRepaircost] = GetDefaultValue("Rate.RepairCost", 1.0f);
if ((float)Values[WorldCfg.RateRepaircost] < 0.0f) if ((float)Values[WorldCfg.RateRepaircost] < 0.0f)
{ {