コード例 #1
0
ファイル: karazhan.cpp プロジェクト: GameOn/gameon
    void WaypointReached(uint32 i)
    {
        if (!pInstance)
            return;

        switch(i)
        {
            case 0:
                DoCast(me, SPELL_TUXEDO, false);
                pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_STAGEDOORLEFT));
                break;
            case 4:
                TalkCount = 0;
                SetEscortPaused(true);

                if (Creature* pSpotlight = me->SummonCreature(CREATURE_SPOTLIGHT,
                    me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f,
                    TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000))
                {
                    pSpotlight->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                    pSpotlight->CastSpell(pSpotlight, SPELL_SPOTLIGHT, false);
                    m_uiSpotlightGUID = pSpotlight->GetGUID();
                }
                break;
            case 8:
                pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_STAGEDOORLEFT));
                PerformanceReady = true;
                break;
            case 9:
                PrepareEncounter();
                pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_CURTAINS));
                break;
        }
    }
コード例 #2
0
 void ToggleGate(bool bOpen)
 {
     if (GameObject* pGo = m_creature->FindNearestGameObject(GO_WILLEY_GATE, 200.0f))
     {
         if (bOpen && pGo->GetGoState() == GO_STATE_READY)
             pInstance->DoUseDoorOrButton(pGo->GetObjectGuid());
         if (!bOpen && pGo->GetGoState() == GO_STATE_ACTIVE)
             pInstance->DoUseDoorOrButton(pGo->GetObjectGuid());
     }
 }
コード例 #3
0
ファイル: karazhan.cpp プロジェクト: Adeer/OregonCore
    void WaypointReached(uint32 i)
    {
        if (!pInstance)
            return;

        switch (i)
        {
        case 0:
            DoCast(me, SPELL_TUXEDO, true);
            pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_STAGEDOORLEFT));
            break;
        case 2:
            TalkCount = 0;
            SetEscortPaused(true);

            if (Creature* pSpotlight = me->SummonCreature(CREATURE_SPOTLIGHT,
                                       me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f,
                                       TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000))
            {
                pSpotlight->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                pSpotlight->CastSpell(pSpotlight, SPELL_SPOTLIGHT, false);
                m_uiSpotlightGUID = pSpotlight->GetGUID();
            }
            switch (m_uiEventId)
            {
            case EVENT_OZ:
                for (int i = 0; i < 5; i++)
                    me->SummonGameObject(GameObjects_OZ[i][0], GameObjects_OZ[i][1], GameObjects_OZ[i][2], GameObjects_OZ[i][3], 4.63f, 0, 0, 0.73f, -0.68f, 60000);
                break;
            case EVENT_HOOD:
                for (int i = 0; i < 5; i++)
                    me->SummonGameObject(GameObjects_Wolf[i][0], GameObjects_Wolf[i][1], GameObjects_Wolf[i][2], GameObjects_Wolf[i][3], 4.63f, 0, 0, 0.73f, -0.68f, 60000);
                break;
            case EVENT_RAJ:
                for (int i = 0; i < 1; i++)
                    me->SummonGameObject(GameObjects_RomeJulia[i][0], GameObjects_RomeJulia[i][1], GameObjects_RomeJulia[i][2], GameObjects_RomeJulia[i][3], 4.63f, 0, 0, 0.73f, -0.68f, 60000);
                break;
            }
            break;
        case 5:
            pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_STAGEDOORLEFT));
            PerformanceReady = true;
            PrepareEncounter();
            pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_CURTAINS));
            me->SetFacingTo(1.41372f);
            break;
        }
    }
