コード例 #1
0
    void Update(uint32 diff)
    {
        if (!instance->HavePlayers())
            return;

        if (bActive)
        {
            if (uiActivationTimer < diff)
            {
                AddWave();
                bActive = false;
                uiActivationTimer = 5000;
            } else uiActivationTimer -= diff;
        }

        if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor))
            if (pMainDoor->GetGoState() != GO_STATE_ACTIVE && CheckWipe())
            {
                SetData(DATA_REMOVE_NPC, 1);
                StartBossEncounter(uiFirstBoss, false);
                StartBossEncounter(uiSecondBoss, false);
                bWiped = true;
                if (Creature* pSinclari = instance->GetCreature(uiSinclari))
                {
                    pSinclari->DisappearAndDie();
                    pSinclari->Respawn(true);
                }

                if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor))
                    pMainDoor->SetGoState(GO_STATE_ACTIVE);
                SetData(DATA_WAVE_COUNT, 0);
            }
    }
コード例 #2
0
        void Update(uint32 diff)
        {
            if (!instance->HavePlayers())
                return;

            // if boss-fight is in progress, no events have to be executed!
            if ((GetData(DATA_FALRIC_EVENT) == IN_PROGRESS) || GetData(DATA_MARWYN_EVENT) == IN_PROGRESS)
            {
                // there should not be _any_ event of next_wave during boss-fight
                events.CancelEvent(EVENT_NEXT_WAVE);
                return;
            }
            else if (GetData(DATA_MARWYN_EVENT) == DONE)
            {
                events.CancelEvent(EVENT_NEXT_WAVE);
            }

            events.Update(diff);

            switch (events.ExecuteEvent())
            {
                case EVENT_NEXT_WAVE:
                    uiWaveCount++;
                    AddWave();
                    break;
            }
        }
コード例 #3
0
        void Update(uint32 diff)
        {
            if (!instance->HavePlayers())
                return;

            if (WaveAlive == 0 && !WaveAdvanced)
            {
                if (uiWaveCount == 1 || uiWaveCount == 2 || uiWaveCount == 3 || uiWaveCount == 4 || uiWaveCount == 6 || uiWaveCount == 7 ||uiWaveCount == 8 || uiWaveCount == 9)
                {
                    WaveAdvanced = true;
                    events.RescheduleEvent(EVENT_NEXT_WAVE, 1000);
                    events.ScheduleEvent(EVENT_ADVANCE_WAVE, 5000);
                }
            }

            events.Update(diff);

            switch (events.ExecuteEvent())
            {
                case EVENT_NEXT_WAVE:
                    uiWaveCount++;
                    AddWave();
                    break;
                case EVENT_ADVANCE_WAVE:
                    WaveAdvanced = false;
                    break;
            }
        }
コード例 #4
0
        void Update(uint32 diff)
        {
            if (!instance->HavePlayers())
                return;

            events.Update(diff);

            switch (events.ExecuteEvent())
            {
                case EVENT_NEXT_WAVE:
                    WaveCount++;
                    AddWave();
                    break;
            }
        }
コード例 #5
0
        void Update(uint32 diff)
        {
            if (!instance->HavePlayers())
                return;

            events.Update(diff);

            switch (events.ExecuteEvent())
            {
                case EVENT_NEXT_WAVE:
                    uiWaveCount++;
                    AddWave();
                    break;
                case EVENT_START_LICH_KING:
                    /// @todo
                    break;
            }
        }
コード例 #6
0
        void Update(uint32 diff)
        {
            if (WaveCnt && (!instance->HavePlayers() || !AlivePlr() || NurGM()))
            {
                DoWipe();
                return;
            }

            events.Update(diff);

            switch (events.ExecuteEvent())
            {
                case EVENT_NEXT_WAVE:
                    ++WaveCnt;
                    AddWave();
                    break;
                default:
                    break;
            }
        }
