void OnCreatureCreate(Creature* creature)
 {
     switch (creature->GetEntry())
     {
         case NPC_DRAKOS:
             drakosGUID = creature->GetGUID();
             break;
         case NPC_VAROS:
             varosGUID = creature->GetGUID();
             if (GetBossState(DATA_DRAKOS_EVENT) == DONE)
                creature->SetPhaseMask(1, true);
             break;
         case NPC_UROM:
             uromGUID = creature->GetGUID();
             if (GetBossState(DATA_VAROS_EVENT) == DONE)
                 creature->SetPhaseMask(1, true);
             break;
         case NPC_EREGOS:
             eregosGUID = creature->GetGUID();
             if (GetBossState(DATA_UROM_EVENT) == DONE)
                 creature->SetPhaseMask(1, true);
             break;
         case NPC_CENTRIFUGE_CONSTRUCT:
             if (creature->isAlive())
                 DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, ++centrifugueConstructCounter);
             break;
         case NPC_BELGARISTRASZ:
             belgaristraszGUID = creature->GetGUID();
             if (GetBossState(DATA_DRAKOS_EVENT) == DONE)
                 creature->SetWalk(true),
                 creature->GetMotionMaster()->MovePoint(0, 941.453f, 1044.1f, 359.967f),
                 creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
             break;
         case NPC_ETERNOS:
             eternosGUID = creature->GetGUID();
             if (GetBossState(DATA_DRAKOS_EVENT) == DONE)
                 creature->SetWalk(true),
                 creature->GetMotionMaster()->MovePoint(0, 943.202f, 1059.35f, 359.967f),
                 creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
             break;
         case NPC_VERDISA:
             verdisaGUID = creature->GetGUID();
             if (GetBossState(DATA_DRAKOS_EVENT) == DONE)
                 creature->SetWalk(true),
                 creature->GetMotionMaster()->MovePoint(0, 949.188f, 1032.91f, 359.967f),
                 creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
             break;
         case NPC_GREATER_WHELP:
             if (GetBossState(DATA_UROM_EVENT) == DONE)
                 creature->SetPhaseMask(1, true);
                 gwhelpList.push_back(creature->GetGUID());
             break;
     }
 }
            void SetData(uint32 type, uint32 data)
            {
                switch (type)
                {
                    case DATA_MEATHOOK_EVENT:
                        _encounterState[0] = data;
                        break;
                    case DATA_SALRAMM_EVENT:
                        _encounterState[1] = data;
                        break;
                    case DATA_EPOCH_EVENT:
                        _encounterState[2] = data;
                        break;
                    case DATA_MAL_GANIS_EVENT:
                        _encounterState[3] = data;

                        switch (_encounterState[3])
                        {
                            case NOT_STARTED:
                                HandleGameObject(_malGanisGate2GUID, true);
                                break;
                            case IN_PROGRESS:
                                HandleGameObject(_malGanisGate2GUID, false);
                                break;
                            case DONE:
                                HandleGameObject(_exitGateGUID, true);
                                if (GameObject* go = instance->GetGameObject(_malGanisChestGUID))
                                    go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND);
                                break;
                        }
                        break;
                    case DATA_INFINITE_EVENT:
                        _encounterState[4] = data;
                        break;
                    case DATA_CRATE_COUNT:
                        _crateCount = data;
                        if (_crateCount == 5)
                        {
                            if (Creature* bunny = instance->GetCreature(_genericBunnyGUID))
                                bunny->CastSpell(bunny, SPELL_CRATES_CREDIT, true);

                            // Summon Chromie and global whisper
                            if (Creature* chromie = instance->SummonCreature(NPC_CHROMIE_2, ChromieSummonPos))
                                if (!instance->GetPlayers().isEmpty())
                                    if (Player* player = instance->GetPlayers().getFirst()->getSource())
                                        sCreatureTextMgr->SendChat(chromie, SAY_CRATES_COMPLETED, player->GetGUID(), CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP);
                        }
                        DoUpdateWorldState(WORLDSTATE_CRATES_REVEALED, _crateCount);
                        break;
                }

                if (data == DONE)
                    SaveToDB();
            }
