Example #1
0
    void UpdateEscortAI(const uint32 uiDiff) override
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
        {
            if (!HasEscortState(STATE_ESCORT_ESCORTING))
                return;

            if (HasEscortState(STATE_ESCORT_PAUSED))
            {
                if (m_uiExplodeTimer < uiDiff)
                {
                    if (m_bFirstBarrel)
                    {
                        switch (m_uiExplodePhase)
                        {
                            case 0:
                                DoCastSpellIfCan(m_creature, SPELL_DETONATE_EXPLOSIVES_1);

                                if (Player* pPlayer = GetPlayerForEscort())
                                    DoScriptText(SAY_HELICE_EXPLODE_1, m_creature, pPlayer);

                                m_uiExplodeTimer = 2500;
                                ++m_uiExplodePhase;
                                break;
                            case 1:
                                if (Player* pPlayer = GetPlayerForEscort())
                                    DoScriptText(SAY_HELICE_MOVE_ON, m_creature, pPlayer);

                                m_uiExplodeTimer = 2500;
                                ++m_uiExplodePhase;
                                break;
                            case 2:
                                SetEscortPaused(false);
                                m_uiExplodePhase = 0;
                                m_uiExplodeTimer = 5000;
                                m_bFirstBarrel = false;
                                break;
                        }
                    }
                    else
                    {
                        switch (m_uiExplodePhase)
                        {
                            case 0:
                                DoCastSpellIfCan(m_creature, SPELL_DETONATE_EXPLOSIVES_2);

                                if (Player* pPlayer = GetPlayerForEscort())
                                    DoScriptText(SAY_HELICE_EXPLODE_2, m_creature, pPlayer);

                                m_uiExplodeTimer = 2500;
                                ++m_uiExplodePhase;
                                break;
                            case 1:
                                SetEscortPaused(false);
                                m_uiExplodePhase = 0;
                                m_uiExplodeTimer = 5000;
                                m_bFirstBarrel = true;
                                break;
                        }
                    }
                }
                else
                    m_uiExplodeTimer -= uiDiff;
            }

            return;
        }

        DoMeleeAttackIfReady();
    }
        void UpdateAI(uint32 uiDiff)
        {
            if (uiPhase)
            {
                if (uiTimer <= uiDiff)
                {
                    switch (uiPhase)
                    {
                        case 1:
                            Talk(SAY_QUEST_ACCEPT_ATTACK);
                            uiTimer = 3000;
                            uiPhase = 2;
                            break;
                        case 2:
                            if (Creature* pTyrion = me->FindNearestCreature(NPC_TYRION, 10.0f))
                                pTyrion->AI()->Talk(SAY_TYRION_1);
                            uiTimer = 3000;
                            uiPhase = 3;
                            break;
                        case 3:
                            me->UpdateEntry(NPC_PRIESTESS_TYRIONA);
                            uiTimer = 2000;
                            uiPhase = 4;
                            break;
                        case 4:
                           SetEscortPaused(false);
                           uiPhase = 0;
                           uiTimer = 0;
                           break;
                        case 5:
                            if (Creature* pGuard = me->FindNearestCreature(NPC_STORMWIND_ROYAL, 10.0f, true))
                                pGuard->AI()->Talk(SAY_GUARD_1);
                            uiTimer = 3000;
                            uiPhase = 6;
                            break;
                        case 6:
                            Talk(SAY_SPYBOT_2);
                            uiTimer = 3000;
                            uiPhase = 7;
                            break;
                        case 7:
                            SetEscortPaused(false);
                            uiTimer = 0;
                            uiPhase = 0;
                            break;
                        case 8:
                            if (Creature* pLescovar = me->FindNearestCreature(NPC_LORD_GREGOR_LESCOVAR, 10.0f))
                                pLescovar->AI()->Talk(SAY_LESCOVAR_1);
                            uiTimer = 3000;
                            uiPhase = 9;
                            break;
                        case 9:
                            Talk(SAY_SPYBOT_4);
                            uiTimer = 3000;
                            uiPhase = 10;
                            break;
                        case 10:
                            if (Creature* pLescovar = me->FindNearestCreature(NPC_LORD_GREGOR_LESCOVAR, 10.0f))
                            {
                                if (Player* player = GetPlayerForEscort())
                                {
                                    CAST_AI(npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI, pLescovar->AI())->Start(false, false, player->GetGUID());
                                    CAST_AI(npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI, pLescovar->AI())->SetMaxPlayerDistance(200.0f);
                                }
                            }
                            me->DisappearAndDie();
                            uiTimer = 0;
                            uiPhase = 0;
                            break;
                    }
                } else uiTimer -= uiDiff;
            }
            npc_escortAI::UpdateAI(uiDiff);

            if (!UpdateVictim())
                return;

            DoMeleeAttackIfReady();
        }
Example #3
0
    void UpdateEscortAI(const uint32 uiDiff) override
    {
        if (m_uiEventTimer)
        {
            if (m_uiEventTimer <= uiDiff)
            {
                switch (m_uiPoint)
                {
                        // Corner stop -> raptors
                    case 7:
                        switch (m_uiSubeventPhase)
                        {
                            case 0:
                                // Summon raptors at first stop
                                DoSpawnMob(NPC_DEVIATE_RAPTOR, aSummonPositions[0][0], aSummonPositions[0][1]);
                                DoSpawnMob(NPC_DEVIATE_RAPTOR, aSummonPositions[1][0], aSummonPositions[1][1]);
                                m_uiEventTimer = 0;
                                ++m_uiSubeventPhase;
                                break;
                            case 1:
                                // After the summoned mobs are killed continue
                                DoScriptText(SAY_CONTINUE, m_creature);
                                SetEscortPaused(false);
                                m_uiEventTimer = 0;
                                break;
                        }
                        break;
                        // Circle stop -> vipers
                    case 15:
                        switch (m_uiSubeventPhase)
                        {
                            case 0:
                                DoScriptText(SAY_CIRCLE_BANISH, m_creature);
                                m_uiEventTimer = 2000;
                                ++m_uiSubeventPhase;
                                break;
                            case 1:
                                DoCastSpellIfCan(m_creature, SPELL_CLEANSING);
                                m_uiEventTimer = 20000;
                                ++m_uiSubeventPhase;
                                break;
                            case 2:
                                // Summon vipers at the first circle
                                for (uint8 i = 0; i < 3; ++i)
                                    DoSpawnMob(NPC_DEVIATE_VIPER, aSummonPositions[2][0], aSummonPositions[2][1] + 2 * M_PI_F / 3 * i);
                                m_uiEventTimer = 0;
                                ++m_uiSubeventPhase;
                                break;
                            case 3:
                                // Wait for casting to be complete - TODO, this might have to be done better
                                ++m_uiSubeventPhase;
                                m_uiEventTimer = 10000;
                                break;
                            case 4:
                                DoScriptText(SAY_PURIFIED, m_creature);
                                m_uiEventTimer = 0;
                                ++m_uiPoint;             // Increment this in order to avoid the special case evade
                                SetEscortPaused(false);
                                break;
                        }
                        break;
                        // Chamber stop -> ritual and final boss
                    case 32:
                        switch (m_uiSubeventPhase)
                        {
                            case 0:
                                DoScriptText(SAY_BEGIN_RITUAL, m_creature);
                                m_creature->SetStandState(UNIT_STAND_STATE_STAND);
                                m_uiEventTimer = 2000;
                                ++m_uiSubeventPhase;
                                break;
                            case 1:
                                DoCastSpellIfCan(m_creature, SPELL_AWAKENING);
                                DoScriptText(EMOTE_RITUAL_BEGIN, m_creature);
                                m_uiEventTimer = 4000;
                                ++m_uiSubeventPhase;
                                break;
                            case 2:
                                if (Creature* pNaralex = m_pInstance->GetSingleCreatureFromStorage(NPC_NARALEX))
                                    DoScriptText(EMOTE_NARALEX_AWAKE, pNaralex);
                                m_uiEventTimer = 5000;
                                ++m_uiSubeventPhase;
                                break;
                            case 3:
                                // First set of mobs
                                for (uint8 i = 0; i < 3; ++i)
                                    DoSpawnMob(NPC_DEVIATE_MOCCASIN, aSummonPositions[3][0], aSummonPositions[3][1] + M_PI_F / 3 * i);
                                m_uiEventTimer = 20000;
                                ++m_uiSubeventPhase;
                                break;
                            case 4:
                                // Second set of mobs
                                for (uint8 i = 0; i < 7; ++i)
                                    DoSpawnMob(NPC_NIGHTMARE_ECTOPLASM, aSummonPositions[3][0], aSummonPositions[3][1] + M_PI_F / 7 * i);
                                m_uiEventTimer = 0;
                                ++m_uiSubeventPhase;
                                break;
                            case 5:
                                // Advance only when all mobs are dead
                                if (Creature* pNaralex = m_pInstance->GetSingleCreatureFromStorage(NPC_NARALEX))
                                    DoScriptText(EMOTE_BREAK_THROUGH, pNaralex);
                                ++m_uiSubeventPhase;
                                m_uiEventTimer = 10000;
                                break;
                            case 6:
                                // Mutanus
                                if (Creature* pNaralex = m_pInstance->GetSingleCreatureFromStorage(NPC_NARALEX))
                                    DoScriptText(EMOTE_VISION, pNaralex);
                                DoSpawnMob(NPC_MUTANUS, aSummonPositions[4][0], aSummonPositions[4][1]);
                                m_uiEventTimer = 0;
                                ++m_uiSubeventPhase;
                                break;
                            case 7:
                                // Awaken Naralex after mutanus is defeated
                                if (Creature* pNaralex = m_pInstance->GetSingleCreatureFromStorage(NPC_NARALEX))
                                {
                                    pNaralex->SetStandState(UNIT_STAND_STATE_SIT);
                                    DoScriptText(SAY_NARALEX_AWAKE, pNaralex);
                                }
                                m_creature->InterruptNonMeleeSpells(false, SPELL_AWAKENING);
                                m_creature->RemoveAurasDueToSpell(SPELL_AWAKENING);
                                m_pInstance->SetData(TYPE_DISCIPLE, DONE);
                                ++m_uiSubeventPhase;
                                m_uiEventTimer = 2000;
                                break;
                            case 8:
                                DoScriptText(SAY_AWAKE, m_creature);
                                m_uiEventTimer = 5000;
                                ++m_uiSubeventPhase;
                                break;
                            case 9:
                                if (Creature* pNaralex = m_pInstance->GetSingleCreatureFromStorage(NPC_NARALEX))
                                {
                                    DoScriptText(SAY_NARALEX_THANKYOU, pNaralex);
                                    pNaralex->SetStandState(UNIT_STAND_STATE_STAND);
                                }
                                m_uiEventTimer = 10000;
                                ++m_uiSubeventPhase;
                                break;
                            case 10:
                                // Shapeshift into a bird
                                if (Creature* pNaralex = m_pInstance->GetSingleCreatureFromStorage(NPC_NARALEX))
                                {
                                    DoScriptText(SAY_FAREWELL, pNaralex);
                                    pNaralex->CastSpell(pNaralex, SPELL_SHAPESHIFT, false);
                                }
                                DoCastSpellIfCan(m_creature, SPELL_SHAPESHIFT);
                                m_uiEventTimer = 10000;
                                ++m_uiSubeventPhase;
                                break;
                            case 11:
                                SetEscortPaused(false);
                                m_creature->SetLevitate(true);
                                SetRun();
                                // Send them flying somewhere outside of the room
                                if (Creature* pNaralex = m_pInstance->GetSingleCreatureFromStorage(NPC_NARALEX))
                                {
                                    // ToDo: Make Naralex fly
                                    // sort of a hack, compare to boss_onyxia
                                    pNaralex->SetByteValue(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_UNK_2);

                                    // Set to flying
                                    pNaralex->SetLevitate(true);
                                    pNaralex->SetWalk(false);

                                    // Set following
                                    pNaralex->GetMotionMaster()->MoveFollow(m_creature, 5.0f, 0);
                                    // Despawn after some time
                                    pNaralex->ForcedDespawn(30000);
                                }
                                m_uiEventTimer = 0;
                                break;
                        }
                        break;
                }
            }
            else
                m_uiEventTimer -= uiDiff;
        }

        if (m_uiPotionTimer < uiDiff)
        {
            // if health lower than 80%, cast heal
            if (m_creature->GetHealthPercent() < 80.0f)
            {
                if (DoCastSpellIfCan(m_creature, SPELL_POTION) == CAST_OK)
                    m_uiPotionTimer = 45000;
            }
            else
                m_uiPotionTimer = 5000;
        }
        else
            m_uiPotionTimer -= uiDiff;

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

        if (m_uiSleepTimer < uiDiff)
        {
            if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1))
            {
                if (DoCastSpellIfCan(pTarget, SPELL_SLEEP) == CAST_OK)
                    m_uiSleepTimer = 30000;
            }
        }
        else
            m_uiSleepTimer -= uiDiff;

        DoMeleeAttackIfReady();
    }
Example #4
0
        void UpdateEscortAI(const uint32 uiDiff)
        {
            if (uiPhase)
            {
                if (uiTimer <= uiDiff)
                {
                    switch (uiPhase)
                    {
                        case 1:
                            Talk(SAY_BLASTMASTER_1);
                            NextStep(2000, true);
                            break;
                        case 2:
                            SetEscortPaused(false);
                            NextStep(0, false, 0);
                            break;
                        case 3:
                            Talk(SAY_BLASTMASTER_2);
                            SetEscortPaused(false);
                            NextStep(0, false, 0);
                            break;
                        case 4:
                            Talk(SAY_BLASTMASTER_3);
                            NextStep(3000, true);
                            break;
                        case 5:
                            Talk(SAY_BLASTMASTER_4);
                            NextStep(3000, true);
                            break;
                        case 6:
                            SetInFace(true);
                            Talk(SAY_BLASTMASTER_5);
                            Summon(1);
                            if (instance)
                                if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_RIGHT)))
                                    instance->HandleGameObject(0, true, go);
                            NextStep(3000, true);
                            break;
                        case 7:
                            Talk(SAY_BLASTMASTER_6);
                            SetEscortPaused(false);
                            NextStep(0, false, 0);
                            break;
                        case 8:
                            me->HandleEmoteCommand(EMOTE_STATE_USE_STANDING);
                            NextStep(25000, true);
                            break;
                        case 9:
                            Summon(2);
                            NextStep(0, false);
                            break;
                        case 10:
                            Summon(4);
                            Talk(SAY_BLASTMASTER_8);
                            NextStep(0, false);
                            break;
                        case 11:
                            Talk(SAY_BLASTMASTER_9);
                            NextStep(5000, true);
                            break;
                        case 12:
                            Talk(SAY_BLASTMASTER_10);
                            NextStep(5000, true);
                            break;
                        case 13:
                            Talk(SAY_BLASTMASTER_11);
                            CaveDestruction(true);
                            NextStep(8000, true);
                            break;
                        case 14:
                            Talk(SAY_BLASTMASTER_12);
                            NextStep(8500, true);
                            break;
                        case 15:
                            Talk(SAY_BLASTMASTER_13);
                            NextStep(2000, true);
                            break;
                        case 16:
                            Talk(SAY_BLASTMASTER_14);
                            SetInFace(false);
                            if (instance)
                                if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_LEFT)))
                                    instance->HandleGameObject(0, true, go);
                            NextStep(2000, true);
                            break;
                        case 17:
                            SetEscortPaused(false);
                            Talk(SAY_BLASTMASTER_15);
                            Summon(5);
                            NextStep(0, false);
                            break;
                        case 18:
                            Summon(6);
                            NextStep(0, false);
                            break;
                        case 19:
                            SetInFace(false);
                            Summon(7);
                            Talk(SAY_BLASTMASTER_16);
                            NextStep(0, false);
                            break;
                        case 20:
                            Talk(SAY_BLASTMASTER_18);
                            NextStep(2000, true);
                            break;
                        case 21:
                            Summon(8);
                            NextStep(0, false);
                            break;
                        case 22:
                            CaveDestruction(false);
                            Talk(SAY_BLASTMASTER_11);
                            NextStep(3000, true);
                            break;
                        case 23:
                            Summon(9);
                            Talk(SAY_BLASTMASTER_19);
                            NextStep(0, false);
                            break;
                    }
                } else uiTimer -= uiDiff;
            }

            if (!UpdateVictim())
                return;

            DoMeleeAttackIfReady();
        }
