本文整理汇总了C++中Group::AddMember方法的典型用法代码示例。如果您正苦于以下问题:C++ Group::AddMember方法的具体用法?C++ Group::AddMember怎么用?C++ Group::AddMember使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Group
的用法示例。
在下文中一共展示了Group::AddMember方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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.
}
示例2: HandleGroupAcceptOpcode
void WorldSession::HandleGroupAcceptOpcode( WorldPacket & /*recv_data*/ )
{
Group *group = GetPlayer()->GetGroupInvite();
if (!group) return;
// remove in from ivites in any case
group->RemoveInvite(GetPlayer());
/** error handling **/
/********************/
// not have place
if(group->IsFull())
{
SendPartyResult(PARTY_OP_INVITE, "", PARTY_RESULT_PARTY_FULL);
return;
}
// everything's fine, do it
if(!group->AddMember(GetPlayer()->GetGUID(), GetPlayer()->GetName()))
return;
uint8 subgroup = group->GetMemberGroup(GetPlayer()->GetGUID());
GetPlayer()->SetGroup(group, subgroup);
}
示例3: AddOrSetPlayerToCorrectBfGroup
bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player* player)
{
if (!player->IsInWorld())
return false;
if (Group* group = player->GetGroup())
group->RemoveMember(player->GetGUID());
Group* group = GetFreeBfRaid(player->GetTeamId());
if (!group)
{
group = new Group;
group->SetBattlefieldGroup(this);
group->Create(player);
sGroupMgr->AddGroup(group);
m_Groups[player->GetTeamId()].insert(group->GetGUID());
}
else if (group->IsMember(player->GetGUID()))
{
uint8 subgroup = group->GetMemberGroup(player->GetGUID());
player->SetBattlegroundOrBattlefieldRaid(group, subgroup);
}
else
group->AddMember(player);
return true;
}
示例4: AddOrSetPlayerToCorrectBfGroup
bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player* player)
{
if (!player->IsInWorld())
return false;
if (player->GetGroup() && (player->GetGroup()->isBGGroup() || player->GetGroup()->isBFGroup()))
{
sLog->outMisc("Battlefield::AddOrSetPlayerToCorrectBfGroup - player is already in %s group!", (player->GetGroup()->isBGGroup() ? "BG" : "BF"));
return false;
}
Group* group = GetFreeBfRaid(player->GetTeamId());
if (!group)
{
group = new Group;
group->SetBattlefieldGroup(this);
group->Create(player);
sGroupMgr->AddGroup(group);
m_Groups[player->GetTeamId()].insert(group->GetGUID());
}
else if (group->IsMember(player->GetGUID()))
{
uint8 subgroup = group->GetMemberGroup(player->GetGUID());
player->SetBattlegroundOrBattlefieldRaid(group, subgroup);
}
else
group->AddMember(player);
return true;
}
示例5: HandleGroupAcceptOpcode
////////////////////////////////////////////////////////////////
///This function handles CMSG_GROUP_ACCEPT:
////////////////////////////////////////////////////////////////
void WorldSession::HandleGroupAcceptOpcode(WorldPacket & recv_data)
{
CHECK_INWORLD_RETURN;
// we are in group already
if(_player->GetGroup() != NULL)
return;
Player* player = objmgr.GetPlayer(_player->GetInviter());
if(!player)
return;
player->SetInviter(0);
_player->SetInviter(0);
Group* grp = player->GetGroup();
if(grp != NULL)
{
grp->AddMember(_player->m_playerInfo);
_player->iInstanceType = grp->m_difficulty;
_player->SendDungeonDifficulty();
//sInstanceSavingManager.ResetSavedInstancesForPlayer(_player);
return;
}
// If we're this far, it means we have no existing group, and have to make one.
grp = new Group(true);
grp->m_difficulty = static_cast<uint8>(player->iInstanceType);
grp->AddMember(player->m_playerInfo); // add the inviter first, therefore he is the leader
grp->AddMember(_player->m_playerInfo); // add us.
_player->iInstanceType = grp->m_difficulty;
_player->SendDungeonDifficulty();
Instance* instance = sInstanceMgr.GetInstanceByIds(player->GetMapId(), player->GetInstanceID());
if(instance != NULL && instance->m_creatorGuid == player->GetLowGUID())
{
grp->m_instanceIds[instance->m_mapId][instance->m_difficulty] = instance->m_instanceId;
instance->m_creatorGroup = grp->GetID();
instance->m_creatorGuid = 0;
instance->SaveToDB();
}
//sInstanceSavingManager.ResetSavedInstancesForPlayer(_player);
// Currentgroup and all that shit are set by addmember.
}
示例6: HandleGroupAcceptOpcode
void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recvData)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_ACCEPT");
#endif
recvData.read_skip<uint32>();
Group* group = GetPlayer()->GetGroupInvite();
if (!group)
return;
// Remove player from invitees in any case
group->RemoveInvite(GetPlayer());
if (GetPlayer()->IsSpectator())
{
SendPartyResult(PARTY_OP_INVITE, "", ERR_INVITE_RESTRICTED);
return;
}
if (group->GetLeaderGUID() == GetPlayer()->GetGUID())
{
sLog->outError("HandleGroupAcceptOpcode: player %s(%d) tried to accept an invite to his own group", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow());
return;
}
// Group is full
if (group->IsFull())
{
SendPartyResult(PARTY_OP_INVITE, "", ERR_GROUP_FULL);
return;
}
Player* leader = ObjectAccessor::FindPlayerInOrOutOfWorld(group->GetLeaderGUID());
// Forming a new group, create it
if (!group->IsCreated())
{
// This can happen if the leader is zoning. To be removed once delayed actions for zoning are implemented
if (!leader || leader->IsSpectator())
{
group->RemoveAllInvites();
return;
}
// If we're about to create a group there really should be a leader present
ASSERT(leader);
group->RemoveInvite(leader);
group->Create(leader);
sGroupMgr->AddGroup(group);
}
// Everything is fine, do it, PLAYER'S GROUP IS SET IN ADDMEMBER!!!
if (!group->AddMember(GetPlayer()))
return;
group->BroadcastGroupUpdate();
}
示例7: HandleGroupAcceptOpcode
////////////////////////////////////////////////////////////////
///This function handles CMSG_GROUP_ACCEPT:
////////////////////////////////////////////////////////////////
void WorldSession::HandleGroupAcceptOpcode( WorldPacket & recv_data )
{
WorldPacket data;
Player * player;
player = objmgr.GetObject<Player>( GetPlayer()->GetGroupLeader() );
if ( !player )
return;
if ( !GetPlayer()->IsInvited() )
return;
GetPlayer()->UnSetInvited();
if ( player->IsInGroup() && (player->GetGroupLeader() == player->GetGUID()) )
{
GetPlayer()->SetInGroup();
Group *group = objmgr.GetGroupByLeader( GetPlayer()->GetGroupLeader() );
ASSERT(group);
group->AddMember( GetPlayer()->GetGUID(), GetPlayer()->GetName() );
group->SendUpdate();
return;
}
else if ( !player->IsInGroup() )
{
player->SetInGroup();
player->SetLeader( player->GetGUID() );
GetPlayer()->SetInGroup();
GetPlayer()->SetLeader( player->GetGUID() );
// creating group
Group * group = new Group;
ASSERT(group);
group->Create(player->GetGUID(), player->GetName());
// adding our client
group->AddMember(GetPlayer()->GetGUID(), GetPlayer()->GetName());
objmgr.AddGroup(group);
group->SendUpdate();
}
}
示例8: HandleLfgInviteAccept
void WorldSession::HandleLfgInviteAccept(WorldPacket & recvPacket)
{
CHECK_INWORLD_RETURN;
_player->PartLFGChannel();
if(_player->m_lfgMatch == NULL && _player->m_lfgInviterGuid == 0)
{
if(_player->m_lfgMatch == NULL)
OutPacket(SMSG_LFG_AUTOJOIN_FAILED_NO_PLAYER); // Matched Player(s) have gone offline.
else
OutPacket(SMSG_LFG_AUTOJOIN_FAILED); // Group no longer available.
return;
}
if( _player->m_lfgMatch != NULL )
{
// move into accepted players
_player->m_lfgMatch->lock.Acquire();
_player->m_lfgMatch->PendingPlayers.erase(_player);
if( !_player->GetGroup() )
{
_player->m_lfgMatch->AcceptedPlayers.insert(_player);
if(!_player->m_lfgMatch->PendingPlayers.size())
{
// all players have accepted
Group * pGroup = new Group(true);
for(set<Player*>::iterator itr = _player->m_lfgMatch->AcceptedPlayers.begin(); itr != _player->m_lfgMatch->AcceptedPlayers.end(); ++itr)
pGroup->AddMember((*itr)->m_playerInfo);
_player->m_lfgMatch->pGroup = pGroup;
}
}
_player->m_lfgMatch->lock.Release();
}
else
{
Player * pPlayer = objmgr.GetPlayer(_player->m_lfgInviterGuid);
if( pPlayer == NULL )
{
OutPacket(SMSG_LFG_AUTOJOIN_FAILED_NO_PLAYER); // Matched Player(s) have gone offline.
return;
}
if( pPlayer->GetGroup() == NULL || pPlayer->GetGroup()->IsFull() || pPlayer->GetGroup()->GetLeader() != pPlayer->m_playerInfo )
{
OutPacket(SMSG_LFG_AUTOJOIN_FAILED);
return;
}
pPlayer->GetGroup()->AddMember(_player->m_playerInfo);
}
_player->m_lfgInviterGuid = 0;
_player->m_lfgMatch = NULL;
}
示例9: CanAddPlayerToRaid
/**
Function that checks if the player can be added to a raid group
@param player to be added to raid
*/
bool Battlefield::CanAddPlayerToRaid(Player* player)
{
if (!player->IsInWorld())
return false;
DEBUG_LOG("Battlefield: Adding player %s to raid", player->GetGuidStr().c_str());
if (Group* group = player->GetGroup())
{
DEBUG_LOG("Battlefield: Player %s already has group %s, uninviting", player->GetGuidStr().c_str(), group->GetGuidStr().c_str());
group->RemoveMember(player->GetObjectGuid(), 0);
}
PvpTeamIndex teamIdx = GetTeamIndexByTeamId(player->GetTeam());
Group* group = GetFreeRaid(teamIdx);
if (!group)
{
DEBUG_LOG("Battlefield: No free raid for %s!", player->GetGuidStr().c_str());
if (IsTeamFull(teamIdx))
{
DEBUG_LOG("Battlefield: Battlefield is full! Can't add player %s!", player->GetGuidStr().c_str());
return false;
}
DEBUG_LOG("Battlefield: Trying to create new group for %s!", player->GetGuidStr().c_str());
group = new Group;
group->SetBattlefieldGroup(this);
if (group->Create(player->GetObjectGuid(), player->GetName()))
DEBUG_LOG("Battlefield: Successfully created new group %s", group->GetGuidStr().c_str());
else
sLog.outError("Battlefield: Failed to create group for player %s.", player->GetGuidStr().c_str());
m_battlefieldRaids[teamIdx].insert(group);
}
else if (group->IsMember(player->GetObjectGuid()))
{
DEBUG_LOG("Battlefield: Raid already has players %s, making some shit", player->GetGuidStr().c_str());
uint8 subgroup = group->GetMemberGroup(player->GetObjectGuid());
player->SetBattleRaid(group, subgroup);
}
else
{
if (IsTeamFull(teamIdx))
{
DEBUG_LOG("Battlefield: Group %s found, but battlefield is full! Can't add player %s!", group->GetGuidStr().c_str(), player->GetGuidStr().c_str());
return false;
}
return group->AddMember(player->GetObjectGuid(), player->GetName());
}
return true;
}
示例10: HandleGroupAcceptOpcode
void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_ACCEPT");
recvData.read_skip<uint32>();
Group* group = GetPlayer()->GetGroupInvite();
if (!group)
return;
// Remove player from invitees in any case
group->RemoveInvite(GetPlayer());
if (group->GetLeaderGUID() == GetPlayer()->GetGUID())
{
TC_LOG_ERROR("network", "HandleGroupAcceptOpcode: player %s(%d) tried to accept an invite to his own group", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUID().GetCounter());
return;
}
// Group is full
if (group->IsFull())
{
SendPartyResult(PARTY_OP_INVITE, "", ERR_GROUP_FULL);
return;
}
Player* leader = ObjectAccessor::FindPlayer(group->GetLeaderGUID());
// Forming a new group, create it
if (!group->IsCreated())
{
// This can happen if the leader is zoning. To be removed once delayed actions for zoning are implemented
if (!leader)
{
group->RemoveAllInvites();
return;
}
// If we're about to create a group there really should be a leader present
ASSERT(leader);
group->RemoveInvite(leader);
group->Create(leader);
sGroupMgr->AddGroup(group);
}
// Everything is fine, do it, PLAYER'S GROUP IS SET IN ADDMEMBER!!!
if (!group->AddMember(GetPlayer()))
return;
group->BroadcastGroupUpdate();
}
示例11: HandleGroupAcceptOpcode
void WorldSession::HandleGroupAcceptOpcode( WorldPacket & recv_data )
{
if (!GetPlayer()->GetPlayerbotAI())
recv_data.read_skip<uint32>(); // roles mask?
Group *group = GetPlayer()->GetGroupInvite();
if (!group)
return;
if (group->GetLeaderGuid() == GetPlayer()->GetObjectGuid())
{
sLog.outError("HandleGroupAcceptOpcode: %s tried to accept an invite to his own group",
GetPlayer()->GetGuidStr().c_str());
return;
}
// remove in from invites in any case
group->RemoveInvite(GetPlayer());
/** error handling **/
/********************/
// not have place
if(group->IsFull())
{
SendPartyResult(PARTY_OP_INVITE, "", ERR_GROUP_FULL);
return;
}
Player* leader = sObjectMgr.GetPlayer(group->GetLeaderGuid());
// forming a new group, create it
if (!group->IsCreated())
{
if (leader)
group->RemoveInvite(leader);
if (group->Create(group->GetLeaderGuid(), group->GetLeaderName()))
sObjectMgr.AddGroup(group);
else
return;
}
// everything is fine, do it, PLAYER'S GROUP IS SET IN ADDMEMBER!!!
if(!group->AddMember(GetPlayer()->GetObjectGuid(), GetPlayer()->GetName()))
return;
// Frozen Mod
group->BroadcastGroupUpdate();
// Frozen Mod
}
示例12: AddPlayerToGroup
bool Battlefield::AddPlayerToGroup(Player * player)
{
Group* grp;
if(player->GetTeam() == ALLIANCE)
grp = m_raidGroup[TEAM_ALLIANCE];
else
grp = m_raidGroup[TEAM_HORDE];
if(!grp->IsCreated())
{
grp->Create(player->GetObjectGuid(),player->GetName());
grp->ConvertToRaid();
grp->AddMember(player->GetObjectGuid(),player->GetName());
}
else if(!grp->IsFull())
{
grp->AddMember(player->GetObjectGuid(),player->GetName());
}
else
return false;
return true;
}
示例13: HandleGroupAcceptOpcode
void WorldSession::HandleGroupAcceptOpcode(WorldPacket & /*recv_data*/)
{
Group *group = GetPlayer()->GetGroupInvite();
if (!group) return;
if (group->GetLeaderGUID() == GetPlayer()->GetGUID())
{
sLog.outError("HandleGroupAcceptOpcode: player %s(%d) tried to accept an invite to his own group", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
return;
}
// remove in from ivites in any case
group->RemoveInvite(GetPlayer());
/** error handling **/
/********************/
// not have place
if (group->IsFull())
{
SendPartyResult(PARTY_OP_INVITE, "", ERR_GROUP_FULL);
return;
}
Player* leader = objmgr.GetPlayer(group->GetLeaderGUID());
// forming a new group, create it
if (!group->IsCreated())
{
if (leader)
group->RemoveInvite(leader);
group->Create(group->GetLeaderGUID(), group->GetLeaderName());
objmgr.AddGroup(group);
}
// everything's fine, do it, PLAYER'S GROUP IS SET IN ADDMEMBER!!!
if (!group->AddMember(GetPlayer()->GetGUID(), GetPlayer()->GetName()))
return;
SendLfgUpdatePlayer(LFG_UPDATETYPE_REMOVED_FROM_QUEUE);
for (GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
if (Player *plrg = itr->getSource())
{
plrg->GetSession()->SendLfgUpdatePlayer(LFG_UPDATETYPE_CLEAR_LOCK_LIST);
plrg->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_CLEAR_LOCK_LIST);
}
group->BroadcastGroupUpdate();
}
示例14: HandleGroupAcceptOpcode
void WorldSession::HandleGroupAcceptOpcode( WorldPacket & /*recv_data*/ )
{
Group *group = GetPlayer()->GetGroupInvite();
if (!group) return;
if(group->GetLeaderGUID() == GetPlayer()->GetGUID())
{
sLog.outError("HandleGroupAcceptOpcode: player %s(%d) tried to accept an invite to his own group", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
return;
}
// remove in from ivites in any case
group->RemoveInvite(GetPlayer());
/** error handling **/
/********************/
// not have place
if(group->IsFull())
{
SendPartyResult(PARTY_OP_INVITE, "", PARTY_RESULT_PARTY_FULL);
return;
}
Player* leader = objmgr.GetPlayer(group->GetLeaderGUID());
if(leader && leader->InBattleGround())
{
SendPartyResult(PARTY_OP_INVITE, "", PARTY_RESULT_INVITE_RESTRICTED);
return;
}
// forming a new group, create it
if(!group->IsCreated())
{
if(leader) group->RemoveInvite(leader);
group->Create(group->GetLeaderGUID(), group->GetLeaderName());
objmgr.AddGroup(group);
}
// everything's fine, do it
if(!group->AddMember(GetPlayer()->GetGUID(), GetPlayer()->GetName()))
return;
uint8 subgroup = group->GetMemberGroup(GetPlayer()->GetGUID());
GetPlayer()->SetGroup(group, subgroup);
}
示例15: HandleGroupAcceptOpcode
void WorldSession::HandleGroupAcceptOpcode( WorldPacket & /*recv_data*/ )
{
Group *group = GetPlayer()->GetGroupInvite();
if (!group)
return;
if(group->GetLeaderGUID() == GetPlayer()->GetGUID())
{
sLog.outError("HandleGroupAcceptOpcode: player %s(%d) tried to accept an invite to his own group", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
return;
}
// remove in from invites in any case
group->RemoveInvite(GetPlayer());
/** error handling **/
/********************/
// not have place
if(group->IsFull())
{
SendPartyResult(PARTY_OP_INVITE, "", ERR_GROUP_FULL);
return;
}
Player* leader = sObjectMgr.GetPlayer(group->GetLeaderGUID());
if(leader && leader->InBattleGround())
{
SendPartyResult(PARTY_OP_INVITE, "", ERR_INVITE_RESTRICTED);
return;
}
// forming a new group, create it
if(!group->IsCreated())
{
if (leader)
group->RemoveInvite(leader);
if (group->Create(group->GetLeaderGUID(), group->GetLeaderName()))
sObjectMgr.AddGroup(group);
else
return;
}
// everything is fine, do it, PLAYER'S GROUP IS SET IN ADDMEMBER!!!
if(!group->AddMember(GetPlayer()->GetGUID(), GetPlayer()->GetName()))
return;
}