Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("userID,roomID")] RoomAccess roomAccess)
        {
            if (id != roomAccess.roomID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(roomAccess);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RoomAccessExists(roomAccess.roomID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["roomID"] = new SelectList(_context.Room, "roomID", "roomID", roomAccess.roomID);
            ViewData["userID"] = new SelectList(_context.Set <User>(), "userID", "userID", roomAccess.userID);
            return(View(roomAccess));
        }
Beispiel #2
0
 public Boss()
 {
     RoomAccess.Add(20);
     RoomAccess.Add(2);
     RoomAccess.Add(40);
     RoomAccess.Add(1);
 }
        public void GetListOfGuests()
        {
            // Arrange
            IRoomAccess service = new RoomAccess();
            service.GenerateBasicHotel(3, 2, 3);

            var guest1 = new Guest(fname: "Some", lname: "Body");
            string roomNumber1 = service.GetRoomNumbers()[4];
            service.AssignGuestToRoom(guest1, roomNumber1);

            var guest2 = new Guest(fname: "Noone", lname: "Special");
            string roomNumber2 = service.GetRoomNumbers()[3];
            service.AssignGuestToRoom(guest2, roomNumber2);

            var guest3 = new Guest(fname: "Short", lname: "Timer");
            string roomNumber3 = service.GetRoomNumbers()[5];
            service.AssignGuestToRoom(guest3, roomNumber3);
            service.UnassignGuestFromRoom(guest3, roomNumber3);

            // Act
            List<Guest> list = service.GetGuestList();

            // Assert
            Assert.AreEqual(2, list.Count);
            Assert.AreEqual(1, list.FindAll(guest => guest.FirstName == "Some" && guest.LastName == "Body").Count);
            Assert.AreEqual(1, list.FindAll(guest => guest.FirstName == "Noone" && guest.LastName == "Special").Count);
        }
Beispiel #4
0
        public async Task GetAccessByHotelStaff(int userId, AccessByWorkerDTO workerDTO)
        {
            var room = context.Rooms.Get(workerDTO.RoomId);

            if (room == null)
            {
                throw new NotFoundException("No such room");
            }

            bool       hasPermission = false;
            HotelStaff staff         = context.HotelStaffs.Get(userId);

            room          = context.Rooms.Get(workerDTO.RoomId);
            hasPermission = room.HotelId == staff.Hotel.Id;

            if (!hasPermission)
            {
                throw new PermissionException();
            }

            var  lastAccess = room.RoomAccesses.Where(r => r.UserId == userId).OrderBy(x => x.DateTime).LastOrDefault();
            bool isOpened   = (lastAccess == null) ? true : !lastAccess.IsOpen;
            var  access     = new RoomAccess()
            {
                DateTime      = DateTime.Now,
                IsOpen        = isOpened,
                RoomId        = workerDTO.RoomId,
                UserId        = userId,
                ReasonOfVisit = workerDTO.Reason
            };

            context.RoomAccesses.Create(access);
            await context.SaveAsync();
        }
Beispiel #5
0
        public void Join(string name, string topic, RoomVersion roomVersion)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException(Resources.Client_Join_Cannot_be_empty_or_null, "name");
            }

            if (string.IsNullOrEmpty(topic))
            {
                throw new ArgumentException(Resources.Client_Join_Cannot_be_empty_or_null, "topic");
            }

            if (this._lobby == null)
            {
                throw new ApplicationException("Lobby is null");
            }

            ObjectAdapter adapter = this.Communicator.createObjectAdapter(string.Empty);

            this._jobQueue = new JobQueue();
            Listener  listener    = new ListenerI(this._outputTxtBx, this._jobQueue);
            ObjectPrx listenerPrx = adapter.addWithUUID(listener);

            this._jobQueue.Start();
            adapter.activate();
            this._lobby.ice_getConnection().setAdapter(adapter);

            this._roomAccess = this._lobby.Join(name, topic, listenerPrx.ice_getIdentity());
            this._context    = new Dictionary <string, string> {
                { SESSIONCTXPROP.value, topic }, { AUTHORCTXPROP.value, name }
            };
        }
        public void GetListOfEmptyRooms()
        {
            // Arrange
            IRoomAccess service = new RoomAccess();
            service.GenerateBasicHotel(3, 2, 3);

            var guest1 = new Guest(fname: "Some", lname: "Body");
            string roomNumber1 = service.GetRoomNumbers()[4];
            service.AssignGuestToRoom(guest1, roomNumber1);

            var guest2 = new Guest(fname: "Noone", lname: "Special");
            string roomNumber2 = service.GetRoomNumbers()[3];
            service.AssignGuestToRoom(guest2, roomNumber2);

            var guest3 = new Guest(fname: "Short", lname: "Timer");
            string roomNumber3 = service.GetRoomNumbers()[5];
            service.AssignGuestToRoom(guest3, roomNumber3);
            service.UnassignGuestFromRoom(guest3, roomNumber3);

            // Act
            List<Room> list = service.GetAllEmptyRooms();

            // Assert
            Assert.AreEqual(3*2*3 - 2, list.Count, "Expected number of empty rooms incorrect");
            Assert.IsTrue(list.All(room => room.Guest == null), "Not all rooms returned are empty");
        }
Beispiel #7
0
        public async Task GetAccessByUser(int userId, int roomId)
        {
            var room = context.Rooms.Get(roomId);

            if (room == null)
            {
                throw new NotFoundException("No such room");
            }

            bool  hasPermission = false;
            Guest user          = context.Guests.Get(userId);

            hasPermission = DoesUserHasAccess(userId, roomId);

            if (!hasPermission)
            {
                throw new PermissionException();
            }
            var  lastAccess = room.RoomAccesses.Where(r => r.UserId == userId).OrderBy(x => x.DateTime).LastOrDefault();
            bool isOpened   = (lastAccess == null) ? true : !lastAccess.IsOpen;
            var  access     = new RoomAccess()
            {
                DateTime      = DateTime.Now,
                IsOpen        = isOpened,
                RoomId        = roomId,
                UserId        = userId,
                ReasonOfVisit = ""
            };

            context.RoomAccesses.Create(access);
            await context.SaveAsync();
        }
 public Administrator()
 {
     for (var i = 1; i <= 40; i++)
     {
         RoomAccess.Add(i);
         RoomAccess.Remove(20);
     }
 }
 public Cleaner()
 {
     for (var i = 1; i <= 40; i++)
     {
         RoomAccess.Add(i);
     }
     RoomAccess.Remove(20);
     RoomAccess.Remove(2);
     RoomAccess.Remove(40);
     RoomAccess.Remove(1);
 }
