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
+16 -16
View File
@@ -40,7 +40,7 @@ namespace Game.BattleGrounds
_battlegroundTemplate = battlegroundTemplate;
m_RandomTypeID = BattlegroundTypeId.None;
m_Status = BattlegroundStatus.None;
_winnerTeamId = BattlegroundTeamId.Neutral;
_winnerTeamId = PvPTeamId.Neutral;
m_HonorMode = BGHonorMode.Normal;
@@ -662,7 +662,7 @@ namespace Game.BattleGrounds
SendBroadcastText(BattlegroundBroadcastTexts.AllianceWins, ChatMsg.BgSystemNeutral);
PlaySoundToAll((uint)BattlegroundSounds.AllianceWins);
SetWinner(BattlegroundTeamId.Alliance);
SetWinner(PvPTeamId.Alliance);
}
else if (winner == Team.Horde)
{
@@ -670,11 +670,11 @@ namespace Game.BattleGrounds
SendBroadcastText(BattlegroundBroadcastTexts.HordeWins, ChatMsg.BgSystemNeutral);
PlaySoundToAll((uint)BattlegroundSounds.HordeWins);
SetWinner(BattlegroundTeamId.Horde);
SetWinner(PvPTeamId.Horde);
}
else
{
SetWinner(BattlegroundTeamId.Neutral);
SetWinner(PvPTeamId.Neutral);
}
PreparedStatement stmt;
@@ -932,7 +932,7 @@ namespace Game.BattleGrounds
// this method is called when no players remains in Battleground
public virtual void Reset()
{
SetWinner(BattlegroundTeamId.Neutral);
SetWinner(PvPTeamId.Neutral);
SetStatus(BattlegroundStatus.WaitQueue);
SetElapsedTime(0);
SetRemainingTime(0);
@@ -1027,7 +1027,7 @@ namespace Game.BattleGrounds
pvpMatchInitialize.Duration = (int)(GetElapsedTime() - (int)BattlegroundStartTimeIntervals.Delay2m) / Time.InMilliseconds;
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.Registered = false;
pvpMatchInitialize.AffectsRating = IsRated();
@@ -1272,8 +1272,8 @@ namespace Game.BattleGrounds
pvpLogData.Statistics.Add(playerData);
}
pvpLogData.PlayerCount[(int)BattlegroundTeamId.Horde] = (sbyte)GetPlayersCountByTeam(Team.Horde);
pvpLogData.PlayerCount[(int)BattlegroundTeamId.Alliance] = (sbyte)GetPlayersCountByTeam(Team.Alliance);
pvpLogData.PlayerCount[(int)PvPTeamId.Horde] = (sbyte)GetPlayersCountByTeam(Team.Horde);
pvpLogData.PlayerCount[(int)PvPTeamId.Alliance] = (sbyte)GetPlayersCountByTeam(Team.Alliance);
}
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; }
public ArenaTypes GetArenaType() { return m_ArenaType; }
BattlegroundTeamId GetWinner() { return _winnerTeamId; }
PvPTeamId GetWinner() { return _winnerTeamId; }
public bool IsRandom() { return m_IsRandom; }
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 SetRated(bool state) { m_IsRated = state; }
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 SetStartDelayTime(BattlegroundStartTimeIntervals Time) { m_StartDelayTime = (int)Time; }
@@ -2041,7 +2041,7 @@ namespace Game.BattleGrounds
bool m_IsRandom;
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[] BgCreatures;// = new Dictionary<int, ObjectGuid>();
@@ -2063,7 +2063,7 @@ namespace Game.BattleGrounds
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_SetDeleteThis; // used for safe deletion of the bg after end / all players leave
BattlegroundTeamId _winnerTeamId;
PvPTeamId _winnerTeamId;
int m_StartDelayTime;
bool m_IsRated; // is this battle rated?
bool m_PrematureCountDown;
@@ -2081,15 +2081,15 @@ namespace Game.BattleGrounds
uint m_InvitedHorde;
// 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
uint[] m_PlayersCount = new uint[SharedConst.BGTeamsCount];
uint[] m_PlayersCount = new uint[SharedConst.PvpTeamsCount];
// 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
BattlegroundMap m_Map;
@@ -843,7 +843,7 @@ namespace Game.BattleGrounds
public class BattlegroundTemplate
{
public BattlegroundTypeId Id;
public WorldSafeLocsEntry[] StartLocation = new WorldSafeLocsEntry[SharedConst.BGTeamsCount];
public WorldSafeLocsEntry[] StartLocation = new WorldSafeLocsEntry[SharedConst.PvpTeamsCount];
public float MaxStartDistSq;
public byte Weight;
public uint ScriptId;
+17 -17
View File
@@ -42,7 +42,7 @@ namespace Game.BattleGrounds
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][];
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
uint index = 0;
if (!m_queueId.Rated && !isPremade)
index += SharedConst.BGTeamsCount;
index += SharedConst.PvpTeamsCount;
if (ginfo.Team == Team.Horde)
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,
//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])
{
@@ -567,7 +567,7 @@ namespace Game.BattleGrounds
m_SelectionPools[TeamId.Horde].AddGroup(horde_group, MaxPlayersPerTeam);
//add groups/players from normal queue to size of bigger group
uint maxPlayers = Math.Min(m_SelectionPools[TeamId.Alliance].GetPlayerCount(), m_SelectionPools[TeamId.Horde].GetPlayerCount());
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])
{
@@ -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
// 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));
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())
{
@@ -605,8 +605,8 @@ namespace Game.BattleGrounds
// this method tries to create Battleground or arena with MinPlayersPerTeam against MinPlayersPerTeam
bool CheckNormalMatch(Battleground bg_template, BattlegroundBracketId bracket_id, uint minPlayers, uint maxPlayers)
{
int[] teamIndex = new int[SharedConst.BGTeamsCount];
for (uint i = 0; i < SharedConst.BGTeamsCount; i++)
int[] teamIndex = new int[SharedConst.PvpTeamsCount];
for (uint i = 0; i < SharedConst.PvpTeamsCount; i++)
{
teamIndex[i] = 0;
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]];
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;
}
// do not allow to start bg with more than 2 players more on 1 faction
@@ -808,7 +808,7 @@ namespace Game.BattleGrounds
return;
}
// 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)
InviteGroupToBG(queueInfo, bg2, queueInfo.Team);
@@ -835,7 +835,7 @@ namespace Game.BattleGrounds
}
// 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)
InviteGroupToBG(queueInfo, bg2, queueInfo.Team);
@@ -882,7 +882,7 @@ namespace Game.BattleGrounds
int discardTime = (int)(GameTime.GetGameTimeMS() - Global.BattlegroundMgr.GetRatingDiscardTimer());
// 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 team = 0;
@@ -980,14 +980,14 @@ namespace Game.BattleGrounds
/// </summary>
List<GroupQueueInfo>[][] m_QueuedGroups = new List<GroupQueueInfo>[(int)BattlegroundBracketId.Max][];
uint[][][] m_WaitTimes = new uint[SharedConst.BGTeamsCount][][];
uint[][] m_WaitTimeLastPlayer = new uint[SharedConst.BGTeamsCount][];
uint[][] m_SumOfWaitTimes = new uint[SharedConst.BGTeamsCount][];
uint[][][] m_WaitTimes = new uint[SharedConst.PvpTeamsCount][][];
uint[][] m_WaitTimeLastPlayer = new uint[SharedConst.PvpTeamsCount][];
uint[][] m_SumOfWaitTimes = new uint[SharedConst.PvpTeamsCount][];
// Event handler
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 SelectionPool
{
@@ -1182,7 +1182,7 @@ namespace Game.BattleGrounds
BattlegroundQueueTypeId bgQueueTypeId = bg.GetQueueId();
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
BattlegroundQueue bgQueue = Global.BattlegroundMgr.GetBattlegroundQueue(bgQueueTypeId);
@@ -1232,7 +1232,7 @@ namespace Game.BattleGrounds
//bg pointer can be NULL! so use it carefully!
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
BattlegroundQueue bgQueue = Global.BattlegroundMgr.GetBattlegroundQueue(m_BgQueueTypeId);
@@ -26,7 +26,7 @@ namespace Game.BattleGrounds
public BattlegroundScore(ObjectGuid playerGuid, Team team)
{
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)
@@ -42,7 +42,7 @@ namespace Game.BattleGrounds.Zones
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_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)
++team_points[team];
}
// Accumulate points
for (int team = 0; team < SharedConst.BGTeamsCount; ++team)
for (int team = 0; team < SharedConst.PvpTeamsCount; ++team)
{
int points = team_points[team];
if (points == 0)
@@ -163,7 +163,7 @@ namespace Game.BattleGrounds.Zones
UpdateWorldState(ABWorldStates.ResourcesHorde, m_TeamScores[team]);
// update achievement flags
// 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)
m_TeamScores500Disadvantage[otherTeam] = true;
}
@@ -593,7 +593,7 @@ namespace Game.BattleGrounds.Zones
//call parent's class reset
base.Reset();
for (var i = 0; i < SharedConst.BGTeamsCount; ++i)
for (var i = 0; i < SharedConst.PvpTeamsCount; ++i)
{
m_TeamScores[i] = 0;
m_lastTick[i] = 0;
@@ -727,14 +727,14 @@ namespace Game.BattleGrounds.Zones
ABNodeStatus[] m_prevNodes = new ABNodeStatus[ABBattlegroundNodes.DynamicNodesCount];
BannerTimer[] m_BannerTimers = new BannerTimer[ABBattlegroundNodes.DynamicNodesCount];
uint[] m_NodeTimers = new uint[ABBattlegroundNodes.DynamicNodesCount];
uint[] m_lastTick = new uint[SharedConst.BGTeamsCount];
uint[] m_HonorScoreTics = new uint[SharedConst.BGTeamsCount];
uint[] m_ReputationScoreTics = new uint[SharedConst.BGTeamsCount];
uint[] m_lastTick = new uint[SharedConst.PvpTeamsCount];
uint[] m_HonorScoreTics = new uint[SharedConst.PvpTeamsCount];
uint[] m_ReputationScoreTics = new uint[SharedConst.PvpTeamsCount];
bool m_IsInformedNearVictory;
uint m_HonorTics;
uint m_ReputationTics;
// need for achievements
bool[] m_TeamScores500Disadvantage = new bool[SharedConst.BGTeamsCount];
bool[] m_TeamScores500Disadvantage = new bool[SharedConst.PvpTeamsCount];
//Const
public const uint NotABBGWeekendHonorTicks = 260;
@@ -1148,7 +1148,7 @@ namespace Game.BattleGrounds.Zones
bool _gateDestroyed;
// Achievement: Not Even a Scratch
bool[] _allVehiclesAlive = new bool[SharedConst.BGTeamsCount];
bool[] _allVehiclesAlive = new bool[SharedConst.PvpTeamsCount];
}
class BattlegroundSAScore : BattlegroundScore