コード例 #7
0
    void Update(uint32 diff)
    {
        if (!instance->HavePlayers())
            return;

        // portals should spawn if other portal is dead and doors are closed
        if (bActive && uiMainEventPhase == IN_PROGRESS)
        {
            if (uiActivationTimer < diff)
            {
                AddWave();
                bActive = false;
                uiActivationTimer = 5000;
            } else uiActivationTimer -= diff;
        }

        // if main event is in progress and players have wiped then reset instance
        if ( uiMainEventPhase == IN_PROGRESS && CheckWipe())
        {
            SetData(DATA_REMOVE_NPC, 1);
            StartBossEncounter(uiFirstBoss, false);
            StartBossEncounter(uiSecondBoss, false);

            SetData(DATA_MAIN_DOOR,GO_STATE_ACTIVE);
            SetData(DATA_WAVE_COUNT, 0);
            uiMainEventPhase = NOT_STARTED;

            if (Creature* pSinclari = instance->GetCreature(uiSinclari))
            {
                pSinclari->SetVisibility(VISIBILITY_ON);

                std::list<Creature*> GuardList;
                pSinclari->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f);
                if (!GuardList.empty())
                {
                    for (std::list<Creature*>::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr)
                    {
                        if (Creature* pGuard = *itr)
                        {
                            pGuard->SetVisibility(VISIBILITY_ON);
                            pGuard->SetReactState(REACT_AGGRESSIVE);
                            pGuard->GetMotionMaster()->MovePoint(1,pGuard->GetHomePosition());
                        }
                    }
                }
                pSinclari->GetMotionMaster()->MovePoint(1,pSinclari->GetHomePosition());
                pSinclari->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NOT_SELECTABLE);
            }
        }

        // Cyanigosa is spawned but not tranformed, prefight event
        Creature *pCyanigosa = instance->GetCreature(uiCyanigosa);
        if (pCyanigosa && !pCyanigosa->HasAura(CYANIGOSA_SPELL_TRANSFORM))
        {
            if (uiCyanigosaEventTimer <= diff)
            {
                switch(uiCyanigosaEventPhase)
                {
                    case 1:
                        pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_BLUE_AURA, false);
                        DoScriptText(CYANIGOSA_SAY_SPAWN, pCyanigosa);
                        uiCyanigosaEventTimer = 7*IN_MILISECONDS;
                        ++uiCyanigosaEventPhase;
                        break;
                    case 2:
                        pCyanigosa->GetMotionMaster()->MoveJump(MiddleRoomLocation.GetPositionX(), MiddleRoomLocation.GetPositionY(), MiddleRoomLocation.GetPositionZ(), 10.0f, 20.0f);
                        pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_BLUE_AURA, false);
                        uiCyanigosaEventTimer = 7*IN_MILISECONDS;
                        ++uiCyanigosaEventPhase;
                        break;
                    case 3:
                        pCyanigosa->RemoveAurasDueToSpell(CYANIGOSA_BLUE_AURA);
                        pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_SPELL_TRANSFORM, 0);
                        pCyanigosa->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE);
                        pCyanigosa->SetReactState(REACT_AGGRESSIVE);
                        uiCyanigosaEventTimer = 2*IN_MILISECONDS;
                        ++uiCyanigosaEventPhase;
                        break;
                    case 4:
                        uiCyanigosaEventPhase = 0;
                        break;
                }
            } else uiCyanigosaEventTimer -= diff;
        }

        // if there are NPCs in front of the prison door, which are casting the door seal spell and doors are active
        if (GetData(DATA_NPC_PRESENCE_AT_DOOR) && uiMainEventPhase == IN_PROGRESS)
        {
            // if door integrity is > 0 then decrase it's integrity state
            if(GetData(DATA_DOOR_INTEGRITY))
            {
                if(uiDoorSpellTimer < diff)
                {
                    SetData(DATA_DOOR_INTEGRITY,GetData(DATA_DOOR_INTEGRITY)-1);
                    uiDoorSpellTimer =2000;
                } else uiDoorSpellTimer -= diff;
            }
            // else set door state to active (means door will open and group have failed to sustain mob invasion on the door)
            else
            {
                SetData(DATA_MAIN_DOOR,GO_STATE_ACTIVE);
                uiMainEventPhase = FAIL;
            }
        }
    }
