Beispiel #1
0
        public void Execute(GameClient Session, Room Room, string[] Params)
        {
            if (!Room.CheckRights(Session, false, false))
            {
                Session.SendWhisper("No tienes permisos en esta sala.");
                return;
            }

            Room.HideWired = !Room.HideWired;
            if (Room.HideWired)
            {
                Session.SendWhisper("Has escondido todos los Wired de la sala.");
            }
            else
            {
                Session.SendWhisper("Has mostrado todos los Wired de la sala.");
            }

            using (IQueryAdapter con = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                con.SetQuery("UPDATE `rooms` SET `hide_wired` = @enum WHERE `id` = @id LIMIT 1");
                con.AddParameter("enum", RavenEnvironment.BoolToEnum(Room.HideWired));
                con.AddParameter("id", Room.Id);
                con.RunQuery();
            }

            List <ServerPacket> list = new List <ServerPacket>();

            list = Room.HideWiredMessages(Room.HideWired);

            Room.SendMessage(list);
        }
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            Boolean ChatPreference = Packet.PopBoolean();

            Session.GetHabbo().ChatPreference = ChatPreference;
            using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `users` SET `chat_preference` = @chatPreference WHERE `id` = '" + Session.GetHabbo().Id + "' LIMIT 1");
                dbClient.AddParameter("chatPreference", RavenEnvironment.BoolToEnum(ChatPreference));
                dbClient.RunQuery();
            }
        }
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            Session.GetHabbo().AllowMimic = !Session.GetHabbo().AllowMimic;
            Session.SendWhisper("Usted " + (Session.GetHabbo().AllowMimic == true ? "ahora" : "ya no") + " protege su look.");

            using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `users` SET `allow_mimic` = @AllowMimic WHERE `id` = '" + Session.GetHabbo().Id + "'");
                dbClient.AddParameter("AllowMimic", RavenEnvironment.BoolToEnum(Session.GetHabbo().AllowMimic));
                dbClient.RunQuery();
            }
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            Boolean Status = Packet.PopBoolean();

            Session.GetHabbo().AllowMessengerInvites = Status;
            using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `users` SET `ignore_invites` = @MessengerInvites WHERE `id` = '" + Session.GetHabbo().Id + "' LIMIT 1");
                dbClient.AddParameter("MessengerInvites", RavenEnvironment.BoolToEnum(Status));
                dbClient.RunQuery();
            }
        }
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            Session.GetHabbo().AllowGifts = !Session.GetHabbo().AllowGifts;
            Session.SendWhisper("Usted " + (Session.GetHabbo().AllowGifts == true ? "ahora" : "ya no") + " acepta regalos.");

            using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `users` SET `allow_gifts` = @AllowGifts WHERE `id` = '" + Session.GetHabbo().Id + "'");
                dbClient.AddParameter("AllowGifts", RavenEnvironment.BoolToEnum(Session.GetHabbo().AllowGifts));
                dbClient.RunQuery();
            }
        }
