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


C++ GuidSet类代码示例

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


在下文中一共展示了GuidSet类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AddOutOfRangeGUID

void UpdateData::AddOutOfRangeGUID(GuidSet& guids)
{
    m_outOfRangeGUIDs.insert(guids.begin(), guids.end());
}
开发者ID:HerrTrigger,项目名称:mangos-wotlk,代码行数:4,代码来源:UpdateData.cpp

示例2: DEBUG_LOG

void WorldSession::SendLfgUpdateProposal(LFGProposal* pProposal)
{
    if (!sWorld.getConfig(CONFIG_BOOL_LFG_ENABLE))
    {
        DEBUG_LOG("SendLfgUpdateProposal %u failed - Dungeon finder disabled", GetPlayer()->GetObjectGuid().GetCounter());
        return;
    }

    if (!pProposal)
        return;

    LFGDungeonEntry const* dungeon = pProposal->GetDungeon();
    if (!dungeon)
    {
        DEBUG_LOG("SMSG_LFG_PROPOSAL_UPDATE: no dungeon in proposal %u, returning.", pProposal->m_uiID);
        return;
    }

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

    bool isSameDungeon = false;
    bool isSameGroup   = false;

    uint32 completedEncounters = 0;
    LFGRolesMap rolesMap;

    if (Group* group = pProposal->GetGroup())
    {
        for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
        {
            Player* pGroupMember = itr->getSource();
            if (pGroupMember && pGroupMember->IsInWorld())
            {
                rolesMap.insert(std::make_pair(pGroupMember->GetObjectGuid(), pGroupMember->GetLFGPlayerState()->GetRoles()));

                if (InstancePlayerBind* bind = pGroupMember->GetBoundInstance(dungeon->map, Difficulty(dungeon->difficulty)))
                {
                    if (DungeonPersistentState* state = bind->state)
                        completedEncounters |= state->GetCompletedEncountersMask();
                }
            }
        }

        // isContinue = group->isLFGGroup() && sLFGMgr->GetState(gguid) != LFG_STATE_FINISHED_DUNGEON;
        isSameDungeon =  dungeon->map == GetPlayer()->GetMapId();
        isSameGroup   =  GetPlayer()->GetGroup() == group;
    }

    GuidSet const proposalGuids = pProposal->GetMembers();
    if (!proposalGuids.empty())
    {
        for (GuidSet::const_iterator itr = proposalGuids.begin(); itr != proposalGuids.end(); ++itr)
        {
            Player* player = sObjectMgr.GetPlayer(*itr);
            if (player && player->IsInWorld())
                rolesMap.insert(std::make_pair(player->GetObjectGuid(), player->GetLFGPlayerState()->GetRoles()));
        }
    }

    uint32 size = rolesMap.size();

    DEBUG_LOG("SMSG_LFG_PROPOSAL_UPDATE proposal %u, player %u, state: %u", pProposal->m_uiID, GetPlayer()->GetObjectGuid().GetCounter(), pProposal->GetState());


    WorldPacket data(SMSG_LFG_PROPOSAL_UPDATE, 4 + 1 + 4 + 4 + 1 + 1 + size * (4 + 1 + 1 + 1 + 1 +1));

    data << uint32(dungeon->Entry());                          // Dungeon
    data << uint8(pProposal->GetState());                      // Result state
    data << uint32(pProposal->m_uiID);                         // Internal Proposal ID
    data << uint32(completedEncounters);                       // Bosses killed
    data << uint8(isSameDungeon);                              // Silent (show client window)
    data << uint8(size);                                       // Group size

    for (LFGRolesMap::const_iterator itr = rolesMap.begin(); itr != rolesMap.end(); ++itr)
    {
        Player* pPlayer = sObjectMgr.GetPlayer(itr->first);
        if (!pPlayer)
            continue;

        isSameDungeon =  dungeon->map == pPlayer->GetMapId();
        isSameGroup   =  pPlayer->GetGroup() == pProposal->GetGroup();

        data << uint32(itr->second);                              // Role
        data << uint8(pPlayer->GetObjectGuid() == guid);          // Self player
        data << uint8(isSameDungeon);                             // Not in dungeon
        data << uint8(isSameGroup);                               // Not same group
        data << uint8(pPlayer->GetLFGPlayerState()->GetAnswer() != LFG_ANSWER_PENDING); // Answered
        data << uint8(pPlayer->GetLFGPlayerState()->GetAnswer() == LFG_ANSWER_AGREE); // Accepted
    }
    SendPacket(&data);
}
开发者ID:BACKUPLIB,项目名称:Infinity_MaNGOS,代码行数:91,代码来源:LFGHandler.cpp