コード例 #8
0
        void Update(uint32 diff) override
        {
            if (!instance->HavePlayers())
                return;

            // portals should spawn if other portal is dead and doors are closed
            if (bActive && uiMainEventPhase == IN_PROGRESS)
            {
                if (uiActivationTimer < diff)
                {
                    AddWave();
                    bActive = false;
                    // 1 minute waiting time after each boss fight
                    uiActivationTimer = (uiWaveCount == 6 || uiWaveCount == 12) ? 60000 : 5000;
                } else uiActivationTimer -= diff;
            }

            // if main event is in progress and players have wiped then reset instance
            if (uiMainEventPhase == IN_PROGRESS && CheckWipe())
            {
                SetData(DATA_REMOVE_NPC, 1);
                StartBossEncounter(uiFirstBoss, false);
                StartBossEncounter(uiSecondBoss, false);

                SetData(DATA_MAIN_DOOR, GO_STATE_ACTIVE);
                SetData(DATA_WAVE_COUNT, 0);
                uiMainEventPhase = NOT_STARTED;

                for (int i = 0; i < 4; ++i)
                    if (GameObject* crystal = instance->GetGameObject(uiActivationCrystal[i]))
                        crystal->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);

                if (Creature* sinclari = GetCreature(DATA_SINCLARI))
                {
                    sinclari->SetVisible(true);

                    std::list<Creature*> GuardList;
                    sinclari->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f);
                    if (!GuardList.empty())
                    {
                        for (Creature* guard : GuardList)
                        {
                            guard->SetVisible(true);
                            guard->SetReactState(REACT_AGGRESSIVE);
                            guard->GetMotionMaster()->MovePoint(1, guard->GetHomePosition());
                        }
                    }
                    sinclari->GetMotionMaster()->MovePoint(1, sinclari->GetHomePosition());
                    sinclari->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                }
            }

            // Cyanigosa is spawned but not tranformed, prefight event
            Creature* cyanigosa = GetCreature(DATA_CYANIGOSA);
            if (cyanigosa && !cyanigosa->HasAura(CYANIGOSA_SPELL_TRANSFORM))
            {
                if (uiCyanigosaEventTimer <= diff)
                {
                    switch (uiCyanigosaEventPhase)
                    {
                        case 1:
                            cyanigosa->CastSpell(cyanigosa, CYANIGOSA_BLUE_AURA, false);
                            cyanigosa->AI()->Talk(CYANIGOSA_SAY_SPAWN);
                            uiCyanigosaEventTimer = 7*IN_MILLISECONDS;
                            ++uiCyanigosaEventPhase;
                            break;
                        case 2:
                            cyanigosa->GetMotionMaster()->MoveJump(MiddleRoomLocation.GetPositionX(), MiddleRoomLocation.GetPositionY(), MiddleRoomLocation.GetPositionZ(), 10.0f, 20.0f);
                            cyanigosa->CastSpell(cyanigosa, CYANIGOSA_BLUE_AURA, false);
                            uiCyanigosaEventTimer = 7*IN_MILLISECONDS;
                            ++uiCyanigosaEventPhase;
                            break;
                        case 3:
                            cyanigosa->RemoveAurasDueToSpell(CYANIGOSA_BLUE_AURA);
                            cyanigosa->CastSpell(cyanigosa, CYANIGOSA_SPELL_TRANSFORM, 0);
                            cyanigosa->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_NON_ATTACKABLE);
                            cyanigosa->SetReactState(REACT_AGGRESSIVE);
                            uiCyanigosaEventTimer = 2*IN_MILLISECONDS;
                            ++uiCyanigosaEventPhase;
                            break;
                        case 4:
                            uiCyanigosaEventPhase = 0;
                            break;
                    }
                } else uiCyanigosaEventTimer -= diff;
            }

            // if there are NPCs in front of the prison door, which are casting the door seal spell and doors are active
            if (GetData(DATA_NPC_PRESENCE_AT_DOOR) && uiMainEventPhase == IN_PROGRESS)
            {
                // if door integrity is > 0 then decrase it's integrity state
                if (GetData(DATA_DOOR_INTEGRITY))
                {
                    if (uiDoorSpellTimer < diff)
                    {
                        SetData(DATA_DOOR_INTEGRITY, GetData(DATA_DOOR_INTEGRITY)-1);
                        uiDoorSpellTimer =2000;
                    } else uiDoorSpellTimer -= diff;
                }
                // else set door state to active (means door will open and group have failed to sustain mob invasion on the door)
                else
                {
                    SetData(DATA_MAIN_DOOR, GO_STATE_ACTIVE);
                    uiMainEventPhase = FAIL;
                }
            }
        }