Ejemplo n.º 3
0
        void OnCreatureDeath(Creature* creature)
        {
            if (creature->GetEntry() != NPC_CENTRIFUGE_CONSTRUCT)
                return;

             DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, --centrifugueConstructCounter);

             if (!centrifugueConstructCounter)
                if (Creature* varos = instance->GetCreature(varosGUID))
                    varos->RemoveAllAuras();
        }
Ejemplo n.º 4
0
void instance_mount_hyjal::SetData(uint32 uiType, uint32 uiData)
{
    switch (uiType)
    {
        case TYPE_WINTERCHILL:
        case TYPE_ANETHERON:
        case TYPE_KAZROGAL:
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_AZGALOR:
            m_auiEncounter[uiType] = uiData;
            if (uiData == DONE)
                DoSpawnArchimonde();
            break;
        case TYPE_ARCHIMONDE:
            m_auiEncounter[uiType] = uiData;
            break;

        case TYPE_TRASH_COUNT:
            m_uiTrashCount = uiData;
            DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, m_uiTrashCount);
            break;

        case TYPE_RETREAT:
            if (uiData == SPECIAL)
            {
                if (!lAncientGemGuidList.empty())
                {
                    for (GuidList::const_iterator itr = lAncientGemGuidList.begin(); itr != lAncientGemGuidList.end(); ++itr)
                    {
                        // don't know how long it expected
                        DoRespawnGameObject(*itr, DAY);
                    }
                }
            }
            break;
    }

    debug_log("SD2: Instance Hyjal: Instance data updated for event %u (Data=%u)", uiType, uiData);

    if (uiData == DONE)
    {
        OUT_SAVE_INST_DATA;

        std::ostringstream saveStream;
        saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " "
                   << m_auiEncounter[3] << " " << m_auiEncounter[4];

        m_strSaveData = saveStream.str();

        SaveToDB();
        OUT_SAVE_INST_DATA_COMPLETE;
    }
}
Ejemplo n.º 5
0
        void SetData(uint32 type,uint32 data)
        {
            switch(type)
            {
                case DATA_BAINE:
                    uiEncounter[1] = data;
                    break;

                case DATA_JAINA:
                    uiEncounter[2] = data;
                    break;

                case DATA_SYLVANA:
                    uiEncounter[3] = data;
                    break;

                case DATA_TYRANDE:
                    uiEncounter[4] = data;
                    break;
                    
                case DATA_MUROZOND:
                    uiEncounter[5] = data;
                    break;

                case DATA_JAINA_PICKED_STATE:
                    switch (data)
                    {
                        case IN_PROGRESS:
                            DoUpdateWorldState(WORLDSTATE_SHOW_FRAGMENTS, 1);
                            break;
                        case DONE:
                            DoUpdateWorldState(WORLDSTATE_SHOW_FRAGMENTS, 0);
                            break;
                    }
                    JainaPickedState = data;
                    break;
            }
         
            if (data == DONE)
                SaveToDB();
        }
 void SetData(uint32 type, uint32 data)
 {
     switch (type)
     {
         case DATA_COLOSSUS:
             ColossusData = data;
             if (data == 2)
             {
                 if (Creature* Leviathan = instance->GetCreature(LeviathanGUID))
                     Leviathan->AI()->DoAction(ACTION_MOVE_TO_CENTER_POSITION);
                 if (GameObject* gameObject = instance->GetGameObject(LeviathanGateGUID))
                     gameObject->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
                 SaveToDB();
             }
             break;
         case DATA_HODIR_RARE_CACHE:
             HodirRareCacheData = data;
             if (!HodirRareCacheData)
             {
                 if (Creature* Hodir = instance->GetCreature(HodirGUID))
                     if (GameObject* gameObject = instance->GetGameObject(HodirRareCacheGUID))
                         Hodir->RemoveGameObject(gameObject, false);
             }
             break;
         case DATA_UNBROKEN:
             Unbroken = bool(data);
             break;
         case EVENT_DESPAWN_ALGALON:
             DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 1);
             DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, 60);
             _algalonTimer = 60;
             _events.ScheduleEvent(EVENT_DESPAWN_ALGALON, 3600000);
             _events.ScheduleEvent(EVENT_UPDATE_ALGALON_TIMER, 60000);
             break;
         case DATA_ALGALON_SUMMON_STATE:
             _algalonSummoned = true;
             break;
         default:
             break;
     }
 }
        // Wipe has been detected. Perform cleanup and reset.
        void DoWipe()
        {

            if (GetData(DATA_MARWYN_EVENT) != DONE) {

                SetData(DATA_WAVE_COUNT, FAIL);
                uiWaveCount = 0;
                events.Reset();
                DoUpdateWorldState(WORLD_STATE_HOR, 1);
                DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, uiWaveCount);
                OpenDoor(uiFrontDoor);

            // TODO
            // in case of wipe, the event is normally restarted by jumping into the center of the room.
            // As I can't find a trigger area there, just respawn Jaina/Sylvanas so the event may be restarted.
            if (Creature* pFalric = instance->GetCreature(uiFalric))
                pFalric->SetVisible(false);
            if (Creature* pMarwyn = instance->GetCreature(uiMarwyn))
                pMarwyn->SetVisible(false);
            }
        }
