コード例 #1
0
// Helper function, to process a slave list
void CreatureLinkingHolder::ProcessSlaveGuidList(CreatureLinkingEvent eventType, Creature* pSource, uint32 flag, uint16 searchRange, GuidList& slaveGuidList, Unit* pEnemy)
{
    if (!flag)
        return;

    for (GuidList::iterator slave_itr = slaveGuidList.begin(); slave_itr != slaveGuidList.end();)
    {
        Creature* pSlave = pSource->GetMap()->GetCreature(*slave_itr);
        if (!pSlave)
        {
            // Remove old guid first
            slaveGuidList.erase(slave_itr++);
            continue;
        }

        ++slave_itr;

        // Ignore Pets
        if (pSlave->IsPet())
            continue;

        // Handle single slave
        if (IsSlaveInRangeOfBoss(pSlave, pSource, searchRange))
            ProcessSlave(eventType, pSource, flag, pSlave, pEnemy);
    }
}
コード例 #2
0
ファイル: moonglade.cpp プロジェクト: MantisLord/mangos-tbc
 void DoDespawnSummoned()
 {
     for (GuidList::const_iterator itr = m_lPriestessList.begin(); itr != m_lPriestessList.end(); ++itr)
     {
         if (Creature* pTemp = m_creature->GetMap()->GetCreature(*itr))
             pTemp->ForcedDespawn();
     }
 }
コード例 #3
0
ファイル: silithus.cpp プロジェクト: mynew4/RustEmu-Core
 void DoUnsummonArmy()
 {
     for (GuidList::const_iterator itr = m_lQirajiWarriorsList.begin(); itr != m_lQirajiWarriorsList.end(); ++itr)
     {
         if (Creature* pTemp = m_creature->GetMap()->GetCreature(*itr))
             pTemp->ForcedDespawn();
     }
 }
コード例 #4
0
ファイル: boss_gluth.cpp プロジェクト: Phatcat/mangos-wotlk
 // Replaces missing spell 29682
 void DoCallAllZombieChow()
 {
     for (GuidList::const_iterator itr = m_lZombieChowGuidList.begin(); itr != m_lZombieChowGuidList.end(); ++itr)
     {
         if (Creature* pZombie = m_creature->GetMap()->GetCreature(*itr))
             pZombie->GetMotionMaster()->MoveFollow(m_creature, ATTACK_DISTANCE, 0);
     }
 }
コード例 #5
0
ファイル: boss_anzu.cpp プロジェクト: conan513/mangos-wotlk
 void DespawnBirdHelpers()
 {
     for (GuidList::const_iterator itr = m_lBirdsGuidList.begin(); itr != m_lBirdsGuidList.end(); ++itr)
     {
         if (Creature* pTemp = m_creature->GetMap()->GetCreature(*itr))
             pTemp->ForcedDespawn();
     }
 }