コード例 #9
0
       void UpdateAI(const uint32 uiDiff)
        {
            if(!m_pInstance) return;

            if (m_pInstance->GetData(DATA_FALRIC_EVENT) == SPECIAL)
            {
                if(!m_bIsCall)
                {
                   m_bIsCall = true;
                   ++SummonCountMarwyn;
                   Summon();
                }
            }

            if(m_pInstance->GetData(DATA_MARWYN_EVENT) == SPECIAL)
            {
               if(m_uiSummonTimer < uiDiff)
               {
                       AddWave();
                       ++SummonCount;
                       ++SummonCountMarwyn;
                       if(SummonCount == 1)
                          DoScriptText(SAY_MARWYN_INTRO, me);

                       if(SummonCount > 4)
                       {
                            m_pInstance->SetData(DATA_MARWYN_EVENT, IN_PROGRESS);
                            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                            me->SetInCombatWithZone();
                       }
                       else CallFallSoldier();
                       m_uiSummonTimer = 60000;
               } else m_uiSummonTimer -= uiDiff;
            }

            if(!UpdateVictim())
                return;

            if(m_uiObliterateTimer < uiDiff)
            {
                DoCast(me->getVictim(), Regular ? SPELL_OBLITERATE_N : SPELL_OBLITERATE_H);
                m_uiObliterateTimer = urand(8000, 12000);
            } else m_uiObliterateTimer -= uiDiff;

            if (m_uiWellTimer < uiDiff)
            {
                DoScriptText(SAY_MARWYN_SP02, me);
                if(Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
                   DoCast(pTarget, SPELL_WELL_OF_CORRUPTION);
                m_uiWellTimer= urand(25000, 30000);
            } else m_uiWellTimer -= uiDiff;

            if (m_uiSharedSufferingTimer < uiDiff)
            {
                if(Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
                   DoCast(pTarget, Regular ? SPELL_SHARED_SUFFERING_N : SPELL_SHARED_SUFFERING_H);
                m_uiSharedSufferingTimer = urand(15000, 20000);
            } else m_uiSharedSufferingTimer -= uiDiff;

            if (m_uiFleshTimer < uiDiff)
            {
                DoScriptText(SAY_MARWYN_SP01, me);
                if(Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
                    DoCast(pTarget, Regular ? SPELL_CORRUPTED_FLESH_N : SPELL_CORRUPTED_FLESH_H);
                m_uiFleshTimer = urand(10000, 16000);
            } else m_uiFleshTimer -= uiDiff;

            if(m_uiBerserkTimer < uiDiff)
            {
                DoCast(me, SPELL_BERSERK);
                m_uiBerserkTimer = 180000;
            } else m_uiBerserkTimer -= uiDiff;

            DoMeleeAttackIfReady();

            return;
        }
コード例 #10
0
ファイル: instance_violet_hold.cpp プロジェクト: VenT/wow
    void Update(uint32 diff)
    {
        if (!instance->HavePlayers())
            return;

        if ((uiWaveCount == 0) && (GetData(DATA_MAIN_DOOR) != GO_STATE_READY) && uiOnlyonce == 0) {
            uiOnlyonce=1;
            if (Creature *pSinclari = instance->GetCreature(uiSinclari)) {
                if(Creature *portal1 = pSinclari->SummonCreature(CREATURE_TELEPORTATION_PORTAL, PreEventPortal1Location, TEMPSUMMON_CORPSE_DESPAWN))
                    uiPreEventPortal1 = portal1->GetGUID();
                if(Creature *portal2 = pSinclari->SummonCreature(CREATURE_TELEPORTATION_PORTAL, PreEventPortal2Location, TEMPSUMMON_CORPSE_DESPAWN))
                    uiPreEventPortal2 = portal2->GetGUID();
            }
            return;
        }

        // portals should spawn if other portal is dead and doors are closed
        if (bActive && GetData(DATA_MAIN_DOOR) == GO_STATE_READY)
        {
            if (uiActivationTimer < diff)
            {
                AddWave();
                bActive = false;
                uiActivationTimer = 5000;
            } else uiActivationTimer -= diff;
        }

        if (uiStartBossEncounter == 1) {
            switch(uiWaveCount)
            {
                case 6:
                    StartBossEncounter(uiFirstBoss);
                    uiStartBossEncounter = -1;
                    break;
                case 12:
                    StartBossEncounter(uiSecondBoss);
                    uiStartBossEncounter = -1;
                    break;
            }
        }



        if (uiTimer <= diff)
        {
            switch(uiWaveCount)
            {
                case 18:
                    if (Creature *pCyanigosa = instance->GetCreature(uiCyanigosa))
                        if (!pCyanigosa->HasAura(CYANIGOSA_SPELL_TRANSFORM))
                            switch(uiPhase)
                            {
                                case 1:
                                    pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_BLUE_AURA, false);
                                    DoScriptText(CYANIGOSA_SAY_SPAWN, pCyanigosa);
                                    uiTimer = 7000;
                                    ++uiPhase;
                                    break;
                                case 2:
                                    pCyanigosa->GetMotionMaster()->MoveJump(MiddleRoomLocation.GetPositionX(), MiddleRoomLocation.GetPositionY(), MiddleRoomLocation.GetPositionZ(), 10.0f, 20.0f);
                                    pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_BLUE_AURA, false);
                                    uiTimer = 7000;
                                    ++uiPhase;
                                    break;
                                case 3:
                                    pCyanigosa->RemoveAurasDueToSpell(CYANIGOSA_BLUE_AURA);
                                    pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_SPELL_TRANSFORM, 0);
                                    pCyanigosa->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE);
                                    pCyanigosa->SetReactState(REACT_AGGRESSIVE);
                                    uiTimer = 2000;
                                    ++uiPhase;
                                    break;
                                case 4:
                                    uiPhase = 0;
                                    break;
                            }
                    break;
            }
        } else uiTimer -= diff;


        // if doors are closed (means event is in progres) and players have wiped then reset instance
        if (GetData(DATA_MAIN_DOOR) != GO_STATE_ACTIVE && CheckWipe())
        {
            SetData(DATA_REMOVE_NPC, 1);
            StartBossEncounter(uiFirstBoss, false);
            StartBossEncounter(uiSecondBoss, false);

            SetData(DATA_MAIN_DOOR,GO_STATE_ACTIVE);
            SetData(DATA_WAVE_COUNT, 0);

            if (Creature* pSinclari = instance->GetCreature(uiSinclari))
            {
                pSinclari->SetVisibility(VISIBILITY_ON);

                std::list<Creature*> GuardList;
                pSinclari->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f);
                if (!GuardList.empty())
                {
                    for (std::list<Creature*>::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr)
                    {
                        if (Creature* pGuard = *itr)
                        {
                            pGuard->SetVisibility(VISIBILITY_ON);
                            pGuard->SetReactState(REACT_AGGRESSIVE);
                            pGuard->GetMotionMaster()->MovePoint(1,pGuard->GetHomePosition());
                        }
                    }
                }
                pSinclari->GetMotionMaster()->MovePoint(1,pSinclari->GetHomePosition());
                pSinclari->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NOT_SELECTABLE);
            }
        }



        // if there are NPCs in front of the prison door, which are casting the door seal spell and doors are active
        if(GetData(DATA_NPC_PRESENCE_AT_DOOR) && (GetData(DATA_MAIN_DOOR) == GO_STATE_READY))
        {
            // if door integrity is > 0 then decrase it's integrity state
            if(GetData(DATA_DOOR_INTEGRITY))
            {
                if(uiDoorSpellTimer < diff)
                {
                    SetData(DATA_DOOR_INTEGRITY,GetData(DATA_DOOR_INTEGRITY)-1);
                    uiDoorSpellTimer =2000;
                }
                else uiDoorSpellTimer -= diff;
            }
            // else set door state to active (means door will open and group have failed to sustain mob invasion on the door)
            else
                SetData(DATA_MAIN_DOOR,GO_STATE_ACTIVE);
        }
    }
