本文整理汇总了C++中Group::GetLeader方法的典型用法代码示例。如果您正苦于以下问题:C++ Group::GetLeader方法的具体用法?C++ Group::GetLeader怎么用?C++ Group::GetLeader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Group
的用法示例。
在下文中一共展示了Group::GetLeader方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleReadyCheckOpcode
void WorldSession::HandleReadyCheckOpcode(WorldPacket& recv_data)
{
Group * pGroup = _player->GetGroup();
if(!pGroup || !_player->IsInWorld())
return;
if(recv_data.size() == 0)
{
if(pGroup->GetLeader() == _player->m_playerInfo)
{
WorldPacket data(MSG_RAID_READY_CHECK, 8);
data << GetPlayer()->GetGUID();
/* send packet to group */
pGroup->SendPacketToAll(&data);
}
else
{
SendNotification(NOTIFICATION_MESSAGE_NO_PERMISSION);
}
}
else
{
uint8 ready;
recv_data >> ready;
WorldPacket data(MSG_RAID_READY_CHECK_CONFIRM, 9);
data << _player->GetGUID();
data << ready;
if(pGroup->GetLeader() && pGroup->GetLeader()->m_loggedInPlayer)
pGroup->GetLeader()->m_loggedInPlayer->GetSession()->SendPacket(&data);
}
}
示例2: HandleGroupAcceptOpcode
////////////////////////////////////////////////////////////////
///This function handles CMSG_GROUP_ACCEPT:
////////////////////////////////////////////////////////////////
void WorldSession::HandleGroupAcceptOpcode( WorldPacket & recv_data )
{
if(!_player->IsInWorld()) return;
Player *player = objmgr.GetPlayer(_player->GetInviter());
if ( !player )
return;
player->SetInviter(0);
_player->SetInviter(0);
Group *grp = player->GetGroup();
if(grp)
{
grp->AddMember(_player);
_player->iInstanceType = grp->GetLeader()->iInstanceType;
_player->GetSession()->OutPacket(CMSG_DUNGEON_DIFFICULTY, 4, &grp->GetLeader()->iInstanceType);
sInstanceSavingManager.ResetSavedInstancesForPlayer(_player);
return;
}
// If we're this far, it means we have no existing group, and have to make one.
grp = new Group;
grp->AddMember(player); // add the inviter first, therefore he is the leader
grp->AddMember(_player); // add us.
_player->iInstanceType = player->iInstanceType;
_player->GetSession()->OutPacket(CMSG_DUNGEON_DIFFICULTY, 4, &player->iInstanceType);
sInstanceSavingManager.ResetSavedInstancesForPlayer(_player);
// Currentgroup and all that shit are set by addmember.
}
示例3: TEST
TEST(NeffKeyShuffle, Disconnect)
{
SessionCreator callback = SessionCreator(TCreateRound<NeffKeyShuffle>);
Group::SubgroupPolicy sg_policy = Group::ManagedSubgroup;
ConnectionManager::UseTimer = false;
SessionLeader::EnableLogOffMonitor = false;
Timer::GetInstance().UseVirtualTime();
int count = Random::GetInstance().GetInt(TEST_RANGE_MIN, TEST_RANGE_MAX);
QVector<TestNode *> nodes;
Group group;
ConstructOverlay(count, nodes, group, sg_policy);
CreateSessions(nodes, group, Id(), callback);
group = BuildGroup(nodes, group);
int leader = group.GetIndex(group.GetLeader());
int disconnector = Random::GetInstance().GetInt(0, count);
if(sg_policy == Group::ManagedSubgroup) {
while(leader == disconnector ||
nodes[disconnector]->ident.GetSuperPeer())
{
disconnector = Random::GetInstance().GetInt(0, count);
}
} else {
while(leader == disconnector) {
disconnector = Random::GetInstance().GetInt(0, count);
}
}
qDebug() << "Node count" << nodes.size();
qDebug() << "Leader" << group.GetLeader();
qDebug() << "Disconnector" << nodes[disconnector]->ident.GetLocalId();
SignalCounter sc, src;
RoundCollector rc;
foreach(TestNode *node, nodes) {
QObject::connect(node->session.data(),
SIGNAL(RoundStarting(const QSharedPointer<Round> &)),
&sc, SLOT(Counter()));
QObject::connect(node->session.data(),
SIGNAL(RoundFinished(const QSharedPointer<Round> &)),
&src, SLOT(Counter()));
QObject::connect(node->session.data(),
SIGNAL(RoundFinished(const QSharedPointer<Round> &)),
&rc, SLOT(RoundFinished(const QSharedPointer<Round> &)));
node->session->Start();
}
示例4: HandleLfgLeaveOpcode
void WorldSession::HandleLfgLeaveOpcode(WorldPacket& recv_data)
{
Log.Debug("LfgHandler", "CMSG_LFG_LEAVE");
Group* grp = GetPlayer()->GetGroup();
Log.Debug("LfgHandler", "CMSG_LFG_LEAVE %u in group: %u", GetPlayer()->GetGUID(), grp ? 1 : 0);
// Check cheating - only leader can leave the queue
if (!grp || grp->GetLeader()->guid == GetPlayer()->GetGUID())
sLfgMgr.Leave(GetPlayer(), grp);
}
示例5: HandleConvertGroupToRaidOpcode
void WorldSession::HandleConvertGroupToRaidOpcode(WorldPacket & recv_data)
{
if(!_player->IsInWorld()) return;
// This is just soooo easy now
Group *pGroup = _player->GetGroup();
if(!pGroup) return;
if ( pGroup->GetLeader() != _player->m_playerInfo ) //access denied
{
SendPartyCommandResult(_player, 0, "", ERR_PARTY_YOU_ARE_NOT_LEADER);
return;
}
pGroup->ExpandToRaid();
SendPartyCommandResult(_player, 0, "", ERR_PARTY_NO_ERROR);
}
示例6: PreTeleport
//.........这里部分代码省略.........
}
else
{
m_mapLock.Release();
return INSTANCE_ABORT_NOT_FOUND;
}
}
else // this is the case when we enter the normal way (e.g. we enter thru the portal )
{
in = NULL;
if(pGroup != NULL) // we are in a group
{
uint32 grpdiff;
// We want to use the raid difficulty for raids, and dungeon difficulty for dungeons
if(inf->type == INSTANCE_RAID)
grpdiff = pGroup->m_raiddifficulty;
else
grpdiff = pGroup->m_difficulty;
if((inf->type == INSTANCE_MULTIMODE && grpdiff == MODE_HEROIC) || inf->type == INSTANCE_RAID)
{
// This is the case when we don't have this map on this difficulty saved yet for the player entering
if(plr->GetPersistentInstanceId(mapid, grpdiff) == 0)
{
// The group has this instance saved already so we will use it
if(pGroup->m_instanceIds[mapid][ grpdiff ] != 0)
{
in = sInstanceMgr.GetInstanceByIds(mapid, pGroup->m_instanceIds[mapid][ grpdiff ]);
}
else if(sWorld.instance_TakeGroupLeaderID)
{
PlayerInfo* pLeaderInfo = pGroup->GetLeader();
if(pLeaderInfo)
{
pLeaderInfo->savedInstanceIdsLock.Acquire();
PlayerInstanceMap::iterator itrLeader = pLeaderInfo->savedInstanceIds[ grpdiff ].find(mapid);
if(itrLeader != pLeaderInfo->savedInstanceIds[ grpdiff ].end())
{
in = sInstanceMgr.GetInstanceByIds(mapid, (*itrLeader).second);
}
pLeaderInfo->savedInstanceIdsLock.Release();
}
}
}
// If we have it saved to the player then use that
if(in == NULL && plr->GetPersistentInstanceId(mapid, grpdiff) != 0)
{
in = sInstanceMgr.GetInstanceByIds(mapid, plr->GetPersistentInstanceId(mapid, grpdiff));
}
}
else
{
if(pGroup->m_instanceIds[mapid][ grpdiff ] != 0)
{
in = sInstanceMgr.GetInstanceByIds(mapid, pGroup->m_instanceIds[mapid][ grpdiff ]);
}
}
}
if(in == NULL)
{
// We are not in a group, so we will look for an instance that we own and has the right difficulty
示例7: HandleArenaJoin
void CBattlegroundManager::HandleArenaJoin(WorldSession * m_session, uint32 BattlegroundType, uint8 as_group, uint8 rated_match)
{
uint32 pguid = m_session->GetPlayer()->GetLowGUID();
uint32 lgroup = GetLevelGrouping(m_session->GetPlayer()->getLevel());
if(as_group && m_session->GetPlayer()->GetGroup() == NULL)
return;
Group * pGroup = m_session->GetPlayer()->GetGroup();
if(as_group)
{
if(pGroup->GetSubGroupCount() != 1)
{
m_session->SystemMessage("Sorry, raid groups joining battlegrounds are currently unsupported.");
return;
}
if(pGroup->GetLeader() != m_session->GetPlayer()->m_playerInfo)
{
m_session->SystemMessage("You must be the party leader to add a group to an arena.");
return;
}
GroupMembersSet::iterator itx;
if(!rated_match)
{
/* add all players normally.. bleh ;P */
pGroup->Lock();
for(itx = pGroup->GetSubGroup(0)->GetGroupMembersBegin(); itx != pGroup->GetSubGroup(0)->GetGroupMembersEnd(); ++itx)
{
if((*itx)->m_loggedInPlayer && !(*itx)->m_loggedInPlayer->m_bgIsQueued && !(*itx)->m_loggedInPlayer->m_bg)
HandleArenaJoin((*itx)->m_loggedInPlayer->GetSession(), BattlegroundType, 0, 0);
}
pGroup->Unlock();
return;
}
else
{
/* make sure all players are 70 */
uint32 maxplayers;
uint32 arenateamtype;
switch(BattlegroundType)
{
case BATTLEGROUND_ARENA_2V2:
arenateamtype=0;
maxplayers=2;
break;
case BATTLEGROUND_ARENA_3V3:
arenateamtype=1;
maxplayers=3;
break;
case BATTLEGROUND_ARENA_5V5:
arenateamtype=2;
maxplayers=5;
break;
default:
arenateamtype=0;
maxplayers=2;
break;
}
uint32 team_id = 0;
pGroup->Lock();
for(itx = pGroup->GetSubGroup(0)->GetGroupMembersBegin(); itx != pGroup->GetSubGroup(0)->GetGroupMembersEnd(); ++itx)
{
if( maxplayers == 0 )
{
m_session->SystemMessage("You have too many players in your party to join this type of arena.");
pGroup->Unlock();
return;
}
if((*itx)->lastLevel < 70)
{
m_session->SystemMessage("Sorry, some of your party members are not level 70.");
pGroup->Unlock();
return;
}
if((*itx)->m_loggedInPlayer)
{
ArenaTeam * t = (*itx)->m_loggedInPlayer->m_arenaTeams[arenateamtype];
if( t != NULL )
{
if ( team_id == 0 )
team_id = t->m_id;
if ( team_id != t->m_id )
{
m_session->SystemMessage("Sorry, not all your party members are in same arena team.");
pGroup->Unlock();
return;
}
}
else
{
m_session->SystemMessage("Sorry, not all your party members are in same arena team.");
pGroup->Unlock();
//.........这里部分代码省略.........
示例8: EventQueueUpdate
//.........这里部分代码省略.........
{
// push as many as possible in
for(k = 0; k < 2; ++k)
{
while(tempPlayerVec[k].size() && bg->HasFreeSlots(k))
{
plr = *tempPlayerVec[k].begin();
tempPlayerVec[k].pop_front();
plr->m_bgTeam=k;
bg->AddPlayer(plr, k);
ErasePlayerFromList(plr->GetLowGUID(), &m_queuedPlayers[i][j]);
}
}
}
}
}
}
}
}
/* Handle paired arena team joining */
list<uint32>::iterator itz;
list<uint32>::iterator itp;
for(i = BATTLEGROUND_ARENA_2V2; i < BATTLEGROUND_ARENA_5V5+1; ++i)
{
// We need at least this many :(
if(m_queuedGroups[i].size() < 2)
continue;
list<uint32> removegroups;
for(itz = m_queuedGroups[i].begin(); itz != m_queuedGroups[i].end(); itz++)
{
Group * pGroup = objmgr.GetGroupById(*itz);
if(!pGroup || !pGroup->m_isqueued || !pGroup->GetLeader() || pGroup->GetLeader()->arenaTeam[i - 4] == NULL) continue;
uint32 maxRange = pGroup->GetLeader()->arenaTeam[i - 4]->m_queueSearchRange;
pGroup->GetLeader()->arenaTeam[i - 4]->m_queueSearchRange += 100;
vector<uint32> inRangeGroups;
uint32 rating = pGroup->GetLeader()->arenaTeam[i - 4]->m_stat_rating;
for(itp = m_queuedGroups[i].begin(); itp != m_queuedGroups[i].end();)
{
Group * tGrp = objmgr.GetGroupById(*itp);
if(!tGrp || !tGrp->m_isqueued || !tGrp->GetLeader() || tGrp->GetLeader()->arenaTeam[i - 4] == NULL)
{
itp = m_queuedGroups[i].erase(itp);
continue;
}
++itp;
if( pGroup == tGrp )
continue;
uint32 tRating = tGrp->GetLeader()->arenaTeam[i - 4]->m_stat_rating;
int32 diff = (int32)tRating - (int32)rating;
if(diff < 0)
diff = -diff;
if(diff > (int32)maxRange)
continue;
//Log.Notice("Debug", "EventQueueUpdate added 1 in range arena");
示例9: CheckInstanceForObject
bool WorldCreator::CheckInstanceForObject(Object *obj, MapInfo *pMapinfo)
{
WorldPacket data(4);
Player *_player = NULL;
if(obj->GetTypeId() == TYPEID_PLAYER)
{
_player = static_cast<Player*>(obj);
}
if(pMapinfo && _player)
{
switch(pMapinfo->type)
{
case INSTANCE_NONRAID:
case INSTANCE_RAID:
case INSTANCE_MULTIMODE:
{
//instance creation detection types
//case 1, player is inside a group aka not soloing
//onoes: leader can be inside a instance already and make a group or its a fresh group, noone inside
if(_player->InGroup()) //group created, join leader instance.
{
Group *pGroup = _player->GetGroup();
if(pGroup)
{
//check if instance already exists(player solo created instance and made group after)
MapMgr *pInstance = sWorldCreator.GetInstanceByGroup(pGroup, _player, pMapinfo);
if(pInstance)
{
//INSTANCE_OK
if(pInstance->IsCombatInProgress())
{
WorldPacket msg;
msg.Initialize(SMSG_AREA_TRIGGER_MESSAGE);
msg << uint32(0) << "Encounter in progress." << uint8(0) << uint8(0);
_player->GetSession()->SendPacket(&msg);
return false;
}
if(pInstance->GetPlayerCount() >= pMapinfo->playerlimit)
{
data.Initialize(SMSG_TRANSFER_ABORTED);
data << uint32(INSTANCE_ABORT_FULL);
_player->GetSession()->SendPacket(&data);
return false;
}
_player->SetInstanceID(pInstance->GetInstanceID());
}
else
{
//group leader didnt made any instance yet, create instance for this group.
uint32 id = sWorldCreator.CreateInstance(pGroup, pGroup->GetLeader(), pMapinfo->mapid);
// again, NULL might not be 0
//if(id != NULL)
if(id != 0)
{
//INSTANCE CREATED
_player->SetInstanceID(id);
}
else
{
data.Initialize(SMSG_TRANSFER_ABORTED);
data << uint32(INSTANCE_ABORT_ERROR);
_player->GetSession()->SendPacket(&data);
return false;
}
}
}
else
{
data.Initialize(SMSG_TRANSFER_ABORTED);
data << uint32(INSTANCE_ABORT_ERROR);
_player->GetSession()->SendPacket(&data);
return false;
}
}
else
{
MapMgr *pInstance = sWorldCreator.GetInstanceByCreator(_player, pMapinfo);
if(pInstance)
{
//INSTANCE_OK
if(pInstance->IsCombatInProgress())
{
WorldPacket msg;
msg.Initialize(SMSG_AREA_TRIGGER_MESSAGE);
msg << uint32(0) << "Encounter in progress." << uint8(0) << uint8(0);
_player->GetSession()->SendPacket(&msg);
return false;
}
if(pInstance->GetPlayerCount() >= pMapinfo->playerlimit)
{
data.Initialize(SMSG_TRANSFER_ABORTED);
data << uint32(INSTANCE_ABORT_FULL);
_player->GetSession()->SendPacket(&data);
return false;
}
_player->SetInstanceID(pInstance->GetInstanceID());
}
//.........这里部分代码省略.........
示例10: HandleArenaJoin
void CBattlegroundManager::HandleArenaJoin(WorldSession* m_session, uint32 BattlegroundType, uint8 as_group, uint8 rated_match)
{
uint32 pguid = m_session->GetPlayer()->GetLowGUID();
uint32 lgroup = GetLevelGrouping(m_session->GetPlayer()->getLevel());
if (as_group && m_session->GetPlayer()->GetGroup() == NULL)
return;
Group* pGroup = m_session->GetPlayer()->GetGroup();
if (as_group)
{
if (pGroup->GetSubGroupCount() != 1)
{
m_session->SystemMessage(m_session->LocalizedWorldSrv(55));
return;
}
if (pGroup->GetLeader() != m_session->GetPlayer()->getPlayerInfo())
{
m_session->SystemMessage(m_session->LocalizedWorldSrv(56));
return;
}
GroupMembersSet::iterator itx;
if (!rated_match)
{
/* add all players normally.. bleh ;P */
pGroup->Lock();
for (itx = pGroup->GetSubGroup(0)->GetGroupMembersBegin(); itx != pGroup->GetSubGroup(0)->GetGroupMembersEnd(); ++itx)
{
if ((*itx)->m_loggedInPlayer && !(*itx)->m_loggedInPlayer->m_bgIsQueued && !(*itx)->m_loggedInPlayer->m_bg)
HandleArenaJoin((*itx)->m_loggedInPlayer->GetSession(), BattlegroundType, 0, 0);
}
pGroup->Unlock();
return;
}
else
{
/* make sure all players are 70 */
uint32 maxplayers;
uint32 type = BattlegroundType - BATTLEGROUND_ARENA_2V2;
switch (BattlegroundType)
{
case BATTLEGROUND_ARENA_3V3:
maxplayers = 3;
break;
case BATTLEGROUND_ARENA_5V5:
maxplayers = 5;
break;
case BATTLEGROUND_ARENA_2V2:
default:
maxplayers = 2;
break;
}
if (pGroup->GetLeader()->m_loggedInPlayer && pGroup->GetLeader()->m_loggedInPlayer->m_arenaTeams[type] == NULL)
{
m_session->SendNotInArenaTeamPacket(uint8(maxplayers));
return;
}
pGroup->Lock();
for (itx = pGroup->GetSubGroup(0)->GetGroupMembersBegin(); itx != pGroup->GetSubGroup(0)->GetGroupMembersEnd(); ++itx)
{
if (maxplayers == 0)
{
m_session->SystemMessage(m_session->LocalizedWorldSrv(58));
pGroup->Unlock();
return;
}
if ((*itx)->lastLevel < PLAYER_ARENA_MIN_LEVEL)
{
m_session->SystemMessage(m_session->LocalizedWorldSrv(59));
pGroup->Unlock();
return;
}
if ((*itx)->m_loggedInPlayer)
{
if ((*itx)->m_loggedInPlayer->m_bg || (*itx)->m_loggedInPlayer->m_bgIsQueued)
{
m_session->SystemMessage(m_session->LocalizedWorldSrv(60));
pGroup->Unlock();
return;
};
if ((*itx)->m_loggedInPlayer->m_arenaTeams[type] != pGroup->GetLeader()->m_loggedInPlayer->m_arenaTeams[type])
{
m_session->SystemMessage(m_session->LocalizedWorldSrv(61));
pGroup->Unlock();
return;
}
--maxplayers;
}
}
WorldPacket data(SMSG_GROUP_JOINED_BATTLEGROUND, 4);
data << uint32(6); // all arenas
for (itx = pGroup->GetSubGroup(0)->GetGroupMembersBegin(); itx != pGroup->GetSubGroup(0)->GetGroupMembersEnd(); ++itx)
//.........这里部分代码省略.........
示例11: PreTeleport
//.........这里部分代码省略.........
}
// Try to add instance ID to player
plr->SetPersistentInstanceId(in);
// Set current group
if (pGroup)
in->m_creatorGroup = pGroup->GetID();
m_mapLock.Release();
return INSTANCE_OK;
}
else
{
m_mapLock.Release();
return INSTANCE_ABORT_NOT_FOUND;
}
}
else
{
in = NULL;
if (pGroup != NULL)
{
if ((inf->type == INSTANCE_MULTIMODE && pGroup->m_difficulty >= MODE_HEROIC) || inf->type == INSTANCE_RAID)
{
if (plr->GetPersistentInstanceId(mapid, pGroup->m_difficulty) == 0)
{
if (pGroup->m_instanceIds[mapid][pGroup->m_difficulty] != 0)
{
in = sInstanceMgr.GetInstanceByIds(mapid, pGroup->m_instanceIds[mapid][pGroup->m_difficulty]);
}
else if (sWorld.instance_TakeGroupLeaderID)
{
PlayerInfo *pLeaderInfo = pGroup->GetLeader();
if (pLeaderInfo)
{
pLeaderInfo->savedInstanceIdsLock.Acquire();
PlayerInstanceMap::iterator itrLeader = pLeaderInfo->savedInstanceIds[pGroup->m_difficulty].find(mapid);
if (itrLeader != pLeaderInfo->savedInstanceIds[pGroup->m_difficulty].end())
{
in = sInstanceMgr.GetInstanceByIds(mapid, (*itrLeader).second);
}
pLeaderInfo->savedInstanceIdsLock.Release();
}
}
}
if (in == NULL && plr->GetPersistentInstanceId(mapid, pGroup->m_difficulty) != 0)
{
in = sInstanceMgr.GetInstanceByIds(mapid, plr->GetPersistentInstanceId(mapid, pGroup->m_difficulty));
}
}
else
{
if (pGroup->m_instanceIds[mapid][pGroup->m_difficulty] != 0)
{
in = sInstanceMgr.GetInstanceByIds(mapid, pGroup->m_instanceIds[mapid][pGroup->m_difficulty]);
}
}
}
if (in == NULL)
{
// search the instance and see if we have one here.
for (itr = instancemap->begin(); itr != instancemap->end();)
{