本文整理汇总了C++中Group::ChangeMembersGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ Group::ChangeMembersGroup方法的具体用法?C++ Group::ChangeMembersGroup怎么用?C++ Group::ChangeMembersGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Group
的用法示例。
在下文中一共展示了Group::ChangeMembersGroup方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleGroupChangeSubGroupOpcode
void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket& recv_data)
{
// we will get correct pointer for group here, so we don't have to check if group is BG raid
Group* group = GetPlayer()->GetGroup();
if (!group)
return;
std::string name;
uint8 groupNr;
recv_data >> name;
recv_data >> groupNr;
/** error handling **/
if (!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
return;
if (!group->HasFreeSlotSubGroup(groupNr))
return;
/********************/
// everything is fine, do it
if (Player* player = ObjectAccessor::Instance().FindPlayerByName(name.c_str()))
group->ChangeMembersGroup(player, groupNr);
else
group->ChangeMembersGroup(objmgr.GetPlayerGUIDByName(name.c_str()), groupNr);
}
示例2: HandleGroupChangeSubGroupOpcode
void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data )
{
std::string name;
uint8 groupNr;
recv_data >> name;
recv_data >> groupNr;
if (groupNr >= MAX_RAID_SUBGROUPS)
return;
// we will get correct pointer for group here, so we don't have to check if group is BG raid
Group *group = GetPlayer()->GetGroup();
if(!group)
return;
/** error handling **/
if (!group->IsLeader(GetPlayer()->GetObjectGuid()) &&
!group->IsAssistant(GetPlayer()->GetObjectGuid()))
return;
if (!group->HasFreeSlotSubGroup(groupNr))
return;
/********************/
// everything is fine, do it
if (Player* player = sObjectMgr.GetPlayer(name.c_str()))
group->ChangeMembersGroup(player, groupNr);
else
{
if (ObjectGuid guid = sObjectMgr.GetPlayerGuidByName(name.c_str()))
group->ChangeMembersGroup(guid, groupNr);
}
}
示例3: HandleGroupChangeSubGroupOpcode
void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket & recv_data) {
// we will get correct pointer for group here, so we don't have to check if group is BG raid
Group *group = GetPlayer()->GetGroup();
if (!group)
return;
std::string name;
uint8 groupNr;
recv_data >> name;
recv_data >> groupNr;
if (groupNr >= MAX_RAID_SUBGROUPS)
return;
/** error handling **/
uint64 senderGuid = GetPlayer()->GetGUID();
if (!group->IsLeader(senderGuid) && !group->IsAssistant(senderGuid))
return;
if (!group->HasFreeSlotSubGroup(groupNr))
return;
/********************/
Player *movedPlayer = sObjectMgr->GetPlayer(name.c_str());
if (movedPlayer) {
//Do not allow leader to change group of player in combat
if (movedPlayer->isInCombat())
return;
// everything's fine, do it
group->ChangeMembersGroup(movedPlayer, groupNr);
} else
group->ChangeMembersGroup(sObjectMgr->GetPlayerGUIDByName(name.c_str()), groupNr);
}
示例4: HandleGroupChangeSubGroupOpcode
void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data )
{
CHECK_PACKET_SIZE(recv_data,1+1);
Group *group = GetPlayer()->GetGroup();
if(!group)
return;
std::string name;
uint8 groupNr;
recv_data >> name;
// recheck
CHECK_PACKET_SIZE(recv_data,(name.size()+1)+1);
recv_data >> groupNr;
/** error handling **/
if(!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
return;
if (!group->HasFreeSlotSubGroup(groupNr))
return;
/********************/
// everything's fine, do it
group->ChangeMembersGroup(objmgr.GetPlayer(name.c_str()), groupNr);
}
示例5: HandleChangeSubGroupOpcode
void WorldSession::HandleChangeSubGroupOpcode(WorldPackets::Party::ChangeSubGroup& packet)
{
// we will get correct pointer for group here, so we don't have to check if group is BG raid
Group* group = GetPlayer()->GetGroup();
if (!group)
return;
if (packet.NewSubGroup >= MAX_RAID_SUBGROUPS)
return;
ObjectGuid senderGuid = GetPlayer()->GetGUID();
if (!group->IsLeader(senderGuid) && !group->IsAssistant(senderGuid))
return;
if (!group->HasFreeSlotSubGroup(packet.NewSubGroup))
return;
group->ChangeMembersGroup(packet.TargetGUID, packet.NewSubGroup);
}
示例6: HandleGroupChangeSubGroupOpcode
void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_CHANGE_SUB_GROUP");
// we will get correct pointer for group here, so we don't have to check if group is BG raid
Group* group = GetPlayer()->GetGroup();
if (!group)
return;
std::string name;
uint8 groupNr;
recvData >> name;
recvData >> groupNr;
if (groupNr >= MAX_RAID_SUBGROUPS)
return;
/********************/
/** error handling **/
uint64 senderGuid = GetPlayer()->GetGUID();
if (!group->IsLeader(senderGuid) && !group->IsAssistant(senderGuid))
return;
if (!group->HasFreeSlotSubGroup(groupNr))
return;
/********************/
Player* movedPlayer = sObjectAccessor->FindPlayerByName(name.c_str());
uint64 guid;
if (movedPlayer)
{
guid = movedPlayer->GetGUID();
}
else
{
CharacterDatabase.EscapeString(name);
guid = sObjectMgr->GetPlayerGUIDByName(name.c_str());
}
group->ChangeMembersGroup(guid, groupNr);
}
示例7: HandleGroupChangeSubGroupOpcode
void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_CHANGE_SUB_GROUP");
// we will get correct pointer for group here, so we don't have to check if group is BG raid
Group* group = GetPlayer()->GetGroup();
if (!group)
return;
time_t now = time(NULL);
if (now - timeLastChangeSubGroupCommand < 2)
return;
else
timeLastChangeSubGroupCommand = now;
ObjectGuid guid;
uint8 groupNr, unk;
recvData >> unk >> groupNr;
uint8 bitsOrder[8] = { 1, 3, 7, 2, 0, 5, 4, 6 };
recvData.ReadBitInOrder(guid, bitsOrder);
recvData.FlushBits();
uint8 bytesOrder[8] = { 7, 0, 2, 4, 5, 3, 6, 1 };
recvData.ReadBytesSeq(guid, bytesOrder);
if (groupNr >= MAX_RAID_SUBGROUPS)
return;
uint64 senderGuid = GetPlayer()->GetGUID();
if (!group->IsLeader(senderGuid) && !group->IsAssistant(senderGuid) && !(group->GetGroupType() & GROUPTYPE_EVERYONE_IS_ASSISTANT))
return;
if (!group->HasFreeSlotSubGroup(groupNr))
return;
if (Player* movedPlayer = sObjectAccessor->FindPlayer(guid))
group->ChangeMembersGroup(guid, groupNr);
}
示例8: HandleGroupChangeSubGroupOpcode
void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_CHANGE_SUB_GROUP");
// we will get correct pointer for group here, so we don't have to check if group is BG raid
Group* group = GetPlayer()->GetGroup();
if (!group)
return;
std::string name;
uint8 groupNr;
recvData >> name;
recvData >> groupNr;
if (groupNr >= MAX_RAID_SUBGROUPS)
return;
ObjectGuid senderGuid = GetPlayer()->GetGUID();
if (!group->IsLeader(senderGuid) && !group->IsAssistant(senderGuid))
return;
if (!group->HasFreeSlotSubGroup(groupNr))
return;
Player* movedPlayer = ObjectAccessor::FindConnectedPlayerByName(name);
ObjectGuid guid;
if (movedPlayer)
{
guid = movedPlayer->GetGUID();
}
else
{
CharacterDatabase.EscapeString(name);
guid = sObjectMgr->GetPlayerGUIDByName(name.c_str());
}
group->ChangeMembersGroup(guid, groupNr);
}
示例9: HandleGroupChangeSubGroupOpcode
void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data )
{
// we will get correct pointer for group here, so we don't have to check if group is BG raid
Group *group = GetPlayer()->GetGroup();
if(!group)
return;
std::string name;
uint8 groupNr;
recv_data >> name;
recv_data >> groupNr;
/** error handling **/
if(!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
return;
if (!group->HasFreeSlotSubGroup(groupNr))
return;
/********************/
Player *movedPlayer=objmgr.GetPlayer(name.c_str());
if(!movedPlayer)
return;
//Do not allow leader to change group of player in combat
if (movedPlayer->isInCombat())
{
WorldPacket data(SMSG_GROUP_SWAP_FAILED, (0));
SendPacket(&data);
return;
}
// everything's fine, do it
group->ChangeMembersGroup(movedPlayer, groupNr);
}