Ejemplo n.º 1
0
    void UpdateAI(const uint32 diff)
    {
        if( Event_Timer < diff )
        {
            switch(Phase)
            {
                case 1:
                    if( someplayer )
                    {
                        Unit* u = Unit::GetUnit((*m_creature), someplayer);
                        if( u && u->GetTypeId() == TYPEID_PLAYER ) DoScriptText(EMOTE_START, m_creature, u);
                    }
                    Event_Timer = 60000;
                    Wave = true;
                    ++Phase;
                    break;
                case 2:
                    DoScriptText(EMOTE_60, m_creature);
                    Event_Timer = 30000;
                    ++Phase;
                    break;
                case 3:
                    DoScriptText(EMOTE_30, m_creature);
                    Event_Timer = 20000;
                    DoFinalSpawnForCreature(m_creature);
                    ++Phase;
                    break;
                case 4:
                    DoScriptText(EMOTE_10, m_creature);
                    Event_Timer = 10000;
                    Wave = false;
                    ++Phase;
                    break;
                case 5:
                    DoScriptText(EMOTE_COMPLETE, m_creature);
                    if( someplayer )
                    {
                        Player* player = Unit::GetPlayer(someplayer);
                        if(player)
                           player->KilledMonster(m_creature->GetEntry(),m_creature->GetGUID());
                        DoCast(m_creature,SPELL_DISABLE_VISUAL);
                    }
                    if( goConsole )
                    {
                        if( GameObject* go = GameObject::GetGameObject((*m_creature),goConsole) )
                            go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
                    }
                    ++Phase;
                    break;
            }
        } else Event_Timer -= diff;

        if( Wave )
        {
            if( Wave_Timer < diff )
            {
                DoWaveSpawnForCreature(m_creature);
            } else Wave_Timer -= diff;
        }
    }
Ejemplo n.º 2
0
    void UpdateAI(const uint32 diff)
    {
        if (Event_Timer < diff)
        {
            Unit *playertarget = NULL;

            if (someplayer)
            {
                playertarget = Unit::GetUnit((*m_creature),someplayer);
                if (!playertarget)
                    return;
                if (playertarget->GetTypeId() != TYPEID_PLAYER)
                    return;
            }else return;

            switch(Phase)
            {
                case 1:
                    DoScriptText(EMOTE_START, m_creature, playertarget);
                    Event_Timer = 60000;
                    Wave = true;
                    ++Phase;
                    break;
                case 2:
                    DoScriptText(EMOTE_60, m_creature, playertarget);
                    Event_Timer = 30000;
                    ++Phase;
                    break;
                case 3:
                    DoScriptText(EMOTE_30, m_creature, playertarget);
                    Event_Timer = 20000;
                    DoFinalSpawnForCreature(m_creature);
                    ++Phase;
                    break;
                case 4:
                    DoScriptText(EMOTE_10, m_creature, playertarget);
                    Event_Timer = 10000;
                    Wave = false;
                    ++Phase;
                    break;
                case 5:
                    DoScriptText(EMOTE_COMPLETE, m_creature, playertarget);
                    ((Player*)playertarget)->KilledMonsterCredit(m_creature->GetEntry(),m_creature->GetGUID());
                    DoCast(m_creature,SPELL_DISABLE_VISUAL);
                    if (goConsole)
                    {
                        if (GameObject* pGo = m_creature->GetMap()->GetGameObject(goConsole))
                            pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
                    }
                    ++Phase;
                    break;
            }
        } else Event_Timer -= diff;

        if (Wave)
        {
            if (Wave_Timer < diff)
            {
                DoWaveSpawnForCreature(m_creature);
            } else Wave_Timer -= diff;
        }
    }
Ejemplo n.º 3
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (m_uiEventTimer < uiDiff)
        {
            if (!m_uiPlayerGUID)
                return;

            Unit* pPlayer = Unit::GetUnit((*m_creature), m_uiPlayerGUID);
            if (!pPlayer)
                return;

            if (pPlayer->GetTypeId() != TYPEID_PLAYER)
                return;

            switch(m_uiPhase)
            {
            case 1:
                DoScriptText(EMOTE_START, m_creature, pPlayer);
                m_uiEventTimer = 60000;
                m_bWave = true;
                ++m_uiPhase;
                break;
            case 2:
                DoScriptText(EMOTE_60, m_creature, pPlayer);
                m_uiEventTimer = 30000;
                ++m_uiPhase;
                break;
            case 3:
                DoScriptText(EMOTE_30, m_creature, pPlayer);
                m_uiEventTimer = 20000;
                DoFinalSpawnForCreature(m_creature);
                ++m_uiPhase;
                break;
            case 4:
                DoScriptText(EMOTE_10, m_creature, pPlayer);
                m_uiEventTimer = 10000;
                m_bWave = false;
                ++m_uiPhase;
                break;
            case 5:
                DoScriptText(EMOTE_COMPLETE, m_creature, pPlayer);
                ((Player*)pPlayer)->KilledMonsterCredit(m_creature->GetEntry(), m_creature->GetGUID());
                DoCastSpellIfCan(m_creature, SPELL_DISABLE_VISUAL);
                if (m_uiConsoleGUID)
                {
                    if (GameObject* pGo = m_creature->GetMap()->GetGameObject(m_uiConsoleGUID))
                        pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
                }
                ++m_uiPhase;
                break;
            }
        }
        else
            m_uiEventTimer -= uiDiff;

        if (m_bWave)
        {
            if (m_uiWaveTimer < uiDiff)
            {
                DoWaveSpawnForCreature(m_creature);
            }
            else
                m_uiWaveTimer -= uiDiff;
        }
    }
