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


C++ CreatureList类代码示例

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


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

示例1: GetCreatureListWithEntryInGrid

void instance_ruins_of_ahnqiraj::DoSortArmyWaves()
{
    CreatureList lCreatureList;

    // Sort the 7 army waves
    // We need to use gridsearcher for this, because coords search is too complicated here
    for (uint8 i = 0; i < MAX_ARMY_WAVES; ++i)
    {
        // Clear all the army waves
        m_sArmyWavesGuids[i].clear();
        lCreatureList.clear();

        if (Creature* pTemp = GetSingleCreatureFromStorage(aArmySortingParameters[i].m_uiEntry))
        {
            GetCreatureListWithEntryInGrid(lCreatureList, pTemp, NPC_QIRAJI_WARRIOR, aArmySortingParameters[i].m_fSearchDist);
            GetCreatureListWithEntryInGrid(lCreatureList, pTemp, NPC_SWARMGUARD_NEEDLER, aArmySortingParameters[i].m_fSearchDist);

            for (CreatureList::const_iterator itr = lCreatureList.begin(); itr != lCreatureList.end(); ++itr)
            {
                if ((*itr)->isAlive())
                    m_sArmyWavesGuids[i].insert((*itr)->GetObjectGuid());
            }

            if (pTemp->isAlive())
                m_sArmyWavesGuids[i].insert(pTemp->GetObjectGuid());
        }
    }

    // send the first wave
    m_uiCurrentArmyWave = 0;
    DoSendNextArmyWave();
}
开发者ID:Ghaster,项目名称:mangos-classic,代码行数:32,代码来源:instance_ruins_of_ahnqiraj.cpp

示例2: GetCreatureListWithEntryInGrid

    Creature *RespawnNearbyBugsAndGetOne()
    {
        CreatureList lUnitList;
        GetCreatureListWithEntryInGrid(lUnitList,m_creature,15316,150.0f);
        GetCreatureListWithEntryInGrid(lUnitList,m_creature,15317,150.0f);

        if (lUnitList.empty())
            return NULL;

        Creature *nearb = NULL;

        for(CreatureList::iterator iter = lUnitList.begin(); iter != lUnitList.end(); ++iter)
        {
            Creature *c = (Creature *)(*iter);
            if (c->isDead())
            {
                c->Respawn();
                c->setFaction(7);
                c->RemoveAllAuras();
            }
            if (c->IsWithinDistInMap(m_creature, ABUSE_BUG_RANGE))
            {
                if (!nearb || !urand(0, 3))
                    nearb = c;
            }
        }
        return nearb;
    }
开发者ID:Tasssadar,项目名称:catcore,代码行数:28,代码来源:boss_twinemperors.cpp

示例3: GOHello_go_altar_of_keepers

bool GOHello_go_altar_of_keepers(Player* pPlayer, GameObject* pGo)
{
    if (!pPlayer || !pGo)
        return false;

    pPlayer->CastSpell(pPlayer, SPELL_USE_ALTAR_VISUAL, true);

    CreatureList lStoneKeepers;
    GetCreatureListWithEntryInGrid(lStoneKeepers, pGo, NPC_STONE_KEEPER, HALL_RADIUS);

    if (!lStoneKeepers.empty())
    {
        for(CreatureList::iterator itr = lStoneKeepers.begin(); itr != lStoneKeepers.end(); ++itr)
        {
            if (*itr && (*itr)->isAlive())
            {
                (*itr)->setFaction(FACTION_TITAN_UNFRIENDLY);
                (*itr)->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                (*itr)->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                if ((*itr)->AI())
                {
                    (*itr)->RemoveAurasDueToSpell(SPELL_STONED);
                    (*itr)->AI()->AttackStart(pPlayer);
                }
            }
        }
    }
    return false;
}
开发者ID:Tasssadar,项目名称:catcore,代码行数:29,代码来源:uldaman.cpp

示例4: EnterEvadeMode

    void EnterEvadeMode()
    {
        CreatureList adds;
        GetCreatureListWithEntryInGrid(adds, m_creature, NPC_ADD, 50.0f);
        if (!adds.empty())
            for(CreatureList::iterator iter = adds.begin(); iter != adds.end(); ++iter)
                (*iter)->ForcedDespawn();

        m_creature->GetMotionMaster()->MoveTargetedHome();
    }
