[CFBG module part 3] Core/BG: Rework functions, delete ASSERT's. (#2010)
This commit is contained in:
@@ -396,7 +396,7 @@ class Battleground
|
|||||||
void SetMaxPlayersPerTeam(uint32 MaxPlayers) { m_MaxPlayersPerTeam = MaxPlayers; }
|
void SetMaxPlayersPerTeam(uint32 MaxPlayers) { m_MaxPlayersPerTeam = MaxPlayers; }
|
||||||
void SetMinPlayersPerTeam(uint32 MinPlayers) { m_MinPlayersPerTeam = MinPlayers; }
|
void SetMinPlayersPerTeam(uint32 MinPlayers) { m_MinPlayersPerTeam = MinPlayers; }
|
||||||
|
|
||||||
void DecreaseInvitedCount(TeamId teamId) { ASSERT(m_BgInvitedPlayers[teamId] > 0); --m_BgInvitedPlayers[teamId]; }
|
void DecreaseInvitedCount(TeamId teamId) { if (m_BgInvitedPlayers[teamId]) --m_BgInvitedPlayers[teamId]; }
|
||||||
void IncreaseInvitedCount(TeamId teamId) { ++m_BgInvitedPlayers[teamId]; }
|
void IncreaseInvitedCount(TeamId teamId) { ++m_BgInvitedPlayers[teamId]; }
|
||||||
uint32 GetInvitedCount(TeamId teamId) const { return m_BgInvitedPlayers[teamId]; }
|
uint32 GetInvitedCount(TeamId teamId) const { return m_BgInvitedPlayers[teamId]; }
|
||||||
|
|
||||||
|
|||||||
@@ -923,7 +923,8 @@ void BattlegroundMgr::RemoveBattleground(BattlegroundTypeId bgTypeId, uint32 ins
|
|||||||
|
|
||||||
void BattlegroundMgr::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, TeamId teamId)
|
void BattlegroundMgr::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, TeamId teamId)
|
||||||
{
|
{
|
||||||
ASSERT(!ginfo->IsInvitedToBGInstanceGUID);
|
if (ginfo->IsInvitedToBGInstanceGUID)
|
||||||
|
return;
|
||||||
|
|
||||||
// set side if needed
|
// set side if needed
|
||||||
if (teamId != TEAM_NEUTRAL)
|
if (teamId != TEAM_NEUTRAL)
|
||||||
@@ -942,13 +943,12 @@ void BattlegroundMgr::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, T
|
|||||||
ginfo->RemoveInviteTime = World::GetGameTimeMS() + INVITE_ACCEPT_WAIT_TIME;
|
ginfo->RemoveInviteTime = World::GetGameTimeMS() + INVITE_ACCEPT_WAIT_TIME;
|
||||||
|
|
||||||
// loop through the players
|
// loop through the players
|
||||||
for (std::set<uint64>::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr)
|
for (auto itr : ginfo->Players)
|
||||||
{
|
{
|
||||||
// get the player
|
// get the player
|
||||||
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(*itr);
|
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(itr);
|
||||||
|
if (!player)
|
||||||
// player is removed from queue when logging out
|
continue;
|
||||||
ASSERT(player);
|
|
||||||
|
|
||||||
// update average wait time
|
// update average wait time
|
||||||
bgQueue.PlayerInvitedToBGUpdateAverageWaitTime(ginfo);
|
bgQueue.PlayerInvitedToBGUpdateAverageWaitTime(ginfo);
|
||||||
@@ -963,12 +963,12 @@ void BattlegroundMgr::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, T
|
|||||||
BGQueueRemoveEvent* removeEvent = new BGQueueRemoveEvent(player->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgQueueTypeId, ginfo->RemoveInviteTime);
|
BGQueueRemoveEvent* removeEvent = new BGQueueRemoveEvent(player->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgQueueTypeId, ginfo->RemoveInviteTime);
|
||||||
bgQueue.AddEvent(removeEvent, INVITE_ACCEPT_WAIT_TIME);
|
bgQueue.AddEvent(removeEvent, INVITE_ACCEPT_WAIT_TIME);
|
||||||
|
|
||||||
WorldPacket data;
|
// Check queueSlot
|
||||||
|
|
||||||
uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId);
|
uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId);
|
||||||
ASSERT(queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES);
|
ASSERT(queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES);
|
||||||
|
|
||||||
// send status packet
|
// send status packet
|
||||||
|
WorldPacket data;
|
||||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType, TEAM_NEUTRAL, bg->isRated(), ginfo->BgTypeId);
|
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType, TEAM_NEUTRAL, bg->isRated(), ginfo->BgTypeId);
|
||||||
player->GetSession()->SendPacket(&data);
|
player->GetSession()->SendPacket(&data);
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ BattlegroundQueue::~BattlegroundQueue()
|
|||||||
m_QueuedPlayers.clear();
|
m_QueuedPlayers.clear();
|
||||||
for (int i = 0; i < MAX_BATTLEGROUND_BRACKETS; ++i)
|
for (int i = 0; i < MAX_BATTLEGROUND_BRACKETS; ++i)
|
||||||
{
|
{
|
||||||
for (uint32 j = 0; j < BG_QUEUE_GROUP_TYPES_COUNT; ++j)
|
for (uint32 j = 0; j < BG_QUEUE_MAX; ++j)
|
||||||
{
|
{
|
||||||
for (GroupsQueueType::iterator itr = m_QueuedGroups[i][j].begin(); itr != m_QueuedGroups[i][j].end(); ++itr)
|
for (GroupsQueueType::iterator itr = m_QueuedGroups[i][j].begin(); itr != m_QueuedGroups[i][j].end(); ++itr)
|
||||||
delete (*itr);
|
delete (*itr);
|
||||||
@@ -135,6 +135,7 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player * leader, Group * grp, PvPDif
|
|||||||
ginfo->JoinTime = World::GetGameTimeMS();
|
ginfo->JoinTime = World::GetGameTimeMS();
|
||||||
ginfo->RemoveInviteTime = 0;
|
ginfo->RemoveInviteTime = 0;
|
||||||
ginfo->teamId = leader->GetTeamId();
|
ginfo->teamId = leader->GetTeamId();
|
||||||
|
ginfo->RealTeamID = leader->GetTeamId(true);
|
||||||
ginfo->ArenaTeamRating = ArenaRating;
|
ginfo->ArenaTeamRating = ArenaRating;
|
||||||
ginfo->ArenaMatchmakerRating = MatchmakerRating;
|
ginfo->ArenaMatchmakerRating = MatchmakerRating;
|
||||||
ginfo->OpponentsTeamRating = 0;
|
ginfo->OpponentsTeamRating = 0;
|
||||||
@@ -144,8 +145,10 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player * leader, Group * grp, PvPDif
|
|||||||
|
|
||||||
//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
|
||||||
uint32 index = 0;
|
uint32 index = 0;
|
||||||
|
|
||||||
if (!isRated && !isPremade)
|
if (!isRated && !isPremade)
|
||||||
index += BG_TEAMS_COUNT;
|
index += BG_TEAMS_COUNT;
|
||||||
|
|
||||||
if (ginfo->teamId == TEAM_HORDE)
|
if (ginfo->teamId == TEAM_HORDE)
|
||||||
index++;
|
index++;
|
||||||
|
|
||||||
@@ -155,11 +158,8 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player * leader, Group * grp, PvPDif
|
|||||||
|
|
||||||
// announce world (this doesn't need mutex)
|
// announce world (this doesn't need mutex)
|
||||||
if (isRated && sWorld->getBoolConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE))
|
if (isRated && sWorld->getBoolConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE))
|
||||||
{
|
if (ArenaTeam* team = sArenaTeamMgr->GetArenaTeamById(arenateamid))
|
||||||
ArenaTeam* team = sArenaTeamMgr->GetArenaTeamById(arenateamid);
|
|
||||||
if (team)
|
|
||||||
sWorld->SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN, team->GetName().c_str(), ginfo->ArenaType, ginfo->ArenaType, ginfo->ArenaTeamRating);
|
sWorld->SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN, team->GetName().c_str(), ginfo->ArenaType, ginfo->ArenaType, ginfo->ArenaTeamRating);
|
||||||
}
|
|
||||||
|
|
||||||
//add players from group to ginfo
|
//add players from group to ginfo
|
||||||
if (grp)
|
if (grp)
|
||||||
@@ -194,15 +194,8 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player * leader, Group * grp, PvPDif
|
|||||||
uint32 MaxPlayers = MinPlayers * 2;
|
uint32 MaxPlayers = MinPlayers * 2;
|
||||||
uint32 q_min_level = std::min(bracketEntry->minLevel, (uint32)80);
|
uint32 q_min_level = std::min(bracketEntry->minLevel, (uint32)80);
|
||||||
uint32 q_max_level = std::min(bracketEntry->maxLevel, (uint32)80);
|
uint32 q_max_level = std::min(bracketEntry->maxLevel, (uint32)80);
|
||||||
uint32 qHorde = 0;
|
uint32 qHorde = GetPlayersCountInGroupsQueue(bracketId, BG_QUEUE_NORMAL_HORDE);
|
||||||
uint32 qAlliance = 0;
|
uint32 qAlliance = GetPlayersCountInGroupsQueue(bracketId, BG_QUEUE_NORMAL_ALLIANCE);
|
||||||
GroupsQueueType::const_iterator itr;
|
|
||||||
for (itr = m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_ALLIANCE].begin(); itr != m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_ALLIANCE].end(); ++itr)
|
|
||||||
if (!(*itr)->IsInvitedToBGInstanceGUID)
|
|
||||||
qAlliance += (*itr)->Players.size();
|
|
||||||
for (itr = m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_HORDE].begin(); itr != m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_HORDE].end(); ++itr)
|
|
||||||
if (!(*itr)->IsInvitedToBGInstanceGUID)
|
|
||||||
qHorde += (*itr)->Players.size();
|
|
||||||
|
|
||||||
// Show queue status to player only (when joining battleground queue or Arena and arena world announcer is disabled)
|
// Show queue status to player only (when joining battleground queue or Arena and arena world announcer is disabled)
|
||||||
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY) || (bgt->isArena() && !sWorld->getBoolConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE)))
|
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY) || (bgt->isArena() && !sWorld->getBoolConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE)))
|
||||||
@@ -210,8 +203,7 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player * leader, Group * grp, PvPDif
|
|||||||
ChatHandler(leader->GetSession()).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_SELF, bgName, q_min_level, q_max_level,
|
ChatHandler(leader->GetSession()).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_SELF, bgName, q_min_level, q_max_level,
|
||||||
qAlliance, (MinPlayers > qAlliance) ? MinPlayers - qAlliance : (uint32)0, qHorde, (MinPlayers > qHorde) ? MinPlayers - qHorde : (uint32)0);
|
qAlliance, (MinPlayers > qAlliance) ? MinPlayers - qAlliance : (uint32)0, qHorde, (MinPlayers > qHorde) ? MinPlayers - qHorde : (uint32)0);
|
||||||
}
|
}
|
||||||
// Show queue status to server (when joining battleground queue)
|
else if (!bgt->isArena()) // Show queue status to server (when joining battleground queue)
|
||||||
else if (!bgt->isArena())
|
|
||||||
{
|
{
|
||||||
if (BGSpamProtection[leader->GetGUID()].last_queue == 0)
|
if (BGSpamProtection[leader->GetGUID()].last_queue == 0)
|
||||||
{
|
{
|
||||||
@@ -226,7 +218,6 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player * leader, Group * grp, PvPDif
|
|||||||
qAlliance + qHorde, MaxPlayers);
|
qAlliance + qHorde, MaxPlayers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ginfo;
|
return ginfo;
|
||||||
@@ -407,8 +398,10 @@ bool BattlegroundQueue::GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo * gin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// this function is filling pools given free slots on both sides, result is ballanced
|
// this function is filling pools given free slots on both sides, result is ballanced
|
||||||
void BattlegroundQueue::FillPlayersToBG(const int32 aliFree, const int32 hordeFree, BattlegroundBracketId bracket_id)
|
void BattlegroundQueue::FillPlayersToBG(Battleground* bg, const int32 aliFree, const int32 hordeFree, BattlegroundBracketId bracket_id)
|
||||||
{
|
{
|
||||||
|
UNUSED(bg);
|
||||||
|
|
||||||
// clear selection pools
|
// clear selection pools
|
||||||
m_SelectionPools[TEAM_ALLIANCE].Init();
|
m_SelectionPools[TEAM_ALLIANCE].Init();
|
||||||
m_SelectionPools[TEAM_HORDE].Init();
|
m_SelectionPools[TEAM_HORDE].Init();
|
||||||
@@ -463,8 +456,10 @@ void BattlegroundQueue::FillPlayersToBG(const int32 aliFree, const int32 hordeFr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlegroundQueue::FillPlayersToBGWithSpecific(const int32 aliFree, const int32 hordeFree, BattlegroundBracketId thisBracketId, BattlegroundQueue * specificQueue, BattlegroundBracketId specificBracketId)
|
void BattlegroundQueue::FillPlayersToBGWithSpecific(Battleground* bg, const int32 aliFree, const int32 hordeFree, BattlegroundBracketId thisBracketId, BattlegroundQueue * specificQueue, BattlegroundBracketId specificBracketId)
|
||||||
{
|
{
|
||||||
|
UNUSED(bg);
|
||||||
|
|
||||||
// clear selection pools
|
// clear selection pools
|
||||||
m_SelectionPools[TEAM_ALLIANCE].Init();
|
m_SelectionPools[TEAM_ALLIANCE].Init();
|
||||||
m_SelectionPools[TEAM_HORDE].Init();
|
m_SelectionPools[TEAM_HORDE].Init();
|
||||||
@@ -600,7 +595,7 @@ bool BattlegroundQueue::CheckNormalMatch(Battleground * bgTemplate, Battleground
|
|||||||
// specific queue
|
// specific queue
|
||||||
BattlegroundQueue & specificQueue = sBattlegroundMgr->GetBattlegroundQueue(BattlegroundMgr::BGQueueTypeId(sBattlegroundMgr->RandomSystem.GetCurrentRandomBg(), 0));
|
BattlegroundQueue & specificQueue = sBattlegroundMgr->GetBattlegroundQueue(BattlegroundMgr::BGQueueTypeId(sBattlegroundMgr->RandomSystem.GetCurrentRandomBg(), 0));
|
||||||
|
|
||||||
FillPlayersToBGWithSpecific(specificTemplate->GetMaxPlayersPerTeam(), specificTemplate->GetMaxPlayersPerTeam(), bracket_id, &specificQueue, BattlegroundBracketId(specificBracket->bracketId));
|
FillPlayersToBGWithSpecific(specificTemplate, specificTemplate->GetMaxPlayersPerTeam(), specificTemplate->GetMaxPlayersPerTeam(), bracket_id, &specificQueue, BattlegroundBracketId(specificBracket->bracketId));
|
||||||
|
|
||||||
//allow 1v0 if debug bg
|
//allow 1v0 if debug bg
|
||||||
if (sBattlegroundMgr->isTesting() && bgTemplate->isBattleground() && (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[TEAM_HORDE].GetPlayerCount()))
|
if (sBattlegroundMgr->isTesting() && bgTemplate->isBattleground() && (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[TEAM_HORDE].GetPlayerCount()))
|
||||||
@@ -611,7 +606,7 @@ bool BattlegroundQueue::CheckNormalMatch(Battleground * bgTemplate, Battleground
|
|||||||
// if this is not random bg queue - use players only from this queue
|
// if this is not random bg queue - use players only from this queue
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FillPlayersToBG(maxPlayers, maxPlayers, bracket_id);
|
FillPlayersToBG(bgTemplate, maxPlayers, maxPlayers, bracket_id);
|
||||||
|
|
||||||
//allow 1v0 if debug bg
|
//allow 1v0 if debug bg
|
||||||
if (sBattlegroundMgr->isTesting() && bgTemplate->isBattleground() && (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[TEAM_HORDE].GetPlayerCount()))
|
if (sBattlegroundMgr->isTesting() && bgTemplate->isBattleground() && (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[TEAM_HORDE].GetPlayerCount()))
|
||||||
@@ -682,10 +677,7 @@ typedef std::set<Battleground*, BgEmptinessComp> BattlegroundNeedSet;
|
|||||||
void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id, uint8 actionMask, bool isRated, uint32 arenaRatedTeamId)
|
void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id, uint8 actionMask, bool isRated, uint32 arenaRatedTeamId)
|
||||||
{
|
{
|
||||||
// if no players in queue - do nothing
|
// if no players in queue - do nothing
|
||||||
if (m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].empty() &&
|
if (IsAllQueuesEmpty(bracket_id))
|
||||||
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].empty() &&
|
|
||||||
m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].empty() &&
|
|
||||||
m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty())
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Battleground* bg_template = sBattlegroundMgr->GetBattlegroundTemplate(m_bgTypeId);
|
Battleground* bg_template = sBattlegroundMgr->GetBattlegroundTemplate(m_bgTypeId);
|
||||||
@@ -717,12 +709,12 @@ void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id
|
|||||||
Battleground* bg = *itr;
|
Battleground* bg = *itr;
|
||||||
|
|
||||||
// call a function that fills whatever we can from normal queues
|
// call a function that fills whatever we can from normal queues
|
||||||
FillPlayersToBG(bg->GetFreeSlotsForTeam(TEAM_ALLIANCE), bg->GetFreeSlotsForTeam(TEAM_HORDE), bracket_id);
|
FillPlayersToBG(bg, bg->GetFreeSlotsForTeam(TEAM_ALLIANCE), bg->GetFreeSlotsForTeam(TEAM_HORDE), bracket_id);
|
||||||
|
|
||||||
// invite players
|
// invite players
|
||||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||||
for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr)
|
for (auto itr : m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups)
|
||||||
BattlegroundMgr::InviteGroupToBG((*citr), bg, (*citr)->teamId);
|
BattlegroundMgr::InviteGroupToBG(itr, bg, itr->RealTeamID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -760,7 +752,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id
|
|||||||
if (bg->HasFreeSlots())
|
if (bg->HasFreeSlots())
|
||||||
{
|
{
|
||||||
// call a function that fills whatever we can from normal queues
|
// call a function that fills whatever we can from normal queues
|
||||||
FillPlayersToBG(bg->GetFreeSlotsForTeam(TEAM_ALLIANCE), bg->GetFreeSlotsForTeam(TEAM_HORDE), bracket_id);
|
FillPlayersToBG(bg, bg->GetFreeSlotsForTeam(TEAM_ALLIANCE), bg->GetFreeSlotsForTeam(TEAM_HORDE), bracket_id);
|
||||||
|
|
||||||
// invite players
|
// invite players
|
||||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||||
@@ -839,7 +831,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id
|
|||||||
uint32 MMR1 = std::min((*itr)->ArenaMatchmakerRating, maxCountedMMR);
|
uint32 MMR1 = std::min((*itr)->ArenaMatchmakerRating, maxCountedMMR);
|
||||||
|
|
||||||
GroupsQueueType::iterator oponentItr;
|
GroupsQueueType::iterator oponentItr;
|
||||||
uint8 oponentQueue = BG_QUEUE_GROUP_TYPES_COUNT;
|
uint8 oponentQueue = BG_QUEUE_MAX;
|
||||||
uint32 minOponentMMRDiff = 0xffffffff;
|
uint32 minOponentMMRDiff = 0xffffffff;
|
||||||
uint8 oponentValid = 0;
|
uint8 oponentValid = 0;
|
||||||
|
|
||||||
@@ -905,7 +897,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oponentQueue != BG_QUEUE_GROUP_TYPES_COUNT)
|
if (oponentQueue != BG_QUEUE_MAX)
|
||||||
{
|
{
|
||||||
if (oponentValid)
|
if (oponentValid)
|
||||||
{
|
{
|
||||||
@@ -963,6 +955,31 @@ void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32 BattlegroundQueue::GetPlayersCountInGroupsQueue(BattlegroundBracketId bracketId, BattlegroundQueueGroupTypes bgqueue)
|
||||||
|
{
|
||||||
|
uint32 playersCount = 0;
|
||||||
|
|
||||||
|
for (auto const& itr : m_QueuedGroups[bracketId][bgqueue])
|
||||||
|
if (!itr->IsInvitedToBGInstanceGUID)
|
||||||
|
playersCount += static_cast<uint32>(itr->Players.size());
|
||||||
|
|
||||||
|
return playersCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BattlegroundQueue::IsAllQueuesEmpty(BattlegroundBracketId bracket_id)
|
||||||
|
{
|
||||||
|
uint32 queueEmptyCount = 0;
|
||||||
|
|
||||||
|
for (uint8 i = 0; i < BG_QUEUE_MAX; i++)
|
||||||
|
if (m_QueuedGroups[bracket_id][i].empty())
|
||||||
|
queueEmptyCount++;
|
||||||
|
|
||||||
|
if (queueEmptyCount == BG_QUEUE_MAX)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
/*** BATTLEGROUND QUEUE EVENTS ***/
|
/*** BATTLEGROUND QUEUE EVENTS ***/
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ struct GroupQueueInfo // stores informatio
|
|||||||
{
|
{
|
||||||
std::set<uint64> Players; // player guid set
|
std::set<uint64> Players; // player guid set
|
||||||
TeamId teamId; // Player team (TEAM_ALLIANCE/TEAM_HORDE)
|
TeamId teamId; // Player team (TEAM_ALLIANCE/TEAM_HORDE)
|
||||||
|
TeamId RealTeamID; // Realm player team (TEAM_ALLIANCE/TEAM_HORDE)
|
||||||
BattlegroundTypeId BgTypeId; // battleground type id
|
BattlegroundTypeId BgTypeId; // battleground type id
|
||||||
bool IsRated; // rated
|
bool IsRated; // rated
|
||||||
uint8 ArenaType; // 2v2, 3v3, 5v5 or 0 when BG
|
uint8 ArenaType; // 2v2, 3v3, 5v5 or 0 when BG
|
||||||
@@ -39,12 +40,13 @@ struct GroupQueueInfo // stores informatio
|
|||||||
|
|
||||||
enum BattlegroundQueueGroupTypes
|
enum BattlegroundQueueGroupTypes
|
||||||
{
|
{
|
||||||
BG_QUEUE_PREMADE_ALLIANCE = 0,
|
BG_QUEUE_PREMADE_ALLIANCE,
|
||||||
BG_QUEUE_PREMADE_HORDE = 1,
|
BG_QUEUE_PREMADE_HORDE,
|
||||||
BG_QUEUE_NORMAL_ALLIANCE = 2,
|
BG_QUEUE_NORMAL_ALLIANCE,
|
||||||
BG_QUEUE_NORMAL_HORDE = 3
|
BG_QUEUE_NORMAL_HORDE,
|
||||||
|
|
||||||
|
BG_QUEUE_MAX
|
||||||
};
|
};
|
||||||
#define BG_QUEUE_GROUP_TYPES_COUNT 4
|
|
||||||
|
|
||||||
class Battleground;
|
class Battleground;
|
||||||
class BattlegroundQueue
|
class BattlegroundQueue
|
||||||
@@ -56,8 +58,8 @@ class BattlegroundQueue
|
|||||||
void BattlegroundQueueUpdate(BattlegroundBracketId bracket_id, uint8 actionMask, bool isRated, uint32 arenaRatedTeamId);
|
void BattlegroundQueueUpdate(BattlegroundBracketId bracket_id, uint8 actionMask, bool isRated, uint32 arenaRatedTeamId);
|
||||||
void UpdateEvents(uint32 diff);
|
void UpdateEvents(uint32 diff);
|
||||||
|
|
||||||
void FillPlayersToBG(const int32 aliFree, const int32 hordeFree, BattlegroundBracketId bracket_id);
|
void FillPlayersToBG(Battleground* bg, const int32 aliFree, const int32 hordeFree, BattlegroundBracketId bracket_id);
|
||||||
void FillPlayersToBGWithSpecific(const int32 aliFree, const int32 hordeFree, BattlegroundBracketId thisBracketId, BattlegroundQueue* specificQueue, BattlegroundBracketId specificBracketId);
|
void FillPlayersToBGWithSpecific(Battleground* bg, const int32 aliFree, const int32 hordeFree, BattlegroundBracketId thisBracketId, BattlegroundQueue* specificQueue, BattlegroundBracketId specificBracketId);
|
||||||
bool CheckPremadeMatch(BattlegroundBracketId bracket_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam);
|
bool CheckPremadeMatch(BattlegroundBracketId bracket_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam);
|
||||||
bool CheckNormalMatch(Battleground* bgTemplate, BattlegroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers);
|
bool CheckNormalMatch(Battleground* bgTemplate, BattlegroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers);
|
||||||
bool CheckSkirmishForSameFaction(BattlegroundBracketId bracket_id, uint32 minPlayersPerTeam);
|
bool CheckSkirmishForSameFaction(BattlegroundBracketId bracket_id, uint32 minPlayersPerTeam);
|
||||||
@@ -68,6 +70,8 @@ class BattlegroundQueue
|
|||||||
bool GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo* ginfo);
|
bool GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo* ginfo);
|
||||||
void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo);
|
void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo);
|
||||||
uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo) const;
|
uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo) const;
|
||||||
|
uint32 GetPlayersCountInGroupsQueue(BattlegroundBracketId bracketId, BattlegroundQueueGroupTypes bgqueue);
|
||||||
|
bool IsAllQueuesEmpty(BattlegroundBracketId bracket_id);
|
||||||
|
|
||||||
void SetBgTypeIdAndArenaType(BattlegroundTypeId b, uint8 a) { m_bgTypeId = b; m_arenaType = ArenaType(a); } // pussywizard
|
void SetBgTypeIdAndArenaType(BattlegroundTypeId b, uint8 a) { m_bgTypeId = b; m_arenaType = ArenaType(a); } // pussywizard
|
||||||
void AddEvent(BasicEvent* Event, uint64 e_time);
|
void AddEvent(BasicEvent* Event, uint64 e_time);
|
||||||
@@ -87,7 +91,7 @@ class BattlegroundQueue
|
|||||||
BG_QUEUE_NORMAL_ALLIANCE is used for normal (or small) alliance groups or non-rated arena matches
|
BG_QUEUE_NORMAL_ALLIANCE is used for normal (or small) alliance groups or non-rated arena matches
|
||||||
BG_QUEUE_NORMAL_HORDE is used for normal (or small) horde groups or non-rated arena matches
|
BG_QUEUE_NORMAL_HORDE is used for normal (or small) horde groups or non-rated arena matches
|
||||||
*/
|
*/
|
||||||
GroupsQueueType m_QueuedGroups[MAX_BATTLEGROUND_BRACKETS][BG_QUEUE_GROUP_TYPES_COUNT];
|
GroupsQueueType m_QueuedGroups[MAX_BATTLEGROUND_BRACKETS][BG_QUEUE_MAX];
|
||||||
|
|
||||||
// class to select and invite groups to bg
|
// class to select and invite groups to bg
|
||||||
class SelectionPool
|
class SelectionPool
|
||||||
|
|||||||
Reference in New Issue
Block a user