本文整理汇总了C++中LfgDungeonSet::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ LfgDungeonSet::empty方法的具体用法?C++ LfgDungeonSet::empty怎么用?C++ LfgDungeonSet::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LfgDungeonSet
的用法示例。
在下文中一共展示了LfgDungeonSet::empty方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendLfgRoleCheckUpdate
void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck* pRoleCheck)
{
ASSERT(pRoleCheck);
LfgDungeonSet dungeons;
if (pRoleCheck->rDungeonId)
dungeons.insert(pRoleCheck->rDungeonId);
else
dungeons = pRoleCheck->dungeons;
Log.Debug("LfgHandler", "SMSG_LFG_ROLE_CHECK_UPDATE %u", GetPlayer()->GetGUID());
WorldPacket data(SMSG_LFG_ROLE_CHECK_UPDATE, 4 + 1 + 1 + dungeons.size() * 4 + 1 + pRoleCheck->roles.size() * (8 + 1 + 4 + 1));
data << uint32(pRoleCheck->state); // Check result
data << uint8(pRoleCheck->state == LFG_ROLECHECK_INITIALITING);
data << uint8(dungeons.size()); // Number of dungeons
if (!dungeons.empty())
{
for (LfgDungeonSet::iterator it = dungeons.begin(); it != dungeons.end(); ++it)
{
DBC::Structures::LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(*it);
data << uint32(dungeon ? dungeon->Entry() : 0); // Dungeon
}
}
data << uint8(pRoleCheck->roles.size()); // Players in group
if (!pRoleCheck->roles.empty())
{
// Leader info MUST be sent 1st :S
uint64 guid = pRoleCheck->leader;
uint8 roles = pRoleCheck->roles.find(guid)->second;
data << uint64(guid); // Guid
data << uint8(roles > 0); // Ready
data << uint32(roles); // Roles
Player* player = objmgr.GetPlayer(GET_LOWGUID_PART(guid));
data << uint8(player ? player->getLevel() : 0); // Level
for (LfgRolesMap::const_iterator it = pRoleCheck->roles.begin(); it != pRoleCheck->roles.end(); ++it)
{
if (it->first == pRoleCheck->leader)
continue;
guid = it->first;
roles = it->second;
data << uint64(guid); // Guid
data << uint8(roles > 0); // Ready
data << uint32(roles); // Roles
player = objmgr.GetPlayer(GET_LOWGUID_PART(guid));
data << uint8(player ? player->getLevel() : 0); // Level
}
}
SendPacket(&data);
}
示例2: SendLfgRoleCheckUpdate
void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck* pRoleCheck)
{
ASSERT(pRoleCheck);
LfgDungeonSet dungeons;
if (pRoleCheck->rDungeonId)
dungeons.insert(pRoleCheck->rDungeonId);
else
dungeons = pRoleCheck->dungeons;
sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_ROLE_CHECK_UPDATE [" UI64FMTD "]", GetPlayer()->GetGUID());
WorldPacket data(SMSG_LFG_ROLE_CHECK_UPDATE, 4 + 1 + 1 + dungeons.size() * 4 + 1 + pRoleCheck->roles.size() * (8 + 1 + 4 + 1));
data << uint32(pRoleCheck->state); // Check result
data << uint8(pRoleCheck->state == LFG_ROLECHECK_INITIALITING);
data << uint8(dungeons.size()); // Number of dungeons
if (!dungeons.empty())
{
for (LfgDungeonSet::iterator it = dungeons.begin(); it != dungeons.end(); ++it)
{
LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(*it);
data << uint32(dungeon ? dungeon->Entry() : 0); // Dungeon
}
}
data << uint8(pRoleCheck->roles.size()); // Players in group
if (!pRoleCheck->roles.empty())
{
// Leader info MUST be sent 1st :S
uint64 guid = pRoleCheck->leader;
uint8 roles = pRoleCheck->roles.find(guid)->second;
data << uint64(guid); // Guid
data << uint8(roles > 0); // Ready
data << uint32(roles); // Roles
Player* plr = ObjectAccessor::FindPlayer(guid);
data << uint8(plr ? plr->getLevel() : 0); // Level
for (LfgRolesMap::const_iterator it = pRoleCheck->roles.begin(); it != pRoleCheck->roles.end(); ++it)
{
if (it->first == pRoleCheck->leader)
continue;
guid = it->first;
roles = it->second;
data << uint64(guid); // Guid
data << uint8(roles > 0); // Ready
data << uint32(roles); // Roles
plr = ObjectAccessor::FindPlayer(guid);
data << uint8(plr ? plr->getLevel() : 0); // Level
}
}
SendPacket(&data);
}
示例3: SendLfgRoleCheckUpdate
void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck& roleCheck)
{
LfgDungeonSet dungeons;
if (roleCheck.rDungeonId)
dungeons.insert(roleCheck.rDungeonId);
else
dungeons = roleCheck.dungeons;
sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_ROLE_CHECK_UPDATE %s", GetPlayerInfo().c_str());
WorldPacket data(SMSG_LFG_ROLE_CHECK_UPDATE, 4 + 1 + 1 + dungeons.size() * 4 + 1 + roleCheck.roles.size() * (8 + 1 + 4 + 1));
data << uint32(roleCheck.state); // Check result
data << uint8(roleCheck.state == LFG_ROLECHECK_INITIALITING);
data << uint8(dungeons.size()); // Number of dungeons
if (!dungeons.empty())
{
for (LfgDungeonSet::iterator it = dungeons.begin(); it != dungeons.end(); ++it)
{
LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(*it);
data << uint32(dungeon ? dungeon->Entry() : 0); // Dungeon
}
}
data << uint8(roleCheck.roles.size()); // Players in group
if (!roleCheck.roles.empty())
{
// Leader info MUST be sent 1st :S
uint64 guid = roleCheck.leader;
uint8 roles = roleCheck.roles.find(guid)->second;
data << uint64(guid); // Guid
data << uint8(roles > 0); // Ready
data << uint32(roles); // Roles
Player* player = ObjectAccessor::FindPlayer(guid);
data << uint8(player ? player->getLevel() : 0); // Level
for (LfgRolesMap::const_iterator it = roleCheck.roles.begin(); it != roleCheck.roles.end(); ++it)
{
if (it->first == roleCheck.leader)
continue;
guid = it->first;
roles = it->second;
data << uint64(guid); // Guid
data << uint8(roles > 0); // Ready
data << uint32(roles); // Roles
player = ObjectAccessor::FindPlayer(guid);
data << uint8(player ? player->getLevel() : 0);// Level
}
}
SendPacket(&data);
}
示例4: ConcatenateDungeons
std::string ConcatenateDungeons(LfgDungeonSet const& dungeons)
{
std::string dungeonstr = "";
if (!dungeons.empty())
{
std::ostringstream o;
LfgDungeonSet::const_iterator it = dungeons.begin();
o << (*it);
for (++it; it != dungeons.end(); ++it)
o << ", " << uint32(*it);
dungeonstr = o.str();
}
return dungeonstr;
}
示例5: CheckCompatibility
/**
Check compatibilities between groups. If group is Matched proposal will be created
@param[in] check List of guids to check compatibilities
@return LfgCompatibility type of compatibility
*/
LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
{
std::string strGuids = ConcatenateGuids(check);
LfgProposal proposal;
LfgDungeonSet proposalDungeons;
LfgGroupsMap proposalGroups;
LfgRolesMap proposalRoles;
// Check for correct size
if (check.size() > MAXGROUPSIZE || check.empty())
{
TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s): Size wrong - Not compatibles", strGuids.c_str());
return LFG_INCOMPATIBLES_WRONG_GROUP_SIZE;
}
// Check all-but-new compatiblitity
if (check.size() > 2)
{
uint64 frontGuid = check.front();
check.pop_front();
// Check all-but-new compatibilities (New, A, B, C, D) --> check(A, B, C, D)
LfgCompatibility child_compatibles = CheckCompatibility(check);
if (child_compatibles < LFG_COMPATIBLES_WITH_LESS_PLAYERS) // Group not compatible
{
TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) child %s not compatibles", strGuids.c_str(), ConcatenateGuids(check).c_str());
SetCompatibles(strGuids, child_compatibles);
return child_compatibles;
}
check.push_front(frontGuid);
}
// Check if more than one LFG group and number of players joining
uint8 numPlayers = 0;
uint8 numLfgGroups = 0;
for (LfgGuidList::const_iterator it = check.begin(); it != check.end() && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++it)
{
uint64 guid = (*it);
LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid);
if (itQueue == QueueDataStore.end())
{
TC_LOG_ERROR("lfg.queue.match.compatibility.check", "Guid: [" UI64FMTD "] is not queued but listed as queued!", guid);
RemoveFromQueue(guid);
return LFG_COMPATIBILITY_PENDING;
}
// Store group so we don't need to call Mgr to get it later (if it's player group will be 0 otherwise would have joined as group)
for (LfgRolesMap::const_iterator it2 = itQueue->second.roles.begin(); it2 != itQueue->second.roles.end(); ++it2)
proposalGroups[it2->first] = IS_GROUP_GUID(itQueue->first) ? itQueue->first : 0;
numPlayers += itQueue->second.roles.size();
if (sLFGMgr->IsLfgGroup(guid))
{
if (!numLfgGroups)
proposal.group = guid;
++numLfgGroups;
}
}
// Group with less that MAXGROUPSIZE members always compatible
if (check.size() == 1 && numPlayers != MAXGROUPSIZE)
{
TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) sigle group. Compatibles", strGuids.c_str());
LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(check.front());
LfgCompatibilityData data(LFG_COMPATIBLES_WITH_LESS_PLAYERS);
data.roles = itQueue->second.roles;
LFGMgr::CheckGroupRoles(data.roles);
UpdateBestCompatibleInQueue(itQueue, strGuids, data.roles);
SetCompatibilityData(strGuids, data);
return LFG_COMPATIBLES_WITH_LESS_PLAYERS;
}
if (numLfgGroups > 1)
{
TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) More than one Lfggroup (%u)", strGuids.c_str(), numLfgGroups);
SetCompatibles(strGuids, LFG_INCOMPATIBLES_MULTIPLE_LFG_GROUPS);
return LFG_INCOMPATIBLES_MULTIPLE_LFG_GROUPS;
}
if (numPlayers > MAXGROUPSIZE)
{
TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) Too much players (%u)", strGuids.c_str(), numPlayers);
SetCompatibles(strGuids, LFG_INCOMPATIBLES_TOO_MUCH_PLAYERS);
return LFG_INCOMPATIBLES_TOO_MUCH_PLAYERS;
}
// If it's single group no need to check for duplicate players, ignores, bad roles or bad dungeons as it's been checked before joining
if (check.size() > 1)
{
for (LfgGuidList::const_iterator it = check.begin(); it != check.end(); ++it)
{
//.........这里部分代码省略.........
示例6: SendLfgRoleCheckUpdate
void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck* pRoleCheck)
{
ASSERT(pRoleCheck);
LfgDungeonSet dungeons;
if (pRoleCheck->rDungeonId)
dungeons.insert(pRoleCheck->rDungeonId);
else
dungeons = pRoleCheck->dungeons;
ObjectGuid unkGuid = 0;
sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_ROLE_CHECK_UPDATE [" UI64FMTD "]", GetPlayer()->GetGUID());
WorldPacket data(SMSG_LFG_ROLE_CHECK_UPDATE, 4 + 1 + 1 + dungeons.size() * 4 + 1 + pRoleCheck->roles.size() * (8 + 1 + 4 + 1));
ByteBuffer dataBuffer;
data.WriteBit(unkGuid[0]);
data.WriteBit(unkGuid[1]);
data.WriteBit(unkGuid[6]);
data.WriteBits(pRoleCheck->roles.size(), 21);
if (!pRoleCheck->roles.empty())
{
ObjectGuid guid = pRoleCheck->leader;
uint8 roles = pRoleCheck->roles.find(guid)->second;
Player* player = ObjectAccessor::FindPlayer(guid);
data.WriteBit(guid[4]);
data.WriteBit(guid[1]);
data.WriteBit(guid[2]);
data.WriteBit(guid[6]);
data.WriteBit(roles > 0);
data.WriteBit(guid[5]);
data.WriteBit(guid[7]);
data.WriteBit(guid[0]);
data.WriteBit(guid[3]);
dataBuffer << uint32(roles); // Roles
dataBuffer.WriteByteSeq(guid[0]);
dataBuffer.WriteByteSeq(guid[2]);
dataBuffer.WriteByteSeq(guid[5]);
dataBuffer.WriteByteSeq(guid[4]);
dataBuffer.WriteByteSeq(guid[7]);
dataBuffer.WriteByteSeq(guid[6]);
dataBuffer.WriteByteSeq(guid[1]);
dataBuffer.WriteByteSeq(guid[3]);
dataBuffer << uint8(player ? player->getLevel() : 0); // Level
for (LfgRolesMap::const_reverse_iterator it = pRoleCheck->roles.rbegin(); it != pRoleCheck->roles.rend(); ++it)
{
if (it->first == pRoleCheck->leader)
continue;
guid = it->first;
roles = it->second;
player = ObjectAccessor::FindPlayer(guid);
data.WriteBit(guid[4]);
data.WriteBit(guid[1]);
data.WriteBit(guid[2]);
data.WriteBit(guid[6]);
data.WriteBit(roles > 0);
data.WriteBit(guid[5]);
data.WriteBit(guid[7]);
data.WriteBit(guid[0]);
data.WriteBit(guid[3]);
dataBuffer << uint32(roles); // Roles
dataBuffer.WriteByteSeq(guid[0]);
dataBuffer.WriteByteSeq(guid[2]);
dataBuffer.WriteByteSeq(guid[5]);
dataBuffer.WriteByteSeq(guid[4]);
dataBuffer.WriteByteSeq(guid[7]);
dataBuffer.WriteByteSeq(guid[6]);
dataBuffer.WriteByteSeq(guid[1]);
dataBuffer.WriteByteSeq(guid[3]);
dataBuffer << uint8(player ? player->getLevel() : 0); // Level
}
}
data.WriteBit(unkGuid[7]);
data.WriteBits(dungeons.size(), 22);
data.WriteBit(pRoleCheck->state == LFG_ROLECHECK_INITIALITING);
data.WriteBit(unkGuid[3]);
data.WriteBit(unkGuid[5]);
data.WriteBit(unkGuid[4]);
data.WriteBit(unkGuid[2]);
data.FlushBits();
data.append(dataBuffer);
data.WriteByteSeq(unkGuid[4]);
if (!dungeons.empty())
{
for (LfgDungeonSet::iterator it = dungeons.begin(); it != dungeons.end(); ++it)
{
LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(*it);
data << uint32(dungeon ? dungeon->Entry() : 0); // Dungeon
}
}
data.WriteByteSeq(unkGuid[6]);
data.WriteByteSeq(unkGuid[7]);
data.WriteByteSeq(unkGuid[0]);
//.........这里部分代码省略.........
示例7: JoinProposal
bool LfgJoinAction::JoinProposal()
{
ItemCountByQuality visitor;
IterateItems(&visitor, ITERATE_ITEMS_IN_EQUIP);
bool heroic = urand(0, 100) < 50 && (visitor.count[ITEM_QUALITY_EPIC] >= 3 || visitor.count[ITEM_QUALITY_RARE] >= 10) && bot->getLevel() >= 70;
bool random = urand(0, 100) < 25;
bool raid = !heroic && (urand(0, 100) < 50 && visitor.count[ITEM_QUALITY_EPIC] >= 5 && (bot->getLevel() == 60 || bot->getLevel() == 70 || bot->getLevel() == 80));
LfgDungeonSet list;
vector<uint32> idx;
for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i)
{
LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(i);
if (!dungeon || (dungeon->type != LFG_TYPE_RANDOM && dungeon->type != LFG_TYPE_DUNGEON && dungeon->type != LFG_TYPE_HEROIC &&
dungeon->type != LFG_TYPE_RAID))
continue;
int botLevel = (int)bot->getLevel();
if (dungeon->minlevel && botLevel < (int)dungeon->minlevel)
continue;
if (dungeon->minlevel && botLevel > (int)dungeon->minlevel + 10)
continue;
if (dungeon->maxlevel && botLevel > (int)dungeon->maxlevel)
continue;
if (heroic && !dungeon->difficulty)
continue;
if (raid && dungeon->type != LFG_TYPE_RAID)
continue;
if (random && dungeon->type != LFG_TYPE_RANDOM)
continue;
if (!random && !raid && !heroic && dungeon->type != LFG_TYPE_DUNGEON)
continue;
if (!random)
list.insert(dungeon->ID);
else
idx.push_back(dungeon->ID);
}
if (list.empty())
return false;
uint8 roles = GetRoles();
if (random)
{
list.insert(idx[urand(0, idx.size() - 1)]);
sLFGMgr->JoinLfg(bot, roles, list, "bot");
sLog->outMessage("playerbot", LOG_LEVEL_DEBUG, "Bot %s joined to LFG_TYPE_RANDOM as %d", bot->GetName().c_str(), (uint32)roles);
return true;
}
else if (heroic)
{
sLog->outMessage("playerbot", LOG_LEVEL_DEBUG, "Bot %s joined to LFG_TYPE_HEROIC_DUNGEON as %d", bot->GetName().c_str(), (uint32)roles);
}
else if (raid)
{
sLog->outMessage("playerbot", LOG_LEVEL_DEBUG, "Bot %s joined to LFG_TYPE_RAID as %d", bot->GetName().c_str(), (uint32)roles);
}
else
{
sLog->outMessage("playerbot", LOG_LEVEL_DEBUG, "Bot %s joined to LFG_TYPE_DUNGEON as %d", bot->GetName().c_str(), (uint32)roles);
}
sLFGMgr->JoinLfg(bot, roles, list, "bot");
return true;
}