开发者ID:Tasssadar,项目名称:catcore,代码行数:10,代码来源:boss_ahune.cpp

示例5: DespawnSphere

    void DespawnSphere()
    {
        CreatureList assistList;
        GetCreatureListWithEntryInGrid(assistList,m_creature, NPC_ETHEREAL_SPHERE ,150.0f);

        if (assistList.empty())
            return;
        for(CreatureList::iterator iter = assistList.begin(); iter != assistList.end(); ++iter)
            (*iter)->DealDamage((*iter), (*iter)->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
    }
开发者ID:Tasssadar,项目名称:catcore,代码行数:10,代码来源:boss_xevozz.cpp

示例6: DamageTaken

    void DamageTaken(Unit* pDoneBy, uint32& uiDamage, DamageEffectType /*damagetype*/) override
    {
        if (uiDamage > m_creature->GetHealth() || m_creature->GetHealthPercent() < 20.0f)
        {
            if (Player* pPlayer = pDoneBy->GetBeneficiaryPlayer())
            {
                if (pPlayer->GetQuestStatus(QUEST_MISSING_DIPLO_PT16) == QUEST_STATUS_INCOMPLETE)
                    guidPlayer = pPlayer->GetObjectGuid();  // Store the player to give quest credit later
            }

            uiDamage = 0;

            DoScriptText(EMOTE_SURRENDER, m_creature);
            EnterEvadeMode();

            // Make the two sentries flee and despawn
            CreatureList lSentryList;
            GetCreatureListWithEntryInGrid(lSentryList, m_creature, NPC_SENTRY, 40.0f);

            for (CreatureList::const_iterator itr = lSentryList.begin(); itr != lSentryList.end(); ++itr)
            {
                if ((*itr)->isAlive())
                {
                    (*itr)->RemoveAllAurasOnEvade();
                    (*itr)->CombatStop(true);
                    (*itr)->SetWalk(false);
                    (*itr)->GetMotionMaster()->MovePoint(0, fSentryFleePoint[0], fSentryFleePoint[1], fSentryFleePoint[2]);
                    (*itr)->ForcedDespawn(4000);
                }
            }

            // Summon Jaina Proudmoore, Archmage Tervosh and Pained
            for (const auto& lOutroSpawn : lOutroSpawns)
            {
                Creature* pCreature = m_creature->SummonCreature(lOutroSpawn.uiEntry, lOutroSpawn.fX, lOutroSpawn.fY, lOutroSpawn.fZ, lOutroSpawn.fO, TEMPSPAWN_TIMED_DESPAWN, 3 * MINUTE * IN_MILLISECONDS, false, true);
                if (pCreature)
                {
                    pCreature->CastSpell(pCreature, SPELL_TELEPORT_VISUAL, TRIGGERED_NONE);
                    pCreature->GetMotionMaster()->MovePoint(0, lOutroSpawn.fDestX, lOutroSpawn.fDestY, lOutroSpawn.fDestZ);

                    // Exception case for Archmage Tervosh: the outro event is a simple speech with visual spell cast
                    // so it will be handled by a DBScript held by NPC Archmage Tervosh
                    if (pCreature->GetEntry() == NPC_TERVOSH)
                    {
                        // Remove Gossip and Quest Giver flag from now, they will be re-added later to Archmage Tervosh in DBScript
                        pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER | UNIT_NPC_FLAG_GOSSIP);
                        // The DBScript will be done here
                        pCreature->GetMotionMaster()->MoveWaypoint(0);
                    }
                }
            }
        }
    }
开发者ID:Phatcat,项目名称:mangos-wotlk,代码行数:53,代码来源:dustwallow_marsh.cpp

示例7: SelectRandomCreatureOfEntryInRange

    Creature* SelectRandomCreatureOfEntryInRange(uint32 uiEntry, float fRange)
    {
        CreatureList lCreatureList;
        GetCreatureListWithEntryInGrid(lCreatureList, m_creature, uiEntry, fRange);

        if (lCreatureList.empty())
            return NULL;

        CreatureList::iterator iter = lCreatureList.begin();
        advance(iter, urand(0, lCreatureList.size()-1));

        return *iter;
    }
