当前位置: 首页>>代码示例>>C++>>正文


C++ LfgDungeonSet::insert方法代码示例

本文整理汇总了C++中LfgDungeonSet::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ LfgDungeonSet::insert方法的具体用法?C++ LfgDungeonSet::insert怎么用?C++ LfgDungeonSet::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LfgDungeonSet的用法示例。


在下文中一共展示了LfgDungeonSet::insert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
开发者ID:AriDEV,项目名称:AscEmu,代码行数:55,代码来源:LfgHandler.cpp

示例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);
}
开发者ID:hodobaj,项目名称:ArkCORE,代码行数:52,代码来源:LFGHandler.cpp

示例3: GetRandomDungeons

/// <summary>
/// Get the random dungeon list that can be done at a certain level and expansion.
/// </summary>
/// <param name="level">Player level</param>
/// <param name="expansion">Player account expansion</param>
/// <returns>LfgDungeonSet*</returns>
LfgDungeonSet* LFGMgr::GetRandomDungeons(uint8 level, uint8 expansion)
{
    LfgDungeonSet *list = new LfgDungeonSet();
    LFGDungeonEntry const *dungeon;
    for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i)
    {
        dungeon = sLFGDungeonStore.LookupEntry(i);
        if (dungeon && dungeon->expansion <= expansion && dungeon->type == LFG_TYPE_RANDOM &&
            dungeon->minlevel <= level && level <= dungeon->maxlevel)
            list->insert(dungeon->Entry());
    }
    return list;
}
开发者ID:Rhyuk,项目名称:Dev,代码行数:19,代码来源:LFGMgr.cpp

示例4: 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);
}
开发者ID:8Infinity8,项目名称:InfinityCore,代码行数:51,代码来源:LFGHandler.cpp

示例5: HandleLfgJoinOpcode

void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData)
{
    if (!sLFGMgr.isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER) ||
        (_player->GetGroup() && _player->GetGroup()->GetLeaderGuid() != _player->GetObjectGuid() &&
        (_player->GetGroup()->GetMembersCount() == MAX_GROUP_SIZE || !_player->GetGroup()->isLFGGroup())))
    {
        recvData.rfinish();
        return;
    }

    std::string comment;
    uint32 commentSize;
    uint32 numDungeons;
    uint32 roles;

    recvData >> roles;

    for (uint8 i = 0; i < 3; ++i)
    {
        recvData.read_skip<uint32>();
    }

    commentSize = recvData.ReadBits(9);
    numDungeons = recvData.ReadBits(24);
    if (!numDungeons)
    {
        sLog.outDebug("CMSG_LFG_JOIN %s no dungeons selected", _player->GetGuidStr().c_str());
        recvData.rfinish();
        return;
    }

    comment = recvData.ReadString(commentSize);

    LfgDungeonSet newDungeons;
    for (uint32 i = 0; i < numDungeons; ++i)
    {
        uint32 dungeon;
        recvData >> dungeon;
        newDungeons.insert((dungeon & 0x00FFFFFF));        // remove the type from the dungeon entry
    }

    sLog.outDebug("CMSG_LFG_JOIN %s roles: %u, Dungeons: %u, Comment: %s",
        _player->GetGuidStr().c_str(), roles, uint8(newDungeons.size()), comment.c_str());

    sLFGMgr.JoinLfg(_player, uint8(roles), newDungeons, comment);
}
开发者ID:Calixa,项目名称:murlocs_434,代码行数:46,代码来源:LFGHandler.cpp

示例6: GetAllDungeons

/// <summary>
/// Get the dungeon list that can be done.
/// </summary>
/// <returns>LfgDungeonSet*</returns>
LfgDungeonSet* LFGMgr::GetAllDungeons()
{
    LfgDungeonSet *dungeons = new LfgDungeonSet();
    LFGDungeonEntry const *dungeon;
    for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i)
    {
        dungeon = sLFGDungeonStore.LookupEntry(i);
        if (!dungeon || dungeon->type == LFG_TYPE_ZONE)
            continue;
        dungeons->insert(dungeon->ID);
    }
    if (!dungeons->size())
    {
        delete dungeons;
        return NULL;
    }
    else
        return dungeons;
}
开发者ID:Rhyuk,项目名称:Dev,代码行数:23,代码来源:LFGMgr.cpp

示例7: HandleLfgJoinOpcode

