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


C++ GetClosestGameObjectWithEntry函数代码示例

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


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

示例1: WaypointReached

 void WaypointReached(uint32 uiPointId) override
 {
     switch (uiPointId)
     {
         case 24:
             DoScriptText(SAY_PREPARE, m_creature);
             break;
         case 25:
             DoScriptText(SAY_CAMP_ENTER, m_creature);
             SetRun(false);
             break;
         case 46:
             // despawn the Ark
             if (GameObject* pArk = GetClosestGameObjectWithEntry(m_creature, GO_ARK_OF_SSSLITH, 10.0f))
                 pArk->SetLootState(GO_JUST_DEACTIVATED);
             // spawn npcs
             m_creature->SummonCreature(NPC_ENCHANTRESS, 526.12f, 8136.96f, 21.64f, 0.57f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000);
             m_creature->SummonCreature(NPC_SLAVEDRIVER, 524.09f, 8138.67f, 21.49f, 0.58f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000);
             m_creature->SummonCreature(NPC_SLAVEDRIVER, 526.93f, 8133.88f, 21.56f, 0.58f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000);
             break;
         case 70:
             DoScriptText(SAY_AMBUSH, m_creature);
             // spawn npcs
             m_bIsAmbush = true;
             m_creature->SummonCreature(NPC_SSSLITH, 162.91f, 8192.08f, 22.55f, 5.98f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000);
             m_creature->SummonCreature(NPC_ENCHANTRESS, 162.34f, 8193.99f, 22.85f, 5.98f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000);
             m_creature->SummonCreature(NPC_SLAVEDRIVER, 163.07f, 8187.04f, 22.71f, 0.10f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000);
             SetEscortPaused(true);
             break;
         case 71:
             DoScriptText(SAY_AMBUSH_CLEARED, m_creature);
             SetRun();
             break;
         case 92:
             SetRun(false);
             break;
         case 93:
             DoScriptText(SAY_ESCORT_COMPLETE, m_creature);
             if (Player* pPlayer = GetPlayerForEscort())
                 pPlayer->GroupEventHappens(QUEST_ID_FHWOOR_SMASH, m_creature);
             break;
     }
 }
开发者ID:kelemeto76,项目名称:ScriptDev3,代码行数:43,代码来源:zangarmarsh.cpp

示例2: WaypointStart

		void WaypointStart(uint32 uiPointId) {
			switch (uiPointId) {
			case 0: {
				GameObject* pCage = NULL;
				if (m_uiGalensCageGUID)
					pCage = me->GetMap()->GetGameObject(m_uiGalensCageGUID);
				else
					pCage = GetClosestGameObjectWithEntry(me, GO_GALENS_CAGE,
							INTERACTION_DISTANCE);
				if (pCage) {
					pCage->UseDoorOrButton();
					m_uiGalensCageGUID = pCage->GetGUID();
				}
				break;
			}
			case 21:
				DoScriptText(EMOTE_DISAPPEAR, me);
				break;
			}
		}
开发者ID:Bootz,项目名称:DeepshjirRepack,代码行数:20,代码来源:swamp_of_sorrows.cpp

示例3: EffectDummy

    bool EffectDummy(Unit* pCaster, uint32 uiSpellId, SpellEffectIndex uiEffIndex, Object* pTarget, ObjectGuid /*originalCasterGuid*/) override
    {
        if (uiEffIndex == EFFECT_INDEX_0)
        {
            Creature *pCreatureTarget = pTarget->ToCreature();
            if (!pCreatureTarget || pCreatureTarget->GetEntry() != NPC_SMOLDERING_SCRAP_BUNNY)
                return true;

            if (GameObject* pScrap = GetClosestGameObjectWithEntry(pCreatureTarget, GO_SMOLDERING_SCRAP, 5.0f))
            {
                if (pScrap->GetRespawnTime() != 0)
                    return true;

                pCreatureTarget->CastSpell(pCreatureTarget, SPELL_FROZEN_IRON_SCRAP, true);
                pScrap->SetLootState(GO_JUST_DEACTIVATED);
                pCreatureTarget->ForcedDespawn(1000);
            }
        }
        return true;
    }
开发者ID:Chuck5ta,项目名称:ScriptDev3,代码行数:20,代码来源:spell_scripts.cpp

