void Update(uint32 diff)
			{
				if (RescueTimer && RescueTimer < 100*MINUTE*IN_MILLISECONDS)
				{
					RescueTimer -= std::min(RescueTimer, diff);

					if ((RescueTimer / IN_MILLISECONDS) == 25*MINUTE)
					{
						DoRemoveAurasDueToSpellOnPlayers(SPELL_KARGATHS_EXECUTIONER_1);
						DoCastSpellOnPlayers(SPELL_KARGATHS_EXECUTIONER_2);
						if (Creature* prisoner = instance->GetCreature(prisonerGUID[0]))
							Unit::Kill(prisoner, prisoner);
						if (Creature* executioner = instance->GetCreature(executionerGUID))
							executioner->RemoveLootMode(2);
					}
					else if ((RescueTimer / IN_MILLISECONDS) == 15*MINUTE)
					{
						DoRemoveAurasDueToSpellOnPlayers(SPELL_KARGATHS_EXECUTIONER_2);
						DoCastSpellOnPlayers(SPELL_KARGATHS_EXECUTIONER_3);
						if (Creature* prisoner = instance->GetCreature(prisonerGUID[1]))
							Unit::Kill(prisoner, prisoner);
					}
					else if ((RescueTimer / IN_MILLISECONDS) == 0)
					{
						DoRemoveAurasDueToSpellOnPlayers(SPELL_KARGATHS_EXECUTIONER_3);
						if (Creature* prisoner = instance->GetCreature(prisonerGUID[2]))
							Unit::Kill(prisoner, prisoner);
					}
				}
			}
            bool SetBossState(uint32 type, EncounterState state)
            {
                if (!InstanceScript::SetBossState(type, state))
                    return false;

                if (state != DONE)
                   return true;

                switch (type)
                {
                    case DATA_ARCHAVON:
                        ArchavonDeath = time(NULL);
                        break;
                    case DATA_EMALON:
                        EmalonDeath = time(NULL);
                        break;
                    case DATA_KORALON:
                        KoralonDeath = time(NULL);
                        break;
                    default:
                        return true;
                }

                // on every death of Archavon, Emalon and Koralon check our achievement
                DoCastSpellOnPlayers(SPELL_EARTH_WIND_FIRE_ACHIEVEMENT_CHECK);

                return true;
            }
			void SetData(uint32 type, uint32 data)
			{
				if (type == DATA_ENTERED_ROOM && data == DATA_ENTERED_ROOM && RescueTimer == 100*MINUTE*IN_MILLISECONDS)
				{
					DoCastSpellOnPlayers(SPELL_KARGATHS_EXECUTIONER_1);
					instance->LoadGrid(230, -80);

					if (Creature* kargath = instance->GetCreature(warchiefKargathGUID))
						sCreatureTextMgr->SendChat(kargath, TeamIdInInstance == TEAM_ALLIANCE ? 3 : 4, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP);

					RescueTimer = 80*MINUTE*IN_MILLISECONDS;
				}
			}
        void SetData(uint32 type, uint32 data)
        {
            if (type == DATA_WAVE_COUNT && data == SPECIAL)
            {
                CloseDoor(FrontDoor);
                events.ScheduleEvent(EVENT_NEXT_WAVE, 10000);
                return;
            }

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

            switch (type)
            {
                case DATA_INTRO_EVENT:
                    IntroDone = data;
                    break;
                case DATA_FALRIC_EVENT:
                    Encounter[0] = data;
                    if (data == DONE)
                        events.ScheduleEvent(EVENT_NEXT_WAVE, 60000);
                    break;
                case DATA_MARWYN_EVENT:
                    Encounter[1] = data;
                    if (data == DONE)
                    {
                        OpenDoor(FrostwornDoor);
                        OpenDoor(FrontDoor);
                    }
                    break;
                case DATA_FROSWORN_EVENT:
                    Encounter[2] = data;
                    if (data == DONE)
                    {
                        OpenDoor(ArthasDoor);
                        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;
                    if (data == IN_PROGRESS)
                    {
                        OpenDoor(RunDoor);

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

                        CloseDoor(RunDoor);

                        if (Creature* lichKing = instance->GetCreature(LichKing))
                            lichKing->DespawnOrUnsummon(10000);
                        if (Creature* lider = instance->GetCreature(Lider))
                            lider->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* chest = instance->GetGameObject(Chest))
                            chest->SetPhaseMask(1, true);
                        if (GameObject* portal = instance->GetGameObject(uiPortal))
                            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;
                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:
                    Wall[0] = data;
                    break;
                case DATA_ICE_WALL_2:
                    Wall[1] = data;
                    break;
                case DATA_ICE_WALL_3:
                    Wall[2] = data;
                    break;
                case DATA_ICE_WALL_4:
                    Wall[3] = data;
                    break;
                case DATA_PHASE:
                    DataPhase = data;
                    break;
            }

            if (data == DONE)
                SaveToDB();
        }
        void SetData(uint32 type, uint32 data)
        {
            if (type == DATA_WAVE_COUNT && data == SPECIAL)
            {
                  bIntroDone = true;
                  CloseDoor(uiFrontDoor);
                  CloseDoor(uiRunDoor);
                  events.ScheduleEvent(EVENT_NEXT_WAVE, 9000);
                return;
            }

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

            switch (type)
            {
                case DATA_FALRIC_EVENT:
                    uiEncounter[0] = data;
                    if (data == DONE)
                           events.ScheduleEvent(EVENT_NEXT_WAVE, 9000);
                    if (Creature* partner = instance->GetCreature(uiPartner2))
                           partner->SetVisible(false);
                    break;
                case DATA_MARWYN_EVENT:
                    uiEncounter[1] = data;
                    if (data == DONE)
                    {
                           OpenDoor(uiFrostswornDoor);
                           OpenDoor(uiFrontDoor);
                    }
                    break;
                case DATA_FROSTSWORN_EVENT:
                    uiEncounter[2] = data;
                    if (data == DONE)
                    {     
                           OpenDoor(uiArthasDoor);
                           SetData(DATA_PHASE, 3);
                           instance->SummonCreature(NPC_LICH_KING_BOSS, OutroSpawns[0]);
                           instance->SummonCreature(NPC_SYLVANAS_PART2, OutroSpawns[1]);
                    }
                    if (Creature* partner = instance->GetCreature(uiPartner2))                    
                           partner->SetVisible(true);
                    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(NPC_LICH_KING_BOSS, OutroSpawns[0]);
                        instance->SummonCreature(NPC_SYLVANAS_PART2, 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);

                        //ToDo Complete Achievement ACHIEV_HALLS_OF_REFLECTION_N
                        if (instance->IsHeroic())
                        {
                        //ToDo Complete Achievement(ACHIEV_HALLS_OF_REFLECTION_H);
                               DoCastSpellOnPlayers(SPELL_ACHIEV_CHECK);
                               DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_NOT_RETREATING_EVENT);
                        }
                    }
                    break;
                case DATA_WAVES_BEGIN:
                    uiWaveBegin = data;
                    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();
        }
        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, SEKUNDEN_60);
                        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, SEKUNDEN_60);
                    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();
        }
Exemple #7
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_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();
        }