void WorldSession::HandleLfgJoinOpcode(WorldPacket& recv_data)
{
    Log.Debug("LfgHandler", "CMSG_LFG_JOIN");

    if ((GetPlayer()->GetGroup() && GetPlayer()->GetGroup()->GetLeader()->guid != GetPlayer()->GetGUID() && (GetPlayer()->GetGroup()->MemberCount() == 5 || !GetPlayer()->GetGroup()->isLFGGroup())))
    {
        Log.Debug("LfgHandler", "Unable to JoinQueue");

        recv_data.clear();
        return;
    }

    uint8 numDungeons;
    uint32 dungeon;
    uint32 roles;

    recv_data >> roles;
    recv_data.read<uint16>();                        // uint8 (always 0) - uint8 (always 0)
    recv_data >> numDungeons;

    if (!numDungeons)
    {
        Log.Debug("LfgHandler", "CMSG_LFG_JOIN no dungeons selected", GetPlayer()->GetGUID());
        recv_data.clear();
        return;
    }

    LfgDungeonSet newDungeons;
    for (int8 i = 0; i < numDungeons; ++i)
    {
        recv_data >> dungeon;
        newDungeons.insert((dungeon & 0x00FFFFFF));       // remove the type from the dungeon entry
    }

    recv_data.read<uint32>();                        // for 0..uint8 (always 3) { uint8 (always 0) }

    std::string comment;
    recv_data >> comment;
    Log.Debug("LfgHandler", "CMSG_LFG_JOIN: %s, roles: %u, Dungeons: %u, Comment: %s", GetPlayer()->GetName(), roles, uint8(newDungeons.size()), comment.c_str());
    sLfgMgr.Join(GetPlayer(), uint8(roles), newDungeons, comment);
}
开发者ID:AriDEV,项目名称:AscEmu,代码行数:41,代码来源:LfgHandler.cpp

示例8: HandleLfgJoinOpcode

void WorldSession::HandleLfgJoinOpcode(WorldPacket& recv_data)
{
    if (!sWorld->getBoolConfig(CONFIG_DUNGEON_FINDER_ENABLE) ||
            (GetPlayer()->GetGroup() && GetPlayer()->GetGroup()->GetLeaderGUID() != GetPlayer()->GetGUID() &&
             (GetPlayer()->GetGroup()->GetMembersCount() == MAXGROUPSIZE || !GetPlayer()->GetGroup()->isLFGGroup())))
    {
        recv_data.rfinish();
        return;
    }

    uint8 numDungeons;
    uint32 dungeon;
    uint32 roles;

    recv_data >> roles;
    recv_data.read_skip<uint16>();                        // uint8 (always 0) - uint8 (always 0)
    recv_data >> numDungeons;
    if (!numDungeons)
    {
        sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_JOIN [" UI64FMTD "] no dungeons selected", GetPlayer()->GetGUID());
        recv_data.rfinish();
        return;
    }

    LfgDungeonSet newDungeons;
    for (int8 i = 0 ; i < numDungeons; ++i)
    {
        recv_data >> dungeon;
        newDungeons.insert((dungeon & 0x00FFFFFF));       // remove the type from the dungeon entry
    }

    recv_data.read_skip<uint32>();                        // for 0..uint8 (always 3) { uint8 (always 0) }

    std::string comment;
    recv_data >> comment;
    sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_JOIN [" UI64FMTD "] roles: %u, Dungeons: %u, Comment: %s", GetPlayer()->GetGUID(), roles, uint8(newDungeons.size()), comment.c_str());
    sLFGMgr->Join(GetPlayer(), uint8(roles), newDungeons, comment);
}
开发者ID:Gosa1979,项目名称:ArkCORE2,代码行数:38,代码来源:LFGHandler.cpp

示例9: GetDungeonsByRandom

/// <summary>
/// Get the dungeon list that can be done given a random dungeon entry.
/// </summary>
/// <param name="randomdungeon">Random dungeon entry</param>
/// <returns>LfgDungeonSet*</returns>
LfgDungeonSet* LFGMgr::GetDungeonsByRandom(uint32 randomdungeon)
{
    LFGDungeonEntry const *dungeon = sLFGDungeonStore.LookupEntry(randomdungeon);
    if (!dungeon)
        return NULL;

    uint32 grouptype = dungeon->grouptype;
    LfgDungeonSet *random = new LfgDungeonSet();
    for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i)
    {
        dungeon = sLFGDungeonStore.LookupEntry(i);
        if (!dungeon || dungeon->type == LFG_TYPE_RANDOM || dungeon->grouptype != grouptype)
            continue;
        random->insert(dungeon->ID);
    }
    if (!random->size())
    {
        delete random;
        return NULL;
    }
    else
        return random;
}
开发者ID:Rhyuk,项目名称:Dev,代码行数:28,代码来源:LFGMgr.cpp