コード例 #4
0
ファイル: windsor_onypre.cpp プロジェクト: yyhhrr/mangospriv
 void WaypointReached(uint32 uiWP)
 {
     ScriptedInstance* pInstance = (ScriptedInstance*)m_creature->GetInstanceData();
     switch (uiWP)
     {
     case 11:
         pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_DOOR_ONE),0,false);
         break;
     case 13:
         pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_CHEST_ONE),0,false);
         m_creature->SetDisplayId(9052);
         break;
     case 24:
         pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_DOOR_TWO),0,false);
         break;
     case 27:
         pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_DOOR_THREE),0,false);
         break;
     case 43:
         pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_DOOR_FOUR),0,false);
         break;
     case 50:
         pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_DOOR_FIVE),0,false);
         break;
     case 53:
         m_creature->SetSpeedRate(MOVE_RUN,1.4f,true);
         break;
     case 70:
         if (Player* pPlayer = GetPlayerForEscort())
             pPlayer->GroupEventHappens(QUEST_MISSING_IN_ACTION, m_creature);
         break;
     }
 }
コード例 #5
0
ファイル: boss_kaelthas.cpp プロジェクト: BThallid/mangos
    void UpdateAI(const uint32 uiDiff) override
    {
        switch (m_uiPhase)
        {
                // ***** Advisors phase ********
            case PHASE_1_ADVISOR:
            {
                if (!m_uiPhaseTimer)
                    return;

                if (m_uiPhaseTimer <= uiDiff)
                {
                    if (!m_pInstance)
                        return;

                    switch (m_uiPhaseSubphase)
                    {
                        case 0:
                            DoScriptText(SAY_INTRO_THALADRED, m_creature);
                            m_uiPhaseTimer = 7000;
                            break;

                        case 1:
                            if (Creature* pAdvisor = m_pInstance->GetSingleCreatureFromStorage(NPC_THALADRED))
                            {
                                pAdvisor->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                                pAdvisor->SetInCombatWithZone();
                            }
                            m_uiPhaseTimer = 0;
                            break;

                        case 2:
                            DoScriptText(SAY_INTRO_SANGUINAR, m_creature);
                            m_uiPhaseTimer = 12500;
                            break;

                        case 3:
                            if (Creature* pAdvisor = m_pInstance->GetSingleCreatureFromStorage(NPC_SANGUINAR))
                            {
                                pAdvisor->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                                pAdvisor->SetInCombatWithZone();
                            }
                            m_uiPhaseTimer = 0;
                            break;

                        case 4:
                            DoScriptText(SAY_INTRO_CAPERNIAN, m_creature);
                            m_uiPhaseTimer = 7000;
                            break;

                        case 5:
                            if (Creature* pAdvisor = m_pInstance->GetSingleCreatureFromStorage(NPC_CAPERNIAN))
                            {
                                pAdvisor->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                                pAdvisor->SetInCombatWithZone();
                            }
                            m_uiPhaseTimer = 0;
                            break;

                        case 6:
                            DoScriptText(SAY_INTRO_TELONICUS, m_creature);
                            m_uiPhaseTimer = 8400;
                            break;

                        case 7:
                            if (Creature* pAdvisor = m_pInstance->GetSingleCreatureFromStorage(NPC_TELONICUS))
                            {
                                pAdvisor->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                                pAdvisor->SetInCombatWithZone();
                            }
                            m_uiPhaseTimer = 0;
                            break;
                    }

                    ++m_uiPhaseSubphase;
                }
                else
                    m_uiPhaseTimer -= uiDiff;

                break;
            }

            // ***** Weapons phase ********
            case PHASE_2_WEAPON:
            {
                if (m_uiPhaseTimer < uiDiff)
                {
                    // Switch to next phase, no matter if the weapons are killed or not
                    if (DoCastSpellIfCan(m_creature, SPELL_RESURRECTION) == CAST_OK)
                    {
                        DoScriptText(SAY_PHASE3_ADVANCE, m_creature);
                        m_uiPhaseSubphase = 0;
                        m_uiPhaseTimer    = 180000;
                        m_uiPhase         = PHASE_3_ADVISOR_ALL;
                    }
                }
                else
                    m_uiPhaseTimer -= uiDiff;

                break;
            }

            // ***** All advisors phase ********
            case PHASE_3_ADVISOR_ALL:
            {
                if (m_uiPhaseTimer < uiDiff)
                {
                    DoScriptText(SAY_PHASE4_INTRO2, m_creature);
                    m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    DoResetThreat();
                    m_creature->SetInCombatWithZone();
                    m_uiPhase      = PHASE_4_SOLO;
                    m_uiPhaseTimer = 30000;
                }
                else
                    m_uiPhaseTimer -= uiDiff;

                break;
            }

            // ***** Solo phases ********
            case PHASE_4_SOLO:
            case PHASE_7_GRAVITY:
            {
                if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
                    return;

                if (m_uiGravityExpireTimer)
                {
                    if (m_uiNetherBeamTimer < uiDiff)
                    {
                        if (DoCastSpellIfCan(m_creature, SPELL_NETHER_BEAM) == CAST_OK)
                            m_uiNetherBeamTimer = urand(2000, 4000);
                    }
                    else
                        m_uiNetherBeamTimer -= uiDiff;

                    // Switch to the other spells after gravity lapse expired
                    if (m_uiGravityExpireTimer <= uiDiff)
                        m_uiGravityExpireTimer = 0;
                    else
                        m_uiGravityExpireTimer -= uiDiff;
                }
                else
                {
                    if (m_uiFireballTimer < uiDiff)
                    {
                        if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
                        {
                            if (DoCastSpellIfCan(pTarget, SPELL_FIREBALL) == CAST_OK)
                                m_uiFireballTimer = urand(3000, 5000);
                        }
                    }
                    else
                        m_uiFireballTimer -= uiDiff;

                    if (m_uiArcaneDisruptionTimer < uiDiff)
                    {
                        if (DoCastSpellIfCan(m_creature, SPELL_ARCANE_DISRUPTION) == CAST_OK)
                            m_uiArcaneDisruptionTimer = 60000;
                    }
                    else
                        m_uiArcaneDisruptionTimer -= uiDiff;

                    if (m_uiFlameStrikeTimer < uiDiff)
                    {
                        if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
                        {
                            if (DoCastSpellIfCan(pTarget, SPELL_FLAME_STRIKE) == CAST_OK)
                                m_uiFlameStrikeTimer = 30000;
                        }
                    }
                    else
                        m_uiFlameStrikeTimer -= uiDiff;

                    if (m_uiPhoenixTimer < uiDiff)
                    {
                        if (DoCastSpellIfCan(m_creature, SPELL_PHOENIX_ANIMATION) == CAST_OK)
                        {
                            DoScriptText(urand(0, 1) ? SAY_SUMMON_PHOENIX1 : SAY_SUMMON_PHOENIX2, m_creature);
                            m_uiPhoenixTimer = 60000;
                        }
                    }
                    else
                        m_uiPhoenixTimer -= uiDiff;
                }

                DoMeleeAttackIfReady();

                // ***** Phase 4 specific actions ********
                if (m_uiPhase == PHASE_4_SOLO)
                {
                    if (m_creature->GetHealthPercent() < 50.0f)
                    {
                        // ToDo: should he cast something here?
                        m_creature->InterruptNonMeleeSpells(false);
                        DoScriptText(SAY_PHASE5_NUTS, m_creature);

                        SetCombatMovement(false);
                        m_creature->GetMotionMaster()->Clear();
                        m_creature->GetMotionMaster()->MovePoint(POINT_ID_CENTER, aCenterPos[0], aCenterPos[1], aCenterPos[2]);

                        m_uiPhase = PHASE_5_WAITING;
                    }

                    if (m_uiShockBarrierTimer < uiDiff)
                    {
                        if (DoCastSpellIfCan(m_creature, SPELL_SHOCK_BARRIER) == CAST_OK)
                        {
                            m_uiPyroblastTimer = 1000;
                            m_uiShockBarrierTimer = 60000;
                        }
                    }
                    else
                        m_uiShockBarrierTimer -= uiDiff;

                    if (m_uiPyroblastTimer)
                    {
                        if (m_uiPyroblastTimer <= uiDiff)
                        {
                            if (DoCastSpellIfCan(m_creature, SPELL_PYROBLAST) == CAST_OK)
                            {
                                DoScriptText(EMOTE_PYROBLAST, m_creature);
                                m_uiPyroblastTimer = 0;
                            }
                        }
                        else
                            m_uiPyroblastTimer -= uiDiff;
                    }

                    if (m_uiMindControlTimer < uiDiff)
                    {
                        for (uint8 i = 0; i < MAX_MIND_CONTROL; ++i)
                        {
                            if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1, SPELL_MIND_CONTROL, SELECT_FLAG_PLAYER))
                                DoCastSpellIfCan(pTarget, SPELL_MIND_CONTROL);
                        }
                        m_uiMindControlTimer = 60000;
                    }
                    else
                        m_uiMindControlTimer -= uiDiff;
                }

                // ***** Phase 7 specific actions ********
                if (m_uiPhase == PHASE_7_GRAVITY)
                {
                    if (m_uiGravityLapseTimer < uiDiff)
                    {
                        if (DoCastSpellIfCan(m_creature, SPELL_GRAVITY_LAPSE) == CAST_OK)
                        {
                            DoScriptText(urand(0, 1) ? SAY_GRAVITYLAPSE1 : SAY_GRAVITYLAPSE2, m_creature);;
                            m_uiGravityIndex       = 0;
                            m_uiNetherBeamTimer    = 8000;
                            m_uiNetherVaporTimer   = 4000;
                            m_uiGravityExpireTimer = 30000;
                            m_uiGravityLapseTimer  = 90000;
                        }
                    }
                    else
                        m_uiGravityLapseTimer -= uiDiff;

                    if (m_uiShockBarrierTimer < uiDiff)
                    {
                        if (DoCastSpellIfCan(m_creature, SPELL_SHOCK_BARRIER) == CAST_OK)
                            m_uiShockBarrierTimer = 20000;
                    }
                    else
                        m_uiShockBarrierTimer -= uiDiff;

                    if (m_uiNetherVaporTimer)
                    {
                        if (m_uiNetherVaporTimer <= uiDiff)
                        {
                            if (DoCastSpellIfCan(m_creature, SPELL_NETHER_VAPOR_SUMMON) == CAST_OK)
                                m_uiNetherVaporTimer = 0;
                        }
                        else
                            m_uiNetherVaporTimer -= uiDiff;
                    }
                }
            }
            // ***** Phase 5 - transition ********
            case PHASE_5_WAITING:
                // Nothing here; wait for boss to arive at point
                break;
                // ***** Phase 6 - explode the bridge ********
            case PHASE_6_FLYING:
                if (m_uiExplodeTimer)
                {
                    if (m_uiExplodeTimer <= uiDiff)
                    {
                        if (DoCastSpellIfCan(m_creature, SPELL_EXPLODE) == CAST_OK)
                        {
                            if (m_pInstance)
                            {
                                m_pInstance->DoUseDoorOrButton(GO_KAEL_STATUE_LEFT);
                                m_pInstance->DoUseDoorOrButton(GO_KAEL_STATUE_RIGHT);
                                m_pInstance->DoUseDoorOrButton(GO_BRIDGE_WINDOW);
                            }
                            // Note: also Kael casts some other unk spells here
                            m_uiPhaseTimer = 5000;
                            m_uiExplodeTimer = 0;
                        }
                    }
                    else
                        m_uiExplodeTimer -= uiDiff;
                }

                if (m_uiPhaseTimer)
                {
                    if (m_uiPhaseTimer <= uiDiff)
                    {
                        m_creature->GetMotionMaster()->Clear();
                        m_creature->GetMotionMaster()->MovePoint(POINT_ID_CENTER, aCenterPos[0], aCenterPos[1], aCenterPos[2]);
                        m_uiPhaseTimer = 0;
                    }
                    else
                        m_uiPhaseTimer -= uiDiff;
                }
                break;
        }
    }