コード例 #6
0
// Small Helper-function
static void GetValidNPCsOfList(Map* pMap, GuidList& lGUIDs, std::list<Creature*>& lNPCs)
{
    lNPCs.clear();
    for (GuidList::const_iterator itr = lGUIDs.begin(); itr != lGUIDs.end(); ++itr)
    {
        if (Creature* pMob = pMap->GetCreature(*itr))
            lNPCs.push_back(pMob);
    }
}
コード例 #7
0
    void ReceiveAIEvent(AIEventType eventType, Unit* /*pSender*/, Unit* pInvoker, uint32 /*uiMiscValue*/) override
    {
        // inform about the harpoon repair event
        if (eventType == AI_EVENT_CUSTOM_A)
        {
            DoMoveEngineersToHarpoon();
            m_uiRepairHarpoonTimer = 20000;
        }
        // inform about a harpoon being shot
        if (eventType == AI_EVENT_CUSTOM_B)
        {
            ++m_uiHarpoonsUsed;

            // start grounded phase
            if (m_uiHarpoonsUsed == m_uiMaxHarpoons)
            {
                // use upgraded speed rate for FlyOrLand. This isn't supported by DB but it's confirmed to happen on retail
                uint32 uiSpeedRate = m_creature->GetSpeedRate(MOVE_RUN);
                m_creature->SetWalk(false);
                m_creature->SetSpeedRate(MOVE_RUN, SPEED_RATE_RAZORSCALE);
                m_creature->GetMotionMaster()->MoveFlyOrLand(1, afRazorscaleGroundPos[0], afRazorscaleGroundPos[1], afRazorscaleGroundPos[2], false);
                m_creature->SetSpeedRate(MOVE_RUN, uiSpeedRate);

                m_uiPhase = PHASE_TRANSITION;
                m_uiShackleTimer = 5000;

                // move the trappers around
                float fX, fY, fZ;
                uint8 uiIndex = 5;
                if (m_pInstance)
                {
                    if (Creature* pController = m_pInstance->GetSingleCreatureFromStorage(NPC_RAZORSCALE_CONTROLLER))
                    {
                        for (GuidList::const_iterator itr = m_lTrappersGuids.begin(); itr != m_lTrappersGuids.end(); ++itr)
                        {
                            if (Creature* pTrapper = m_creature->GetMap()->GetCreature(*itr))
                            {
                                pController->GetNearPoint(pController, fX, fY, fZ, 0, 50.0f, M_PI_F / 4 * uiIndex);

                                pTrapper->SetWalk(false);
                                uiSpeedRate = pTrapper->GetSpeedRate(MOVE_RUN);
                                pTrapper->SetSpeedRate(MOVE_RUN, SPEED_RATE_HELPERS);
                                pTrapper->GetMotionMaster()->MovePoint(1, fX, fY, fZ);
                                pTrapper->SetSpeedRate(MOVE_RUN, uiSpeedRate);
                                ++uiIndex;
                            }
                        }
                    }

                    // yell that Razor is grounded
                    if (Creature* pCommander = m_pInstance->GetSingleCreatureFromStorage(NPC_EXPEDITION_COMMANDER))
                        DoScriptText(SAY_GROUNDED, pCommander);
                }
            }
        }
    }
コード例 #8
0
ファイル: boss_zuljin.cpp プロジェクト: jviljoen82/ScriptDev3
 // Function to handle the Feather Vortexes despawn on phase change
 void DoDespawnVortexes()
 {
     for (GuidList::const_iterator itr = m_lSummonsList.begin(); itr != m_lSummonsList.end(); ++itr)
     {
         if (Creature* pVortex = m_creature->GetMap()->GetCreature(*itr))
         {
             pVortex->ForcedDespawn();
         }
     }
 }
コード例 #9
0
    // Wrapper to kill the eye tentacles before summoning new ones
    void DoDespawnEyeTentacles()
    {
        for (GuidList::const_iterator itr = m_lEyeTentaclesList.begin(); itr != m_lEyeTentaclesList.end(); ++itr)
        {
            if (Creature* pTemp = m_creature->GetMap()->GetCreature(*itr))
                pTemp->DealDamage(pTemp, pTemp->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NONE, nullptr, false);
        }

        m_lEyeTentaclesList.clear();
    }
コード例 #10
0
    ObjectGuid SelectRandomCrowdNpc()
    {
        if (m_lCrowdGuidList.empty())
            return ObjectGuid();

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

        return *iter;
    }
コード例 #11
0
ファイル: boss_jedoga.cpp プロジェクト: jviljoen82/ScriptDev3
    ObjectGuid SelectRandomVolunteer()
    {
        if (m_lVolunteerGuidList.empty())
            return ObjectGuid();

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

        return *iter;
    }
コード例 #12
0
ファイル: hinterlands.cpp プロジェクト: killerwife/mangos-tbc
    void JustDied(Unit* pKiller) override
    {
        for (GuidList::const_iterator itr = m_lSummonsList.begin(); itr != m_lSummonsList.end(); ++itr)
        {
            if (Creature* pSummoned = m_creature->GetMap()->GetCreature(*itr))
                pSummoned->ForcedDespawn();
        }

        npc_escortAI::JustDied(pKiller);
    }
