本文整理汇总了C++中Group::IsFull方法的典型用法代码示例。如果您正苦于以下问题:C++ Group::IsFull方法的具体用法?C++ Group::IsFull怎么用?C++ Group::IsFull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Group
的用法示例。
在下文中一共展示了Group::IsFull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: 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();
}
示例3: 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();
}
示例4: 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
}
示例5: 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();
}
示例6: 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;
}
示例7: 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);
}
示例8: HandleGroupJoinCommand
static bool HandleGroupJoinCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
Player* playerSource = NULL;
Player* playerTarget = NULL;
Group* groupSource = NULL;
Group* groupTarget = NULL;
uint64 guidSource = 0;
uint64 guidTarget = 0;
char* nameplgrStr = strtok((char*)args, " ");
char* nameplStr = strtok(NULL, " ");
if (!handler->GetPlayerGroupAndGUIDByName(nameplgrStr, playerSource, groupSource, guidSource, true))
return false;
if (!groupSource)
{
handler->PSendSysMessage(LANG_GROUP_NOT_IN_GROUP, playerSource->GetName().c_str());
handler->SetSentErrorMessage(true);
return false;
}
if (!handler->GetPlayerGroupAndGUIDByName(nameplStr, playerTarget, groupTarget, guidTarget, true))
return false;
if (groupTarget || playerTarget->GetGroup() == groupSource)
{
handler->PSendSysMessage(LANG_GROUP_ALREADY_IN_GROUP, playerTarget->GetName().c_str());
handler->SetSentErrorMessage(true);
return false;
}
if (!groupSource->IsFull())
{
handler->PSendSysMessage(LANG_GROUP_FULL);
handler->SetSentErrorMessage(true);
return false;
}
groupSource->AddMember(playerTarget);
groupSource->BroadcastGroupUpdate();
handler->PSendSysMessage(LANG_GROUP_PLAYER_JOINED, playerTarget->GetName().c_str(), playerSource->GetName().c_str());
return true;
}
示例9: HandleGroupAcceptOpcode
void WorldSession::HandleGroupAcceptOpcode( WorldPacket & recv_data )
{
recv_data.read_skip<uint32>(); // value received in WorldSession::HandleGroupInviteOpcode and also skipeed currently?
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 = sObjectMgr.GetPlayer(group->GetLeaderGUID());
// forming a new group, create it
if(!group->IsCreated())
{
if( leader )
group->RemoveInvite(leader);
group->Create(group->GetLeaderGUID(), group->GetLeaderName());
sObjectMgr.AddGroup(group);
}
// everything's fine, do it, PLAYER'S GROUP IS SET IN ADDMEMBER!!!
if(!group->AddMember(GetPlayer()->GetGUID(), GetPlayer()->GetName()))
return;
}
示例10: 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;
}
示例11: HandleGroupInviteOpcode
void WorldSession::HandleGroupInviteOpcode(WorldPacket& recv_data)
{
std::string membername;
recv_data >> membername;
// attempt add selected player
// cheating
if (!normalizePlayerName(membername))
{
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_CANT_FIND_TARGET);
return;
}
Player* player = ObjectAccessor::Instance().FindPlayerByName(membername.c_str());
// no player
if (!player)
{
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_CANT_FIND_TARGET);
return;
}
// restrict invite to GMs
if (!sWorld.getConfig(CONFIG_ALLOW_GM_GROUP) && !GetPlayer()->isGameMaster() && player->isGameMaster())
{
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_CANT_FIND_TARGET);
return;
}
// can't group with
if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && GetPlayer()->GetTeam() != player->GetTeam())
{
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_TARGET_UNFRIENDLY);
return;
}
if (GetPlayer()->GetInstanceId() != 0 && player->GetInstanceId() != 0 && GetPlayer()->GetInstanceId() != player->GetInstanceId() && GetPlayer()->GetMapId() == player->GetMapId())
{
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_NOT_IN_YOUR_INSTANCE);
return;
}
// just ignore us
if (player->GetInstanceId() != 0 && player->GetDifficulty() != GetPlayer()->GetDifficulty())
{
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_TARGET_IGNORE_YOU);
return;
}
if (player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
{
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_TARGET_IGNORE_YOU);
return;
}
Group* group = GetPlayer()->GetGroup();
if (group && group->isBGGroup())
group = GetPlayer()->GetOriginalGroup();
Group* group2 = player->GetGroup();
if (group2 && group2->isBGGroup())
group2 = player->GetOriginalGroup();
// player already in another group or invited
if (group2 || player->GetGroupInvite())
{
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_ALREADY_IN_GROUP);
return;
}
if (group)
{
// not have permissions for invite
if (!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
{
SendPartyResult(PARTY_OP_INVITE, "", PARTY_RESULT_YOU_NOT_LEADER);
return;
}
// not have place
if (group->IsFull())
{
SendPartyResult(PARTY_OP_INVITE, "", PARTY_RESULT_PARTY_FULL);
return;
}
}
// ok, but group not exist, start a new group
// but don't create and save the group to the DB until
// at least one person joins
if (!group)
{
group = new Group;
// new group: if can't add then delete
if (!group->AddLeaderInvite(GetPlayer()))
{
delete group;
return;
}
if (!group->AddInvite(player))
{
delete group;
return;
//.........这里部分代码省略.........
示例12: HandleGroupInviteOpcode
void WorldSession::HandleGroupInviteOpcode(WorldPacket& recv_data)
{
ObjectGuid guid;
recv_data.read_skip<uint32>(); // cross-realm party related
recv_data.read_skip<uint32>(); // roles mask?
recv_data.ReadGuidMask<2, 7>(guid);
uint32 realmLength = recv_data.ReadBits(9);
recv_data.ReadGuidMask<3>(guid);
uint32 nameLength = recv_data.ReadBits(10);
recv_data.ReadGuidMask<5, 4, 6, 0, 1>(guid);
recv_data.ReadGuidBytes<4, 7, 6>(guid);
std::string membername = recv_data.ReadString(nameLength);
std::string realmname = recv_data.ReadString(realmLength);
// attempt add selected player
// cheating
if (!normalizePlayerName(membername))
{
SendPartyResult(PARTY_OP_INVITE, membername, ERR_BAD_PLAYER_NAME_S);
return;
}
Player* player = sObjectMgr.GetPlayer(membername.c_str());
// no player
if (!player)
{
SendPartyResult(PARTY_OP_INVITE, membername, ERR_BAD_PLAYER_NAME_S);
return;
}
// can't group with
if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GROUP) && GetPlayer()->GetTeam() != player->GetTeam())
{
SendPartyResult(PARTY_OP_INVITE, membername, ERR_PLAYER_WRONG_FACTION);
return;
}
if (GetPlayer()->GetInstanceId() != 0 && player->GetInstanceId() != 0 && GetPlayer()->GetInstanceId() != player->GetInstanceId() && GetPlayer()->GetMapId() == player->GetMapId())
{
SendPartyResult(PARTY_OP_INVITE, membername, ERR_TARGET_NOT_IN_INSTANCE_S);
return;
}
// just ignore us
if (player->GetSocial()->HasIgnore(GetPlayer()->GetObjectGuid()))
{
SendPartyResult(PARTY_OP_INVITE, membername, ERR_IGNORING_YOU_S);
return;
}
Group* group = GetPlayer()->GetGroup();
if (group && group->isBGGroup())
group = GetPlayer()->GetOriginalGroup();
if (group && group->isRaidGroup() && !player->GetAllowLowLevelRaid() && (player->getLevel() < sWorld.getConfig(CONFIG_UINT32_MIN_LEVEL_FOR_RAID)))
{
SendPartyResult(PARTY_OP_INVITE, "", ERR_RAID_DISALLOWED_BY_LEVEL);
return;
}
// player already invited
if (player->GetGroupInvite())
{
SendPartyResult(PARTY_OP_INVITE, membername, ERR_ALREADY_IN_GROUP_S);
return;
}
Group* group2 = player->GetGroup();
if (group2 && group2->isBGGroup())
group2 = player->GetOriginalGroup();
// player already in another group
if (group2)
{
SendPartyResult(PARTY_OP_INVITE, membername, ERR_ALREADY_IN_GROUP_S);
// tell the player that they were invited but it failed as they were already in a group
player->GetSession()->SendGroupInvite(player, true);
return;
}
if (group)
{
// not have permissions for invite
if (!group->IsLeader(GetPlayer()->GetObjectGuid()) && !group->IsAssistant(GetPlayer()->GetObjectGuid()))
{
SendPartyResult(PARTY_OP_INVITE, "", ERR_NOT_LEADER);
return;
}
// not have place
if (group->IsFull())
{
SendPartyResult(PARTY_OP_INVITE, "", ERR_GROUP_FULL);
//.........这里部分代码省略.........
示例13: HandleGroupInviteResponseOpcode
void WorldSession::HandleGroupInviteResponseOpcode(WorldPacket& recv_data)
{
bool unk = recv_data.ReadBit();
bool accepted = recv_data.ReadBit();
if (unk)
recv_data.read_skip<uint32>();
Group* group = GetPlayer()->GetGroupInvite();
if (!group)
return;
if (accepted)
{
// remove in from invites in any case
group->RemoveInvite(GetPlayer());
if (group->GetLeaderGuid() == GetPlayer()->GetObjectGuid())
{
sLog.outError("HandleGroupInviteResponseOpcode: %s tried to accept an invite to his own group",
GetPlayer()->GetGuidStr().c_str());
return;
}
/** 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;
}
else
{
// uninvite, group can be deleted
GetPlayer()->UninviteFromGroup();
// remember leader if online
Player* leader = sObjectMgr.GetPlayer(group->GetLeaderGuid());
if (!leader || !leader->GetSession())
return;
// report
WorldPacket data(SMSG_GROUP_DECLINE, 10); // guess size
data << GetPlayer()->GetName();
leader->GetSession()->SendPacket(&data);
}
}
示例14: Update
void LFGQueue::Update(uint32 diff)
{
if(m_QueuedGroups.empty() && m_QueuedPlayers.empty())
return;
// Iterate over QueuedPlayersMap to update players timers and remove offline/disconnected players.
for(QueuedPlayersMap::iterator qPlayer = m_QueuedPlayers.begin(); qPlayer != m_QueuedPlayers.end(); ++qPlayer)
{
Player* plr = sObjectMgr.GetPlayer(qPlayer->first);
// Player could have been disconnected
if(!plr ||!plr->IsInWorld())
{
m_OfflinePlayers[qPlayer->first] = qPlayer->second;
m_QueuedPlayers.erase(qPlayer);
break;
}
qPlayer->second.timeInLFG += diff;
// Update player timer and give him queue priority.
if(qPlayer->second.timeInLFG >= (30 * MINUTE * IN_MILLISECONDS))
{
qPlayer->second.hasQueuePriority = true;
}
}
if(!m_QueuedGroups.empty())
{
// Iterate over QueuedGroupsMap to fill groups with roles they're missing.
for(QueuedGroupsMap::iterator qGroup = m_QueuedGroups.begin(); qGroup != m_QueuedGroups.end(); ++qGroup)
{
Group* grp = sObjectMgr.GetGroupById(qGroup->first);
// Safe check
if(!grp)
return;
// Remove group from Queue if it's full
if(grp->IsFull())
{
RemoveGroupFromQueue(qGroup->first, GROUP_SYSTEM_LEAVE);
break;
}
// Iterate over QueuedPlayersMap to find suitable player to join group
for(QueuedPlayersMap::iterator qPlayer = m_QueuedPlayers.begin(); qPlayer != m_QueuedPlayers.end(); ++qPlayer)
{
Player* plr = sObjectMgr.GetPlayer(qPlayer->first);
// Check here that players team and areaId they're in queue are same
if(qPlayer->second.team == qGroup->second.team &&
qPlayer->second.areaId == qGroup->second.areaId)
{
// Check if player can perform tank role
if((canPerformRole(qPlayer->second.roleMask, LFG_ROLE_TANK) & qGroup->second.availableRoles) == LFG_ROLE_TANK)
{
if(FindRoleToGroup(plr, grp, LFG_ROLE_TANK))
{
break;
}
else
{
continue;
}
}
// Check if player can perform healer role
if((canPerformRole(qPlayer->second.roleMask, LFG_ROLE_HEALER) & qGroup->second.availableRoles) == LFG_ROLE_HEALER)
{
if(FindRoleToGroup(plr, grp, LFG_ROLE_HEALER))
{
break;
}
else
{
continue;
}
}
// Check if player can perform dps role
if((canPerformRole(qPlayer->second.roleMask, LFG_ROLE_DPS) & qGroup->second.availableRoles) == LFG_ROLE_DPS)
{
if(FindRoleToGroup(plr, grp, LFG_ROLE_DPS))
{
break;
}
else
{
continue;
}
}
// Check if group is full, no need to try to iterate same group if it's already full.
if(grp->IsFull())
{
RemoveGroupFromQueue(qGroup->first, GROUP_SYSTEM_LEAVE);
break;
}
}
//.........这里部分代码省略.........
示例15: HandleGroupInviteOpcode
//////////////////////////////////////////////////////////////
/// This function handles CMSG_GROUP_INVITE
//////////////////////////////////////////////////////////////
void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data )
{
if(!_player->IsInWorld()) return;
CHECK_PACKET_SIZE(recv_data, 1);
WorldPacket data(100);
std::string membername;
Player * player = NULL;
Group *group = NULL;
recv_data >> membername;
if(_player->HasBeenInvited())return;
player = objmgr.GetPlayer(membername.c_str(), false);
if ( player == NULL)
{
SendPartyCommandResult(_player, 0, membername, ERR_PARTY_CANNOT_FIND);
return;
}
if (player == _player)
{
return;
}
if ( _player->InGroup() && !_player->IsGroupLeader() )
{
SendPartyCommandResult(_player, 0, "", ERR_PARTY_YOU_ARE_NOT_LEADER);
return;
}
group = _player->GetGroup();
if ( group != NULL )
{
if (group->IsFull())
{
SendPartyCommandResult(_player, 0, "", ERR_PARTY_IS_FULL);
return;
}
}
if ( player->InGroup() )
{
SendPartyCommandResult(_player, player->GetGroup()->GetGroupType(), membername, ERR_PARTY_ALREADY_IN_GROUP);
return;
}
if(player->GetTeam()!=_player->GetTeam() && _player->GetSession()->GetPermissionCount() == 0)
{
SendPartyCommandResult(_player, 0, membername, ERR_PARTY_WRONG_FACTION);
return;
}
if ( player->HasBeenInvited() )
{
SendPartyCommandResult(_player, 0, membername, ERR_PARTY_ALREADY_IN_GROUP);
return;
}
if( player->Social_IsIgnoring( _player->GetLowGUID() ) )
{
SendPartyCommandResult(_player, 0, membername, ERR_PARTY_IS_IGNORING_YOU);
return;
}
// 16/08/06 - change to guid to prevent very unlikely event of a crash in deny, etc
_player->SetInviter(_player->GetLowGUID());//bugfix if player invtied 2 people-> he can be in 2 parties
data.SetOpcode(SMSG_GROUP_INVITE);
data << GetPlayer()->GetName();
player->GetSession()->SendPacket(&data);
uint32 gtype = 0;
if(group)
gtype = group->GetGroupType();
SendPartyCommandResult(_player, gtype, membername, ERR_PARTY_NO_ERROR);
// 16/08/06 - change to guid to prevent very unlikely event of a crash in deny, etc
player->SetInviter(_player->GetLowGUID());
}