Example #5
0
        void UpdateEscortAI(const uint32 uiDiff)
        {
            if (uiPhaseTimer <= uiDiff)
            {
                switch(uiStep)
                {
                case 1:
                    if (pInstance)
                    {
                        if (pInstance->GetData(DATA_BRANN_EVENT) != NOT_STARTED)
                            return;
                        pInstance->SetData(DATA_BRANN_EVENT, IN_PROGRESS);
                    }
                    bIsBattle = false;
                    DoScriptText(SAY_ESCORT_START, me);
                    SetRun(true);
                    JumpToNextStep(0);
                    break;
                case 3:
                    SetEscortPaused(false);
                    JumpToNextStep(0);
                    break;
                case 5:
                    if (pInstance)
                        if (Creature* pTemp = (Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))))
                            DoScriptText(SAY_EVENT_INTRO_3_ABED, pTemp);
                    JumpToNextStep(8500);
                    break;
                case 6:
                    DoScriptText(SAY_EVENT_A_1, me);
                    JumpToNextStep(6500);
                    break;
                case 7:
                    if (pInstance)
                        if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_KADDRAK)))
                            DoScriptText(SAY_EVENT_A_2_KADD, pTemp);
                    JumpToNextStep(12500);
                    break;
                case 8:
                    DoScriptText(SAY_EVENT_A_3, me);
                    if (pInstance)
                        pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_KADDRAK), true);
                    if (Creature* pTemp = Unit::GetCreature(*me, uiControllerGUID))
                        CAST_AI(mob_tribuna_controller::mob_tribuna_controllerAI, pTemp->AI())->bKaddrakActivated = true;
                    JumpToNextStep(5000);
                    break;
                case 9:
                    me->SetReactState(REACT_PASSIVE);
                    SpawnDwarf(1);
                    JumpToNextStep(20000);
                    break;
                case 10:
                    DoScriptText(SAY_EVENT_B_1, me);
                    JumpToNextStep(6000);
                    break;
                case 11:
                    if (pInstance)
                        if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_MARNAK)))
                            DoScriptText(SAY_EVENT_B_2_MARN, pTemp);
                    SpawnDwarf(1);
                    JumpToNextStep(20000);
                    break;
                case 12:
                    DoScriptText(SAY_EVENT_B_3, me);
                    if (pInstance)
                        pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_MARNAK), true);
                    if (Creature* pTemp = Unit::GetCreature(*me, uiControllerGUID))
                        CAST_AI(mob_tribuna_controller::mob_tribuna_controllerAI, pTemp->AI())->bMarnakActivated = true;
                    JumpToNextStep(10000);
                    break;
                case 13:
                    SpawnDwarf(1);
                    JumpToNextStep(10000);
                    break;
                case 14:
                    SpawnDwarf(2);
                    JumpToNextStep(20000);
                    break;
                case 15:
                    DoScriptText(SAY_EVENT_C_1, me);
                    SpawnDwarf(1);
                    JumpToNextStep(10000);
                    break;
                case 16:
                    SpawnDwarf(2);
                    JumpToNextStep(20000);
                    break;
                case 17:
                    if (pInstance)
                        if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM)))
                            DoScriptText(SAY_EVENT_C_2_ABED, pTemp);
                    SpawnDwarf(1);
                    JumpToNextStep(20000);
                    break;
                case 18:
                    DoScriptText(SAY_EVENT_C_3, me);
                    if (pInstance)
                        pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_ABEDNEUM), true);
                    if (Creature* pTemp = Unit::GetCreature(*me, uiControllerGUID))
                        CAST_AI(mob_tribuna_controller::mob_tribuna_controllerAI, pTemp->AI())->bAbedneumActivated = true;
                    JumpToNextStep(5000);
                    break;
                case 19:
                    SpawnDwarf(2);
                    JumpToNextStep(10000);
                    break;
                case 20:
                    SpawnDwarf(1);
                    JumpToNextStep(15000);
                    break;
                case 21:
                    DoScriptText(SAY_EVENT_D_1, me);
                    SpawnDwarf(3);
                    JumpToNextStep(20000);
                    break;
                case 22:
                    if (pInstance)
                        if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM)))
                            DoScriptText(SAY_EVENT_D_2_ABED, pTemp);
                    SpawnDwarf(1);
                    JumpToNextStep(5000);
                    break;
                case 23:
                    SpawnDwarf(2);
                    JumpToNextStep(15000);
                    break;
                case 24:
                    DoScriptText(SAY_EVENT_D_3, me);
                    SpawnDwarf(3);
                    JumpToNextStep(5000);
                    break;
                case 25:
                    SpawnDwarf(1);
                    JumpToNextStep(5000);
                    break;
                case 26:
                    SpawnDwarf(2);
                    JumpToNextStep(10000);
                    break;
                case 27:
                    if (pInstance)
                        if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM)))
                            DoScriptText(SAY_EVENT_D_4_ABED, pTemp);
                    SpawnDwarf(1);
                    JumpToNextStep(10000);
                    break;
                case 28:
                    me->SetReactState(REACT_DEFENSIVE);
                    DoScriptText(SAY_EVENT_END_01, me);
                    me->SetStandState(UNIT_STAND_STATE_STAND);
                    if (pInstance)
                        pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_SKY_FLOOR), true);
                    if (Creature* pTemp = Unit::GetCreature(*me, uiControllerGUID))
                        pTemp->DealDamage(pTemp, pTemp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
                    bIsBattle = true;
                    SetEscortPaused(false);
                    JumpToNextStep(6500);
                    break;
                case 29:
                    DoScriptText(SAY_EVENT_END_02, me);
                    if (pInstance)
                    {
                        pInstance->SetData(DATA_BRANN_EVENT, DONE);

                        // Achievement criteria is with spell 59046 which does not exist.
                        // There is thus no way it can be given by casting the spell on the players.
                        pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 59046);

                        if (!bHasBeenDamaged)
                            pInstance->DoCompleteAchievement(ACHIEV_BRANN_SPANKIN_NEW);

                        // Award Justice Points
                        if (Map* map = pInstance->instance)
                        {
                            Map::PlayerList const &PlayerList = map->GetPlayers();
                            if (!PlayerList.isEmpty())
                            {
                                for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                                {
                                    if (Player* player = i->getSource())
                                        player->ModifyCurrency(395, 1600);
                                }
                            }
                        }
                    }

                    JumpToNextStep(5500);
                    break;
                case 30:
                    if (pInstance)
                        if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM)))
                            DoScriptText(SAY_EVENT_END_03_ABED, pTemp);
                    JumpToNextStep(8500);
                    break;
                case 31:
                    DoScriptText(SAY_EVENT_END_04, me);
                    JumpToNextStep(11500);
                    break;
                case 32:
                    if (pInstance)
                        if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM)))
                            DoScriptText(SAY_EVENT_END_05_ABED, pTemp);
                    JumpToNextStep(11500);
                    break;
                case 33:
                    DoScriptText(SAY_EVENT_END_06, me);
                    JumpToNextStep(4500);
                    break;
                case 34:
                    if (pInstance)
                        if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM)))
                            DoScriptText(SAY_EVENT_END_07_ABED, pTemp);
                    JumpToNextStep(22500);
                    break;
                case 35:
                    DoScriptText(SAY_EVENT_END_08, me);
                    JumpToNextStep(7500);
                    break;
                case 36:
                    if (pInstance)
                        if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_KADDRAK)))
                            DoScriptText(SAY_EVENT_END_09_KADD, pTemp);
                    JumpToNextStep(18500);
                    break;
                case 37:
                    DoScriptText(SAY_EVENT_END_10, me);
                    JumpToNextStep(5500);
                    break;
                case 38:
                    if (pInstance)
                        if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_KADDRAK)))
                            DoScriptText(SAY_EVENT_END_11_KADD, pTemp);
                    JumpToNextStep(20500);
                    break;
                case 39:
                    DoScriptText(SAY_EVENT_END_12, me);
                    JumpToNextStep(2500);
                    break;
                case 40:
                    if (pInstance)
                        if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_KADDRAK)))
                            DoScriptText(SAY_EVENT_END_13_KADD, pTemp);
                    JumpToNextStep(19500);
                    break;
                case 41:
                    DoScriptText(SAY_EVENT_END_14, me);
                    JumpToNextStep(10500);
                    break;
                case 42:
                    if (pInstance)
                        if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_MARNAK)))
                            DoScriptText(SAY_EVENT_END_15_MARN, pTemp);
                    JumpToNextStep(6500);
                    break;
                case 43:
                    DoScriptText(SAY_EVENT_END_16, me);
                    JumpToNextStep(6500);
                    break;
                case 44:
                    if (pInstance)
                        if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_MARNAK)))
                            DoScriptText(SAY_EVENT_END_17_MARN, pTemp);
                    JumpToNextStep(25500);
                    break;
                case 45:
                    DoScriptText(SAY_EVENT_END_18, me);
                    JumpToNextStep(23500);
                    break;
                case 46:
                    if (pInstance)
                        if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_MARNAK)))
                            DoScriptText(SAY_EVENT_END_19_MARN, pTemp);
                    JumpToNextStep(3500);
                    break;
                case 47:
                    DoScriptText(SAY_EVENT_END_20, me);
                    JumpToNextStep(8500);
                    break;
                case 48:
                    if (pInstance)
                        if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM)))
                            DoScriptText(SAY_EVENT_END_21_ABED, pTemp);
                    JumpToNextStep(5500);
                    break;
                case 49:
                {
                    if (pInstance)
                    {
                        pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_KADDRAK), false);
                        pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_MARNAK), false);
                        pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_ABEDNEUM), false);
                        pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_SKY_FLOOR), false);
                    }
                    Player* pPlayer = GetPlayerForEscort();
                    if (pPlayer)
                        pPlayer->GroupEventHappens(QUEST_HALLS_OF_STONE, me);
                    me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
                    JumpToNextStep(180000);
                    break;
                }
                case 50:
                    SetEscortPaused(false);
                    break;
                }
            } else uiPhaseTimer -= uiDiff;

            if (!bIsLowHP && HealthBelowPct(30))
            {
                DoScriptText(SAY_LOW_HEALTH, me);
                bIsLowHP = true;
            }
            else if (bIsLowHP && !HealthBelowPct(30))
                bIsLowHP = false;

            if (!UpdateVictim())
                return;

            DoMeleeAttackIfReady();
        }
Example #6
0
        void UpdateEscortAI(const uint32 uiDiff)
        {
            if (uiPhaseTimer <= uiDiff)
            {
                switch (uiStep)
                {
                    case 1:
                        if (instance)
                        {
                            if (instance->GetData(DATA_BRANN_EVENT) != NOT_STARTED)
                                return;
                            instance->SetData(DATA_BRANN_EVENT, IN_PROGRESS);
                        }
                        bIsBattle = false;
                        Talk(SAY_ESCORT_START);
                        SetRun(true);
                        JumpToNextStep(0);
                        break;
                    case 3:
                        SetEscortPaused(false);
                        JumpToNextStep(0);
                        break;
                    case 5:
                        if (instance)
                            if (Creature* temp = (Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))))
                                temp->AI()->Talk(SAY_EVENT_INTRO_3_ABED);
                            JumpToNextStep(8500);
                        break;
                    case 6:
                        Talk(SAY_EVENT_A_1);
                        JumpToNextStep(6500);
                        break;
                    case 7:
                        if (instance)
                            if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_KADDRAK)))
                                temp->AI()->Talk(SAY_EVENT_A_2_KADD);
                            JumpToNextStep(12500);
                        break;
                    case 8:
                        Talk(SAY_EVENT_A_3);
                        if (instance)
                            instance->HandleGameObject(instance->GetData64(DATA_GO_KADDRAK), true);
                        if (Creature* temp = Unit::GetCreature(*me, uiControllerGUID))
                            CAST_AI(mob_tribuna_controller::mob_tribuna_controllerAI, temp->AI())->bKaddrakActivated = true;
                        JumpToNextStep(5000);
                        break;
                    case 9:
                        me->SetReactState(REACT_PASSIVE);
                        SpawnDwarf(1);
                        JumpToNextStep(20000);
                        break;
                    case 10:
                        Talk(SAY_EVENT_B_1);
                        JumpToNextStep(6000);
                        break;
                    case 11:
                        if (instance)
                            if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_MARNAK)))
                                temp->AI()->Talk(SAY_EVENT_B_2_MARN);
                        SpawnDwarf(1);
                        JumpToNextStep(20000);
                        break;
                    case 12:
                        Talk(SAY_EVENT_B_3);
                        if (instance)
                            instance->HandleGameObject(instance->GetData64(DATA_GO_MARNAK), true);
                        if (Creature* temp = Unit::GetCreature(*me, uiControllerGUID))
                            CAST_AI(mob_tribuna_controller::mob_tribuna_controllerAI, temp->AI())->bMarnakActivated = true;
                        JumpToNextStep(10000);
                        break;
                    case 13:
                        SpawnDwarf(1);
                        JumpToNextStep(10000);
                        break;
                    case 14:
                        SpawnDwarf(2);
                        JumpToNextStep(20000);
                        break;
                    case 15:
                        Talk(SAY_EVENT_C_1);
                        SpawnDwarf(1);
                        JumpToNextStep(10000);
                        break;
                    case 16:
                        SpawnDwarf(2);
                        JumpToNextStep(20000);
                        break;
                    case 17:
                        if (instance)
                            if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
                                temp->AI()->Talk(SAY_EVENT_C_2_ABED);
                            SpawnDwarf(1);
                        JumpToNextStep(20000);
                        break;
                    case 18:
                        Talk(SAY_EVENT_C_3);
                        if (instance)
                            instance->HandleGameObject(instance->GetData64(DATA_GO_ABEDNEUM), true);
                        if (Creature* temp = Unit::GetCreature(*me, uiControllerGUID))
                            CAST_AI(mob_tribuna_controller::mob_tribuna_controllerAI, temp->AI())->bAbedneumActivated = true;
                        JumpToNextStep(5000);
                        break;
                    case 19:
                        SpawnDwarf(2);
                        JumpToNextStep(10000);
                        break;
                    case 20:
                        SpawnDwarf(1);
                        JumpToNextStep(15000);
                        break;
                    case 21:
                        Talk(SAY_EVENT_D_1);
                        SpawnDwarf(3);
                        JumpToNextStep(20000);
                        break;
                    case 22:
                        if (instance)
                            if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
                                temp->AI()->Talk(SAY_EVENT_D_2_ABED);
                        SpawnDwarf(1);
                        JumpToNextStep(5000);
                        break;
                    case 23:
                        SpawnDwarf(2);
                        JumpToNextStep(15000);
                        break;
                    case 24:
                        Talk(SAY_EVENT_D_3);
                        SpawnDwarf(3);
                        JumpToNextStep(5000);
                        break;
                    case 25:
                        SpawnDwarf(1);
                        JumpToNextStep(5000);
                        break;
                    case 26:
                        SpawnDwarf(2);
                        JumpToNextStep(10000);
                        break;
                    case 27:
                        if (instance)
                            if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
                                temp->AI()->Talk(SAY_EVENT_D_4_ABED);
                        SpawnDwarf(1);
                        JumpToNextStep(10000);
                        break;
                    case 28:
                        me->SetReactState(REACT_DEFENSIVE);
                        Talk(SAY_EVENT_END_01);
                        me->SetStandState(UNIT_STAND_STATE_STAND);
                        if (instance)
                            instance->HandleGameObject(instance->GetData64(DATA_GO_SKY_FLOOR), true);
                        if (Creature* temp = Unit::GetCreature(*me, uiControllerGUID))
                            temp->DealDamage(temp, temp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
                        bIsBattle = true;
                        SetEscortPaused(false);
                        JumpToNextStep(6500);
                        break;
                    case 29:
                        Talk(SAY_EVENT_END_02);
                        if (instance)
                            instance->SetData(DATA_BRANN_EVENT, DONE);
                        me->CastSpell(me, SPELL_REWARD_ACHIEVEMENT, true);
                        JumpToNextStep(5500);
                        break;
                    case 30:
                        if (instance)
                            if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
                                temp->AI()->Talk(SAY_EVENT_END_03_ABED);
                        JumpToNextStep(8500);
                        break;
                    case 31:
                        Talk(SAY_EVENT_END_04);
                        JumpToNextStep(11500);
                        break;
                    case 32:
                        if (instance)
                            if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
                                temp->AI()->Talk(SAY_EVENT_END_05_ABED);
                            JumpToNextStep(11500);
                        break;
                    case 33:
                        Talk(SAY_EVENT_END_06);
                        JumpToNextStep(4500);
                        break;
                    case 34:
                        if (instance)
                            if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
                                temp->AI()->Talk(SAY_EVENT_END_07_ABED);
                            JumpToNextStep(22500);
                        break;
                    case 35:
                        Talk(SAY_EVENT_END_08);
                        JumpToNextStep(7500);
                        break;
                    case 36:
                        if (instance)
                            if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_KADDRAK)))
                                temp->AI()->Talk(SAY_EVENT_END_09_KADD);
                        JumpToNextStep(18500);
                        break;
                    case 37:
                        Talk(SAY_EVENT_END_10);
                        JumpToNextStep(5500);
                        break;
                    case 38:
                        if (instance)
                            if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_KADDRAK)))
                                temp->AI()->Talk(SAY_EVENT_END_11_KADD);
                            JumpToNextStep(20500);
                        break;
                    case 39:
                        Talk(SAY_EVENT_END_12);
                        JumpToNextStep(2500);
                        break;
                    case 40:
                        if (instance)
                            if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_KADDRAK)))
                                temp->AI()->Talk(SAY_EVENT_END_13_KADD);
                        JumpToNextStep(19500);
                        break;
                    case 41:
                        Talk(SAY_EVENT_END_14);
                        JumpToNextStep(10500);
                        break;
                    case 42:
                        if (instance)
                            if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_MARNAK)))
                                temp->AI()->Talk(SAY_EVENT_END_15_MARN);
                            JumpToNextStep(6500);
                        break;
                    case 43:
                        Talk(SAY_EVENT_END_16);
                        JumpToNextStep(6500);
                        break;
                    case 44:
                        if (instance)
                            if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_MARNAK)))
                                temp->AI()->Talk(SAY_EVENT_END_17_MARN);
                            JumpToNextStep(25500);
                        break;
                    case 45:
                        Talk(SAY_EVENT_END_18);
                        JumpToNextStep(23500);
                        break;
                    case 46:
                        if (instance)
                            if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_MARNAK)))
                                temp->AI()->Talk(SAY_EVENT_END_19_MARN);
                            JumpToNextStep(3500);
                        break;
                    case 47:
                        Talk(SAY_EVENT_END_20);
                        JumpToNextStep(8500);
                        break;
                    case 48:
                        if (instance)
                            if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
                                temp->AI()->Talk(SAY_EVENT_END_21_ABED);
                            JumpToNextStep(5500);
                        break;
                    case 49:
                    {
                        if (instance)
                        {
                            instance->HandleGameObject(instance->GetData64(DATA_GO_KADDRAK), false);
                            instance->HandleGameObject(instance->GetData64(DATA_GO_MARNAK), false);
                            instance->HandleGameObject(instance->GetData64(DATA_GO_ABEDNEUM), false);
                            instance->HandleGameObject(instance->GetData64(DATA_GO_SKY_FLOOR), false);
                        }
                        Player* player = GetPlayerForEscort();
                        if (player)
                            player->GroupEventHappens(QUEST_HALLS_OF_STONE, me);
                        me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
                        JumpToNextStep(180000);
                        break;
                    }
                    case 50:
                        SetEscortPaused(false);
                        break;
                }
            } else uiPhaseTimer -= uiDiff;

            if (!bIsLowHP && HealthBelowPct(30))
            {
                Talk(SAY_LOW_HEALTH);
                bIsLowHP = true;
            }
            else if (bIsLowHP && !HealthBelowPct(30))
                bIsLowHP = false;

            if (!UpdateVictim())
                return;

            DoMeleeAttackIfReady();
        }
 void StartWP()
 {
     me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
     SetEscortPaused(false);
 }