Beispiel #6
0
        public void UpdatePreset(int Preset, string Color, int Intensity, bool BgOnly, bool Hax = false)
        {
            if (!IsValidColor(Color) || !IsValidIntensity(Intensity) && !Hax)
            {
                return;
            }

            string Pr;

            switch (Preset)
            {
            case 3:

                Pr = "three";
                break;

            case 2:

                Pr = "two";
                break;

            case 1:
            default:

                Pr = "one";
                break;
            }

            using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE room_items_moodlight SET preset_" + Pr + " = '@color," + Intensity + "," + RavenEnvironment.BoolToEnum(BgOnly) + "' WHERE item_id = '" + ItemId + "' LIMIT 1");
                dbClient.AddParameter("color", Color);
                dbClient.RunQuery();
            }

            GetPreset(Preset).ColorCode      = Color;
            GetPreset(Preset).ColorIntensity = Intensity;
            GetPreset(Preset).BackgroundOnly = BgOnly;
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom)
            {
                return;
            }
            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }
            int    BotId      = Packet.PopInt();
            int    ActionId   = Packet.PopInt();
            string DataString = Packet.PopString();

            if (ActionId < 1 || ActionId > 5)
            {
                return;
            }
            RoomUser Bot = null;

            if (!Room.GetRoomUserManager().TryGetBot(BotId, out Bot))
            {
                return;
            }
            if ((Bot.BotData.ownerID != Session.GetHabbo().Id&& !Session.GetHabbo().GetPermissions().HasRight("bot_edit_any_override")))
            {
                return;
            }
            RoomBot RoomBot = Bot.BotData;

            if (RoomBot == null)
            {
                return;
            }

            /* 1 = Copy looks
             * 2 = Setup Speech
             * 3 = Relax
             * 4 = Dance
             * 5 = Change Name
             */
            switch (ActionId)
            {
                #region Copy Looks (1)
            case 1:
            {
                ServerPacket UserChangeComposer = new ServerPacket(ServerPacketHeader.UserChangeMessageComposer);
                UserChangeComposer.WriteInteger(Bot.VirtualId);
                UserChangeComposer.WriteString(Session.GetHabbo().Look);
                UserChangeComposer.WriteString(Session.GetHabbo().Gender);
                UserChangeComposer.WriteString(Bot.BotData.Motto);
                UserChangeComposer.WriteInteger(0);
                Room.SendMessage(UserChangeComposer);
                //Change the defaults
                Bot.BotData.Look   = Session.GetHabbo().Look;
                Bot.BotData.Gender = Session.GetHabbo().Gender;
                using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("UPDATE `bots` SET `look` = @look, `gender` = '" + Session.GetHabbo().Gender + "' WHERE `id` = '" + Bot.BotData.Id + "' LIMIT 1");
                    dbClient.AddParameter("look", Session.GetHabbo().Look);
                    dbClient.RunQuery();
                }
                //Room.SendMessage(new UserChangeComposer(BotUser.GetClient(), true));
                break;
            }

                #endregion
                #region Setup Speech (2)
            case 2:
            {
                string[] ConfigData = DataString.Split(new string[]
                    {
                        ";#;"
                    }, StringSplitOptions.None);
                string[] SpeechData = ConfigData[0].Split(new char[]
                    {
                        '\r',
                        '\n'
                    }, StringSplitOptions.RemoveEmptyEntries);
                string AutomaticChat    = Convert.ToString(ConfigData[1]);
                string SpeakingInterval = Convert.ToString(ConfigData[2]);
                string MixChat          = Convert.ToString(ConfigData[3]);
                if (String.IsNullOrEmpty(SpeakingInterval) || Convert.ToInt32(SpeakingInterval) <= 0 || Convert.ToInt32(SpeakingInterval) < 7)
                {
                    SpeakingInterval = "7";
                }
                RoomBot.AutomaticChat    = Convert.ToBoolean(AutomaticChat);
                RoomBot.SpeakingInterval = Convert.ToInt32(SpeakingInterval);
                RoomBot.MixSentences     = Convert.ToBoolean(MixChat);
                using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.RunQuery("DELETE FROM `bots_speech` WHERE `bot_id` = '" + Bot.BotData.Id + "'");
                    #region Save Data - TODO: MAKE METHODS FOR THIS.
                    for (int i = 0; i <= SpeechData.Length - 1; i++)
                    {
                        dbClient.SetQuery("INSERT INTO `bots_speech` (`bot_id`, `text`) VALUES (@id, @data)");
                        dbClient.AddParameter("id", BotId);
                        dbClient.AddParameter("data", SpeechData[i]);
                        dbClient.RunQuery();
                        dbClient.SetQuery("UPDATE `bots` SET `automatic_chat` = @AutomaticChat, `speaking_interval` = @SpeakingInterval, `mix_sentences` = @MixChat WHERE `id` = @id LIMIT 1");
                        dbClient.AddParameter("id", BotId);
                        dbClient.AddParameter("AutomaticChat", AutomaticChat.ToLower());
                        dbClient.AddParameter("SpeakingInterval", Convert.ToInt32(SpeakingInterval));
                        dbClient.AddParameter("MixChat", RavenEnvironment.BoolToEnum(Convert.ToBoolean(MixChat)));
                        dbClient.RunQuery();
                    }
                    #endregion
                    #region Handle Speech
                    RoomBot.RandomSpeech.Clear();
                    dbClient.SetQuery("SELECT `text` FROM `bots_speech` WHERE `bot_id` = @id");
                    dbClient.AddParameter("id", BotId);
                    DataTable           BotSpeech = dbClient.getTable();
                    List <RandomSpeech> Speeches  = new List <RandomSpeech>();
                    foreach (DataRow Speech in BotSpeech.Rows)
                    {
                        RoomBot.RandomSpeech.Add(new RandomSpeech(Convert.ToString(Speech["text"]), BotId));
                    }
                    #endregion
                }
                break;
            }

                #endregion
                #region Relax (3)
            case 3:
            {
                if (Bot.BotData.WalkingMode == "stand")
                {
                    Bot.BotData.WalkingMode = "freeroam";
                }
                else
                {
                    Bot.BotData.WalkingMode = "stand";
                }
                using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.RunQuery("UPDATE `bots` SET `walk_mode` = '" + Bot.BotData.WalkingMode + "' WHERE `id` = '" + Bot.BotData.Id + "' LIMIT 1");
                }
                break;
            }

                #endregion
                #region Dance (4)
            case 4:
            {
                if (Bot.BotData.DanceId > 0)
                {
                    Bot.BotData.DanceId = 0;
                }
                else
                {
                    Random RandomDance = new Random();
                    Bot.BotData.DanceId = RandomDance.Next(1, 4);
                }
                Room.SendMessage(new DanceComposer(Bot, Bot.BotData.DanceId));
                break;
            }

                #endregion
                #region Change Name (5)
            case 5:
            {
                if (DataString.Length == 0)
                {
                    Session.SendWhisper("Por favor, colócale un nombre al robot.");
                    return;
                }
                else if (DataString.Length >= 16)
                {
                    Session.SendWhisper("El nombre del bot no puede superar los 16 caracteres.");
                    return;
                }
                if (DataString.Contains("<img src") || DataString.Contains("<font ") || DataString.Contains("</font>") || DataString.Contains("</a>") || DataString.Contains("<i>"))
                {
                    Session.SendWhisper("¿Qué intentas, crack?");
                    return;
                }
                Bot.BotData.Name = DataString;
                using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("UPDATE `bots` SET `name` = @name WHERE `id` = '" + Bot.BotData.Id + "' LIMIT 1");
                    dbClient.AddParameter("name", DataString);
                    dbClient.RunQuery();
                }
                Room.SendMessage(new UsersComposer(Bot));
                break;
            }
                #endregion
            }
        }
