Example #1
0
    Creature* RespawnNearbyBugsAndGetOne()
    {
        std::list<Creature*> lUnitList;
        me->GetCreatureListWithEntryInGrid(lUnitList, 15316, 150.0f);
        me->GetCreatureListWithEntryInGrid(lUnitList, 15317, 150.0f);

        if (lUnitList.empty())
            return NULL;

        Creature* nearb = NULL;

        for (std::list<Creature*>::const_iterator iter = lUnitList.begin(); iter != lUnitList.end(); ++iter)
        {
            Creature* c = *iter;
            if (c)
            {
                if (c->isDead())
                {
                    c->Respawn();
                    c->setFaction(7);
                    c->RemoveAllAuras();
                }
                if (c->IsWithinDistInMap(me, ABUSE_BUG_RANGE))
                {
                    if (!nearb || (rand()%4) == 0)
                        nearb = c;
                }
            }
        }
        return nearb;
    }
Example #2
0
    void Aggro(Unit *pWho)
    {
        if(!pInstance) return;
        if (pWho->GetTypeId() != TYPEID_PLAYER)
            return;

        Creature* pBlightTarget = m_creature->GetMap()->GetCreature(blightTargetGUID);

        pInstance->SetData(TYPE_FESTERGUT, IN_PROGRESS);
        DoScriptText(-1631203,m_creature,pWho);
        if (pBlightTarget && !pBlightTarget->isAlive())
            pBlightTarget->Respawn();
        if (pBlightTarget)
        {
            pBlightTarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
            pBlightTarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
            doRemove(SPELL_BLIGHT_VISUAL_1,pBlightTarget);
            doRemove(SPELL_BLIGHT_VISUAL_2,pBlightTarget);
            doRemove(SPELL_BLIGHT_VISUAL_3,pBlightTarget);
            doCast(SPELL_BLIGHT_VISUAL_1,pBlightTarget);
        }
        doCast(SPELL_GASEOUS_BLIGHT_1);
        doRemoveFromAll(SPELL_BLIGHT_VISUAL_3);
        doRemoveFromAll(SPELL_BLIGHT_VISUAL_2);
        doRemoveFromAll(SPELL_BLIGHT_VISUAL_1);
/*        for(uint8 i = 0; i < 3; ++i)
             if (pPuddleStalkerGUID[i])
                 doCast(SPELL_GASEOUS_SPIGOT, m_creature->GetMap()->GetCreature(pPuddleStalkerGUID[i]));
*/
    }
    //npc deathstate handling
    static bool HandleNpcSetDeathStateCommand(ChatHandler* handler, const char* args)
    {
        if (!*args)
            return false;

        Creature* pCreature = handler->getSelectedCreature();
        if (!pCreature || pCreature->isPet())
        {
            handler->SendSysMessage(LANG_SELECT_CREATURE);
            handler->SetSentErrorMessage(true);
            return false;
        }

        if (strncmp(args, "on", 3) == 0)
            pCreature->SetDeadByDefault(true);
        else if (strncmp(args, "off", 4) == 0)
            pCreature->SetDeadByDefault(false);
        else
        {
            handler->SendSysMessage(LANG_USE_BOL);
            handler->SetSentErrorMessage(true);
            return false;
        }

        pCreature->SaveToDB();
        pCreature->Respawn();

        return true;
    }
        void Reset()
        {
            ArcingSmash_Timer = 10000;
            MightyBlow_Timer = 40000;
            Whirlwind_Timer = 30000;
            Charging_Timer = 0;
            Roar_Timer = 0;

            DoCast(me, SPELL_DUAL_WIELD, false);

            Phase2 = false;

            Creature* creature = NULL;
            for (uint8 i = 0; i < 4; ++i)
            {
                if (Council[i])
                {
                    creature = (Unit::GetCreature((*me), Council[i]));
                    if (creature && !creature->IsAlive())
                    {
                        creature->Respawn();
                        creature->AI()->EnterEvadeMode();
                    }
                }
            }

            //reset encounter
            if (instance)
                instance->SetData(DATA_MAULGAREVENT, NOT_STARTED);
        }
        void Reset()
        {
            CataclysmicBolt_Timer = 10000;
            Enrage_Timer = 600000;                              //10 minutes
            SearNova_Timer = 20000+rand()%40000; // 20 - 60 seconds

            BlessingOfTides = false;

            if (instance)
            {
                uint64 RAdvisors[MAX_ADVISORS];
                RAdvisors[0] = instance->GetData64(DATA_SHARKKIS);
                RAdvisors[1] = instance->GetData64(DATA_TIDALVESS);
                RAdvisors[2] = instance->GetData64(DATA_CARIBDIS);
                //Respawn of the 3 Advisors
                Creature* pAdvisor = NULL;
                for (int i=0; i<MAX_ADVISORS; ++i)
                    if (RAdvisors[i])
                    {
                        pAdvisor = (Unit::GetCreature((*me), RAdvisors[i]));
                        if (pAdvisor && !pAdvisor->IsAlive())
                        {
                            pAdvisor->Respawn();
                            pAdvisor->AI()->EnterEvadeMode();
                            pAdvisor->GetMotionMaster()->MoveTargetedHome();
                        }
                    }
                instance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED);
            }

        }