Example #8
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (uiPhase)
        {
            if (uiTimer <= uiDiff)
            {
                switch(uiPhase)
                {
                    case 1:
                        if (Creature* pGuard = m_creature->FindNearestCreature(NPC_STORMWIND_ROYAL, 8.0f, true))
                            DoScriptText(SAY_GUARD_2, pGuard);
                        uiTimer = 3000;
                        uiPhase = 2;
                        break;
                    case 2:
                        DoGuardsDisappearAndDie();
                        uiTimer = 2000;
                        uiPhase = 3;
                        break;
                    case 3:
                        SetEscortPaused(false);
                        uiTimer = 0;
                        uiPhase = 0;
                        break;
                    case 4:
                        DoScriptText(SAY_LESCOVAR_3, m_creature);
                        uiTimer = 0;
                        uiPhase = 0;
                        break;
                    case 5:
                        if (pMarzon)
                            DoScriptText(SAY_MARZON_1, pMarzon);
                        uiTimer = 3000;
                        uiPhase = 6;
                        break;
                    case 6:
                        DoScriptText(SAY_LESCOVAR_4, m_creature);
                        if (Player* pPlayer = GetPlayerForEscort())
                            pPlayer->AreaExploredOrEventHappens(QUEST_THE_ATTACK);
                        uiTimer = 2000;
                        uiPhase = 7;
                        break;
                    case 7:
                        if (Creature* pTyrion = m_creature->FindNearestCreature(NPC_TYRION, 20.0f, true))
                            DoScriptText(SAY_TYRION_2, pTyrion);
                        if (pMarzon)
                            pMarzon->setFaction(14);
                        m_creature->setFaction(14);
                        uiTimer = 0;
                        uiPhase = 0;
                        break;
                }
            } else uiTimer -= uiDiff;
        }
        npc_escortAI::UpdateAI(uiDiff);

        if (!UpdateVictim())
            return;

        DoMeleeAttackIfReady();
    }
Example #9
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (uiPhase)
        {
            if (uiTimer <= uiDiff)
            {
                switch(uiPhase)
                {
                    case 1:
                        DoScriptText(SAY_QUEST_ACCEPT_ATTACK, m_creature);
                        uiTimer = 3000;
                        uiPhase = 2;
                        break;
                    case 2:
                        if (pTyrion)
                            DoScriptText(SAY_TYRION_1, pTyrion);
                        uiTimer = 3000;
                        uiPhase = 3;
                        break;
                    case 3:
                        m_creature->UpdateEntry(NPC_PRIESTESS_TYRIONA, ALLIANCE);
                        uiTimer = 2000;
                        uiPhase = 4;
                        break;
                    case 4:
                       SetEscortPaused(false);
                       uiPhase = 0;
                       uiTimer = 0;
                       break;
                    case 5:
                        if (Creature* pGuard = m_creature->FindNearestCreature(NPC_STORMWIND_ROYAL, 10.0f, true))
                            DoScriptText(SAY_GUARD_1, pGuard);
                        uiTimer = 3000;
                        uiPhase = 6;
                        break;
                    case 6:
                        DoScriptText(SAY_SPYBOT_2, m_creature);
                        uiTimer = 3000;
                        uiPhase = 7;
                        break;
                    case 7:
                        SetEscortPaused(false);
                        uiTimer = 0;
                        uiPhase = 0;
                        break;
                    case 8:
                        if (pLescovar)
                            DoScriptText(SAY_LESCOVAR_1, pLescovar);
                        uiTimer = 3000;
                        uiPhase = 9;
                        break;
                    case 9:
                        DoScriptText(SAY_SPYBOT_4, m_creature);
                        uiTimer = 3000;
                        uiPhase = 10;
                        break;
                    case 10:
                        if (pLescovar && pLescovar->isAlive())
                        {
                            if (Player* pPlayer = GetPlayerForEscort())
                                CAST_AI(npc_lord_gregor_lescovarAI,pLescovar->AI())->Start(false, false, pPlayer->GetGUID());
                            CAST_AI(npc_lord_gregor_lescovarAI, pLescovar->AI())->SetMaxPlayerDistance(200.0f);
                        }
                        m_creature->DisappearAndDie();
                        uiTimer = 0;
                        uiPhase = 0;
                        break;
                }
            } else uiTimer -= uiDiff;
        }
        npc_escortAI::UpdateAI(uiDiff);

        if (!UpdateVictim())
            return;

        DoMeleeAttackIfReady();
    }
Example #10
0
        void UpdateAI(const uint32 Diff)
        {
            if (Phase)
            {
                if (Timer <= Diff)
                {
                    switch (Phase)
                    {
                        case 1:
                            if (Creature* guard = me->FindNearestCreature(NPC_STORMWIND_ROYAL, 8.0f, true))
                                DoScriptText(SAY_GUARD_2, guard);
                            Timer = 3000;
                            Phase = 2;
                            break;
                        case 2:
                            DoGuardsDisappearAndDie();
                            Timer = 2000;
                            Phase = 3;
                            break;
                        case 3:
                            SetEscortPaused(false);
                            Timer = 0;
                            Phase = 0;
                            break;
                        case 4:
                            DoScriptText(SAY_LESCOVAR_3, me);
                            Timer = 0;
                            Phase = 0;
                            break;
                        case 5:
                            if (Creature* marzon = Unit::GetCreature(*me, MarzonGUID))
                                DoScriptText(SAY_MARZON_1, marzon);
                            Timer = 3000;
                            Phase = 6;
                            break;
                        case 6:
                            DoScriptText(SAY_LESCOVAR_4, me);
                            if (Player* player = GetPlayerForEscort())
                                player->AreaExploredOrEventHappens(QUEST_THE_ATTACK);
                            Timer = 2000;
                            Phase = 7;
                            break;
                        case 7:
                            if (Creature* tyrion = me->FindNearestCreature(NPC_TYRION, 20.0f, true))
                                DoScriptText(SAY_TYRION_2, tyrion);
                            if (Creature* marzon = Unit::GetCreature(*me, MarzonGUID))
                                marzon->setFaction(14);
                            me->setFaction(14);
                            Timer = 0;
                            Phase = 0;
                            break;
                    }
                }
                else Timer -= Diff;
            }
            npc_escortAI::UpdateAI(Diff);

            if (!UpdateVictim())
                return;

            DoMeleeAttackIfReady();
        }
Example #11
0
        void UpdateAI(const uint32 Diff)
        {
            if (Phase)
            {
                if (Timer <= Diff)
                {
                    switch (Phase)
                    {
                        case 1:
                            DoScriptText(SAY_QUEST_ACCEPT_ATTACK, me);
                            Timer = 3000;
                            Phase = 2;
                            break;
                        case 2:
                            if (Creature* tyrion = me->FindNearestCreature(NPC_TYRION, 10.0f))
                                DoScriptText(SAY_TYRION_1, tyrion);
                            Timer = 3000;
                            Phase = 3;
                            break;
                        case 3:
                            me->UpdateEntry(NPC_PRIESTESS_TYRIONA, ALLIANCE);
                            Timer = 2000;
                            Phase = 4;
                            break;
                        case 4:
                           SetEscortPaused(false);
                           Phase = 0;
                           Timer = 0;
                           break;
                        case 5:
                            if (Creature* guard = me->FindNearestCreature(NPC_STORMWIND_ROYAL, 10.0f, true))
                                DoScriptText(SAY_GUARD_1, guard);
                            Timer = 3000;
                            Phase = 6;
                            break;
                        case 6:
                            DoScriptText(SAY_SPYBOT_2, me);
                            Timer = 3000;
                            Phase = 7;
                            break;
                        case 7:
                            SetEscortPaused(false);
                            Timer = 0;
                            Phase = 0;
                            break;
                        case 8:
                            if (Creature* lescovar = me->FindNearestCreature(NPC_LORD_GREGOR_LESCOVAR, 10.0f))
                                DoScriptText(SAY_LESCOVAR_1, lescovar);
                            Timer = 3000;
                            Phase = 9;
                            break;
                        case 9:
                            DoScriptText(SAY_SPYBOT_4, me);
                            Timer = 3000;
                            Phase = 10;
                            break;
                        case 10:
                            if (Creature* lescovar = me->FindNearestCreature(NPC_LORD_GREGOR_LESCOVAR, 10.0f))
                            {
                                if (Player* player = GetPlayerForEscort())
                                {
                                    CAST_AI(npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI, lescovar->AI())->Start(false, false, player->GetGUID());
                                    CAST_AI(npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI, lescovar->AI())->SetMaxPlayerDistance(200.0f);
                                }
                            }
                            me->DisappearAndDie();
                            Timer = 0;
                            Phase = 0;
                            break;
                    }
                }
                else Timer -= Diff;
            }
            npc_escortAI::UpdateAI(Diff);

            if (!UpdateVictim())
                return;

            DoMeleeAttackIfReady();
        }