示例3: UpdateEscortAI

    void UpdateEscortAI(const uint32 uiDiff) override
    {
        if (!m_pInstance)
            return;

        if (m_pInstance->GetData(TYPE_RING_OF_LAW) == FAIL)
        {
            // Reset Doors
            if (m_uiEventPhase >= 10)                       // North Gate is opened
            {
                m_pInstance->DoUseDoorOrButton(GO_ARENA_2);
                m_pInstance->DoUseDoorOrButton(GO_ARENA_4);
            }
            else if (m_uiEventPhase >= 4)                   // East Gate is opened
            {
                m_pInstance->DoUseDoorOrButton(GO_ARENA_1);
                m_pInstance->DoUseDoorOrButton(GO_ARENA_4);
            }

            // Despawn Summoned Mobs
            for (GuidList::const_iterator itr = m_lSummonedGUIDList.begin(); itr != m_lSummonedGUIDList.end(); ++itr)
            {
                if (Creature* pSummoned = m_creature->GetMap()->GetCreature(*itr))
                    pSummoned->ForcedDespawn();
            }
            m_lSummonedGUIDList.clear();

            // Despawn NPC
            m_creature->ForcedDespawn();
            return;
        }

        if (m_uiEventTimer)
        {
            if (m_uiEventTimer <= uiDiff)
            {
                switch (m_uiEventPhase)
                {
                    case 0:
                        // Shortly after spawn, start walking
                        m_creature->CastSpell(m_creature, SPELL_ASHCROMBES_TELEPORT_A, true);
                        DoScriptText(SAY_START_2, m_creature);
                        m_pInstance->DoUseDoorOrButton(GO_ARENA_4);
                        // Some of the NPCs in the crowd do cheer emote at event start
                        // we randomly select 25% of the NPCs to do this
                        m_pInstance->GetArenaCrowdGuid(m_lArenaCrowd);
                        for (GuidSet::const_iterator itr = m_lArenaCrowd.begin(); itr != m_lArenaCrowd.end(); ++itr)
                        {
                            if (Creature* pSpectator = m_creature->GetMap()->GetCreature(*itr))
                            {
                                if (urand(0, 1) < 0.25)
                                    pSpectator->HandleEmote(EMOTE_ONESHOT_CHEER);
                            }
                        }
                        Start(false);
                        SetEscortPaused(false);
                        m_uiEventTimer = 0;
                        break;
                    case 1:
                        // Start walking towards wall
                        SetEscortPaused(false);
                        m_uiEventTimer = 0;
                        break;
                    case 2:
                        m_uiEventTimer = 2000;
                        break;
                    case 3:
                        // Open East Gate
                        m_creature->CastSpell(m_creature, SPELL_ARENA_FLASH_A, true);
                        m_creature->CastSpell(m_creature, SPELL_ARENA_FLASH_B, true);
                        m_pInstance->DoUseDoorOrButton(GO_ARENA_1);
                        m_uiEventTimer = 3000;
                        break;
                    case 4:
                        // timer for teleport out spell which has 2000 ms cast time
                        m_creature->CastSpell(m_creature, SPELL_ASHCROMBES_TELEPORT_B, true);
                        m_uiEventTimer = 2500;
                        break;
                    case 5:
                        m_creature->SetVisibility(VISIBILITY_OFF);
                        SetEscortPaused(false);
                        // Summon Ring Mob(s)
                        SummonRingMob(aRingMob[m_uiMobSpawnId], POS_EAST);
                        m_uiEventTimer = 8000;
                        break;
                    case 6:
                        // Summon Ring Mob(s)
                        SummonRingMob(aRingMob[m_uiMobSpawnId], POS_EAST);
                        SummonRingMob(aRingMob[m_uiMobSpawnId], POS_EAST);
                        m_uiEventTimer = 8000;
                        break;
                    case 7:
                        // Summon Ring Mob(s)
                        SummonRingMob(aRingMob[m_uiMobSpawnId], POS_EAST);
                        m_uiEventTimer = 0;
                        break;
                    case 8:
                        // Summoned Mobs are dead, continue event
                        DoScriptText(SAY_SUMMON_BOSS_2, m_creature);
                        m_creature->SetVisibility(VISIBILITY_ON);
//.........这里部分代码省略.........
开发者ID:Exxenoz,项目名称:scriptdev2,代码行数:101,代码来源:blackrock_depths.cpp


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