void instance_old_hillsbrad::OnCreatureEnterCombat(Creature* pCreature)
{
    switch (pCreature->GetEntry())
    {
        case NPC_DRAKE:
            SetData(TYPE_DRAKE, IN_PROGRESS);
            DoUpdateWorldState(WORLD_STATE_OH, 0);
            break;
        case NPC_SKARLOC: SetData(TYPE_SKARLOC, IN_PROGRESS); break;
        case NPC_EPOCH:   SetData(TYPE_EPOCH, IN_PROGRESS);   break;
    }
}
        // Wipe has been detected. Perform cleanup and reset.
        void DoWipe()
        {
            uiWaveCount = 0;
            events.Reset();
            DoUpdateWorldState(WORLD_STATE_HOR, 1);
            DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, uiWaveCount);
            HandleGameObject(uiFrontDoor, true);

            // TODO
            // in case of wipe, the event is normally restarted by jumping into the center of the room.
            // As I can't find a trigger area there, just respawn Jaina/Sylvanas so the event may be restarted.
            if (Creature* pJaina = instance->GetCreature(uiJainaPart1))
                pJaina->Respawn();
            if (Creature* pSylvanas = instance->GetCreature(uiSylvanasPart1))
                pSylvanas->Respawn();

            if (Creature* pFalric = instance->GetCreature(uiFalric))
                pFalric->SetVisibility(VISIBILITY_OFF);
            if (Creature* pMarwyn = instance->GetCreature(uiMarwyn))
                pMarwyn->SetVisibility(VISIBILITY_OFF);
        }
Ejemplo n.º 10
0
 void SetData(uint32 type, uint32 data)
 {
     switch (type)
     {
         case DATA_ZULAMAN_STATE:
         {
             if (data == IN_PROGRESS)
             {
                 DoUpdateWorldState(WORLD_STATE_ZULAMAN_TIMER_ENABLED, 1);
                 DoUpdateWorldState(WORLD_STATE_ZULAMAN_TIMER, 15);
                 events.ScheduleEvent(EVENT_UPDATE_ZULAMAN_TIMER, 60000);
                 SpeedRunTimer = 15;
                 ZulAmanState = data;
                 SaveToDB();
             }
             break;
         }
         default:
             break;
     }
 }
Ejemplo n.º 11
0
        bool SetBossState(uint32 type, EncounterState state)
        {
            if (!InstanceScript::SetBossState(type, state))
                return false;

            switch (type)
            {
                case DATA_DRAKOS_EVENT:
                    if (state == DONE)
                    {
                        DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 1);
                        DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, centrifugueConstructCounter);
                        OpenCageDoors();
                    }
                    break;
                case DATA_VAROS_EVENT:
                    if (state == DONE)
                    {
                        DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 0);
                        if (Creature* urom = instance->GetCreature(uromGUID))
                        {
                            urom->RestoreFaction();
                            urom->RemoveAllAuras();
                            urom->AI()->DoCast(SPELL_EVOCATION);
                        }
                    }
                    break;
                case DATA_UROM_EVENT:
                    if (state == DONE)
                        if (Creature* eregos = instance->GetCreature(eregosGUID))
                            eregos->RestoreFaction();
                    break;
                case DATA_EREGOS_EVENT:
                    if (state == DONE)
                        DoRespawnGameObject(eregosCacheGUID, 7*DAY);
                    break;
            }

            return true;
        }