开发者ID:Tasssadar,项目名称:catcore,代码行数:13,代码来源:boss_nadox.cpp

示例8: MoveInLineOfSight

    void MoveInLineOfSight(Unit* pWho) override
    {
        if (HasEscortState(STATE_ESCORT_ESCORTING) && pWho->GetEntry() == NPC_REETHE && lCreatureList.empty())
            lCreatureList.push_back((Creature*)pWho);

        npc_escortAI::MoveInLineOfSight(pWho);
    }
开发者ID:Phatcat,项目名称:mangos-wotlk,代码行数:7,代码来源:dustwallow_marsh.cpp

示例9:

CreatureList<PrivateKey> StorageReal::getPrivateKeyList(Monitor& monitor)
{
	if (!check_interface(monitor)) return CreatureList<PrivateKey>();

	CreatureList<PrivateKey> res = creator.createCreatureList<PrivateKey>();
	Iterator i; SIMPLE_CALL( (i=iface->iterator(session,error)) );
	for (; i.inrange(); ++i)
	{
		eprovider::Error error;
		TheKey thekey = iface->item(session,i,error);
		if (thekey.category() == kcPrivateKey)
		{
			PrivateKey toadd = creator.createPrivateKey(thekey,NotCritical(monitor));
			if (toadd) res.push_back( toadd );
		}
	}
	return res;
}
开发者ID:relonger,项目名称:ECryptoLib,代码行数:18,代码来源:StorageReal.cpp

示例10: JustSummoned

    void JustSummoned(Creature* pSummoned) override
    {
        lCreatureList.push_back(pSummoned);

        pSummoned->setFaction(FACTION_GENERIC_FRIENDLY);

        if (pSummoned->GetEntry() == NPC_CALDWELL)
            pSummoned->GetMotionMaster()->MovePoint(0, m_afMoveTo[0], m_afMoveTo[1], m_afMoveTo[2]);
        else
        {
            if (Creature* pCaldwell = GetCreature(NPC_CALDWELL))
            {
                // will this conversion work without compile warning/error?
                size_t iSize = lCreatureList.size();
                pSummoned->GetMotionMaster()->MoveFollow(pCaldwell, 0.5f, (M_PI / 2) * (int)iSize);
            }
        }
    }
开发者ID:Phatcat,项目名称:mangos-wotlk,代码行数:18,代码来源:dustwallow_marsh.cpp

示例11: GetClosestDwarfNotInCombat

Creature* instance_uldaman::GetClosestDwarfNotInCombat(Creature* pSearcher)
{
    CreatureList lTemp;

    for (GuidList::const_iterator itr = m_lWardens.begin(); itr != m_lWardens.end(); ++itr)
    {
        Creature* pTemp = instance->GetCreature(*itr);

        if (pTemp && pTemp->isAlive() && !pTemp->getVictim())
            lTemp.push_back(pTemp);
    }

    if (lTemp.empty())
        return nullptr;

    lTemp.sort(ObjectDistanceOrder(pSearcher));
    return lTemp.front();
}
开发者ID:Ghaster,项目名称:mangos-classic,代码行数:18,代码来源:instance_uldaman.cpp

示例12: PrepareSummonPlaces

    void PrepareSummonPlaces()
    {
        CreatureList lSummonList;
        m_pInstance->GetGothSummonPointCreatures(lSummonList, true);

        if (lSummonList.empty())
            return;

        // Trainees and Rider
        uint8 index = 0;
        uint8 uiTraineeCount = 3;
        lSummonList.sort(ObjectDistanceOrder(m_creature));
        for (auto& itr : lSummonList)
        {
            if (itr)
            {
                if (uiTraineeCount == 0)
                    break;
                if (index == 1)
                    m_lRiderSummonPosGuids.push_back(itr->GetObjectGuid());
                else
                {
                    m_lTraineeSummonPosGuids.push_back(itr->GetObjectGuid());
                    --uiTraineeCount;
                }
                index++;
            }
        }

        // DeathKnights
        uint8 uiDeathKnightCount = 2;
        lSummonList.sort(ObjectDistanceOrderReversed(m_creature));
        for (auto& itr : lSummonList)
        {
            if (itr)
            {
                if (uiDeathKnightCount == 0)
                    break;
                m_lDeathKnightSummonPosGuids.push_back(itr->GetObjectGuid());
                --uiDeathKnightCount;
            }
        }
    }
