Пример #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);
            }
    }
            void Update(uint32 diff) override
            {
                if (!instance->HavePlayers())
                    return;

                // if main event is in progress and players have wiped then reset instance
                if ((EventState == IN_PROGRESS && CheckWipe()) || EventState == FAIL)
                {
                    ResetBossEncounter(FirstBossId);
                    ResetBossEncounter(SecondBossId);
                    ResetBossEncounter(DATA_CYANIGOSA);

                    WaveCount = 0;
                    DoorIntegrity = 100;
                    Defenseless = true;
                    SetData(DATA_MAIN_EVENT_STATE, NOT_STARTED);

                    Scheduler.CancelAll();

                    if (Creature* sinclari = GetCreature(DATA_SINCLARI))
                        sinclari->AI()->EnterEvadeMode();
                }

                Scheduler.Update(diff);

                if (EventState == IN_PROGRESS)
                {
                    // if door is destroyed, event is failed
                    if (!GetData(DATA_DOOR_INTEGRITY))
                        EventState = FAIL;
                }
            }
Пример #3
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;
            }
        }
    }
        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;
                }
            }
        }
Пример #5
0
    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);
        }
    }