Ejemplo n.º 12
0
    void AddWave()
    {
        DoUpdateWorldState(WORLD_STATE_VH, 1);
        DoUpdateWorldState(WORLD_STATE_VH_WAVE_COUNT, uiWaveCount);
        DoUpdateWorldState(WORLD_STATE_VH_PRISON_STATE, 100); // TODO

        switch (uiWaveCount)
        {
            case 6:
                if (uiFirstBoss == 0)
                    uiFirstBoss = urand(1,6);
                StartBossEncounter(uiFirstBoss);
                break;
            case 12:
                if (uiSecondBoss == 0)
                    do 
                    {
                        uiSecondBoss = urand(1,6);
                    } while (uiSecondBoss == uiFirstBoss);
                StartBossEncounter(uiSecondBoss);
                break;
            case 18:
            {
                Creature *pSinclari = instance->GetCreature(uiSinclari);
                if (pSinclari)
                    pSinclari->SummonCreature(CREATURE_CYANIGOSA,PortalLocation[0],TEMPSUMMON_DEAD_DESPAWN);
                break;
            }
            case 1:
            {
                if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor))
                    pMainDoor->SetGoState(GO_STATE_READY);
            }
            default:
                if (!bWiped)
                    SpawnPortal();
                bWiped = false;
                break;
        }
    }
Ejemplo n.º 13
0
            void Load(char const* str)
            {
                if (!str)
                {
                    OUT_LOAD_INST_DATA_FAIL;
                    return;
                }

                OUT_LOAD_INST_DATA(str);

                char dataHead1, dataHead2;

                std::istringstream loadStream(str);
                loadStream >> dataHead1 >> dataHead2;

                if (dataHead1 == 'Z' && dataHead2 == 'A')
                {
                    for (uint8 i = 0; i < EncounterCount; ++i)
                    {
                        uint32 tmpState;
                        loadStream >> tmpState;
                        if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
                            tmpState = NOT_STARTED;

                        SetBossState(i, EncounterState(tmpState));
                    }

                    loadStream >> ZulAmanState;
                    loadStream >> SpeedRunTimer;
                    loadStream >> ZulAmanBossCount;

                    if (ZulAmanState == IN_PROGRESS && SpeedRunTimer && SpeedRunTimer <= 15)
                    {
                        events.ScheduleEvent(EVENT_UPDATE_ZULAMAN_TIMER, 60000);
                        DoUpdateWorldState(WORLD_STATE_ZULAMAN_TIMER_ENABLED, 1);
                        DoUpdateWorldState(WORLD_STATE_ZULAMAN_TIMER, SpeedRunTimer);
                    }
                }
                else
        void DoWipe()
        {
            if (GetData(DATA_FALRIC_EVENT) == DONE && GetData(DATA_MARWYN_EVENT) != DONE)
                WaveCnt = 5;
            else
                WaveCnt = 0;

            events.Reset();

            DoUpdateWorldState(WORLD_STATE_HOR, 0);
            DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, WaveCnt);

            OpenDoor(FrontDoorGUID);

            if (Creature * Falric = instance->GetCreature(FalricGUID))
                if (Falric->isAlive())
                    Falric->AI()->EnterEvadeMode();

            if (Creature * Marwyn = instance->GetCreature(MarwynGUID))
                if (Marwyn->isAlive())
                    Marwyn->AI()->EnterEvadeMode();
        }
