Example #1
0
    void SummonedCreatureJustDied(Creature* pSummoned) override
    {
        if (pSummoned->GetEntry() == NPC_IRONTREE_STOMPER || pSummoned->GetEntry() == NPC_IRONTREE_WANDERER)
        {
            m_lSummonsGuids.remove(pSummoned->GetObjectGuid());

            if (m_lSummonsGuids.empty())
                StartNextDialogueText(SAY_CLEAR_PATH);
        }
    }
Example #2
0
    // 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;
    }
Example #3
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;
    }
Example #4
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();
    }
Example #5
0
 // 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();
         }
     }
 }
Example #6
0
        ObjectGuid SelectRandomVolunteer()
        {
            if (m_lVolunteerGuidList.empty())
                return ObjectGuid();

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

            return *iter;
        }
 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();
         }
     }
 }
Example #8
0
    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);
    }
Example #9
0
    // 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);
    }
Example #10
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)
        {
            if (Player* pPlayer = m_creature->GetMap()->GetPlayer(*itr))
                pPlayer->CastSpell(pPlayer, SPELL_PORT_OUT_STOMACH_EFFECT, TRIGGERED_OLD_TRIGGERED);
        }

        Scripted_NoMovementAI::EnterEvadeMode();
    }
Example #11
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);
         }
     }
 }
Example #12
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();
        }
    }
    // 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();
    }
Example #14
0
    // 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();
        }
    }
Example #15
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();
     }
 }
Example #16
0
 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();
 }
 void DoSummonGuards()
 {
     // 4 adds
     if (Creature* pTmp = m_creature->SummonCreature(NPC_KORKRON_REAVER, fPositions[3][0], fPositions[3][1], fPositions[3][2], fPositions[3][3], TEMPSUMMON_MANUAL_DESPAWN, 0))
         m_lGuards.push_back(pTmp->GetObjectGuid());
     if (Creature* pTmp = m_creature->SummonCreature(NPC_KORKRON_REAVER, fPositions[4][0], fPositions[4][1], fPositions[4][2], fPositions[4][3], TEMPSUMMON_MANUAL_DESPAWN, 0))
         m_lGuards.push_back(pTmp->GetObjectGuid());
     if (Creature* pTmp = m_creature->SummonCreature(NPC_KORKRON_REAVER, fPositions[5][0], fPositions[5][1], fPositions[5][2], fPositions[5][3], TEMPSUMMON_MANUAL_DESPAWN, 0))
         m_lGuards.push_back(pTmp->GetObjectGuid());
     if (Creature* pTmp = m_creature->SummonCreature(NPC_KORKRON_REAVER, fPositions[6][0], fPositions[6][1], fPositions[6][2], fPositions[6][3], TEMPSUMMON_MANUAL_DESPAWN, 0))
         m_lGuards.push_back(pTmp->GetObjectGuid());
 }
Example #18
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();
    }
Example #19
0
 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;
     }
 }
Example #20
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;
        }
Example #21
0
        void Reset() override
        {
            if (!HasEscortState(STATE_ESCORT_ESCORTING))
            {
                uiTimer = 0;
                uiPhase = 0;

                RestoreAll();

                SummonList.clear();
                GoSummonList.clear();
            }
        }
 void SendAddsUpStairs(uint32 count)
 {
     //pop a add from list, send him up the stairs...
     for (uint32 addCount = 0; addCount<count && !addsAtBase.empty(); addCount++)
     {
         if (Creature* add = instance->GetCreature(*addsAtBase.begin()))
         {
             add->GetMotionMaster()->MovePath(PATH_ADDS, false);
             movedadds.push_back(add->GetGUID());
         }
         addsAtBase.erase(addsAtBase.begin());
     }
 }
Example #23
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();
    }
    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();
    }
Example #25
0
    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();
    }
    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();
            }
        }
    }
Example #27
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();
    }
Example #28
0
    void DespawnGolems()
    {
        if (m_lGolemGUIDList.empty())
            return;

        for (GuidList::const_iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr)
        {
            if (Creature* pTemp = m_creature->GetMap()->GetCreature(*itr))
            {
                if (pTemp->isAlive())
                    pTemp->ForcedDespawn();
            }
        }
    }
    void JustReachedHome() override
    {
        for (GuidList::const_iterator itr = m_lAssistList.begin(); itr != m_lAssistList.end(); ++itr)
        {
            if (*itr == m_creature->GetObjectGuid())
                continue;

            if (Creature* pBuddy = m_creature->GetMap()->GetCreature(*itr))
            {
                if (pBuddy->isDead())
                    pBuddy->Respawn();
            }
        }
    }
Example #30
0
    void JustDied(Unit* /*pKiller*/) override
    {
        DoScriptText(aTexts[3][m_uiFace], m_creature);

        if (m_pInstance)
            m_pInstance->SetData(TYPE_DEVOURER_OF_SOULS, DONE);

        for (GuidList::const_iterator itr = m_lWellGuids.begin(); itr != m_lWellGuids.end(); ++itr)
        {
            if (Creature* pWell = m_creature->GetMap()->GetCreature(*itr))
                pWell->ForcedDespawn();
        }
        m_lWellGuids.clear();
    }