Exemplo n.º 1
0
    void UpdateAI(const uint32 diff)
    {
        if (!pInstance)
            return;

        if (MobDeath_Timer)
        {
            if (MobDeath_Timer <= diff)
            {
                MobDeath_Timer = 2500;

                if (RingBossGUID)
                {
                    Creature *boss = Unit::GetCreature(*m_creature,RingBossGUID);
                    if (boss && !boss->isAlive() && boss->isDead())
                    {
                        RingBossGUID = 0;
                        Event_Timer = 5000;
                        MobDeath_Timer = 0;
                        return;
                    }
                    return;
                }

                for(uint8 i = 0; i < MOB_AMOUNT; i++)
                {
                    Creature *mob = Unit::GetCreature(*m_creature,RingMobGUID[i]);
                    if (mob && !mob->isAlive() && mob->isDead())
                    {
                        RingMobGUID[i] = 0;
                        --MobCount;

                        //seems all are gone, so set timer to continue and discontinue this
                        if (!MobCount)
                        {
                            Event_Timer = 5000;
                            MobDeath_Timer = 0;
                        }
                    }
                }
            }else MobDeath_Timer -= diff;
        }

        if (Event_Timer)
        {
            if (Event_Timer <= diff)
            {
                switch(EventPhase)
                {
                case 0:
                    DoScriptText(-1000000, m_creature);//1
                    HandleGameObject(DATA_ARENA4, false);
                    Start(false, false, false);
                    CanWalk = true;
                    Event_Timer = 0;
                    break;
                case 1:
                    CanWalk = true;
                    Event_Timer = 0;
                    break;
                case 2:
                    Event_Timer = 2000;
                    break;
                case 3:
                    HandleGameObject(DATA_ARENA1, true);
                    Event_Timer = 3000;
                    break;
                case 4:
                    CanWalk = true;
                    m_creature->SetVisibility(VISIBILITY_OFF);
                    SummonRingMob();
                    Event_Timer = 8000;
                    break;
                case 5:
                    SummonRingMob();
                    SummonRingMob();
                    Event_Timer = 8000;
                    break;
                case 6:
                    SummonRingMob();
                    Event_Timer = 0;
                    break;
                case 7:
                    m_creature->SetVisibility(VISIBILITY_ON);
                    HandleGameObject(DATA_ARENA1, false);
                    DoScriptText(-1000000, m_creature);//4
                    CanWalk = true;
                    Event_Timer = 0;
                    break;
                case 8:
                    HandleGameObject(DATA_ARENA2, true);
                    Event_Timer = 5000;
                    break;
                case 9:
                    m_creature->SetVisibility(VISIBILITY_OFF);
                    SummonRingBoss();
                    Event_Timer = 0;
                    break;
                case 10:
                    //if quest, complete
                    HandleGameObject(DATA_ARENA2, false);
                    HandleGameObject(DATA_ARENA3, true);
                    HandleGameObject(DATA_ARENA4, true);
                    CanWalk = true;
                    Event_Timer = 0;
                    break;
                }
                ++EventPhase;
            }else Event_Timer -= diff;
        }

        if (CanWalk)
            npc_escortAI::UpdateAI(diff);
       }
