本文整理汇总了C++中Battleground::Set1vs1方法的典型用法代码示例。如果您正苦于以下问题:C++ Battleground::Set1vs1方法的具体用法?C++ Battleground::Set1vs1怎么用?C++ Battleground::Set1vs1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Battleground
的用法示例。
在下文中一共展示了Battleground::Set1vs1方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InviteGroupsToArena
bool ChallengeMgr::InviteGroupsToArena(Player *leader1, Player *leader2, ArenaChallengeType type)
{
uint8 arenatype = (type == ARENA_CHALLENGE_TYPE_1v1) ? ARENA_CHALLENGE_TYPE_2v2 : type;
uint32 matchmakerRating = 0;
//check existance
Battleground* bg = sBattlegroundMgr->GetBattlegroundTemplate(BATTLEGROUND_AA);
if (!bg)
{
sLog->outError("Battleground: template bg (all arenas) not found");
return false;
}
BattlegroundTypeId bgTypeId = bg->GetTypeID();
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bgTypeId, arenatype);
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), 80);
if (!bracketEntry)
return false;
GroupQueueInfo *group1, *group2;
if (type == ARENA_CHALLENGE_TYPE_1v1)
{
group1 = CreateGroupQueueInfo(leader1, bgTypeId, arenatype);
group2 = CreateGroupQueueInfo(leader2, bgTypeId, arenatype);
}
else
{
group1 = CreateGroupQueueInfo(leader1->GetGroup(), bgTypeId, arenatype);
group2 = CreateGroupQueueInfo(leader2->GetGroup(), bgTypeId, arenatype);
}
if (!group1 || !group2)
return false;
for (std::map<uint64, PlayerQueueInfo*>::iterator itr = group1->Players.begin(); itr != group1->Players.end(); ++itr)
{
Player *player = ObjectAccessor::FindPlayer(itr->first);
if (!player)
return false;
if (!CanInvitePlayer(player, bgQueueTypeId))
return false;
}
for (std::map<uint64, PlayerQueueInfo*>::iterator itr = group2->Players.begin(); itr != group2->Players.end(); ++itr)
{
Player *player = ObjectAccessor::FindPlayer(itr->first);
if (!player)
return false;
if (!CanInvitePlayer(player, bgQueueTypeId))
return false;
}
sBattlegroundMgr->ScheduleQueueUpdate(matchmakerRating, arenatype, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
Battleground *arena = sBattlegroundMgr->CreateNewBattleground(bgTypeId, bracketEntry, arenatype, true);
arena->SetRated(false);
if (type == ARENA_CHALLENGE_TYPE_1v1)
arena->Set1vs1(true);
for (std::map<uint64, PlayerQueueInfo*>::iterator itr = group1->Players.begin(); itr != group1->Players.end(); ++itr)
{
Player *player = ObjectAccessor::FindPlayer(itr->first);
if (!player)
return false;
uint32 queueSlot = player->AddBattlegroundQueueId(bgQueueTypeId);
WorldPacket data;
// send status packet (in queue)
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, 0, 0, arenatype);
player->GetSession()->SendPacket(&data);
player->challengeData->bg = arena;
player->challengeData->ginfo = CreateGroupQueueInfo(player, bgTypeId, arenatype);
player->challengeData->ginfo->IsInvitedToBGInstanceGUID = arena->GetInstanceID();
player->challengeData->ginfo->Team = ALLIANCE;
}
for (std::map<uint64, PlayerQueueInfo*>::iterator itr = group2->Players.begin(); itr != group2->Players.end(); ++itr)
{
Player *player = ObjectAccessor::FindPlayer(itr->first);
if (!player)
return false;
uint32 queueSlot = player->AddBattlegroundQueueId(bgQueueTypeId);
WorldPacket data;
// send status packet (in queue)
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, 0, 0, arenatype);
player->GetSession()->SendPacket(&data);
player->challengeData->bg = arena;
player->challengeData->ginfo = CreateGroupQueueInfo(player, bgTypeId, arenatype);
player->challengeData->ginfo->IsInvitedToBGInstanceGUID = arena->GetInstanceID();
player->challengeData->ginfo->Team = HORDE;
}
//.........这里部分代码省略.........