コード例 #13
0
ファイル: boss_thorim.cpp プロジェクト: jviljoen82/ScriptDev3
    // function to return a random arena upper Bunny
    Creature* SelectRandomUpperBunny()
    {
        if (m_lUpperBunniesGuids.empty())
            return NULL;

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

        return m_creature->GetMap()->GetCreature(*iter);
    }
コード例 #14
0
ファイル: boss_thorim.cpp プロジェクト: jviljoen82/ScriptDev3
    // function to return a random arena bunny for Blizzard spell
    ObjectGuid SelectRandomBunnyGuid()
    {
        if (m_lBunniesGuids.empty())
            return ObjectGuid();

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

        return *iter;
    }
コード例 #15
0
ファイル: boss_cthun.cpp プロジェクト: Phatcat/mangos-wotlk
    void EnterEvadeMode() override
    {
        // Kill any player from the stomach on evade - this is becuase C'thun cannot be soloed.
        for (GuidList::const_iterator itr = m_lPlayersInStomachList.begin(); itr != m_lPlayersInStomachList.end(); ++itr)
        {
            if (Player* pPlayer = m_creature->GetMap()->GetPlayer(*itr))
                pPlayer->CastSpell(pPlayer, SPELL_PORT_OUT_STOMACH_EFFECT, TRIGGERED_OLD_TRIGGERED);
        }

        Scripted_NoMovementAI::EnterEvadeMode();
    }
コード例 #16
0
ファイル: boss_jeklik.cpp プロジェクト: MantisLord/mangos-tbc
    // Wrapper to despawn the bomb riders on evade / death
    void DoDespawnBombRiders()
    {
        if (m_lBombRiderGuidsList.empty())
            return;

        for (GuidList::const_iterator itr = m_lBombRiderGuidsList.begin(); itr != m_lBombRiderGuidsList.end(); ++itr)
        {
            if (Creature* pRider = m_creature->GetMap()->GetCreature(*itr))
                pRider->ForcedDespawn();
        }
    }
コード例 #17
0
    void JustDied(Unit* /*pKiller*/) override
    {
        if (m_pInstance)
            m_pInstance->SetData(TYPE_SUPREMUS, DONE);

        for (GuidList::const_iterator itr = m_lSummonedGUIDs.begin(); itr != m_lSummonedGUIDs.end(); ++itr)
        {
            if (Creature* pSummoned = m_creature->GetMap()->GetCreature(*itr))
                pSummoned->ForcedDespawn();
        }
    }
コード例 #18
0
    // Unsummon Majordomo adds
    void UnsummonMajordomoAdds()
    {
        for (GuidList::const_iterator itr = m_luiMajordomoAddsGUIDs.begin(); itr != m_luiMajordomoAddsGUIDs.end(); ++itr)
        {
            if (Creature* pAdd = m_creature->GetMap()->GetCreature(*itr))
                if (pAdd->IsTemporarySummon())
                    ((TemporarySpawn*)pAdd)->UnSummon();
        }

        m_luiMajordomoAddsGUIDs.clear();
    }
コード例 #19
0
 // Function to use the recently spawned GOs
 void DoUseExplosiveTraps()
 {
     for (GuidList::const_iterator itr = m_lExplosivesGuidsList.begin(); itr != m_lExplosivesGuidsList.end(); ++itr)
     {
         if (GameObject* pTrap = m_creature->GetMap()->GetGameObject(*itr))
         {
             pTrap->SendGameObjectCustomAnim(pTrap->GetObjectGuid());
             pTrap->SetLootState(GO_JUST_DEACTIVATED);
         }
     }
 }
コード例 #20
0
 bool IsWaveAllDead()
 {
     for (GuidList::iterator itr = addsAtBase.begin(); itr != addsAtBase.end(); ++itr)
     {
         if (Creature* add = instance->GetCreature((*itr)))
         {
             if (add->IsAlive())
                 return false;
         }
     }
     for (GuidList::iterator itr = movedadds.begin(); itr != movedadds.end(); ++itr)
     {
         if (Creature* add = instance->GetCreature(((*itr))))
         {
             if (add->IsAlive())
                 return false;
         }
     }
     return true;
 }
