示例#1
0
/**
 *
 *
 *  @author OLiver
 */
nobUsual::nobUsual(BuildingType type,
                   MapPoint pos,
                   unsigned char player,
                   Nation nation)
    : noBuilding(type, pos, player, nation),
      worker(NULL), disable_production(false), disable_production_virtual(false),
      last_ordered_ware(0), orderware_ev(NULL), productivity_ev(NULL), is_working(false)
{
    std::fill(wares.begin(), wares.end(), 0);

    // Entsprechend so viele Listen erstellen, wie nötig sind, bei Bergwerken 3
    if(USUAL_BUILDING_CONSTS[type_ - 10].wares_needed_count)
        ordered_wares.resize(USUAL_BUILDING_CONSTS[type_ - 10].wares_needed_count);
    else
        ordered_wares.clear();

    // Arbeiter bestellen
    GameClientPlayer& owner = gwg->GetPlayer(player);
    owner.AddJobWanted(USUAL_BUILDING_CONSTS[type_ - 10].job, this);

    // Tür aufmachen,bis Gebäude besetzt ist
    OpenDoor();

    const std::list<nobUsual*>& otherBlds = owner.GetBuildings(type);
    if(otherBlds.empty())
        productivity = 0;
    else
    {
        // New building gets half the average productivity from all buildings of the same type
        int sumProductivity = 0;
        for(std::list<nobUsual*>::const_iterator it = otherBlds.begin(); it != otherBlds.end(); ++it)
            sumProductivity += (*it)->GetProductivity();
        productivity = sumProductivity / otherBlds.size() / 2;
    }
    // Set last productivities to current to avoid resetting it on first recalculation event
    std::fill(last_productivities.begin(), last_productivities.end(), productivity);

    // Gebäude in den Index eintragen, damit die Wirtschaft auch Bescheid weiß
    // Do this AFTER the productivity calculation or we will get this building too!
    owner.AddUsualBuilding(this);
}
        // Wipe has been detected. Perform cleanup and reset.
        void DoWipe()
        {

            if (GetData(DATA_MARWYN_EVENT) != DONE) {

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

            // TODO
            // in case of wipe, the event is normally restarted by jumping into the center of the room.
            // As I can't find a trigger area there, just respawn Jaina/Sylvanas so the event may be restarted.
            if (Creature* pFalric = instance->GetCreature(uiFalric))
                pFalric->SetVisible(false);
            if (Creature* pMarwyn = instance->GetCreature(uiMarwyn))
                pMarwyn->SetVisible(false);
            }
        }
	void Scheduler::Passenger()
    {
	  
	  Serial.print("----- Passenger Command ");
	     switch(opCode){
	    
	     case 0:   break;
	     case 1:   ScheduleCalls(floor,"UP");
	 	           Serial.print(" op: Hall Call Up");
	 			   Serial.print("\tFloor : "+String(floor)+"-----\n");
	 			   break;
	     case 2:   ScheduleCalls(floor,"DOWN");
	 	           Serial.print(" op: Hall Call Down");
	 			   Serial.print("\tFloor : "+String(floor)+"-----\n");
	 			   break;
	     case 3:   InsertDestination(floor,elevatorID);
	 	           Serial.print(" op:Insert Destination for Elevator "+String(elevatorID+1));
	 	           Serial.print("\tFloor : "+String(floor)+"-----\n");
	 	           break;
	     case 4:   OpenDoor(elevatorID);
	 	           Serial.print(" op: Open Door for Elevator "+String(elevatorID+1));
	 	           Serial.print("-----\n");
	 	           break;
	     case 5:   CloseDoor(elevatorID);
	 	           Serial.print(" op: Close Door for Elevator "+String(elevatorID+1));
	 	           Serial.print("-----\n");
	 	           break;
	     case 6:   CancelCalls(floor,elevatorID);
	 			   Serial.print(" op: Cancel floor for Elevator "+String(elevatorID+1));
	 			   Serial.print("\tFloor : "+String(floor)+"-----\n");
	 			   break;
	     case 7:   Serial.print(" op: Alarm status:");
	 			   Alarm(elevatorID);
	 			   Serial.print(" for Elevator "+String(elevatorID+1));
	 			   Serial.print("-----\n");
	 			   break;
	     default : break;
	 }
    }	
示例#4
0
文件: Swipe.c 项目: dgastler/Door
int ProcessCardSwipe(int swipeFD,int arduinoFD, MYSQL * conn)
{
  int ret = 0;
  const unsigned bufferSize = 256;
  char buffer[bufferSize+1];
  buffer[bufferSize] = '\0';
  bzero(buffer,bufferSize);

  unsigned readSize = ReadKeyboard(swipeFD,buffer,bufferSize);
  if(readSize == 10)
    {
      int opendoor = 0;
      buffer[readSize] = '\0';
      //              0123456789012345678901234567890123 45678901
      char query[] = "select * from users where swipe = \"XXXXXXXXX\" limit 0,1 ";      
      memcpy(query+35,buffer,9); 
      //      printf("%s (%d)\n",query,sizeof(query));
      
      opendoor = RunSQLquery(conn,query,sizeof(query));
      if(opendoor == 1)
	{
	  alarm(0); //Cancel any previous alarms
	  OpenDoor(arduinoFD);
	  alarm(5);  //schedule an alarm to go off in 5 seconds to close the door
	}

      memcpy(query+35,"XXXXXXXXX",9); 
      ret = 1;
    }
  else if(readSize == 0)
    {
      ret = 1;
    }
  else
    {
      ret = 0;
    }
  return ret;
}
        void DoWipe()
        {
            if (GetData(DATA_FALRIC_EVENT) == DONE && GetData(DATA_MARWYN_EVENT) != DONE)
                WaveCnt = 5;
            else
                WaveCnt = 0;

            events.Reset();

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

            OpenDoor(FrontDoorGUID);

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

            if (Creature * Marwyn = instance->GetCreature(MarwynGUID))
                if (Marwyn->isAlive())
                    Marwyn->AI()->EnterEvadeMode();
        }
示例#6
0
    void SetData(uint32 id, uint32 data)
    {
        switch(id)
        {
            case DATA_KALECGOS_EVENT:      Encounters[0] = data; break;
            case DATA_BRUTALLUS_EVENT:
                Encounters[1] = data;
                OpenDoor(DoorFireBarrier, data == DONE);
                break;
            case DATA_FELMYST_EVENT:
                Encounters[2] = data;
                OpenDoor(DoorTheFirstGate, data == DONE);
                break;
            case DATA_ALYTHESS_EVENT:
                Encounters[3] = data;
                OpenDoor(DoorTheSecondGate, data == DONE);
                break;
            case DATA_SACROLASH_EVENT:
                Encounters[4] = data;
                OpenDoor(DoorRaid_Gate_07, data == DONE);
                break;
            case DATA_MURU_EVENT:
                Encounters[5] = data;
                OpenDoor(DoorRaid_Gate_08, data == DONE);
                break;
            case DATA_ENTROPIUS_EVENT:
                Encounters[6] = data;
                OpenDoor(DoorTheThirdGate, data == DONE);
                break;
            case DATA_KILJAEDEN_EVENT:     Encounters[7] = data; break;

            case DATA_SET_SPECTRAL_CHECK:  SpectralRealmTimer = data; break;
            case DATA_INST_EJECT_PLAYERS:  EjectPlayers(); break;
        }
        if (data == DONE)
        {
            SaveToDB();
        }
    }
void instance_naxxramas::SetData(uint32 uiType, uint32 uiData)
{
    switch(uiType)
    {
        case TYPE_ANUB_REKHAN:
            m_auiEncounter[0] = uiData;
            DoUseDoorOrButton(m_uiAnubDoorGUID);
            if (uiData == DONE)
            {
                OpenDoor(m_uiAnubGateGUID);
                m_uiArachnofobiaTimer = 0;
                m_bIsArachnofobia = true;
            }
            break;
        case TYPE_FAERLINA:
            m_auiEncounter[1] = uiData;
            DoUseDoorOrButton(m_uiFaerWebGUID);
            if (uiData == DONE)
        {
            OpenDoor(m_uiFaerDoorGUID);
            OpenDoor(m_uiMaexOuterGUID);
        }
            break;
        case TYPE_MAEXXNA:
            m_auiEncounter[2] = uiData;
            DoUseDoorOrButton(m_uiMaexInnerGUID, uiData);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(m_uiAracEyeRampGUID);
                DoUseDoorOrButton(m_uiAracEyeGUID);
                DoRespawnGameObject(m_uiAracPortalGUID, 30*MINUTE);
                Immortal();
                DoTaunt();

                // Arachnofobia
                if(m_uiArachnofobiaTimer <= 20 * 60000 && m_bIsArachnofobia)
                {
                    Arachnofobia();
                    m_bIsArachnofobia = false;
                }
            }
            break;
        case TYPE_NOTH:
            m_auiEncounter[3] = uiData;
            DoUseDoorOrButton(m_uiNothEntryDoorGUID);
            if (uiData == DONE)
            {
                OpenDoor(m_uiNothExitDoorGUID);
                OpenDoor(m_uiHeigEntryDoorGUID);
            }
            break;
        case TYPE_HEIGAN:
            m_auiEncounter[4] = uiData;
            DoUseDoorOrButton(m_uiHeigEntryDoorGUID);
            if (uiData == DONE)
            {
                OpenDoor(m_uiHeigExitDoorGUID);
                OpenDoor(m_uiLoathebDoorGUID);
            }
            break;
        case TYPE_LOATHEB:
            m_auiEncounter[5] = uiData;
            DoUseDoorOrButton(m_uiLoathebDoorGUID);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(m_uiPlagEyeRampGUID);
                DoUseDoorOrButton(m_uiPlagEyeGUID);
                DoRespawnGameObject(m_uiPlagPortalGUID, 30*MINUTE);
                DoTaunt();
                Immortal();
            }
            break;
        case TYPE_RAZUVIOUS:
            m_auiEncounter[6] = uiData;
            if (uiData == DONE)
                OpenDoor(m_uiGothikEntryDoorGUID);
            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:
                    OpenDoor(m_uiGothikEntryDoorGUID);
                    OpenDoor(m_uiGothikExitDoorGUID);
                    OpenDoor(m_uiHorsemenDoorGUID);
                    OpenDoor(m_uiGothCombatGateGUID);
                    break;
            }
            m_auiEncounter[7] = uiData;
            break;
        case TYPE_FOUR_HORSEMEN:
            m_auiEncounter[8] = uiData;
            DoUseDoorOrButton(m_uiHorsemenDoorGUID);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(m_uiMiliEyeRampGUID);
                DoUseDoorOrButton(m_uiMiliEyeGUID);
                DoRespawnGameObject(m_uiMiliPortalGUID, 30*MINUTE);
                DoRespawnGameObject(m_uiHorsemenChestGUID, 30*MINUTE);
                DoTaunt();
                Immortal();
            }
            break;
        case TYPE_PATCHWERK:
            m_auiEncounter[9] = uiData;
            if (uiData == DONE)
                OpenDoor(m_uiPathExitDoorGUID);
            break;
        case TYPE_GROBBULUS:
            m_auiEncounter[10] = uiData;
            break;
        case TYPE_GLUTH:
            m_auiEncounter[11] = uiData;
            if (uiData == DONE)
            {
                OpenDoor(m_uiGlutExitDoorGUID);
                OpenDoor(m_uiThadDoorGUID);
            }
            break;
        case TYPE_THADDIUS:
            m_auiEncounter[12] = uiData;
            if(uiData != SPECIAL)
                DoUseDoorOrButton(m_uiThadDoorGUID, uiData);
            if(uiData == FAIL)
                OpenDoor(m_uiThadDoorGUID);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(m_uiConsEyeRampGUID);
                DoUseDoorOrButton(m_uiConsEyeGUID);
                DoRespawnGameObject(m_uiConsPortalGUID, 30*MINUTE);
                DoTaunt();
                Immortal();
            }
            break;
        case TYPE_SAPPHIRON:
            m_auiEncounter[13] = uiData;
            if (uiData == DONE)
                DoUseDoorOrButton(m_uiKelthuzadDoorGUID);
            break;
        case TYPE_KELTHUZAD:
            m_auiEncounter[14] = uiData;
            DoUseDoorOrButton(m_uiKelthuzadExitDoorGUID);
            if(uiData == DONE)
                Immortal();
            break;
        case TYPE_IMMORTAL:
            m_auiEncounter[15] = uiData;
            break;
            //Four Horsemen Chest
        case TYPE_BLAUMEAUX:
            if (uiData == DONE)
            {
                BlaumeuxDead = true;
                UpdateCheck = true;
                Horseman();
            }
            break;
        case TYPE_RIVENDARE:
            if (uiData == DONE)
            {
                RivendareDead = true;
                UpdateCheck = true;
                Horseman();
            }
            break;
        case TYPE_ZELIEK:
            if (uiData == DONE)
            {
                ZeliekDead = true;
                UpdateCheck = true;
                Horseman();
            }
            break;
        case TYPE_KORTHAZZ:
            if (uiData == DONE)
            {
                KorthazzDead = true;
                UpdateCheck = true;
                Horseman();
            }
            break;
        case TYPE_STALAGG:
            m_auiStalaggEncounter = uiData;
            break;
        case TYPE_FEUGEN:
            m_auiFeugenEncouter = 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;
    }
}
示例#8
0
// used in order to unlock the door to Vezax and make vezax attackable
void instance_ulduar::DoOpenMadnessDoorIfCan()
{
    if(m_auiEncounter[7] == DONE && m_auiEncounter[8] == DONE && m_auiEncounter[9] == DONE && m_auiEncounter[10] == DONE)
        OpenDoor(m_uiAncientGateGUID);
        OpenDoor(m_uiAncientGateGUID);
}
        void OnGameObjectCreate(GameObject* go)
        {
            // TODO: init state depending on encounters
            switch (go->GetEntry())
            {
                case GO_FROSTMOURNE:
                    Frostmourne = go->GetGUID();
                    go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND);
                    HandleGameObject(0, false, go);
                    break;
                case GO_FROSTMOURNE_ALTAR:
                    go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND);
                    HandleGameObject(0, true, go);
                    break;
                case GO_FRONT_DOOR:
                    FrontDoor = go->GetGUID();
                    go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND);
                    OpenDoor(FrontDoor);
                    break;
                case GO_FROSTWORN_DOOR:
                    FrostwornDoor = go->GetGUID();
                    go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND);

                    if (Encounter[1] == DONE)
                        OpenDoor(FrostwornDoor);
                    else
                        CloseDoor(FrostwornDoor);
                    break;
                case GO_RUN_DOOR:
                    RunDoor = go->GetGUID();
                    break;
                case GO_ARTHAS_DOOR:
                    ArthasDoor = go->GetGUID();
                    break;
                case GO_ICE_WALL_1:
                    WallID[0] = go->GetGUID();
                    break;
                case GO_ICE_WALL_2:
                    WallID[1] = go->GetGUID();
                    break;
                case GO_ICE_WALL_3:
                    WallID[2] = go->GetGUID();
                    break;
                case GO_ICE_WALL_4:
                    WallID[3] = go->GetGUID();
                    break;
                case GO_CAVE:
                    CaveDoor = go->GetGUID();
                    break;
                case GO_CAPTAIN_CHEST_1:
                    go->SetPhaseMask(2, true);
                    if (!instance->IsHeroic() && TeamInInstance == HORDE)
                        Chest = go->GetGUID();
                    break;
                case GO_CAPTAIN_CHEST_3:
                    go->SetPhaseMask(2, true);
                    if (instance->IsHeroic() && TeamInInstance == HORDE)
                        Chest = go->GetGUID();
                    break;
                case GO_CAPTAIN_CHEST_2:
                    go->SetPhaseMask(2, true);
                    if (!instance->IsHeroic() && TeamInInstance == ALLIANCE)
                        Chest = go->GetGUID();
                    break;
                case GO_CAPTAIN_CHEST_4:
                    go->SetPhaseMask(2, true);
                    if (instance->IsHeroic() && TeamInInstance == ALLIANCE)
                        Chest = go->GetGUID();
                    break;
                case GO_SKYBREAKER:
                    go->SetPhaseMask(2, true);
                    if (TeamInInstance == ALLIANCE)
                        Gunship = go->GetGUID();
                    break;
                case GO_ORGRIM_HAMMER:
                    go->SetPhaseMask(2, true);
                    if (TeamInInstance == HORDE)
                        Gunship = go->GetGUID();
                    break;
                case GO_PORTAL:
                    go->SetPhaseMask(2, true);
                    uiPortal = go->GetGUID();
                    break;
            }
        }