示例4: MovementInform

        void MovementInform(uint32 uiType, uint32 uiPointId) override
        {
            if (uiType != POINT_MOTION_TYPE || !uiPointId)
                return;

            if (GameObject* pTrap = m_creature->GetMap()->GetGameObject(m_trapGuid))
            {
                // respawn the Quality Fur
                if (GameObject* pGoFur = GetClosestGameObjectWithEntry(pTrap, GO_QUALITY_FUR, INTERACTION_DISTANCE))
                {
                    if (!pGoFur->isSpawned())
                    {
                        pGoFur->SetRespawnTime(10);
                        pGoFur->Refresh();
                    }
                }
            }

            m_uiPhaseTimer = 2000;
        }
开发者ID:Chuck5ta,项目名称:ScriptDev3,代码行数:20,代码来源:borean_tundra.cpp

示例5: EffectAuraDummy_spell_aura_dummy_crystal_spike_visual

bool EffectAuraDummy_spell_aura_dummy_crystal_spike_visual(const Aura* pAura, bool bApply)
{
    if (pAura->GetId() == SPELL_CRYSTAL_SPIKE_PRE && pAura->GetEffIndex() == EFFECT_INDEX_0 && !bApply)
    {
        if (Creature* pTarget = (Creature*)pAura->GetTarget())
        {
            if (pTarget->GetEntry() != NPC_CRYSTAL_SPIKE_TRIGGER)
                return true;

            // Use the Spike gameobject so we can summon the npc which actual does the damage
            if (GameObject* pSpike = GetClosestGameObjectWithEntry(pTarget, GO_CRYSTAL_SPIKE, 10.0f))
            {
                pSpike->Use(pTarget);
                // Note: the following command should be handled in core by the trap GO code
                pSpike->SetLootState(GO_JUST_DEACTIVATED);
            }
        }
    }
    return true;
}
开发者ID:Phatcat,项目名称:mangos-wotlk,代码行数:20,代码来源:boss_ormorok.cpp

示例6: MoveInLineOfSight

        void MoveInLineOfSight(Unit* who)
        {
            if (!who)
                return;

            if (Phase == IDLE && me->IsValidAttackTarget(who) && me->IsWithinDistInMap(who, 40))
            {
                Phase = INTRO;
                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);

                if (GameObject* mirror = GetClosestGameObjectWithEntry(me, OBJECT_UTGARDE_MIRROR, 100.0f))
                    mirror->SetGoState(GO_STATE_READY);

                if (Creature* arthas = me->SummonCreature(CREATURE_ARTHAS, ArthasPos, TEMPSUMMON_MANUAL_DESPAWN))
                {
                    arthas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
                    arthasGUID = arthas->GetGUID();
                }
            }
        }
开发者ID:4m1g0,项目名称:TrinityCore,代码行数:20,代码来源:boss_svala.cpp

示例7: WaypointReached

 void WaypointReached(uint32 uiPointId) override
 {
     switch (uiPointId)
     {
         case 5:
             DoScriptText(SAY_STINKY_FIRST_STOP, m_creature);
             break;
         case 10:
             DoScriptText(SAY_STINKY_SECOND_STOP, m_creature);
             break;
         case 24:
             DoScriptText(SAY_STINKY_THIRD_STOP_1, m_creature);
             break;
         case 25:
             DoScriptText(SAY_STINKY_THIRD_STOP_2, m_creature);
             if (GameObject* pBogbeanPlant = GetClosestGameObjectWithEntry(m_creature, GO_BOGBEAN_PLANT, DEFAULT_VISIBILITY_DISTANCE))
             {
                 m_bogbeanPlantGuid = pBogbeanPlant->GetObjectGuid();
                 m_creature->SetFacingToObject(pBogbeanPlant);
             }
             break;
         case 26:
             if (Player* pPlayer = GetPlayerForEscort())
                 DoScriptText(SAY_STINKY_THIRD_STOP_3, m_creature, pPlayer);
             break;
         case 29:
             m_creature->HandleEmote(EMOTE_STATE_USESTANDING);
             break;
         case 30:
             DoScriptText(SAY_STINKY_PLANT_GATHERED, m_creature);
             break;
         case 39:
             if (Player* pPlayer = GetPlayerForEscort())
             {
                 pPlayer->GroupEventHappens(pPlayer->GetTeam() == ALLIANCE ? QUEST_ID_STINKYS_ESCAPE_ALLIANCE : QUEST_ID_STINKYS_ESCAPE_HORDE, m_creature);
                 DoScriptText(SAY_STINKY_END, m_creature, pPlayer);
             }
             break;
     }
 }
开发者ID:conan513,项目名称:mangos-wotlk,代码行数:40,代码来源:dustwallow_marsh.cpp

