本文整理汇总了C++中Battleground::GetPlayersSize方法的典型用法代码示例。如果您正苦于以下问题:C++ Battleground::GetPlayersSize方法的具体用法?C++ Battleground::GetPlayersSize怎么用?C++ Battleground::GetPlayersSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Battleground
的用法示例。
在下文中一共展示了Battleground::GetPlayersSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShowPage
void ShowPage(Player* player, uint16 page, uint32 IsTop)
{
uint32 firstTeamId = 0;
uint16 TypeOne = 0;
uint16 TypeTwo = 0;
uint16 TypeThree = 0;
uint16 mmr = 0;
uint16 mmrTwo = 0;
bool haveNextPage = false;
for (uint8 i = 0; i <= MAX_BATTLEGROUND_TYPE_ID; ++i)
{
if (!sBattlegroundMgr->IsArenaType(BattlegroundTypeId(i)))
continue;
//BattlegroundContainer arenas = sBattlegroundMgr->GetBattlegroundsByType((BattlegroundTypeId)i);
BattlegroundData* arenas = sBattlegroundMgr->GetAllBattlegroundsWithTypeId(BattlegroundTypeId(i));
if (!arenas || arenas->m_Battlegrounds.empty())
continue;
for (BattlegroundContainer::const_iterator itr = arenas->m_Battlegrounds.begin(); itr != arenas->m_Battlegrounds.end(); ++itr)
{
Battleground* arena = itr->second;
Player* target = ObjectAccessor::FindPlayer(GetFirstPlayerGuid(arena));
if (target && (target->HasAura(32728) || target->HasAura(32727)))
continue;
if (!arena->GetPlayersSize())
continue;
if (arena->GetArenaType() == ARENA_TYPE_2v2)
{
mmr = arena->GetArenaMatchmakerRating(0);
firstTeamId = target->GetArenaTeamId(0);
Battleground::BattlegroundPlayerMap::const_iterator citr = arena->GetPlayers().begin();
for (; citr != arena->GetPlayers().end(); ++citr)
if (Player* plrs = sObjectAccessor->FindPlayer(citr->first))
if (plrs->GetArenaTeamId(0) != firstTeamId)
mmrTwo = arena->GetArenaMatchmakerRating(citr->second.Team);
}
else if (arena->GetArenaType() == ARENA_TYPE_3v3)
{
mmr = arena->GetArenaMatchmakerRating(1);
firstTeamId = target->GetArenaTeamId(1);
Battleground::BattlegroundPlayerMap::const_iterator citr = arena->GetPlayers().begin();
for (; citr != arena->GetPlayers().end(); ++citr)
if (Player* plrs = sObjectAccessor->FindPlayer(citr->first))
if (plrs->GetArenaTeamId(1) != firstTeamId)
mmrTwo = arena->GetArenaMatchmakerRating(citr->second.Team);
}
else if (arena->GetArenaType() == ARENA_TYPE_5v5 && arena->GetArenaType() == ARENA_TYPE_3v3_SOLO)
{
mmr = arena->GetArenaMatchmakerRating(2);
firstTeamId = target->GetArenaTeamId(2);
Battleground::BattlegroundPlayerMap::const_iterator citr = arena->GetPlayers().begin();
for (; citr != arena->GetPlayers().end(); ++citr)
if (Player* plrs = sObjectAccessor->FindPlayer(citr->first))
if (plrs->GetArenaTeamId(2) != firstTeamId)
mmrTwo = arena->GetArenaMatchmakerRating(citr->second.Team);
}
if (IsTop == 1 && arena->GetArenaType() == ARENA_TYPE_2v2)
{
TypeOne++;
if (TypeOne > (page + 1) * GamesOnPage)
{
haveNextPage = true;
break;
}
if (TypeOne >= page * GamesOnPage)
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, GetGamesStringData(arena, mmr, mmrTwo), GOSSIP_SENDER_MAIN, NPC_SPECTATOR_ACTION_SELECTED_PLAYER + GetFirstPlayerGuid(arena));
}
else if (IsTop == 2 && arena->GetArenaType() == ARENA_TYPE_3v3)
{
TypeTwo++;
if (TypeTwo > (page + 1) * GamesOnPage)
{
haveNextPage = true;
break;
}
if (TypeTwo >= page * GamesOnPage)
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, GetGamesStringData(arena, mmr, mmrTwo), GOSSIP_SENDER_MAIN, NPC_SPECTATOR_ACTION_SELECTED_PLAYER + GetFirstPlayerGuid(arena));
}
else if (IsTop == 3 && arena->GetArenaType() == ARENA_TYPE_5v5 && arena->GetArenaType() == ARENA_TYPE_3v3_SOLO)
{
TypeThree++;
if (TypeThree > (page + 1) * GamesOnPage)
{
haveNextPage = true;
break;
}
if (TypeThree >= page * GamesOnPage)
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, GetGamesStringData(arena, mmr, mmrTwo), GOSSIP_SENDER_MAIN, NPC_SPECTATOR_ACTION_SELECTED_PLAYER + GetFirstPlayerGuid(arena));
}
}
}
//.........这里部分代码省略.........