Example #12
0
    void UpdateEscortAI(const uint32 uiDiff)
    {
        if (!m_pInstance)
            return;

        if (m_pInstance->GetData(TYPE_RING_OF_LAW) == FAIL)
        {
            // Reset Doors
            if (m_uiEventPhase >= 9)                        // North Gate is opened
            {
                m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_ARENA_2));
                m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_ARENA_4));
            }
            else if (m_uiEventPhase >= 4)                   // East Gate is opened
            {
                m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_ARENA_1));
                m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_ARENA_4));
            }

            // Despawn Summoned Mobs
            for (std::list<uint64>::const_iterator itr = m_lSummonedGUIDList.begin(); itr != m_lSummonedGUIDList.end(); ++itr)
                if (Creature* pSummoned = m_creature->GetMap()->GetCreature(*itr))
                    pSummoned->ForcedDespawn();
            m_lSummonedGUIDList.clear();

            // Despawn NPC
            m_creature->ForcedDespawn();
            return;
        }

        if (m_uiEventTimer)
        {
            if (m_uiEventTimer <= uiDiff)
            {
                switch(m_uiEventPhase)
                {
                    case 0:
                        // Shortly after spawn, start walking
                        //DoScriptText(-1000000, m_creature); // no more text on spawn
                        m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_ARENA_4));
                        Start(false);
                        SetEscortPaused(false);
                        m_uiEventTimer = 0;
                        break;
                    case 1:
                        // Start walking towards wall
                        SetEscortPaused(false);
                        m_uiEventTimer = 0;
                        break;
                    case 2:
                        m_uiEventTimer = 2000;
                        break;
                    case 3:
                        // Open East Gate
                        m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_ARENA_1));
                        m_uiEventTimer = 3000;
                        break;
                    case 4:
                        SetEscortPaused(false);
                        m_creature->SetVisibility(VISIBILITY_OFF);
                        // Summon Ring Mob(s)
                        SummonRingMob(aRingMob[m_uiMobSpawnId], POS_EAST);
                        m_uiEventTimer = 8000;
                        break;
                    case 5:
                        // Summon Ring Mob(s)
                        SummonRingMob(aRingMob[m_uiMobSpawnId], POS_EAST);
                        SummonRingMob(aRingMob[m_uiMobSpawnId], POS_EAST);
                        m_uiEventTimer = 8000;
                        break;
                    case 6:
                        // Summon Ring Mob(s)
                        SummonRingMob(aRingMob[m_uiMobSpawnId], POS_EAST);
                        m_uiEventTimer = 0;
                        break;
                    case 7:
                        // Summoned Mobs are dead, continue event
                        m_creature->SetVisibility(VISIBILITY_ON);
                        m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_ARENA_1));
                        //DoScriptText(-1000000, m_creature); // after killed the mobs, no say here
                        SetEscortPaused(false);
                        m_uiEventTimer = 0;
                        break;
                    case 8:
                        // Open North Gate
                        m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_ARENA_2));
                        m_uiEventTimer = 5000;
                        break;
                    case 9:
                        // Summon Boss
                        m_creature->SetVisibility(VISIBILITY_OFF);
                        // If banner summoned after start, then summon Thelden after the creatures are dead
                        if (m_pInstance->GetData(TYPE_RING_OF_LAW) == SPECIAL && m_uiPhase == PHASE_MOBS)
                        {
                            m_uiPhase = PHASE_GLADIATORS;
                            SummonRingMob(NPC_THELDREN, POS_NORTH);
                            for (uint8 i = 0; i < MAX_THELDREN_ADDS; ++i)
                                SummonRingMob(m_uiGladiatorId[i], POS_NORTH);
                        }
                        else
                        {
                            m_uiPhase = PHASE_BOSS;
                            SummonRingMob(aRingBoss[urand(0, 5)], POS_NORTH);
                        }
                        m_uiEventTimer = 0;
                        break;
                    case 10:
                        // Boss dead
                        m_lSummonedGUIDList.clear();
                        m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_ARENA_2));
                        m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_ARENA_3));
                        m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_ARENA_4));
                        SetEscortPaused(false);
                        m_uiEventTimer = 0;
                        break;
                }
                ++m_uiEventPhase;
            }
            else
                m_uiEventTimer -= uiDiff;
        }
    }
    void UpdateEscortAI(const uint32 uiDiff) override
    {
        DialogueUpdate(uiDiff);

        if (m_uiOutroTimer)
        {
            if (m_uiOutroTimer <= uiDiff)
            {
                switch (m_uiOutroPhase)
                {
                    case 0:
                        DoScriptText(SAY_REMULOS_OUTRO_1, m_creature);
                        m_uiOutroTimer = 3000;
                        break;
                    case 1:
                        // Despawn Remulos after the outro is finished - he will respawn automatically at his home position after a few min
                        DoScriptText(SAY_REMULOS_OUTRO_2, m_creature);
                        m_creature->SetRespawnDelay(1 * MINUTE);
                        m_creature->ForcedDespawn(3000);
                        m_uiOutroTimer = 0;
                        break;
                }
                ++m_uiOutroPhase;
            }
            else
            {
                m_uiOutroTimer -= uiDiff;
            }
        }

        // during the battle
        if (m_uiShadesummonTimer)
        {
            if (m_uiShadesummonTimer <= uiDiff)
            {
                // do this yell only first time
                if (m_bIsFirstWave)
                {
                    // summon 3 shades inside the house
                    for (uint8 i = 0; i < MAX_SHADOWS; ++i)
                    {
                        m_creature->SummonCreature(NPC_NIGHTMARE_PHANTASM, aShadowsLocations[i].m_fX, aShadowsLocations[i].m_fY, aShadowsLocations[i].m_fZ, 0, TEMPSUMMON_DEAD_DESPAWN, 0);
                    }

                    if (Creature* pEranikus = m_creature->GetMap()->GetCreature(m_eranikusGuid))
                    {
                        DoScriptText(SAY_ERANIKUS_ATTACK_1, pEranikus);
                    }

                    ++m_uiSummonCount;
                    SetEscortPaused(false);
                    m_bIsFirstWave = false;
                }

                // Summon 3 shades per turn until the maximum summon turns are reached
                float fX, fY, fZ;
                // Randomize the summon point
                uint8 uiSummonPoint = roll_chance_i(70) ? uint32(MAX_SHADOWS) : urand(MAX_SHADOWS + 1, MAX_SHADOWS + 2);

                if (m_uiSummonCount < MAX_SUMMON_TURNS)
                {
                    for (uint8 i = 0; i < MAX_SHADOWS; ++i)
                    {
                        m_creature->GetRandomPoint(aShadowsLocations[uiSummonPoint].m_fX, aShadowsLocations[uiSummonPoint].m_fY, aShadowsLocations[uiSummonPoint].m_fZ, 10.0f, fX, fY, fZ);
                        m_creature->SummonCreature(NPC_NIGHTMARE_PHANTASM, fX, fY, fZ, 0.0f, TEMPSUMMON_DEAD_DESPAWN, 0);
                    }

                    ++m_uiSummonCount;
                }

                // If all the shades were summoned then set Eranikus in combat
                // We don't count the dead shades, because the boss is usually set in combat before all shades are dead
                if (m_uiSummonCount == MAX_SUMMON_TURNS)
                {
                    m_uiShadesummonTimer = 0;

                    if (Creature* pEranikus = m_creature->GetMap()->GetCreature(m_eranikusGuid))
                    {
                        pEranikus->SetByteFlag(UNIT_FIELD_BYTES_1, 3, 0);
                        pEranikus->SetLevitate(false);
                        pEranikus->GetMotionMaster()->MovePoint(POINT_ID_ERANIKUS_COMBAT, aEranikusLocations[2].m_fX, aEranikusLocations[2].m_fY, aEranikusLocations[2].m_fZ);
                    }
                }
                else
                {
                    m_uiShadesummonTimer = urand(20000, 30000);
                }
            }
            else
            {
                m_uiShadesummonTimer -= uiDiff;
            }
        }

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

        if (m_uiHealTimer < uiDiff)
        {
            if (Unit* pTarget = DoSelectLowestHpFriendly(DEFAULT_VISIBILITY_DISTANCE))
            {
                switch (urand(0, 2))
                {
                    case 0:
                        DoCastSpellIfCan(pTarget, SPELL_HEALING_TOUCH);
                        break;
                    case 1:
                        DoCastSpellIfCan(pTarget, SPELL_REJUVENATION);
                        break;
                    case 2:
                        DoCastSpellIfCan(pTarget, SPELL_REGROWTH);
                        break;
                }
            }
            m_uiHealTimer = 10000;
        }
        else
            { m_uiHealTimer -= uiDiff; }

        if (m_uiStarfireTimer < uiDiff)
        {
            if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
            {
                if (DoCastSpellIfCan(pTarget, SPELL_STARFIRE) == CAST_OK)
                {
                    m_uiStarfireTimer = 20000;
                }
            }
        }
        else
            { m_uiStarfireTimer -= uiDiff; }

        DoMeleeAttackIfReady();
    }
Example #14
0
    void UpdateEscortAI(const uint32 diff)
    {
        if (!m_pInstance)
            return;
        
        Unit* pPlayer = GetPlayerForEscort();
        if (!pPlayer)
            return;
        EventStarter = pPlayer;

        Unit* Naralex = Unit::GetUnit(*m_creature, m_pInstance->GetData64(DATA_NARALEX));
        if (!Naralex)
            return;

        if (Event_Timer && Event_Timer <= diff)
        {
            switch (Point)
            {
            case 0:
                {
                Debug(Point);
                Map *map = m_creature->GetMap();
                if (map && map->IsDungeon())
                {
                    Map::PlayerList const &PlayerList = map->GetPlayers();
                    if (!PlayerList.isEmpty())
                    {
                        for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                        {
                            if (i->getSource()->isAlive() && (i->getSource()->GetDistance(m_creature)<30))
                                m_creature->CastSpell(i->getSource(),SPELL_MARK,false);
                        }
                    }
                }
                SetEscortPaused(false);
                Event_Timer = 0;
                break;
                }

            case 1:
                Debug(Point);
                SetEscortPaused(false);
                Event_Timer = 0;
                break;

            case 15:
                Debug(Point);
                switch (Subevent_Phase)
                {
                case 0:
                    DoScriptText(SAY_BEFORE_CIRCLE,m_creature);
                    Subevent_Phase = 1;
                    Event_Timer = 2000;
                    break;
                case 1:
                    m_creature->CastSpell(m_creature,SPELL_CLEANSING,false);
                    Subevent_Phase = 2;
                    Event_Timer = 30000;
                    break;
                case 2:
                    for (int i=0; i <3; ++i)
                    {
                        SummonAttacker(MOB_DEVIATE_VIPER,Position[i][0],Position[i][1],Position[i][2]);
                    }
                    Subevent_Phase = 3;
                    Event_Timer = 2000;
                    break;
                case 3:
                    if (!m_creature->isInCombat() && !pPlayer->isInCombat())
                    {
                        DoScriptText(SAY_AFTER_CIRCLE,m_creature);
                        Point = 16;
                        Event_Timer = 2000;
                        SetEscortPaused(false);
                        break;
                    }
                    else
                    {
                        Event_Timer = 2000;
                        Subevent_Phase = 3;
                        break;
                    }
                }
                break;
            case 30:
                Debug(Point);
                SetEscortPaused(true);
                switch (Subevent_Phase)
                {
                case 0:
                    DoScriptText(SAY_BEFORE_RITUAL,m_creature);
                    Subevent_Phase = 1;
                    Event_Timer = 2000;
                    break;
                case 1:
                    m_creature->CastSpell(m_creature,SPELL_AWAKENING,false);
                    DoScriptText(EMOTE_DISCIPLE_1,m_creature);
                    Subevent_Phase = 2;
                    Event_Timer = 4000;
                    break;
                case 2:
                    DoScriptText(EMOTE_NARALEX_1, Naralex);
                    Subevent_Phase = 3;
                    Event_Timer = 5000;
                    break;
                case 3:
                    for (int i = 3; i <6; ++i)
                    {
                        SummonAttacker(MOB_DEVIATE_MOCCASIN, Position[i][0],Position[i][1],Position[i][2]);
                    }
                    Event_Timer = 40000;
                    Subevent_Phase = 4;
                    break;
                case 4:
                    for (int i = 3; i <10; ++i)
                    {
                        SummonAttacker(MOB_NIGHTMARE_ECTOPLASM, Position[i][0],Position[i][1],Position[i][2]);
                    }
                    Event_Timer = 40000;
                    Subevent_Phase = 5;
                    break;
                case 5:
                     Subevent_Phase = 6;
                     Event_Timer = 10000;
                     DoScriptText(EMOTE_NARALEX_2,Naralex);
                     DoScriptText(SAY_BEFORE_MUTANOUS,m_creature);
                     break;
                case 6:
                    SummonAttacker(MOB_MUTANOUS_DEVOURER, Position[4][0],Position[4][1],Position[4][2]);
                    Subevent_Phase = 7;
                    Event_Timer = 2000;
                    break;
                case 7:
                    if (m_pInstance->GetData(TYPE_MUTANOUS) == DONE)
                    {
                    Naralex->SetByteValue(UNIT_FIELD_BYTES_1,0,UNIT_STAND_STATE_SIT);
                    DoScriptText(SAY_NARALEX_AWAKEN,Naralex);
                    m_creature->InterruptNonMeleeSpells(false,SPELL_AWAKENING);
                    m_creature->RemoveAurasDueToSpell(SPELL_AWAKENING);
                    m_pInstance->SetData(TYPE_DISCIPLE,DONE);
                    Event_Timer = 2000;
                    Subevent_Phase = 8;
                    break;
                    }else
                    {
                    Event_Timer = 2000;
                    Subevent_Phase = 7;
                    break;
                    }
                case 8:
                    DoScriptText(SAY_DISCIPLE_FINAL,m_creature);
                    Subevent_Phase = 9;
                    Event_Timer = 5000;
                    break;
                case 9:
                    DoScriptText(SAY_NARALEX_FINAL1,Naralex);
                    Naralex->SetByteValue(UNIT_FIELD_BYTES_1,0,UNIT_STAND_STATE_STAND);
                    Event_Timer = 5000;
                    Subevent_Phase = 10;
                    break;
                case 10:
                    DoScriptText(SAY_NARALEX_FINAL2,Naralex);
                    m_creature->CastSpell(m_creature,SPELL_SHAPESHIFT,false);
                    Naralex->CastSpell(Naralex,SPELL_SHAPESHIFT,false);
                    Event_Timer = 10000;
                    Subevent_Phase = 11;
                    break;
                case 11:
                    m_creature->SendMonsterMove(Position[9][0],Position[9][1],Position[9][2],0,MONSTER_MOVE_FLY,5000);
                    Naralex->SendMonsterMove(Position[9][0],Position[9][1],Position[9][2],0,MONSTER_MOVE_FLY,5000);
                    Event_Timer = 5000;
                    Subevent_Phase = 12;
                    break;
                case 12:
                    m_creature->SetVisibility(VISIBILITY_OFF);
                    Naralex->SetVisibility(VISIBILITY_OFF);
                    break;
                }
                break;
            default: break;
            }
        }else Event_Timer -= diff;

        if (Potion_Timer < diff)
        {
            if ((m_creature->GetHealth()/m_creature->GetMaxHealth())<0.8)
                m_creature->CastSpell(m_creature, SPELL_POTION, false);
            Potion_Timer = 45000;
        } else Potion_Timer -= diff;

        if (m_creature->isInCombat() && m_creature->isInCombat() && m_creature->getVictim())
        {
            if (!Yelled)
            {
                DoScriptText(SAY_ATTACKED,m_creature,m_creature->getVictim());
                Yelled = true;
            }

            if (Sleep_Timer < diff)
            {
                if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,1))
                    m_creature->CastSpell(target,SPELL_SLEEP,false);
                Sleep_Timer = 30000;
            } else Sleep_Timer -= diff;

            DoMeleeAttackIfReady();
        }
    }