Exemplo n.º 2
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (!m_pInstance)
            return;

        if (m_uiMobDeathTimer)
        {
            if (m_uiMobDeathTimer <= uiDiff)
            {
                m_uiMobDeathTimer = 2500;

                if (m_uiRingBossGUID)
                {
                    Creature* pBoss = m_creature->GetMap()->GetCreature(m_uiRingBossGUID);
                    if (pBoss && !pBoss->isAlive() && pBoss->isDead())
                    {
                        m_uiRingBossGUID = 0;
                        m_uiEventTimer = 5000;
                        m_uiMobDeathTimer = 0;
                        return;
                    }
                    return;
                }

                for(uint8 i = 0; i < MAX_MOB_AMOUNT; ++i)
                {
                    Creature* pMob = m_creature->GetMap()->GetCreature(m_auiRingMobGUID[i]);
                    if (pMob && !pMob->isAlive() && pMob->isDead())
                    {
                        m_auiRingMobGUID[i] = 0;
                        --m_uiMobCount;

                        //seems all are gone, so set timer to continue and discontinue this
                        if (!m_uiMobCount)
                        {
                            m_uiEventTimer = 5000;
                            m_uiMobDeathTimer = 0;
                        }
                    }
                }
            }
            else
                m_uiMobDeathTimer -= uiDiff;
        }

        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
                        DoGate(DATA_ARENA4, GO_STATE_READY);
                        Start(false);
                        m_bCanWalk = true;
                        m_uiEventTimer = 0;
                        break;
                    case 1:
                        // Start walking towards wall
                        m_bCanWalk = true;
                        m_uiEventTimer = 0;
                        break;
                    case 2:
                        m_uiEventTimer = 2000;
                        break;
                    case 3:
                        // Open East Gate
                        DoGate(DATA_ARENA1, GO_STATE_ACTIVE);
                        m_uiEventTimer = 3000;
                        break;
                    case 4:
                        m_bCanWalk = true;
                        m_creature->SetVisibility(VISIBILITY_OFF);
                        SummonRingMob();
                        m_uiEventTimer = 8000;
                        break;
                    case 5:
                        SummonRingMob();
                        SummonRingMob();
                        m_uiEventTimer = 8000;
                        break;
                    case 6:
                        SummonRingMob();
                        m_uiEventTimer = 0;
                        break;
                    case 7:
                        // Summoned Mobs are dead, continue event
                        m_creature->SetVisibility(VISIBILITY_ON);
                        DoGate(DATA_ARENA1, GO_STATE_READY);
                        //DoScriptText(-1000000, m_creature); // after killed the mobs, no say here
                        m_bCanWalk = true;
                        m_uiEventTimer = 0;
                        break;
                    case 8:
                        // Open North Gate
                        DoGate(DATA_ARENA2, GO_STATE_ACTIVE);
                        m_uiEventTimer = 5000;
                        break;
                    case 9:
                        // Summon Boss
                        m_creature->SetVisibility(VISIBILITY_OFF);
                        SummonRingBoss();
                        m_uiEventTimer = 0;
                        break;
                    case 10:
                        // Boss dead
                        //if quest, complete
                        DoGate(DATA_ARENA2, GO_STATE_READY);
                        DoGate(DATA_ARENA3, GO_STATE_ACTIVE);
                        DoGate(DATA_ARENA4, GO_STATE_ACTIVE);
                        m_bCanWalk = true;
                        m_uiEventTimer = 0;
                        break;
                }
                ++m_uiEventPhase;
            }
            else
                m_uiEventTimer -= uiDiff;
        }

        if (m_bCanWalk)
            npc_escortAI::UpdateAI(uiDiff);
    }
Exemplo n.º 3
0
        void UpdateAI(uint32 diff) override
        {
            if (MobDeath_Timer)
            {
                if (MobDeath_Timer <= diff)
                {
                    MobDeath_Timer = 2500;

                    if (RingBossGUID)
                    {
                        Creature* boss = ObjectAccessor::GetCreature(*me, RingBossGUID);
                        if (boss && !boss->IsAlive() && boss->isDead())
                        {
                            RingBossGUID.Clear();
                            Event_Timer = 5000;
                            MobDeath_Timer = 0;
                            return;
                        }
                        return;
                    }

                    for (uint8 i = 0; i < MAX_NPC_AMOUNT; ++i)
                    {
                        Creature* mob = ObjectAccessor::GetCreature(*me, RingMobGUID[i]);
                        if (mob && !mob->IsAlive() && mob->isDead())
                        {
                            RingMobGUID[i].Clear();
                            --MobCount;

                            //seems all are gone, so set timer to continue and discontinue this
                            if (!MobCount)
                            {
                                Event_Timer = 5000;
                                MobDeath_Timer = 0;
                            }
                        }
                    }
                } else MobDeath_Timer -= diff;
            }

            if (Event_Timer)
            {
                if (Event_Timer <= diff)
                {
                    switch (EventPhase)
                    {
                    case 0:
                        Talk(SAY_TEXT5);
                        HandleGameObject(DATA_ARENA4, false);
                        Start(false, false);
                        CanWalk = true;
                        Event_Timer = 0;
                        break;
                    case 1:
                        CanWalk = true;
                        Event_Timer = 0;
                        break;
                    case 2:
                        Event_Timer = 2000;
                        break;
                    case 3:
                        HandleGameObject(DATA_ARENA1, true);
                        Event_Timer = 3000;
                        break;
                    case 4:
                        CanWalk = true;
                        me->SetVisible(false);
                        SummonRingMob();
                        Event_Timer = 8000;
                        break;
                    case 5:
                        SummonRingMob();
                        SummonRingMob();
                        Event_Timer = 8000;
                        break;
                    case 6:
                        SummonRingMob();
                        Event_Timer = 0;
                        break;
                    case 7:
                        me->SetVisible(true);
                        HandleGameObject(DATA_ARENA1, false);
                        Talk(SAY_TEXT6);
                        CanWalk = true;
                        Event_Timer = 0;
                        break;
                    case 8:
                        HandleGameObject(DATA_ARENA2, true);
                        Event_Timer = 5000;
                        break;
                    case 9:
                        me->SetVisible(false);
                        SummonRingBoss();
                        Event_Timer = 0;
                        break;
                    case 10:
                        //if quest, complete
                        HandleGameObject(DATA_ARENA2, false);
                        HandleGameObject(DATA_ARENA3, true);
                        HandleGameObject(DATA_ARENA4, true);
                        CanWalk = true;
                        Event_Timer = 0;
                        break;
                    }
                    ++EventPhase;
                } else Event_Timer -= diff;
            }

            if (CanWalk)
                npc_escortAI::UpdateAI(diff);
           }
