예제 #1
0
        /// <summary>
        /// Loads the room.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns>Room.</returns>
        internal Room LoadRoom(uint id)
        {
            if (LoadedRooms.ContainsKey(id))
            {
                return(GetRoom(id));
            }

            var roomData = GenerateRoomData(id);

            if (roomData == null)
            {
                return(null);
            }
            if (LoadedRooms.ContainsKey(id))
            {
                return(GetRoom(id));
            }

            var room = new Room();

            LoadedRooms.AddOrUpdate(id, room, (key, value) => room);
            room.Start(roomData);

            Out.WriteLine(string.Format("Room '{0}' [{1}] was loaded!", room.RoomData.Name, id), "", ConsoleColor.DarkCyan);

            room.InitBots();
            room.InitPets();

            if (room.RoomData.Description.Contains("BOXING"))
            {
                room.SoloQueue = new SoloQueueRoom(room);
                Out.WriteLine(string.Format("Room '{0}' [{1}] is a boxing room!", room.RoomData.Name, id), "", ConsoleColor.DarkCyan);
            }

            if (room.RoomId == ColourManager.GameLobby && ColourManager.LobbyLoop == null)
            {
                ColourManager.LobbyLoop    = new ShittyLoopForYing(room);
                ColourManager.LobbyLoop.On = true;
            }

            if (room.RoomData.Description.Contains("MAFIAWARLOBBY") && Plus.GetGame().MafiaWars.LobbyLoop == null)
            {
                Plus.GetGame().MafiaWars.LobbyLoop = new HabboHotel.Roleplay.Minigames.Mafia_Wars.MWLoop(room);
                Plus.GetGame().MafiaWars.LobbyLoop.On = true;
            }

            if (room.RoomData.Description.Contains("SPACE") && spaceManager.initiated == false)
            {
                spaceManager.initSpace();
                spaceManager.initiated = true;
            }

            if (room.RoomData.Description.Contains("TREES") && woodManager.initiated == false)
            {
                woodManager.initTrees();
                woodManager.initiated = true;
            }

            if (room.RoomData.Description.Contains("FARM") && farmingManager.initiated == false)
            {
                farmingManager.init();
                farmingManager.initiated = true;
            }

            if (room.RoomData.Description.Contains("CASINO") && SlotsManager.initiated == false)
            {
                SlotsManager.init();
                SlotsManager.initiated = true;
            }
            return(room);
        }