Beispiel #8
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Oops, debes elegir una opcion para desactivar. ejecuta el comando ':room list'");
                return;
            }

            if (!Room.CheckRights(Session, true))
            {
                Session.SendWhisper("Oops, solo el dueño de la sala puede ejecutar este comando");
                return;
            }

            string Option = Params[1];

            switch (Option)
            {
            case "list":
            {
                StringBuilder List = new StringBuilder("");
                List.AppendLine("Lista de comando en salas");
                List.AppendLine("-------------------------");
                List.AppendLine("Pet Morphs: " + (Room.PetMorphsAllowed == true ? "Habilitado" : "Deshabilitado"));
                //List.AppendLine("Pull: " + (Room.PullEnabled == true ? "Habilitado" : "Deshabilitado"));
                //List.AppendLine("Push: " + (Room.PushEnabled == true ? "Habilitado" : "Deshabilitado"));
                //List.AppendLine("Golpes: " + (Room.GolpeEnabled == true ? "Habilitado" : "Deshabilitado"));
                //List.AppendLine("Super Pull: " + (Room.SPullEnabled == true ? "Habilitado" : "Deshabilitado"));
                //List.AppendLine("Super Push: " + (Room.SPushEnabled == true ? "Habilitado" : "Deshabilitado"));
                List.AppendLine("Respect: " + (Room.RespectNotificationsEnabled == true ? "Habilitado" : "Deshabilitado"));
                //List.AppendLine("Enables: " + (Room.EnablesEnabled == true ? "Habilitado" : "Deshabilitado"));
                //List.AppendLine("Besos: " + (Room.BesosEnabled == true ? "Habilitado" : "Deshabilitado"));
                //List.AppendLine("Quemar: " + (Room.QuemarEnabled == true ? "Habilitado" : "Deshabilitado"));
                Session.SendNotification(List.ToString());
                break;
            }

            //case "golpe":
            //{
            //    Room.GolpeEnabled = !Room.GolpeEnabled;
            //    using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            //    {
            //        dbClient.SetQuery("UPDATE `rooms` SET `golpe_enabled` = @GolpeEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1");
            //        dbClient.AddParameter("GolpeEnabled", RavenEnvironment.BoolToEnum(Room.GolpeEnabled));
            //        dbClient.RunQuery();
            //    }

            //    Session.SendWhisper("Los golpes en esta sala estan " + (Room.GolpeEnabled == true ? "Habilitado!" : "Deshabilitado!"));
            //    break;
            //}

            //case "quemar":
            //    {
            //        Room.QuemarEnabled = !Room.QuemarEnabled;
            //        using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            //        {
            //            dbClient.SetQuery("UPDATE `rooms` SET `quemar_enabled` = @QuemarEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1");
            //            dbClient.AddParameter("QuemarEnabled", RavenEnvironment.BoolToEnum(Room.QuemarEnabled));
            //            dbClient.RunQuery();
            //        }

            //        Session.SendWhisper("¡El poder de quemar en esta sala está " + (Room.QuemarEnabled == true ? "habilitado!" : "deshabilitado!"));
            //        break;
            //    }

            //case "beso":
            //    {
            //        Room.BesosEnabled = !Room.BesosEnabled;
            //        using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            //        {
            //            dbClient.SetQuery("UPDATE `rooms` SET `besos_enabled` = @BesosENabled WHERE `id` = '" + Room.Id + "' LIMIT 1");
            //            dbClient.AddParameter("BesosEnabled", RavenEnvironment.BoolToEnum(Room.QuemarEnabled));
            //            dbClient.RunQuery();
            //        }

            //        Session.SendWhisper("¡El poder de besar en esta sala está " + (Room.QuemarEnabled == true ? "habilitado!" : "deshabilitado!"));
            //        break;
            //    }

            //case "push":
            //    {
            //        Room.PushEnabled = !Room.PushEnabled;
            //        using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            //        {
            //            dbClient.SetQuery("UPDATE `rooms` SET `push_enabled` = @PushEnabled WHERE `id` = '" + Room.Id +"' LIMIT 1");
            //            dbClient.AddParameter("PushEnabled", RavenEnvironment.BoolToEnum(Room.PushEnabled));
            //            dbClient.RunQuery();
            //        }

            //        Session.SendWhisper("Modo Push ahora esta " + (Room.PushEnabled == true ? "Habilitado!" : "Deshabilitado!"));
            //        break;
            //    }

            //case "spush":
            //    {
            //        Room.SPushEnabled = !Room.SPushEnabled;
            //        using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            //        {
            //            dbClient.SetQuery("UPDATE `rooms` SET `spush_enabled` = @PushEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1");
            //            dbClient.AddParameter("PushEnabled", RavenEnvironment.BoolToEnum(Room.SPushEnabled));
            //            dbClient.RunQuery();
            //        }

            //        Session.SendWhisper("Modo Super Push ahora esta " + (Room.SPushEnabled == true ? "Habilitado!" : "Deshabilitado!"));
            //        break;
            //    }

            //case "spull":
            //    {
            //        Room.SPullEnabled = !Room.SPullEnabled;
            //        using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            //        {
            //            dbClient.SetQuery("UPDATE `rooms` SET `spull_enabled` = @PullEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1");
            //            dbClient.AddParameter("PullEnabled", RavenEnvironment.BoolToEnum(Room.SPullEnabled));
            //            dbClient.RunQuery();
            //        }

            //        Session.SendWhisper("Modo Super Pull ahora esta  " + (Room.SPullEnabled == true ? "Habilitado!" : "Deshabilitado!"));
            //        break;
            //    }

            //case "pull":
            //    {
            //        Room.PullEnabled = !Room.PullEnabled;
            //        using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            //        {
            //            dbClient.SetQuery("UPDATE `rooms` SET `pull_enabled` = @PullEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1");
            //            dbClient.AddParameter("PullEnabled", RavenEnvironment.BoolToEnum(Room.PullEnabled));
            //            dbClient.RunQuery();
            //        }

            //        Session.SendWhisper("Modo Pull ahora esta " + (Room.PullEnabled == true ? "Habilitado!" : "Deshabilitado!"));
            //        break;
            //    }

            //case "enable":
            //case "enables":
            //    {
            //        Room.EnablesEnabled = !Room.EnablesEnabled;
            //        using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            //        {
            //            dbClient.SetQuery("UPDATE `rooms` SET `enables_enabled` = @EnablesEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1");
            //            dbClient.AddParameter("EnablesEnabled", RavenEnvironment.BoolToEnum(Room.EnablesEnabled));
            //            dbClient.RunQuery();
            //        }

            //        Session.SendWhisper("Los efectos en esta sala estan " + (Room.EnablesEnabled == true ? "Habilitados!" : "Deshabilitados!"));
            //        break;
            //    }

            case "respect":
            {
                Room.RespectNotificationsEnabled = !Room.RespectNotificationsEnabled;
                using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("UPDATE `rooms` SET `respect_notifications_enabled` = @RespectNotificationsEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1");
                    dbClient.AddParameter("RespectNotificationsEnabled", RavenEnvironment.BoolToEnum(Room.RespectNotificationsEnabled));
                    dbClient.RunQuery();
                }

                Session.SendWhisper("Notificaciones de Respeto estan " + (Room.RespectNotificationsEnabled == true ? "Habilitado!" : "Deshabilitado!"));
                break;
            }

            case "pets":
            case "morphs":
            {
                Room.PetMorphsAllowed = !Room.PetMorphsAllowed;
                using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("UPDATE `rooms` SET `pet_morphs_allowed` = @PetMorphsAllowed WHERE `id` = '" + Room.Id + "' LIMIT 1");
                    dbClient.AddParameter("PetMorphsAllowed", RavenEnvironment.BoolToEnum(Room.PetMorphsAllowed));
                    dbClient.RunQuery();
                }

                Session.SendWhisper("Que se convierta en mascotas esta " + (Room.PetMorphsAllowed == true ? "Habilitado!" : "Deshabilitado!"));

                if (!Room.PetMorphsAllowed)
                {
                    foreach (RoomUser User in Room.GetRoomUserManager().GetRoomUsers())
                    {
                        if (User == null || User.GetClient() == null || User.GetClient().GetHabbo() == null)
                        {
                            continue;
                        }

                        User.GetClient().SendWhisper("El propietario de la sala ha deshabilitado la opcion de convertirse en mascota.");
                        if (User.GetClient().GetHabbo().PetId > 0)
                        {
                            //Tell the user what is going on.
                            User.GetClient().SendWhisper("Oops, el dueño de la sala solo permite Usuarios normales, no mascotas..");

                            //Change the users Pet Id.
                            User.GetClient().GetHabbo().PetId = 0;

                            //Quickly remove the old user instance.
                            Room.SendMessage(new UserRemoveComposer(User.VirtualId));

                            //Add the new one, they won't even notice a thing!!11 8-)
                            Room.SendMessage(new UsersComposer(User));
                        }
                    }
                }
                break;
            }
            }
        }
Beispiel #9
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null)
            {
                return;
            }

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

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

            string word;
            string Name = Packet.PopString();

            Name = RavenEnvironment.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Name, out word) ? "Spam" : Name;
            string Description = Packet.PopString();

            Description = RavenEnvironment.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Description, out word) ? "Spam" : Description;
            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(RavenEnvironment.BoolToEnum(Packet.PopBoolean()));
            int AllowPetsEat        = Convert.ToInt32(RavenEnvironment.BoolToEnum(Packet.PopBoolean()));
            int RoomBlockingEnabled = Convert.ToInt32(RavenEnvironment.BoolToEnum(Packet.PopBoolean()));
            int Hidewall            = Convert.ToInt32(RavenEnvironment.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 (!RavenEnvironment.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 = RavenEnvironment.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, RavenEnvironment.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, RavenEnvironment.EnumToBool(Room.Hidewall.ToString())));
            }

            RavenEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModDoorModeSeen", 1);
            RavenEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModWalkthroughSeen", 1);
            RavenEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModChatScrollSpeedSeen", 1);
            RavenEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModChatFloodFilterSeen", 1);
            RavenEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModChatHearRangeSeen", 1);
        }