void SetData(uint32 type, uint32 data)
        {
            if (type == DATA_WAVE_COUNT && data == SPECIAL)
            {
                CloseDoor(uiFrontDoor);
                events.ScheduleEvent(EVENT_NEXT_WAVE, 10000);
                return;
            }

            if (uiWaveCount && data == NOT_STARTED)
                DoWipe();

            switch(type)
            {
                case DATA_INTRO_EVENT:
                    uiIntroDone = data;
                    break;
                case DATA_FALRIC_EVENT:
                    uiEncounter[0] = data;
                    if (data == DONE)
                        events.ScheduleEvent(EVENT_NEXT_WAVE, 60000);
                    break;
                case DATA_MARWYN_EVENT:
                    uiEncounter[1] = data;
                    if (data == DONE)
                    {
                        OpenDoor(uiFrostwornDoor);
                        OpenDoor(uiFrontDoor);
                    }
                    break;
                case DATA_FROSWORN_EVENT:
                    uiEncounter[2] = data;
                    if (data == DONE)
                    {
                        OpenDoor(uiArthasDoor);
                        SetData(DATA_PHASE, 3);
                        instance->SummonCreature(BOSS_LICH_KING, OutroSpawns[0]);
                        instance->SummonCreature(NPC_JAINA_OUTRO, OutroSpawns[1]);
                    }
                    break;
                case DATA_LICHKING_EVENT:
                    uiEncounter[3] = data;
                    if(data == IN_PROGRESS)
                    {
                        OpenDoor(uiRunDoor);

                        if(instance->IsHeroic())
                            DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_NOT_RETREATING_EVENT);
                    }
                    if(data == FAIL)
                    {
                        for(uint8 i = 0; i<4; i++)
                            OpenDoor(uiWallID[i]);

                        CloseDoor(uiRunDoor);

                        if(Creature* pLichKing = instance->GetCreature(uiLichKing))
                            pLichKing->DespawnOrUnsummon(10000);
                        if(Creature* pLider = instance->GetCreature(uiLider))
                            pLider->DespawnOrUnsummon(10000);

                        DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_NOT_RETREATING_EVENT);
                        DoCastSpellOnPlayers(5); // Kill all players

                        SetData(DATA_PHASE, 3);
                        instance->SummonCreature(BOSS_LICH_KING, OutroSpawns[0]);
                        instance->SummonCreature(NPC_JAINA_OUTRO, OutroSpawns[1]);
                    }
                    if(data == DONE)
                    {
                        if(GameObject *pChest = instance->GetGameObject(uiChest))
                            pChest->SetPhaseMask(1, true);
                        if(GameObject *pPortal = instance->GetGameObject(uiPortal))
                            pPortal->SetPhaseMask(1, true);

                        /*DoCompleteAchievement(ACHIEV_HALLS_OF_REFLECTION_N);
                        if(instance->IsHeroic())
                        {
                            DoCompleteAchievement(ACHIEV_HALLS_OF_REFLECTION_H);
                            DoCastSpellOnPlayers(SPELL_ACHIEV_CHECK);
                            DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_NOT_RETREATING_EVENT);
                        }*/
                    }
                    break;
                case DATA_SUMMONS:
                    if (data == 3) uiSummons = 0;
                    else if (data == 1) ++uiSummons;
                    else if (data == 0) --uiSummons;
                    data = NOT_STARTED;
                    break;
                case DATA_ICE_WALL_1:
                    uiWall[0] = data;
                    break;
                case DATA_ICE_WALL_2:
                    uiWall[1] = data;
                    break;
                case DATA_ICE_WALL_3:
                    uiWall[2] = data;
                    break;
                case DATA_ICE_WALL_4:
                    uiWall[3] = data;
                    break;
                case DATA_PHASE:
                    uiDataPhase = data;
                    break;
            }

            if (data == DONE)
                SaveToDB();
        }