Ejemplo n.º 15
0
        bool SetBossState(uint32 type, EncounterState state)
        {
            if (!InstanceScript::SetBossState(type, state))
                return false;

            switch (type)
            {
                case DATA_DRAKOS_EVENT:
                    if (state == DONE)
                    {
                        DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 1);
                        DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, centrifugueConstructCounter);
                        OpenCageDoors();
                        FreeDragons();
                        if (Creature* varos = instance->GetCreature(varosGUID))
                            varos->SetPhaseMask(1, true);
                    }
                    break;
                case DATA_VAROS_EVENT:
                    if (state == DONE)
                        DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 0);
                        if (Creature* urom = instance->GetCreature(uromGUID))
                            urom->SetPhaseMask(1, true);
                    break;
                case DATA_UROM_EVENT:
                    if (state == DONE)
                        if (Creature* eregos = instance->GetCreature(eregosGUID))
                            eregos->SetPhaseMask(1, true);
                            GreaterWhelps();
                    break;
                case DATA_EREGOS_EVENT:
                    if (state == DONE)
                        DoRespawnGameObject(eregosCacheGUID, 7*DAY);
                    break;
            }

            return true;
        }
    void Update(uint32 uiDiff)
    {
       if(m_auiEncounter[5] == IN_PROGRESS)
       {
         if(m_uiHeroicTimer < uiDiff)
         {
             m_auiEncounter[5] = FAIL;
             DoUpdateWorldState(WORLD_STATE_COS_TIME_ON, 0);
             if(Creature* Corruptor = instance->GetCreature(m_uiCorruptorGUID))
               Corruptor->SetPhaseMask(0, true);

         }else m_uiHeroicTimer -= uiDiff;

         if(m_uiHeroicTimer < m_uiLastTimer - 60000)
         {
            m_uiLastTimer = m_uiHeroicTimer;
            uint32 tMinutes = m_uiHeroicTimer / 60000;
            DoUpdateWorldState(WORLD_STATE_COS_TIME_COUNT, tMinutes);
         }
       }
 
       return;
    }
        void Update(uint32 diff)
        {        
           if (tMinutes == 25)
           {
               m_auiEncounter[4] = FAIL;
               if (Creature *pInfinite = instance->GetCreature(uiInfinite))
               {
                   pInfinite->DisappearAndDie();
                   pInfinite->SetLootRecipient(NULL);
               }
               DoUpdateWorldState(WORLD_STATE_TIMER, 0);             
           }

           if (Minute <= diff)
           {
              LastTimer = EventTimer;
              tMinutes++;
              DoUpdateWorldState(WORLD_STATE_TIME_COUNTER, 25 - tMinutes);
              Minute = 60000;
           }
           else Minute -= diff;
           return;
        }
		void DoWipe1()
		{
			if (!WaveNumber)
				return;

			DoUpdateWorldState(WORLD_STATE_HOR_COUNTER, 0);
			DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, 0);
			HandleGameObject(GO_FrontDoorGUID, true);

			TrashCounter = NUM_OF_TRASH;
			WaveNumber = 0;
			NextWaveTimer = 0;
			memset(&chosenComposition, 0, sizeof(chosenComposition));

			for (uint8 i=0; i<NUM_OF_TRASH; ++i)
				if (TrashActive[i])
					if (Creature* c = instance->GetCreature(NPC_TrashGUID[i]))
					{
						c->DeleteThreatList();
						c->CombatStop(true);
						c->InterruptNonMeleeSpells(true);
						c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE);
						c->Respawn(true);
						c->UpdatePosition(c->GetHomePosition(), true);
						c->StopMovingOnCurrentPos();
					}
			memset(&TrashActive, 0, sizeof(TrashActive));

			if (Creature* falric = instance->GetCreature(NPC_FalricGUID))
				falric->AI()->EnterEvadeMode();
			if (Creature* marwyn = instance->GetCreature(NPC_MarwynGUID))
				marwyn->AI()->EnterEvadeMode();

			ResumeFirstEventTimer = 5000;
			ResumeFirstEventStep = 2;
			reqKillCount = 0;
		}
        void AddWave()
        {
            DoUpdateWorldState(WORLD_STATE_HOR, 1);
            DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, WaveCount);

            switch (WaveCount)
            {
                case 1:
                case 2:
                case 3:
                case 4:
                    if (Creature* falric = instance->GetCreature(Falric))
                        SpawnWave(falric);
                    break;
                case 5:
                    if (GetData(DATA_FALRIC_EVENT) == DONE)
                        events.ScheduleEvent(EVENT_NEXT_WAVE, 10000);
                    else if (Creature* falric = instance->GetCreature(Falric))
                        if (falric->AI())
                            falric->AI()->DoAction(ACTION_ENTER_COMBAT);
                    break;
                case 6:
                case 7:
                case 8:
                case 9:
                    if (Creature* marwyn  = instance->GetCreature(Marwyn))
                        SpawnWave(marwyn);
                    break;
                case 10:
                    if (GetData(DATA_MARWYN_EVENT) != DONE) // wave should not have been started if DONE. Check anyway to avoid bug exploit!
                        if (Creature* marwyn = instance->GetCreature(Marwyn))
                            if (marwyn->AI())
                                marwyn->AI()->DoAction(ACTION_ENTER_COMBAT);
                    break;
            }
        }
        void Update(uint32 diff)
        {
            if (GetData(DATA_INFINITE_EVENT) == SPECIAL || GetData(DATA_INFINITE_EVENT) == IN_PROGRESS)
                if (uiCountdownMinute)
                {
                    if (uiCountdownTimer < diff)
                    {
                        --uiCountdownMinute;

                        if (uiCountdownMinute)
                        {
                            DoUpdateWorldState(WORLDSTATE_NUMBER_INFINITE_SHOW, 1);
                            DoUpdateWorldState(WORLDSTATE_NUMBER_INFINITE_TIMER, uiCountdownMinute);
                        }
                        else
                        {
                            DoUpdateWorldState(WORLDSTATE_NUMBER_INFINITE_SHOW, 0);
                        }
                        SaveToDB();
                        uiCountdownTimer += 60000;
                    }
                    uiCountdownTimer -= diff;
                }
        }
