本文整理汇总了C++中Group::GetObjectGuid方法的典型用法代码示例。如果您正苦于以下问题:C++ Group::GetObjectGuid方法的具体用法?C++ Group::GetObjectGuid怎么用?C++ Group::GetObjectGuid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Group
的用法示例。
在下文中一共展示了Group::GetObjectGuid方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitBoot
void LFGMgr::InitBoot(Player* kicker, ObjectGuid victimGuid, std::string reason)
{
Group* group = kicker->GetGroup();
Player* victim = sObjectMgr.GetPlayer(victimGuid);
if (!group || !victim)
return;
group->GetLFGState()->SetState(LFG_STATE_BOOT);
LFGPlayerBoot boot;
boot.inProgress = true;
boot.cancelTime = time_t(time(NULL)) + LFG_TIME_BOOT;
boot.reason = reason;
boot.victim = victimGuid;
boot.votedNeeded = group->GetLFGState()->GetVotesNeeded();
// Set votes
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
if (Player* player = itr->getSource())
{
player->GetLFGState()->SetState(LFG_STATE_BOOT);;
if (player == victim)
boot.votes[victimGuid] = LFG_ANSWER_DENY; // Victim auto vote NO
else if (player == kicker)
boot.votes[kicker->GetObjectGuid()] = LFG_ANSWER_AGREE; // Kicker auto vote YES
else
{
boot.votes[player->GetObjectGuid()] = LFG_ANSWER_PENDING; // Other members need to vote
}
}
}
m_bootMap.insert(std::make_pair(group->GetObjectGuid(), boot));
LFGPlayerBoot* pBoot = GetBoot(group->GetObjectGuid());
if (!pBoot)
return;
// Notify players
for (GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* player = itr->getSource();
if (player && player->IsInWorld())
player->GetSession()->SendLfgBootPlayer(pBoot);
}
}
示例2: HandleLfgLeaveOpcode
void WorldSession::HandleLfgLeaveOpcode(WorldPacket& recvData)
{
uint32 roles, time, reason, instanceId;
recvData >> roles >> time >> reason >> instanceId;
Group* group = _player->GetGroup();
ObjectGuid guid = _player->GetObjectGuid();
ObjectGuid gguid = group ? group->GetObjectGuid() : guid;
sLog.outDebug("CMSG_LFG_LEAVE %s in group: %u",
guid.GetString().c_str(), group ? 1 : 0);
// Check cheating - only leader can leave the queue
if (!group || group->GetLeaderGuid() == guid)
sLFGMgr.LeaveLfg(gguid);
}
示例3: GetDungeonGroupQueue
LFGQueueSet LFGMgr::GetDungeonGroupQueue(LFGDungeonEntry const* dungeon, Team team)
{
LFGQueueSet tmpSet;
tmpSet.clear();
LFGType type = LFG_TYPE_NONE;
uint32 dungeonID = 0;
uint8 searchEnd = LFG_TYPE_MAX;
if (dungeon)
{
type = LFGType(dungeon->type);
dungeonID = dungeon->ID;
searchEnd = type+1;
}
for (uint8 i = type; i < searchEnd; ++i)
{
for (LFGQueueInfoMap::iterator itr = m_groupQueueInfoMap[i].begin(); itr != m_groupQueueInfoMap[i].end(); ++itr)
{
ObjectGuid guid = itr->first;
if (!guid.IsGroup())
continue;
Group* group = sObjectMgr.GetGroup(guid);
if (!group)
continue;
Player* player = sObjectMgr.GetPlayer(group->GetLeaderGuid());
if (!player)
continue;
if (team && player->GetTeam() != team)
continue;
if (player->GetLFGState()->GetState() < LFG_STATE_LFR ||
player->GetLFGState()->GetState() > LFG_STATE_PROPOSAL)
continue;
if (player->GetLFGState()->GetDungeons()->find(dungeon) == player->GetLFGState()->GetDungeons()->end())
continue;
tmpSet.insert(group->GetObjectGuid());
}
}
return tmpSet;
}
示例4: HandleLfgSetRolesOpcode
void WorldSession::HandleLfgSetRolesOpcode(WorldPacket &recv_data)
{
uint8 roles;
recv_data >> roles;
Group* group = GetPlayer()->GetGroup();
if (group)
{
bool isChanged = sLFGMgr.RoleChanged(GetPlayer(), LFGRoleMask(roles));
DEBUG_LOG("CMSG_LFG_SET_ROLES: Group %u, Player %u, Roles: %u %s", group->GetObjectGuid().GetCounter(), GetPlayer()->GetObjectGuid().GetCounter(), roles, isChanged ? "changed" : "not changed");
sLFGMgr.UpdateRoleCheck(group);
}
else
{
sLFGMgr.GetLFGPlayerState(GetPlayer()->GetObjectGuid())->SetRoles(LFGRoleMask(roles));
DEBUG_LOG("CMSG_LFG_SET_ROLES (not in group) Player %u roles %u", GetPlayer()->GetObjectGuid().GetCounter(), roles);
}
}
示例5: HandleLfgSetRolesOpcode
void WorldSession::HandleLfgSetRolesOpcode(WorldPacket& recvData)
{
uint32 roles;
recvData >> roles; // Player Group Roles
ObjectGuid guid = _player->GetObjectGuid();
Group* group = _player->GetGroup();
if (!group)
{
sLog.outDebug("CMSG_LFG_SET_ROLES %s Not in group",
guid.GetString().c_str());
return;
}
ObjectGuid gguid = group->GetObjectGuid();
sLog.outDebug("CMSG_LFG_SET_ROLES: Group %u, Player %s, Roles: %u",
gguid.GetCounter(), guid.GetString().c_str(), roles);
sLFGMgr.UpdateRoleCheck(gguid, guid, roles);
}
示例6: Leave
void LFGMgr::Leave(Player* player)
{
if (!sWorld.getConfig(CONFIG_BOOL_LFG_ENABLE) && !sWorld.getConfig(CONFIG_BOOL_LFR_ENABLE))
return;
ObjectGuid guid;
Group* group = player->GetGroup();
if (group)
{
if (player->GetObjectGuid() != group->GetLeaderGuid())
return;
else
guid = group->GetObjectGuid();
}
else
guid = player->GetObjectGuid();
if (guid.IsEmpty())
return;
LFGType type = player->GetLFGState()->GetType();
guid.IsGroup() ? _LeaveGroup(guid) : _Leave(guid);
player->GetLFGState()->Clear();
if (group)
{
group->GetLFGState()->Clear();
player->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_REMOVED_FROM_QUEUE, type);
}
player->GetSession()->SendLfgUpdatePlayer(LFG_UPDATETYPE_REMOVED_FROM_QUEUE, type);
if(sWorld.getConfig(CONFIG_BOOL_RESTRICTED_LFG_CHANNEL) && player->GetSession()->GetSecurity() == SEC_PLAYER )
player->LeaveLFGChannel();
}
示例7: UpdateBoot
void LFGMgr::UpdateBoot(Player* player, bool accept)
{
Group* group = player ? player->GetGroup() : NULL;
if (!group)
return;
LFGPlayerBoot* pBoot = GetBoot(group->GetObjectGuid());
if (!pBoot)
return;
if (pBoot->votes[player->GetObjectGuid()] != LFG_ANSWER_PENDING) // Cheat check: Player can't vote twice
return;
Player* victim = sObjectMgr.GetPlayer(pBoot->victim);
if (!victim)
return;
pBoot->votes[player->GetObjectGuid()] = LFGAnswer(accept);
uint8 votesNum = 0;
uint8 agreeNum = 0;
for (LFGAnswerMap::const_iterator itVotes = pBoot->votes.begin(); itVotes != pBoot->votes.end(); ++itVotes)
{
if (itVotes->second != LFG_ANSWER_PENDING)
{
++votesNum;
if (itVotes->second == LFG_ANSWER_AGREE)
++agreeNum;
}
}
if (agreeNum >= pBoot->votedNeeded || // Vote passed
votesNum >= pBoot->votes.size() || // All voted but not passed
(pBoot->votes.size() - votesNum + agreeNum) < pBoot->votedNeeded) // Vote didnt passed
{
// Send update info to all players
pBoot->inProgress = false;
for (LFGAnswerMap::const_iterator itVotes = pBoot->votes.begin(); itVotes != pBoot->votes.end(); ++itVotes)
{
Player* pPlayer = sObjectMgr.GetPlayer(itVotes->first);
if (pPlayer && (pPlayer != victim))
{
pPlayer->GetLFGState()->SetState(LFG_STATE_DUNGEON);
pPlayer->GetSession()->SendLfgBootPlayer(pBoot);
}
}
group->GetLFGState()->SetState(LFG_STATE_DUNGEON);
if (agreeNum == pBoot->votedNeeded) // Vote passed - Kick player
{
Player::RemoveFromGroup(group, victim->GetObjectGuid());
TeleportPlayer(victim, true, false);
victim->GetLFGState()->Clear();
OfferContinue(group);
group->GetLFGState()->DecreaseKicksLeft();
}
DeleteBoot(group->GetObjectGuid());
}
}
示例8: Join
void LFGMgr::Join(Player* player)
{
// LfgDungeonSet* dungeons = NULL;
if (!sWorld.getConfig(CONFIG_BOOL_LFG_ENABLE) && !sWorld.getConfig(CONFIG_BOOL_LFR_ENABLE))
return;
ObjectGuid guid;
Group* group = player->GetGroup();
if (group)
{
if (player->GetObjectGuid() != group->GetLeaderGuid())
{
player->GetSession()->SendLfgJoinResult(ERR_LFG_NO_SLOTS_PLAYER);
return;
}
else
guid = group->GetObjectGuid();
}
else
guid = player->GetObjectGuid();
if (guid.IsEmpty())
return;
LFGType type = player->GetLFGState()->GetType();
if (type == LFG_TYPE_NONE)
{
DEBUG_LOG("LFGMgr::Join: %u trying to join without dungeon type. Aborting.", guid.GetCounter());
player->GetSession()->SendLfgJoinResult(ERR_LFG_INVALID_SLOT);
return;
}
else if (group && type == LFG_TYPE_RAID && !group->isRaidGroup())
{
DEBUG_LOG("LFGMgr::Join: %u trying to join to raid finder, but group is not raid. Aborting.", guid.GetCounter());
player->GetSession()->SendLfgJoinResult(ERR_LFG_MISMATCHED_SLOTS);
return;
}
else if (group && type != LFG_TYPE_RAID && group->isRaidGroup())
{
DEBUG_LOG("LFGMgr::Join: %u trying to join to dungeon finder, but group is raid. Aborting.", guid.GetCounter());
player->GetSession()->SendLfgJoinResult(ERR_LFG_MISMATCHED_SLOTS);
return;
}
LFGQueueInfoMap::iterator queue = (guid.IsGroup() ? m_groupQueueInfoMap[type].find(guid) : m_queueInfoMap[type].find(guid));
LFGJoinResult result = ERR_LFG_OK;
if (queue != (guid.IsGroup() ? m_groupQueueInfoMap[type].end() : m_queueInfoMap[type].end()))
{
DEBUG_LOG("LFGMgr::Join: %u trying to join but is already in queue!", guid.GetCounter());
result = ERR_LFG_NO_LFG_OBJECT;
player->GetSession()->SendLfgJoinResult(result);
_Leave(guid);
_LeaveGroup(guid);
return;
}
result = guid.IsGroup() ? GetGroupJoinResult(group) : GetPlayerJoinResult(player);
if (result != ERR_LFG_OK) // Someone can't join. Clear all stuf
{
DEBUG_LOG("LFGMgr::Join: %u joining with %u members. result: %u", guid.GetCounter(), group ? group->GetMembersCount() : 1, result);
player->GetLFGState()->Clear();
player->GetSession()->SendLfgJoinResult(result);
player->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_ROLECHECK_FAILED, type);
return;
}
if (!guid.IsGroup() && player->GetLFGState()->GetRoles() == LFG_ROLE_MASK_NONE)
{
sLog.outError("LFGMgr::Join: %u has no roles", guid.GetCounter());
}
// Joining process
if (guid.IsGroup())
{
for (GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
if (Player* player = itr->getSource())
_Leave(player->GetObjectGuid());
}
_LeaveGroup(guid, type);
_JoinGroup(guid, type);
}
else
{
_Leave(guid, type);
_Join(guid, type);
}
player->GetLFGState()->SetState((type == LFG_TYPE_RAID) ? LFG_STATE_LFR : LFG_STATE_LFG);
player->GetSession()->SendLfgJoinResult(ERR_LFG_OK, 0);
if (group)
player->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_JOIN_PROPOSAL, type);
//.........这里部分代码省略.........
示例9: SendLfgUpdateList
void WorldSession::SendLfgUpdateList(uint32 dungeonEntry)
{
if (!sWorld.getConfig(CONFIG_BOOL_LFR_ENABLE))
{
DEBUG_LOG("SendLfgUpdateList %u failed - Raid finder disabled", GetPlayer()->GetObjectGuid().GetCounter());
return;
}
DEBUG_LOG("SMSG_LFG_SEARCH_RESULTS %u dungeonentry: %u ", GetPlayer()->GetObjectGuid().GetCounter(), dungeonEntry);
LFGDungeonEntry const* dungeon = sLFGMgr.GetDungeon(dungeonEntry);
if (!dungeonEntry)
return;
Team team = sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GROUP) ? TEAM_NONE : GetPlayer()->GetTeam();
LFGQueueGroupSet groups = sLFGMgr.GetDungeonGroupQueue(dungeon, team);
LFGQueuePlayerSet players = sLFGMgr.GetDungeonPlayerQueue(dungeon, team);
uint32 groupCount = groups.size();
uint32 groupSize = 4+4;
for (LFGQueueGroupSet::const_iterator itr = groups.begin(); itr != groups.end(); ++itr)
{
Player* leader = sObjectMgr.GetPlayer((*itr)->GetLeaderGuid());
if (!leader)
continue;
leader->GetLFGState()->AddFlags(LFG_MEMBER_FLAG_CHARINFO |
LFG_MEMBER_FLAG_COMMENT |
LFG_MEMBER_FLAG_GROUPLEADER |
LFG_MEMBER_FLAG_GROUPGUID |
LFG_MEMBER_FLAG_ROLES |
LFG_MEMBER_FLAG_AREA |
LFG_MEMBER_FLAG_STATUS |
LFG_MEMBER_FLAG_BIND);
uint32 flags = leader->GetLFGState()->GetFlags();
if (flags & LFG_MEMBER_FLAG_COMMENT)
groupSize += leader->GetLFGState()->GetComment().size()+1;
if (flags & LFG_MEMBER_FLAG_ROLES)
groupSize +=3;
if (flags & LFG_MEMBER_FLAG_BIND)
groupSize += (8+4);
players.insert(leader);
for (GroupReference *itr2 = (*itr)->GetFirstMember(); itr2 != NULL; itr2 = itr2->next())
{
Player* player = itr2->getSource();
if (!player || player == leader)
continue;
player->GetLFGState()->AddFlags(LFG_MEMBER_FLAG_GROUPLEADER |
LFG_MEMBER_FLAG_GROUPGUID |
LFG_MEMBER_FLAG_STATUS);
player->GetLFGState()->RemoveFlags(LFG_MEMBER_FLAG_CHARINFO |
LFG_MEMBER_FLAG_COMMENT |
LFG_MEMBER_FLAG_ROLES |
LFG_MEMBER_FLAG_AREA |
LFG_MEMBER_FLAG_BIND);
players.insert(player);
}
}
uint32 playerCount = players.size();
uint32 playerSize = 4+4;
uint32 guidsSize = 0;
LFGQueuePlayerSet playersUpdated;
playersUpdated.clear();
for(LFGQueuePlayerSet::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
uint32 flags = (*itr)->GetLFGState()->GetFlags();
playerSize += (8+4);
if (flags & LFG_MEMBER_FLAG_CHARINFO)
playerSize += (1+1+1+3+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4+4);
if (flags & LFG_MEMBER_FLAG_COMMENT)
playerSize += (*itr)->GetLFGState()->GetComment().size()+1; // comment
if (flags & LFG_MEMBER_FLAG_GROUPLEADER)
playerSize += 1;
if (flags & LFG_MEMBER_FLAG_GROUPGUID)
playerSize += 8;
if (flags & LFG_MEMBER_FLAG_ROLES)
playerSize += 1;
if (flags & LFG_MEMBER_FLAG_AREA)
playerSize += 4;
//.........这里部分代码省略.........
示例10: SendLfgRoleCheckUpdate
void WorldSession::SendLfgRoleCheckUpdate()
{
if (!sWorld.getConfig(CONFIG_BOOL_LFG_ENABLE))
{
DEBUG_LOG("SendLfgRoleCheckUpdate %u failed - Dungeon finder disabled", GetPlayer()->GetObjectGuid().GetCounter());
return;
}
Group* pGroup = GetPlayer()->GetGroup();
if (!pGroup)
return;
LFGDungeonSet const* dungeons = sLFGMgr.GetLFGGroupState(pGroup->GetObjectGuid())->GetDungeons();
if (!dungeons)
return;
DEBUG_LOG("SMSG_LFG_ROLE_CHECK_UPDATE %u, dugeons size " SIZEFMTD, GetPlayer()->GetObjectGuid().GetCounter(), dungeons->size());
WorldPacket data(SMSG_LFG_ROLE_CHECK_UPDATE, 4 + 1 + 1 + dungeons->size() * 4 + 1 + pGroup->GetMembersCount() * (8 + 1 + 4 + 1));
data << uint32(sLFGMgr.GetLFGGroupState(pGroup->GetObjectGuid())->GetRoleCheckState()); // Check result
data << uint8(sLFGMgr.GetLFGGroupState(pGroup->GetObjectGuid())->GetRoleCheckState() == LFG_ROLECHECK_INITIALITING);
data << uint8(dungeons->size()); // Number of dungeons
if (dungeons->size())
{
for (LFGDungeonSet::const_iterator itr = dungeons->begin(); itr != dungeons->end(); ++itr)
{
data << uint32(*itr ? (*itr)->Entry() : 0); // Dungeon Entry
}
}
data << uint8(pGroup->GetMembersCount()); // Players in group
if (pGroup->GetMembersCount())
{
// Leader info MUST be sent 1st :S
ObjectGuid leaderguid = pGroup->GetLeaderGuid();
Player* pLeader = sObjectMgr.GetPlayer(leaderguid);
LFGRoleMask roles = LFG_ROLE_MASK_NONE;
uint8 leaderLevel = 1;
if (pLeader)
{
roles = sLFGMgr.GetLFGPlayerState(pLeader->GetObjectGuid())->GetRoles();
leaderLevel = pLeader->getLevel();
}
data << leaderguid; // Guid
data << uint8(roles != LFG_ROLE_MASK_NONE); // Ready
data << uint32(roles); // Roles
data << uint8(leaderLevel); // Level
for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
{
if (Player* pGroupMember = itr->getSource())
{
ObjectGuid guid = pGroupMember->GetObjectGuid();
// Leader data handle first
if (guid == leaderguid)
continue;
roles = sLFGMgr.GetLFGPlayerState(pGroupMember->GetObjectGuid())->GetRoles();
data << guid; // Guid
data << uint8(roles != LFG_ROLE_MASK_NONE); // Ready
data << uint32(roles); // Roles
data << uint8(pGroupMember->getLevel()); // Level
}
}
}
SendPacket(&data);
}
示例11: SendLfgBootPlayer
void WorldSession::SendLfgBootPlayer()
{
if (!sWorld.getConfig(CONFIG_BOOL_LFG_ENABLE))
{
DEBUG_LOG("SendLfgBootPlayer %u failed - Dungeon finder disabled", GetPlayer()->GetObjectGuid().GetCounter());
return;
}
Group* pGroup = GetPlayer()->GetGroup();
if (!pGroup)
{
sLog.outError("ERROR:SendLfgBootPlayer %s failed - player not in group!", GetPlayer()->GetGuidStr().c_str());
return;
}
ObjectGuid guid = GetPlayer()->GetObjectGuid();
LFGAnswerMap* votes = sLFGMgr.GetLFGGroupState(pGroup->GetObjectGuid())->GetBootMap();
if (votes->empty())
{
sLog.outError("ERROR:SendLfgBootPlayer %s failed - votes map is empty!", GetPlayer()->GetGuidStr().c_str());
return;
}
LFGAnswerMap::const_iterator votesItr = votes->find(guid);
if (votesItr == votes->end())
{
sLog.outError("ERROR:SendLfgBootPlayer %s failed - votes map not contain this player! Possible cheating.", GetPlayer()->GetGuidStr().c_str());
return;
}
LFGAnswer playerVote = votesItr->second;
uint8 votesNum = 0;
uint8 agreeNum = 0;
uint32 secsleft = uint8(sLFGMgr.GetLFGGroupState(pGroup->GetObjectGuid())->GetBootCancelTime() - time(NULL));
bool isBootContinued = (sLFGMgr.GetLFGGroupState(pGroup->GetObjectGuid())->GetBootResult() == LFG_ANSWER_PENDING);
for (LFGAnswerMap::const_iterator itr = votes->begin(); itr != votes->end(); ++itr)
{
if (itr->second != LFG_ANSWER_PENDING)
{
++votesNum;
if (itr->second == LFG_ANSWER_AGREE)
++agreeNum;
}
}
DEBUG_LOG("SMSG_LFG_BOOT_PLAYER %u didVote: %u - agree: %u - victim: %u votes: %u - agrees: %u - left: %u - needed: %u - reason %s",
GetPlayer()->GetObjectGuid().GetCounter(), uint8(playerVote != LFG_ANSWER_PENDING), uint8(playerVote == LFG_ANSWER_AGREE), sLFGMgr.GetLFGGroupState(pGroup->GetObjectGuid())->GetBootVictim().GetCounter(), votesNum, agreeNum, secsleft, sLFGMgr.GetLFGGroupState(pGroup->GetObjectGuid())->GetVotesNeeded(), sLFGMgr.GetLFGGroupState(pGroup->GetObjectGuid())->GetBootReason().c_str());
WorldPacket data(SMSG_LFG_BOOT_PLAYER, 1 + 1 + 1 + 8 + 4 + 4 + 4 + 4 + sLFGMgr.GetLFGGroupState(pGroup->GetObjectGuid())->GetBootReason().length()+1);
data << uint8(isBootContinued); // Vote in progress
data << uint8(playerVote != LFG_ANSWER_PENDING); // Did Vote
data << uint8(playerVote == LFG_ANSWER_AGREE); // Agree
data << sLFGMgr.GetLFGGroupState(pGroup->GetObjectGuid())->GetBootVictim(); // Victim GUID
data << uint32(votesNum); // Total Votes
data << uint32(agreeNum); // Agree Count
data << uint32(secsleft); // Time Left
data << uint32(sLFGMgr.GetLFGGroupState(pGroup->GetObjectGuid())->GetVotesNeeded()); // Needed Votes
data << sLFGMgr.GetLFGGroupState(pGroup->GetObjectGuid())->GetBootReason().c_str(); // Kick reason
SendPacket(&data);
}