예제 #2
0
void instance_halls_of_stone::SetData(uint32 uiType, uint32 uiData)
{
    switch(uiType)
    {
        case TYPE_TRIBUNAL:
            m_auiEncounter[0] = uiData;
            switch (uiData)
            {
                case IN_PROGRESS:
                    SortFaces();
                    break;
                case DONE:
                    if (GameObject* pChest = GetSingleGameObjectFromStorage(instance->IsRegularDifficulty() ? GO_TRIBUNAL_CHEST : GO_TRIBUNAL_CHEST_H))
                    {
                        DoRespawnGameObject(instance->IsRegularDifficulty() ? GO_TRIBUNAL_CHEST : GO_TRIBUNAL_CHEST_H, 10*MINUTE);
                        pChest->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NO_INTERACT);
                    }
                    // Door workaround because of the missing Bran event
                    DoUseDoorOrButton(GO_DOOR_SJONNIR);
                    break;
                case FAIL:
                    for (uint8 i = 0; i < MAX_FACES; ++i)
                    {
                        // Shut down the faces
                        if (m_aFaces[i].m_bIsActive)
                            DoUseDoorOrButton(m_aFaces[i].m_goFaceGuid);
                        m_aFaces[i].m_bIsActive = false;
                        m_aFaces[i].m_uiTimer = 1000;
                    }
                    break;
                case SPECIAL:
                    for (uint8 i = 0; i < MAX_FACES; ++i)
                    {
                        m_aFaces[i].m_bIsActive = false;
                        m_aFaces[i].m_uiTimer = 1000;
                        // TODO - Kill NPCs
                        // TODO - Check which stay red and how long (also find out how they get red..)
                    }
                    break;
            }
            break;
        case TYPE_MAIDEN:
            m_auiEncounter[1] = uiData;
            if (uiData == IN_PROGRESS)
                DoStartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEV_START_MAIDEN_ID);
            break;
        case TYPE_KRYSTALLUS:
            m_auiEncounter[2] = uiData;
            break;
        case TYPE_SJONNIR:
            m_auiEncounter[3] = uiData;
            DoUseDoorOrButton(GO_DOOR_SJONNIR);
            break;
    }

    if (uiData == DONE)
    {
        OUT_SAVE_INST_DATA;

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

        m_strInstData = saveStream.str();

        SaveToDB();
        OUT_SAVE_INST_DATA_COMPLETE;
    }
}
예제 #3
0
void instance_naxxramas::SetData(uint32 uiType, uint32 uiData)
{
    switch(uiType)
    {
        case TYPE_ANUB_REKHAN:
            m_auiEncounter[0] = uiData;
            DoUseDoorOrButton(m_uiAnubDoorGUID);
            if (uiData == DONE)
                DoUseDoorOrButton(m_uiAnubGateGUID);
            break;
        case TYPE_FAERLINA:
            DoUseDoorOrButton(m_uiFaerWebGUID);
            if (uiData == IN_PROGRESS)
                SetSpecialAchievementCriteria(TYPE_ACHIEV_KNOCK_YOU_OUT, true);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(m_uiFaerDoorGUID);
                DoUseDoorOrButton(m_uiMaexOuterGUID);
            }
            if (uiData == FAIL)
            {
                for (GUIDList::const_iterator itr = m_lFaerlinaAddGUIDs.begin(); itr != m_lFaerlinaAddGUIDs.end(); ++itr)
                {
                    Creature* pAdd = instance->GetCreature(*itr);
                    if (pAdd && !pAdd->isAlive())
                        pAdd->Respawn();
                }
            }
            m_auiEncounter[1] = uiData;
            break;
        case TYPE_MAEXXNA:
            m_auiEncounter[2] = uiData;
            DoUseDoorOrButton(m_uiMaexInnerGUID, uiData);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(m_uiAracEyeRampGUID);
                DoRespawnGameObject(m_uiAracPortalGUID, 30*MINUTE);
                DoTaunt();
            }
            break;
        case TYPE_NOTH:
            m_auiEncounter[3] = uiData;
            DoUseDoorOrButton(m_uiNothEntryDoorGUID);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(m_uiNothExitDoorGUID);
                DoUseDoorOrButton(m_uiHeigEntryDoorGUID);
            }
            break;
        case TYPE_HEIGAN:
            m_auiEncounter[4] = uiData;
            DoUseDoorOrButton(m_uiHeigEntryDoorGUID);
            // not used, achievement handled by heigan script
            //if (uiData == IN_PROGRESS)
            //    SetSpecialAchievementCriteria(TYPE_ACHIEV_SAFETY_DANCE, true);
            if (uiData == DONE)
                DoUseDoorOrButton(m_uiHeigExitDoorGUID);
            break;
        case TYPE_LOATHEB:
            m_auiEncounter[5] = uiData;
            DoUseDoorOrButton(m_uiLoathebDoorGUID);
            if (uiData == IN_PROGRESS)
                SetSpecialAchievementCriteria(TYPE_ACHIEV_SPORE_LOSER, true);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(m_uiPlagEyeRampGUID);
                DoRespawnGameObject(m_uiPlagPortalGUID, 30*MINUTE);
                DoTaunt();
            }
            break;
        case TYPE_RAZUVIOUS:
            m_auiEncounter[6] = uiData;
            break;
        case TYPE_GOTHIK:
            switch(uiData)
            {
                case IN_PROGRESS:
                    DoUseDoorOrButton(m_uiGothikEntryDoorGUID);
                    DoUseDoorOrButton(m_uiGothCombatGateGUID);
                    break;
                case SPECIAL:
                    DoUseDoorOrButton(m_uiGothCombatGateGUID);
                    break;
                case FAIL:
                    if (m_auiEncounter[7] == IN_PROGRESS)
                        DoUseDoorOrButton(m_uiGothCombatGateGUID);

                    DoUseDoorOrButton(m_uiGothikEntryDoorGUID);
                    break;
                case DONE:
                    DoUseDoorOrButton(m_uiGothikEntryDoorGUID);
                    DoUseDoorOrButton(m_uiGothikExitDoorGUID);
                    DoUseDoorOrButton(m_uiHorsemenDoorGUID);
                    break;
            }
            m_auiEncounter[7] = uiData;
            break;
        case TYPE_FOUR_HORSEMEN:
            m_auiEncounter[8] = uiData;
            DoUseDoorOrButton(m_uiHorsemenDoorGUID);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(m_uiMiliEyeRampGUID);
                DoRespawnGameObject(m_uiMiliPortalGUID, 30*MINUTE);
                DoRespawnGameObject(m_uiHorsemenChestGUID, 30*MINUTE);
                DoTaunt();
            }
            break;
        case TYPE_PATCHWERK:
            m_auiEncounter[9] = uiData;
            if (uiData == IN_PROGRESS)
                DoStartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEV_START_PATCHWERK_ID);
            if (uiData == DONE)
                DoUseDoorOrButton(m_uiPathExitDoorGUID);
            break;
        case TYPE_GROBBULUS:
            m_auiEncounter[10] = uiData;
            break;
        case TYPE_GLUTH:
            m_auiEncounter[11] = uiData;
            if (uiData == DONE)
            {
                DoUseDoorOrButton(m_uiGlutExitDoorGUID);
                DoUseDoorOrButton(m_uiThadDoorGUID);
            }
            break;
        case TYPE_THADDIUS:
            m_auiEncounter[12] = uiData;
            if (uiData != SPECIAL)
                DoUseDoorOrButton(m_uiThadDoorGUID, uiData);
            // Uncomment when Thaddius (and this achievement is implemented)
            //if (uiData == IN_PROGRESS)
            //    SetSpecialAchievementCriteria(TYPE_ACHIEV_SHOCKING, true);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(m_uiConsEyeRampGUID);
                DoRespawnGameObject(m_uiConsPortalGUID, 30*MINUTE);
                DoTaunt();
            }
            break;
        case TYPE_SAPPHIRON:
            m_auiEncounter[13] = uiData;
            // Uncomment when achiev check implemented
            //if (uiData == IN_PROGRESS)
            //    SetSpecialAchievementCriteria(TYPE_ACHIEV_HUNDRED_CLUB, true);
            if (uiData == DONE)
                DoUseDoorOrButton(m_uiKelthuzadDoorGUID);
            break;
        case TYPE_KELTHUZAD:
            m_auiEncounter[14] = uiData;
            DoUseDoorOrButton(m_uiKelthuzadExitDoorGUID);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(m_uiKelthuzadWindow1GUID);
                DoUseDoorOrButton(m_uiKelthuzadWindow2GUID);
                DoUseDoorOrButton(m_uiKelthuzadWindow3GUID);
                DoUseDoorOrButton(m_uiKelthuzadWindow4GUID);
            }
            else if (uiData == IN_PROGRESS)
                SetSpecialAchievementCriteria(TYPE_ACHIEV_GET_ENOUGH, false);
            break;
        case TYPE_UNDYING_FAILED:
            m_auiEncounter[15] = uiData;
            break;
    }

    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_auiEncounter[5] << " "
            << m_auiEncounter[6] << " " << m_auiEncounter[7] << " " << m_auiEncounter[8] << " "
            << m_auiEncounter[9] << " " << m_auiEncounter[10] << " " << m_auiEncounter[11] << " "
            << m_auiEncounter[12] << " " << m_auiEncounter[13] << " " << m_auiEncounter[14] << " " << m_auiEncounter[15];

        strInstData = saveStream.str();

        SaveToDB();
        OUT_SAVE_INST_DATA_COMPLETE;
    }
}
예제 #4
0
        void SetData(uint32 type, uint32 data)
        {
            if (type == DATA_WIPE)
            {
                DoWipe();
                return;
            }

            if (type == DATA_WAVES_STATE && data == IN_PROGRESS)
            {
                uiWaveState = data;
                HandleGameObject(uiFrontDoor, false);
                events.CancelEvent(EVENT_NEXT_WAVE);
                events.ScheduleEvent(EVENT_NEXT_WAVE, 10000);
                return;
            }

            switch (type)
            {
                case DATA_INTRO_EVENT:
                    uiIntroDone = data;
                    break;
                case DATA_FALRIC_EVENT:
                    uiEncounter[0] = data;
                    if (data == DONE)
                    {
                        events.CancelEvent(EVENT_NEXT_WAVE);
                        events.ScheduleEvent(EVENT_NEXT_WAVE, WAVE_STD_SPAWNCYCLE);
                    }
                    break;
                case DATA_MARWYN_EVENT:
                    uiEncounter[1] = data;
                    if (data == DONE)
                    {
                        HandleGameObject(uiFrostwornDoor, true);
                        HandleGameObject(uiFrontDoor, true);
                    }
                    break;
                case DATA_FROSWORN_EVENT:
                    uiEncounter[2] = data;
                    if (data == DONE)
                    {
                        HandleGameObject(uiArthasDoor, true);
                        SetData(DATA_PHASE, 3);

                        instance->SummonCreature(NPC_LICH_KING_BOSS, OutroSpawns[0]);
                        instance->SummonCreature(uiTeamInInstance == HORDE ? NPC_SYLVANAS_PART2 : NPC_JAINA_PART2, OutroSpawns[1]);
                    }
                    break;
                case DATA_LICHKING_EVENT:
                    uiEncounter[3] = data;

                    if (data == IN_PROGRESS)
                    {
                        // Respawn all ice uiWalls on gossip select
                        for (uint8 i = 0; i<4; i++)
                            HandleGameObject(uiWallID[i], false);

                        // Open door on gossip select
                        HandleGameObject(uiRunDoor, true);
                        if (instance->IsHeroic())
                            DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_NOT_RETREATING_EVENT);
                    }

                    if (data == FAIL)
                    {
                        // Open ice uiWalls on wipe (way back for alive players)
                        for (uint8 i = 0; i<4; i++)
                            HandleGameObject(uiWallID[i], true);

                        // Open door on wipe (way back for alive players)
                        HandleGameObject(uiRunDoor, true);

                        if (Creature* pLichKing = instance->GetCreature(uiLichKingEvent))
                            pLichKing->DespawnOrUnsummon(10000);

                        if (Creature* pLeader = instance->GetCreature(uiLeader))
                            pLeader->DespawnOrUnsummon(10000);

                        DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_NOT_RETREATING_EVENT);
                        DoCastSpellOnPlayers(5); // Kill all players

                        SetData(DATA_PHASE, 3);
                        instance->SummonCreature(NPC_LICH_KING_BOSS, OutroSpawns[0]);
                        instance->SummonCreature(uiTeamInInstance == HORDE ? NPC_SYLVANAS_PART2 : NPC_JAINA_PART2, OutroSpawns[1]);
                    }

                    if (data == DONE)
                    {
                        // Open ice uiWalls on complete (way back for alive players)
                        for (uint8 i = 0; i<4; i++)
                            HandleGameObject(uiWallID[i], true);

                        // Open door on complete (way back for alive players)
                        HandleGameObject(uiRunDoor, true);

                        if (GameObject* pChest = instance->GetGameObject(uiChest))
                            pChest->SetPhaseMask(1, true);
                        if (GameObject* pPortal = instance->GetGameObject(uiPortal))
                            pPortal->SetPhaseMask(1, true);

                        if (!instance->IsHeroic())
                        {
                            DoCompleteAchievement(ACHIEV_HALLS_OF_REFLECTION_N);
                        }
                        else
                        {
                            DoCompleteAchievement(ACHIEV_HALLS_OF_REFLECTION_H);
                            DoCastSpellOnPlayers(SPELL_ACHIEV_CHECK);
                            DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_NOT_RETREATING_EVENT);
                        }

                    }
                    break;
                case DATA_ICE_WALL_1:
                    uiWall[0] = data;
                    if (data == IN_PROGRESS)
                    {
                        uiCurrentWall = 1;
                    }
                    break;
                case DATA_ICE_WALL_2:
                    uiWall[1] = data;
                    if (data == IN_PROGRESS)
                    {
                        uiCurrentWall = 2;
                    }
                    break;
                case DATA_ICE_WALL_3:
                    uiWall[2] = data;
                    if (data == IN_PROGRESS)
                    {
                        uiCurrentWall = 3;
                    }
                    break;
                case DATA_ICE_WALL_4:
                    uiWall[3] = data;
                    if (data == IN_PROGRESS)
                    {
                        uiCurrentWall = 4;
                    }
                    break;
                case DATA_PHASE:
                    uiDataPhase = data;
                    break;
                case DATA_CURRENT_WALL:
                    uiCurrentWall = data;
                    break;
                case DATA_WAVES_STATE:
                    uiWaveState = data;
                    break;
            }

            if (data == DONE)
                SaveToDB();
        }
        void SetData(uint32 type, uint32 data)
        {
            switch (type)
            {
                case DATA_WAVE_COUNT:
                    if (GetData(DATA_MARWYN_EVENT) == DONE)
                    {
                        WaveCnt = 0;
                        DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, 0);
                        DoUpdateWorldState(WORLD_STATE_HOR, WaveCnt);
                        events.CancelEvent(EVENT_NEXT_WAVE);
                        break;
                    }
                    if (data == START_WAVES) // Start der Wellen
                    {
                        CloseDoor(FrontDoorGUID);
                        events.ScheduleEvent(EVENT_NEXT_WAVE, 0);
                        break;
                    }
                    if (data == START_NEXT_WAVE_INSTANT) // Nächste Welle sofort
                    {
                        events.RescheduleEvent(EVENT_NEXT_WAVE, 0);
                        break;
                    }
                    if (data == START_NEXT_WAVE) // Nächste Welle starten
                    {
                        events.RescheduleEvent(EVENT_NEXT_WAVE, 60 * IN_MILLISECONDS);
                        break;
                    }
                    if (WaveCnt && data == START_RESET) // Wipe
                    {
                        DoWipe();
                        break;
                    }
                    break;
                case DATA_INTRO_EVENT:
                    IntroDone = data;
                    break;
                case DATA_FALRIC_EVENT:
                    Encounter[0] = data;
                    if (data == DONE)
                        events.RescheduleEvent(EVENT_NEXT_WAVE, 60 * IN_MILLISECONDS);
                    break;
                case DATA_MARWYN_EVENT:
                    Encounter[1] = data;
                    if (data == DONE)
                    {
                        DoUpdateWorldState(WORLD_STATE_HOR, 0);
                        OpenDoor(FrostwornDoorGUID);
                        OpenDoor(FrontDoorGUID);
                    }
                    break;
                case DATA_FROSWORN_EVENT:
                    Encounter[2] = data;
                    if (data == DONE)
                    {
                        OpenDoor(ArthasDoorGUID);
                        SetData(DATA_PHASE, 3);
                        instance->SummonCreature(BOSS_LICH_KING, OutroSpawns[0]);
                        instance->SummonCreature(NPC_JAINA_OUTRO, OutroSpawns[1]);
                    }
                    break;
                case DATA_LICHKING_EVENT:
                    Encounter[3] = data;
                    switch(data)
                    {
                        case IN_PROGRESS:
                            OpenDoor(RunDoorGUID);
                            if (instance->IsHeroic())
                                DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_NOT_RETREATING_EVENT);
                            break;
                        case FAIL:
                            for (uint8 i=0; i<4; ++i)
                                OpenDoor(WallGUID[i]);

                            CloseDoor(RunDoorGUID);

                            if (Creature* LichKing = instance->GetCreature(LichKingGUID))
                                LichKing->DespawnOrUnsummon(10000);
                            if (Creature* Leader = instance->GetCreature(LeaderGUID))
                                Leader->DespawnOrUnsummon(10000);

                            DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_NOT_RETREATING_EVENT);
                            DoCastSpellOnPlayers(SPELL_SUICIDE); // Alle Spieler begehen Selbsmord!

                            SetData(DATA_PHASE, 3);
                            instance->SummonCreature(BOSS_LICH_KING, OutroSpawns[0]);
                            instance->SummonCreature(NPC_JAINA_OUTRO, OutroSpawns[1]);
                            break;
                        case DONE:
                            if (GameObject* Chest = instance->GetGameObject(ChestGUID))
                                Chest->SetPhaseMask(1, true);
                            if (GameObject* Portal = instance->GetGameObject(PortalGUID))
                                Portal->SetPhaseMask(1, true);

                            DoCompleteAchievement(ACHIEV_HALLS_OF_REFLECTION_N);

                            if (instance->IsHeroic())
                            {
                                DoCompleteAchievement(ACHIEV_HALLS_OF_REFLECTION_H);
                                DoCastSpellOnPlayers(SPELL_ACHIEV_CHECK);
                                DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_NOT_RETREATING_EVENT);
                            }
                            break;
                    }
                    break;
                case DATA_SUMMONS:
                    if (data == 3)
                        Summons = 0;
                    else if (data == 1)
                        ++Summons;
                    else if (data == 0)
                        --Summons;
                    data = NOT_STARTED;
                    break;
                case DATA_ICE_WALL_1:
                    WallData[0] = data;
                    break;
                case DATA_ICE_WALL_2:
                    WallData[1] = data;
                    break;
                case DATA_ICE_WALL_3:
                    WallData[2] = data;
                    break;
                case DATA_ICE_WALL_4:
                    WallData[3] = data;
                    break;
                case DATA_PHASE:
                    PhaseData = data;
                    break;
            }

            if (data == DONE)
                SaveToDB();
        }