Example #15
0
 void DoAction(const int32 param)
 {
     SetEscortPaused(false);
 }
        void UpdateAI(uint32 diff) override
        {
            _events.Update(diff);

            if (UpdateVictim())
            {
                while (uint32 eventId = _events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_FROST_SHOCK:
                            DoCastVictim(SPELL_FROST_SHOCK);
                            _events.DelayEvents(1 * IN_MILLISECONDS);
                            _events.ScheduleEvent(EVENT_FROST_SHOCK, urand(10, 15) * IN_MILLISECONDS);
                            break;
                        case EVENT_SEARING_TOTEM:
                            DoCast(me, SPELL_SEARING_TOTEM);
                            _events.DelayEvents(1 * IN_MILLISECONDS);
                            _events.ScheduleEvent(EVENT_SEARING_TOTEM, urand(110, 130) * IN_MILLISECONDS);
                            break;
                        case EVENT_STRENGTH_OF_EARTH_TOTEM:
                            DoCast(me, SPELL_STRENGTH_OF_EARTH_TOTEM);
                            _events.DelayEvents(1 * IN_MILLISECONDS);
                            _events.ScheduleEvent(EVENT_STRENGTH_OF_EARTH_TOTEM, urand(110, 130) * IN_MILLISECONDS);
                            break;
                        case EVENT_HEALING_SURGE:
                        {
                            Unit* target = NULL;
                            if (me->GetHealthPct() < 85)
                                target = me;
                            else if (Player* player = GetPlayerForEscort())
                                if (player->GetHealthPct() < 85)
                                    target = player;
                            if (target)
                            {
                                DoCast(target, SPELL_HEALING_SURGE);
                                _events.ScheduleEvent(EVENT_HEALING_SURGE, 10 * IN_MILLISECONDS);
                            }
                            else
                                _events.ScheduleEvent(EVENT_HEALING_SURGE, 2 * IN_MILLISECONDS);
                            break;
                        }
                        default:
                            break;
                    }
                }

                DoMeleeAttackIfReady();
            }

            if (HasEscortState(STATE_ESCORT_NONE))
                return;

            npc_escortAI::UpdateAI(diff);

            if (_phase)
            {
                if (_moveTimer <= diff)
                {
                    switch (_phase)
                    {
                        case PHASE_WP_26: //debug skip path to point 26, buggy path calculation
                            me->GetMotionMaster()->MovePoint(WP_DEBUG_2, -2021.77f, -10648.8f, 129.903f, false);
                            _moveTimer = 2 * IN_MILLISECONDS;
                            _phase = PHASE_CONTINUE;
                            break;
                        case PHASE_CONTINUE: // continue escort
                            SetEscortPaused(false);
                            _moveTimer = 0 * IN_MILLISECONDS;
                            _phase = PHASE_NONE;
                            break;
                        case PHASE_WP_22: //debug skip path to point 22, buggy path calculation
                            me->GetMotionMaster()->MovePoint(WP_EXPLOSIVES_FIRST_PLANT, -1958.026f, -10660.465f, 111.547f, false);
                            Talk(SAY_LEGOSO_3);
                            _moveTimer = 2 * IN_MILLISECONDS;
                            _phase = PHASE_PLANT_FIRST_KNEEL;
                            break;
                        case PHASE_PLANT_FIRST_KNEEL: // plant first explosives stage 1 kneel
                            me->SetStandState(UNIT_STAND_STATE_KNEEL);
                            _moveTimer = 10 * IN_MILLISECONDS;
                            _phase = PHASE_PLANT_FIRST_STAND;
                            break;
                        case PHASE_PLANT_FIRST_STAND: // plant first explosives stage 1 stand
                            me->SetStandState(UNIT_STAND_STATE_STAND);
                            _moveTimer = 0.5* IN_MILLISECONDS;
                            _phase = PHASE_PLANT_FIRST_WORK;
                            break;
                        case PHASE_PLANT_FIRST_WORK: // plant first explosives stage 2 work
                            Talk(SAY_LEGOSO_4);
                            _moveTimer = 17.5 * IN_MILLISECONDS;
                            _phase = PHASE_PLANT_FIRST_FINISH;
                            break;
                        case PHASE_PLANT_FIRST_FINISH: // plant first explosives finish
                            _explosivesGuids.clear();
                            for (uint8 i = 0; i != MAX_EXPLOSIVES; ++i)
                            {
                                if (GameObject* explosive = me->SummonGameObject(GO_DRAENEI_EXPLOSIVES_1, ExplosivesPos[0][i].m_positionX, ExplosivesPos[0][i].m_positionY, ExplosivesPos[0][i].m_positionZ, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0))
                                    _explosivesGuids.push_back(explosive->GetGUID());
                            }
                            me->HandleEmoteCommand(EMOTE_ONESHOT_NONE); // reset anim state
                            // force runoff movement so he will not screw up next waypoint
                            me->GetMotionMaster()->MovePoint(WP_EXPLOSIVES_FIRST_RUNOFF, -1955.6f, -10669.8f, 110.65f, false);
                            Talk(SAY_LEGOSO_5);
                            _moveTimer = 1.5 * IN_MILLISECONDS;
                            _phase = PHASE_CONTINUE;
                            break;
                        case PHASE_PLANT_FIRST_TIMER_1: // first explosives detonate timer 1
                            Talk(SAY_LEGOSO_6);
                            _moveTimer = 1 * IN_MILLISECONDS;
                            _phase = PHASE_PLANT_FIRST_TIMER_2;
                            break;
                        case PHASE_PLANT_FIRST_TIMER_2: // first explosives detonate timer 2
                            Talk(SAY_LEGOSO_7);
                            _moveTimer = 1 * IN_MILLISECONDS;
                            _phase = PHASE_PLANT_FIRST_TIMER_3;
                            break;
                        case PHASE_PLANT_FIRST_TIMER_3: // first explosives detonate timer 3
                            Talk(SAY_LEGOSO_8);
                            _moveTimer = 1 * IN_MILLISECONDS;
                            _phase = PHASE_PLANT_FIRST_DETONATE;
                            break;
                        case PHASE_PLANT_FIRST_DETONATE: // first explosives detonate finish
                            for (GuidList::iterator itr = _explosivesGuids.begin(); itr != _explosivesGuids.end(); ++itr)
                            {
                                if (GameObject* explosive = ObjectAccessor::GetGameObject(*me, *itr))
                                    me->RemoveGameObject(explosive, true);
                            }
                            _explosivesGuids.clear();
                            me->HandleEmoteCommand(EMOTE_ONESHOT_CHEER);
                            _moveTimer = 2 * IN_MILLISECONDS;
                            _phase = PHASE_PLANT_FIRST_SPEECH;
                            break;
                        case PHASE_PLANT_FIRST_SPEECH: // after detonation 1 speech
                            Talk(SAY_LEGOSO_9);
                            _moveTimer = 4 * IN_MILLISECONDS;
                            _phase = PHASE_PLANT_FIRST_ROTATE;
                            break;
                        case PHASE_PLANT_FIRST_ROTATE: // after detonation 1 rotate to next point
                            me->SetFacingTo(2.272f);
                            _moveTimer = 1 * IN_MILLISECONDS;
                            _phase = PHASE_PLANT_FIRST_POINT;
                            break;
                        case PHASE_PLANT_FIRST_POINT: // after detonation 1 send point anim and go on to next point
                            me->HandleEmoteCommand(EMOTE_ONESHOT_POINT);
                            _moveTimer = 2 * IN_MILLISECONDS;
                            _phase = PHASE_CONTINUE;
                            break;
                        case PHASE_FEEL_SIRONAS_1: // legoso exclamation before sironas 1.1
                            Talk(SAY_LEGOSO_10);
                            _moveTimer = 4 * IN_MILLISECONDS;
                            _phase = PHASE_FEEL_SIRONAS_2;
                            break;
                        case PHASE_FEEL_SIRONAS_2: // legoso exclamation before sironas 1.2
                            Talk(SAY_LEGOSO_11);
                            _moveTimer = 4 * IN_MILLISECONDS;
                            _phase = PHASE_CONTINUE;
                            break;
                        case PHASE_MEET_SIRONAS_ROAR: // legoso exclamation before sironas 2.1
                            Talk(SAY_LEGOSO_12);
                            _moveTimer = 4 * IN_MILLISECONDS;
                            _phase = PHASE_MEET_SIRONAS_TURN;
                            break;
                        case PHASE_MEET_SIRONAS_TURN: // legoso exclamation before sironas 2.2
                            if (Player* player = GetPlayerForEscort())
                                me->SetFacingToObject(player);
                            _moveTimer = 1 * IN_MILLISECONDS;
                            _phase = PHASE_MEET_SIRONAS_SPEECH;
                            break;
                        case PHASE_MEET_SIRONAS_SPEECH: // legoso exclamation before sironas 2.3
                            Talk(SAY_LEGOSO_13);
                            _moveTimer = 7 * IN_MILLISECONDS;
                            _phase = PHASE_CONTINUE;
                            break;
                        case PHASE_PLANT_SECOND_KNEEL: // plant second explosives stage 1 kneel
                            me->SetStandState(UNIT_STAND_STATE_KNEEL);
                            _moveTimer = 11 * IN_MILLISECONDS;
                            _phase = PHASE_PLANT_SECOND_SPEECH;
                            break;
                        case PHASE_PLANT_SECOND_SPEECH: // plant second explosives stage 2 kneel
                            Talk(SAY_LEGOSO_14);
                            _moveTimer = 13 * IN_MILLISECONDS;
                            _phase = PHASE_PLANT_SECOND_STAND;
                            break;
                        case PHASE_PLANT_SECOND_STAND: // plant second explosives finish
                            me->SetStandState(UNIT_STAND_STATE_STAND);
                            _moveTimer = 1 * IN_MILLISECONDS;
                            _phase = PHASE_PLANT_SECOND_FINISH;
                            break;
                        case PHASE_PLANT_SECOND_FINISH: // plant second explosives finish - create explosives
                            _explosivesGuids.clear();
                            for (uint8 i = 0; i != MAX_EXPLOSIVES; ++i)
                            {
                                if (GameObject* explosive = me->SummonGameObject(GO_DRAENEI_EXPLOSIVES_2, ExplosivesPos[1][i].m_positionX, ExplosivesPos[1][i].m_positionY, ExplosivesPos[1][i].m_positionZ, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0))
                                    _explosivesGuids.push_back(explosive->GetGUID());
                            }
                            Talk(SAY_LEGOSO_15);
                            _moveTimer = 1 * IN_MILLISECONDS;
                            _phase = PHASE_PLANT_SECOND_WAIT;
                            break;
                        case PHASE_PLANT_SECOND_WAIT: // plant second explosives finish - proceed to next point
                            _moveTimer = 1 * IN_MILLISECONDS;
                            _phase = PHASE_CONTINUE;
                            break;
                        case PHASE_PLANT_SECOND_TIMER_1: // second explosives detonate timer 1
                            Talk(SAY_LEGOSO_16);
                            _moveTimer = 1 * IN_MILLISECONDS;
                            _phase = PHASE_PLANT_SECOND_TIMER_2;
                            break;
                        case PHASE_PLANT_SECOND_TIMER_2: // second explosives detonate timer 2
                            Talk(SAY_LEGOSO_17);
                            _moveTimer = 1 * IN_MILLISECONDS;
                            _phase = PHASE_PLANT_SECOND_TIMER_3;
                            break;
                        case PHASE_PLANT_SECOND_TIMER_3: // second explosives detonate timer 3
                            Talk(SAY_LEGOSO_18);
                            _moveTimer = 1 * IN_MILLISECONDS;
                            _phase = PHASE_PLANT_SECOND_DETONATE;
                            break;
                        case PHASE_PLANT_SECOND_DETONATE: // second explosives detonate finish
                            for (GuidList::iterator itr = _explosivesGuids.begin(); itr != _explosivesGuids.end(); ++itr)
                            {
                                if (GameObject* explosive = ObjectAccessor::GetGameObject(*me, *itr))
                                    me->RemoveGameObject(explosive, true);
                            }
                            _explosivesGuids.clear();
                            if (Creature* sironas = me->FindNearestCreature(NPC_SIRONAS, SIZE_OF_GRIDS))
                            {
                                sironas->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
                                me->SetFacingToObject(sironas);
                            }
                            _moveTimer = 1 * IN_MILLISECONDS;
                            _phase = PHASE_FIGHT_SIRONAS_STOP;
                            break;
                        case PHASE_FIGHT_SIRONAS_STOP: // sironas channel stop
                            if (Creature* sironas = me->FindNearestCreature(NPC_SIRONAS, SIZE_OF_GRIDS))
                                sironas->AI()->DoAction(ACTION_SIRONAS_CHANNEL_STOP);
                            _moveTimer = 1 * IN_MILLISECONDS;
                            _phase = PHASE_FIGHT_SIRONAS_SPEECH_1;
                            break;
                        case PHASE_FIGHT_SIRONAS_SPEECH_1: // sironas exclamation before aggro
                            if (Creature* sironas = me->FindNearestCreature(NPC_SIRONAS, SIZE_OF_GRIDS))
                                sironas->AI()->Talk(SAY_SIRONAS_1);
                            _moveTimer = 1 * IN_MILLISECONDS;
                            _phase = PHASE_FIGHT_SIRONAS_SPEECH_2;
                            break;
                        case PHASE_FIGHT_SIRONAS_SPEECH_2: // legoso exclamation before aggro
                            if (Creature* sironas = me->FindNearestCreature(NPC_SIRONAS, SIZE_OF_GRIDS))
                                sironas->SetObjectScale(3.0f);
                            Talk(SAY_LEGOSO_19);
                            _moveTimer = 1 * IN_MILLISECONDS;
                            _phase = PHASE_FIGHT_SIRONAS_START;
                            break;
                        case PHASE_FIGHT_SIRONAS_START: // legoso exclamation at aggro
                            if (Creature* sironas = me->FindNearestCreature(NPC_SIRONAS, SIZE_OF_GRIDS))
                            {
                                Unit* target = GetPlayerForEscort();
                                if (!target)
                                    target = me;

                                target->AddThreat(sironas, 0.001f);
                                sironas->Attack(target, true);
                                sironas->GetMotionMaster()->MoveChase(target);
                            }
                            _moveTimer = 10 * IN_MILLISECONDS;
                            _phase = PHASE_CONTINUE;
                            break;
                        case PHASE_SIRONAS_SLAIN_SPEECH_1: // legoso exclamation after battle - stage 1.1
                            Talk(SAY_LEGOSO_20);
                            _moveTimer = 2 * IN_MILLISECONDS;
                            _phase = PHASE_SIRONAS_SLAIN_EMOTE_1;
                            break;
                        case PHASE_SIRONAS_SLAIN_EMOTE_1: // legoso exclamation after battle - stage 1.2
                            me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION);
                            _moveTimer = 2 * IN_MILLISECONDS;
                            _phase = PHASE_SIRONAS_SLAIN_EMOTE_2;
                            break;
                        case PHASE_SIRONAS_SLAIN_EMOTE_2: // legoso exclamation after battle - stage 1.3
                            if (Player* player = GetPlayerForEscort())
                                player->GroupEventHappens(QUEST_ENDING_THEIR_WORLD, me);
                            me->HandleEmoteCommand(EMOTE_ONESHOT_CHEER);
                            _moveTimer = 5 * IN_MILLISECONDS;
                            _phase = PHASE_SIRONAS_SLAIN_SPEECH_2;
                            break;
                        case PHASE_SIRONAS_SLAIN_SPEECH_2: // legoso exclamation after battle - stage 2
                            Talk(SAY_LEGOSO_21);
                            _moveTimer = 30 * IN_MILLISECONDS;
                            _phase = PHASE_CONTINUE;
                            break;
                        default:
                            break;
                    }
               }
                else if (!me->IsInCombat())
                    _moveTimer -= diff;
            }
        }
Example #17
0
    void WaypointReached(uint32 i)
    {
        Player *player = GetPlayerForEscort();

        if (!player)
            return;

        switch(i)
        {
            case 0:
                me->Say(SAY_REGINALD_WINDSOR_0_1, LANG_UNIVERSAL, player->GetGUID());
            break;
            case 1:
                me->Say(SAY_REGINALD_WINDSOR_0_2, LANG_UNIVERSAL, player->GetGUID());
            break;
            case 7:
                me->HandleEmoteCommand(EMOTE_STATE_POINT);
                me->Say(SAY_REGINALD_WINDSOR_5_1, LANG_UNIVERSAL, player->GetGUID());
                if (pInstance)
                {
                    if (Creature* jaz = Unit::GetCreature(*me, pInstance->GetData64(DATA_JAZ)))
                    {
                        if (!jaz->isAlive())
                            jaz->Respawn();
                        jaz->SetVisibility(VISIBILITY_ON);
                        jaz->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
                    }
                }
                SetEscortPaused(true);
                break;
            case 8:
                me->Say(SAY_REGINALD_WINDSOR_5_2, LANG_UNIVERSAL, player->GetGUID());
            break;
            case 11:
                me->HandleEmoteCommand(EMOTE_STATE_POINT);
                me->Say(SAY_REGINALD_WINDSOR_7_1, LANG_UNIVERSAL, player->GetGUID());
                if (pInstance)
                {
                    if (Creature* shill = Unit::GetCreature(*me, pInstance->GetData64(DATA_SHILL)))
                    {
                        if (!shill->isAlive())
                            shill->Respawn();
                        shill->SetVisibility(VISIBILITY_ON);
                        shill->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
                    }
                }
                SetEscortPaused(true);
            break;
            case 12:
                me->Say(SAY_REGINALD_WINDSOR_7_2, LANG_UNIVERSAL, player->GetGUID());
            break;
            case 13:
                me->Say(SAY_REGINALD_WINDSOR_7_3, LANG_UNIVERSAL, player->GetGUID());
            break;
            case 20:
                me->HandleEmoteCommand(EMOTE_STATE_POINT);
                me->Say(SAY_REGINALD_WINDSOR_13_1, LANG_UNIVERSAL, player->GetGUID());
                if (pInstance)
                {
                    if (Creature* crest = Unit::GetCreature(*me, pInstance->GetData64(DATA_CREST)))
                    {
                        if (!crest->isAlive())
                            crest->Respawn();
                        crest->SetVisibility(VISIBILITY_ON);
                        crest->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
                    }
                }
                SetEscortPaused(true);
            break;
            case 21:
                me->Say(SAY_REGINALD_WINDSOR_13_3, LANG_UNIVERSAL, player->GetGUID());
            break;
            case 23:
                me->HandleEmoteCommand(EMOTE_STATE_POINT);
                me->Say(SAY_REGINALD_WINDSOR_14_1, LANG_UNIVERSAL, player->GetGUID());
                if (pInstance)
                {
                    if (Creature* tobias = Unit::GetCreature(*me, pInstance->GetData64(DATA_TOBIAS)))
                    {
                        if (!tobias->isAlive())
                            tobias->Respawn();
                        tobias->SetVisibility(VISIBILITY_ON);
                        tobias->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
                    }
                }
                SetEscortPaused(true);
            break;
            case 24:
                me->Say(SAY_REGINALD_WINDSOR_14_2, LANG_UNIVERSAL, player->GetGUID());
            break;
            case 31:
                me->Say(SAY_REGINALD_WINDSOR_20_1, LANG_UNIVERSAL, player->GetGUID());
            break;
            case 32:
                me->Say(SAY_REGINALD_WINDSOR_20_2, LANG_UNIVERSAL, player->GetGUID());

                if (pInstance)
                {
                    if (Unit *qstarter = Unit::GetUnit(*me, pInstance->GetData64(Q_STARTER)))
                        ((Player*)qstarter)->GroupEventHappens(QUEST_JAIL_BREAK, me);
                }
                pInstance->SetData(DATA_QUEST_JAIL_BREAK, DONE);
            break;
        }
    }
        void WaypointReached(uint32 waypointId) override
        {
            Player* player = GetPlayerForEscort();
            if (!player)
                return;

            switch (waypointId)
            {
                case WP_START:
                    SetEscortPaused(true);
                    me->SetFacingToObject(player);
                    Talk(SAY_LEGOSO_1);
                    _moveTimer = 2.5 * IN_MILLISECONDS;
                    _phase = PHASE_CONTINUE;
                    break;
                case WP_EXPLOSIVES_FIRST_POINT:
                    SetEscortPaused(true);
                    Talk(SAY_LEGOSO_2);
                    _moveTimer = 8 * IN_MILLISECONDS;
                    _phase = PHASE_WP_22;
                    break;
                case WP_EXPLOSIVES_FIRST_PLANT:
                    me->SetFacingTo(1.46f);
                    break;
                case WP_EXPLOSIVES_FIRST_DETONATE:
                    SetEscortPaused(true);
                    me->SetFacingTo(1.05f);
                    _moveTimer = 1 * IN_MILLISECONDS;
                    _phase = PHASE_PLANT_FIRST_TIMER_1;
                    break;
                case WP_DEBUG_1:
                    SetEscortPaused(true);
                    _moveTimer = 0.5 * IN_MILLISECONDS;
                    _phase = PHASE_WP_26;
                    break;
                case WP_SIRONAS_HILL:
                {
                    SetEscortPaused(true);

                    //Find Sironas and make it respawn if needed
                    Creature* sironas = NULL;
                    Trinity::AllCreaturesOfEntryInRange check(me, NPC_SIRONAS, SIZE_OF_GRIDS);
                    Trinity::CreatureSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(me, sironas, check);
                    me->VisitNearbyObject(SIZE_OF_GRIDS, searcher);

                    if (sironas)
                    {
                        if (!sironas->IsAlive())
                            sironas->Respawn(true);

                        sironas->AI()->DoAction(ACTION_SIRONAS_CHANNEL_START);
                        me->SetFacingToObject(sironas);
                    }
                    _moveTimer = 1 * IN_MILLISECONDS;
                    _phase = PHASE_FEEL_SIRONAS_1;
                    break;
                }
                case WP_EXPLOSIVES_SECOND_BATTLEROAR:
                    SetEscortPaused(true);
                    _moveTimer = 0.2 * IN_MILLISECONDS;
                    _phase = PHASE_MEET_SIRONAS_ROAR;
                    break;
                case WP_EXPLOSIVES_SECOND_PLANT:
                    SetEscortPaused(true);
                    _moveTimer = 0.5 * IN_MILLISECONDS;
                    _phase = PHASE_PLANT_SECOND_KNEEL;
                    break;
                case WP_EXPLOSIVES_SECOND_DETONATE:
                    SetEscortPaused(true);
                    me->SetFacingTo(5.7f);
                    _moveTimer = 2 * IN_MILLISECONDS;
                    _phase = PHASE_PLANT_SECOND_TIMER_1;
                    break;
                default:
                    break;
            }
        }