示例8: UpdateAI

        void UpdateAI(const uint32 uiDiff)
        {
            npc_escortAI::UpdateAI(uiDiff);

            if (bTake)
            {
                if (uiTakeTimer < uiDiff)
                {
                    me->HandleEmoteCommand(EMOTE_STATE_NONE);
                    if (GameObject* pGO = GetClosestGameObjectWithEntry(me, GO_DRAENEI_MACHINE, INTERACTION_DISTANCE))
                    {
                        SetEscortPaused(false);
                        bTake=false;
                        uiTakeTimer = 3000;
                        pGO->Delete();
                    }
                }
                else
                    uiTakeTimer -= uiDiff;
            }
            DoMeleeAttackIfReady();
        }
开发者ID:Albis,项目名称:TrinityCore,代码行数:22,代码来源:netherstorm.cpp

示例9: WaypointStart

 void WaypointStart(uint32 uiPointId)
 {
     switch (uiPointId)
     {
     case 0:
         {
             GameObject* cage = NULL;
             if (galensCageGUID)
                 cage = me->GetMap()->GetGameObject(galensCageGUID);
             else
                 cage = GetClosestGameObjectWithEntry(me, GO_GALENS_CAGE, INTERACTION_DISTANCE);
             if (cage)
             {
                 cage->UseDoorOrButton();
                 galensCageGUID = cage->GetGUID();
             }
             break;
         }
     case 21:
         Talk(EMOTE_DISAPPEAR);
         break;
     }
 }
开发者ID:Helias,项目名称:azerothcore-wotlk,代码行数:23,代码来源:zone_swamp_of_sorrows.cpp

示例10: KnotQuestRewarded

bool KnotQuestRewarded(Player*, Creature* cr, Quest const* quest)
{
	if((quest->GetQuestId() != 5525 && quest->GetQuestId() != 7429) || cr->GetEntry() != 14338)
	{
		return false;
	}

	if(cr->GetInstanceData() == nullptr)
		return false;

	bool spawned = ((ScriptedInstance*)cr->GetInstanceData())->GetData(TYPE_KNOT_CHEST) == DONE;
	if(spawned)
		return false;

	auto existing = GetClosestGameObjectWithEntry(cr, GO_KNOTS_CACHE, 100.0f);
	if(existing)
	{
		return false;
	}

	cr->SummonObject(cr->GetMap(), GO_KNOTS_CACHE, 583.688f, 523.646f, -25.401f, 1.545f);
	return true;
}
开发者ID:yyhhrr,项目名称:mangospriv,代码行数:23,代码来源:knot_quest_suit.cpp

示例11: WaypointStarted

 void WaypointStarted(uint32 uiPointId, uint32 /*pathId*/) override
 {
     switch (uiPointId)
     {
         case 0:
         {
             GameObject* cage = nullptr;
             if (galensCageGUID)
                 cage = ObjectAccessor::GetGameObject(*me, galensCageGUID);
             else
                 cage = GetClosestGameObjectWithEntry(me, GO_GALENS_CAGE, INTERACTION_DISTANCE);
             if (cage)
             {
                 cage->UseDoorOrButton();
                 galensCageGUID = cage->GetGUID();
             }
             break;
         }
         case 21:
             Talk(EMOTE_DISAPPEAR);
             break;
     }
 }
开发者ID:Refuge89,项目名称:TrinityCore,代码行数:23,代码来源:zone_swamp_of_sorrows.cpp

示例12: DoOpenPortal

    //"opens" the portal and does the "opening" whisper
    void DoOpenPortal()
    {
        // there are 4 portal spawn locations, each are expected to be spawned with negative spawntimesecs in database

        // using a grid search here seem to be more efficient than caching all four guids
        // in instance script and calculate range to each.
        GameObject* pPortal = GetClosestGameObjectWithEntry(m_creature, GO_TWILIGHT_PORTAL, 50.0f);
        DoScriptText(EMOTE_OPEN_PORTAL, m_creature);

        // By using SetRespawnTime() we will actually "spawn" the object with our defined time.
        // Once time is up, portal will disappear again.
        if (pPortal && !pPortal->isSpawned())
        {
            pPortal->SetRespawnTime(HOUR * IN_MILLISECONDS);
            pPortal->Refresh();
        }

        // set portal status as active when Sartharion is in progress
        if (m_pInstance && m_pInstance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS)
            m_pInstance->SetPortalStatus(m_uiPortalId, true);

        // Unclear what are expected to happen if one drake has a portal open already
        // Refresh respawnTime so time again are set to 30secs?
    }