void instance_pinnacle::SetData(uint32 uiType, uint32 uiData)
{
    switch (uiType)
    {
        case TYPE_SVALA:
            if (uiData == IN_PROGRESS || uiData == FAIL)
                SetSpecialAchievementCriteria(TYPE_ACHIEV_INCREDIBLE_HULK, false);
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_GORTOK:
            if (uiData == IN_PROGRESS)
            {
                if (Creature* pOrb = instance->GetCreature(m_gortokEventTriggerGuid))
                {
                    pOrb->SetLevitate(true);
                    pOrb->CastSpell(pOrb, SPELL_ORB_VISUAL, TRIGGERED_OLD_TRIGGERED);
                    pOrb->GetMotionMaster()->MovePoint(0, aOrbPositions[0][0], aOrbPositions[0][1], aOrbPositions[0][2]);

                    m_uiGortokOrbTimer = 2000;
                }
            }
            else if (uiData == FAIL)
            {
                if (Creature* pOrb = instance->GetCreature(m_gortokEventTriggerGuid))
                {
                    if (!pOrb->isAlive())
                        pOrb->Respawn();
                    else
                        pOrb->RemoveAllAuras();

                    // For some reasone the Orb doesn't evade automatically
                    pOrb->GetMotionMaster()->MoveTargetedHome();
                }

                for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
                {
                    // Reset each miniboss
                    if (Creature* pTemp = GetSingleCreatureFromStorage(aGortokMiniBosses[i]))
                    {
                        if (!pTemp->isAlive())
                            pTemp->Respawn();

                        pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                    }
                }

                m_uiGortokOrbPhase = 0;
            }
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_SKADI:
            // Don't process the event twice
            if (m_auiEncounter[uiType] == uiData)
                return;
            switch (uiData)
            {
                case DONE:
                    DoUseDoorOrButton(GO_DOOR_SKADI);
                    break;
                case SPECIAL:
                    // Prepare achievements
                    SetSpecialAchievementCriteria(TYPE_ACHIEV_LOVE_SKADI, true);
                    DoStartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEV_START_SKADI_ID);

                    m_auiEncounter[uiType] = uiData;
                    return;
                case FAIL:
                    // Handle Grauf evade - if event is in phase 1
                    if (Creature* pGrauf = GetSingleCreatureFromStorage(NPC_GRAUF))
                        pGrauf->AI()->EnterEvadeMode();

                    // no break;
                case NOT_STARTED:
                    // Despawn all summons
                    for (GuidList::const_iterator itr = m_lskadiGauntletMobsList.begin(); itr != m_lskadiGauntletMobsList.end(); ++itr)
                    {
                        if (Creature* pYmirjar = instance->GetCreature(*itr))
                            pYmirjar->ForcedDespawn();
                    }

                    // Reset position
                    if (Creature* pGrauf = GetSingleCreatureFromStorage(NPC_GRAUF))
                        pGrauf->GetMotionMaster()->MoveTargetedHome();

                    // no break;
                case IN_PROGRESS:

                    // Remove the summon aura on phase 2 or fail
                    if (Creature* pTrigger = instance->GetCreature(m_skadiMobsTriggerGuid))
                        pTrigger->RemoveAllAuras();
                    break;
            }
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_YMIRON:
            if (uiData == DONE)
                DoUseDoorOrButton(GO_DOOR_YMIRON);
            else if (uiData == IN_PROGRESS)
                SetSpecialAchievementCriteria(TYPE_ACHIEV_KINGS_BANE, true);
            else if (uiData == SPECIAL)
                SetSpecialAchievementCriteria(TYPE_ACHIEV_KINGS_BANE, false);
            m_auiEncounter[uiType] = uiData;
            break;
        default:
            script_error_log("Instance Pinnacle: SetData = %u for type %u does not exist/not implemented.", uiType, uiData);
            return;
    }

    // Saving also SPECIAL for this instance
    if (uiData == DONE || uiData == SPECIAL)
    {
        OUT_SAVE_INST_DATA;

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

        m_strInstData = saveStream.str();

        SaveToDB();
        OUT_SAVE_INST_DATA_COMPLETE;
    }
}
void instance_pinnacle::SetData(uint32 uiType, uint32 uiData)
{
    switch (uiType)
    {
        case TYPE_SVALA:
            if (uiData == IN_PROGRESS || uiData == FAIL)
                SetSpecialAchievementCriteria(TYPE_ACHIEV_INCREDIBLE_HULK, false);
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_GORTOK:
            if (uiData == IN_PROGRESS)
            {
                if (Creature* pOrb = instance->GetCreature(m_gortokEventTriggerGuid))
                {
                    pOrb->SetLevitate(true);
                    pOrb->CastSpell(pOrb, SPELL_ORB_VISUAL, true);
                    pOrb->GetMotionMaster()->MovePoint(0, aOrbPositions[0][0], aOrbPositions[0][1], aOrbPositions[0][2]);

                    m_uiGortokOrbTimer = 2000;
                }
            }
            if (uiData == FAIL)
            {
                if (Creature* pOrb = instance->GetCreature(m_gortokEventTriggerGuid))
                {
                    if (!pOrb->isAlive())
                        pOrb->Respawn();
                    else
                        pOrb->RemoveAllAuras();

                    // For some reasone the Orb doesn't evade automatically
                    pOrb->GetMotionMaster()->MoveTargetedHome();
                }

                for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
                {
                    // Reset each miniboss
                    if (Creature* pTemp = GetSingleCreatureFromStorage(aGortokMiniBosses[i]))
                    {
                        if (!pTemp->isAlive())
                            pTemp->Respawn();

                        pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                    }
                }

                m_uiGortokOrbPhase = 0;
            }
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_SKADI:
            if (uiData == IN_PROGRESS)
            {
                DoStartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEV_START_SKADI_ID);
            }
            if (uiData == DONE)
                DoUseDoorOrButton(GO_DOOR_SKADI);

            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_YMIRON:
            if (uiData == DONE)
                DoUseDoorOrButton(GO_DOOR_YMIRON);
            if (uiData == IN_PROGRESS)
                SetSpecialAchievementCriteria(TYPE_ACHIEV_KINGS_BANE, true);
            if (uiData == SPECIAL)
                SetSpecialAchievementCriteria(TYPE_ACHIEV_KINGS_BANE, false);
            m_auiEncounter[uiType] = uiData;
            break;
        default:
            script_error_log("Instance Pinnacle: SetData = %u for type %u does not exist/not implemented.", uiType, uiData);
            return;
    }

    // Saving also SPECIAL for this instance
    if (uiData == DONE || uiData == SPECIAL)
    {
        OUT_SAVE_INST_DATA;

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

        m_strInstData = saveStream.str();

        SaveToDB();
        OUT_SAVE_INST_DATA_COMPLETE;
    }
}
void instance_halls_of_stone::SetData(uint32 uiType, uint32 uiData)
{
    switch (uiType)
    {
        case TYPE_TRIBUNAL:
            m_auiEncounter[uiType] = uiData;
            switch (uiData)
            {
                case IN_PROGRESS:
                    SortFaces();
                    break;
                case DONE:
                    // Cast achiev check spell - Note: it's not clear who casts this spell, but for the moment we'll use Abedneum
                    if (Creature* pEye = instance->GetCreature(m_aFaces[1].m_leftEyeGuid))
                        pEye->CastSpell(pEye, SPELL_ACHIEVEMENT_CHECK, true);
                    // Spawn the loot
                    DoRespawnGameObject(instance->IsRegularDifficulty() ? GO_TRIBUNAL_CHEST : GO_TRIBUNAL_CHEST_H, 30 * MINUTE);
                    DoToggleGameObjectFlags(instance->IsRegularDifficulty() ? GO_TRIBUNAL_CHEST : GO_TRIBUNAL_CHEST_H, GO_FLAG_NO_INTERACT, false);
                    // Door workaround because of the missing Bran event
                    DoUseDoorOrButton(GO_DOOR_SJONNIR);
                    break;
                case FAIL:
                    for (uint8 i = 0; i < MAX_FACES; ++i)
                    {
                        // Shut down the faces
                        if (m_aFaces[i].m_bIsActive)
                            DoUseDoorOrButton(m_aFaces[i].m_goFaceGuid);
                        m_aFaces[i].m_bIsActive = false;
                        m_aFaces[i].m_uiTimer = 1000;
                    }
                    break;
                case SPECIAL:
                    for (uint8 i = 0; i < MAX_FACES; ++i)
                    {
                        m_aFaces[i].m_bIsActive = false;
                        m_aFaces[i].m_uiTimer = 1000;
                        // TODO - Check which stay red and how long (also find out how they get red..)

                        // Cleanup when finished
                        if (Creature* pEye = instance->GetCreature(m_aFaces[i].m_leftEyeGuid))
                            pEye->CastSpell(pEye, SPELL_KILL_TRIBUNAL_ADD, true);
                        if (Creature* pEye = instance->GetCreature(m_aFaces[i].m_rightEyeGuid))
                            pEye->CastSpell(pEye, SPELL_KILL_TRIBUNAL_ADD, true);
                    }
                    break;
            }
            break;
        case TYPE_MAIDEN:
            m_auiEncounter[uiType] = uiData;
            if (uiData == IN_PROGRESS)
                DoStartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEV_START_MAIDEN_ID);
            break;
        case TYPE_KRYSTALLUS:
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_SJONNIR:
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_DOOR_SJONNIR);
            if (uiData == IN_PROGRESS)
                m_uiIronSludgeKilled = 0;
            break;
    }

    if (uiData == DONE)
    {
        OUT_SAVE_INST_DATA;

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

        m_strInstData = saveStream.str();

        SaveToDB();
        OUT_SAVE_INST_DATA_COMPLETE;
    }
}
예제 #9
0
		void SetData(uint32 type, uint32 data)
		{
			switch( type )
			{
				case DATA_DRAKOS:
					m_auiEncounter[DATA_DRAKOS] = data;
					if( data == DONE )
					{
						DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 1);
						DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, 10-CentrifugeCount);

						if (instance->IsHeroic())
							DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_MAKE_IT_COUNT_TIMED_EVENT);
					}
					break;
				case DATA_VAROS:
					m_auiEncounter[DATA_VAROS] = data;
					if( data == DONE )
					{
						DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 0);

						if( Creature* urom = instance->GetCreature(uiUromGUID) )
							urom->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
					}
					break;
				case DATA_UROM:
					m_auiEncounter[DATA_UROM] = data;
					if( data == DONE )
						if( Creature* eregos = instance->GetCreature(uiEregosGUID) )
							eregos->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
					break;
				case DATA_EREGOS:
					m_auiEncounter[DATA_EREGOS] = data;
					if (data == DONE)
						DoRespawnGameObject(EregosCacheGUID, 7*DAY);
					break;
				case DATA_CC_COUNT:
					if( CentrifugeCount < 10 )
					{
						++CentrifugeCount;
						DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, 10-CentrifugeCount);
					}
					if( CentrifugeCount >= 10 )
						if( Creature* varos = instance->GetCreature(uiVarosGUID) )
						{
							varos->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
							varos->InterruptNonMeleeSpells(false);
							varos->RemoveAura(50053);
						}
					break;
				case DATA_AMBER_VOID:
					bAmberVoid = data ? true : false;
					break;
				case DATA_EMERALD_VOID:
					bEmeraldVoid = data ? true : false;
					break;
				case DATA_RUBY_VOID:
					bRubyVoid = data ? true : false;
					break;
			}

			if( data == DONE )
				SaveToDB();
		}
