本文整理汇总了C++中Battleground::SetTeamMatchmakerRating方法的典型用法代码示例。如果您正苦于以下问题:C++ Battleground::SetTeamMatchmakerRating方法的具体用法?C++ Battleground::SetTeamMatchmakerRating怎么用?C++ Battleground::SetTeamMatchmakerRating使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Battleground
的用法示例。
在下文中一共展示了Battleground::SetTeamMatchmakerRating方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BattlegroundQueueUpdate
//.........这里部分代码省略.........
if (front1 && front2)
{
if (front1->joinTime < front2->joinTime)
arenaRating = front1->teamMatchmakerRating;
}
else if (!front1 && !front2)
return; //queues are empty
}
//set rating range
uint32 arenaMinRating = (arenaRating <= sBattlegroundMgr->GetMaxRatingDifference()) ? 0 : arenaRating - sBattlegroundMgr->GetMaxRatingDifference();
uint32 arenaMaxRating = arenaRating + sBattlegroundMgr->GetMaxRatingDifference();
// if max rating difference is set and the time past since server startup is greater than the rating discard time
// (after what time the ratings aren't taken into account when making teams) then
// the discard time is current_time - time_to_discard, teams that joined after that, will have their ratings taken into account
// else leave the discard time on 0, this way all ratings will be discarded
uint32 discardTime = getMSTime() - sBattlegroundMgr->GetRatingDiscardTimer();
// we need to find 2 teams which will play next game
GroupsQueueType::iterator itr_teams[BG_TEAMS_COUNT];
uint8 found = 0;
uint8 team = 0;
for (uint8 i = BG_QUEUE_PREMADE_ALLIANCE; i < BG_QUEUE_NORMAL_ALLIANCE; i++)
{
// take the group that joined first
GroupsQueueType::iterator itr2 = m_QueuedGroups[bracket_id][i].begin();
for (; itr2 != m_QueuedGroups[bracket_id][i].end(); ++itr2)
{
// if group match conditions, then add it to pool
if (!(*itr2)->isInvitedToBGInstanceGUID
&& (((*itr2)->teamMatchmakerRating >= arenaMinRating && (*itr2)->teamMatchmakerRating <= arenaMaxRating)
|| (*itr2)->joinTime < discardTime))
{
itr_teams[found++] = itr2;
team = i;
break;
}
}
}
if (!found)
return;
if (found == 1)
{
for (GroupsQueueType::iterator itr3 = itr_teams[0]; itr3 != m_QueuedGroups[bracket_id][team].end(); ++itr3)
{
if (!(*itr3)->isInvitedToBGInstanceGUID
&& (((*itr3)->teamMatchmakerRating >= arenaMinRating && (*itr3)->teamMatchmakerRating <= arenaMaxRating)
|| (*itr3)->joinTime < discardTime)
&& (*itr_teams[0])->leaderGUID != (*itr3)->leaderGUID)
{
itr_teams[found++] = itr3;
break;
}
}
}
//if we have 2 teams, then start new arena and invite players!
if (found == 2)
{
GroupQueueInfo* aTeam = *itr_teams[TEAM_ALLIANCE];
GroupQueueInfo* hTeam = *itr_teams[TEAM_HORDE];
Battleground* arena = sBattlegroundMgr->CreateNewBattleground(bgTypeId, bracketEntry, ratedType, true);
if (!arena)
{
TC_LOG_ERROR("bg.battleground", "BattlegroundQueue::Update couldn't create arena instance for rated arena match!");
return;
}
aTeam->opponentsTeamRating = hTeam->teamRating;
hTeam->opponentsTeamRating = aTeam->teamRating;
aTeam->opponentsTeamMatchmakerRating = hTeam->teamMatchmakerRating;
hTeam->opponentsTeamMatchmakerRating = aTeam->teamMatchmakerRating;
TC_LOG_DEBUG("bg.battleground", "setting oposite teamrating to %u", aTeam->opponentsTeamRating);
TC_LOG_DEBUG("bg.battleground", "setting oposite teamrating to %u", hTeam->opponentsTeamRating);
// now we must move team if we changed its faction to another faction queue, because then we will spam log by errors in Queue::RemovePlayer
if (aTeam->team != ALLIANCE)
{
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].push_front(aTeam);
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].erase(itr_teams[TEAM_ALLIANCE]);
}
if (hTeam->team != HORDE)
{
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].push_front(hTeam);
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].erase(itr_teams[TEAM_HORDE]);
}
arena->SetTeamMatchmakerRating(ALLIANCE, aTeam->teamMatchmakerRating);
arena->SetTeamMatchmakerRating( HORDE, hTeam->teamMatchmakerRating);
InviteGroupToBG(aTeam, arena, ALLIANCE);
InviteGroupToBG(hTeam, arena, HORDE);
TC_LOG_DEBUG("bg.battleground", "Starting rated arena match!");
arena->StartBattleground();
}
}
}