コード例 #11
0
        void UpdateAI(const uint32 uiDiff)
        {
            if(!m_pInstance) return;

            if (m_pInstance->GetData(DATA_FALRIC_EVENT) == SPECIAL)
            {
                if(!m_bIsCall)
                {
                   m_bIsCall = true;
                   Summon();
                }

                if (m_uiSummonTimer < uiDiff)
                {
                        ++SummonCount;
                        AddWave();
                        if(SummonCount > 4)
                        {
                            m_pInstance->SetData(DATA_FALRIC_EVENT, IN_PROGRESS);
                            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                            me->SetInCombatWithZone();
                        }
                        else CallFallSoldier();
                        m_uiSummonTimer = 60000;
                } else m_uiSummonTimer -= uiDiff;
            }

            if (!UpdateVictim())
                return;

            if(m_uiStrikeTimer < uiDiff)
            {
                DoCast(me->getVictim(), Regular ? SPELL_QUIVERING_STRIKE_N : SPELL_QUIVERING_STRIKE_H);
                m_uiStrikeTimer = (urand(7000, 14000));
            }
            else m_uiStrikeTimer -= uiDiff;

            if(m_uiHorrorTimer < uiDiff)
            {
                DoScriptText(SAY_FALRIC_SP01, me);
                if(Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
                   DoCast(pTarget, SPELL_IMPENDING_DESPAIR);
                m_uiHorrorTimer = (urand(15000, 25000));
            }
            else m_uiHorrorTimer -= uiDiff;

            if(m_uiGrowlTimer < uiDiff)
            {
                DoScriptText(SAY_FALRIC_SP02, me);
                DoCast(me->getVictim(), Regular ? SPELL_DEFILING_HORROR_N : SPELL_DEFILING_HORROR_H);
                m_uiGrowlTimer = (urand(25000, 30000));
            }
            else m_uiGrowlTimer -= uiDiff;

            if (m_uiBerserkTimer < uiDiff)
            {
                DoCast(me, SPELL_BERSERK);
                m_uiBerserkTimer = 180000;
            } else m_uiBerserkTimer -= uiDiff;

            DoMeleeAttackIfReady();

            return;
        }