Example #6
0
    void DoSpawnNextCrystal()
    {
        if (!m_pInstance)
            return;

        Creature* pOssirianTrigger = NULL;
        if (m_uiCrystalPosition == 0)
        {
            // Respawn static spawned crystal trigger
            pOssirianTrigger = m_pInstance->GetSingleCreatureFromStorage(NPC_OSSIRIAN_TRIGGER);
            if (pOssirianTrigger && !pOssirianTrigger->isAlive())
                pOssirianTrigger->Respawn();
        }
        else
        {
            // Summon a new crystal trigger at some position depending on m_uiCrystalPosition
            // Note: the summon points seem to be very random; requires additional research
            float fX, fY, fZ;
            m_creature->GetRandomPoint(aCrystalSpawnPos[0], aCrystalSpawnPos[1], aCrystalSpawnPos[2], 100.0f, fX, fY, fZ);
            m_creature->SummonCreature(NPC_OSSIRIAN_TRIGGER, fX, fY, fZ, 0, TEMPSUMMON_CORPSE_DESPAWN, 0);
        }
        if (!pOssirianTrigger)
            return;

        // Respawn GO near crystal trigger
        if (GameObject* pCrystal = GetClosestGameObjectWithEntry(pOssirianTrigger, GO_OSSIRIAN_CRYSTAL, 10.0f))
            m_pInstance->DoRespawnGameObject(pCrystal->GetObjectGuid(), 5 * MINUTE);

        // Increase position
        ++m_uiCrystalPosition %= MAX_CRYSTAL_POSITIONS;
    }
Example #7
0
        void Reset()
        {
            CheckTimer    = 2000;
            EndEventTimer = 0;

            DeathCount = 0;

            Creature* pMember = NULL;
            for (uint8 i = 0; i < 4; ++i)
            {
                pMember = Unit::GetCreature((*me), Council[i]);
                if (!pMember)
                    continue;

                if (!pMember->isAlive())
                {
                    pMember->RemoveCorpse();
                    pMember->Respawn();
                }
                pMember->AI()->EnterEvadeMode();
            }

            if (instance)
            {
                instance->SetData(DATA_ILLIDARICOUNCILEVENT, NOT_STARTED);
                if (Creature* VoiceTrigger = (Unit::GetCreature(*me, instance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE))))
                    VoiceTrigger->AI()->EnterEvadeMode();
            }

            EventBegun = false;

            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
            me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
            me->SetDisplayId(11686);
        }
        void MoveInLineOfSight(Unit* /*who*/)
        {
            if (!GridSearcherSucceeded)
            {
                FindChannelers();

                if (!Channelers.empty())
                {
                    for (std::list<uint64>::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr)
                    {
                        Creature* Channeler = (Unit::GetCreature(*me, *itr));
                        if (Channeler)
                        {
                            if (Channeler->isDead())
                            {
                                Channeler->RemoveCorpse();
                                Channeler->Respawn();
                            }

                            Channeler->CastSpell(me, SPELL_SHADE_SOUL_CHANNEL, true);
                            Channeler->CastSpell(me, SPELL_SHADE_SOUL_CHANNEL_2, true);
                            Channeler->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                            GridSearcherSucceeded = true;
                        }
                    }
                } else sLog->outError("SD2 ERROR: No Channelers are stored in the list. This encounter will not work properly");
            }
        }
