Пример #1
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);
        }
Пример #2
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);
            }
        }