示例10: 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;
}
开发者ID:mynew3,项目名称:LordPsyanBots,代码行数:73,代码来源:LfgActions.cpp

示例11: HandleLfgPlayerLockInfoRequestOpcode

void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recv_data*/)
{
    uint64 guid = GetPlayer()->GetGUID();
    sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFD_PLAYER_LOCK_INFO_REQUEST [" UI64FMTD "]", guid);

    // Get Random dungeons that can be done at a certain level and expansion
    // FIXME - Should return seasonals (when not disabled)
    LfgDungeonSet randomDungeons;
    uint8 level = GetPlayer()->getLevel();
    uint8 expansion = GetPlayer()->GetSession()->Expansion();
    for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i)
    {
        LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(i);
        if (dungeon && dungeon->type == LFG_TYPE_RANDOM && dungeon->expansion <= expansion &&
                dungeon->minlevel <= level && level <= dungeon->maxlevel)
            randomDungeons.insert(dungeon->Entry());
    }

    // Get player locked Dungeons
    LfgLockMap lock = sLFGMgr->GetLockedDungeons(guid);
    uint32 rsize = uint32(randomDungeons.size());
    uint32 lsize = uint32(lock.size());

    sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_PLAYER_INFO [" UI64FMTD "]", guid);
    WorldPacket data(SMSG_LFG_PLAYER_INFO, 1 + rsize * (4 + 1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4) + 4 + lsize * (1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4));

    data << uint8(randomDungeons.size());                  // Random Dungeon count
    for (LfgDungeonSet::const_iterator it = randomDungeons.begin(); it != randomDungeons.end(); ++it)
    {
        data << uint32(*it);                               // Dungeon Entry (id + type)
        LfgReward const* reward = sLFGMgr->GetRandomDungeonReward(*it, level);
        Quest const* qRew = NULL;
        uint8 done = 0;
        if (reward)
        {
            qRew = sObjectMgr->GetQuestTemplate(reward->reward[0].questId);
            if (qRew)
            {
                done = !GetPlayer()->CanRewardQuest(qRew, false);
                if (done)
                    qRew = sObjectMgr->GetQuestTemplate(reward->reward[1].questId);
            }
        }
        if (qRew)
        {
            data << uint8(done);
            data << uint32(qRew->GetRewOrReqMoney());
            data << uint32(qRew->XPValue(GetPlayer()));
            data << uint32(reward->reward[done].variableMoney);
            data << uint32(reward->reward[done].variableXP);
            data << uint8(qRew->GetRewItemsCount());
            if (qRew->GetRewItemsCount())
            {
                ItemTemplate const* iProto = NULL;
                for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
                {
                    if (!qRew->RewItemId[i])
                        continue;

                    iProto = sObjectMgr->GetItemTemplate(qRew->RewItemId[i]);

                    data << uint32(qRew->RewItemId[i]);
                    data << uint32(iProto ? iProto->DisplayInfoID : 0);
                    data << uint32(qRew->RewItemCount[i]);
                }
            }
        }
        else
        {
            data << uint8(0);
            data << uint32(0);
            data << uint32(0);
            data << uint32(0);
            data << uint32(0);
            data << uint8(0);
        }
    }
    BuildPlayerLockDungeonBlock(data, lock);
    SendPacket(&data);
}
开发者ID:Gosa1979,项目名称:ArkCORE2,代码行数:80,代码来源:LFGHandler.cpp

示例12: HandleLfgPlayerLockInfoRequestOpcode