开发者ID:jviljoen82,项目名称:ScriptDev3,代码行数:25,代码来源:boss_sartharion.cpp

示例13: GOUse_go_caribou_trap

bool GOUse_go_caribou_trap(Player* pPlayer, GameObject* pGo)
{
    float fX, fY, fZ;
    pGo->GetClosePoint(fX, fY, fZ, pGo->GetObjectBoundingRadius(), 2*INTERACTION_DISTANCE, frand(0, M_PI_F*2));

    if (Creature* pCreature = pGo->SummonCreature(NPC_NESINGWARY_TRAPPER, fX, fY, fZ, pGo->GetOrientation(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 10000))
    {
        if (npc_nesingwary_trapperAI* pTrapperAI = dynamic_cast<npc_nesingwary_trapperAI*>(pCreature->AI()))
            pTrapperAI->StartAction(pPlayer, pGo);

        pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);

        if (GameObject* pGoFur = GetClosestGameObjectWithEntry(pGo, GO_QUALITY_FUR, INTERACTION_DISTANCE))
        {
            if (!pGoFur->isSpawned())
            {
                pGoFur->SetRespawnTime(10);
                pGoFur->Refresh();
            }
        }
    }

    return true;
}
开发者ID:Shutok,项目名称:StrawberryCore-501Beta,代码行数:24,代码来源:borean_tundra.cpp