Ejemplo n.º 21
0
            void OnUnitDeath(Unit* unit) override
            {
                Creature* creature = unit->ToCreature();
                if (!creature)
                    return;

                if (creature->GetEntry() == NPC_CENTRIFUGE_CONSTRUCT)
                {
                     DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, --CentrifugueConstructCounter);

                     if (!CentrifugueConstructCounter)
                        if (Creature* varos = instance->GetCreature(VarosGUID))
                            varos->RemoveAllAuras();
                }
            }
Ejemplo n.º 22
0
        void Update(uint32 diff)
        {
            if (uiAlgalonCountdown > 0 && uiAlgalonCountdown < 61)
            {
                if (uiCountdownTimer < diff)
                {
                    uiAlgalonCountdown--;

                    if (uiAlgalonCountdown)
                    {
                        DoUpdateWorldState(WORLDSTATE_ALGALON_SHOW, 1);
                        DoUpdateWorldState(WORLDSTATE_ALGALON_TIME, uiAlgalonCountdown);
                    }
                    else
                    {
                        if (Creature* algalon = instance->GetCreature(uiAlgalonGUID))
                            algalon->AI()->DoAction(1);
                    }
                    SaveToDB();
                    uiCountdownTimer += 1*MINUTE*IN_MILLISECONDS;
                }
                uiCountdownTimer -= diff;
            }
        }
Ejemplo n.º 23
0
void instance_oculus::SetData64(uint32 uiData, uint64 uiGuid)
{
    // If Varos already completed, just ignore
    if (GetData(TYPE_VAROS) == DONE)
        return;

    // Note: this is handled in Acid. The purpose is check which Centrifuge Construct is alive, in case of server reset
    // The function is triggered by eventAI on generic timer
    if (uiData == DATA_CONSTRUCTS_EVENT)
    {
        m_sConstructsAliveGUIDSet.insert(ObjectGuid(uiGuid));

        // Update world state in case of server reset
        if (GetData(TYPE_DRAKOS) == DONE)
            DoUpdateWorldState(WORLD_STATE_CONSTRUCTS_COUNT, m_sConstructsAliveGUIDSet.size());
    }
}
Ejemplo n.º 24
0
    void SetData(uint32 uiType, uint32 uiData)
    {
        switch(uiType)
        {
        case TYPE_DRAKOS:
            m_auiEncounter[0] = uiData;
            if(uiData == DONE)
                m_bMakeCount = true;
            break;
        case TYPE_VAROS:
            m_auiEncounter[1] = uiData;
            break;
        case TYPE_UROM:
            m_auiEncounter[2] = uiData;
            break;
        case TYPE_EREGOS:
            m_auiEncounter[3] = uiData;
            if(uiData == DONE)
            {
                DoRespawnGameObject(m_uiEregosCacheGUID);
                if(m_uiMakeCountTimer < 20*MINUTE && !instance->IsRegularDifficulty())
                    DoCompleteAchievement(ACHIEV_MAKE_IT_COUNT);
            }
            break;
        case TYPE_CENTRIFUGE_DEAD:
            m_uiCentrifugeDead += uiData;
            DoUpdateWorldState(UI_STATE_CONSTRUCT_COUNT, 10 - m_uiCentrifugeDead);
            m_bNeedSave = true;
            break;
        }

        if (uiData == DONE || m_bNeedSave)
        {
            OUT_SAVE_INST_DATA;

            std::ostringstream saveStream;
            saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_uiCentrifugeDead;

            strInstData = saveStream.str();

            SaveToDB();
            OUT_SAVE_INST_DATA_COMPLETE;
            m_bNeedSave = false;
        }
    }