예제 #10
0
void instance_naxxramas::SetData(uint32 uiType, uint32 uiData)
{
    switch (uiType)
    {
        case TYPE_ANUB_REKHAN:
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_ARAC_ANUB_DOOR);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_ARAC_ANUB_GATE);
                DoStartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEV_START_MAEXXNA_ID);
            }
            break;
        case TYPE_FAERLINA:
            DoUseDoorOrButton(GO_ARAC_FAER_WEB);
            if (uiData == IN_PROGRESS)
                SetSpecialAchievementCriteria(TYPE_ACHIEV_KNOCK_YOU_OUT, true);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_ARAC_FAER_DOOR);
                DoUseDoorOrButton(GO_ARAC_MAEX_OUTER_DOOR);
            }
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_MAEXXNA:
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_ARAC_MAEX_INNER_DOOR, uiData);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_ARAC_EYE_RAMP);
                DoUseDoorOrButton(GO_ARAC_EYE_BOSS);
                DoRespawnGameObject(GO_ARAC_PORTAL, 30 * MINUTE);
                DoToggleGameObjectFlags(GO_ARAC_PORTAL, GO_FLAG_NO_INTERACT, false);
                m_uiTauntTimer = 5000;
            }
            break;
        case TYPE_NOTH:
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_PLAG_NOTH_ENTRY_DOOR);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_PLAG_NOTH_EXIT_DOOR);
                DoUseDoorOrButton(GO_PLAG_HEIG_ENTRY_DOOR);
            }
            break;
        case TYPE_HEIGAN:
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_PLAG_HEIG_ENTRY_DOOR);
            if (uiData == IN_PROGRESS)
                SetSpecialAchievementCriteria(TYPE_ACHIEV_SAFETY_DANCE, true);
            if (uiData == DONE)
                DoUseDoorOrButton(GO_PLAG_HEIG_EXIT_DOOR);
            break;
        case TYPE_LOATHEB:
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_PLAG_LOAT_DOOR);
            if (uiData == IN_PROGRESS)
                SetSpecialAchievementCriteria(TYPE_ACHIEV_SPORE_LOSER, true);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_PLAG_EYE_RAMP);
                DoUseDoorOrButton(GO_PLAG_EYE_BOSS);
                DoRespawnGameObject(GO_PLAG_PORTAL, 30 * MINUTE);
                DoToggleGameObjectFlags(GO_PLAG_PORTAL, GO_FLAG_NO_INTERACT, false);
                m_uiTauntTimer = 5000;
            }
            break;
        case TYPE_RAZUVIOUS:
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_GOTHIK:
            switch (uiData)
            {
                case IN_PROGRESS:
                    DoUseDoorOrButton(GO_MILI_GOTH_ENTRY_GATE);
                    DoUseDoorOrButton(GO_MILI_GOTH_COMBAT_GATE);
                    break;
                case SPECIAL:
                    DoUseDoorOrButton(GO_MILI_GOTH_COMBAT_GATE);
                    break;
                case FAIL:
                    if (m_auiEncounter[uiType] == IN_PROGRESS)
                        DoUseDoorOrButton(GO_MILI_GOTH_COMBAT_GATE);

                    DoUseDoorOrButton(GO_MILI_GOTH_ENTRY_GATE);
                    break;
                case DONE:
                    DoUseDoorOrButton(GO_MILI_GOTH_ENTRY_GATE);
                    DoUseDoorOrButton(GO_MILI_GOTH_EXIT_GATE);
                    DoUseDoorOrButton(GO_MILI_HORSEMEN_DOOR);

                    m_dialogueHelper.StartNextDialogueText(NPC_THANE);
                    break;
            }
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_FOUR_HORSEMEN:
            // Skip if already set
            if (m_auiEncounter[uiType] == uiData)
                return;
            if (uiData == SPECIAL)
            {
                ++m_uiHorseMenKilled;

                if (m_uiHorseMenKilled == 4)
                    SetData(TYPE_FOUR_HORSEMEN, DONE);

                // Don't store special data
                break;
            }
            if (uiData == FAIL)
                m_uiHorseMenKilled = 0;
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_MILI_HORSEMEN_DOOR);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_MILI_EYE_RAMP);
                DoUseDoorOrButton(GO_MILI_EYE_BOSS);
                DoRespawnGameObject(GO_MILI_PORTAL, 30 * MINUTE);
                DoToggleGameObjectFlags(GO_MILI_PORTAL, GO_FLAG_NO_INTERACT, false);
                DoRespawnGameObject(instance->IsRegularDifficulty() ? GO_CHEST_HORSEMEN_NORM : GO_CHEST_HORSEMEN_HERO, 30 * MINUTE);
                m_uiTauntTimer = 5000;
            }
            break;
        case TYPE_PATCHWERK:
            m_auiEncounter[uiType] = uiData;
            if (uiData == IN_PROGRESS)
                DoStartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEV_START_PATCHWERK_ID);
            if (uiData == DONE)
                DoUseDoorOrButton(GO_CONS_PATH_EXIT_DOOR);
            break;
        case TYPE_GROBBULUS:
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_GLUTH:
            m_auiEncounter[uiType] = uiData;
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_CONS_GLUT_EXIT_DOOR);
                DoUseDoorOrButton(GO_CONS_THAD_DOOR);
            }
            break;
        case TYPE_THADDIUS:
            // Only process real changes here
            if (m_auiEncounter[uiType] == uiData)
                return;

            m_auiEncounter[uiType] = uiData;
            if (uiData != SPECIAL)
                DoUseDoorOrButton(GO_CONS_THAD_DOOR, uiData);
            // Uncomment when this achievement is implemented
            // if (uiData == IN_PROGRESS)
            //    SetSpecialAchievementCriteria(TYPE_ACHIEV_SHOCKING, true);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_CONS_EYE_RAMP);
                DoUseDoorOrButton(GO_CONS_EYE_BOSS);
                DoRespawnGameObject(GO_CONS_PORTAL, 30 * MINUTE);
                DoToggleGameObjectFlags(GO_CONS_PORTAL, GO_FLAG_NO_INTERACT, false);
                m_uiTauntTimer = 5000;
            }
            break;
        case TYPE_SAPPHIRON:
            m_auiEncounter[uiType] = uiData;
            // Uncomment when achiev check implemented
            // if (uiData == IN_PROGRESS)
            //    SetSpecialAchievementCriteria(TYPE_ACHIEV_HUNDRED_CLUB, true);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_KELTHUZAD_WATERFALL_DOOR);
                m_dialogueHelper.StartNextDialogueText(NPC_KELTHUZAD);
            }
            break;
        case TYPE_KELTHUZAD:
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_KELTHUZAD_EXIT_DOOR);
            if (uiData == IN_PROGRESS)
                SetSpecialAchievementCriteria(TYPE_ACHIEV_GET_ENOUGH, false);
            break;
        case TYPE_UNDYING_FAILED:
            m_auiEncounter[uiType] = uiData;
            break;
    }

    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_auiEncounter[5] << " "
                   << m_auiEncounter[6] << " " << m_auiEncounter[7] << " " << m_auiEncounter[8] << " "
                   << m_auiEncounter[9] << " " << m_auiEncounter[10] << " " << m_auiEncounter[11] << " "
                   << m_auiEncounter[12] << " " << m_auiEncounter[13] << " " << m_auiEncounter[14] << " " << m_auiEncounter[15];

        m_strInstData = saveStream.str();

        SaveToDB();
        OUT_SAVE_INST_DATA_COMPLETE;
    }
}
예제 #11
0
void instance_naxxramas::SetData(uint32 uiType, uint32 uiData)
{
    switch(uiType)
    {
        case TYPE_ANUB_REKHAN:
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_ARAC_ANUB_DOOR);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_ARAC_ANUB_GATE);
                DoStartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEV_START_MAEXXNA_ID);
            }
            break;
        case TYPE_FAERLINA:
            DoUseDoorOrButton(GO_ARAC_FAER_WEB);
            if (uiData == IN_PROGRESS)
            {
                if (Creature* pFaerlina = GetSingleCreatureFromStorage(NPC_FAERLINA))
                    if (Unit* pVictim = pFaerlina->getVictim())
                        for (GUIDList::const_iterator itr = m_lFaerlinaAddGUIDs.begin(); itr != m_lFaerlinaAddGUIDs.end(); ++itr)
                            if (Creature* pFaerlenaAdd = instance->GetCreature(*itr))
                                pFaerlenaAdd->AI()->AttackStart(pVictim);
                SetSpecialAchievementCriteria(TYPE_ACHIEV_KNOCK_YOU_OUT, true);
            }
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_ARAC_FAER_DOOR);
                DoUseDoorOrButton(GO_ARAC_MAEX_OUTER_DOOR);
            }
            if (uiData == FAIL)
            {
                for (GUIDList::const_iterator itr = m_lFaerlinaAddGUIDs.begin(); itr != m_lFaerlinaAddGUIDs.end(); ++itr)
                {
                    Creature* pAdd = instance->GetCreature(*itr);
                    if (pAdd && !pAdd->isAlive())
                        pAdd->Respawn();
                }
            }
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_MAEXXNA:
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_ARAC_MAEX_INNER_DOOR, uiData);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_ARAC_EYE_RAMP);
                DoRespawnGameObject(GO_ARAC_PORTAL, 30*MINUTE);
                m_uiTauntTimer = 5000;
            }
            break;
        case TYPE_NOTH:
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_PLAG_NOTH_ENTRY_DOOR);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_PLAG_NOTH_EXIT_DOOR);
                DoUseDoorOrButton(GO_PLAG_HEIG_ENTRY_DOOR);
            }
            break;
        case TYPE_HEIGAN:
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_PLAG_HEIG_ENTRY_DOOR);
            // uncomment when eruption is implemented
            //if (uiData == IN_PROGRESS)
            //    SetSpecialAchievementCriteria(TYPE_ACHIEV_SAFETY_DANCE, true);
            if (uiData == DONE)
                DoUseDoorOrButton(GO_PLAG_HEIG_EXIT_DOOR);
            break;
        case TYPE_LOATHEB:
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_PLAG_LOAT_DOOR);
            if (uiData == IN_PROGRESS)
                SetSpecialAchievementCriteria(TYPE_ACHIEV_SPORE_LOSER, true);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_PLAG_EYE_RAMP);
                DoRespawnGameObject(GO_PLAG_PORTAL, 30*MINUTE);
                m_uiTauntTimer = 5000;
            }
            break;
        case TYPE_RAZUVIOUS:
            switch(uiData)
            {
                case IN_PROGRESS:
                {
                    if (Creature* pRazuvious = GetSingleCreatureFromStorage(NPC_RAZUVIOUS))
                        if (Unit* pVictim = pRazuvious->getVictim())
                            for (GUIDList::iterator itr = m_lRazuUnderstudyGUIDs.begin(); itr != m_lRazuUnderstudyGUIDs.end(); ++itr)
                                if (Creature* pUnderstudy = instance->GetCreature(*itr))
                                    pUnderstudy->AI()->AttackStart(pVictim);
                    break;
                }
                case FAIL:
                {
                    for (GUIDList::iterator itr = m_lRazuUnderstudyGUIDs.begin(); itr != m_lRazuUnderstudyGUIDs.end(); ++itr)
                        if (Creature* pUnderstudy = instance->GetCreature(*itr))
                            if (!pUnderstudy->isAlive())
                                pUnderstudy->Respawn();
                    break;
                }
                default: break;
            }
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_GOTHIK:
            switch(uiData)
            {
                case IN_PROGRESS:
                    DoUseDoorOrButton(GO_MILI_GOTH_ENTRY_GATE);
                    DoUseDoorOrButton(GO_MILI_GOTH_COMBAT_GATE);
                    break;
                case SPECIAL:
                    DoUseDoorOrButton(GO_MILI_GOTH_COMBAT_GATE);
                    break;
                case FAIL:
                    if (m_auiEncounter[uiType] == IN_PROGRESS)
                        DoUseDoorOrButton(GO_MILI_GOTH_COMBAT_GATE);

                    DoUseDoorOrButton(GO_MILI_GOTH_ENTRY_GATE);
                    break;
                case DONE:
                    DoUseDoorOrButton(GO_MILI_GOTH_ENTRY_GATE);
                    DoUseDoorOrButton(GO_MILI_GOTH_EXIT_GATE);
                    DoUseDoorOrButton(GO_MILI_HORSEMEN_DOOR);
                    break;
            }
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_FOUR_HORSEMEN:
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_MILI_HORSEMEN_DOOR);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_MILI_EYE_RAMP);
                DoRespawnGameObject(GO_MILI_PORTAL, 30*MINUTE);
                DoRespawnGameObject(instance->IsRegularDifficulty() ? GO_CHEST_HORSEMEN_NORM : GO_CHEST_HORSEMEN_HERO, 30*MINUTE);
                m_uiTauntTimer = 5000;
            }
            break;
        case TYPE_PATCHWERK:
            m_auiEncounter[uiType] = uiData;
            if (uiData == IN_PROGRESS)
            {
                DoStartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEV_START_PATCHWERK_ID);
                // call all creatures in area
                if (Creature* pPatchwerk = GetSingleCreatureFromStorage(NPC_PATCHWERK))
                    if (Unit* pVictim = pPatchwerk->getVictim())
                        for (GUIDList::iterator itr = m_lPatchwerkAddGUIDs.begin(); itr != m_lPatchwerkAddGUIDs.end(); ++itr)
                            if (Creature* pPatchwerkAdd = instance->GetCreature(*itr))
                                pPatchwerkAdd->AI()->AttackStart(pVictim);
            }
            if (uiData == DONE)
                DoUseDoorOrButton(GO_CONS_PATH_EXIT_DOOR);
            break;
        case TYPE_GROBBULUS:
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_GLUTH:
            m_auiEncounter[uiType] = uiData;
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_CONS_GLUT_EXIT_DOOR);
                DoUseDoorOrButton(GO_CONS_THAD_DOOR);
            }
            break;
        case TYPE_THADDIUS:
            // Only process real changes here
            if (m_auiEncounter[uiType] == uiData)
                return;

            m_auiEncounter[uiType] = uiData;
            if (uiData != SPECIAL)
                DoUseDoorOrButton(GO_CONS_THAD_DOOR, uiData);
            // Uncomment when this achievement is implemented
            //if (uiData == IN_PROGRESS)
            //    SetSpecialAchievementCriteria(TYPE_ACHIEV_SHOCKING, true);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_CONS_EYE_RAMP);
                DoRespawnGameObject(GO_CONS_PORTAL, 30*MINUTE);
                m_uiTauntTimer = 5000;
            }
            break;
        case TYPE_SAPPHIRON:
            m_auiEncounter[uiType] = uiData;
            // Uncomment when achiev check implemented
            //if (uiData == IN_PROGRESS)
            //    SetSpecialAchievementCriteria(TYPE_ACHIEV_HUNDRED_CLUB, true);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_KELTHUZAD_WATERFALL_DOOR);
                m_dialogueHelper.StartNextDialogueText(SAY_SAPP_DIALOG1);
            }
            break;
        case TYPE_KELTHUZAD:
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_KELTHUZAD_EXIT_DOOR);
            if (uiData == IN_PROGRESS)
                SetSpecialAchievementCriteria(TYPE_ACHIEV_GET_ENOUGH, false);
            break;
        case TYPE_UNDYING_FAILED:
            m_auiEncounter[uiType] = uiData;
            break;
    }

    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_auiEncounter[5] << " "
            << m_auiEncounter[6] << " " << m_auiEncounter[7] << " " << m_auiEncounter[8] << " "
            << m_auiEncounter[9] << " " << m_auiEncounter[10] << " " << m_auiEncounter[11] << " "
            << m_auiEncounter[12] << " " << m_auiEncounter[13] << " " << m_auiEncounter[14] << " " << m_auiEncounter[15];

        m_strInstData = saveStream.str();

        SaveToDB();
        OUT_SAVE_INST_DATA_COMPLETE;
    }
}
예제 #12
0
void instance_ulduar::SetData(uint32 uiType, uint32 uiData)
{
    switch(uiType)
    {
        case TYPE_LEVIATHAN:
            if (uiData == IN_PROGRESS)
                CloseDoor(GO_SHIELD_WALL);
            else
                OpenDoor(GO_SHIELD_WALL);
            if (uiData == SPECIAL)
            {
                if (GameObject* pGo = GetSingleGameObjectFromStorage(GO_LEVIATHAN_GATE))
                    pGo->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
            }
            break;
        case TYPE_IGNIS:
            if (uiData == IN_PROGRESS)
            {
                SetSpecialAchievementCriteria(TYPE_ACHIEV_SHATTERED, false);
                DoStartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEV_START_IGNIS_ID);
            }
            // Add respawn and kill
            if (uiData == FAIL)
            {
                for (GuidList::iterator itr = m_lIronConstructsGuids.begin(); itr != m_lIronConstructsGuids.end(); ++itr)
                {
                    if (Creature* pAdd = instance->GetCreature(*itr))
                        if (!pAdd->isAlive())
                            pAdd->Respawn();
                }
            }
            if (uiData == DONE)
            {
                for (GuidList::iterator itr = m_lIronConstructsGuids.begin(); itr != m_lIronConstructsGuids.end(); ++itr)
                {
                    if (Creature* pAdd = instance->GetCreature(*itr))
                        if (pAdd->isAlive())
                            pAdd->DealDamage(pAdd, pAdd->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NONE, NULL, false);
                }
            }
            break;
        case TYPE_RAZORSCALE:
            if (uiData == IN_PROGRESS)
            {
                SetSpecialAchievementCriteria(TYPE_ACHIEV_QUICK_SHAVE, true);
                SetSpecialAchievementCriteria(TYPE_ACHIEV_IRON_DWARF_MEDIUM_RARE, false);
            }
            break;
        case TYPE_XT002:
            if (uiData == DONE || uiData == FAIL)
                OpenDoor(GO_XT002_GATE);
            else if (uiData == IN_PROGRESS)
            {
                CloseDoor(GO_XT002_GATE);
                SetSpecialAchievementCriteria(TYPE_ACHIEV_NERF_ENGINEERING, true);
                SetSpecialAchievementCriteria(TYPE_ACHIEV_HEARTBREAKER, false);
                DoStartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEV_START_XT_002_ID);
            }
            break;
        case TYPE_ASSEMBLY:
            if (uiData == DONE)
            {
                OpenDoor(GO_IRON_ENTRANCE_DOOR);
                OpenDoor(GO_ARCHIVUM_DOOR);
                OpenDoor(GO_SHATTERED_DOOR);
            }
            else if (uiData == IN_PROGRESS)
            {
                SetSpecialAchievementCriteria(TYPE_ACHIEV_YOU_BRUNDIR, true);
                SetSpecialAchievementCriteria(TYPE_ACHIEV_YOU_MOLGEIM, true);
                SetSpecialAchievementCriteria(TYPE_ACHIEV_YOU_STEELBREAKER, true);
                CloseDoor(GO_IRON_ENTRANCE_DOOR);
            }
            else if (uiData == FAIL)
            {
                if (Creature* pBrundir = GetSingleCreatureFromStorage(NPC_BRUNDIR))
                {
                    if (!pBrundir->isAlive())
                        pBrundir->Respawn();
                }
                if (Creature* pMolgeim = GetSingleCreatureFromStorage(NPC_MOLGEIM))
                {
                    if (!pMolgeim->isAlive())
                        pMolgeim->Respawn();
                }
                if (Creature* pSteelbreaker = GetSingleCreatureFromStorage(NPC_STEELBREAKER))
                {
                    if (!pSteelbreaker->isAlive())
                        pSteelbreaker->Respawn();
                }
                OpenDoor(GO_IRON_ENTRANCE_DOOR);
            }
            break;
        case TYPE_KOLOGARN:
            if (uiData == DONE)
            {
                if (instance->IsRegularDifficulty())
                {
                    DoRespawnGameObject(GO_CACHE_OF_LIVING_STONE, 30*MINUTE);
                }
                else
                {
                    DoRespawnGameObject(GO_CACHE_OF_LIVING_STONE_H, 30*MINUTE);
                }
                if (GameObject* pGo = GetSingleGameObjectFromStorage(GO_KOLOGARN_BRIDGE))
                {
                    pGo->SetUInt32Value(GAMEOBJECT_LEVEL, 0);
                    pGo->SetGoState(GO_STATE_READY);
                }
            }
            if (uiData == IN_PROGRESS)
            {
                SetSpecialAchievementCriteria(TYPE_ACHIEV_DISARMED, false);
                SetSpecialAchievementCriteria(TYPE_ACHIEV_OPEN_ARMS, true);
                SetSpecialAchievementCriteria(TYPE_ACHIEV_RUBBLE_AND_ROLL, false);
            }
            break;
        case TYPE_AURIAYA:
            if (uiData == DONE)
            {
                if (GameObject* pGO = GetSingleGameObjectFromStorage(GO_MIMIRON_TRAM))
                {
                    pGO->SetUInt32Value(GAMEOBJECT_LEVEL, 0);
                    pGO->SetGoState(GO_STATE_READY);
                }
            }
            if (uiData == IN_PROGRESS)
            {
                SetSpecialAchievementCriteria(TYPE_ACHIEV_NINE_LIVES, false);
                SetSpecialAchievementCriteria(TYPE_ACHIEV_CRAZY_CAT_LADY, true);
            }
            break;
            // Keepers
        case TYPE_MIMIRON:
            DoUseDoorOrButton(GO_MIMIRON_DOOR_1);
            DoUseDoorOrButton(GO_MIMIRON_DOOR_2);
            DoUseDoorOrButton(GO_MIMIRON_DOOR_3);
            if (uiData == DONE)
            {
                if (m_auiEncounter[TYPE_MIMIRON_HARD] != DONE)
                {
                    if (instance->IsRegularDifficulty())
                    {
                        DoRespawnGameObject(GO_CACHE_OF_INOV, 30*MINUTE);
                    }
                    else
                    {
                        DoRespawnGameObject(GO_CACHE_OF_INOV_H, 30*MINUTE);
                    }
                }
                // used to make the friendly keeper visible
                if (Creature* pImage = GetSingleCreatureFromStorage(KEEPER_MIMIRON))
                    pImage->SetVisibility(VISIBILITY_ON);
                DoOpenMadnessDoorIfCan();
            }
            if (uiData == IN_PROGRESS)
                SetSpecialAchievementCriteria(TYPE_ACHIEV_FIREFIGHTER, false);
            break;
        case TYPE_HODIR:
            if (uiData == DONE)
            {
                OpenDoor(GO_HODIR_ENTER);
                DoUseDoorOrButton(GO_HODIR_ICE_WALL);
                DoUseDoorOrButton(GO_HODIR_EXIT);
                if (instance->IsRegularDifficulty())
                {
                    DoRespawnGameObject(GO_CACHE_OF_WINTER, 30*MINUTE);
                }
                else
                {
                    DoRespawnGameObject(GO_CACHE_OF_WINTER_H, 30*MINUTE);
                }
                // used to make the friendly keeper visible
                if (Creature* pImage = GetSingleCreatureFromStorage(KEEPER_HODIR))
                    pImage->SetVisibility(VISIBILITY_ON);

                DoOpenMadnessDoorIfCan();
            }
            else if (uiData == IN_PROGRESS)
            {
                SetSpecialAchievementCriteria(TYPE_ACHIEV_CHEESE_FREEZE, true);
                SetSpecialAchievementCriteria(TYPE_ACHIEV_COOLEST_FRIEND, true);
                SetSpecialAchievementCriteria(TYPE_ACHIEV_RARE_CACHE, true);
                CloseDoor(GO_HODIR_ENTER);
            }
            else if (uiData == FAIL)
                OpenDoor(GO_HODIR_ENTER);
            break;
        case TYPE_THORIM:
            DoUseDoorOrButton(GO_LIGHTNING_FIELD);
            if (uiData == IN_PROGRESS)
            {
                SetSpecialAchievementCriteria(TYPE_ACHIEV_SIFFED, false);
                SetSpecialAchievementCriteria(TYPE_ACHIEV_LOSE_YOUR_ILLUSION, false);
                DoUseDoorOrButton(GO_DARK_IRON_PORTCULIS);
            }
            if (uiData == DONE)
            {
                if (m_auiEncounter[TYPE_THORIM_HARD] != DONE)
                {
                    if (instance->IsRegularDifficulty())
                    {
                        DoRespawnGameObject(GO_CACHE_OF_STORMS, 30*MINUTE);
                    }
                    else
                    {
                        DoRespawnGameObject(GO_CACHE_OF_STORMS_H, 30*MINUTE);
                    }
                }
                // used to make the friendly keeper visible
                if (Creature* pImage = GetSingleCreatureFromStorage(KEEPER_THORIM))
                    pImage->SetVisibility(VISIBILITY_ON);
                DoOpenMadnessDoorIfCan();
            }
            break;
        case TYPE_FREYA:
            if (uiData == DONE)
            {
                // do this in order to see how many elders were alive and spawn the correct chest
                // hard mode drop
                if (m_auiEncounter[TYPE_FREYA_HARD] != DONE)
                {
                    if (instance->IsRegularDifficulty())
                    {
                        DoRespawnGameObject(GO_FREYA_GIFT, 30*MINUTE);
                    }
                    else
                    {
                        DoRespawnGameObject(GO_FREYA_GIFT_H, 30*MINUTE);
                    }
                }
                // used to make the friendly keeper visible
                if (Creature* pImage = GetSingleCreatureFromStorage(KEEPER_FREYA))
                    pImage->SetVisibility(VISIBILITY_ON);
                DoOpenMadnessDoorIfCan();
            }
            if (uiData == IN_PROGRESS)
            {
                SetSpecialAchievementCriteria(TYPE_ACHIEV_BACK_TO_NATURE, false);
                SetSpecialAchievementCriteria(TYPE_ACHIEV_KNOCK_WOOD, false);
                SetSpecialAchievementCriteria(TYPE_ACHIEV_KNOCK_KNOCK_WOOD, false);
                SetSpecialAchievementCriteria(TYPE_ACHIEV_KNOCK_KNOCK_KNOCK_WOOD, false);
            }
            break;
            // Prison
        case TYPE_VEZAX:
            if (uiData == DONE)
                DoUseDoorOrButton(GO_VEZAX_GATE);
            if (uiData == IN_PROGRESS)
            {
                SetSpecialAchievementCriteria(TYPE_ACHIEV_MORNING_SARONITE, false);
            }
            break;
        case TYPE_YOGGSARON:
            DoUseDoorOrButton(GO_YOGG_GATE);
            if (uiData == IN_PROGRESS)
            {
                DoStartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEV_START_YOGG_SARON_ID);
                SetSpecialAchievementCriteria(TYPE_ACHIEV_THREE_LIGHTS, false);
                SetSpecialAchievementCriteria(TYPE_ACHIEV_TWO_LIGHTS, false);
                SetSpecialAchievementCriteria(TYPE_ACHIEV_ONE_LIGHT, false);
                SetSpecialAchievementCriteria(TYPE_ACHIEV_ALONE, false);
            }
            if (uiData == FAIL)
            {
                // respawn clouds
                for (GuidList::iterator iter = m_lCloudGuids.begin(); iter != m_lCloudGuids.end(); ++iter)
                    if (Creature* pTmp = instance->GetCreature(*iter))
                        pTmp->Respawn();
                // respawn Sara
                if (Creature* pSara = GetSingleCreatureFromStorage(NPC_SARA))
                {
                    if (!pSara->isAlive())
                        pSara->Respawn();
                    else
                        pSara->AI()->EnterEvadeMode();
                }
                if (Creature* pYoggBrain = GetSingleCreatureFromStorage(NPC_YOGG_BRAIN))
                {
                    if (!pYoggBrain->isAlive())
                        pYoggBrain->Respawn();
                    else
                        pYoggBrain->AI()->EnterEvadeMode();
                }
            }
            break;

            // Celestial Planetarium
        case TYPE_ALGALON:
            DoUseDoorOrButton(GO_CELESTIAL_DOOR);
            DoUseDoorOrButton(GO_UNIVERSE_FLOOR_CELESTIAL);
            if (uiData == DONE)
                DoRespawnGameObject(GO_GIFT_OF_OBSERVER, 30*MINUTE);
            break;

            // Hard modes
        case TYPE_LEVIATHAN_DIFFICULTY:
        case TYPE_XT002_HARD:
            break;
        case TYPE_ASSEMBLY_HARD:
            break;
        case TYPE_MIMIRON_HARD:
            if (uiData == DONE)
            {
                if (instance->IsRegularDifficulty())
                {
                    DoRespawnGameObject(GO_CACHE_OF_INOV_HARD, 30*MINUTE);
                }
                else
                {
                    DoRespawnGameObject(GO_CACHE_OF_INOV_HARD_H, 30*MINUTE);
                }
            }
            break;
        case TYPE_HODIR_HARD:
            if (uiData == DONE)
            {
                if (instance->IsRegularDifficulty())
                {
                    DoRespawnGameObject(GO_CACHE_OF_RARE_WINTER, 30*MINUTE);
                }
                else
                {
                    DoRespawnGameObject(GO_CACHE_OF_RARE_WINTER_H, 30*MINUTE);
                }
            }
            break;
        case TYPE_THORIM_HARD:
            if (uiData == DONE)
            {
                if (instance->IsRegularDifficulty())
                {
                    DoRespawnGameObject(GO_CACHE_OF_RARE_STORMS, 30*MINUTE);
                }
                else
                {
                    DoRespawnGameObject(GO_CACHE_OF_RARE_STORMS_H, 30*MINUTE);
                }
            }
            break;
        case TYPE_FREYA_HARD:
            if (uiData == DONE)
            {
                if (instance->IsRegularDifficulty())
                {
                    DoRespawnGameObject(GO_FREYA_GIFT_HARD, 30*MINUTE);
                }
                else
                {
                    DoRespawnGameObject(GO_FREYA_GIFT_HARD_H, 30*MINUTE);
                }
            }
            break;
        case TYPE_VEZAX_HARD:
        case TYPE_YOGGSARON_HARD:
            break;

        // Ulduar keepers
        case TYPE_KEEPER_HODIR:
        case TYPE_KEEPER_THORIM:
        case TYPE_KEEPER_FREYA:
        case TYPE_KEEPER_MIMIRON:
            break;

        // teleporters
        case TYPE_LEVIATHAN_TP:
        case TYPE_XT002_TP:
        case TYPE_MIMIRON_TP:
            break;

        // mini boss
        case TYPE_RUNIC_COLOSSUS:
            if (uiData == DONE)
                OpenDoor(GO_RUNED_STONE_DOOR);
            else
                CloseDoor(GO_RUNED_STONE_DOOR);
            break;
        case TYPE_RUNE_GIANT:
            if (uiData == DONE)
                OpenDoor(GO_THORIM_STONE_DOOR);
            else
                CloseDoor(GO_THORIM_STONE_DOOR);
            break;
        case TYPE_LEVIATHAN_MK:
            break;
        case TYPE_VX001:
            /*if (uiData == DONE)     // just for animation :)
            {
                for (uint8 i = 0; i < 9; i++)
                    DoUseDoorOrButton(m_uiMimironTelGUID[i]);
            }*/
            break;
        case TYPE_AERIAL_UNIT:
        case TYPE_YOGG_BRAIN:
            break;

        //phases
        case TYPE_MIMIRON_PHASE:
        case TYPE_YOGG_PHASE:
        case TYPE_VISION_PHASE:
            break;
        default:
            error_log("Used undefined uiType(%u) in instance_ulduar::SetData()", uiType);
            return;
    }
    m_auiEncounter[uiType] = uiData;

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

        // save all encounters, hard bosses and keepers
        std::ostringstream saveStream;
        saveStream << m_auiEncounter[TYPE_LEVIATHAN] << " " << m_auiEncounter[TYPE_IGNIS] << " " << m_auiEncounter[TYPE_RAZORSCALE] << " "
            << m_auiEncounter[TYPE_XT002] << " " << m_auiEncounter[TYPE_ASSEMBLY] << " " << m_auiEncounter[TYPE_KOLOGARN] << " "
            << m_auiEncounter[TYPE_AURIAYA] << " " << m_auiEncounter[TYPE_MIMIRON] << " " << m_auiEncounter[TYPE_HODIR] << " "
            << m_auiEncounter[TYPE_THORIM] << " " << m_auiEncounter[TYPE_FREYA] << " " << m_auiEncounter[TYPE_VEZAX] << " "
            << m_auiEncounter[TYPE_YOGGSARON] << " " << m_auiEncounter[TYPE_ALGALON] << " " << m_auiEncounter[TYPE_LEVIATHAN_DIFFICULTY] << " "
            << m_auiEncounter[TYPE_XT002_HARD] << " " << m_auiEncounter[TYPE_ASSEMBLY_HARD] << " " << m_auiEncounter[TYPE_ASSEMBLY_HARD] << " "
            << m_auiEncounter[TYPE_HODIR_HARD] << " " << m_auiEncounter[TYPE_THORIM_HARD] << " " << m_auiEncounter[TYPE_FREYA_HARD] << " "
            << m_auiEncounter[TYPE_VEZAX_HARD] << " " << m_auiEncounter[TYPE_YOGGSARON_HARD] << " " << m_auiEncounter[TYPE_KEEPER_HODIR] << " "
            << m_auiEncounter[TYPE_KEEPER_THORIM] << " " << m_auiEncounter[TYPE_KEEPER_FREYA] << " " << m_auiEncounter[TYPE_KEEPER_MIMIRON] << " "
            << m_auiEncounter[TYPE_LEVIATHAN_TP] << " " << m_auiEncounter[TYPE_XT002_TP] << " " << m_auiEncounter[TYPE_MIMIRON_TP];

        m_strInstData = saveStream.str();

        SaveToDB();
        OUT_SAVE_INST_DATA_COMPLETE;
    }
}
void instance_pinnacle::SetData(uint32 uiType, uint32 uiData)
{
    switch (uiType)
    {
        case TYPE_SVALA:
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_GORTOK:
            m_auiEncounter[uiType] = uiData;
            if (uiData == FAIL)
            {
                if (Creature* pFurbolg = GetSingleCreatureFromStorage(NPC_FURBOLG))
                {
                    pFurbolg->Respawn();
                    pFurbolg->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                }
                if (Creature* pWorg = GetSingleCreatureFromStorage(NPC_WORGEN))
                {
                    pWorg->Respawn();
                    pWorg->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                }
                if (Creature* pJormungar = GetSingleCreatureFromStorage(NPC_JORMUNGAR))
                {
                    pJormungar->Respawn();
                    pJormungar->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                }
                if (Creature* pRhino = GetSingleCreatureFromStorage(NPC_RHINO))
                {
                    pRhino->Respawn();
                    pRhino->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                }
            }
            break;
        case TYPE_SKADI:
            if (uiData == IN_PROGRESS)
            {
                DoStartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEV_START_SKADY_ID);
            }
            if (uiData == DONE)
                DoUseDoorOrButton(GO_DOOR_SKADI);

            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_YMIRON:
            m_auiEncounter[uiType] = uiData;
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_DOOR_AFTER_YMIRON);
            }
            break;
        default:
            error_log("SD2: Instance Pinnacle: SetData = %u for type %u does not exist/not implemented.", uiType, uiData);
            return;
    }

    // Saving also SPECIAL for this instance
    if (uiData == DONE || uiData == SPECIAL)
    {
        OUT_SAVE_INST_DATA;

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

        m_strInstData = saveStream.str();

        SaveToDB();
        OUT_SAVE_INST_DATA_COMPLETE;
    }
}
        void SetData(uint32 type, uint32 data)
        {
            switch(type)
            {
				case DATA_WAVE_STATE:
                    uiWaveState = data;
                    
                    if (data == SPECIAL) // Called on first spawn
                    {
                        CloseDoor(uiFrontDoor);
                        if (!m_bIsCall)
                        {
                           m_bIsCall = true;
                           Summon();
                        }
                        events.ScheduleEvent(EVENT_NEXT_WAVE, 15000);
                     }
                     
                     if (data == IN_PROGRESS) // Called on failed wave
                    {
                        CloseDoor(uiFrontDoor);
                        if (!m_bIsCall)
                        {
                           m_bIsCall = true;
                           Summon();
                        }
                        events.ScheduleEvent(EVENT_NEXT_WAVE, 3000);
                    }

                    if (uiWaveCount && data == FAIL)
                        DoWipe();
                    break;
                case DATA_INTRO_EVENT:
                    uiIntroDone = data;
                    break;
                case DATA_FALRIC_EVENT:
                    uiEncounter[0] = data;
                    if (data == DONE)
                        events.ScheduleEvent(EVENT_NEXT_WAVE, 60000);
                    break;
                case DATA_MARWYN_EVENT:
                    uiEncounter[1] = data;
                    if (data == DONE)
                    {
                        OpenDoor(uiFrostwornDoor);
                        OpenDoor(uiFrontDoor);
                    }
                    break;
                case DATA_FROSWORN_EVENT:
                    uiEncounter[2] = data;
                    if (data == DONE)
                    {
                        OpenDoor(uiArthasDoor);
                        SetData(DATA_PHASE, 3);
                        instance->SummonCreature(BOSS_LICH_KING, OutroSpawns[0]);
                        instance->SummonCreature(NPC_JAINA_OUTRO, OutroSpawns[1]);
                    }
                    break;
                case DATA_LICHKING_EVENT:
                    uiEncounter[3] = data;
                    if(data == IN_PROGRESS)
                    {
                        OpenDoor(uiRunDoor);

                        if(instance->IsHeroic())
                            DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEVNOTRETREATINGEVENT);
                    }
                    if(data == FAIL)
                    {
                        for(uint8 i = 0; i<4; i++)
                            OpenDoor(uiWallID[i]);

                        CloseDoor(uiRunDoor);

                        if(Creature* pLichKing = instance->GetCreature(uiLichKing))
                            pLichKing->DespawnOrUnsummon(10000);
                        if(Creature* pLider = instance->GetCreature(uiLider))
                            pLider->DespawnOrUnsummon(10000);

                        DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEVNOTRETREATINGEVENT);
                        DoCastSpellOnPlayers(5); // Kill all players

                        SetData(DATA_PHASE, 3);
                        instance->SummonCreature(BOSS_LICH_KING, OutroSpawns[0]);
                        instance->SummonCreature(NPC_JAINA_OUTRO, OutroSpawns[1]);
                    }
                    if(data == DONE)
                    {
                        if(GameObject *pChest = instance->GetGameObject(uiChest))
                            pChest->SetPhaseMask(1, true);
                        if(GameObject *pPortal = instance->GetGameObject(uiPortal))
                            pPortal->SetPhaseMask(1, true);

						AchievementEntry const* AchievHoRN = sAchievementStore.LookupEntry(ACHIEVHORN);

						Map::PlayerList const &players = instance->GetPlayers();
                        for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
							itr->getSource()->CompletedAchievement(AchievHoRN);

                        if(instance->IsHeroic())
                        {
							AchievementEntry const* AchievHoRH = sAchievementStore.LookupEntry(ACHIEVHORH);
                            for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
								itr->getSource()->CompletedAchievement(AchievHoRH);
                            DoCastSpellOnPlayers(SPELL_ACHIEV_CHECK);
                            DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEVNOTRETREATINGEVENT);
                        }
                    }
                    break;
                case DATA_SUMMONS:
                    if (data == 3) uiSummons = 0;
                    else if (data == 1) ++uiSummons;
                    else if (data == 0) --uiSummons;
                    data = NOT_STARTED;
                    break;
                case DATA_ICE_WALL_1:
                    uiWall[0] = data;
                    break;
                case DATA_ICE_WALL_2:
                    uiWall[1] = data;
                    break;
                case DATA_ICE_WALL_3:
                    uiWall[2] = data;
                    break;
                case DATA_ICE_WALL_4:
                    uiWall[3] = data;
                    break;
                case DATA_PHASE:
                    uiDataPhase = data;
                    break;
            }

            if (data == DONE)
                SaveToDB();
        }