Beispiel #10
0
        public static Dictionary <string, object> GetRoomAccess(RoomAccess roomAccess)
        {
            const string prefix = "RoomAccess";

            return(new Dictionary <string, object>
            {
                { $"{prefix}.Justification", roomAccess.Justification },
                { $"{prefix}.RefusalReason", roomAccess.RefusalReason },
                { $"{prefix}.AccessStatus", roomAccess.AccessStatus }
            });
        }
Beispiel #11
0
 public static RoomAccessDTO ToRoomAccessDTO(this RoomAccess room)
 {
     return(new RoomAccessDTO()
     {
         Id = room.Id,
         RoomId = room.RoomId,
         DateTime = room.DateTime,
         IsOpen = room.IsOpen,
         UserId = room.UserId,
         Reason = room.ReasonOfVisit
     });
 }
Beispiel #12
0
 public Receptionist()
 {
     for (var i = 1; i <= 40; i++)
     {
         RoomAccess.Add(i);
     }
     RoomAccess.Remove(3);
     RoomAccess.Remove(20);
     RoomAccess.Remove(2);
     RoomAccess.Remove(40);
     RoomAccess.Remove(1);
     RoomAccess.Remove(4);
 }
Beispiel #13
0
        public async Task <IActionResult> Create([Bind("userID,roomID")] RoomAccess roomAccess)
        {
            if (ModelState.IsValid)
            {
                _context.Add(roomAccess);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["roomID"] = new SelectList(_context.Room, "roomID", "roomID", roomAccess.roomID);
            ViewData["userID"] = new SelectList(_context.Set <User>(), "userID", "userID", roomAccess.userID);
            return(View(roomAccess));
        }
        public void CheckInGuestIntoNonExistantRoom()
        {
            // Arrange
            IRoomAccess service = new RoomAccess();
            service.GenerateBasicHotel(2, 2, 2);
            var guest = new Guest(fname: "Some", lname: "Body");
            string roomNumber = "IAmNotARoom";

            // Act
            service.AssignGuestToRoom(guest, roomNumber);

            // Assert
            Assert.Fail("Expected exception was not thrown");
        }
        public void Generated2DimensionalHotelHasUniqueRoomNumbers()
        {
            // Arrange
            IRoomAccess service = new RoomAccess();
            const uint x = 10;
            const uint y = 10;
            const uint z = 1;

            // Act
            service.GenerateBasicHotel(x, y, z);

            // Assert
            VerifyThatHotelHasUniqueRoomNumbers(RoomAccess.HotelMap);
        }
        public void Generate3DimensionalHotel()
        {
            // Arrange
            IRoomAccess service = new RoomAccess();
            const uint x = 10;
            const uint y = 10;
            const uint z = 10;

            // Act
            service.GenerateBasicHotel(x, y, z);

            // Assert
            Assert.AreEqual((int) (x*y*z), RoomAccess.HotelMap.Count);
        }
Beispiel #17
0
        private void cbxLoaiPhong_SelectedIndexChanged(object sender, EventArgs e)
        {
            string     loaiPhong = cbxLoaiPhong.GetItemText(cbxLoaiPhong.SelectedItem);
            RoomAccess data      = new RoomAccess();
            DataTable  dt        = new DataTable();

            dt = data.loadIDCost(loaiPhong);
            cbxMaPhong.DisplayMember   = "roomno";
            cbxMaPhong.DataSource      = dt;
            cbxtienPhong.DisplayMember = "price";
            cbxtienPhong.DataSource    = dt;
            txtCostPerDay.Text         = cbxtienPhong.GetItemText(cbxtienPhong.SelectedItem);
            cost = float.Parse(txtCostPerDay.Text);
            caculteMoney();
        }
        public void CheckInGuestIntoEmptyRoom()
        {
            // Arrange
            IRoomAccess service = new RoomAccess();
            service.GenerateBasicHotel(2, 2, 2);
            var guest = new Guest(fname: "Some", lname: "Body");
            string roomNumber = service.GetRoomNumbers()[4];

            // Act
            service.AssignGuestToRoom(guest, roomNumber);

            // Assert
            Assert.AreEqual("Some", RoomAccess.HotelMap.Find(room => room.RoomNumber == roomNumber).Guest.FirstName, "Assigned guest's first name doesn't match");
            Assert.AreEqual("Body", RoomAccess.HotelMap.Find(room => room.RoomNumber == roomNumber).Guest.LastName, "assigned guest's last name doesn't match");
            Assert.IsTrue(RoomAccess.HotelMap.FindAll(room => room.RoomNumber != roomNumber).TrueForAll(room => room.Guest == null),
                          "Guest assigned to wrong rooms");
        }
        public static int GetRoomAccessPacketNum(RoomAccess access)
        {
            switch (access)
            {
            default:
            case RoomAccess.Open:
                return(0);

            case RoomAccess.Doorbell:
                return(1);

            case RoomAccess.Password:
                return(2);

            case RoomAccess.Invisible:
                return(3);
            }
        }
        public static int GetRoomAccessPacketNum(RoomAccess Access)
        {
            switch (Access)
            {
            default:
            case RoomAccess.OPEN:
                return(0);

            case RoomAccess.DOORBELL:
                return(1);

            case RoomAccess.PASSWORD:
                return(2);

            case RoomAccess.INVISIBLE:
                return(3);
            }
        }
Beispiel #21
0
        public static int GetRoomAccessPacketNum(RoomAccess Access)
        {
            switch (Access)
            {
                default:
                case RoomAccess.OPEN:
                    return 0;

                case RoomAccess.DOORBELL:
                    return 1;

                case RoomAccess.PASSWORD:
                    return 2;

                case RoomAccess.INVISIBLE:
                    return 3;
            }
        }
Beispiel #22
0
        public async Task <IActionResult> Create([Bind("RoomID,UserID")] RoomAccess roomAccess)
        {
            if (_context.RoomAccess.Any(ra => ra.UserID == roomAccess.UserID && ra.RoomID == roomAccess.RoomID))
            {
                TempData["Error"] = "That combination already exists";
                return(RedirectToAction("Create"));
            }
            if (ModelState.IsValid)
            {
                _context.Add(roomAccess);
                await _context.SaveChangesAsync();

                TempData["Success"] = "User was successfully linked to room";
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RoomID"] = new SelectList(_context.Room, "RoomID", "Name", roomAccess.RoomID);
            ViewData["UserID"] = new SelectList(_context.Users, "Id", "UserName", roomAccess.UserID);
            return(View(roomAccess));
        }
        public void CheckOutWrongGuestFromRoom()
        {
            // Arrange
            IRoomAccess service = new RoomAccess();
            service.GenerateBasicHotel(2, 2, 2);

            var guest1 = new Guest(fname: "Some", lname: "Body");
            string roomNumber1 = service.GetRoomNumbers()[4];
            service.AssignGuestToRoom(guest1, roomNumber1);

            var guest2 = new Guest(fname: "Noone", lname: "Special");
            string roomNumber2 = service.GetRoomNumbers()[3];
            service.AssignGuestToRoom(guest2, roomNumber2);

            // Act
            service.UnassignGuestFromRoom(guest2, roomNumber1);

            // Assert
            Assert.Fail("Expected exception was not thrown");
        }
        public void CheckOutGuest()
        {
            // Arrange
            IRoomAccess service = new RoomAccess();
            service.GenerateBasicHotel(2, 2, 2);

            var guest1 = new Guest(fname: "Some", lname: "Body");
            string roomNumber1 = service.GetRoomNumbers()[4];
            service.AssignGuestToRoom(guest1, roomNumber1);

            var guest2 = new Guest(fname: "Noone", lname: "Special");
            string roomNumber2 = service.GetRoomNumbers()[3];
            service.AssignGuestToRoom(guest2, roomNumber2);

            // Act
            service.UnassignGuestFromRoom(guest1, roomNumber1);

            // Assert
            Assert.IsNull(RoomAccess.HotelMap.Find(room => room.RoomNumber == roomNumber1).Guest, "Guest still exists in room");
            Assert.AreEqual("Noone", RoomAccess.HotelMap.Find(room => room.RoomNumber == roomNumber2).Guest.FirstName, "Other Guest was checked out");
        }
Beispiel #25
0
        private void btnTraTien_Click(object sender, EventArgs e)
        {
            RoomAccess data = new RoomAccess();

            if (data.CheckOUt(bookingIDaa, customerIDaa, roomNoaa, totaldayaa, totalaa))
            {
                MessageBox.Show("Trả Phòng Thành Công");
                this.Hide();
                Thread t = new Thread(new ThreadStart(showServerForm));
                t.Start();
                this.Close();
            }
            else
            {
                MessageBox.Show("Trả Phòng Không Thành Công");
                this.Hide();
                Thread t = new Thread(new ThreadStart(showServerForm));
                t.Start();
                this.Close();
            }
        }
Beispiel #26
0
        public void Join(string name, string topic, RoomVersion roomVersion)
        {
            if (string.IsNullOrEmpty(name))
                throw new ArgumentException(Resources.Client_Join_Cannot_be_empty_or_null, "name");

            if (string.IsNullOrEmpty(topic))
                throw new ArgumentException(Resources.Client_Join_Cannot_be_empty_or_null, "topic");

            if (this._lobby == null)
                throw new ApplicationException("Lobby is null");

            ObjectAdapter adapter = this.Communicator.createObjectAdapter(string.Empty);
            this._jobQueue = new JobQueue();
            Listener listener = new ListenerI(this._outputTxtBx, this._jobQueue);
            ObjectPrx listenerPrx = adapter.addWithUUID(listener);
            this._jobQueue.Start();
            adapter.activate();
            this._lobby.ice_getConnection().setAdapter(adapter);

            this._roomAccess = this._lobby.Join(name, topic, listenerPrx.ice_getIdentity());
            this._context = new Dictionary<string, string> { { SESSIONCTXPROP.value, topic }, {AUTHORCTXPROP.value, name} };
        }
Beispiel #27
0
        public Payment(int bookingID, string CustomerID, string RoomNo, DateTime CheckInDay, DateTime CheckOutDay, float TotalPay, float PrePay)
        {
            RoomAccess data = new RoomAccess();

            InitializeComponent();
            txtPayBookintID.Text = bookingID.ToString();
            txtPayCustNo.Text    = data.getCusName(CustomerID);
            txtPayRoomNo.Text    = RoomNo;
            txtPayCheckin.Text   = CheckInDay.ToShortDateString();
            txtPayCheckOut.Text  = CheckOutDay.ToShortDateString();
            TimeSpan ngayo = CheckOutDay.Subtract(CheckInDay);

            txtNgayO.Text    = (ngayo.Days + 1).ToString();
            txtPayTotal.Text = TotalPay.ToString();
            txtPayPre.Text   = PrePay.ToString();
            txtConLai.Text   = (TotalPay - PrePay).ToString();

            bookingIDaa  = bookingID;
            customerIDaa = CustomerID;
            roomNoaa     = RoomNo;
            totaldayaa   = ngayo.Days + 1;
            totalaa      = TotalPay;
        }
Beispiel #28
0
 public RoomController(IConfiguration config)
 {
     _roomAccess = new RoomAccess(config);
 }
Beispiel #29
0
        public void Fill(DataRow Row)
        {
            Id = Convert.ToInt32(Row["id"]);
            Name = Convert.ToString(Row["caption"]);
            Description = Convert.ToString(Row["description"]);
            Type = Convert.ToString(Row["roomtype"]);
            OwnerId = Convert.ToInt32(Row["owner"]);

            OwnerName = "";
            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT `username` FROM `users` WHERE `id` = @owner LIMIT 1");
                dbClient.AddParameter("owner", OwnerId);
                string result = dbClient.getString();
                if (!String.IsNullOrEmpty(result))
                    OwnerName = result;
            }

            this.Access = RoomAccessUtility.ToRoomAccess(Row["state"].ToString().ToLower());

            Category = Convert.ToInt32(Row["category"]);
            if (!string.IsNullOrEmpty(Row["users_now"].ToString()))
                UsersNow = Convert.ToInt32(Row["users_now"]);
            else
                UsersNow = 0;
            UsersMax = Convert.ToInt32(Row["users_max"]);
            ModelName = Convert.ToString(Row["model_name"]);
            Score = Convert.ToInt32(Row["score"]);
            Tags = new List<string>();
            AllowPets = Convert.ToInt32(Row["allow_pets"].ToString());
            AllowPetsEating = Convert.ToInt32(Row["allow_pets_eat"].ToString());
            RoomBlockingEnabled = Convert.ToInt32(Row["room_blocking_disabled"].ToString());
            Hidewall = Convert.ToInt32(Row["allow_hidewall"].ToString());
            Password = Convert.ToString(Row["password"]);
            Wallpaper = Convert.ToString(Row["wallpaper"]);
            Floor = Convert.ToString(Row["floor"]);
            Landscape = Convert.ToString(Row["landscape"]);
            FloorThickness = Convert.ToInt32(Row["floorthick"]);
            WallThickness = Convert.ToInt32(Row["wallthick"]);
            WhoCanMute = Convert.ToInt32(Row["mute_settings"]);
            WhoCanKick = Convert.ToInt32(Row["kick_settings"]);
            WhoCanBan = Convert.ToInt32(Row["ban_settings"]);
            chatMode = Convert.ToInt32(Row["chat_mode"]);
            chatSpeed = Convert.ToInt32(Row["chat_speed"]);
            chatSize = Convert.ToInt32(Row["chat_size"]);
            TradeSettings = Convert.ToInt32(Row["trade_settings"]);

            Group G = null;
            if (PlusEnvironment.GetGame().GetGroupManager().TryGetGroup(Convert.ToInt32(Row["group_id"]), out G))
                Group = G;
            else
                Group = null;

            foreach (string Tag in Row["tags"].ToString().Split(','))
            {
                Tags.Add(Tag);
            }

            mModel = PlusEnvironment.GetGame().GetRoomManager().GetModel(ModelName);

            this.PushEnabled = PlusEnvironment.EnumToBool(Row["push_enabled"].ToString());
            this.PullEnabled = PlusEnvironment.EnumToBool(Row["pull_enabled"].ToString());
            this.SPushEnabled = PlusEnvironment.EnumToBool(Row["spush_enabled"].ToString());
            this.SPullEnabled = PlusEnvironment.EnumToBool(Row["spull_enabled"].ToString());
            this.EnablesEnabled = PlusEnvironment.EnumToBool(Row["enables_enabled"].ToString());
            this.RespectNotificationsEnabled = PlusEnvironment.EnumToBool(Row["respect_notifications_enabled"].ToString());
            this.PetMorphsAllowed = PlusEnvironment.EnumToBool(Row["pet_morphs_allowed"].ToString());
        }
Beispiel #30
0
        public void Fill(DataRow Row)
        {
            Id          = Convert.ToInt32(Row["id"]);
            Name        = Convert.ToString(Row["caption"]);
            Description = Convert.ToString(Row["description"]);
            Type        = Convert.ToString(Row["roomtype"]);
            OwnerId     = Convert.ToInt32(Row["owner"]);

            OwnerName = "";
            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT `username` FROM `users` WHERE `id` = @owner LIMIT 1");
                dbClient.AddParameter("owner", OwnerId);
                string result = dbClient.GetString();
                if (!String.IsNullOrEmpty(result))
                {
                    OwnerName = result;
                }
            }

            this.Access = RoomAccessUtility.ToRoomAccess(Row["state"].ToString().ToLower());

            Category = Convert.ToInt32(Row["category"]);
            if (!string.IsNullOrEmpty(Row["users_now"].ToString()))
            {
                UsersNow = Convert.ToInt32(Row["users_now"]);
            }
            else
            {
                UsersNow = 0;
            }
            UsersMax            = Convert.ToInt32(Row["users_max"]);
            ModelName           = Convert.ToString(Row["model_name"]);
            Score               = Convert.ToInt32(Row["score"]);
            Tags                = new List <string>();
            AllowPets           = Convert.ToInt32(Row["allow_pets"].ToString());
            AllowPetsEating     = Convert.ToInt32(Row["allow_pets_eat"].ToString());
            RoomBlockingEnabled = Convert.ToInt32(Row["room_blocking_disabled"].ToString());
            Hidewall            = Convert.ToInt32(Row["allow_hidewall"].ToString());
            Password            = Convert.ToString(Row["password"]);
            Wallpaper           = Convert.ToString(Row["wallpaper"]);
            Floor               = Convert.ToString(Row["floor"]);
            Landscape           = Convert.ToString(Row["landscape"]);
            FloorThickness      = Convert.ToInt32(Row["floorthick"]);
            WallThickness       = Convert.ToInt32(Row["wallthick"]);
            WhoCanMute          = Convert.ToInt32(Row["mute_settings"]);
            WhoCanKick          = Convert.ToInt32(Row["kick_settings"]);
            WhoCanBan           = Convert.ToInt32(Row["ban_settings"]);
            chatMode            = Convert.ToInt32(Row["chat_mode"]);
            chatSpeed           = Convert.ToInt32(Row["chat_speed"]);
            chatSize            = Convert.ToInt32(Row["chat_size"]);
            TradeSettings       = Convert.ToInt32(Row["trade_settings"]);

            Group G = null;

            if (PlusEnvironment.GetGame().GetGroupManager().TryGetGroup(Convert.ToInt32(Row["group_id"]), out G))
            {
                Group = G;
            }
            else
            {
                Group = null;
            }

            foreach (string Tag in Row["tags"].ToString().Split(','))
            {
                Tags.Add(Tag);
            }

            mModel = PlusEnvironment.GetGame().GetRoomManager().GetModel(ModelName);

            this.PushEnabled    = PlusEnvironment.EnumToBool(Row["push_enabled"].ToString());
            this.PullEnabled    = PlusEnvironment.EnumToBool(Row["pull_enabled"].ToString());
            this.SPushEnabled   = PlusEnvironment.EnumToBool(Row["spush_enabled"].ToString());
            this.SPullEnabled   = PlusEnvironment.EnumToBool(Row["spull_enabled"].ToString());
            this.EnablesEnabled = PlusEnvironment.EnumToBool(Row["enables_enabled"].ToString());
            this.RespectNotificationsEnabled = PlusEnvironment.EnumToBool(Row["respect_notifications_enabled"].ToString());
            this.PetMorphsAllowed            = PlusEnvironment.EnumToBool(Row["pet_morphs_allowed"].ToString());
        }