void instance_culling_of_stratholme::Update(uint32 uiDiff)
{
    // 25min Run - decrease time, update worldstate every ~20s
    // as the time is always saved by m_auiEncounter[TYPE_INFINITE_CORRUPTER_TIME], there is no need for an extra timer
    if (m_auiEncounter[TYPE_INFINITE_CORRUPTER_TIME])
    {
        if (m_auiEncounter[TYPE_INFINITE_CORRUPTER_TIME] <= uiDiff)
            SetData(TYPE_INFINITE_CORRUPTER, FAIL);
        else
        {
            m_auiEncounter[TYPE_INFINITE_CORRUPTER_TIME] -= uiDiff;
            if (m_auiEncounter[TYPE_INFINITE_CORRUPTER_TIME]/IN_MILLISECONDS % 20 == 0)
                SetData(TYPE_INFINITE_CORRUPTER_TIME, m_auiEncounter[TYPE_INFINITE_CORRUPTER_TIME]);
        }

        // This part is needed for a small "hurry up guys" note, TODO, verify 20min
        if (m_auiEncounter[TYPE_INFINITE_CORRUPTER] == IN_PROGRESS && m_auiEncounter[TYPE_INFINITE_CORRUPTER_TIME] <= 24*MINUTE*IN_MILLISECONDS)
            SetData(TYPE_INFINITE_CORRUPTER, SPECIAL);
    }

    // Small Timer, to remove Grain-Crate WorldState and Spawn Second Chromie
    if (m_uiRemoveCrateStateTimer)
    {
        if (m_uiRemoveCrateStateTimer <= uiDiff)
        {
            DoUpdateWorldState(WORLD_STATE_CRATES, 0);
            DoSpawnChromieIfNeeded();
            m_uiRemoveCrateStateTimer = 0;
        }
        else
            m_uiRemoveCrateStateTimer -= uiDiff;
    }

    // Respawn Arthas after some time
    if (m_uiArthasRespawnTimer)
    {
        if (m_uiArthasRespawnTimer <= uiDiff)
        {
            DoSpawnArthasIfNeeded();
            m_uiArthasRespawnTimer = 0;
        }
        else
            m_uiArthasRespawnTimer -= uiDiff;
    }
}
        void OnPlayerEnter(Player * plr)
        {
            if (!plr || !plr->IsInWorld())
                return;

            Position pos = { 5304.132324f, 2001.124634f, 709.341431f, 3.895033f };

            if (plr->HasAura(SPELL_QUELDELARS_ZWANG) && !GetData64(DATA_QUELDELAR_PLR))
            {
                SetData64(DATA_QUELDELAR_PLR, plr->GetGUID());

                if (!instance->GetCreature(QuelDelarGUID))
                    instance->SummonCreature(NPC_QUELDELAR_TRIGGER, pos);
            }

            if (WaveCnt)
                DoUpdateWorldState(WORLD_STATE_HOR, 1);
        }