Example #9
0
    Creature *RespawnNearbyBugsAndGetOne()
    {
        CellPair p(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
        Cell cell(p);
        cell.data.Part.reserved = ALL_DISTRICT;
        cell.SetNoCreate();

        std::list<Creature*> unitList;

        AnyBugCheck u_check(m_creature, 150);
        Trinity::CreatureListSearcher<AnyBugCheck> searcher(unitList, u_check);
        TypeContainerVisitor<Trinity::CreatureListSearcher<AnyBugCheck>, GridTypeMapContainer >  grid_creature_searcher(searcher);
        CellLock<GridReadGuard> cell_lock(cell, p);
        cell_lock->Visit(cell_lock, grid_creature_searcher, *(m_creature->GetMap()));

        Creature *nearb = NULL;

        for(std::list<Creature*>::iterator iter = unitList.begin(); iter != unitList.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 || (rand()%4)==0)
                    nearb = c;
            }
        }
        return nearb;
    }
Example #10
0
        void Reset()
        {
            if(!pInstance) return;

            if(me->isAlive())
                pInstance->SetData(TYPE_BALTHARUS, NOT_STARTED);
            me->SetRespawnDelay(7*DAY);

            uiStage = 0;
            pClone = NULL;
            inCombat = false;
            intro = false;

            m_uiChannelTimer = 1*IN_MILLISECONDS;
            m_uiEnevatingTimer = urand(10*IN_MILLISECONDS,25*IN_MILLISECONDS);
            m_uiSaberLashTimer = urand(10*IN_MILLISECONDS,15*IN_MILLISECONDS);

            pDummyTarget = me->GetMap()->GetCreature( pInstance->GetData64(NPC_BALTHARUS_TARGET));
            if(pDummyTarget) {
                if(!pDummyTarget->isAlive()) pDummyTarget->Respawn();

                pDummyTarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                pDummyTarget->GetMotionMaster()->MoveIdle();
            } else {
                pDummyTarget = me->SummonCreature(NPC_BALTHARUS_TARGET, SpawnLoc[0].x, SpawnLoc[0].y, SpawnLoc[0].z, 0.0f, TEMPSUMMON_MANUAL_DESPAWN, 1000);
                if(pDummyTarget) {
                    pDummyTarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                    pDummyTarget->GetMotionMaster()->MoveIdle();
                }
            }

            if(Creature* pTarget = me->GetMap()->GetCreature( pInstance->GetData64(NPC_XERESTRASZA)))
                me->SetUInt64Value(UNIT_FIELD_TARGET, pTarget->GetGUID());
        }
    void Reset()
    {
        ArcingSmash_Timer = 10000;
        MightyBlow_Timer = 40000;
        Whirlwind_Timer = 30000;
        Charging_Timer = 0;
        Roar_Timer = 0;

        me->CastSpell(me, SPELL_DUAL_WIELD, false);

        Phase2 = false;

        Creature* pCreature = NULL;
        for (uint8 i = 0; i < 4; i++)
        {
            if (Council[i])
            {
                pCreature = (Creature*)(Unit::GetUnit((*me), Council[i]));
                if (pCreature && !pCreature->isAlive())
                {
                    pCreature->Respawn();
                    pCreature->AI()->EnterEvadeMode();
                }
            }
        }

        //reset encounter
        if (pInstance)
            pInstance->SetData(DATA_MAULGAREVENT, NOT_STARTED);
    }