Example #19
0
        void WaypointReached(uint32 i)
        {
            if (!pInstance)
                return;

            switch(i)
            {
                case 8:
                    SetRun(false);
                    me->SummonCreature(18764, 2181.87f, 112.46f, 89.45f, 0.26f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    break;
                case 9:
                    DoScriptText(SAY_TH_ARMORY, me);
                    me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, THRALL_WEAPON_MODEL);
                    //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, THRALL_WEAPON_INFO);
                    //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+1, 781);
                    me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, THRALL_SHIELD_MODEL);
                    //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+2, THRALL_SHIELD_INFO);
                    //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+3, 1038);
                    break;
                case 10:
                    me->SetDisplayId(THRALL_MODEL_EQUIPPED);
                    break;
                case 11:
                    SetRun();
                    break;
                case 15:
                    me->SummonCreature(MOB_ENTRY_RIFLE, 2200.28f, 137.37f, 87.93f, 5.07f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_WARDEN, 2197.44f, 131.83f, 87.93f, 0.78f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_VETERAN, 2203.62f, 135.40f, 87.93f, 3.70f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_VETERAN, 2200.75f, 130.13f, 87.93f, 1.48f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    break;
                case 21:
                    me->SummonCreature(MOB_ENTRY_RIFLE, 2135.80f, 154.01f, 67.45f, 4.98f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_WARDEN, 2144.36f, 151.87f, 67.74f, 4.46f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_VETERAN, 2142.12f, 154.41f, 67.12f, 4.56f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_VETERAN, 2138.08f, 155.38f, 67.24f, 4.60f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    break;
                case 25:
                    me->SummonCreature(MOB_ENTRY_RIFLE, 2102.98f, 192.17f, 65.24f, 6.02f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_WARDEN, 2108.48f, 198.75f, 65.18f, 5.15f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_VETERAN, 2106.11f, 197.29f, 65.18f, 5.63f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_VETERAN, 2104.18f, 194.82f, 65.18f, 5.75f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    break;
                case 29:
                    DoScriptText(SAY_TH_SKARLOC_MEET, me);
                    me->SummonCreature(ENTRY_SCARLOC, 2036.48f, 271.22f, 63.43f, 5.27f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
                    //temporary, skarloc should rather be triggered to walk up to thrall
                    break;
                case 30:
                    SetEscortPaused(true);
                    me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
                    SetRun(false);
                    break;
                case 31:
                    DoScriptText(SAY_TH_MOUNTS_UP, me);
                    DoMount();
                    SetRun();
                    break;
                case 37:
                    //possibly regular patrollers? If so, remove this and let database handle them
                    me->SummonCreature(MOB_ENTRY_WATCHMAN, 2124.26f, 522.16f, 56.87f, 3.99f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_WATCHMAN, 2121.69f, 525.37f, 57.11f, 4.01f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_SENTRY, 2124.65f, 524.55f, 56.63f, 3.98f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    break;
                case 59:
                    me->SummonCreature(SKARLOC_MOUNT, 2488.64f, 625.77f, 58.26f, 4.71f, TEMPSUMMON_TIMED_DESPAWN, 10000);
                    DoUnmount();
                    HadMount = false;
                    SetRun(false);
                    break;
                case 60:
                    me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION);
                    //make horsie run off
                    SetEscortPaused(true);
                    me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
                    pInstance->SetData(TYPE_THRALL_PART2, DONE);
                    SetRun();
                    break;
                case 64:
                    SetRun(false);
                    break;
                case 68:
                    me->SummonCreature(MOB_ENTRY_BARN_PROTECTOR, 2500.22f, 692.60f, 55.50f, 2.84f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_BARN_LOOKOUT, 2500.13f, 696.55f, 55.51f, 3.38f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_BARN_GUARDSMAN, 2500.55f, 693.64f, 55.50f, 3.14f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_BARN_GUARDSMAN, 2500.94f, 695.81f, 55.50f, 3.14f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    break;
                case 71:
                    SetRun();
                    break;
                case 81:
                    SetRun(false);
                    break;
                case 83:
                    me->SummonCreature(MOB_ENTRY_CHURCH_PROTECTOR, 2627.33f, 646.82f, 56.03f, 4.28f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 5000);
                    me->SummonCreature(MOB_ENTRY_CHURCH_LOOKOUT, 2624.14f, 648.03f, 56.03f, 4.50f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 5000);
                    me->SummonCreature(MOB_ENTRY_CHURCH_GUARDSMAN, 2625.32f, 649.60f, 56.03f, 4.38f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 5000);
                    me->SummonCreature(MOB_ENTRY_CHURCH_GUARDSMAN, 2627.22f, 649.00f, 56.03f, 4.34f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 5000);
                    break;
                case 84:
                    DoScriptText(SAY_TH_CHURCH_END, me);
                    SetRun();
                    break;
                case 91:
                    me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
                    SetRun(false);
                    break;
                case 93:
                    me->SummonCreature(MOB_ENTRY_INN_PROTECTOR, 2652.71f, 660.31f, 61.93f, 1.67f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_INN_LOOKOUT, 2648.96f, 662.59f, 61.93f, 0.79f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_INN_GUARDSMAN, 2657.36f, 662.34f, 61.93f, 2.68f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_INN_GUARDSMAN, 2656.39f, 659.77f, 61.93f, 2.61f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    break;
                case 94:
                    if (uint64 TarethaGUID = pInstance->GetData64(DATA_TARETHA))
                    {
                        if (Unit* Taretha = Unit::GetUnit((*me), TarethaGUID))
                            DoScriptText(SAY_TA_ESCAPED, Taretha, me);
                    }
                    break;
                case 95:
                    DoScriptText(SAY_TH_MEET_TARETHA, me);
                    pInstance->SetData(TYPE_THRALL_PART3, DONE);
                    SetEscortPaused(true);
                    break;
                case 96:
                    DoScriptText(SAY_TH_EPOCH_WONDER, me);
                    break;
                case 97:
                    DoScriptText(SAY_TH_EPOCH_KILL_TARETHA, me);
                    SetRun();
                    break;
                case 98:
                    //trigger epoch Yell("Thrall! Come outside and face your fate! ....")
                    //from here, thrall should not never be allowed to move to point 106 which he currently does.
                    break;

                case 106:
                    {
                        //trigger taretha to run down outside
                        if (Creature* Taretha = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TARETHA)))
                        {
                            if (Player* pPlayer = GetPlayerForEscort())
                                CAST_AI(npc_escortAI, (Taretha->AI()))->Start(false, true, pPlayer->GetGUID());
                        }

                        //kill credit Creature for quest
                        Map* pMap = me->GetMap();
                        Map::PlayerList const& players = pMap->GetPlayers();
                        if (!players.isEmpty() && pMap->IsDungeon())
                        {
                            for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
                            {
                                if (Player* pPlayer = itr->getSource())
                                    pPlayer->KilledMonsterCredit(20156, 0);
                            }
                        }

                        //alot will happen here, thrall and taretha talk, erozion appear at spot to explain
                        me->SummonCreature(EROZION_ENTRY, 2646.47f, 680.416f, 55.38f, 4.16f, TEMPSUMMON_TIMED_DESPAWN, 120000);
                    }
                    break;
                case 108:
                    //last waypoint, just set Thrall invisible, respawn is turned off
                    me->SetVisible(false);
                    break;
            }
        }
    void WaypointReached(uint32 uiPointId) override
    {
        switch (uiPointId)
        {
            case 7:
                DoScriptText(SAY_HARRISON_CHAMBER_1, m_creature);
                break;
            case 8:
                DoScriptText(SAY_HARRISON_CHAMBER_2, m_creature);
                break;
            case 10:
                m_creature->HandleEmote(EMOTE_ONESHOT_USESTANDING);
                break;
            case 11:
                DoScriptText(SAY_HARRISON_CHAMBER_RELEASE, m_creature);
                if (GameObject* pCage = GetClosestGameObjectWithEntry(m_creature, GO_ADARRAH_CAGE, 5.0f))
                    pCage->Use(m_creature);
                break;
            case 12:
                if (Creature* pAdarrah = GetClosestCreatureWithEntry(m_creature, NPC_ADARRAH, 5.0f))
                {
                    DoScriptText(SAY_ADARRAH_THANK_YOU, pAdarrah);
                    m_adarrahGuid = pAdarrah->GetObjectGuid();
                }
                break;
            case 13:
                if (Creature* pAdarrah = m_creature->GetMap()->GetCreature(m_adarrahGuid))
                {
                    pAdarrah->SetWalk(false);
                    pAdarrah->GetMotionMaster()->MovePoint(0, 4878.416f, -4793.893f, 32.549f);
                    pAdarrah->ForcedDespawn(5000);
                }
                break;
            case 15:
                m_creature->SetFacingTo(0.2f);
                m_creature->HandleEmote(EMOTE_ONESHOT_KNEEL);
                break;
            case 16:
            {
                // set mummies in fire
                std::list<Creature*> lBunniesInRange;
                GetCreatureListWithEntryInGrid(lBunniesInRange, m_creature, NPC_MUMMY_EFFECT_BUNNY, 50.0f);

                for (std::list<Creature*>::const_iterator itr = lBunniesInRange.begin(); itr != lBunniesInRange.end(); ++itr)
                    (*itr)->CastSpell((*itr), SPELL_BUNNY_IMMOLATION, TRIGGERED_OLD_TRIGGERED);

                m_creature->SetFacingTo(5.0f);
                DoCastSpellIfCan(m_creature, SPELL_GONG_EFFECT);
                break;
            }
            case 17:
                DoScriptText(SAY_HARRISON_CHAMBER_3, m_creature);
                break;
            case 18:
                DoScriptText(SAY_HARRISON_CHAMBER_4, m_creature);
                break;
            case 21:
                // close door
                if (GameObject* pDoor = GetClosestGameObjectWithEntry(m_creature, GO_FIRE_DOOR, 10.0f))
                    pDoor->Use(m_creature);
                break;
            case 22:
                DoScriptText(SAY_HARRISON_CHAMBER_5, m_creature);
                SetRun();
                // summon snake
                m_creature->SummonCreature(NPC_TECAHUNA, 4907.077f, -4819.035f, 32.55f, 2.32f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000);
                break;
            case 23:
                DoScriptText(SAY_HARRISON_CHAMBER_6, m_creature);
                break;
            case 24:
                DoScriptText(SAY_HARRISON_CHAMBER_7, m_creature);
                break;
            case 25:
                // attack snake
                if (Creature* pTecahuna = m_creature->GetMap()->GetCreature(m_tecahunaGuid))
                    AttackStart(pTecahuna);
                SetEscortPaused(true);
                m_uiActivateMummiesTimer = 10000;
                break;
            case 53:
                DoScriptText(SAY_HARRISON_ESCORT_COMPELTE, m_creature);
                if (Player* pPlayer = GetPlayerForEscort())
                {
                    pPlayer->GroupEventHappens(QUEST_ID_DUN_DA_DUN_TAH, m_creature);
                    m_creature->SetFacingToObject(pPlayer);
                }
                break;
        }
    }
Example #21
0
    void UpdateEscortAI(const uint32 uiDiff)
    {
        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
            m_uiFrostNovaTimer -= uiDiff;

        DoMeleeAttackIfReady();
    }
Example #22
0
    void UpdateEscortAI(const uint32 uiDiff)
    {
        if (!UpdateVictim())
        {
            if (HasEscortState(STATE_ESCORT_PAUSED))
            {
                if (m_uiGlobalTimer < uiDiff)
                {
                    m_uiGlobalTimer = 5000;

                    switch (m_uiPhase)
                    {
                        case PHASE_INTRO:
                        {
                            switch (m_uiPhaseCounter)
                            {
                                case 0:
                                    if (Creature* pReethe = me->FindNearestCreature(NPC_REETHE, 15.0f))
                                        DoScriptText(SAY_OGR_RET_SWEAR, pReethe);
                                    break;
                                case 1:
                                    DoScriptText(SAY_OGR_REPLY_RET, me);
                                    break;
                                case 2:
                                    if (Creature* pReethe = me->FindNearestCreature(NPC_REETHE, 15.0f))
                                        DoScriptText(SAY_OGR_RET_TAKEN, pReethe);
                                    break;
                                case 3:
                                    DoScriptText(SAY_OGR_TELL_FIRE, me);
                                    if (Creature* pReethe = me->FindNearestCreature(NPC_REETHE, 15.0f))
                                        DoScriptText(SAY_OGR_RET_NOCLOSER, pReethe);
                                    break;
                                case 4:
                                    if (Creature* pReethe = me->FindNearestCreature(NPC_REETHE, 15.0f))
                                        DoScriptText(SAY_OGR_RET_NOFIRE, pReethe);
                                    break;
                                case 5:
                                    if (Creature* pReethe = me->FindNearestCreature(NPC_REETHE, 15.0f))
                                        DoScriptText(SAY_OGR_RET_HEAR, pReethe);

                                    me->SummonCreature(NPC_CALDWELL, m_afSpawn[0], m_afSpawn[1], m_afSpawn[2], 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 300000);
                                    me->SummonCreature(NPC_HALLAN, m_afSpawn[0], m_afSpawn[1], m_afSpawn[2], 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 300000);
                                    me->SummonCreature(NPC_SKIRMISHER, m_afSpawn[0], m_afSpawn[1], m_afSpawn[2], 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 300000);
                                    me->SummonCreature(NPC_SKIRMISHER, m_afSpawn[0], m_afSpawn[1], m_afSpawn[2], 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 300000);

                                    m_uiPhase = PHASE_GUESTS;
                                    break;
                            }
                            break;
                        }

                        case PHASE_GUESTS:
                        {
                            switch (m_uiPhaseCounter)
                            {
                                case 6:
                                    if (Creature* pCaldwell = me->FindNearestCreature(NPC_CALDWELL, 15.0f))
                                        DoScriptText(SAY_OGR_CAL_FOUND, pCaldwell);
                                    break;
                                case 7:
                                    if (Creature* pCaldwell = me->FindNearestCreature(NPC_CALDWELL, 15.0f))
                                        DoScriptText(SAY_OGR_CAL_MERCY, pCaldwell);
                                    break;
                                case 8:
                                    if (Creature* pHallan = me->FindNearestCreature(NPC_HALLAN, 15.0f))
                                    {
                                        DoScriptText(SAY_OGR_HALL_GLAD, pHallan);

                                        if (Creature* pReethe = me->FindNearestCreature(NPC_REETHE, 15.0f))
                                            pHallan->CastSpell(pReethe, SPELL_FAKE_SHOT, false);
                                    }
                                    break;
                                case 9:
                                    if (Creature* pReethe = me->FindNearestCreature(NPC_REETHE, 15.0f))
                                    {
                                        DoScriptText(EMOTE_OGR_RET_ARROW, pReethe);
                                        DoScriptText(SAY_OGR_RET_ARROW, pReethe);
                                    }
                                    break;
                                case 10:
                                    if (Creature* pCaldwell = me->FindNearestCreature(NPC_CALDWELL, 15.0f))
                                        DoScriptText(SAY_OGR_CAL_CLEANUP, pCaldwell);

                                    DoScriptText(SAY_OGR_NODIE, me);
                                    break;
                                case 11:
                                    DoStartAttackMe();
                                    m_uiPhase = PHASE_COMPLETE;
                                    break;
                            }
                            break;
                        }

                        case PHASE_COMPLETE:
                        {
                            switch (m_uiPhaseCounter)
                            {
                                case 12:
                                    if (Player* player = GetPlayerForEscort())
                                        player->GroupEventHappens(QUEST_QUESTIONING, me);
                                    DoScriptText(SAY_OGR_SURVIVE, me);
                                    break;
                                case 13:
                                    if (Creature* pReethe = me->FindNearestCreature(NPC_REETHE, 15.0f))
                                        DoScriptText(SAY_OGR_RET_LUCKY, pReethe);
                                    break;
                                case 14:
                                    if (Creature* pReethe = me->FindNearestCreature(NPC_REETHE, 15.0f))
                                        pReethe->setDeathState(JUST_DIED);
                                    break;
                                case 15:
                                    DoScriptText(SAY_OGR_THANKS, me);
                                    SetRun(true);
                                    SetEscortPaused(false);
                                    break;
                            }
                            break;
                        }
                    }
                        ++m_uiPhaseCounter;
                }
                else
                    m_uiGlobalTimer -= uiDiff;
            }

            return;
        }

        DoMeleeAttackIfReady();
    }
Example #23
0
		void UpdateEscortAI(const uint32 uiDiff) {
			if (uiPhase) {
				if (uiTimer <= uiDiff) {
					switch (uiPhase) {
					case 1:
						DoScriptText(SAY_BLASTMASTER_1, me);
						NextStep(1500, true);
						break;
					case 2:
						SetEscortPaused(false);
						NextStep(0, false, 0);
						break;
					case 3:
						DoScriptText(SAY_BLASTMASTER_2, me);
						SetEscortPaused(false);
						NextStep(0, false, 0);
						break;
					case 4:
						DoScriptText(SAY_BLASTMASTER_3, me);
						NextStep(3000, true);
						break;
					case 5:
						DoScriptText(SAY_BLASTMASTER_4, me);
						NextStep(3000, true);
						break;
					case 6:
						SetInFace(true);
						DoScriptText(SAY_BLASTMASTER_5, me);
						Summon(1);
						if (pInstance)
							if (GameObject* pGo = GameObject::GetGameObject((*me), pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT)))
								pInstance->HandleGameObject(NULL, true, pGo);
						NextStep(3000, true);
						break;
					case 7:
						DoScriptText(SAY_BLASTMASTER_6, me);
						SetEscortPaused(false);
						NextStep(0, false, 0);
						break;
					case 8:
						me->HandleEmoteCommand(EMOTE_STATE_WORK);
						NextStep(25000, true);
						break;
					case 9:
						Summon(2);
						NextStep(0, false);
						break;
					case 10:
						Summon(4);
						NextStep(0, false);
						break;
					case 11:
						DoScriptText(SAY_BLASTMASTER_17, me);
						NextStep(5000, true);
						break;
					case 12:
						DoScriptText(SAY_BLASTMASTER_18, me);
						NextStep(5000, true);
						break;
					case 13:
						DoScriptText(SAY_BLASTMASTER_20, me);
						CaveDestruction(true);
						NextStep(8000, true);
						break;
					case 14:
						DoScriptText(SAY_BLASTMASTER_21, me);
						NextStep(8500, true);
						break;
					case 15:
						DoScriptText(SAY_BLASTMASTER_22, me);
						NextStep(2000, true);
						break;
					case 16:
						DoScriptText(SAY_BLASTMASTER_23, me);
						SetInFace(false);
						if (pInstance)
							if (GameObject* pGo = GameObject::GetGameObject((*me), pInstance->GetData64(DATA_GO_CAVE_IN_LEFT)))
								pInstance->HandleGameObject(NULL, true, pGo);
						NextStep(2000, true);
						break;
					case 17:
						SetEscortPaused(false);
						DoScriptText(SAY_BLASTMASTER_24, me);
						Summon(6);
						NextStep(0, false);
						break;
					case 18:
						Summon(7);
						NextStep(0, false);
						break;
					case 19:
						SetInFace(false);
						Summon(8);
						DoScriptText(SAY_BLASTMASTER_25, me);
						NextStep(0, false);
						break;
					case 20:
						DoScriptText(SAY_BLASTMASTER_27, me);
						NextStep(2000, true);
						break;
					case 21:
						Summon(9);
						NextStep(0, false);
						break;
					case 22:
						CaveDestruction(false);
						DoScriptText(SAY_BLASTMASTER_20, me);
						NextStep(0, false);
						break;
					}
				} else
					uiTimer -= uiDiff;
			}

			if (!UpdateVictim())
				return;

			DoMeleeAttackIfReady();
		}
    void WaypointReached(uint32 uiPointId) override
    {
        switch (uiPointId)
        {
            case 1:
                DoScriptText(SAY_START, m_creature);
                break;
            case 7:
                DoScriptText(SAY_PAY, m_creature);
                break;
            case 12:
                DoScriptText(SAY_FIRST_AMBUSH_START, m_creature);
                SetEscortPaused(true);

                m_creature->SummonCreature(NPC_BLACKROCK_AMBUSHER, -7844.3f, -1521.6f, 139.2f, 0.0f, TEMPSUMMON_TIMED_OOC_DESPAWN, 20000);
                m_creature->SummonCreature(NPC_BLACKROCK_AMBUSHER, -7860.4f, -1507.8f, 141.0f, 6.0f, TEMPSUMMON_TIMED_OOC_DESPAWN, 20000);
                m_creature->SummonCreature(NPC_BLACKROCK_RAIDER,   -7845.6f, -1508.1f, 138.8f, 6.1f, TEMPSUMMON_TIMED_OOC_DESPAWN, 20000);
                m_creature->SummonCreature(NPC_BLACKROCK_RAIDER,   -7859.8f, -1521.8f, 139.2f, 6.2f, TEMPSUMMON_TIMED_OOC_DESPAWN, 20000);
                break;
            case 24:
                DoScriptText(SAY_SEC_AMBUSH_START, m_creature);
                SetEscortPaused(true);

                m_creature->SummonCreature(NPC_BLACKROCK_AMBUSHER,     -8035.3f, -1222.2f, 135.5f, 5.1f, TEMPSUMMON_TIMED_OOC_DESPAWN, 20000);
                m_creature->SummonCreature(NPC_FLAMESCALE_DRAGONSPAWN, -8037.5f, -1216.9f, 135.8f, 5.1f, TEMPSUMMON_TIMED_OOC_DESPAWN, 20000);
                m_creature->SummonCreature(NPC_BLACKROCK_AMBUSHER,     -8009.5f, -1222.1f, 139.2f, 3.9f, TEMPSUMMON_TIMED_OOC_DESPAWN, 20000);
                m_creature->SummonCreature(NPC_FLAMESCALE_DRAGONSPAWN, -8007.1f, -1219.4f, 140.1f, 3.9f, TEMPSUMMON_TIMED_OOC_DESPAWN, 20000);
                break;
            case 28:
                m_creature->SummonCreature(NPC_SEARSCALE_DRAKE, -7897.8f, -1123.1f, 233.4f, 3.0f, TEMPSUMMON_TIMED_OOC_DESPAWN, 60000);
                m_creature->SummonCreature(NPC_SEARSCALE_DRAKE, -7898.8f, -1125.1f, 193.9f, 3.0f, TEMPSUMMON_TIMED_OOC_DESPAWN, 60000);
                m_creature->SummonCreature(NPC_SEARSCALE_DRAKE, -7895.6f, -1119.5f, 194.5f, 3.1f, TEMPSUMMON_TIMED_OOC_DESPAWN, 60000);
                break;
            case 30:
            {
                SetEscortPaused(true);
                DoScriptText(SAY_THIRD_AMBUSH_START, m_creature);

                Player* pPlayer = GetPlayerForEscort();
                if (!pPlayer)
                    return;

                // Set all the dragons in combat
                for (GuidList::const_iterator itr = m_lSearscaleGuidList.begin(); itr != m_lSearscaleGuidList.end(); ++itr)
                {
                    if (Creature* pTemp = m_creature->GetMap()->GetCreature(*itr))
                        pTemp->AI()->AttackStart(pPlayer);
                }
                break;
            }
            case 36:
                DoScriptText(EMOTE_LAUGH, m_creature);
                break;
            case 45:
                StartNextDialogueText(SAY_LAST_STAND);
                SetEscortPaused(true);

                m_creature->SummonCreature(NPC_HIGH_EXECUTIONER_NUZARK, -7532.3f, -1029.4f, 258.0f, 2.7f, TEMPSUMMON_TIMED_DESPAWN, 40000);
                m_creature->SummonCreature(NPC_SHADOW_OF_LEXLORT,       -7532.8f, -1032.9f, 258.2f, 2.5f, TEMPSUMMON_TIMED_DESPAWN, 40000);
                break;
        }
    }
Example #25
0
        void UpdateAI(uint32 uiDiff)
        {
            if (uiPhase)
            {
                if (uiTimer <= uiDiff)
                {
                    switch (uiPhase)
                    {
                        case 1:
                            if (Creature* pGuard = me->FindNearestCreature(NPC_STORMWIND_ROYAL, 8.0f, true))
                                pGuard->AI()->Talk(SAY_GUARD_2);
                            uiTimer = 3000;
                            uiPhase = 2;
                            break;
                        case 2:
                            DoGuardsDisappearAndDie();
                            uiTimer = 2000;
                            uiPhase = 3;
                            break;
                        case 3:
                            SetEscortPaused(false);
                            uiTimer = 0;
                            uiPhase = 0;
                            break;
                        case 4:
                            Talk(SAY_LESCOVAR_3);
                            uiTimer = 0;
                            uiPhase = 0;
                            break;
                        case 5:
                            if (Creature* pMarzon = ObjectAccessor::GetCreature(*me, MarzonGUID))
                                pMarzon->AI()->Talk(SAY_MARZON_1);
                            uiTimer = 3000;
                            uiPhase = 6;
                            break;
                        case 6:
                            Talk(SAY_LESCOVAR_4);
                            if (Player* player = GetPlayerForEscort())
								player->GroupEventHappens(QUEST_THE_ATTACK, me);
                            uiTimer = 2000;
                            uiPhase = 7;
                            break;
                        case 7:
                            if (Creature* pTyrion = me->FindNearestCreature(NPC_TYRION, 20.0f, true))
                                pTyrion->AI()->Talk(SAY_TYRION_2);
                            if (Creature* pMarzon = ObjectAccessor::GetCreature(*me, MarzonGUID))
                                pMarzon->setFaction(14);
                            me->setFaction(14);
                            uiTimer = 0;
                            uiPhase = 0;
                            break;
                    }
                } else uiTimer -= uiDiff;
            }
            npc_escortAI::UpdateAI(uiDiff);

            if (!UpdateVictim())
                return;

            DoMeleeAttackIfReady();
        }
Example #26
0
        void UpdateAI(const uint32 uiDiff)
        {
            npc_escortAI::UpdateAI(uiDiff);

            if (HasEscortState(STATE_ESCORT_PAUSED))
            {
                if (m_uiWave_Timer <= uiDiff)
                {
                    switch (m_uiWave)
                    {
                        case 0:
                            DoScriptText(SAY_BREAKOUT3, me);
                            SummonAcolyte(3);
                            m_uiWave_Timer = 20000;
                            break;
                        case 1:
                            DoScriptText(SAY_BREAKOUT4, me);
                            SummonAcolyte(3);
                            m_uiWave_Timer = 20000;
                            break;
                        case 2:
                            DoScriptText(SAY_BREAKOUT5, me);
                            SummonAcolyte(4);
                            m_uiWave_Timer = 20000;
                            break;
                        case 3:
                            DoScriptText(SAY_BREAKOUT6, me);
                            me->SummonCreature(NPC_HIGH_INQUISITOR_VALROTH, 1642.329f, -6045.818f, 127.583f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000);
                            m_uiWave_Timer = 1000;
                            break;
                        case 4:
                        {
                            Creature* pTemp = Unit::GetCreature(*me, m_uiValrothGUID);

                            if (!pTemp || !pTemp->isAlive())
                            {
                                DoScriptText(SAY_BREAKOUT8, me);
                                m_uiWave_Timer = 5000;
                            }
                            else
                            {
                                m_uiWave_Timer = 2500;
                                return;                         //return, we don't want m_uiWave to increment now
                            }
                            break;
                        }
                        case 5:
                            DoScriptText(SAY_BREAKOUT9, me);
                            me->RemoveAurasDueToSpell(SPELL_ANTI_MAGIC_ZONE);
                            // i do not know why the armor will also be removed
                            m_uiWave_Timer = 2500;
                            break;
                        case 6:
                            DoScriptText(SAY_BREAKOUT10, me);
                            SetEscortPaused(false);
                            break;
                    }

                    ++m_uiWave;
                }
                else
                    m_uiWave_Timer -= uiDiff;
            }
        }
Example #27
0
        void UpdateAI(uint32 uiDiff) override
        {
            npc_escortAI::UpdateAI(uiDiff);

            if (HasEscortState(STATE_ESCORT_PAUSED))
            {
                if (waveTimer <= uiDiff)
                {
                    switch (wave)
                    {
                        case 0:
                            Talk(SAY_BREAKOUT3);
                            SummonAcolyte(3);
                            waveTimer = 20000;
                            break;
                        case 1:
                            Talk(SAY_BREAKOUT4);
                            SummonAcolyte(3);
                            waveTimer = 20000;
                            break;
                        case 2:
                            Talk(SAY_BREAKOUT5);
                            SummonAcolyte(4);
                            waveTimer = 20000;
                            break;
                        case 3:
                            Talk(SAY_BREAKOUT6);
                            me->SummonCreature(NPC_HIGH_INQUISITOR_VALROTH, 1642.329f, -6045.818f, 127.583f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000);
                            waveTimer = 1000;
                            break;
                        case 4:
                        {
                            Creature* temp = ObjectAccessor::GetCreature(*me, valrothGUID);

                            if (!temp || !temp->IsAlive())
                            {
                                Talk(SAY_BREAKOUT8);
                                waveTimer = 5000;
                            }
                            else
                            {
                                waveTimer = 2500;
                                return;
                            }
                            break;
                        }
                        case 5:
                            Talk(SAY_BREAKOUT9);
                            me->RemoveAurasDueToSpell(SPELL_ANTI_MAGIC_ZONE);
                            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                            waveTimer = 2500;
                            break;
                        case 6:
                            Talk(SAY_BREAKOUT10);
                            SetEscortPaused(false);
                            break;
                    }

                    ++wave;
                }
                else
                    waveTimer -= uiDiff;
            }
        }
Example #28
0
    void JustDidDialogueStep(int32 iEntry) override
    {
        switch (iEntry)
        {
            case NPC_RANSHALLA:
                // Start the altar channeling
                DoChannelTorchSpell(true);
                break;
            case SAY_RANSHALLA_ALTAR_6:
                SetEscortPaused(false);
                break;
            case SAY_PRIESTESS_ALTAR_8:
                // make the gem and its aura respawn
                if (GameObject* pGem = GetClosestGameObjectWithEntry(m_creature, GO_ELUNE_GEM, 10.0f))
                {
                    if (pGem->isSpawned())
                        break;

                    pGem->SetRespawnTime(90);
                    pGem->Refresh();
                }
                if (GameObject* pAura = GetClosestGameObjectWithEntry(m_creature, GO_ELUNE_AURA, 10.0f))
                {
                    if (pAura->isSpawned())
                        break;

                    pAura->SetRespawnTime(90);
                    pAura->Refresh();
                }
                break;
            case SAY_PRIESTESS_ALTAR_9:
                // move near the escort npc
                if (Creature* pPriestess = m_creature->GetMap()->GetCreature(m_firstPriestessGuid))
                    pPriestess->GetMotionMaster()->MovePoint(0, aWingThicketLocations[6].m_fX, aWingThicketLocations[6].m_fY, aWingThicketLocations[6].m_fZ);
                break;
            case SAY_PRIESTESS_ALTAR_13:
                // summon the Guardian of Elune
                if (Creature* pGuard = m_creature->SummonCreature(NPC_GUARDIAN_ELUNE, aWingThicketLocations[2].m_fX, aWingThicketLocations[2].m_fY, aWingThicketLocations[2].m_fZ, aWingThicketLocations[2].m_fO, TEMPSPAWN_CORPSE_DESPAWN, 0))
                {
                    pGuard->GetMotionMaster()->MovePoint(0, aWingThicketLocations[5].m_fX, aWingThicketLocations[5].m_fY, aWingThicketLocations[5].m_fZ);
                    m_guardEluneGuid = pGuard->GetObjectGuid();
                }
                // summon the Voice of Elune
                if (GameObject* pAltar = m_creature->GetMap()->GetGameObject(m_altarGuid))
                {
                    if (Creature* pVoice = m_creature->SummonCreature(NPC_VOICE_ELUNE, pAltar->GetPositionX(), pAltar->GetPositionY(), pAltar->GetPositionZ(), 0, TEMPSPAWN_TIMED_DESPAWN, 30000))
                        m_voiceEluneGuid = pVoice->GetObjectGuid();
                }
                break;
            case SAY_VOICE_ALTAR_15:
                // move near the escort npc and continue dialogue
                if (Creature* pPriestess = m_creature->GetMap()->GetCreature(m_secondPriestessGuid))
                {
                    DoScriptText(SAY_PRIESTESS_ALTAR_14, pPriestess);
                    pPriestess->GetMotionMaster()->MovePoint(0, aWingThicketLocations[7].m_fX, aWingThicketLocations[7].m_fY, aWingThicketLocations[7].m_fZ);
                }
                break;
            case SAY_PRIESTESS_ALTAR_19:
                // make the voice of elune leave
                if (Creature* pGuard = m_creature->GetMap()->GetCreature(m_guardEluneGuid))
                {
                    pGuard->GetMotionMaster()->MovePoint(0, aWingThicketLocations[2].m_fX, aWingThicketLocations[2].m_fY, aWingThicketLocations[2].m_fZ);
                    pGuard->ForcedDespawn(4000);
                }
                break;
            case SAY_PRIESTESS_ALTAR_20:
                // make the first priestess leave
                if (Creature* pPriestess = m_creature->GetMap()->GetCreature(m_firstPriestessGuid))
                {
                    pPriestess->GetMotionMaster()->MovePoint(0, aWingThicketLocations[0].m_fX, aWingThicketLocations[0].m_fY, aWingThicketLocations[0].m_fZ);
                    pPriestess->ForcedDespawn(4000);
                }
                break;
            case SAY_PRIESTESS_ALTAR_21:
                // make the second priestess leave
                if (Creature* pPriestess = m_creature->GetMap()->GetCreature(m_secondPriestessGuid))
                {
                    pPriestess->GetMotionMaster()->MovePoint(0, aWingThicketLocations[1].m_fX, aWingThicketLocations[1].m_fY, aWingThicketLocations[1].m_fZ);
                    pPriestess->ForcedDespawn(4000);
                }
                break;
            case DATA_EVENT_END:
                // Turn towards the player
                if (Player* pPlayer = GetPlayerForEscort())
                {
                    m_creature->SetFacingToObject(pPlayer);
                    DoScriptText(SAY_QUEST_END_1, m_creature, pPlayer);
                }
                break;
            case SAY_QUEST_END_2:
                // Turn towards the altar and kneel - quest complete
                if (GameObject* pAltar = m_creature->GetMap()->GetGameObject(m_altarGuid))
                    m_creature->SetFacingToObject(pAltar);
                m_creature->SetStandState(UNIT_STAND_STATE_KNEEL);
                if (Player* pPlayer = GetPlayerForEscort())
                    pPlayer->GroupEventHappens(QUEST_GUARDIANS_ALTAR, m_creature);
                break;
        }
    }
Example #29
0
    void UpdateAI(const uint32 diff)
    {
        npc_escortAI::UpdateAI(diff);

        if (HasEscortState(STATE_ESCORT_PAUSED))
        {
            if (TalkTimer <= diff)
            {
                if (TalkCount > 3)
                {
                    if (Creature* pSpotlight = Unit::GetCreature(*me, m_uiSpotlightGUID))
                        pSpotlight->ForcedDespawn();

                    SetEscortPaused(false);
                    return;
                }

                Talk(TalkCount);
                ++TalkCount;
            }
            else TalkTimer -= diff;
        }

        if (PerformanceReady)
        {
            if (!RaidWiped)
            {
                if (WipeTimer <= diff)
                {
                    Map* pMap = me->GetMap();
                    if (!pMap->IsDungeon())
                        return;

                    Map::PlayerList const& PlayerList = pMap->GetPlayers();
                    if (PlayerList.isEmpty())
                        return;

                    RaidWiped = true;
                    for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                    {
                        if (i->getSource()->IsAlive() && !i->getSource()->isGameMaster())
                        {
                            RaidWiped = false;
                            break;
                        }
                    }

                    if (RaidWiped)
                    {
                        RaidWiped = true;
                        EnterEvadeMode();
                        return;
                    }

                    WipeTimer = 15000;
                }
                else WipeTimer -= diff;
            }

        }
    }
Example #30
0
    void UpdateEscortAI(uint32 const uiDiff) override
    {
        // the phases are handled OOC (keeps them in sync with the waypoints)
        if (m_uiPhaseTimer && !m_creature->getVictim())
        {
            if (m_uiPhaseTimer <= uiDiff)
            {
                switch (m_uiPhase)
                {
                    case 1:
                        DoScriptText(SAY_START, m_creature);
                        m_creature->SetFactionTemporary(FACTION_ESCORT_N_NEUTRAL_PASSIVE, TEMPFACTION_RESTORE_RESPAWN);
                        m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
                        m_creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0);
                        m_uiPhaseTimer = 5000;
                        break;
                    case 2:
                        DoScriptText(SAY_INTRO_1, m_creature);
                        m_uiPhaseTimer = 3500;              // 6s delay, but 2500ms for escortstarting
                        break;
                    case 3:
                        Start(false, m_creature->GetMap()->GetPlayer(m_playerGuid), nullptr, false, false);
                        m_uiPhaseTimer = 0;
                        break;

                    case 4:                                 // Shortly after reached WP 4
                        DoScriptText(SAY_INTRO_2, m_creature);
                        m_uiPhaseTimer = 0;
                        break;

                    case 5:                                 // Shortly after reached WP 9
                        DoScriptText(SAY_INTRO_3, m_creature);
                        m_uiPhaseTimer = 6000;
                        break;
                    case 6:
                        DoScriptText(SAY_INTRO_4, m_creature);
                        m_uiPhaseTimer = 9000;
                        break;
                    case 7:
                        if (m_pInstance)
                        {
                            if (GameObject* pDoor = m_pInstance->GetSingleGameObjectFromStorage(GO_CAVE_IN_SOUTH))
                                m_creature->SetFacingToObject(pDoor);
                        }
                        m_uiPhaseTimer = 2000;
                        break;
                    case 8:
                        DoScriptText(SAY_LOOK_1, m_creature);
                        m_uiPhaseTimer = 5000;
                        break;
                    case 9:
                        DoScriptText(SAY_HEAR_1, m_creature);
                        m_uiPhaseTimer = 2000;
                        break;
                    case 10:                                // Shortly shortly before starting WP 11
                        DoSummonPack(1);
                        m_uiPhaseTimer = 0;
                        break;

                    case 11:                                // 15s after reached WP 11
                        DoSummonPack(2);

                        // Summon first explosive charge
                        if (m_pInstance)
                            m_pInstance->SetData(TYPE_EXPLOSIVE_CHARGE, DATA_EXPLOSIVE_CHARGE_1);
                        // Remove EMOTE_STATE_USESTANDING state-emote
                        m_creature->HandleEmote(EMOTE_ONESHOT_NONE);

                        m_uiPhaseTimer = 1;
                        break;
                    case 12:                                // Empty Phase, used to store information about set charge
                        m_uiPhaseTimer = 0;
                        break;

                    case 13:                                // 10s after reached WP 13
                        DoSummonPack(3);

                        // Summon second explosive charge
                        if (m_pInstance)
                            m_pInstance->SetData(TYPE_EXPLOSIVE_CHARGE, DATA_EXPLOSIVE_CHARGE_2);
                        // Remove EMOTE_STATE_USESTANDING state-emote
                        m_creature->HandleEmote(EMOTE_ONESHOT_NONE);

                        m_uiPhaseTimer = 11000;
                        break;
                    case 14:                                // Empty Phase, used to store information about set charge
                        m_uiPhaseTimer = 1;
                        break;
                    case 15:                                // shortly before starting WP 14
                        if (Player* pPlayer = m_creature->GetMap()->GetPlayer(m_playerGuid))
                            m_creature->SetFacingToObject(pPlayer);
                        DoScriptText(SAY_CHARGE_2, m_creature);
                        m_uiPhaseTimer = 0;
                        break;

                    case 16:                                // 5s after reaching WP 15
                        DoScriptText(SAY_BLOW_1_5, m_creature);
                        m_uiPhaseTimer = 5000;
                        break;
                    case 17:
                        DoScriptText(SAY_BLOW_1, m_creature);
                        m_uiPhaseTimer = 1000;
                        break;
                    case 18:
                        DoCastSpellIfCan(m_creature, SPELL_EXPLOSION_SOUTH);
                        m_uiPhaseTimer = 500;
                        break;
                    case 19:
                        // Close southern cave-in and let charges explode
                        if (m_pInstance)
                        {
                            m_pInstance->DoUseDoorOrButton(GO_CAVE_IN_SOUTH);
                            m_bSouthernCaveInOpened = false;
                            m_pInstance->SetData(TYPE_EXPLOSIVE_CHARGE, DATA_EXPLOSIVE_CHARGE_USE);
                        }
                        m_uiPhaseTimer = 5000;
                        break;
                    case 20:
                        m_creature->HandleEmote(EMOTE_ONESHOT_CHEER);
                        m_uiPhaseTimer = 6000;
                        break;
                    case 21:
                        DoScriptText(SAY_FINISH_1, m_creature);
                        m_uiPhaseTimer = 6000;
                        break;
                    case 22:
                        DoScriptText(SAY_LOOK_2, m_creature);
                        m_uiPhaseTimer = 3000;
                        break;
                    case 23:
                        if (m_pInstance)
                        {
                            if (GameObject* pDoor = m_pInstance->GetSingleGameObjectFromStorage(GO_CAVE_IN_NORTH))
                                m_creature->SetFacingToObject(pDoor);
                        }
                        m_uiPhaseTimer = 3000;
                        break;
                    case 24:
                        DoScriptText(SAY_HEAR_2, m_creature);
                        m_uiPhaseTimer = 8000;
                        break;
                    case 25:                                // shortly before starting WP 16
                        SetEscortPaused(false);
                        DoSummonPack(4);
                        m_uiPhaseTimer = 0;
                        break;

                    case 26:                                // 15s after reaching WP 16
                        DoSummonPack(5);

                        // Summon third explosive charge
                        if (m_pInstance)
                            m_pInstance->SetData(TYPE_EXPLOSIVE_CHARGE, DATA_EXPLOSIVE_CHARGE_3);
                        // Remove EMOTE_STATE_USESTANDING state-emote
                        m_creature->HandleEmote(EMOTE_ONESHOT_NONE);

                        m_uiPhaseTimer = 1;
                        break;
                    case 27:                                // Empty Phase, used to store information about set charge
                        m_uiPhaseTimer = 0;
                        break;

                    case 28:                                // 10s after reaching WP 17
                        DoSummonPack(6);

                        // Summon forth explosive charge
                        if (m_pInstance)
                            m_pInstance->SetData(TYPE_EXPLOSIVE_CHARGE, DATA_EXPLOSIVE_CHARGE_4);
                        // Remove EMOTE_STATE_USESTANDING state-emote
                        m_creature->HandleEmote(EMOTE_ONESHOT_NONE);

                        m_uiPhaseTimer = 10000;
                        break;
                    case 29:                                // Empty Phase, used to store information about set charge
                        m_uiPhaseTimer = 1;
                        break;
                    case 30:                                // shortly before starting WP 18
                        DoScriptText(SAY_CHARGE_4, m_creature);
                        m_uiPhaseTimer = 0;
                        break;

                    case 31:                                // shortly after reaching WP 19
                        if (m_pInstance)
                        {
                            if (GameObject* pDoor = m_pInstance->GetSingleGameObjectFromStorage(GO_CAVE_IN_NORTH))
                                m_creature->SetFacingToObject(pDoor);
                        }
                        DoScriptText(SAY_BLOW_2_10, m_creature);
                        m_uiPhaseTimer = 5000;
                        break;
                    case 32:
                        DoScriptText(SAY_BLOW_2_5, m_creature);
                        m_uiPhaseTimer = 1000;
                        break;
                    case 33:
                        DoSummonPack(7);                    // Summon Grubbis and add
                        m_uiPhaseTimer = 0;
                        break;

                    case 34:                                // 1 sek after Death of Grubbis
                        if (m_pInstance)
                        {
                            if (GameObject* pDoor = m_pInstance->GetSingleGameObjectFromStorage(GO_CAVE_IN_NORTH))
                                m_creature->SetFacingToObject(pDoor);
                        }
                        m_creature->HandleEmote(EMOTE_ONESHOT_CHEER);
                        m_uiPhaseTimer = 5000;
                        break;
                    case 35:
                        DoScriptText(SAY_BLOW_SOON, m_creature);
                        m_uiPhaseTimer = 5000;
                        break;
                    case 36:
                        DoScriptText(SAY_BLOW_2, m_creature);
                        m_uiPhaseTimer = 2000;
                        break;
                    case 37:
                        m_creature->HandleEmote(EMOTE_ONESHOT_POINT);
                        m_uiPhaseTimer = 1000;
                        break;
                    case 38:
                        DoCastSpellIfCan(m_creature, SPELL_EXPLOSION_NORTH);
                        m_uiPhaseTimer = 500;
                        break;
                    case 39:
                        // Close northern cave-in and let charges explode
                        if (m_pInstance)
                        {
                            m_pInstance->DoUseDoorOrButton(GO_CAVE_IN_NORTH);
                            m_bNorthernCaveInOpened = false;
                            m_pInstance->SetData(TYPE_EXPLOSIVE_CHARGE, DATA_EXPLOSIVE_CHARGE_USE);
                        }
                        m_uiPhaseTimer = 8000;
                        break;
                    case 40:
                        DoCastSpellIfCan(m_creature, SPELL_FIREWORKS_RED);
                        DoScriptText(SAY_FINISH_2, m_creature);
                        m_uiPhaseTimer = 0;
                        break;
                }
                ++m_uiPhase;
            }
            else
                m_uiPhaseTimer -= uiDiff;
        }

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

        DoMeleeAttackIfReady();
    }