Ejemplo n.º 27
0
void instance_violet_hold::Update(uint32 uiDiff)
{
    if (!(m_auiEncounter[0] == IN_PROGRESS || m_auiEncounter[0] == SPECIAL))
        return;

    if (m_uiPortalTimer)
    {
        if (m_uiPortalTimer <= uiDiff)
        {
            DoUpdateWorldState(WORLD_STATE_PORTALS, ++m_uiWorldStatePortalCount);
            SetPortalId();
            SpawnPortal();
            m_uiPortalTimer = 0;
        }
        else
            m_uiPortalTimer -= uiDiff;
    }
}
		void UpdateEventState()
		{
			if (_encounterState > COS_PROGRESS_NOT_STARTED)
			{
				// Summon Chromie and global whisper
                instance->SummonCreature(NPC_CHROMIE_MIDDLE, EventPos[EVENT_POS_CHROMIE]);
				instance->SummonCreature(NPC_HOURGLASS, EventPos[EVENT_POS_HOURGLASS]);

				if (_encounterState == COS_PROGRESS_CRATES_FOUND ||
					_encounterState == COS_PROGRESS_START_INTRO)
				{
					ChromieWhisper(0);

					// hide crates count
					DoUpdateWorldState(WORLDSTATE_SHOW_CRATES, 0);
					_showCrateTimer = 0;
					_encounterState = COS_PROGRESS_CRATES_FOUND;
				}
			}
		}
Ejemplo n.º 29
0
void instance_oculus::OnCreatureDeath(Creature* pCreature)
{
    switch (pCreature->GetEntry())
    {
        case NPC_DRAKOS: SetData(TYPE_DRAKOS, DONE); break;
        case NPC_CENTRIFUGE_CONSTRUCT:
            m_sConstructsAliveGUIDSet.erase(pCreature->GetObjectGuid());
            DoUpdateWorldState(WORLD_STATE_CONSTRUCTS_COUNT, m_sConstructsAliveGUIDSet.size());

            if (m_sConstructsAliveGUIDSet.empty())
            {
                if (Creature* pVaros = GetSingleCreatureFromStorage(NPC_VAROS))
                {
                    pVaros->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_ALL, false);
                    pVaros->InterruptNonMeleeSpells(false);
                }
            }
            break;
    }
}
            void AddWave()
            {
                DoUpdateWorldState(WORLD_STATE_VH_WAVE_COUNT, WaveCount);

                switch (WaveCount)
                {
                    case 6:
                        if (FirstBossId == 0)
                            FirstBossId = urand(DATA_MORAGG, DATA_ZURAMAT);
                        if (Creature* sinclari = GetCreature(DATA_SINCLARI))
                        {
                            sinclari->SummonCreature(NPC_TELEPORTATION_PORTAL_INTRO, PortalIntroPositions[3], TEMPSUMMON_TIMED_DESPAWN, 3000);
                            sinclari->SummonCreature(NPC_SABOTEOUR, SaboteurSpawnLocation, TEMPSUMMON_DEAD_DESPAWN);
                        }
                        break;
                    case 12:
                        if (SecondBossId == 0)
                            do
                            {
                                SecondBossId = urand(DATA_MORAGG, DATA_ZURAMAT);
                            } while (SecondBossId == FirstBossId);
                        if (Creature* sinclari = GetCreature(DATA_SINCLARI))
                        {
                            sinclari->SummonCreature(NPC_TELEPORTATION_PORTAL_INTRO, PortalIntroPositions[3], TEMPSUMMON_TIMED_DESPAWN, 3000);
                            sinclari->SummonCreature(NPC_SABOTEOUR, SaboteurSpawnLocation, TEMPSUMMON_DEAD_DESPAWN);
                        }
                        break;
                    case 18:
                        if (Creature* sinclari = GetCreature(DATA_SINCLARI))
                        {
                            sinclari->SummonCreature(NPC_TELEPORTATION_PORTAL_INTRO, PortalIntroPositions[4], TEMPSUMMON_TIMED_DESPAWN, 6000);
                            if (Creature* cyanigosa = sinclari->SummonCreature(NPC_CYANIGOSA, CyanigosaSpawnLocation, TEMPSUMMON_DEAD_DESPAWN))
                                cyanigosa->CastSpell(cyanigosa, SPELL_CYANIGOSA_ARCANE_POWER_STATE, true);
                            ScheduleCyanigosaIntro();
                        }
                        break;
                    default:
                        SpawnPortal();
                        break;
                }
            }