예제 #15
0
void instance_ahnkahet::SetData(uint32 uiType, uint32 uiData)
{
    debug_log("SD2: Instance Ahn'Kahet: SetData received for type %u with data %u", uiType, uiData);

    switch (uiType)
    {
        case TYPE_NADOX:
            m_auiEncounter[uiType] = uiData;
            if (uiData == IN_PROGRESS)
                m_bRespectElders = true;
            if (uiData == SPECIAL)
                m_bRespectElders = false;
            if (uiData == DONE)
            {
                DoToggleGameObjectFlags(GO_ANCIENT_DEVICE_L, GO_FLAG_NO_INTERACT, false);
                DoToggleGameObjectFlags(GO_ANCIENT_DEVICE_R, GO_FLAG_NO_INTERACT, false);
            }
            break;
        case TYPE_TALDARAM:
            if (uiData == SPECIAL)
            {
                ++m_uiDevicesActivated;

                if (m_uiDevicesActivated == 2)
                {
                    m_auiEncounter[uiType] = uiData;
                    DoUseDoorOrButton(GO_VORTEX);

                    // Lower Taldaram
                    if (Creature* pTaldaram = GetSingleCreatureFromStorage(NPC_TALDARAM))
                        pTaldaram->GetMotionMaster()->MovePoint(1, aTaldaramLandingLoc[0], aTaldaramLandingLoc[1], aTaldaramLandingLoc[2]);

                    // Interrupt the channeling
                    for (GuidList::const_iterator itr = m_lJedogaControllersGuidList.begin(); itr != m_lJedogaControllersGuidList.end(); ++itr)
                    {
                        if (Creature* pTemp = instance->GetCreature(*itr))
                            pTemp->InterruptNonMeleeSpells(false);
                    }
                }
            }
            if (uiData == DONE)
            {
                m_auiEncounter[uiType] = uiData;
                DoUseDoorOrButton(GO_DOOR_TALDARAM);
            }
            break;
        case TYPE_JEDOGA:
            m_auiEncounter[uiType] = uiData;
            if (uiData == IN_PROGRESS)
                m_bVolunteerWork = true;
            if (uiData == SPECIAL)
                m_bVolunteerWork = false;
            if (uiData == FAIL)
                m_uiInitiatesKilled = 0;
            break;
        case TYPE_AMANITAR:
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_VOLAZJ:
            m_auiEncounter[uiType] = uiData;
            if (uiData == IN_PROGRESS)
                DoStartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEV_START_VOLAZJ_ID);
            break;

        default:
            script_error_log("Instance Ahn'Kahet: ERROR SetData = %u for type %u does not exist/not implemented.", uiType, uiData);
            break;
    }

    // For some encounters Special data needs to be saved
    if (uiData == DONE || uiData == SPECIAL)
    {
        OUT_SAVE_INST_DATA;

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

        m_strInstData = saveStream.str();

        SaveToDB();
        OUT_SAVE_INST_DATA_COMPLETE;
    }
}