示例14: UpdateEscortAI

    void UpdateEscortAI(const uint32 uiDiff) override
    {
        if (HasEscortState(STATE_ESCORT_PAUSED))
        {
            if (m_uiRitualTimer < uiDiff)
            {
                switch (m_uiRitualPhase)
                {
                    case 0:
                        DoCastSpellIfCan(m_creature, SPELL_IDOL_SHUTDOWN);
                        m_uiRitualTimer = 1000;
                        break;
                    case 1:
                        DoSummonSpawner(irand(1, 3));
                        m_uiRitualTimer = 39000;
                        break;
                    case 2:
                        DoSummonSpawner(irand(1, 3));
                        m_uiRitualTimer = 20000;
                        break;
                    case 3:
                        DoScriptText(SAY_BELNISTRASZ_3_MIN, m_creature, m_creature);
                        m_uiRitualTimer = 20000;
                        break;
                    case 4:
                        DoSummonSpawner(irand(1, 3));
                        m_uiRitualTimer = 40000;
                        break;
                    case 5:
                        DoSummonSpawner(irand(1, 3));
                        DoScriptText(SAY_BELNISTRASZ_2_MIN, m_creature, m_creature);
                        m_uiRitualTimer = 40000;
                        break;
                    case 6:
                        DoSummonSpawner(irand(1, 3));
                        m_uiRitualTimer = 20000;
                        break;
                    case 7:
                        DoScriptText(SAY_BELNISTRASZ_1_MIN, m_creature, m_creature);
                        m_uiRitualTimer = 40000;
                        break;
                    case 8:
                        DoSummonSpawner(irand(1, 3));
                        m_uiRitualTimer = 20000;
                        break;
                    case 9:
                        DoScriptText(SAY_BELNISTRASZ_FINISH, m_creature, m_creature);
                        m_uiRitualTimer = 3000;
                        break;
                    case 10:
                    {
                        if (Player* pPlayer = GetPlayerForEscort())
                        {
                            pPlayer->GroupEventHappens(QUEST_EXTINGUISHING_THE_IDOL, m_creature);

                            if (GameObject* pGo = GetClosestGameObjectWithEntry(m_creature, GO_BELNISTRASZ_BRAZIER, 10.0f))
                            {
                                if (!pGo->isSpawned())
                                {
                                    pGo->SetRespawnTime(HOUR * IN_MILLISECONDS);
                                    pGo->Refresh();
                                }
                            }
                        }

                        m_creature->RemoveAurasDueToSpell(SPELL_IDOL_SHUTDOWN);
                        SetEscortPaused(false);
                        break;
                    }
                }

                ++m_uiRitualPhase;
            }
            else
            {
                m_uiRitualTimer -= uiDiff;
            }

            return;
        }

        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
        {
            return;
        }

        if (m_uiFireballTimer < uiDiff)
        {
            DoCastSpellIfCan(m_creature->getVictim(), SPELL_FIREBALL);
            m_uiFireballTimer  = urand(2000, 3000);
        }
        else
            { m_uiFireballTimer -= uiDiff; }

        if (m_uiFrostNovaTimer < uiDiff)
        {
            DoCastSpellIfCan(m_creature->getVictim(), SPELL_FROST_NOVA);
            m_uiFrostNovaTimer = urand(10000, 15000);
        }
        else
//.........这里部分代码省略.........
开发者ID:0jpq0,项目名称:server,代码行数:101,代码来源:razorfen_downs.cpp

示例15: EffectDummyCreature_spell_dummy_npc


//.........这里部分代码省略.........
            pCreatureTarget->UpdateEntry(NPC_FREED_GREENGILL_SLAVE);

            pCreatureTarget->CastSpell(pCreatureTarget, SPELL_ENRAGE, true);

            return true;
        }
        case SPELL_FUMPING:
        {
            if (uiEffIndex == EFFECT_INDEX_2)
            {
                switch (urand(0, 2))
                {
                    case 0:
                    {
                        pCaster->CastSpell(pCreatureTarget, SPELL_SUMMON_HAISHULUD, true);
                        break;
                    }
                    case 1:
                    {
                        for (int i = 0; i < 2; ++i)
                        {
                            if (Creature* pSandGnome = pCaster->SummonCreature(NPC_SAND_GNOME, pCreatureTarget->GetPositionX(), pCreatureTarget->GetPositionY(), pCreatureTarget->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_OOC_DESPAWN, 30000))
                                pSandGnome->AI()->AttackStart(pCaster);
                        }
                        break;
                    }
                    case 2:
                    {
                        for (int i = 0; i < 2; ++i)
                        {
                            if (Creature* pMatureBoneSifter = pCaster->SummonCreature(NPC_MATURE_BONE_SIFTER, pCreatureTarget->GetPositionX(), pCreatureTarget->GetPositionY(), pCreatureTarget->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_OOC_DESPAWN, 30000))
                                pMatureBoneSifter->AI()->AttackStart(pCaster);
                        }
                        break;
                    }
                }
                pCreatureTarget->ForcedDespawn();
            }
            return true;
        }
        case SPELL_THROW_GORDAWG_BOULDER:
        {
            if (uiEffIndex == EFFECT_INDEX_0)
            {
                for (int i = 0; i < 3; ++i)
                {
                    if (irand(i, 2))                        // 2-3 summons
                        pCreatureTarget->SummonCreature(NPC_MINION_OF_GUROK, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 5000);
                }

                if (pCreatureTarget->getVictim())
                {
                    pCaster->DealDamage(pCreatureTarget, pCreatureTarget->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
                    return true;
                }

                // If not in combat, no xp or loot
                pCreatureTarget->SetDeathState(JUST_DIED);
                pCreatureTarget->SetHealth(0);
                return true;
            }
            return true;
        }
        case SPELL_EXPOSE_RAZORTHORN_ROOT:
        {
            if (uiEffIndex == EFFECT_INDEX_0)
            {
                if (pCreatureTarget->GetEntry() != NPC_RAZORTHORN_RAVAGER)
                    return true;

                if (GameObject* pMound = GetClosestGameObjectWithEntry(pCreatureTarget, GO_RAZORTHORN_DIRT_MOUND, 20.0f))
                {
                    if (pMound->GetRespawnTime() != 0)
                        return true;

                    pCreatureTarget->CastSpell(pCreatureTarget, SPELL_SUMMON_RAZORTHORN_ROOT, true);
                    pMound->SetLootState(GO_JUST_DEACTIVATED);
                }
            }
            return true;
        }
        case SPELL_MELODIOUS_RAPTURE:
        {
            if (uiEffIndex == EFFECT_INDEX_0)
            {
                if (pCaster->GetTypeId() != TYPEID_PLAYER && pCreatureTarget->GetEntry() != NPC_DEEPRUN_RAT)
                    return true;

                pCreatureTarget->UpdateEntry(NPC_ENTHRALLED_DEEPRUN_RAT);
                pCreatureTarget->CastSpell(pCreatureTarget, SPELL_MELODIOUS_RAPTURE_VISUAL, false);
                pCreatureTarget->GetMotionMaster()->MoveFollow(pCaster, frand(0.5f, 3.0f), frand(M_PI_F * 0.8f, M_PI_F * 1.2f));

                ((Player*)pCaster)->KilledMonsterCredit(NPC_ENTHRALLED_DEEPRUN_RAT);
            }
            return true;
        }
    }

    return false;
}
开发者ID:SakhWoW,项目名称:blizzlikecore,代码行数:101,代码来源:spell_scripts.cpp


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