Example #1
0
        /// <summary>
        /// Generates the room data.
        /// </summary>
        /// <param name="roomId">The room identifier.</param>
        /// <returns>RoomData.</returns>
        internal RoomData GenerateRoomData(uint roomId)
        {
            if (LoadedRoomData.ContainsKey(roomId))
            {
                LoadedRoomData[roomId].LastUsed = DateTime.Now;
                return(LoadedRoomData[roomId]);
            }

            var roomData = new RoomData();

            if (LoadedRooms.ContainsKey(roomId))
            {
                return(GetRoom(roomId).RoomData);
            }

            using (var queryReactor = Plus.GetDatabaseManager().GetQueryReactor())
            {
                queryReactor.SetQuery(string.Format("SELECT * FROM rooms_data WHERE id = {0} LIMIT 1", roomId));

                DataRow dataRow = queryReactor.GetRow();
                if (dataRow == null)
                {
                    return(null);
                }

                roomData.Fill(dataRow);
            }

            LoadedRoomData.TryAdd(roomId, roomData);

            return(roomData);
        }
Example #2
0
        public RoomData GenerateRoomData(int RoomId)
        {
            if (_loadedRoomData.ContainsKey(RoomId))
            {
                return(_loadedRoomData[RoomId]);
            }

            var  Data = new RoomData();
            Room Room;

            if (TryGetRoom(RoomId, out Room))
            {
                return(Room.RoomData);
            }

            DataRow Row = null;

            using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT * FROM rooms WHERE id = " + RoomId + " LIMIT 1");
                Row = dbClient.GetRow();
            }
            if (Row == null)
            {
                return(null);
            }

            Data.Fill(Row);
            if (!_loadedRoomData.ContainsKey(RoomId))
            {
                _loadedRoomData.TryAdd(RoomId, Data);
            }
            return(Data);
        }
Example #3
0
        /// <summary>
        /// Fetches the room data.
        /// </summary>
        /// <param name="roomId">The room identifier.</param>
        /// <param name="dRow">The d row.</param>
        /// <returns>RoomData.</returns>
        internal RoomData FetchRoomData(uint roomId, DataRow dRow)
        {
            if (LoadedRoomData.ContainsKey(roomId))
            {
                LoadedRoomData[roomId].LastUsed = DateTime.Now;
                return(LoadedRoomData[roomId]);
            }
            var roomData = new RoomData();

            roomData.Fill(dRow);
            LoadedRoomData.TryAdd(roomId, roomData);
            return(roomData);
        }
Example #4
0
        public RoomData FetchRoomData(int RoomId, DataRow dRow)
        {
            if (_loadedRoomData.ContainsKey(RoomId))
            {
                return(_loadedRoomData[RoomId]);
            }

            var data = new RoomData();

            data.Fill(dRow);
            if (!_loadedRoomData.ContainsKey(RoomId))
            {
                _loadedRoomData.TryAdd(RoomId, data);
            }
            return(data);
        }
Example #5
0
        public RoomData GenerateRoomData(int RoomId)
        {
            if (_loadedRoomData.ContainsKey(RoomId))
            {
                return((RoomData)_loadedRoomData[RoomId]);
            }

            RoomData Data = new RoomData();

            Room Room;

            if (TryGetRoom(RoomId, out Room))
            {
                return(Room.RoomData);
            }

            DataRow Row   = null;
            DataRow RPRow = null;

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT * FROM `rooms` WHERE `id` = " + RoomId + " LIMIT 1");
                Row = dbClient.getRow();

                dbClient.SetQuery("SELECT * FROM `rp_rooms` WHERE `id` = " + RoomId + " LIMIT 1");
                RPRow = dbClient.getRow();
            }

            if (Row == null || RPRow == null)
            {
                return(null);
            }

            Data.Fill(Row);
            Data.FillRP(RPRow);

            if (!_loadedRoomData.ContainsKey(RoomId))
            {
                _loadedRoomData.TryAdd(RoomId, Data);
            }

            return(Data);
        }
Example #6
0
        public RoomData FetchRoomData(int RoomId, DataRow dRow, DataRow dRowRP)
        {
            if (_loadedRoomData.ContainsKey(RoomId))
            {
                return((RoomData)_loadedRoomData[RoomId]);
            }
            else
            {
                RoomData data = new RoomData();

                data.Fill(dRow);
                data.FillRP(dRowRP);

                if (!_loadedRoomData.ContainsKey(RoomId))
                {
                    _loadedRoomData.TryAdd(RoomId, data);
                }
                return(data);
            }
        }
Example #7
0
        public RoomData GenerateRoomData(int RoomId)
        {
            if (_loadedRoomData.ContainsKey(RoomId))
                return (RoomData)_loadedRoomData[RoomId];

            RoomData Data = new RoomData();

            Room Room;

            if (TryGetRoom(RoomId, out Room))
                return Room.RoomData;

            DataRow Row = null;
            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT * FROM rooms WHERE id = " + RoomId + " LIMIT 1");
                Row = dbClient.getRow();
            }

            if (Row == null)
                return null;

            Data.Fill(Row);

            if (!_loadedRoomData.ContainsKey(RoomId))
                _loadedRoomData.TryAdd(RoomId, Data);

            return Data;
        }
Example #8
0
        public RoomData FetchRoomData(int RoomId, DataRow dRow)
        {
            if (_loadedRoomData.ContainsKey(RoomId))
                return (RoomData)_loadedRoomData[RoomId];
            else
            {
                RoomData data = new RoomData();

                data.Fill(dRow);

                if (!_loadedRoomData.ContainsKey(RoomId))
                    _loadedRoomData.TryAdd(RoomId, data);
                return data;
            }
        }