示例#10
0
 // used to open the door to XT (custom script because Leviathan is disabled)
 // this will be removed when the Leviathan will be implemented
 void OpenXtDoor()
 {
     if(m_auiEncounter[1] == DONE && m_auiEncounter[2] == DONE)
         OpenDoor(m_uiXT002GateGUID);
 }
    void SetData(uint32 uiType, uint32 uiData)
    {
        switch(uiType)
        {
        case TYPE_STAGE:     m_auiEncounter[0] = uiData; break;
        case TYPE_BEASTS:    m_auiEncounter[1] = uiData; break;
        case TYPE_JARAXXUS:  m_auiEncounter[2] = uiData; break;
        case TYPE_CRUSADERS: if (uiData == FAIL && (m_auiEncounter[3] == FAIL || m_auiEncounter[3] == NOT_STARTED))
                             m_auiEncounter[3] = NOT_STARTED;
                             else  m_auiEncounter[3] = uiData;
                             if (uiData == DONE) {
                                   if (GameObject* pChest = instance->GetGameObject(m_uiCrusadersCacheGUID))
                                       if (pChest && !pChest->isSpawned())
                                             pChest->SetRespawnTime(7*DAY);
                                   };
                             break;
        case TYPE_CRUSADERS_COUNT:  if (uiData == 0) --m_auiCrusadersCount;
                                         else m_auiCrusadersCount = uiData;
                                    break;
        case TYPE_VALKIRIES: if (m_auiEncounter[4] == SPECIAL && uiData == SPECIAL) uiData = DONE;
                             m_auiEncounter[4] = uiData; break;
        case TYPE_LICH_KING: m_auiEncounter[5] = uiData; break;
        case TYPE_ANUBARAK:  m_auiEncounter[6] = uiData; 
                            if (uiData == DONE) {
                            if(Difficulty == RAID_DIFFICULTY_10MAN_HEROIC){
                                if ( m_auiEncounter[7] >= 25) m_uiTributeChest1GUID = m_uiTC10h25GUID;
                                if ( m_auiEncounter[7] >= 45) m_uiTributeChest2GUID = m_uiTC10h45GUID;
                                if ( m_auiEncounter[7] >= 49) m_uiTributeChest3GUID = m_uiTC10h50GUID;
                                m_uiTributeChest4GUID = m_uiTC10h99GUID;
                            }
                            if(Difficulty == RAID_DIFFICULTY_25MAN_HEROIC){
                                if ( m_auiEncounter[7] >= 25) m_uiTributeChest1GUID = m_uiTC25h25GUID;
                                if ( m_auiEncounter[7] >= 45) m_uiTributeChest2GUID = m_uiTC25h45GUID;
                                if ( m_auiEncounter[7] >= 49) m_uiTributeChest3GUID = m_uiTC25h50GUID;
                                m_uiTributeChest4GUID = m_uiTC25h99GUID;
                            }
                            // Attention! It is (may be) not off-like, but  spawning all Tribute Chests is real
                            // reward for clearing TOC instance
                            if (m_uiTributeChest1GUID)
                              if (GameObject* pChest1 = instance->GetGameObject(m_uiTributeChest1GUID))
                                if (pChest1 && !pChest1->isSpawned()) pChest1->SetRespawnTime(7*DAY);
                            if (m_uiTributeChest2GUID)
                              if (GameObject* pChest2 = instance->GetGameObject(m_uiTributeChest2GUID))
                                if (pChest2 && !pChest2->isSpawned()) pChest2->SetRespawnTime(7*DAY);
                            if (m_uiTributeChest3GUID)
                              if (GameObject* pChest3 = instance->GetGameObject(m_uiTributeChest3GUID))
                                if (pChest3 && !pChest3->isSpawned()) pChest3->SetRespawnTime(7*DAY);
                            if (m_uiTributeChest4GUID)
                              if (GameObject* pChest4 = instance->GetGameObject(m_uiTributeChest4GUID))
                                if (pChest4 && !pChest4->isSpawned()) pChest4->SetRespawnTime(7*DAY);
                            };
        break;
        case TYPE_COUNTER:   m_auiEncounter[7] = uiData; uiData = DONE; break;
        case TYPE_EVENT:     m_auiEncounter[8] = uiData; uiData = NOT_STARTED; break;
        case TYPE_EVENT_TIMER:      m_auiEventTimer = uiData; uiData = NOT_STARTED; break;
        case TYPE_NORTHREND_BEASTS: m_auiNorthrendBeasts = uiData; break;
        case DATA_HEALTH_FJOLA:     m_uiDataDamageFjola = uiData; uiData = NOT_STARTED; break;
        case DATA_HEALTH_EYDIS:     m_uiDataDamageEydis = uiData; uiData = NOT_STARTED; break;
        case DATA_CASTING_VALKYRS:  m_uiValkyrsCasting = uiData; uiData = NOT_STARTED; break;
        }

        if (IsEncounterInProgress()) 
        {

            CloseDoor(GetData64(GO_WEST_PORTCULLIS));
            CloseDoor(GetData64(GO_NORTH_PORTCULLIS));
            //                                    CloseDoor(GetData64(GO_SOUTH_PORTCULLIS));
        }
        else
        {

            OpenDoor(GetData64(GO_WEST_PORTCULLIS));
            OpenDoor(GetData64(GO_NORTH_PORTCULLIS));
            //                                    OpenDoor(GetData64(GO_SOUTH_PORTCULLIS));
        };

        if (uiData == FAIL && uiType != TYPE_STAGE
                           && uiType != TYPE_EVENT
                           && uiType != TYPE_COUNTER
                           && uiType != TYPE_EVENT_TIMER)
        {
            if (IsRaidWiped()) 
            {
                --m_auiEncounter[7];
                needsave = true;
            }
            uiData = NOT_STARTED;
        }

        if ((uiData == DONE && uiType != TYPE_STAGE
                           && uiType != TYPE_EVENT
                           && uiType != TYPE_EVENT_TIMER)
                           || needsave == true)
        {
            OUT_SAVE_INST_DATA;

            std::ostringstream saveStream;

            for(uint8 i = 0; i < MAX_ENCOUNTERS; ++i)
                saveStream << m_auiEncounter[i] << " ";

            m_strInstData = saveStream.str();

            SaveToDB();
            OUT_SAVE_INST_DATA_COMPLETE;
            needsave = false;
        }
    }
