Esempio n. 1
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 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);
        }
Esempio n. 3
0
        public void Parse(GameClient session, ClientPacket packet)
        {
            if (session?.GetHabbo() == null)
            {
                return;
            }

            var room = PlusEnvironment.GetGame().GetRoomManager().LoadRoom(packet.PopInt());

            if (room == null || !room.CheckRights(session, true))
            {
                return;
            }

            var name        = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(packet.PopString());
            var description = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(packet.PopString());
            var access      = RoomAccessUtility.ToRoomAccess(packet.PopInt());
            var password    = packet.PopString();
            var maxUsers    = packet.PopInt();
            var categoryId  = packet.PopInt();
            var tagCount    = packet.PopInt();

            var tags          = new List <string>();
            var formattedTags = new StringBuilder();

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

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

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

            var tradeSettings       = packet.PopInt(); //2 = All can trade, 1 = owner only, 0 = no trading.
            var allowPets           = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean()));
            var allowPetsEat        = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean()));
            var roomBlockingEnabled = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean()));
            var hidewall            = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean()));
            var wallThickness       = packet.PopInt();
            var floorThickness      = packet.PopInt();
            var whoMute             = packet.PopInt(); // mute
            var whoKick             = packet.PopInt(); // kick
            var whoBan = packet.PopInt();              // ban

            var chatMode     = packet.PopInt();
            var chatSize     = packet.PopInt();
            var chatSpeed    = packet.PopInt();
            var chatDistance = packet.PopInt();
            var 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.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;

            var 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 (var 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);
        }