Beispiel #31
0
 public Guest()
 {
     RoomAccess.Add(41);
 }
Beispiel #32
0
        public void Fill(DataRow Row)
        {
            Id          = Convert.ToInt32(Row["id"]);
            Name        = Convert.ToString(Row["caption"]);
            Description = Convert.ToString(Row["description"]);
            Type        = Convert.ToString(Row["roomtype"]);
            OwnerId     = Convert.ToInt32(Row["owner"]);

            OwnerName = "";
            using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT `username` FROM `users` WHERE `id` = @owner LIMIT 1");
                dbClient.AddParameter("owner", OwnerId);
                string result = dbClient.getString();
                if (!string.IsNullOrEmpty(result))
                {
                    OwnerName = result;
                }
            }

            Access = RoomAccessUtility.ToRoomAccess(Row["state"].ToString().ToLower());

            Category = Convert.ToInt32(Row["category"]);
            if (!string.IsNullOrEmpty(Row["users_now"].ToString()))
            {
                UsersNow = Convert.ToInt32(Row["users_now"]);
            }
            else
            {
                UsersNow = 0;
            }

            UsersMax            = Convert.ToInt32(Row["users_max"]);
            ModelName           = Convert.ToString(Row["model_name"]);
            Score               = Convert.ToInt32(Row["score"]);
            Tags                = new List <string>();
            AllowPets           = Convert.ToInt32(Row["allow_pets"].ToString());
            AllowPetsEating     = Convert.ToInt32(Row["allow_pets_eat"].ToString());
            RoomBlockingEnabled = Convert.ToInt32(Row["room_blocking_disabled"].ToString());
            Hidewall            = Convert.ToInt32(Row["allow_hidewall"].ToString());
            Password            = Convert.ToString(Row["password"]);
            Wallpaper           = Convert.ToString(Row["wallpaper"]);
            Floor               = Convert.ToString(Row["floor"]);
            Landscape           = Convert.ToString(Row["landscape"]);
            FloorThickness      = Convert.ToInt32(Row["floorthick"]);
            WallThickness       = Convert.ToInt32(Row["wallthick"]);
            WhoCanMute          = Convert.ToInt32(Row["mute_settings"]);
            WhoCanKick          = Convert.ToInt32(Row["kick_settings"]);
            WhoCanBan           = Convert.ToInt32(Row["ban_settings"]);
            chatMode            = Convert.ToInt32(Row["chat_mode"]);
            chatSpeed           = Convert.ToInt32(Row["chat_speed"]);
            chatSize            = Convert.ToInt32(Row["chat_size"]);
            TradeSettings       = Convert.ToInt32(Row["trade_settings"]);
            RollerSpeed         = Convert.ToInt32(Row["roller_speed"]);

            if (NeonEnvironment.GetGame().GetGroupManager().TryGetGroup(Convert.ToInt32(Row["group_id"]), out Group G))
            {
                Group = G;
            }
            else
            {
                Group = null;
            }

            foreach (string Tag in Row["tags"].ToString().Split(','))
            {
                Tags.Add(Tag);
            }

            mModel = NeonEnvironment.GetGame().GetRoomManager().GetModel(ModelName);

            PushEnabled    = NeonEnvironment.EnumToBool(Row["push_enabled"].ToString());
            PullEnabled    = NeonEnvironment.EnumToBool(Row["pull_enabled"].ToString());
            SPushEnabled   = NeonEnvironment.EnumToBool(Row["spush_enabled"].ToString());
            SPullEnabled   = NeonEnvironment.EnumToBool(Row["spull_enabled"].ToString());
            EnablesEnabled = NeonEnvironment.EnumToBool(Row["enables_enabled"].ToString());
            RespectNotificationsEnabled = NeonEnvironment.EnumToBool(Row["respect_notifications_enabled"].ToString());
            PetMorphsAllowed            = NeonEnvironment.EnumToBool(Row["pet_morphs_allowed"].ToString());
            Shoot     = Convert.ToInt32(Row["shoot"]);
            HideWired = NeonEnvironment.EnumToBool(Row["hide_wired"].ToString());

            WiredScoreBordDay   = new Dictionary <int, KeyValuePair <int, string> >();
            WiredScoreBordWeek  = new Dictionary <int, KeyValuePair <int, string> >();
            WiredScoreBordMonth = new Dictionary <int, KeyValuePair <int, string> >();

            using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                List <bool> SuperCheck = new List <bool>()
                {
                    false,
                    false,
                    false
                };

                DateTime now           = DateTime.Now;
                int      getdaytoday   = Convert.ToInt32(now.ToString("MMddyyyy"));
                int      getmonthtoday = Convert.ToInt32(now.ToString("MM"));
                int      getweektoday  = CultureInfo.GetCultureInfo("Nl-nl").Calendar.GetWeekOfYear(DateTime.Now, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);

                WiredScoreFirstBordInformation = new List <int>()
                {
                    getdaytoday,
                    getmonthtoday,
                    getweektoday
                };

                dbClient.SetQuery("SELECT * FROM wired_scorebord WHERE roomid = @id ORDER BY `punten` DESC ");
                dbClient.AddParameter("id", Id);
                foreach (DataRow row in dbClient.getTable().Rows)
                {
                    int    userid    = Convert.ToInt32(row["userid"]);
                    string username  = Convert.ToString(row["username"]);
                    int    Punten    = Convert.ToInt32(row["punten"]);
                    string soort     = Convert.ToString(row["soort"]);
                    int    timestamp = Convert.ToInt32(row["timestamp"]);
                    if ((!(soort == "day") || WiredScoreBordDay.ContainsKey(userid) ? false : !SuperCheck[0]))
                    {
                        if (timestamp != getdaytoday)
                        {
                            SuperCheck[0] = false;
                        }
                        if (!SuperCheck[0])
                        {
                            WiredScoreBordDay.Add(userid, new KeyValuePair <int, string>(Punten, username));
                        }
                    }
                    if ((!(soort == "month") || WiredScoreBordMonth.ContainsKey(userid) ? false : !SuperCheck[1]))
                    {
                        if (timestamp != getmonthtoday)
                        {
                            SuperCheck[1] = false;
                        }
                        WiredScoreBordMonth.Add(userid, new KeyValuePair <int, string>(Punten, username));
                    }
                    if ((!(soort == "week") || WiredScoreBordWeek.ContainsKey(userid) ? false : !SuperCheck[2]))
                    {
                        if (timestamp != getweektoday)
                        {
                            SuperCheck[2] = false;
                        }
                        WiredScoreBordWeek.Add(userid, new KeyValuePair <int, string>(Punten, username));
                    }
                }
                if (SuperCheck[0])
                {
                    dbClient.RunQuery(string.Concat("DELETE FROM `wired_scorebord` WHERE `roomid`='", Id, "' AND `soort`='day'"));
                    WiredScoreBordDay.Clear();
                }
                if (SuperCheck[1])
                {
                    dbClient.RunQuery(string.Concat("DELETE FROM `wired_scorebord` WHERE `roomid`='", Id, "' AND `soort`='month'"));
                    WiredScoreBordMonth.Clear();
                }
                if (SuperCheck[2])
                {
                    dbClient.RunQuery(string.Concat("DELETE FROM `wired_scorebord` WHERE `roomid`='", Id, "' AND `soort`='week'"));
                    WiredScoreBordDay.Clear();
                }
            }
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null)
            {
                return;
            }

            Room Room = RocketEmulador.GetGame().GetRoomManager().LoadRoom(Packet.PopInt());

            if (Room == null || !Room.CheckRights(Session, true))
            {
                return;
            }

            string     Name        = RocketEmulador.GetGame().GetChatManager().GetFilter().CheckMessage(Packet.PopString());
            string     Description = RocketEmulador.GetGame().GetChatManager().GetFilter().CheckMessage(Packet.PopString());
            RoomAccess Access      = RoomAccessUtility.ToRoomAccess(Packet.PopInt());
            string     Password    = Packet.PopString();
            int        MaxUsers    = Packet.PopInt();
            int        CategoryId  = Packet.PopInt();
            int        TagCount    = Packet.PopInt();

            List <string> Tags          = new List <string>();
            StringBuilder formattedTags = new StringBuilder();

            for (int i = 0; i < TagCount; i++)
            {
                if (i > 0)
                {
                    formattedTags.Append(",");
                }

                string tag = Packet.PopString().ToLower();

                Tags.Add(tag);
                formattedTags.Append(tag);
            }

            int TradeSettings       = Packet.PopInt();//2 = All can trade, 1 = owner only, 0 = no trading.
            int AllowPets           = Convert.ToInt32(RocketEmulador.BoolToEnum(Packet.PopBoolean()));
            int AllowPetsEat        = Convert.ToInt32(RocketEmulador.BoolToEnum(Packet.PopBoolean()));
            int RoomBlockingEnabled = Convert.ToInt32(RocketEmulador.BoolToEnum(Packet.PopBoolean()));
            int Hidewall            = Convert.ToInt32(RocketEmulador.BoolToEnum(Packet.PopBoolean()));
            int WallThickness       = Packet.PopInt();
            int FloorThickness      = Packet.PopInt();
            int WhoMute             = Packet.PopInt(); // mute
            int WhoKick             = Packet.PopInt(); // kick
            int WhoBan = Packet.PopInt();              // ban

            int chatMode     = Packet.PopInt();
            int chatSize     = Packet.PopInt();
            int chatSpeed    = Packet.PopInt();
            int chatDistance = Packet.PopInt();
            int extraFlood   = Packet.PopInt();

            if (chatMode < 0 || chatMode > 1)
            {
                chatMode = 0;
            }

            if (chatSize < 0 || chatSize > 2)
            {
                chatSize = 0;
            }

            if (chatSpeed < 0 || chatSpeed > 2)
            {
                chatSpeed = 0;
            }

            if (chatDistance < 0)
            {
                chatDistance = 1;
            }

            if (chatDistance > 99)
            {
                chatDistance = 100;
            }

            if (extraFlood < 0 || extraFlood > 2)
            {
                extraFlood = 0;
            }

            if (TradeSettings < 0 || TradeSettings > 2)
            {
                TradeSettings = 0;
            }

            if (WhoMute < 0 || WhoMute > 1)
            {
                WhoMute = 0;
            }

            if (WhoKick < 0 || WhoKick > 1)
            {
                WhoKick = 0;
            }

            if (WhoBan < 0 || WhoBan > 1)
            {
                WhoBan = 0;
            }

            if (WallThickness < -2 || WallThickness > 1)
            {
                WallThickness = 0;
            }

            if (FloorThickness < -2 || FloorThickness > 1)
            {
                FloorThickness = 0;
            }

            if (Name.Length < 1)
            {
                return;
            }

            if (Name.Length > 60)
            {
                Name = Name.Substring(0, 60);
            }

            if (Access == RoomAccess.PASSWORD && Password.Length == 0)
            {
                Access = RoomAccess.OPEN;
            }

            if (MaxUsers < 0)
            {
                MaxUsers = 10;
            }

            if (MaxUsers > 50)
            {
                MaxUsers = 50;
            }

            SearchResultList SearchResultList = null;

            if (!RocketEmulador.GetGame().GetNavigator().TryGetSearchResultList(CategoryId, out SearchResultList))
            {
                CategoryId = 36;
            }

            if (SearchResultList.CategoryType != NavigatorCategoryType.CATEGORY || SearchResultList.RequiredRank > Session.GetHabbo().Rank || (Session.GetHabbo().Id != Room.OwnerId && Session.GetHabbo().Rank >= SearchResultList.RequiredRank))
            {
                CategoryId = 36;
            }

            if (TagCount > 2)
            {
                return;
            }

            Room.AllowPets           = AllowPets;
            Room.AllowPetsEating     = AllowPetsEat;
            Room.RoomBlockingEnabled = RoomBlockingEnabled;
            Room.Hidewall            = Hidewall;

            Room.RoomData.AllowPets           = AllowPets;
            Room.RoomData.AllowPetsEating     = AllowPetsEat;
            Room.RoomData.RoomBlockingEnabled = RoomBlockingEnabled;
            Room.RoomData.Hidewall            = Hidewall;

            Room.Name        = Name;
            Room.Access      = Access;
            Room.Description = Description;
            Room.Category    = CategoryId;
            Room.Password    = Password;

            Room.RoomData.Name        = Name;
            Room.RoomData.Access      = Access;
            Room.RoomData.Description = Description;
            Room.RoomData.Category    = CategoryId;
            Room.RoomData.Password    = Password;

            Room.WhoCanBan           = WhoBan;
            Room.WhoCanKick          = WhoKick;
            Room.WhoCanMute          = WhoMute;
            Room.RoomData.WhoCanBan  = WhoBan;
            Room.RoomData.WhoCanKick = WhoKick;
            Room.RoomData.WhoCanMute = WhoMute;

            Room.ClearTags();
            Room.AddTagRange(Tags);
            Room.UsersMax = MaxUsers;

            Room.RoomData.Tags.Clear();
            Room.RoomData.Tags.AddRange(Tags);
            Room.RoomData.UsersMax = MaxUsers;

            Room.WallThickness           = WallThickness;
            Room.FloorThickness          = FloorThickness;
            Room.RoomData.WallThickness  = WallThickness;
            Room.RoomData.FloorThickness = FloorThickness;

            Room.chatMode     = chatMode;
            Room.chatSize     = chatSize;
            Room.chatSpeed    = chatSpeed;
            Room.chatDistance = chatDistance;
            Room.extraFlood   = extraFlood;

            Room.TradeSettings = TradeSettings;

            Room.RoomData.chatMode     = chatMode;
            Room.RoomData.chatSize     = chatSize;
            Room.RoomData.chatSpeed    = chatSpeed;
            Room.RoomData.chatDistance = chatDistance;
            Room.RoomData.extraFlood   = extraFlood;

            Room.RoomData.TradeSettings = TradeSettings;

            string AccessStr = Password.Length > 0 ? "password" : "open";

            switch (Access)
            {
            default:
            case RoomAccess.OPEN:
                AccessStr = "open";
                break;

            case RoomAccess.PASSWORD:
                AccessStr = "password";
                break;

            case RoomAccess.DOORBELL:
                AccessStr = "locked";
                break;

            case RoomAccess.INVISIBLE:
                AccessStr = "invisible";
                break;
            }

            using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE rooms SET caption = @caption, description = @description, password = @password, category = " +
                                  CategoryId + ", state = '" + AccessStr + "', tags = @tags, users_max = " + MaxUsers +
                                  ", allow_pets = '" + AllowPets + "', allow_pets_eat = '" + AllowPetsEat + "', room_blocking_disabled = '" +
                                  RoomBlockingEnabled + "', allow_hidewall = '" + Room.Hidewall + "', floorthick = " +
                                  Room.FloorThickness + ", wallthick = " + Room.WallThickness + ", mute_settings='" + Room.WhoCanMute +
                                  "', kick_settings='" + Room.WhoCanKick + "',ban_settings='" + Room.WhoCanBan + "', `chat_mode` = '" + Room.chatMode + "', `chat_size` = '" + Room.chatSize + "', `chat_speed` = '" + Room.chatSpeed + "', `chat_extra_flood` = '" + Room.extraFlood + "', `chat_hearing_distance` = '" + Room.chatDistance + "', `trade_settings` = '" + Room.TradeSettings + "' WHERE `id` = '" + Room.RoomId + "' LIMIT 1");
                dbClient.AddParameter("caption", Room.Name);
                dbClient.AddParameter("description", Room.Description);
                dbClient.AddParameter("password", Room.Password);
                dbClient.AddParameter("tags", formattedTags.ToString());
                dbClient.RunQuery();
            }

            Room.GetGameMap().GenerateMaps();

            if (Session.GetHabbo().CurrentRoom == null)
            {
                Session.SendMessage(new RoomSettingsSavedComposer(Room.RoomId));
                Session.SendMessage(new RoomInfoUpdatedComposer(Room.RoomId));
                Session.SendMessage(new RoomVisualizationSettingsComposer(Room.WallThickness, Room.FloorThickness, RocketEmulador.EnumToBool(Room.Hidewall.ToString())));
            }
            else
            {
                Room.SendMessage(new RoomSettingsSavedComposer(Room.RoomId));
                Room.SendMessage(new RoomInfoUpdatedComposer(Room.RoomId));
                Room.SendMessage(new RoomVisualizationSettingsComposer(Room.WallThickness, Room.FloorThickness, RocketEmulador.EnumToBool(Room.Hidewall.ToString())));
            }

            RocketEmulador.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModDoorModeSeen", 1);
            RocketEmulador.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModWalkthroughSeen", 1);
            RocketEmulador.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModChatScrollSpeedSeen", 1);
            RocketEmulador.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModChatFloodFilterSeen", 1);
            RocketEmulador.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModChatHearRangeSeen", 1);
        }
        public void GetListOfRoomNumbers()
        {
            // Arrange
            IRoomAccess service = new RoomAccess();
            service.GenerateBasicHotel(10, 10, 10);

            // Act
            List<string> list = service.GetRoomNumbers();

            // Assert
            Assert.AreEqual(10*10*10, list.Count);
        }