示例#12
0
// used in order to unlock the door to Vezax and make vezax attackable
void instance_ulduar::DoOpenMadnessDoorIfCan()
{
    if(m_auiEncounter[TYPE_MIMIRON] == DONE && m_auiEncounter[TYPE_HODIR] == DONE && m_auiEncounter[TYPE_THORIM] == DONE && m_auiEncounter[TYPE_FREYA] == DONE)
        OpenDoor(GO_ANCIENT_GATE);
}
        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* LiftDoorBehaveInit(void* bhdata, STRATEGYBLOCK* sbptr)
{
	LIFT_DOOR_BEHAV_BLOCK *doorbhv;
	LIFT_DOOR_TOOLS_TEMPLATE *doortt;
	MORPHCTRL* morphctrl;	
	MORPHHEADER* morphheader;
	MORPHFRAME* morphframe;
	MODULE * my_mod;

	doorbhv = (LIFT_DOOR_BEHAV_BLOCK*)AllocateMem(sizeof(LIFT_DOOR_BEHAV_BLOCK));
	if (!doorbhv) 
	{
		memoryInitialisationFailure = 1;
		return ((void *)NULL);
	}

	doorbhv->bhvr_type = I_BehaviourLiftDoor;

	// from loaders
	
	doortt = (LIFT_DOOR_TOOLS_TEMPLATE*)bhdata;	

	// Set up a new Morph Control
	morphctrl = (MORPHCTRL*)AllocateMem(sizeof(MORPHCTRL));
	if (!morphctrl)
	{
		memoryInitialisationFailure = 1;
		return ((void *)NULL);
	}
	morphheader = (MORPHHEADER*)AllocateMem(sizeof(MORPHHEADER));
	if (!morphheader)
	{
		memoryInitialisationFailure = 1;
		return ((void *)NULL);
	}
	morphframe = (MORPHFRAME*)AllocateMem(sizeof(MORPHFRAME));
	if (!morphframe)
	{
		memoryInitialisationFailure = 1;
		return ((void *)NULL);
	}

	morphframe->mf_shape1 = doortt->shape_open;
	morphframe->mf_shape2 = doortt->shape_closed;

	morphheader->mph_numframes = 1;
	morphheader->mph_maxframes = ONE_FIXED;
	morphheader->mph_frames = morphframe;

	morphctrl->ObMorphCurrFrame = 0;
	morphctrl->ObMorphFlags = 0;
	morphctrl->ObMorphSpeed = 0;
	morphctrl->ObMorphHeader = morphheader;

	// Copy the name over
	COPY_NAME (sbptr->SBname, doortt->nameID);

	// Setup module ref
	{
		MREF mref=doortt->my_module;
		ConvertModuleNameToPointer (&mref, MainSceneArray[0]->sm_marray);
		my_mod = mref.mref_ptr;
	}
	GLOBALASSERT (my_mod);

	my_mod->m_sbptr = sbptr;
	sbptr->SBmoptr = my_mod;
	sbptr->SBmomptr = my_mod->m_mapptr;
	sbptr->SBflags.no_displayblock = 1;

	doorbhv->door_state	= doortt->state;
	doorbhv->PDmctrl = morphctrl;
	doorbhv->door_closing_speed=doortt->door_closing_speed;
	doorbhv->door_opening_speed=doortt->door_opening_speed;

	// all lift doors have a closed starting state except the
	// one where the lift is - fill in other data

	sbptr->SBmorphctrl = doorbhv->PDmctrl;

	if(doorbhv->door_state == I_door_open)
		{
			sbptr->SBmorphctrl->ObMorphCurrFrame = 0; 
			OpenDoor(sbptr->SBmorphctrl, DOOR_OPENFASTSPEED);	
		}
	else
		{
			GLOBALASSERT(doorbhv->door_state == I_door_closed);
			sbptr->SBmorphctrl->ObMorphCurrFrame = 1; 
			CloseDoor(sbptr->SBmorphctrl, DOOR_CLOSEFASTSPEED);	
		}
	doorbhv->request_state = doorbhv->door_state;

	// copy data into relevant structures

	sbptr->SBmorphctrl = doorbhv->PDmctrl;

	if(sbptr->SBmoptr)
		{
			sbptr->SBmoptr->m_flags |= m_flag_open;
		}
	if(sbptr->SBmomptr)
		{
			sbptr->SBmomptr->MapMorphHeader = sbptr->SBmorphctrl->ObMorphHeader;
		}
			
			
  	doorbhv->SoundHandle=SOUND_NOACTIVEINDEX;
			
	return((void*)doorbhv);
}
void LiftDoorBehaveFun(STRATEGYBLOCK* sbptr)
{
	LIFT_DOOR_BEHAV_BLOCK *doorbhv;
	MORPHCTRL *mctrl;
	DISPLAYBLOCK* dptr;
	MODULE *mptr;

 	GLOBALASSERT(sbptr);
	doorbhv = (LIFT_DOOR_BEHAV_BLOCK*)sbptr->SBdataptr;
	GLOBALASSERT((doorbhv->bhvr_type == I_BehaviourLiftDoor));
	mctrl = doorbhv->PDmctrl;
	GLOBALASSERT(mctrl);
	mptr = sbptr->SBmoptr;
	GLOBALASSERT(mptr);
	dptr = sbptr->SBdptr;
	
	/* update morphing.... */
	UpdateMorphing(mctrl);

 	switch(doorbhv->door_state)
	{
		case I_door_opening:
		{	
			mptr->m_flags |= m_flag_open;
			if(mctrl->ObMorphFlags & mph_flag_finished)		
			{
		        if (doorbhv->SoundHandle!=SOUND_NOACTIVEINDEX)
		        {
		          Sound_Play(SID_DOOREND,"d",&mptr->m_world);
		          Sound_Stop(doorbhv->SoundHandle);
		        }
				doorbhv->door_state = I_door_open;
			}
			break;
		}
		case I_door_closing:
		{
			if(mctrl->ObMorphFlags & mph_flag_finished)
			{
		        if (doorbhv->SoundHandle!=SOUND_NOACTIVEINDEX)
		        {
					Sound_Play(SID_DOOREND,"d",&mptr->m_world);
					Sound_Stop(doorbhv->SoundHandle);
		        }
				doorbhv->door_state = I_door_closed;
				mptr->m_flags &= ~m_flag_open;
			}
			else if(AnythingInMyModule(sbptr->SBmoptr))
			{
				if (doorbhv->SoundHandle==SOUND_NOACTIVEINDEX)
				{
					Sound_Play(SID_DOORSTART,"d",&mptr->m_world);
					Sound_Play(SID_DOORMID,"del",&mptr->m_world,&doorbhv->SoundHandle);
				}
				OpenDoor(mctrl, doorbhv->door_opening_speed);
				doorbhv->door_state = I_door_opening;
				mptr->m_flags |= m_flag_open;
			}							
			break;
		}
		case I_door_open:
		{
			mptr->m_flags |= m_flag_open;
			if(doorbhv->request_state == I_door_closed)
			{
		 	    					
				if (doorbhv->SoundHandle==SOUND_NOACTIVEINDEX)
				{
 					Sound_Play(SID_DOORSTART,"d",&mptr->m_world);
 					Sound_Play(SID_DOORMID,"del",&mptr->m_world,&doorbhv->SoundHandle);
				}
							
				CloseDoor(mctrl, doorbhv->door_closing_speed);
				doorbhv->door_state = I_door_closing;
			}
			break;
		}
		case I_door_closed:
		{
			mptr->m_flags &= ~m_flag_open;
			if(doorbhv->request_state == I_door_open)
			{
						
				if (doorbhv->SoundHandle==SOUND_NOACTIVEINDEX)
				{
					Sound_Play(SID_DOORSTART,"d",&mptr->m_world);
					Sound_Play(SID_DOORMID,"del",&mptr->m_world,&doorbhv->SoundHandle);
				}
		
				OpenDoor(mctrl, doorbhv->door_opening_speed);
				doorbhv->door_state = I_door_opening;
				mptr->m_flags |= m_flag_open;
			}
			break;
		}
		default:
			LOCALASSERT(1==0);
	}
}
        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();
        }