void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData*/)
{
    ObjectGuid guid = _player->GetObjectGuid();
    sLog.outDebug( "CMSG_LFG_PLAYER_LOCK_INFO_REQUEST %s",
        guid.GetString().c_str());

    // Get Random dungeons that can be done at a certain level and expansion
    LfgDungeonSet randomDungeons;
    uint8 level = _player->getLevel();
    uint8 expansion = _player->GetSession()->Expansion();

    LFGDungeonContainer& LfgDungeons = sLFGMgr.GetLFGDungeonMap();
    for (LFGDungeonContainer::const_iterator itr = LfgDungeons.begin(); itr != LfgDungeons.end(); ++itr)
    {
        LFGDungeonData const& dungeon = itr->second;
        if ((dungeon.type == LFG_TYPE_RANDOM || (dungeon.seasonal && sLFGMgr.IsSeasonActive(dungeon.id)))
            && dungeon.expansion <= expansion && dungeon.minlevel <= level && level <= dungeon.maxlevel)
            randomDungeons.insert(dungeon.Entry());
    }

    // Get player locked Dungeons
    LfgLockMap const& lock = sLFGMgr.GetLockedDungeons(guid);
    uint32 rsize = uint32(randomDungeons.size());
    uint32 lsize = uint32(lock.size());

    sLog.outDebug("SMSG_LFG_PLAYER_INFO %s", _player->GetGuidStr().c_str());
    WorldPacket data(SMSG_LFG_PLAYER_INFO, 1 + rsize * (4 + 1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4) + 4 + lsize * (1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4));

    data << uint8(randomDungeons.size());                  // Random Dungeon count
    for (LfgDungeonSet::const_iterator it = randomDungeons.begin(); it != randomDungeons.end(); ++it)
    {
        data << uint32(*it);                               // Dungeon Entry (id + type)
        LfgReward const* reward = sLFGMgr.GetRandomDungeonReward(*it, level);
        Quest const* quest = NULL;
        bool done = false;
        if (reward)
        {
            quest = sObjectMgr.GetQuestTemplate(reward->firstQuest);
            if (quest)
            {
                done = !_player->CanRewardQuest(quest, false);
                if (done)
                    quest = sObjectMgr.GetQuestTemplate(reward->otherQuest);
            }
        }

        if (quest)
        {
            data << uint8(done);
            data << uint32(500); // Times precision
            data << uint32(500); // Available times per week

            data << uint32(396); // Unknown 4.3.4
            data << uint32(0); // Unknown 4.3.4

            data << uint32(100000); // Unknown 4.3.4
            data << uint32(0); // Unknown 4.3.4
            data << uint32(0); // Unknown 4.3.4
            data << uint32(0); // Unknown 4.3.4
            data << uint32(100000); // Unknown 4.3.4
            data << uint32(70000); // Unknown 4.3.4
            data << uint32(80000); // Unknown 4.3.4

            data << uint32(90000); // Unknown 4.3.4
            data << uint32(50000); // isComplited

            data << uint8(100); // seasonal ?
            {
                for (uint8 i = 0; i < 3; ++i) // 3 - Max roles ?
                {
                    uint8 callToArmsRoleMask = 0; // TODO Call to arms role check (LfgRoles) Not implemented
                    data << uint32(callToArmsRoleMask);
                    if (callToArmsRoleMask > 0)
                    {
                        /* Call to Arms bonus*/

                        data << uint32(0); // Call to arms Money
                        data << uint32(0); // Call to arms XP

                        uint8 totalRewardCount = uint8(quest->GetRewCurrencyCount() + quest->GetRewItemsCount());
                        if (totalRewardCount > 16)
                            totalRewardCount = 16;

                        data << uint8(totalRewardCount);
                        if (totalRewardCount)
                        {
                            for (uint8 j = 0; j < QUEST_REWARD_CURRENCY_COUNT; ++j)
                            {
                                uint32 id = quest->RewCurrencyId[j];
                                if (!id)
                                    continue;

                                uint32 amount = quest->RewCurrencyCount[j];
                                if (CurrencyTypesEntry const* currency = sCurrencyTypesStore.LookupEntry(id))
                                    amount *= currency->GetPrecision();

                                data << uint32(id);
                                data << uint32(0);
                                data << uint32(amount);
                                data << uint8(true); // Is currency
//.........这里部分代码省略.........
开发者ID:Calixa,项目名称:murlocs_434,代码行数:101,代码来源:LFGHandler.cpp

示例13: HandleLfgJoinOpcode

void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData)
{
    uint32 numDungeons;
    uint32 dungeon;
    uint32 roles;
    uint8 length = 0;
    uint8 unk8 = 0;
    bool unkbit = false;

    recvData >> unk8;

    for (int i = 0; i < 3; ++i)
        recvData.read_skip<uint32>();

    recvData >> roles;

    numDungeons = recvData.ReadBits(22);
    length = recvData.ReadBits(8);
    unkbit = recvData.ReadBit();

    recvData.FlushBits();

    if (!numDungeons)
    {
        sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_JOIN [" UI64FMTD "] no dungeons selected", GetPlayer()->GetGUID());
        recvData.rfinish();
        return;
    }

    std::string comment = recvData.ReadString(length);

    LfgDungeonSet newDungeons;
    for (uint32 i = 0; i < numDungeons; ++i)
    {
        recvData >> dungeon;
        dungeon &= 0xFFFFFF;
        newDungeons.insert(dungeon);       // remove the type from the dungeon entry
    }

    const LFGDungeonEntry* entry = sLFGDungeonStore.LookupEntry(*newDungeons.begin() & 0xFFFFFF);
    uint8 type = TYPEID_DUNGEON;
    uint8 maxGroupSize = 5;
    if (entry != NULL)
        type = entry->type;

    if (type == LFG_SUBTYPEID_RAID)
        maxGroupSize = 25;
    if (type == LFG_SUBTYPEID_SCENARIO)
        maxGroupSize = 3;

    if (!sWorld->getBoolConfig(CONFIG_DUNGEON_FINDER_ENABLE) ||
        (GetPlayer()->GetGroup() && GetPlayer()->GetGroup()->GetLeaderGUID() != GetPlayer()->GetGUID() &&
        (GetPlayer()->GetGroup()->GetMembersCount() == maxGroupSize || !GetPlayer()->GetGroup()->isLFGGroup())))
    {
        recvData.rfinish();
        return;
    }

    sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_JOIN [" UI64FMTD "] roles: %u, Dungeons: %u, Comment: %s", GetPlayer()->GetGUID(), roles, uint8(newDungeons.size()), comment.c_str());
    sLFGMgr->Join(GetPlayer(), uint8(roles), newDungeons, comment);
}
开发者ID:Expery,项目名称:Core,代码行数:61,代码来源:LFGHandler.cpp

示例14: HandleLfgLockInfoRequestOpcode

void WorldSession::HandleLfgLockInfoRequestOpcode(WorldPacket& recvData)
{
    uint8 value;
    bool groupPacket;

    recvData >> value;
    groupPacket = recvData.ReadBit();

    ObjectGuid guid = GetPlayer()->GetGUID();

    // Get Random dungeons that can be done at a certain level and expansion
    LfgDungeonSet randomDungeons;
    uint8 level = GetPlayer()->getLevel();
    uint8 expansion = GetPlayer()->GetSession()->Expansion();
    for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i)
    {
        LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(i);
        if (dungeon && dungeon->expansion <= expansion && dungeon->minlevel <= level && level <= dungeon->maxlevel)
        {
            if (dungeon->flags & LFG_FLAG_SEASONAL)
            {
                if (HolidayIds holiday = sLFGMgr->GetDungeonSeason(dungeon->ID))
                    if (holiday == HOLIDAY_WOTLK_LAUNCH || !IsHolidayActive(holiday))
                        continue;
            }
            else if (dungeon->type != TYPEID_RANDOM_DUNGEON)
                continue;

            randomDungeons.insert(dungeon->Entry());
        }
    }

    // Get player locked Dungeons
    LfgLockMap lock = sLFGMgr->GetLockedDungeons(guid);

    uint32 rsize = uint32(randomDungeons.size());
    uint32 lsize = uint32(lock.size());

    WorldPacket data(SMSG_LFG_PLAYER_INFO, 1 + rsize * (4 + 1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4) + 4 + lsize * (1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4));

    bool hasGuid = true;
    data.WriteBit(hasGuid);
    if (hasGuid)
    {
        uint8 bitOrder[8] = { 0, 6, 7, 5, 2, 4, 1, 3 };
        data.WriteBitInOrder(guid, bitOrder);
    }

    data.WriteBits(randomDungeons.size(), 17);

    for (LfgDungeonSet::const_iterator it = randomDungeons.begin(); it != randomDungeons.end(); ++it)
    {
        LfgReward const* reward = sLFGMgr->GetRandomDungeonReward(*it, level);
        Quest const* qRew = NULL;

        bool done = false;
        if (reward)
        {
            qRew = sObjectMgr->GetQuestTemplate(reward->reward[0].questId);
            if (qRew)
            {
                done = !GetPlayer()->CanRewardQuest(qRew, false);
                if (done)
                    qRew = sObjectMgr->GetQuestTemplate(reward->reward[1].questId);
            }
        }

        data.WriteBits(0, 21); // Unk count
        data.WriteBits(qRew ? qRew->GetRewCurrencyCount() : 0, 21);
        data.WriteBits(0, 19); // Unk count 2 - related to call to Arms

        data.WriteBit(!done);
        data.WriteBit(0); // some bit
        data.WriteBits(qRew ? qRew->GetRewItemsCount() : 0, 20);
    }

    data.WriteBits(lock.size(), 20);

    for (LfgDungeonSet::const_iterator it = randomDungeons.begin(); it != randomDungeons.end(); ++it)
    {
        LfgReward const* reward = sLFGMgr->GetRandomDungeonReward(*it, level);
        Quest const* qRew = NULL;
        uint8 done = 0;
        if (reward)
        {
            qRew = sObjectMgr->GetQuestTemplate(reward->reward[0].questId);
            if (qRew)
            {
                done = !GetPlayer()->CanRewardQuest(qRew, false);
                if (done)
                    qRew = sObjectMgr->GetQuestTemplate(reward->reward[1].questId);
            }
        }

        data << uint32(0); // 11
        data << uint32(0); // 12

        data << uint32(0); // 15
        data << uint32(0); // 16
        data << uint32(0); // 17
//.........这里部分代码省略.........
开发者ID:Expery,项目名称:Core,代码行数:101,代码来源:LFGHandler.cpp

示例15: HandleLfgPlayerLockInfoRequestOpcode

void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData*/)
{
    uint64 guid = GetPlayer()->GetGUID();
    sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_PLAYER_LOCK_INFO_REQUEST %s",
        GetPlayerInfo().c_str());

    // Get Random dungeons that can be done at a certain level and expansion
    LfgDungeonSet randomDungeons;
    uint8 level = GetPlayer()->getLevel();
    uint8 expansion = GetPlayer()->GetSession()->Expansion();

    LFGDungeonContainer& LfgDungeons = sLFGMgr->GetLFGDungeonMap();
    for (LFGDungeonContainer::const_iterator itr = LfgDungeons.begin(); itr != LfgDungeons.end(); ++itr)
    {
        LFGDungeonData const& dungeon = itr->second;
        if ((dungeon.type == LFG_TYPE_RANDOM || (dungeon.seasonal && sLFGMgr->IsSeasonActive(dungeon.id)))
            && dungeon.expansion <= expansion && dungeon.minlevel <= level && level <= dungeon.maxlevel)
            randomDungeons.insert(dungeon.Entry());
    }

    // Get player locked Dungeons
    LfgLockMap const& lock = sLFGMgr->GetLockedDungeons(guid);
    uint32 rsize = uint32(randomDungeons.size());
    uint32 lsize = uint32(lock.size());

    sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PLAYER_INFO %s", GetPlayerInfo().c_str());
    WorldPacket data(SMSG_LFG_PLAYER_INFO, 1 + rsize * (4 + 1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4) + 4 + lsize * (1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4));

    data << uint8(randomDungeons.size());                  // Random Dungeon count
    for (LfgDungeonSet::const_iterator it = randomDungeons.begin(); it != randomDungeons.end(); ++it)
    {
        data << uint32(*it);                               // Dungeon Entry (id + type)
        LfgReward const* reward = sLFGMgr->GetRandomDungeonReward(*it, level);
        Quest const* quest = NULL;
        uint8 done = 0;
        if (reward)
        {
            quest = sObjectMgr->GetQuestTemplate(reward->reward[0].questId);
            if (quest)
            {
                done = !GetPlayer()->CanRewardQuest(quest, false);
                if (done)
                    quest = sObjectMgr->GetQuestTemplate(reward->reward[1].questId);
            }
        }

        if (quest)
        {
            data << uint8(done);
            data << uint32(quest->GetRewOrReqMoney());
            data << uint32(quest->XPValue(GetPlayer()));
            data << uint32(reward->reward[done].variableMoney);
            data << uint32(reward->reward[done].variableXP);
            data << uint8(quest->GetRewItemsCount());
            if (quest->GetRewItemsCount())
            {
                for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
                    if (uint32 itemId = quest->RewardItemId[i])
                    {
                        ItemTemplate const* item = sObjectMgr->GetItemTemplate(itemId);
                        data << uint32(itemId);
                        data << uint32(item ? item->DisplayInfoID : 0);
                        data << uint32(quest->RewardItemIdCount[i]);
                    }
            }
        }
        else
        {
            data << uint8(0);
            data << uint32(0);
            data << uint32(0);
            data << uint32(0);
            data << uint32(0);
            data << uint8(0);
        }
    }
    BuildPlayerLockDungeonBlock(data, lock);
    SendPacket(&data);
}
开发者ID:8Infinity8,项目名称:InfinityCore,代码行数:79,代码来源:LFGHandler.cpp


注:本文中的LfgDungeonSet::insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。