Beispiel #35
0
        public void Parse(HabboHotel.GameClients.GameClient session, ClientPacket packet)
        {
            if (session == null || session.GetHabbo() == null)
            {
                return;
            }

            int roomId = packet.PopInt();

            if (!PlusEnvironment.GetGame().GetRoomManager().TryLoadRoom(roomId, out Room room))
            {
                return;
            }

            string     Name        = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(packet.PopString());
            string     Description = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(packet.PopString());
            RoomAccess Access      = RoomAccessUtility.ToRoomAccess(packet.PopInt());
            string     Password    = packet.PopString();
            int        MaxUsers    = packet.PopInt();
            int        CategoryId  = packet.PopInt();
            int        TagCount    = packet.PopInt();

            List <string> Tags          = new List <string>();
            StringBuilder formattedTags = new StringBuilder();

            for (int i = 0; i < TagCount; i++)
            {
                if (i > 0)
                {
                    formattedTags.Append(",");
                }

                string tag = packet.PopString().ToLower();

                Tags.Add(tag);
                formattedTags.Append(tag);
            }

            int TradeSettings       = packet.PopInt();//2 = All can trade, 1 = owner only, 0 = no trading.
            int AllowPets           = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean()));
            int AllowPetsEat        = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean()));
            int RoomBlockingEnabled = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean()));
            int Hidewall            = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean()));
            int WallThickness       = packet.PopInt();
            int FloorThickness      = packet.PopInt();
            int WhoMute             = packet.PopInt(); // mute
            int WhoKick             = packet.PopInt(); // kick
            int WhoBan = packet.PopInt();              // ban

            int chatMode     = packet.PopInt();
            int chatSize     = packet.PopInt();
            int chatSpeed    = packet.PopInt();
            int chatDistance = packet.PopInt();
            int extraFlood   = packet.PopInt();

            if (chatMode < 0 || chatMode > 1)
            {
                chatMode = 0;
            }

            if (chatSize < 0 || chatSize > 2)
            {
                chatSize = 0;
            }

            if (chatSpeed < 0 || chatSpeed > 2)
            {
                chatSpeed = 0;
            }

            if (chatDistance < 0)
            {
                chatDistance = 1;
            }

            if (chatDistance > 99)
            {
                chatDistance = 100;
            }

            if (extraFlood < 0 || extraFlood > 2)
            {
                extraFlood = 0;
            }

            if (TradeSettings < 0 || TradeSettings > 2)
            {
                TradeSettings = 0;
            }

            if (WhoMute < 0 || WhoMute > 1)
            {
                WhoMute = 0;
            }

            if (WhoKick < 0 || WhoKick > 1)
            {
                WhoKick = 0;
            }

            if (WhoBan < 0 || WhoBan > 1)
            {
                WhoBan = 0;
            }

            if (WallThickness < -2 || WallThickness > 1)
            {
                WallThickness = 0;
            }

            if (FloorThickness < -2 || FloorThickness > 1)
            {
                FloorThickness = 0;
            }

            if (Name.Length < 1)
            {
                return;
            }

            if (Name.Length > 60)
            {
                Name = Name.Substring(0, 60);
            }

            if (Access == RoomAccess.Password && Password.Length == 0)
            {
                Access = RoomAccess.Open;
            }

            if (MaxUsers < 0)
            {
                MaxUsers = 10;
            }

            if (MaxUsers > 50)
            {
                MaxUsers = 50;
            }

            SearchResultList SearchResultList = null;

            if (!PlusEnvironment.GetGame().GetNavigator().TryGetSearchResultList(CategoryId, out SearchResultList))
            {
                CategoryId = 36;
            }

            if (SearchResultList.CategoryType != NavigatorCategoryType.Category || SearchResultList.RequiredRank > session.GetHabbo().Rank || (session.GetHabbo().Id != room.OwnerId && session.GetHabbo().Rank >= SearchResultList.RequiredRank))
            {
                CategoryId = 36;
            }

            if (TagCount > 2)
            {
                return;
            }

            room.AllowPets           = AllowPets;
            room.AllowPetsEating     = AllowPetsEat;
            room.RoomBlockingEnabled = RoomBlockingEnabled;
            room.Hidewall            = Hidewall;

            room.Name        = Name;
            room.Access      = Access;
            room.Description = Description;
            room.Category    = CategoryId;
            room.Password    = Password;

            room.WhoCanBan  = WhoBan;
            room.WhoCanKick = WhoKick;
            room.WhoCanMute = WhoMute;

            room.ClearTags();
            room.AddTagRange(Tags);
            room.UsersMax = MaxUsers;

            room.WallThickness  = WallThickness;
            room.FloorThickness = FloorThickness;

            room.ChatMode     = chatMode;
            room.ChatSize     = chatSize;
            room.ChatSpeed    = chatSpeed;
            room.ChatDistance = chatDistance;
            room.ExtraFlood   = extraFlood;

            room.TradeSettings = TradeSettings;

            string AccessStr = Password.Length > 0 ? "password" : "open";

            switch (Access)
            {
            default:
            case RoomAccess.Open:
                AccessStr = "open";
                break;

            case RoomAccess.Password:
                AccessStr = "password";
                break;

            case RoomAccess.Doorbell:
                AccessStr = "locked";
                break;

            case RoomAccess.Invisible:
                AccessStr = "invisible";
                break;
            }

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `rooms` SET `caption` = @caption, `description` = @description, `password` = @password, `category` = @categoryId, `state` = @state, `tags` = @tags, `users_max` = @maxUsers, `allow_pets` = @allowPets, `allow_pets_eat` = @allowPetsEat, `room_blocking_disabled` = @roomBlockingDisabled, `allow_hidewall` = @allowHidewall, `floorthick` = @floorThick, `wallthick` = @wallThick, `mute_settings` = @muteSettings, `kick_settings` = @kickSettings, `ban_settings` = @banSettings, `chat_mode` = @chatMode, `chat_size` = @chatSize, `chat_speed` = @chatSpeed, `chat_extra_flood` = @extraFlood, `chat_hearing_distance` = @chatDistance, `trade_settings` = @tradeSettings WHERE `id` = @roomId LIMIT 1");
                dbClient.AddParameter("categoryId", CategoryId);
                dbClient.AddParameter("maxUsers", MaxUsers);
                dbClient.AddParameter("allowPets", AllowPets);
                dbClient.AddParameter("allowPetsEat", AllowPetsEat);
                dbClient.AddParameter("roomBlockingDisabled", RoomBlockingEnabled);
                dbClient.AddParameter("allowHidewall", room.Hidewall);
                dbClient.AddParameter("floorThick", room.FloorThickness);
                dbClient.AddParameter("wallThick", room.WallThickness);
                dbClient.AddParameter("muteSettings", room.WhoCanMute);
                dbClient.AddParameter("kickSettings", room.WhoCanKick);
                dbClient.AddParameter("banSettings", room.WhoCanBan);
                dbClient.AddParameter("chatMode", room.ChatMode);
                dbClient.AddParameter("chatSize", room.ChatSize);
                dbClient.AddParameter("chatSpeed", room.ChatSpeed);
                dbClient.AddParameter("extraFlood", room.ExtraFlood);
                dbClient.AddParameter("chatDistance", room.ChatDistance);
                dbClient.AddParameter("tradeSettings", room.TradeSettings);
                dbClient.AddParameter("roomId", room.Id);
                dbClient.AddParameter("caption", room.Name);
                dbClient.AddParameter("description", room.Description);
                dbClient.AddParameter("password", room.Password);
                dbClient.AddParameter("state", AccessStr);
                dbClient.AddParameter("tags", formattedTags.ToString());
                dbClient.RunQuery();
            }

            room.GetGameMap().GenerateMaps();

            if (session.GetHabbo().CurrentRoom == null)
            {
                session.SendPacket(new RoomSettingsSavedComposer(room.RoomId));
                session.SendPacket(new RoomInfoUpdatedComposer(room.RoomId));
                session.SendPacket(new RoomVisualizationSettingsComposer(room.WallThickness, room.FloorThickness, PlusEnvironment.EnumToBool(room.Hidewall.ToString())));
            }
            else
            {
                room.SendPacket(new RoomSettingsSavedComposer(room.RoomId));
                room.SendPacket(new RoomInfoUpdatedComposer(room.RoomId));
                room.SendPacket(new RoomVisualizationSettingsComposer(room.WallThickness, room.FloorThickness, PlusEnvironment.EnumToBool(room.Hidewall.ToString())));
            }

            PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModDoorModeSeen", 1);
            PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModWalkthroughSeen", 1);
            PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModChatScrollSpeedSeen", 1);
            PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModChatFloodFilterSeen", 1);
            PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModChatHearRangeSeen", 1);
        }
        public void InstantiateRoomAccessClass()
        {
            // Arrange

            // Act
            IRoomAccess service = new RoomAccess();

            // Assert
            Assert.IsNotNull(service);
        }