示例#17
0
void instance_ulduar::SetData(uint32 uiType, uint32 uiData)
{
    switch(uiType)
    {
    case TYPE_LEVIATHAN:
        m_auiEncounter[0] = uiData;
        DoUseDoorOrButton(m_uiShieldWallGUID);
        if (uiData == DONE)
            OpenDoor(m_uiLeviathanGateGUID);
        break;
    case TYPE_IGNIS:
        m_auiEncounter[1] = uiData;
        break;
    case TYPE_RAZORSCALE:
        m_auiEncounter[2] = uiData;
        break;
    case TYPE_XT002:
        m_auiEncounter[3] = uiData;
        if (uiData == DONE || uiData == FAIL)
            OpenDoor(m_uiXT002GateGUID);
        else if (uiData == IN_PROGRESS)
            CloseDoor(m_uiXT002GateGUID);
        break;
    case TYPE_ASSEMBLY:
        m_auiEncounter[4] = uiData;
        if (uiData == DONE)
        {
            OpenDoor(m_uiIronCouncilDoorGUID);
            OpenDoor(m_uiArchivumDoorGUID);
            OpenDoor(m_uiShatteredHallsDoorGUID);
        }
        else if (uiData == IN_PROGRESS)
            CloseDoor(m_uiIronCouncilDoorGUID);
        else if (uiData == FAIL)
            OpenDoor(m_uiIronCouncilDoorGUID);
        break;
    case TYPE_KOLOGARN:
        m_auiEncounter[5] = uiData;
        if (uiData == DONE)
        {
            DoRespawnGameObject(m_uiKologarnLootGUID, 30*MINUTE);
            if (GameObject* pGo = instance->GetGameObject(m_uiKologarnBridgeGUID))
            {
                pGo->SetUInt32Value(GAMEOBJECT_LEVEL, 0);
                pGo->SetGoState(GO_STATE_READY);
            }
        }
        break;
    case TYPE_AURIAYA:
        m_auiEncounter[6] = uiData;
        if (uiData == DONE)
        {
            if (GameObject* pGO = instance->GetGameObject(m_uiMimironTramGUID))
            {
                pGO->SetUInt32Value(GAMEOBJECT_LEVEL, 0);
                pGO->SetGoState(GO_STATE_READY);
            }
        }
        break;

        // Keepers
    case TYPE_MIMIRON:
        m_auiEncounter[7] = uiData;
        DoUseDoorOrButton(m_uiMimironDoor1GUID);
        DoUseDoorOrButton(m_uiMimironDoor2GUID);
        DoUseDoorOrButton(m_uiMimironDoor3GUID);
        if (uiData == DONE)
        {
            if(m_auiHardBoss[3] != DONE)
                DoRespawnGameObject(m_uiMimironLootGUID, 30*MINUTE);
            // used to make the friendly keeper visible
            if(Creature* pImage = instance->GetCreature(m_uiMimironImageGUID))
                pImage->SetVisibility(VISIBILITY_ON);
            DoOpenMadnessDoorIfCan();
        }
        break;
    case TYPE_HODIR:
        m_auiEncounter[8] = uiData;
        if (uiData == DONE)
        {
            OpenDoor(m_uiHodirEnterDoorGUID);
            DoUseDoorOrButton(m_uiHodirWallGUID);
            DoUseDoorOrButton(m_uiHodirExitDoorGUID);
            DoRespawnGameObject(m_uiHodirLootGUID, 30*MINUTE);

            // used to make the friendly keeper visible
            if(Creature* pImage = instance->GetCreature(m_uiHodirImageGUID))
                pImage->SetVisibility(VISIBILITY_ON);

            DoOpenMadnessDoorIfCan();
        }
        else if (uiData == IN_PROGRESS)
            CloseDoor(m_uiHodirEnterDoorGUID);
        else if (uiData == FAIL)
            OpenDoor(m_uiHodirEnterDoorGUID);
        break;
    case TYPE_THORIM:
        m_auiEncounter[9] = uiData;
        DoUseDoorOrButton(m_uiArenaEnterDoorGUID);
        if (uiData == IN_PROGRESS)
            DoUseDoorOrButton(m_uiArenaExitDoorGUID);
        if (uiData == DONE)
        {
            if(m_auiHardBoss[5] != DONE)
                DoRespawnGameObject(m_uiThorimLootGUID, 30*MINUTE);
            // used to make the friendly keeper visible
            if(Creature* pImage = instance->GetCreature(m_uiThorimImageGUID))
                pImage->SetVisibility(VISIBILITY_ON);
            DoOpenMadnessDoorIfCan();
        }
        break;
    case TYPE_FREYA:
        m_auiEncounter[10] = uiData;
        if (uiData == DONE)
        {
            // do this in order to see how many elders were alive and spawn the correct chest
            // hard mode drop
            if(m_auiHardBoss[6] == 3)
                DoRespawnGameObject(m_uiFreyaLootHardGUID, 30*MINUTE);
            // normal mode
            else
                DoRespawnGameObject(m_uiFreyaLootGUID, 30*MINUTE);
            // used to make the friendly keeper visible
            if(Creature* pImage = instance->GetCreature(m_uiFreyaImageGUID))
                pImage->SetVisibility(VISIBILITY_ON);
            DoOpenMadnessDoorIfCan();
        }
        break;
    // 1 elder up +1 emblem drops
    case TYPE_FREYA_1:
        m_auiFreyaElders[1] = uiData;
        break;
    // 2 elders up +2 emblems drop
    case TYPE_FREYA_2:
        m_auiFreyaElders[2] = uiData;
        break;
    // 3 elders up is TYPE_FREYA_HARD

        // Prison
    case TYPE_VEZAX:
        m_auiEncounter[11] = uiData;
        if (uiData == DONE)
            DoUseDoorOrButton(m_uiVezaxGateGUID);
        break;
    case TYPE_YOGGSARON:
        m_auiEncounter[12] = uiData;
        DoUseDoorOrButton(m_uiYoggGateGUID);
        break;

        // Celestial Planetarium
    case TYPE_ALGALON:
        m_auiEncounter[13] = uiData;
        DoUseDoorOrButton(m_uiCelestialDoorGUID);
        DoUseDoorOrButton(m_uiUniverseFloorCelestialGUID);
        if (uiData == DONE)
            DoRespawnGameObject(m_uiAlagonLootGUID, 30*MINUTE);
        break;

        // Hard modes
    case TYPE_LEVIATHAN_HARD:
        m_auiHardBoss[0] = uiData;
        break;
    case TYPE_XT002_HARD:
        m_auiHardBoss[1] = uiData;
        break;
    case TYPE_HODIR_HARD:
        m_auiHardBoss[4] = uiData;
        if(uiData == DONE)
            DoRespawnGameObject(m_uiHodirRareLootGUID, 30*MINUTE);
        break;
    case TYPE_ASSEMBLY_HARD:
        m_auiHardBoss[2] = uiData;
        break;
    case TYPE_FREYA_HARD:
        m_auiHardBoss[6] = uiData;
        break;
    case TYPE_THORIM_HARD:
        m_auiHardBoss[5] = uiData;
        if(uiData == DONE)
            DoRespawnGameObject(m_uiThorimRareLootGUID, 30*MINUTE);
        break;
    case TYPE_MIMIRON_HARD:
        m_auiHardBoss[3] = uiData;
        if(uiData == DONE)
            DoRespawnGameObject(m_uiMimironHardLootGUID, 30*MINUTE);
        break;
    case TYPE_VEZAX_HARD:
        m_auiHardBoss[7] = uiData;
        break;
    case TYPE_YOGGSARON_HARD:
        m_auiHardBoss[8] = uiData;
        break;

        // Ulduar keepers
    case TYPE_KEEPER_HODIR:
        m_auiUlduarKeepers[0] = uiData;
        break;
    case TYPE_KEEPER_THORIM:
        m_auiUlduarKeepers[1] = uiData;
        break;
    case TYPE_KEEPER_FREYA:
        m_auiUlduarKeepers[2] = uiData;
        break;
    case TYPE_KEEPER_MIMIRON:
        m_auiUlduarKeepers[3] = uiData;
        break;

        // teleporters
    case TYPE_LEVIATHAN_TP:
        m_auiUlduarTeleporters[0] = uiData;
        break;
    case TYPE_XT002_TP:
        m_auiUlduarTeleporters[1] = uiData;
        break;
    case TYPE_MIMIRON_TP:
        m_auiUlduarTeleporters[2] = uiData;
        break;

        // mini boss
    case TYPE_RUNIC_COLOSSUS:
        m_auiMiniBoss[0] = uiData;
        if (uiData == DONE)
            OpenDoor(m_uiHallwayDoorGUID);
        else
            CloseDoor(m_uiHallwayDoorGUID);
        break;
    case TYPE_RUNE_GIANT:
        m_auiMiniBoss[1] = uiData;
        if (uiData == DONE)
            OpenDoor(m_uiThorimEnterDoorGUID);
        else
            CloseDoor(m_uiThorimEnterDoorGUID);
        break;
    case TYPE_LEVIATHAN_MK:
        m_auiMiniBoss[2] = uiData;
        break;
    case TYPE_VX001:
        m_auiMiniBoss[3] = uiData;
        if (uiData == DONE)     // just for animation :)
        {
            for(uint8 i = 0; i < 9; i++)
                DoUseDoorOrButton(m_uiMimironTelGUID[i]);
        }
        break;
    case TYPE_AERIAL_UNIT:
        m_auiMiniBoss[4] = uiData;
        break;
    case TYPE_YOGG_BRAIN:
        m_auiMiniBoss[5] = uiData;
        break;

        //phases
    case TYPE_MIMIRON_PHASE:
        m_uiMimironPhase = uiData;
        break;
    case TYPE_YOGG_PHASE:
        m_uiYoggPhase = uiData;
        break;
    case TYPE_VISION_PHASE:
        m_uiVisionPhase = uiData;
        break;

    // achievements
    case TYPE_ACHI_QUICK_SHAVE:
        m_bQuickShave = (uiData == DONE);
        break;
    case TYPE_ACHI_SHATTERED:
        m_bShattered = (uiData == DONE);
        break;
    case TYPE_ACHI_NERF_ENGI:
        m_bNerfEngi = (uiData == DONE);
        break;
    case TYPE_ACHI_NERF_GRAVITY:
        m_bNerfGravity = (uiData == DONE);
        break;
    case TYPE_ACHI_CHOOSE_MOLG:
        m_bChooseMolg = (uiData == DONE);
        break;
    case TYPE_ACHI_CHOOSE_BRUN:
        m_bChooseBrun = (uiData == DONE);
        break;
    case TYPE_ACHI_CHOOSE_STEEL:
        m_bChooseSteel = (uiData == DONE);
        break;
    case TYPE_ACHI_CANT_DO_THAT:
        m_bCantDoThat = (uiData == DONE);
        break;
    case TYPE_ACHI_OPEN_ARMS:
        m_bOpenArms = (uiData == DONE);
        break;
    case TYPE_ACHI_IF_LOOKS:
        m_bIfLooks = (uiData == DONE);
        break;
    case TYPE_ACHI_RUBBLE_ROLL:
        m_bRubbleRoll = (uiData == DONE);
        break;
    case TYPE_ACHI_CAT_LADY:
        m_bCatLady = (uiData == DONE);
        break;
    case TYPE_ACHI_NINE_LIVES:
        m_bNineLives = (uiData == DONE);
        break;
    }

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

        // save all encounters, hard bosses and keepers
        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_auiHardBoss[0] << " "
            << m_auiHardBoss[1] << " " << m_auiHardBoss[2] << " " << m_auiHardBoss[2] << " "
            << m_auiHardBoss[4] << " " << m_auiHardBoss[5] << " " << m_auiHardBoss[6] << " "
            << m_auiHardBoss[7] << " " << m_auiHardBoss[8] << " " << m_auiUlduarKeepers[0] << " "
            << m_auiUlduarKeepers[1] << " " << m_auiUlduarKeepers[2] << " " << m_auiUlduarKeepers[3] << " "
            << m_auiUlduarTeleporters[0] << " " << m_auiUlduarTeleporters[1] << " " << m_auiUlduarTeleporters[2];

        m_strInstData = saveStream.str();

        SaveToDB();
        OUT_SAVE_INST_DATA_COMPLETE;
    }
}
示例#18
0
/*-------------------------------------------------------------------
    Procedure   :       Open BGObject Door
    Input       :       uint8 * Data
    Output      :       nothing
-------------------------------------------------------------------*/
void EVENT_OpenDoor( uint8 * Data )
{
    OpenDoor( (uint16) *Data );
}
示例#19
0
    void SetData(uint32 type, uint32 data)
    {
        switch(type)
        {
            case DATA_RAGEWINTERCHILLEVENT: Encounters[0] = data; break;
            case DATA_ANETHERONEVENT:
                Encounters[1] = data;
                break;
            case DATA_KAZROGALEVENT:        Encounters[2] = data; break;
            case DATA_AZGALOREVENT:
                {
                    Encounters[3] = data;
                    if (data == DONE)
                    {
                        if (ArchiYell)break;
                        ArchiYell = true;

                        Creature* pCreature = instance->GetCreature(Azgalor);
                        if (pCreature)
                        {
                            Creature* pUnit = pCreature->SummonCreature(21987,pCreature->GetPositionX(),pCreature->GetPositionY(),pCreature->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,10000);

                            Map* pMap = pCreature->GetMap();
                            if (pMap->IsDungeon() && pUnit)
                            {
                                pUnit->SetVisibility(VISIBILITY_OFF);
                                Map::PlayerList const &PlayerList = pMap->GetPlayers();
                                if (PlayerList.isEmpty())
                                     return;

                                for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                                {
                                     if (i->getSource())
                                     {
                                        WorldPacket data(SMSG_MESSAGECHAT, 200);
                                        pUnit->BuildMonsterChat(&data,CHAT_MSG_MONSTER_YELL,YELL_EFFORTS,0,YELL_EFFORTS_NAME,i->getSource()->GetGUID());
                                        i->getSource()->GetSession()->SendPacket(&data);

                                        WorldPacket data2(SMSG_PLAY_SOUND, 4);
                                        data2 << 10986;
                                        i->getSource()->GetSession()->SendPacket(&data2);
                                     }
                                }
                            }
                        }
                    }
                }
                break;
            case DATA_ARCHIMONDEEVENT:      Encounters[4] = data; break;
            case DATA_RESET_TRASH_COUNT:    Trash = 0;            break;

            case DATA_TRASH:
                if (data) Trash = data;
                else     Trash--;
                UpdateWorldState(WORLD_STATE_ENEMYCOUNT, Trash);
                break;
            case DATA_ALLIANCE_RETREAT:
                allianceRetreat = data;
                OpenDoor(HordeGate,true);
                SaveToDB();
                break;
            case DATA_HORDE_RETREAT:
                hordeRetreat = data;
                OpenDoor(ElfGate,true);
                SaveToDB();
                break;
            case DATA_RAIDDAMAGE:
                RaidDamage += data;
                if (RaidDamage >= MINRAIDDAMAGE)
                    RaidDamage = MINRAIDDAMAGE;
                break;
            case DATA_RESET_RAIDDAMAGE:
                RaidDamage = 0;
                break;
        }

         debug_log("BSCR: Instance Hyjal: Instance data updated for event %u (Data=%u)",type,data);

        if (data == DONE)
            SaveToDB();
    }
        void SetData(uint32 uiType, uint32 uiData)
        {
            switch(uiType)
            {
                case TYPE_EVENT: m_auiEncounter[uiType] = uiData; uiData = NOT_STARTED; 
                    break;
                case TYPE_RAGEFIRE: m_auiEncounter[uiType] = uiData;
                    OpenAllDoors();
                    break;
                case TYPE_BALTHARUS: m_auiEncounter[uiType] = uiData;
                    OpenAllDoors();
                    break;
                case TYPE_XERESTRASZA: m_auiEncounter[uiType] = uiData;
                    if (uiData == IN_PROGRESS)
                        OpenDoor(m_uiFireFieldGUID);
                    else if (uiData == NOT_STARTED)
                    {
                        CloseDoor(m_uiFireFieldGUID);
                        OpenAllDoors();
                    }
                    else if (uiData == DONE)
                    {
                        OpenAllDoors();
                        if (m_auiEncounter[TYPE_ZARITHRIAN] == DONE)
                        {
                            m_auiEncounter[TYPE_EVENT] = 200;
                            m_auiEventTimer = 30000;
                        };
                    }
                    break;
                case TYPE_ZARITHRIAN: m_auiEncounter[uiType] = uiData;
                    if (uiData == DONE)
                    {
                        OpenDoor(m_uiFlameWallsGUID);
                        m_auiEncounter[TYPE_EVENT] = 200;
                        m_auiEventTimer = 30000;
                    }
                    else if (uiData == IN_PROGRESS)
                        CloseDoor(m_uiFlameWallsGUID);
                    else if (uiData == FAIL)
                        OpenDoor(m_uiFlameWallsGUID);
                        break;
                case TYPE_HALION: m_auiEncounter[uiType] = uiData;
                    if (uiData == IN_PROGRESS)
                    {
                        CloseDoor(m_uiFlameRingGUID);
                    }
                    else
                    {
                        OpenDoor(m_uiFlameRingGUID);
                    }
                    break;
                case TYPE_HALION_EVENT: m_auiHalionEvent = uiData; uiData = NOT_STARTED; break;
                case TYPE_EVENT_TIMER: m_auiEventTimer = uiData; uiData = NOT_STARTED; break;
                case DATA_ORB_DIRECTION: m_auiOrbDirection = uiData; uiData = NOT_STARTED; break;
                case DATA_ORB_N: m_auiOrbNState = uiData; uiData = NOT_STARTED; break;
                case DATA_ORB_S: m_auiOrbSState = uiData; uiData = NOT_STARTED; break;
                case TYPE_COUNTER:
                    if (uiData == COUNTER_OFF)
                    {
                        UpdateWorldState(false,0);
                    }
                    else 
                    {
                        UpdateWorldState(true,uiData);
                    }
                    uiData = NOT_STARTED;
                    break;
            }

            if (uiData == DONE)
            {
                OUT_SAVE_INST_DATA;
                std::ostringstream saveStream;
                for(uint8 i = 0; i < MAX_ENCOUNTERS; ++i)
                    saveStream << m_auiEncounter[i] << " ";

                strSaveData = saveStream.str();
                SaveToDB();
                OUT_SAVE_INST_DATA_COMPLETE;
            }
        }