コード例 #21
0
ファイル: halls_of_stone.cpp プロジェクト: mynew/Core
 void DespawnDwarf()
 {
     if (lDwarfGUIDList.empty())
         return;
     for (GuidList::const_iterator itr = lDwarfGUIDList.begin(); itr != lDwarfGUIDList.end(); ++itr)
     {
         Creature* temp = ObjectAccessor::GetCreature(*me, instance ? (*itr) : ObjectGuid::Empty);
         if (temp && temp->IsAlive())
             temp->DespawnOrUnsummon();
     }
     lDwarfGUIDList.clear();
 }
コード例 #22
0
    void EnterEvadeMode() override
    {
        // Kill any player from the stomach on evade - this is becuase C'thun cannot be soloed.
        for (GuidList::const_iterator itr = m_lPlayersInStomachList.begin(); itr != m_lPlayersInStomachList.end(); ++itr)
        {
            // Workaround for missing spell 26648
            if (Player* pPlayer = m_creature->GetMap()->GetPlayer(*itr))
                m_creature->DealDamage(pPlayer, pPlayer->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NONE, nullptr, false);
        }

        Scripted_NoMovementAI::EnterEvadeMode();
    }
コード例 #23
0
 void DespawnAdds(GuidList& List)
 {
     if (!List.empty())
     {
         for (GuidList::iterator itr = List.begin(); itr != List.end(); ++itr)
         {
             if (Creature* pSummon = m_creature->GetMap()->GetCreature(*itr))
                 pSummon->ForcedDespawn();
         }
         List.clear();
     }
 }
コード例 #24
0
ファイル: halls_of_stone.cpp プロジェクト: mynew/Core
 void UpdateAI(uint32 diff) override
 {
     if (bKaddrakActivated)
     {
         if (uiKaddrakEncounterTimer <= diff)
         {
             if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                 if (!KaddrakGUIDList.empty())
                     for (GuidList::const_iterator itr = KaddrakGUIDList.begin(); itr != KaddrakGUIDList.end(); ++itr)
                     {
                         if (Creature* pKaddrak = ObjectAccessor::GetCreature(*me, *itr))
                         {
                             if (pKaddrak->IsAlive())
                                 pKaddrak->CastSpell(target, SPELL_GLARE_OF_THE_TRIBUNAL, true);
                         }
                     }
             uiKaddrakEncounterTimer = 1500;
         } else uiKaddrakEncounterTimer -= diff;
     }
     if (bMarnakActivated)
     {
         if (uiMarnakEncounterTimer <= diff)
         {
             if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
             {
                 if (Creature* summon = me->SummonCreature(NPC_DARK_MATTER_TARGET, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 1000))
                 {
                     summon->SetDisplayId(11686);
                     summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                     summon->CastSpell(target, SPELL_DARK_MATTER, true);
                 }
             }
             uiMarnakEncounterTimer = urand(30000, 31000);
         } else uiMarnakEncounterTimer -= diff;
     }
     if (bAbedneumActivated)
     {
         if (uiAbedneumEncounterTimer <= diff)
         {
             if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
             {
                 if (Creature* summon = me->SummonCreature(NPC_SEARING_GAZE_TARGET, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 1000))
                 {
                     summon->SetDisplayId(11686);
                     summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                     summon->CastSpell(target, SPELL_SEARING_GAZE, true);
                 }
             }
             uiAbedneumEncounterTimer = urand(30000, 31000);
         } else uiAbedneumEncounterTimer -= diff;
     }
 }
コード例 #25
0
        bool OnCheck(Player* player, Unit* target) override
        {
            if (!target)
                return false;

            GuidList intenseColdList = ENSURE_AI(boss_keristrasza::boss_keristraszaAI, target->ToCreature()->AI())->intenseColdList;
            if (!intenseColdList.empty())
                for (GuidList::iterator itr = intenseColdList.begin(); itr != intenseColdList.end(); ++itr)
                    if (player->GetGUID() == *itr)
                        return false;

            return true;
        }