Exemplo n.º 4
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (!m_pInstance)
            return;

        if (m_uiMobDeathTimer)
        {
            if (m_uiMobDeathTimer <= uiDiff)
            {
                m_uiMobDeathTimer = 2500;

                if (m_uiRingBossGUID)
                {
                    Creature* pBoss = (Creature*)Unit::GetUnit(*m_creature, m_uiRingBossGUID);
                    if (pBoss && !pBoss->isAlive() && pBoss->isDead())
                    {
                        m_uiRingBossGUID = 0;
                        m_uiEventTimer = 5000;
                        m_uiMobDeathTimer = 0;
                        return;
                    }
                    return;
                }

                for(uint8 i = 0; i < MAX_MOB_AMOUNT; ++i)
                {
                    Creature* pMob = (Creature*)Unit::GetUnit(*m_creature, m_auiRingMobGUID[i]);
                    if (pMob && !pMob->isAlive() && pMob->isDead())
                    {
                        m_auiRingMobGUID[i] = 0;
                        --m_uiMobCount;

                        //seems all are gone, so set timer to continue and discontinue this
                        if (!m_uiMobCount)
                        {
                            m_uiEventTimer = 5000;
                            m_uiMobDeathTimer = 0;
                        }
                    }
                }
        }
            else
                m_uiMobDeathTimer -= uiDiff;
        }

        if (m_uiEventTimer)
        {
            if (m_uiEventTimer <= uiDiff)
            {
                switch(m_uiEventPhase)
                {
                    case 0:
                        DoScriptText(-1000000, m_creature);
                        DoGate(DATA_ARENA4, GO_STATE_READY);
                        Start(false, false);
                        m_bCanWalk = true;
                        m_uiEventTimer = 0;
                        break;
                    case 1:
                        m_bCanWalk = true;
                        m_uiEventTimer = 0;
                        break;
                    case 2:
                        m_uiEventTimer = 2000;
                        break;
                    case 3:
                        DoGate(DATA_ARENA1,GO_STATE_ACTIVE);
                        m_uiEventTimer = 3000;
                        break;
                    case 4:
                        m_bCanWalk = true;
                        m_creature->SetVisibility(VISIBILITY_OFF);
                        SummonRingMob();
                        m_uiEventTimer = 8000;
                        break;
                    case 5:
                        SummonRingMob();
                        SummonRingMob();
                        m_uiEventTimer = 8000;
                        break;
                    case 6:
                        SummonRingMob();
                        m_uiEventTimer = 0;
                        break;
                    case 7:
                        m_creature->SetVisibility(VISIBILITY_ON);
                        DoGate(DATA_ARENA1,GO_STATE_READY);
                        DoScriptText(-1000000, m_creature);
                        m_bCanWalk = true;
                        m_uiEventTimer = 0;
                        break;
                    case 8:
                        DoGate(DATA_ARENA2,GO_STATE_ACTIVE);
                        m_uiEventTimer = 5000;
                        break;
                    case 9:
                        m_creature->SetVisibility(VISIBILITY_OFF);
                        SummonRingBoss();
                        m_uiEventTimer = 0;
                        break;
                    case 10:
                        //if quest, complete
                        DoGate(DATA_ARENA2,GO_STATE_READY);
                        DoGate(DATA_ARENA3,GO_STATE_ACTIVE);
                        DoGate(DATA_ARENA4,GO_STATE_ACTIVE);
                        m_bCanWalk = true;
                        m_uiEventTimer = 0;
                        break;
                }
                ++m_uiEventPhase;
        }
            else
                m_uiEventTimer -= uiDiff;
        }

        if (m_bCanWalk)
            npc_escortAI::UpdateAI(uiDiff);
    }