示例#21
0
void instance_ulduar::SetData(uint32 uiType, uint32 uiData)
{
    switch(uiType)
    {
    case TYPE_LEVIATHAN:
        m_auiEncounter[uiType] = uiData;
        DoUseDoorOrButton(GO_SHIELD_WALL);
        if (uiData == DONE)
            OpenDoor(GO_LEVIATHAN_GATE);
        break;
    case TYPE_IGNIS:
        m_auiEncounter[uiType] = uiData;
        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:
        m_auiEncounter[uiType] = uiData;
        if (uiData == IN_PROGRESS)
        {
            SetSpecialAchievementCriteria(TYPE_ACHIEV_QUICK_SHAVE, true);
            SetSpecialAchievementCriteria(TYPE_ACHIEV_IRON_DWARF_MEDIUM_RARE, false);
        }
        break;
    case TYPE_XT002:
        m_auiEncounter[uiType] = uiData;
        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:
        m_auiEncounter[uiType] = uiData;
        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:
        m_auiEncounter[uiType] = uiData;
        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:
        m_auiEncounter[uiType] = uiData;
        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:
        m_auiEncounter[uiType] = uiData;
        DoUseDoorOrButton(GO_MIMIRON_DOOR_1);
        DoUseDoorOrButton(GO_MIMIRON_DOOR_2);
        DoUseDoorOrButton(GO_MIMIRON_DOOR_3);
        if (uiData == DONE)
        {
            if (m_auiHardBoss[3] != 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:
        m_auiEncounter[uiType] = uiData;
        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:
        m_auiEncounter[uiType] = uiData;
        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_auiHardBoss[5] != 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:
        m_auiEncounter[uiType] = uiData;
        if (uiData == DONE)
        {
            // do this in order to see how many elders were alive and spawn the correct chest
            // hard mode drop
            if(m_auiHardBoss[6] != 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:
        m_auiEncounter[uiType] = uiData;
        if (uiData == DONE)
            DoUseDoorOrButton(GO_VEZAX_GATE);
        if (uiData == IN_PROGRESS)
        {
            SetSpecialAchievementCriteria(TYPE_ACHIEV_MORNING_SARONITE, false);
        }
        break;
    case TYPE_YOGGSARON:
        m_auiEncounter[uiType] = uiData;
        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:
        m_auiEncounter[uiType] = uiData;
        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_HARD:
        m_auiHardBoss[0] = uiData;
        break;
    case TYPE_XT002_HARD:
        m_auiHardBoss[1] = uiData;
        break;
    case TYPE_ASSEMBLY_HARD:
        m_auiHardBoss[2] = uiData;
        break;
    case TYPE_MIMIRON_HARD:
        m_auiHardBoss[3] = uiData;
        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:
        m_auiHardBoss[4] = uiData;
        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:
        m_auiHardBoss[5] = uiData;
        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:
        m_auiHardBoss[6] = uiData;
        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:
        m_auiHardBoss[7] = uiData;
        break;
    case TYPE_YOGGSARON_HARD:
        m_auiHardBoss[8] = uiData;
        break;

    // Ulduar keepers
    case TYPE_KEEPER_HODIR:
        m_auiUlduarKeepers[0] = uiData;
        break;
    case TYPE_KEEPER_THORIM:
        m_auiUlduarKeepers[1] = uiData;
        break;
    case TYPE_KEEPER_FREYA:
        m_auiUlduarKeepers[2] = uiData;
        break;
    case TYPE_KEEPER_MIMIRON:
        m_auiUlduarKeepers[3] = uiData;
        break;

    // teleporters
    case TYPE_LEVIATHAN_TP:
        m_auiUlduarTeleporters[0] = uiData;
        break;
    case TYPE_XT002_TP:
        m_auiUlduarTeleporters[1] = uiData;
        break;
    case TYPE_MIMIRON_TP:
        m_auiUlduarTeleporters[2] = uiData;
        break;

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

    //phases
    case TYPE_MIMIRON_PHASE:
        m_uiMimironPhase = uiData;
        break;
    case TYPE_YOGG_PHASE:
        m_uiYoggPhase = uiData;
        break;
    case TYPE_VISION_PHASE:
        m_uiVisionPhase = uiData;
        break;
    }

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

        // save all encounters, hard bosses and keepers
        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_auiHardBoss[0] << " "
                   << m_auiHardBoss[1] << " " << m_auiHardBoss[2] << " " << m_auiHardBoss[2] << " "
                   << m_auiHardBoss[4] << " " << m_auiHardBoss[5] << " " << m_auiHardBoss[6] << " "
                   << m_auiHardBoss[7] << " " << m_auiHardBoss[8] << " " << m_auiUlduarKeepers[0] << " "
                   << m_auiUlduarKeepers[1] << " " << m_auiUlduarKeepers[2] << " " << m_auiUlduarKeepers[3] << " "
                   << m_auiUlduarTeleporters[0] << " " << m_auiUlduarTeleporters[1] << " " << m_auiUlduarTeleporters[2];

        m_strInstData = saveStream.str();

        SaveToDB();
        OUT_SAVE_INST_DATA_COMPLETE;
    }
}
示例#22
0
    void SetData(uint32 type, uint32 data)
    {
        switch(type)
        {
            case DATA_STRANGE_POOL:
                {
                    StrangePool = data;
                    if(data == NOT_STARTED)
                        LurkerSubEvent = LURKER_NOT_STARTED;
                }
                break;
            case DATA_WATER : Water = data; break;
            case DATA_CONTROL_CONSOLE:
                if(data == DONE)
                {
                    OpenDoor(BridgePart[0], true);
                    OpenDoor(BridgePart[1], true);
                    OpenDoor(BridgePart[2], true);
                }
                ControlConsole = data;
                break;
            case DATA_HYDROSSTHEUNSTABLEEVENT:
                if(Encounters[0] != DONE)
                    Encounters[0] = data;
                break;
            case DATA_LEOTHERASTHEBLINDEVENT:
                if(Encounters[1] != DONE)
                    Encounters[1] = data;
                break;
            case DATA_THELURKERBELOWEVENT:
                if(Encounters[2] != DONE)
                    Encounters[2] = data;
                break;
            case DATA_KARATHRESSEVENT:
                if(Encounters[3] != DONE)
                    Encounters[3] = data;
                break;
            case DATA_MOROGRIMTIDEWALKEREVENT:
                if(Encounters[4] != DONE)
                    Encounters[4] = data;
                break;
                //Lady Vashj
            case DATA_LADYVASHJEVENT:
                if(data == NOT_STARTED)
                {
                    ShieldGeneratorDeactivated[0] = false;
                    ShieldGeneratorDeactivated[1] = false;
                    ShieldGeneratorDeactivated[2] = false;
                    ShieldGeneratorDeactivated[3] = false;
                }
                if (Encounters[5] != DONE)
                    Encounters[5] = data;
                break;
            case DATA_SHIELDGENERATOR1:ShieldGeneratorDeactivated[0] = (data) ? true : false;   break;
            case DATA_SHIELDGENERATOR2:ShieldGeneratorDeactivated[1] = (data) ? true : false;   break;
            case DATA_SHIELDGENERATOR3:ShieldGeneratorDeactivated[2] = (data) ? true : false;   break;
            case DATA_SHIELDGENERATOR4:ShieldGeneratorDeactivated[3] = (data) ? true : false;   break;
        }

        if (data == DONE)
            SaveToDB();
    }
示例#23
0
 void SetEncounterData(uint32 type, uint32 data) 
 {
    switch (type)
     {
         //Spiderwing ------------------------------------
         case ENCOUNT_ANUBREKHAN:
             Encounters[ENCOUNT_ANUBREKHAN] = data;
             switch (data)
             {
                 case NOT_STARTED:
                     CloseDoor(go_anubrekhan_gate);
                     OpenDoor(go_anubrekhan_door);
                     Close(go_maexxna_outerweb);
                     break;
                 case IN_PROGRESS:
                     CloseDoor(go_anubrekhan_door);
                     break;
                 case DONE:
                     OpenDoor(go_anubrekhan_gate);
                     OpenDoor(go_anubrekhan_door);
                     if(Encounters[ENCOUNT_FAERLINA] == DONE)   //Impossible, but check
                         Open(go_maexxna_outerweb);
                     break;
             }
             break;
         case ENCOUNT_FAERLINA:
             Encounters[ENCOUNT_FAERLINA] = data;
             switch (data)
             {
                 case NOT_STARTED:
                     CloseDoor(go_faerlina_door);
                     Open(go_faerlina_web);
                     Close(go_maexxna_outerweb);
                     break;
                 case IN_PROGRESS:
                     Close(go_faerlina_web);
                     break;
                 case DONE:
                     OpenDoor(go_faerlina_door);
                     Open(go_faerlina_web);
                     if(Encounters[ENCOUNT_ANUBREKHAN] == DONE)
                         Open(go_maexxna_outerweb);
                     break;
             }
             break;
         case ENCOUNT_MAEXXNA:
             Encounters[ENCOUNT_MAEXXNA] = data;
             switch (data)
             {
                 case NOT_STARTED:
                     Open(go_maexxna_innerweb);
                     Disable(go_spiderwing_portal);
                     Close(go_spiderwing_eye_boss);
                     Close(go_spiderwing_eye_ramp);
                     break;
                 case IN_PROGRESS:
                     Close(go_maexxna_innerweb);
                     break;
                 case DONE:
                     Open(go_maexxna_innerweb);
                     Open(go_spiderwing_eye_boss);
                     Open(go_spiderwing_eye_ramp);
                     Enable(go_spiderwing_portal);
                     break;
             }
             break;
             //Plaguewing ------------------------------------
         case ENCOUNT_NOTH:
             Encounters[ENCOUNT_NOTH] = data;
             switch(data)
             {
             case NOT_STARTED:
                 Open(go_noth_door);
                 Close(go_noth_exit);
                 break;
             case IN_PROGRESS:
                 Close(go_noth_door);
                 break;
             case DONE:
                 Open(go_noth_door);
                 Open(go_noth_exit);
                 break;
             }
             break;
         case ENCOUNT_HEIGAN:
             Encounters[ENCOUNT_HEIGAN] = data;
             switch(data)
             {
                 case NOT_STARTED:
                     Open(go_heigan_entry);
                     Close(go_heigan_outerdoor);
                     Close(go_heigan_exitgate);
                     break;
                 case IN_PROGRESS:
                     Close(go_heigan_entry);
                     break;
                 case DONE:
                     Open(go_heigan_entry);
                     Open(go_heigan_outerdoor);
                     Open(go_heigan_exitgate);
                     break;
             }
             break;
         case ENCOUNT_LOATHEB:
             Encounters[ENCOUNT_LOATHEB] = data;
             switch (data)
             {
             case NOT_STARTED:
                 Open(go_loatheb_door);
                 Disable(go_plaguewing_portal);
                 Close(go_plaguewing_eye_boss);
                 Close(go_plaguewing_eye_ramp);
                 break;
             case IN_PROGRESS:
                 Close(go_loatheb_door);
                 break;
             case DONE:
                 Open(go_loatheb_door);
                 Open(go_plaguewing_eye_boss);
                 Open(go_plaguewing_eye_ramp);
                 Enable(go_plaguewing_portal);
                 break;
             }
             break;
         case ENCOUNT_PATCHWERK:
             Encounters[ENCOUNT_PATCHWERK] = data;
             switch(data)
             {
             case NOT_STARTED:
                 //Close(go_grobblulus_door);
                 break;
             case IN_PROGRESS:
                 break;
             case DONE:
                 Open(go_grobblulus_door);
                 break;
             }
             break;
         case ENCOUNT_GROBBULUS:
             Encounters[ENCOUNT_GROBBULUS] = data;
             switch(data)
             {
             case NOT_STARTED:
                 Open(go_grobblulus_door);
                 break;
             case IN_PROGRESS:
                 Close(go_grobblulus_door);
                 break;
             case DONE:
                 Open(go_grobblulus_door);
                 break;
             }
             break;
         case ENCOUNT_GLUTH:
             Encounters[ENCOUNT_GLUTH] = data;
             switch(data)
             {
             case NOT_STARTED:
                 Close(go_gluth_door);
                 Close(go_thaddius_door);
                 break;
             case DONE:
                 Open(go_gluth_door);
                 Open(go_thaddius_door);
                 break;
             }
             break;
         case ENCOUNT_THADDIUS:
             Encounters[ENCOUNT_THADDIUS] = data;
             switch(data)
             {
             case NOT_STARTED:
                 {
                     Disable(go_naxx_portal);
                     Close(go_abom_eye_boss);
                     Close(go_abom_eye_ramp);
                     if (GetData(ENCOUNT_GLUTH) == 3)
                         Open(go_thaddius_door);
                     break;
                 }
             case IN_PROGRESS:
                 Close(go_thaddius_door);
                 break;
             case DONE:
                 Open(go_abom_eye_boss);
                 Open(go_abom_eye_ramp);
                 Enable(go_naxx_portal);
                 Open(go_thaddius_door);
                 break;
             }
             break;
         case ENCOUNT_GOTHIK:
             Encounters[ENCOUNT_GOTHIK] = data;
             switch(data)
             {
             case NOT_STARTED:
                 Open(go_vaccuum_enter_gate);
                 Open(go_vaccuum_combat_gate);
                 Close(go_vaccuum_exit_gate);
                 break;
             case IN_PROGRESS:
                 Close(go_vaccuum_enter_gate);
                 Close(go_vaccuum_combat_gate);
                 break;
             case DONE:
                 Open(go_vaccuum_combat_gate);
                 Open(go_vaccuum_enter_gate);
                 Open(go_vaccuum_exit_gate);
                 break;
             }
             break;
         case ENCOUNT_FOURHORSEMAN:
             Encounters[ENCOUNT_FOURHORSEMAN] = data;
             switch(data)
             {
             case NOT_STARTED:
                 Open(go_horsemans_door);
                 Close(go_horsemans_eye_boss);
                 Close(go_horsemans_eye_ramp);
                 Disable(go_horsemans_portal);
                 break;
             case IN_PROGRESS:
                 Close(go_horsemans_door);
                 break;
             case DONE:
                 Open(go_horsemans_door);
                 Open(go_horsemans_eye_boss);
                 Open(go_horsemans_eye_ramp);
                 Enable(go_horsemans_portal);
                 break;
             }
             break;
         case ENCOUNT_SAPPHIRON:
             Encounters[ENCOUNT_SAPPHIRON] = data;
             switch(data)
             {
             case NOT_STARTED:
                 Close(go_sapphiron_door);
                 Close(go_kelthuzad_door);
                 break;
             case IN_PROGRESS:
                 break;
             case DONE:
                 Open(go_sapphiron_door);
                 Open(go_kelthuzad_door);
                 break;
             }
             break;
         case ENCOUNT_KELTHUZAD:
             Encounters[ENCOUNT_KELTHUZAD] = data;
             switch(data)
             {
             case NOT_STARTED:
                 if (GetData(ENCOUNT_SAPPHIRON) == DONE)
                     Open(go_kelthuzad_door);
                 break;
             case IN_PROGRESS:
                 Close(go_kelthuzad_door);
                 break;
             case DONE:
                 Open(go_kelthuzad_door);
                 break;
             }
             break;
         }
 }
示例#24
0
void instance_ulduar::OnObjectCreate(GameObject* pGo)
{
	switch(pGo->GetEntry())
    {
		case GO_KOLOGARN_BRIDGE:
			m_uiKologarnBridgeGUID = pGo->GetGUID();
			if(!(GetData(TYPE_KOLOGARN) == DONE))
				pGo->SetGoState(GO_STATE_ACTIVE);
			else
				pGo->SetGoState(GO_STATE_READY);
			break;
		case GO_KOLOGARN_LOOT:
		case GO_KOLOGARN_LOOT_H:
			m_uiKologarnLootGUID = pGo->GetGUID();
			break;
		case 8151: // Thorim Door
			m_uiThorimDoor = pGo->GetGUID();
			break;
		case 194312:
		case 194313:
			m_uiThorimLootGUID = pGo->GetGUID();
			break;
		case 194631:
			XTDoorGUID = pGo->GetGUID();
			break;
		case 194554:
			IronCouncilDoorGUID = pGo->GetGUID();
			break;
		case 194556:
			IronCouncilArchivumGUID = pGo->GetGUID();
			break;
		case 194553:
			KologarnDoorGUID = pGo->GetGUID();
			break;
		case 194442:
			HodirDoorGUID = pGo->GetGUID();
			break;
		case 194441:
			HodirExitDoor1GUID = pGo->GetGUID();
			break;
		case 194634:
			HodirExitDoor2GUID = pGo->GetGUID();
			break;
		case 194560:
			ThorimDoorGUID = pGo->GetGUID();
			break;
		case 194255:
			AuriayaDoorGUID = pGo->GetGUID();
			if(GetData(TYPE_AURIAYA) == DONE)
				OpenDoor(AuriayaDoorGUID);
			break;
		case 194750:
			VezaxDoorGUID = pGo->GetGUID();
			if(GetData(TYPE_VEZAX) == DONE)
				OpenDoor(VezaxDoorGUID);
			break;
		case 194773:
			YoggDoorGUID = pGo->GetGUID();
			break;
		case 194325:
			FreyaGiftGUID = pGo->GetGUID();
			break;
		case 194625:
			YoggEndPortals.push_back(pGo->GetGUID());
			break;
		case 194637:
			YoggBrainDoor1GUID = pGo->GetGUID();
			break;
		case 194635:
			YoggBrainDoor2GUID = pGo->GetGUID();
			break;
		case 194636:
			YoggBrainDoor3GUID = pGo->GetGUID();
			break;
	}
}
示例#25
0
 // used in order to unlock the door to Vezax and make vezax attackable
 void OpenMadnessDoor()
 {
     if(m_auiEncounter[7] == DONE && m_auiEncounter[8] == DONE && m_auiEncounter[9] == DONE && m_auiEncounter[10] == DONE)
         OpenDoor(m_uiAncientGateGUID);
         OpenDoor(m_uiAncientGateGUID);
 }
示例#26
0
void instance_ulduar::SetData(uint32 uiType, uint32 uiData)
{
	switch(uiType)
    {
		
		case TYPE_LEVIATHAN:
		case TYPE_RAZORSCALE:
		case TYPE_MIMIRON:
		case TYPE_ALGALON:
			m_auiEncounter[uiType] = uiData;
			break;
		case TYPE_IGNIS:
			m_auiEncounter[uiType] = uiData;
			if(uiData == DONE)
			{
				if(IgnisAddTimedActivate > 1)
				{
					IgnisAddTimedActivate = 0;
					CompleteAchievementForGroup(instance->GetDifficulty() ? 2926 : 2925);
				}
			}
			break;
		case TYPE_VEZAX:
			m_auiEncounter[uiType] = uiData;
			if(uiData == DONE)
				OpenDoor(VezaxDoorGUID);
			else
				CloseDoor(VezaxDoorGUID);
			break;
		case TYPE_YOGGSARON:
			if(uiData == DONE || uiData == FAIL ||uiData == NOT_STARTED)
			{
				DespawnCreatures(YoggAdds);
				CloseDoor(YoggDoorGUID);
			}
			else
				OpenDoor(YoggDoorGUID);
			break;
		case TYPE_AURIAYA:
			m_auiEncounter[uiType] = uiData;
			if(uiData == DONE)
				OpenDoor(AuriayaDoorGUID);
			break;
		case TYPE_ASSEMBLY:
			m_auiEncounter[uiType] = uiData;
			if(uiData == DONE)
			{
				CloseDoor(IronCouncilDoorGUID);
				OpenDoor(IronCouncilArchivumGUID);
			}
			else if(uiData == IN_PROGRESS)
			{
				OpenDoor(IronCouncilDoorGUID);
				CloseDoor(IronCouncilArchivumGUID);
			}
			CompleteAchievementForGroup(instance->GetDifficulty() ? 2885 : 2860);
			break;
		case TYPE_XT002:
			m_auiEncounter[uiType] = uiData;
			if(uiData == DONE)
				CloseDoor(XTDoorGUID);
			else
				OpenDoor(XTDoorGUID);
			break;
		case TYPE_THORIM:
			m_auiEncounter[uiType] = uiData;
			if (uiData == DONE)
			{
				if (GameObject* pChest = instance->GetGameObject(m_uiThorimLootGUID))
					if (pChest && !pChest->isSpawned())
						pChest->SetRespawnTime(350000000);
			}
			else if(uiData == IN_PROGRESS)
				OpenDoor(ThorimDoorGUID);
			break;
		case TYPE_FREYA:
			m_auiEncounter[uiType] = uiData;
			for (std::vector<Creature*>::iterator itr = FreyaTrashs.begin(); itr != FreyaTrashs.end();++itr)
				if((*itr) && (*itr)->isAlive())
					(*itr)->SetRespawnDelay(7*RESPAWN_ONE_DAY);

			if(uiData == DONE)
			{
				if (GameObject* pChest = instance->GetGameObject(FreyaGiftGUID))
					if (pChest && !pChest->isSpawned())
						pChest->SetRespawnTime(350000000);
			}
			break;
		case TYPE_HODIR:
			m_auiEncounter[uiType] = uiData;
			for (std::vector<Creature*>::iterator itr = HodirTrashs.begin(); itr != HodirTrashs.end();++itr)
					if((*itr) && (*itr)->isAlive())
						(*itr)->SetRespawnDelay(7*RESPAWN_ONE_DAY);
			if(uiData == NOT_STARTED)
			{
				for(std::vector<Creature*>::const_iterator itr = HodirAdds.begin(); itr != HodirAdds.end(); ++itr)
					(*itr)->Respawn();
			}
			else if(uiData == DONE)
			{
				CloseDoor(HodirDoorGUID);
				OpenDoor(HodirExitDoor1GUID);
				OpenDoor(HodirExitDoor2GUID);
			}
			else if(uiData == IN_PROGRESS)
			{
				OpenDoor(HodirDoorGUID);
			}
			break;
		case TYPE_KOLOGARN:
			m_auiEncounter[5] = uiData;
			if (uiData == DONE)
			{
				if (GameObject* pChest = instance->GetGameObject(m_uiKologarnLootGUID))
					if (pChest && !pChest->isSpawned())
						pChest->SetRespawnTime(350000000);
				if (GameObject* pBridge = instance->GetGameObject(m_uiKologarnBridgeGUID))
					pBridge->SetGoState(GO_STATE_READY);

				for (std::vector<Creature*>::iterator itr = KologarnTrashs.begin(); itr != KologarnTrashs.end();++itr)
					if((*itr) && (*itr)->isAlive())
						(*itr)->SetRespawnDelay(7*RESPAWN_ONE_DAY);

				CloseDoor(KologarnDoorGUID);
			}
			else if(uiData == IN_PROGRESS)
				OpenDoor(KologarnDoorGUID);
			break;
		case DATA_THORIM_ORB:
		{
			Unit* target = NULL;
			if(thisMap)
			{
				Map::PlayerList const& lPlayers = thisMap->GetPlayers();
				if (!lPlayers.isEmpty())
					for(Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr)
						if (Player* pPlayer = itr->getSource())
							if(pPlayer->isAlive())
								target = pPlayer;
			}
			for (std::vector<Creature*>::iterator itr = ThorimThunderOrbs.begin(); itr != ThorimThunderOrbs.end();++itr)
				if((*itr) && (*itr)->isAlive())
					(*itr)->CastSpell(target,62470,false);
			break;
		}
		case DATA_THORIM_ADDS:
		{
			for (std::vector<Creature*>::iterator itr = ThorimAdds.begin(); itr != ThorimAdds.end();++itr)
				if((*itr))
					(*itr)->Respawn();
			break;
		}
		case DATA_YOGG_NUAGE:
		{
			for (std::vector<Creature*>::iterator itr = YoggNuage.begin(); itr != YoggNuage.end();++itr)
			{
				if(uiData == 0)
					(*itr)->SetPhaseMask(0x1,true);
				else
				{
					(*itr)->SetPhaseMask(0x2,true);
				}
			}

			DespawnCreatures(YoggAdds);
			DespawnCreatures(YoggTentacles);
			break;
		}
		case DATA_YOGG_END_PORTALS:
		{
			for (std::vector<uint64>::iterator itr = YoggEndPortals.begin(); itr != YoggEndPortals.end();++itr)
			{
				if(GameObject* go = GetGoInMap(*itr))
				{
					if(uiData == 0)
						go->SetPhaseMask(0x1,true);
					else
						go->SetPhaseMask(0x2,true);
				}
			}
			break;
		}
		case DATA_IGNIS_ADD_MONO:
		{
			if(IgnisAddTimedActivate == 0)
				IgnisHFReset_Timer = 5000;
			IgnisAddTimedActivate++;
			break;
		}
		case DATA_YOGG_TENTACLES_FROZEN:
		{
			if(uiData == 0)
				TentaclesCanAttack = false;
			else
				TentaclesCanAttack = true;
			break;
		}
		case DATA_YOGGBRAIN_DOOR:
		{
			switch(uiData)
			{
				case 0:
					CloseDoor(YoggBrainDoor1GUID);
					CloseDoor(YoggBrainDoor2GUID);
					CloseDoor(YoggBrainDoor2GUID);
					break;
				case 1:
					OpenDoor(YoggBrainDoor1GUID);
					break;
				case 2:
					OpenDoor(YoggBrainDoor2GUID);
					break;
				case 3:
					OpenDoor(YoggBrainDoor3GUID);
					break;
			}
			break;
		}
    }

    if (uiData == DONE)
    {
        OUT_SAVE_INST_DATA;

        std::ostringstream saveStream;

        for(uint8 i = 0; i < MAX_ENCOUNTER; ++i)
            saveStream << m_auiEncounter[i] << " ";

        m_strInstData = saveStream.str();

        SaveToDB();
        OUT_SAVE_INST_DATA_COMPLETE;
    }
}
示例#27
0
    void SetData(uint32 uiType, uint32 uiData)
    {
        switch(uiType)
        {
        case TYPE_LEVIATHAN:
            m_auiEncounter[0] = uiData;
            DoUseDoorOrButton(m_uiShieldWallGUID);
            if (uiData == DONE)
            {
                OpenDoor(m_uiXT002GateGUID);
                //OpenDoor(m_uiLeviathanGateGUID);
            }
            break;
        case TYPE_IGNIS:
            m_auiEncounter[1] = uiData;
            OpenXtDoor();       // remove when leviathan implemented
            break;
        case TYPE_RAZORSCALE:
            m_auiEncounter[2] = uiData;
            OpenXtDoor();       // remove when leviathan implemented
            break;
        case TYPE_XT002:
            m_auiEncounter[3] = uiData;
            if (uiData == DONE)
                OpenDoor(m_uiXT002GateGUID);
            else if (uiData == IN_PROGRESS)
                CloseDoor(m_uiXT002GateGUID);
            break;
        case TYPE_ASSEMBLY:
            m_auiEncounter[4] = uiData;
            if (uiData == DONE)
            {
                OpenDoor(m_uiIronCouncilDoorGUID);
                OpenDoor(m_uiArchivumDoorGUID);
                CheckIronCouncil();		// used for a hacky achiev, remove for revision!
            } else if (uiData == IN_PROGRESS)
                CloseDoor(m_uiIronCouncilDoorGUID);
            break;
        case TYPE_KOLOGARN:
            m_auiEncounter[5] = uiData;
            if (uiData == DONE)
            {
                DoRespawnGameObject(m_uiKologarnLootGUID, 30*MINUTE);
                if(m_auiEncounter[5] == DONE)
                if (GameObject* pGo = instance->GetGameObject(m_uiKologarnBridgeGUID))
                {
                    pGo->SetUInt32Value(GAMEOBJECT_LEVEL, 0);
                    pGo->SetGoState(GO_STATE_READY);
                }
            }
            break;
        case TYPE_AURIAYA:
            m_auiEncounter[6] = uiData;
            if (uiData == DONE)
            {
//                CheckIronCouncil();		// used for a hacky achiev, remove for revision!
                if (GameObject* pGO = instance->GetGameObject(m_uiMimironTramGUID))
                {
                    pGO->SetUInt32Value(GAMEOBJECT_LEVEL, 0);
                    pGO->SetGoState(GO_STATE_READY);
                }
            }
            break;

            // Keepers
        case TYPE_MIMIRON:
            m_auiEncounter[7] = uiData;
            DoUseDoorOrButton(m_uiMimironDoor1GUID);
            DoUseDoorOrButton(m_uiMimironDoor2GUID);
            DoUseDoorOrButton(m_uiMimironDoor3GUID);
            if (uiData == DONE)
            {
                if(m_auiHardBoss[3] != DONE)
                    DoRespawnGameObject(m_uiMimironLootGUID, 30*MINUTE);
                // used to make the friendly keeper visible
                if(Creature* pImage = instance->GetCreature(m_uiMimironImageGUID))
                    pImage->SetVisibility(VISIBILITY_ON);
                OpenMadnessDoor();
                CheckKeepers();		// used for a hacky achiev, remove for revision!
            }
            break;
        case TYPE_HODIR:
            m_auiEncounter[8] = uiData;
            DoUseDoorOrButton(m_uiHodirEnterDoorGUID);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(m_uiHodirWallGUID);
                DoUseDoorOrButton(m_uiHodirExitDoorGUID);
                DoRespawnGameObject(m_uiHodirLootGUID, 30*MINUTE);
                // used to make the friendly keeper visible
                if(Creature* pImage = instance->GetCreature(m_uiHodirImageGUID))
                    pImage->SetVisibility(VISIBILITY_ON);
                OpenMadnessDoor();
                CheckKeepers();		// used for a hacky achiev, remove for revision!
            }
            break;
        case TYPE_THORIM:
            m_auiEncounter[9] = uiData;   
            DoUseDoorOrButton(m_uiArenaEnterDoorGUID);
            if (uiData == IN_PROGRESS)
                DoUseDoorOrButton(m_uiArenaExitDoorGUID);
            if (uiData == DONE)
            {
                if(m_auiHardBoss[5] != DONE)
                    DoRespawnGameObject(m_uiThorimLootGUID, 30*MINUTE);
                // used to make the friendly keeper visible
                if(Creature* pImage = instance->GetCreature(m_uiThorimImageGUID))
                    pImage->SetVisibility(VISIBILITY_ON);
                OpenMadnessDoor();
                CheckKeepers();		// used for a hacky achiev, remove for revision!
            }
            break;
        case TYPE_FREYA:
            m_auiEncounter[10] = uiData;
            if (uiData == DONE)
            {
                // do this in order to see how many elders were alive and spawn the correct chest
                if(m_auiHardBoss[6] == 0)
                    DoRespawnGameObject(m_uiFreyaLootGUID, 30*MINUTE);
                else if(m_auiHardBoss[6] == 1)
                    DoRespawnGameObject(m_uiFreyaLoot1GUID, 30*MINUTE);
                else if(m_auiHardBoss[6] == 2)
                    DoRespawnGameObject(m_uiFreyaLoot2GUID, 30*MINUTE);
                else if(m_auiHardBoss[6] == 3)
                    DoRespawnGameObject(m_uiFreyaLoot3GUID, 30*MINUTE);
                // used to make the friendly keeper visible
                if(Creature* pImage = instance->GetCreature(m_uiFreyaImageGUID))
                    pImage->SetVisibility(VISIBILITY_ON);
                OpenMadnessDoor();
                CheckKeepers();		// used for a hacky achiev, remove for revision!
            }
            break;

            // Prison
        case TYPE_VEZAX:
            m_auiEncounter[11] = uiData;
            //if (uiData == DONE)
                //DoUseDoorOrButton(m_uiVezaxGateGUID);
            break;
        case TYPE_YOGGSARON:
            m_auiEncounter[12] = uiData;
            //DoUseDoorOrButton(m_uiYoggGateGUID);
            break;

            // Celestial Planetarium
        case TYPE_ALGALON:
            m_auiEncounter[13] = uiData;
            DoUseDoorOrButton(m_uiCelestialDoorGUID);
            DoUseDoorOrButton(m_uiUniverseFloorCelestialGUID);
            if (uiData == DONE)
                DoRespawnGameObject(m_uiAlagonLootGUID, 30*MINUTE);
            break;

            // Hard modes
        case TYPE_LEVIATHAN_HARD:
            m_auiHardBoss[0] = uiData;  // todo: add extra loot
            break;
        case TYPE_XT002_HARD:
            m_auiHardBoss[1] = uiData;  // hard mode loot in sql -> hacky way
            break;
        case TYPE_HODIR_HARD:
            m_auiHardBoss[4] = uiData;
            if(uiData == DONE)
                DoRespawnGameObject(m_uiHodirRareLootGUID, 30*MINUTE);
            break;
        case TYPE_ASSEMBLY_HARD:
            m_auiHardBoss[2] = uiData;  // hard mode loot in sql
            break;
        case TYPE_FREYA_HARD:
            m_auiHardBoss[6] = uiData;  // hard mode loot in the script above
            break;
        case TYPE_THORIM_HARD:
            m_auiHardBoss[5] = uiData;
            if(uiData == DONE)
                DoRespawnGameObject(m_uiThorimRareLootGUID, 30*MINUTE);
            break;
        case TYPE_MIMIRON_HARD:
            m_auiHardBoss[3] = uiData;
            if(uiData == DONE)
                DoRespawnGameObject(m_uiMimironHardLootGUID, 30*MINUTE);
            break;
        case TYPE_VEZAX_HARD:
            m_auiHardBoss[7] = uiData;  // hard mode loot in sql -> hacky way
            break;
        case TYPE_YOGGSARON_HARD:
            m_auiHardBoss[8] = uiData;  // todo: add extra loot
            break;

            // Ulduar keepers
        case TYPE_KEEPER_HODIR:
            m_auiUlduarKeepers[0] = uiData;
            break;
        case TYPE_KEEPER_THORIM:
            m_auiUlduarKeepers[1] = uiData;
            break;
        case TYPE_KEEPER_FREYA:
            m_auiUlduarKeepers[2] = uiData;
            break;
        case TYPE_KEEPER_MIMIRON:
            m_auiUlduarKeepers[3] = uiData;
            break;

            // teleporters
        case TYPE_LEVIATHAN_TP:
            m_auiUlduarTeleporters[0] = uiData;
            break;
        case TYPE_XT002_TP:
            m_auiUlduarTeleporters[1] = uiData;
            break;
        case TYPE_MIMIRON_TP:
            m_auiUlduarTeleporters[2] = uiData;
            break;

            // mini boss
        case TYPE_RUNIC_COLOSSUS:
            m_auiMiniBoss[0] = uiData;
            if (uiData == DONE)
                OpenDoor(m_uiHallwayDoorGUID);
            else
                CloseDoor(m_uiHallwayDoorGUID);
            break;
        case TYPE_RUNE_GIANT:
            m_auiMiniBoss[1] = uiData;
            if (uiData == DONE)
                OpenDoor(m_uiThorimEnterDoorGUID);
            else
                CloseDoor(m_uiThorimEnterDoorGUID);
            break;
        case TYPE_LEVIATHAN_MK:
            m_auiMiniBoss[2] = uiData;
            break;
        case TYPE_VX001:
            m_auiMiniBoss[3] = uiData;
            if (uiData == DONE)     // just for animation :)
            {
                for(uint8 i = 0; i < 9; i++)
                    DoUseDoorOrButton(m_uiMimironTelGUID[i]);
            }
            break;
        case TYPE_AERIAL_UNIT:
            m_auiMiniBoss[4] = uiData;
            break;
        case TYPE_YOGG_BRAIN:
            m_auiMiniBoss[5] = uiData;
            break;

            //phases
        case TYPE_MIMIRON_PHASE:
            m_uiMimironPhase = uiData;
            break;
        case TYPE_YOGG_PHASE:
            m_uiYoggPhase = uiData;
            break;
        case TYPE_VISION_PHASE:
            m_uiVisionPhase = uiData;
            break;
        }

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

            // save all encounters, hard bosses and keepers
            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_auiHardBoss[0] << " " 
                << m_auiHardBoss[1] << " " << m_auiHardBoss[2] << " " << m_auiHardBoss[2] << " "
                << m_auiHardBoss[4] << " " << m_auiHardBoss[5] << " " << m_auiHardBoss[6] << " "
                << m_auiHardBoss[7] << " " << m_auiHardBoss[8] << " " << m_auiUlduarKeepers[0] << " "
                << m_auiUlduarKeepers[1] << " " << m_auiUlduarKeepers[2] << " " << m_auiUlduarKeepers[3] << " "
                << m_auiUlduarTeleporters[0] << " " << m_auiUlduarTeleporters[1] << " " << m_auiUlduarTeleporters[2];

            m_strInstData = saveStream.str();

            SaveToDB();
            OUT_SAVE_INST_DATA_COMPLETE;
        }
    }
            bool SetBossState(uint32 type, EncounterState state)
            {
                if (!InstanceScript::SetBossState(type, state))
                    return false;

                switch (type)
                {
                    case BOSS_BEASTS:
                        break;
                    case BOSS_JARAXXUS:
                        // Cleanup Icehowl
                        if (Creature* icehowl = instance->GetCreature(IcehowlGUID))
                            icehowl->DespawnOrUnsummon();
                        if (state == DONE)
                            EventStage = 2000;
                        break;
                    case BOSS_CRUSADERS:
                        // Cleanup Jaraxxus
                        if (Creature* jaraxxus = instance->GetCreature(JaraxxusGUID))
                            jaraxxus->DespawnOrUnsummon();
                        if (Creature* fizzlebang = instance->GetCreature(FizzlebangGUID))
                            fizzlebang->DespawnOrUnsummon();
                        switch (state)
                        {
                            case IN_PROGRESS:
                                ResilienceWillFixItTimer = 0;
                                break;
                            case SPECIAL: //Means the first blood
                                ResilienceWillFixItTimer = 60*IN_MILLISECONDS;
                                state = IN_PROGRESS;
                                break;
                            case DONE:
                                DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_DEFEAT_FACTION_CHAMPIONS);
                                if (ResilienceWillFixItTimer > 0)
                                    DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_CHAMPIONS_KILLED_IN_MINUTE);
                                DoRespawnGameObject(CrusadersCacheGUID, 7*DAY);
                                if (GameObject* cache = instance->GetGameObject(CrusadersCacheGUID))
                                    cache->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
                                EventStage = 3100;
                                break;
                            default:
                                break;
                        }
                        break;
                    case BOSS_VALKIRIES:
                        // Cleanup chest
                        if (GameObject* cache = instance->GetGameObject(CrusadersCacheGUID))
                            cache->Delete();
                        switch (state)
                        {
                            case FAIL:
                                if (GetBossState(BOSS_VALKIRIES) == NOT_STARTED)
                                    state = NOT_STARTED;
                                break;
                            case SPECIAL:
                                if (GetBossState(BOSS_VALKIRIES) == SPECIAL)
                                    state = DONE;
                                break;
                            case DONE:
                                if (instance->GetPlayers().getFirst()->getSource()->GetTeam() == ALLIANCE)
                                    EventStage = 4020;
                                else
                                    EventStage = 4030;
                                break;
                            default:
                                break;
                        }
                        break;
                    case BOSS_LICH_KING:
                        break;
                    case BOSS_ANUBARAK:
                        switch (state)
                        {
                            case DONE:
                            {
                                EventStage = 6000;
                                uint32 tributeChest = 0;
                                if (instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_HEROIC)
                                {
                                    if (TrialCounter >= 50)
                                        tributeChest = GO_TRIBUTE_CHEST_10H_99;
                                    else
                                    {
                                        if (TrialCounter >= 45)
                                            tributeChest = GO_TRIBUTE_CHEST_10H_50;
                                        else
                                        {
                                            if (TrialCounter >= 25)
                                                tributeChest = GO_TRIBUTE_CHEST_10H_45;
                                            else
                                                tributeChest = GO_TRIBUTE_CHEST_10H_25;
                                        }
                                    }
                                }
                                else if (instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_HEROIC)
                                {
                                    if (TrialCounter >= 50)
                                        tributeChest = GO_TRIBUTE_CHEST_25H_99;
                                    else
                                    {
                                        if (TrialCounter >= 45)
                                            tributeChest = GO_TRIBUTE_CHEST_25H_50;
                                        else
                                        {
                                            if (TrialCounter >= 25)
                                                tributeChest = GO_TRIBUTE_CHEST_25H_45;
                                            else
                                                tributeChest = GO_TRIBUTE_CHEST_25H_25;
                                        }
                                    }
                                }

                                if (tributeChest)
                                    if (Creature* tirion =  instance->GetCreature(TirionGUID))
                                        if (GameObject* chest = tirion->SummonGameObject(tributeChest, 805.62f, 134.87f, 142.16f, 3.27f, 0, 0, 0, 0, WEEK))
                                            chest->SetRespawnTime(chest->GetRespawnDelay());
                                break;
                            }
                            default:
                                break;
                        }
                        break;
                    default:
                        break;
                }

                if (IsEncounterInProgress())
                {
                    CloseDoor(GetData64(GO_EAST_PORTCULLIS));
                    CloseDoor(GetData64(GO_WEB_DOOR));
                }
                else
                {
                    OpenDoor(GetData64(GO_EAST_PORTCULLIS));
                    OpenDoor(GetData64(GO_WEB_DOOR));
                }

                if (type < MAX_ENCOUNTERS)
                {
                    TC_LOG_INFO(LOG_FILTER_TSCR, "[ToCr] BossState(type %u) %u = state %u;", type, GetBossState(type), state);
                    if (state == FAIL)
                    {
                        if (instance->IsHeroic())
                        {
                            --TrialCounter;
                            // decrease attempt counter at wipe
                            Map::PlayerList const &PlayerList = instance->GetPlayers();
                            for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr)
                                if (Player* player = itr->getSource())
                                    player->SendUpdateWorldState(UPDATE_STATE_UI_COUNT, TrialCounter);

                            // if theres no more attemps allowed
                            if (!TrialCounter)
                            {
                                if (Unit* announcer = instance->GetCreature(GetData64(NPC_BARRENT)))
                                    announcer->ToCreature()->DespawnOrUnsummon();

                                if (Creature* anubArak = instance->GetCreature(GetData64(NPC_ANUBARAK)))
                                    anubArak->DespawnOrUnsummon();
                            }
                        }
                        NeedSave = true;
                        EventStage = (type == BOSS_BEASTS ? 666 : 0);
                        state = NOT_STARTED;
                    }

                    if (state == DONE || NeedSave)
                    {
                        if (Unit* announcer = instance->GetCreature(GetData64(NPC_BARRENT)))
                            announcer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
                        Save();
                    }
                }
                return true;
            }
        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 uiType, uint32 uiData)
        {
            switch(uiType)
            {
                case TYPE_JARAXXUS:
                    if (uiData == DONE) m_uiEvent = 2000;
                    break;
                case TYPE_CRUSADERS:
                    switch (uiData)
                    {
                        case IN_PROGRESS: m_uiResilienceWillFixItTimer = 0; break;
                        case SPECIAL: //Means the first blood
                            m_uiResilienceWillFixItTimer = 60*IN_MILLISECONDS;
                            uiData = IN_PROGRESS;
                            break;
                        case DONE:
                            DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_DEFEAT_FACTION_CHAMPIONS);
                            if (m_uiResilienceWillFixItTimer > 0)
                                DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_CHAMPIONS_KILLED_IN_MINUTE);
                            if (GameObject* pChest = instance->GetGameObject(m_uiCrusadersCacheGUID))
                                if (pChest && !pChest->isSpawned())
                                    pChest->SetRespawnTime(7*DAY);
                            m_uiEvent = 3100;
                            break;
                    }
                    break;
                case TYPE_VALKIRIES:
                    switch (uiData)
                    {
                        case FAIL:
                            if (m_auiEncounter[TYPE_VALKIRIES] == NOT_STARTED) uiData = NOT_STARTED;
                            break;
                        case SPECIAL:
                            if (m_auiEncounter[TYPE_VALKIRIES] == SPECIAL) uiData = DONE;
                            break;
                        case DONE:
                            if (instance->GetPlayers().getFirst()->getSource()->GetTeam() == ALLIANCE)
                                m_uiEvent = 4020;
                            else
                                m_uiEvent = 4030;
                            break;
                    }
                    break;
                case TYPE_ANUBARAK:
                    switch (uiData)
                    {
                        case DONE:
                            m_uiEvent = 6000;
                            break;
                        case SPECIAL:
                            uint32 tributeChest = 0;
                            if (instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_HEROIC)
                            {
                                if (m_uiTrialCounter >= 50)
                                    tributeChest = GO_TRIBUTE_CHEST_10H_99;
                                else
                                    if (m_uiTrialCounter >= 45)
                                        tributeChest = GO_TRIBUTE_CHEST_10H_50;
                                    else
                                        if (m_uiTrialCounter >= 25)
                                            tributeChest = GO_TRIBUTE_CHEST_10H_45;
                                        else
                                            tributeChest = GO_TRIBUTE_CHEST_10H_25;
                            }
                            else if (instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_HEROIC)
                            {
                                if (m_uiTrialCounter >= 50)
                                    tributeChest = GO_TRIBUTE_CHEST_25H_99;
                                else
                                    if (m_uiTrialCounter >= 45)
                                        tributeChest = GO_TRIBUTE_CHEST_25H_50;
                                    else
                                        if (m_uiTrialCounter >= 25)
                                            tributeChest = GO_TRIBUTE_CHEST_25H_45;
                                        else
                                            tributeChest = GO_TRIBUTE_CHEST_25H_25;
                            }
                            if (tributeChest)
                                if (Creature* pTirion =  instance->GetCreature(m_uiTirionGUID))
                                    if (GameObject* pChest = pTirion->SummonGameObject(tributeChest, 805.62f, 134.87f, 142.16f, 3.27f, 0, 0, 0, 0, 90000000))
                                        pChest->SetRespawnTime(pChest->GetRespawnDelay());
                            break;
                    }
                    break;
                case TYPE_COUNTER:   m_uiTrialCounter = uiData; uiData = DONE; break;
                case TYPE_EVENT:     m_uiEvent = uiData; uiData = NOT_STARTED; break;
                case TYPE_EVENT_TIMER:      m_uiEventTimer = uiData; uiData = NOT_STARTED; break;
                case TYPE_NORTHREND_BEASTS:
                    m_uiNorthrendBeasts = uiData;
                    switch (uiData)
                    {
                        case GORMOK_DONE:
                            m_uiEvent = 200;
                            SetData(TYPE_NORTHREND_BEASTS, IN_PROGRESS);
                            SetData(TYPE_BEASTS, IN_PROGRESS);
                            break;
                        case SNAKES_IN_PROGRESS: m_uiNotOneButTwoJormungarsTimer = 0; break;
                        case SNAKES_SPECIAL: m_uiNotOneButTwoJormungarsTimer = 10*IN_MILLISECONDS; break;
                        case SNAKES_DONE:
                            if (m_uiNotOneButTwoJormungarsTimer > 0)
                                DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_WORMS_KILLED_IN_10_SECONDS);
                            m_uiEvent = 300;
                            SetData(TYPE_NORTHREND_BEASTS, IN_PROGRESS);
                            SetData(TYPE_BEASTS, IN_PROGRESS);
                            break;
                        case ICEHOWL_DONE:
                            m_uiEvent = 400;
                            SetData(TYPE_NORTHREND_BEASTS, DONE);
                            SetData(TYPE_BEASTS, DONE);
                            break;
                        case FAIL:
                            SetData(TYPE_BEASTS, FAIL);
                            break;
                    }
                    break;
                case DATA_HEALTH_TWIN_SHARED:     m_uiDataDamageTwin = uiData; uiData = NOT_STARTED; break;

                //Achievements
                case DATA_SNOBOLD_COUNT:
                    if (uiData == INCREASE)
                        ++m_uiSnoboldCount;
                    else if (uiData == DECREASE)
                        --m_uiSnoboldCount;
                    break;
                case DATA_MISTRESS_OF_PAIN_COUNT:
                    if (uiData == INCREASE)
                        ++m_uiMistressOfPainCount;
                    else if (uiData == DECREASE)
                        --m_uiMistressOfPainCount;
                    break;
                case DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE:
                    m_bTributeToImmortalityElegible = false;
                    break;
            }
            if (IsEncounterInProgress())
            {
                CloseDoor(GetData64(GO_EAST_PORTCULLIS));
                CloseDoor(GetData64(GO_WEB_DOOR));
            } else {
                OpenDoor(GetData64(GO_EAST_PORTCULLIS));
                OpenDoor(GetData64(GO_WEB_DOOR));
            }

            if (uiType < MAX_ENCOUNTERS)
            {
                sLog->outBasic("[ToCr] m_auiEncounter[uiType %u] %u = uiData %u;", uiType, m_auiEncounter[uiType], uiData);
                if (uiData == FAIL)
                {
                    if (IsRaidWiped())
                    {
                        --m_uiTrialCounter;
                        m_bNeedSave = true;
                        m_uiEvent = (uiType == TYPE_BEASTS? 666 : 0);
                    }
                    uiData = NOT_STARTED;
                }
                m_auiEncounter[uiType] = uiData;

                if (uiData == DONE || m_bNeedSave == true)
                {
                    if (Unit* pAnnouncer = instance->GetCreature(GetData64(NPC_BARRENT)))
                        pAnnouncer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
                    Save();
                }
            }
        }