コード例 #26
0
    void DoDespawnSummons(bool bIsEventEnd = false)
    {
        for (GuidList::const_iterator itr = m_lSummonedGuidList.begin(); itr != m_lSummonedGuidList.end(); ++itr)
        {
            if (Creature* pTemp = m_creature->GetMap()->GetCreature(*itr))
            {
                if (bIsEventEnd && (pTemp->GetEntry() == NPC_INJURED_PEASANT || pTemp->GetEntry() == NPC_PLAGUED_PEASANT))
                    continue;

                pTemp->ForcedDespawn();
            }
        }
    }
コード例 #27
0
    void JustReachedHome() override
    {
        if (m_pInstance)
            m_pInstance->SetData(TYPE_THERMAPLUGG, FAIL);

        // Remove remaining bombs
        for (GuidList::const_iterator itr = m_lSummonedBombGUIDs.begin(); itr != m_lSummonedBombGUIDs.end(); ++itr)
        {
            if (Creature* pBomb = m_creature->GetMap()->GetCreature(*itr))
                pBomb->ForcedDespawn();
        }
        m_lSummonedBombGUIDs.clear();
    }
コード例 #28
0
    void DoRemoveAdds()
    {
        for (GuidList::iterator i = m_lSummonedAddsGuids.begin(); i != m_lSummonedAddsGuids.end(); ++i)
        {
            if (Creature* pTmp = m_creature->GetMap()->GetCreature(*i))
                pTmp->ForcedDespawn();
        }

        std::list<Creature*> lWorms;
        GetCreatureListWithEntryInGrid(lWorms, m_creature, NPC_ROT_WORM, 100.0f);
        for (std::list<Creature*>::iterator i = lWorms.begin(); i != lWorms.end(); ++i)
            (*i)->ForcedDespawn();
    }
コード例 #29
0
ファイル: boss_ionar.cpp プロジェクト: jviljoen82/ScriptDev3
    void DespawnSpark()
    {
        for (GuidList::const_iterator itr = m_lSparkGUIDList.begin(); itr != m_lSparkGUIDList.end(); ++itr)
        {
            if (Creature* pTemp = m_creature->GetMap()->GetCreature(*itr))
            {
                if (pTemp->IsAlive())
                    pTemp->ForcedDespawn();
            }
        }

        m_lSparkGUIDList.clear();
    }
コード例 #30
0
    void UpdateEscortAI(const uint32 uiDiff) override
    {
        DialogueUpdate(uiDiff);

        // Check if all Onyxia guards are dead
        if (m_uiGuardCheckTimer)
        {
            if (m_uiGuardCheckTimer <= uiDiff)
            {
                uint8 uiDeadGuardsCount = 0;
                for (GuidList::const_iterator itr = m_lRoyalGuardsGuidList.begin(); itr != m_lRoyalGuardsGuidList.end(); ++itr)
                {
                    if (Creature* pGuard = m_creature->GetMap()->GetCreature(*itr))
                    {
                        if (!pGuard->isAlive() && pGuard->GetEntry() == NPC_GUARD_ONYXIA)
                            ++uiDeadGuardsCount;
                    }
                }
                if (uiDeadGuardsCount == m_lRoyalGuardsGuidList.size())
                {
                    StartNextDialogueText(NPC_GUARD_ONYXIA);
                    m_uiGuardCheckTimer = 0;
                }
                else
                    m_uiGuardCheckTimer = 1000;
            }
            else
                m_uiGuardCheckTimer -= uiDiff;
        }

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

        if (m_uiHammerTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_HAMMER_OF_JUSTICE) == CAST_OK)
                m_uiHammerTimer = 60000;
        }
        else
            m_uiHammerTimer -= uiDiff;

        if (m_uiCleaveTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_STRONG_CLEAVE) == CAST_OK)
                m_uiCleaveTimer = urand(1000, 5000);
        }
        else
            m_uiCleaveTimer -= uiDiff;

        DoMeleeAttackIfReady();
    }