开发者ID:Ghaster,项目名称:mangos-classic,代码行数:43,代码来源:boss_gothik.cpp

示例13: DoEncounterCleanup

    // function to cleanup the world states and GO flags
    void DoEncounterCleanup()
    {
        // remove world state
        if (Player* pSummoner = m_creature->GetMap()->GetPlayer(m_summonerGuid))
            pSummoner->SendUpdateWorldState(WORLD_STATE_TETHYR_SHOW, 0);

        // reset all cannons
        GameObjectList lCannonsInRange;
        GetGameObjectListWithEntryInGrid(lCannonsInRange, m_creature, GO_COVE_CANNON, 100.0f);

        for (GameObjectList::const_iterator itr = lCannonsInRange.begin(); itr != lCannonsInRange.end(); ++itr)
            (*itr)->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NO_INTERACT);

        // despawn all marksmen
        CreatureList lMarksmenInRange;
        GetCreatureListWithEntryInGrid(lMarksmenInRange, m_creature, NPC_THERAMORE_MARKSMAN, 100.0f);

        for (CreatureList::const_iterator itr = lMarksmenInRange.begin(); itr != lMarksmenInRange.end(); ++itr)
            (*itr)->ForcedDespawn(30000);
    }
开发者ID:Phatcat,项目名称:mangos-wotlk,代码行数:21,代码来源:dustwallow_marsh.cpp

示例14: GetCreature

    Creature* GetCreature(uint32 uiCreatureEntry)
    {
        if (!lCreatureList.empty())
        {
            for (auto& itr : lCreatureList)
            {
                if (itr->GetEntry() == uiCreatureEntry && itr->isAlive())
                    return itr;
            }
        }

        return nullptr;
    }
开发者ID:Phatcat,项目名称:mangos-wotlk,代码行数:13,代码来源:dustwallow_marsh.cpp

示例15: MovementInform

    void MovementInform(uint32 uiMotionType, uint32 uiPointId) override
    {
        if (uiMotionType == WAYPOINT_MOTION_TYPE)
        {
            // start attacking
            if (uiPointId == 12)
            {
                // make cannons usable
                GameObjectList lCannonsInRange;
                GetGameObjectListWithEntryInGrid(lCannonsInRange, m_creature, GO_COVE_CANNON, 100.0f);

                for (GameObjectList::const_iterator itr = lCannonsInRange.begin(); itr != lCannonsInRange.end(); ++itr)
                    (*itr)->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NO_INTERACT);

                // attack all marksmen
                CreatureList lMarksmenInRange;
                GetCreatureListWithEntryInGrid(lMarksmenInRange, m_creature, NPC_THERAMORE_MARKSMAN, 100.0f);

                for (CreatureList::const_iterator itr = lMarksmenInRange.begin(); itr != lMarksmenInRange.end(); ++itr)
                {
                    (*itr)->AI()->AttackStart(m_creature);
                    AttackStart(*itr);
                }
            }
        }
        else if (uiMotionType == POINT_MOTION_TYPE)
        {
            // Spout on cannon point reach
            if (uiPointId)
            {
                if (DoCastSpellIfCan(m_creature, urand(0, 1) ? SPELL_SPOUT_LEFT : SPELL_SPOUT_RIGHT, CAST_INTERRUPT_PREVIOUS) == CAST_OK)
                {
                    // Remove the target focus
                    m_creature->SetTarget(nullptr);
                    m_uiPhase = PHASE_SPOUT;
                }
            }
        }
    }
开发者ID:Phatcat,项目名称:mangos-wotlk,代码行数:39,代码来源:dustwallow_marsh.cpp


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