Ejemplo n.º 4
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (m_uiEventTimer < uiDiff)
        {
            Player* pPlayer = m_creature->GetMap()->GetPlayer(m_playerGuid);

            if (!pPlayer)
            {
                // Reset Event
                if (GameObject* pGo = m_creature->GetMap()->GetGameObject(m_consoleGuid))
                    pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);

                m_creature->ForcedDespawn();
                return;
            }

            switch(m_uiPhase)
            {
                case 1:
                    DoScriptText(EMOTE_START, m_creature, pPlayer);
                    m_uiEventTimer = 60000;
                    m_bWave = true;
                    ++m_uiPhase;
                    break;
                case 2:
                    DoScriptText(EMOTE_60, m_creature, pPlayer);
                    m_uiEventTimer = 30000;
                    ++m_uiPhase;
                    break;
                case 3:
                    DoScriptText(EMOTE_30, m_creature, pPlayer);
                    m_uiEventTimer = 20000;
                    DoFinalSpawnForCreature(m_creature);
                    ++m_uiPhase;
                    break;
                case 4:
                    DoScriptText(EMOTE_10, m_creature, pPlayer);
                    m_uiEventTimer = 10000;
                    m_bWave = false;
                    ++m_uiPhase;
                    break;
                case 5:
                    DoScriptText(EMOTE_COMPLETE, m_creature, pPlayer);
                    pPlayer->KilledMonsterCredit(m_creature->GetEntry(), m_creature->GetObjectGuid());
                    DoCastSpellIfCan(m_creature, SPELL_DISABLE_VISUAL);

                    if (GameObject* pGo = m_creature->GetMap()->GetGameObject(m_consoleGuid))
                        pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);

                    ++m_uiPhase;
                    break;
            }
        }
        else
            m_uiEventTimer -= uiDiff;

        if (m_bWave)
        {
            if (m_uiWaveTimer < uiDiff)
            {
                DoWaveSpawnForCreature(m_creature);
            }
            else
                m_uiWaveTimer -= uiDiff;
        }
    }
Ejemplo n.º 5
0
        void UpdateAI(uint32 diff)
        {
            if (Event_Timer <= diff)
            {
                switch (Phase)
                {
                    case 1:
                        if (someplayer)
                        {
                            Unit* u = Unit::GetUnit(*me, someplayer);
                            if (u && u->GetTypeId() == TYPEID_PLAYER)
                                Talk(EMOTE_START, u->GetGUID());
                        }
                        Event_Timer = 60000;
                        Wave = true;
                        ++Phase;
                        break;
                    case 2:
                        Talk(EMOTE_60);
                        Event_Timer = 30000;
                        ++Phase;
                        break;
                    case 3:
                        Talk(EMOTE_30);
                        Event_Timer = 20000;
                        DoFinalSpawnForCreature(me);
                        ++Phase;
                        break;
                    case 4:
                        Talk(EMOTE_10);
                        Event_Timer = 10000;
                        Wave = false;
                        ++Phase;
                        break;
                    case 5:
                        Talk(EMOTE_COMPLETE);
                        if (someplayer)
                        {
                            Unit* u = Unit::GetUnit(*me, someplayer);
                            if (u && u->GetTypeId() == TYPEID_PLAYER)
                                CAST_PLR(u)->KilledMonsterCredit(me->GetEntry(), me->GetGUID());
                            DoCast(me, SPELL_DISABLE_VISUAL);
                        }
                        if (goConsole)
                        {
                            if (GameObject* go = GameObject::GetGameObject(*me, goConsole))
                                go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
                        }
                        ++Phase;
                        break;
                }
            } else Event_Timer -= diff;

            if (Wave)
            {
                if (Wave_Timer <= diff)
                {
                    DoWaveSpawnForCreature(me);
                } else Wave_Timer -= diff;
            }
        }