Пример #1
0
        public void AlertUser(GameClient ModSession, uint UserId, string Message, Boolean Caution)
        {
            GameClient Client = UberEnvironment.GetGame().GetClientManager().GetClientByHabbo(UserId);

            if (Client == null || Client.GetHabbo().Id == ModSession.GetHabbo().Id)
            {
                return;
            }

            if (Caution && Client.GetHabbo().Rank >= ModSession.GetHabbo().Rank)
            {
                ModSession.SendNotif("You do not have permission to caution that user, sending as a regular message instead.");
                Caution = false;
            }

            Client.SendNotif(Message, Caution);

            if (Caution)
            {
                using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
                {
                    dbClient.ExecuteQuery("UPDATE user_info SET cautions = cautions + 1 WHERE user_id = '" + UserId + "' LIMIT 1");
                }
            }
        }
        public void parse(GameClient Session, ClientPacket Packet)
        {
            if (Session.GetHabbo().LoadingRoom <= 0)
            {
                return;
            }

            RoomData Data = UberEnvironment.GetGame().GetRoomManager().GenerateRoomData(Session.GetHabbo().LoadingRoom);

            if (Data == null)
            {
                return;
            }

            if (Data.Model == null)
            {
                Session.SendNotif("Sorry, model data is missing from this room and therefore cannot be loaded.");
                Session.SendPacket(new ServerPacket(18));
                Session.ClearRoomLoading();
                return;
            }

            Session.SendPacket(Data.Model.SerializeHeightmap());
            Session.SendPacket(Data.Model.SerializeRelativeHeightmap());
        }
        public void parse(GameClient Session, ClientPacket Packet)
        {
            CatalogPage Page = UberEnvironment.GetGame().GetCatalog().GetPage(Packet.PopWiredInt32());

            if (Page == null || !Page.Enabled || !Page.Visible || Page.ComingSoon || Page.MinRank > Session.GetHabbo().Rank)
            {
                return;
            }

            if (Page.ClubOnly && !Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
            {
                Session.SendNotif("This page is for Club members only!");
                return;
            }

            Session.SendPacket(UberEnvironment.GetGame().GetCatalog().SerializePage(Page));

            if (Page.Layout == "recycler")
            {
                ServerPacket message = new ServerPacket(507);
                message.AppendBoolean(true);
                message.AppendBoolean(false);
                Session.SendPacket(message);
            }
        }
        public void parse(GameClient Session, ClientPacket Packet)
        {
            if (Session.GetHabbo().MutantPenalty)
            {
                Session.SendNotif("Because of a penalty or restriction on your account, you are not allowed to change your look.");
                return;
            }

            string Gender = Packet.PopFixedString().ToUpper();
            string Look = UberEnvironment.FilterInjectionChars(Packet.PopFixedString());

            if (!AntiMutant.ValidateLook(Look, Gender))
            {
                return;
            }

            Session.GetHabbo().Look = Look;
            Session.GetHabbo().Gender = Gender.ToLower();

            using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
            {
                dbClient.AddParamWithValue("look", Look);
                dbClient.AddParamWithValue("gender", Gender);
                dbClient.ExecuteQuery("UPDATE users SET look = @look, gender = @gender WHERE id = '" + Session.GetHabbo().Id + "' LIMIT 1");
            }

            UberEnvironment.GetGame().GetAchievementManager().UnlockAchievement(Session, 1, 1);

            ServerPacket packet = new ServerPacket(266);
            packet.AppendInt32(-1);
            packet.AppendStringWithBreak(Session.GetHabbo().Look);
            packet.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower());
            packet.AppendStringWithBreak(Session.GetHabbo().Motto);
            Session.SendPacket(packet);

            if (Session.GetHabbo().InRoom)
            {
                Room Room = Session.GetHabbo().CurrentRoom;

                if (Room == null)
                {
                    return;
                }

                RoomUser User = Room.GetRoomUserByHabbo(Session.GetHabbo().Id);

                if (User == null)
                {
                    return;
                }

                ServerPacket RoomUpdate = new ServerPacket(266);
                RoomUpdate.AppendInt32(User.VirtualId);
                RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Look);
                RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower());
                RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Motto);
                Room.SendMessage(RoomUpdate);
            }
        }
 public void parse(GameClient Session, ClientPacket Packet)
 {
     if (Session.GetHabbo() == null)
     {
         Session.Login(Packet.PopFixedString());
     }
     else
     {
         Session.SendNotif("You are already logged in!");
     }
 }
Пример #6
0
        public RoomData CreateRoom(GameClient Session, string Name, string Model)
        {
            Name = UberEnvironment.FilterInjectionChars(Name);

            if (!Models.ContainsKey(Model))
            {
                Session.SendNotif("Sorry, this room model has not been added yet. Try again later.");
                return null;
            }

            if (Models[Model].ClubOnly && !Session.GetHabbo().HasFuse("fuse_use_special_room_layouts"))
            {
                Session.SendNotif("You must be an Club member to use that room layout.");
                return null;
            }

            if (Name.Length < 3)
            {
                Session.SendNotif("Room name is too short for room creation!");
                return null;
            }

            using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
            {
                dbClient.AddParamWithValue("caption", Name);
                dbClient.AddParamWithValue("model", Model);
                dbClient.AddParamWithValue("username", Session.GetHabbo().Username);
                dbClient.ExecuteQuery("INSERT INTO rooms (roomtype,caption,owner,model_name) VALUES ('private',@caption,@username,@model)");
            }

            uint RoomId = 0;

            using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
            {
                dbClient.AddParamWithValue("caption", Name);
                dbClient.AddParamWithValue("username", Session.GetHabbo().Username);
                RoomId = (uint)dbClient.ReadDataRow("SELECT id FROM rooms WHERE owner = @username AND caption = @caption ORDER BY id DESC")[0];
            }

            return GenerateRoomData(RoomId);
        }
        public void parse(GameClient Session, ClientPacket Packet)
        {
            uint ItemId = Packet.PopWiredUInt();
            DataRow Row = null;

            using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
            {
                Row = dbClient.ReadDataRow("SELECT * FROM catalog_marketplace_offers WHERE offer_id = '" + ItemId + "' LIMIT 1");
            }

            if (Row == null || (string)Row["state"] != "1" || (double)Row["timestamp"] <= UberEnvironment.GetGame().GetCatalog().GetMarketplace().FormatTimestamp())
            {
                Session.SendNotif("Sorry, this offer has expired.");
                return;
            }

            Item Item = UberEnvironment.GetGame().GetItemManager().GetItem((uint)Row["item_id"]);

            if (Item == null)
            {
                return;
            }

            if ((int)Row["total_price"] >= 1)
            {
                Session.GetHabbo().Credits -= (int)Row["total_price"];
                Session.GetHabbo().UpdateCreditsBalance(true);
            }

            UberEnvironment.GetGame().GetCatalog().DeliverItems(Session, Item, 1, (string)Row["extra_data"]);

            using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
            {
                dbClient.ExecuteQuery("UPDATE catalog_marketplace_offers SET state = '2' WHERE offer_id = '" + ItemId + "' LIMIT 1");
            }

            ServerPacket packet = new ServerPacket(67);
            packet.AppendUInt(Item.ItemId);
            packet.AppendStringWithBreak(Item.Name);
            packet.AppendInt32(0);
            packet.AppendInt32(0);
            packet.AppendInt32(1);
            packet.AppendStringWithBreak(Item.Type.ToLower());
            packet.AppendInt32(Item.SpriteId);
            packet.AppendStringWithBreak("");
            packet.AppendInt32(1);
            packet.AppendInt32(-1);
            packet.AppendStringWithBreak("");
            Session.SendPacket(packet);

            Session.SendPacket(UberEnvironment.GetGame().GetCatalog().GetMarketplace().SerializeOffers(-1, -1, "", 1));
        }
        public void parse(GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().HasFuse("fuse_mod"))
            {
                return;
            }

            uint UserId = Packet.PopWiredUInt();

            if (UberEnvironment.GetGame().GetClientManager().GetNameById(UserId) != "Unknown User")
            {
                Session.SendPacket(UberEnvironment.GetGame().GetModerationTool().SerializeUserInfo(UserId));
            }
            else
            {
                Session.SendNotif("Could not load user info; invalid user.");
            }
        }
Пример #9
0
        public void BanUser(GameClient ModSession, uint UserId, int Length, string Message)
        {
            GameClient Client = UberEnvironment.GetGame().GetClientManager().GetClientByHabbo(UserId);

            if (Client == null || Client.GetHabbo().Id == ModSession.GetHabbo().Id)
            {
                return;
            }

            if (Client.GetHabbo().Rank >= ModSession.GetHabbo().Rank)
            {
                ModSession.SendNotif("You do not have permission to ban that user.");
                return;
            }

            Double dLength = Length;

            UberEnvironment.GetGame().GetBanManager().BanUser(Client, ModSession.GetHabbo().Username, dLength, Message, false);
        }
        public void parse(GameClient Session, ClientPacket Packet)
        {
            Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

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

            uint PetId = Packet.PopWiredUInt();

            Pet Pet = Session.GetHabbo().GetInventoryComponent().GetPet(PetId);

            if (Pet == null || Pet.PlacedInRoom)
            {
                return;
            }

            int X = Packet.PopWiredInt32();
            int Y = Packet.PopWiredInt32();

            if (!Room.CanWalk(X, Y, 0, true))
            {
                return;
            }

            if (Room.PetCount >= UberEnvironment.GetGame().GetRoomManager().MAX_PETS_PER_ROOM)
            {
                Session.SendNotif("There are too many pets in this room. A room may only contain up to " + UberEnvironment.GetGame().GetRoomManager().MAX_PETS_PER_ROOM + " pets.");
                return;
            }

            Pet.PlacedInRoom = true;
            Pet.RoomId = Room.RoomId;

            RoomUser PetUser = Room.DeployBot(new HabboHotel.RoomBots.RoomBot(Pet.PetId, Pet.RoomId, "pet", "freeroam", Pet.Name, "", Pet.Look, X, Y, 0, 0, 0, 0, 0, 0), Pet);

            if (Room.CheckRights(Session, true))
            {
                Session.GetHabbo().GetInventoryComponent().MovePetToRoom(Pet.PetId, Room.RoomId);
            }
        }
        public void parse(GameClient Session, ClientPacket Packet)
        {
            uint UserId = Packet.PopWiredUInt();

            Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
            RoomUser RoomUser = Room.GetRoomUserByHabbo(UserId);

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

            if (Room.UsersWithRights.Contains(UserId))
            {
                // todo: fix silly bug
                Session.SendNotif("User already has rights! (There appears to be a bug with the rights button, we are looking into it - for now rely on 'Advanced settings')");
                return;
            }

            Room.UsersWithRights.Add(UserId);

            using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
            {
                dbClient.ExecuteQuery("INSERT INTO room_rights (room_id,user_id) VALUES ('" + Room.RoomId + "','" + UserId + "')");
            }

            ServerPacket packet = new ServerPacket(510);
            packet.AppendUInt(Room.RoomId);
            packet.AppendUInt(UserId);
            packet.AppendStringWithBreak(RoomUser.GetClient().GetHabbo().Username);
            Session.SendPacket(packet);

            RoomUser.AddStatus("flatcrtl", "");
            RoomUser.UpdateNeeded = true;

            RoomUser.GetClient().SendPacket(new ServerPacket(42));
        }
Пример #12
0
        public void KickUser(GameClient ModSession, uint UserId, string Message, Boolean Soft)
        {
            GameClient Client = UberEnvironment.GetGame().GetClientManager().GetClientByHabbo(UserId);

            if (Client == null || Client.GetHabbo().CurrentRoomId < 1 || Client.GetHabbo().Id == ModSession.GetHabbo().Id)
            {
                return;
            }

            if (Client.GetHabbo().Rank >= ModSession.GetHabbo().Rank)
            {
                ModSession.SendNotif("You do not have permission to kick that user.");
                return;
            }

            Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Client.GetHabbo().CurrentRoomId);

            if (Room == null)
            {
                return;
            }

            Room.RemoveUserFromRoom(Client, true, false);

            if (!Soft)
            {
                Client.SendNotif(Message);

                using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
                {
                    dbClient.ExecuteQuery("UPDATE user_info SET cautions = cautions + 1 WHERE user_id = '" + UserId + "' LIMIT 1");
                }
            }
        }
Пример #13
0
        public static Boolean Parse(GameClient Session, string Input)
        {
            string[] Params = Input.Split(' ');

            string TargetUser = null;
            GameClient TargetClient = null;
            Room TargetRoom = null;
            RoomUser TargetRoomUser = null;

            try
            {
                switch (Params[0].ToLower())
                {
                    #region Debugging/Development
                    case "update_inventory":

                        if (Session.GetHabbo().HasFuse("fuse_sysadmin"))
                        {
                            Session.GetHabbo().GetInventoryComponent().UpdateItems(true);
                            return true;
                        }

                        return false;

                    case "update_bots":

                        if (Session.GetHabbo().HasFuse("fuse_sysadmin"))
                        {
                            UberEnvironment.GetGame().GetBotManager().LoadBots();
                            return true;
                        }

                        return false;

                    case "update_catalog":

                        if (Session.GetHabbo().HasFuse("fuse_sysadmin"))
                        {
                            UberEnvironment.GetGame().GetCatalog().Initialize();
                            UberEnvironment.GetGame().GetClientManager().BroadcastMessage(new ServerPacket(441));

                            return true;
                        }

                        return false;

                    case "update_help":

                        if (Session.GetHabbo().HasFuse("fuse_sysadmin"))
                        {
                            UberEnvironment.GetGame().GetHelpTool().LoadCategories();
                            UberEnvironment.GetGame().GetHelpTool().LoadTopics();
                            Session.SendNotif("Reloaded help categories and topics successfully.");

                            return true;
                        }

                        return false;

                    case "update_navigator":

                        if (Session.GetHabbo().HasFuse("fuse_sysadmin"))
                        {
                            UberEnvironment.GetGame().GetNavigator().Initialize();
                            Session.SendNotif("Re-initialized navigator successfully.");

                            return true;
                        }

                        return false;

                    /*case "idletime":

                        if (Session.GetHabbo().HasFuse("fuse_sysadmin"))
                        {
                            TargetRoom = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
                            TargetRoomUser = TargetRoom.GetRoomUserByHabbo(Session.GetHabbo().Id);

                            TargetRoomUser.IdleTime = 600;

                            return true;
                        }

                        return false;*/

                    case "t":

                        if (Session.GetHabbo().HasFuse("fuse_sysadmin"))
                        {
                            TargetRoom = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

                            if (TargetRoom == null)
                            {
                                return false;
                            }

                            TargetRoomUser = TargetRoom.GetRoomUserByHabbo(Session.GetHabbo().Id);

                            if (TargetRoomUser == null)
                            {
                                return false;
                            }

                            Session.SendNotif("X: " + TargetRoomUser.X + " - Y: " + TargetRoomUser.Y + " - Z: " + TargetRoomUser.Z + " - Rot: " + TargetRoomUser.RotBody);

                            return true;
                        }

                        return false;

                    case "override":

                        if (Session.GetHabbo().HasFuse("fuse_sysadmin"))
                        {
                            TargetRoom = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

                            if (TargetRoom == null)
                            {
                                return false;
                            }

                            TargetRoomUser = TargetRoom.GetRoomUserByHabbo(Session.GetHabbo().Id);

                            if (TargetRoomUser == null)
                            {
                                return false;
                            }

                            if (TargetRoomUser.AllowOverride)
                            {
                                TargetRoomUser.AllowOverride = false;
                                Session.SendNotif("Walking override disabled.");
                            }
                            else
                            {
                                TargetRoomUser.AllowOverride = true;
                                Session.SendNotif("Walking override enabled.");
                            }

                            return true;
                        }

                        return false;
                    case "moonwalkon":

                        Rotation.MoonwalkEnabled = 1;
                        Session.SendNotif("Moonwalk is now enabled.");
                        Console.WriteLine("Someone has enabled their moonwalk.");

                        break;

                    case "moonwalkoff":

                        Rotation.MoonwalkEnabled = 0;
                        Session.SendNotif("Moonwalk is now disabled..");
                        Console.WriteLine("Someone has turned their moonwalk off.");

                        break;

                    case "update_defs":

                        if (Session.GetHabbo().HasFuse("fuse_sysadmin"))
                        {
                            UberEnvironment.GetGame().GetItemManager().LoadItems();
                            Session.SendNotif("Item defenitions reloaded successfully.");
                            return true;
                        }

                        return false;

                    case "whosonline":

                        if (Session.GetHabbo().HasFuse("fuse_sysadmin"))
                        {
                            DataTable onlineData = new DataTable("online");
                            string message = "Users Online:\r";
                            using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
                            {
                                onlineData = dbClient.ReadDataTable("SELECT username FROM users WHERE online = '1';");
                            }
                            foreach (DataRow user in onlineData.Rows)
                            {
                                message = message + user["username"] + "\r";
                            }
                            Session.SendNotif(message);
                            return true;
                        }

                        return false;

                    #endregion

                    #region General Commands
                    case "pickall":

                        TargetRoom = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

                        if (TargetRoom != null && TargetRoom.CheckRights(Session, true))
                        {
                            List<RoomItem> ToRemove = new List<RoomItem>();

                            ToRemove.AddRange(TargetRoom.Items);

                            foreach (RoomItem Item in ToRemove)
                            {
                                TargetRoom.RemoveFurniture(Session, Item.Id);
                                Session.GetHabbo().GetInventoryComponent().AddItem(Item.Id, Item.BaseItem, Item.ExtraData);
                            }

                            Session.GetHabbo().GetInventoryComponent().UpdateItems(true);
                            return true;
                        }

                        return false;

                    case "empty":

                        Session.GetHabbo().GetInventoryComponent().ClearItems();

                        return true;
                    #endregion

                    #region Moderation Commands

                    case "invisible":

                        if (Session.GetHabbo().HasFuse("fuse_sysadmin"))
                        {
                            if (Session.GetHabbo().SpectatorMode)
                            {
                                Session.GetHabbo().SpectatorMode = false;
                                Session.SendNotif("Spectator mode disabled. Reload the room to apply changes.");
                            }
                            else
                            {
                                Session.GetHabbo().SpectatorMode = true;
                                Session.SendNotif("Spectator mode enabled. Reload the room to apply changes.");
                            }

                            return true;
                        }

                        return false;

                    case "commands":
                        if (Session.GetHabbo().HasFuse("fuse_sysadmin"))
                            Session.SendNotif("Hello Administrator. Below are your commands~\n\n" + ":ha (message)\n:shutup <user> <message>\n:roomkick <message>\n\nMore are available.");
                        else
                            Session.SendNotif("Hello user. Below are your commands~\n\n" + ":commands - Shows this dialogue.\n:about - Tells you information about our emulator.\n:moonwalkon - Turns moonwalk on\n:moonwalkoff - Turns moonwalk off\n\nThats all for now, Enjoy!");
                        break;

                    case "ha":
                        if (Session.GetHabbo().HasFuse("fuse_sysadmin"))
                        {
                            string Notice = Input.Substring(3);
                            ServerPacket HotelAlert = new ServerPacket(139);
                            HotelAlert.AppendStringWithBreak("Message from Hotel Management:\r\n" + Notice + "\r\n-" + Session.GetHabbo().Username);
                            UberEnvironment.GetGame().GetClientManager().BroadcastMessage(HotelAlert);

                            return true;
                        }
                        return false;

                    case "credits":
                        if (Session.GetHabbo().HasFuse("fuse_sysadmin"))
                        {
                            TargetClient = UberEnvironment.GetGame().GetClientManager().GetClientByHabbo(Params[1]);
                            if (TargetClient != null)
                            {
                                int creditsToAdd;
                                if (int.TryParse(Params[2], out creditsToAdd))
                                {
                                    TargetClient.GetHabbo().Credits = TargetClient.GetHabbo().Credits + creditsToAdd;
                                    TargetClient.GetHabbo().UpdateCreditsBalance(true);
                                    TargetClient.SendNotif(Session.GetHabbo().Username + " has awarded you " + creditsToAdd.ToString() + " credits!");
                                    Session.SendNotif("Credit balance updated successfully.");
                                    return true;
                                }
                                else
                                {
                                    Session.SendNotif("Please enter a valid amount of credits.");
                                    return false;
                                }
                            }
                            else
                            {
                                Session.SendNotif("User could not be found.");
                                return false;
                            }
                        }
                        return false;

                    case "pixels":
                        if (Session.GetHabbo().HasFuse("fuse_sysadmin"))
                        {
                            TargetClient = UberEnvironment.GetGame().GetClientManager().GetClientByHabbo(Params[1]);
                            if (TargetClient != null)
                            {
                                int creditsToAdd;
                                if (int.TryParse(Params[2], out creditsToAdd))
                                {
                                    TargetClient.GetHabbo().ActivityPoints = TargetClient.GetHabbo().ActivityPoints + creditsToAdd;
                                    TargetClient.GetHabbo().UpdateActivityPointsBalance(true);
                                    TargetClient.SendNotif(Session.GetHabbo().Username + " has awarded you " + creditsToAdd.ToString() + " pixels!");
                                    Session.SendNotif("Pixel balance updated successfully.");
                                    return true;
                                }
                                else
                                {
                                    Session.SendNotif("Please enter a valid amount of pixels.");
                                    return false;
                                }
                            }
                            else
                            {
                                Session.SendNotif("User could not be not found.");
                                return false;
                            }
                        }
                        return false;

                    case "ban":

                        if (Session.GetHabbo().HasFuse("fuse_ban"))
                        {
                            TargetClient = UberEnvironment.GetGame().GetClientManager().GetClientByHabbo(Params[1]);

                            if (TargetClient == null)
                            {
                                Session.SendNotif("User not found.");
                                return true;
                            }

                            if (TargetClient.GetHabbo().Rank >= Session.GetHabbo().Rank)
                            {
                                Session.SendNotif("You are not allowed to ban that user.");
                                return true;
                            }

                            int BanTime = 0;

                            try
                            {
                                BanTime = int.Parse(Params[2]);
                            }
                            catch (FormatException) { }

                            if (BanTime <= 600)
                            {
                                Session.SendNotif("Ban time is in seconds and must be at least than 600 seconds (ten minutes). For more specific preset ban times, use the mod tool.");
                            }

                            UberEnvironment.GetGame().GetBanManager().BanUser(TargetClient, Session.GetHabbo().Username, BanTime, MergeParams(Params, 3), false);
                            return true;
                        }

                        return false;

                    case "superban":

                        if (Session.GetHabbo().HasFuse("fuse_superban"))
                        {
                            TargetClient = UberEnvironment.GetGame().GetClientManager().GetClientByHabbo(Params[1]);

                            if (TargetClient == null)
                            {
                                Session.SendNotif("User not found.");
                                return true;
                            }

                            if (TargetClient.GetHabbo().Rank >= Session.GetHabbo().Rank)
                            {
                                Session.SendNotif("You are not allowed to ban that user.");
                                return true;
                            }

                            UberEnvironment.GetGame().GetBanManager().BanUser(TargetClient, Session.GetHabbo().Username, 360000000, MergeParams(Params, 2), false);
                            return true;
                        }

                        return false;

                    case "roomkick":

                        if (Session.GetHabbo().HasFuse("fuse_roomkick"))
                        {
                            TargetRoom = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

                            if (TargetRoom == null)
                            {
                                return false;
                            }

                            bool GenericMsg = true;
                            string ModMsg = MergeParams(Params, 1);

                            if (ModMsg.Length > 0)
                            {
                                GenericMsg = false;
                            }

                            foreach (RoomUser RoomUser in TargetRoom.UserList)
                            {
                                if (RoomUser.GetClient().GetHabbo().Rank >= Session.GetHabbo().Rank)
                                {
                                    continue;
                                }

                                if (!GenericMsg)
                                {
                                    RoomUser.GetClient().SendNotif("You have been kicked by an moderator: " + ModMsg);
                                }

                                TargetRoom.RemoveUserFromRoom(RoomUser.GetClient(), true, GenericMsg);
                            }

                            return true;
                        }

                        return false;

                    case "roomalert":

                        if (Session.GetHabbo().HasFuse("fuse_roomalert"))
                        {
                            TargetRoom = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

                            if (TargetRoom == null)
                            {
                                return false;
                            }

                            string Msg = MergeParams(Params, 1);

                            foreach (RoomUser RoomUser in TargetRoom.UserList)
                            {
                                if (RoomUser.IsBot) { continue; }
                                RoomUser.GetClient().SendNotif(Msg);
                            }

                            return true;
                        }

                        return false;

                    case "mute":

                        if (Session.GetHabbo().HasFuse("fuse_mute"))
                        {
                            TargetUser = Params[1];
                            TargetClient = UberEnvironment.GetGame().GetClientManager().GetClientByHabbo(TargetUser);

                            if (TargetClient == null || TargetClient.GetHabbo() == null)
                            {
                                Session.SendNotif("Could not find user: "******"You are not allowed to (un)mute that user.");
                                return true;
                            }

                            TargetClient.GetHabbo().Mute();
                            return true;
                        }

                        return false;

                    case "unmute":

                        if (Session.GetHabbo().HasFuse("fuse_mute"))
                        {
                            TargetUser = Params[1];
                            TargetClient = UberEnvironment.GetGame().GetClientManager().GetClientByHabbo(TargetUser);

                            if (TargetClient == null || TargetClient.GetHabbo() == null)
                            {
                                Session.SendNotif("Could not find user: "******"You are not allowed to (un)mute that user.");
                                return true;
                            }

                            TargetClient.GetHabbo().Unmute();
                            return true;
                        }

                        return false;

                    case "alert":

                        if (Session.GetHabbo().HasFuse("fuse_alert"))
                        {
                            TargetUser = Params[1];
                            TargetClient = UberEnvironment.GetGame().GetClientManager().GetClientByHabbo(TargetUser);

                            if (TargetClient == null)
                            {
                                Session.SendNotif("Could not find user: "******"fuse_admin"));
                            return true;
                        }

                        return false;

                    case "softkick":
                    case "kick":

                        if (Session.GetHabbo().HasFuse("fuse_kick"))
                        {
                            TargetUser = Params[1];
                            TargetClient = UberEnvironment.GetGame().GetClientManager().GetClientByHabbo(TargetUser);

                            if (TargetClient == null)
                            {
                                Session.SendNotif("Could not find user: "******"You are not allowed to kick that user.");
                                return true;
                            }

                            if (TargetClient.GetHabbo().CurrentRoomId < 1)
                            {
                                Session.SendNotif("That user is not in a room and can not be kicked.");
                                return true;
                            }

                            TargetRoom = UberEnvironment.GetGame().GetRoomManager().GetRoom(TargetClient.GetHabbo().CurrentRoomId);

                            if (TargetRoom == null)
                            {
                                return true;
                            }

                            TargetRoom.RemoveUserFromRoom(TargetClient, true, false);

                            if (Params.Length > 2)
                            {
                                TargetClient.SendNotif("A moderator has kicked you from the room for the following reason: " + MergeParams(Params, 2));
                            }
                            else
                            {
                                TargetClient.SendNotif("A moderator has kicked you from the room.");
                            }

                            return true;
                        }

                        return false;
                    #endregion
                }
            }
            catch { }

            return false;
        }
        public void parse(GameClient Session, ClientPacket Packet)
        {
            Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

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

            int Id = Packet.PopWiredInt32();
            string Name = UberEnvironment.FilterInjectionChars(Packet.PopFixedString());
            string Description = UberEnvironment.FilterInjectionChars(Packet.PopFixedString());
            int State = Packet.PopWiredInt32();
            string Password = UberEnvironment.FilterInjectionChars(Packet.PopFixedString());
            int MaxUsers = Packet.PopWiredInt32();
            int CategoryId = Packet.PopWiredInt32();
            int TagCount = Packet.PopWiredInt32();

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

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

                string tag = UberEnvironment.FilterInjectionChars(Packet.PopFixedString().ToLower());

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

            int AllowPets = 0;
            int AllowPetsEat = 0;
            int AllowWalkthrough = 0;
            int Hidewall = 0;

            string _AllowPets = Packet.PlainReadBytes(1)[0].ToString();
            Packet.AdvancePointer(1);

            string _AllowPetsEat = Packet.PlainReadBytes(1)[0].ToString();
            Packet.AdvancePointer(1);

            string _AllowWalkthrough = Packet.PlainReadBytes(1)[0].ToString();
            Packet.AdvancePointer(1);

            string _Hidewall = Packet.PlainReadBytes(1)[0].ToString();
            Packet.AdvancePointer(1);

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

            if (State < 0 || State > 2)
            {
                return;
            }

            if (MaxUsers != 10 && MaxUsers != 15 && MaxUsers != 20 && MaxUsers != 25)
            {
                return;
            }

            FlatCat FlatCat = UberEnvironment.GetGame().GetNavigator().GetFlatCat(CategoryId);

            if (FlatCat == null)
            {
                return;
            }

            if (FlatCat.MinRank > Session.GetHabbo().Rank)
            {
                Session.SendNotif("You are not allowed to use this category. Your room has been moved to no category instead.");
                CategoryId = 0;
            }

            if (TagCount > 2)
            {
                return;
            }

            if (State < 0 || State > 2)
            {
                return;
            }

            if (_AllowPets == "65")
            {
                AllowPets = 1;
                Room.AllowPets = true;
            }
            else
            {
                Room.AllowPets = false;
            }

            if (_AllowPetsEat == "65")
            {
                AllowPetsEat = 1;
                Room.AllowPetsEating = true;
            }
            else
            {
                Room.AllowPetsEating = false;
            }

            if (_AllowWalkthrough == "65")
            {
                AllowWalkthrough = 1;
                Room.AllowWalkthrough = true;
            }
            else
            {
                Room.AllowWalkthrough = false;
            }

            if (_Hidewall == "65")
            {
                Hidewall = 1;
                Room.Hidewall = true;
            }
            else
            {
                Room.Hidewall = false;
            }

            Room.Name = Name;
            Room.State = State;
            Room.Description = Description;
            Room.Category = CategoryId;
            Room.Password = Password;
            Room.Tags = Tags;
            Room.UsersMax = MaxUsers;

            string formattedState = "open";

            if (Room.State == 1)
            {
                formattedState = "locked";
            }
            else if (Room.State > 1)
            {
                formattedState = "password";
            }

            using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
            {
                dbClient.AddParamWithValue("caption", Room.Name);
                dbClient.AddParamWithValue("description", Room.Description);
                dbClient.AddParamWithValue("password", Room.Password);
                dbClient.AddParamWithValue("tags", formattedTags.ToString());
                dbClient.ExecuteQuery("UPDATE rooms SET caption = @caption, description = @description, password = @password, category = '" + CategoryId + "', state = '" + formattedState + "', tags = @tags, users_max = '" + MaxUsers + "', allow_pets = '" + AllowPets + "', allow_pets_eat = '" + AllowPetsEat + "', allow_walkthrough = '" + AllowWalkthrough + "', allow_hidewall = '" + Hidewall + "' WHERE id = '" + Room.RoomId + "' LIMIT 1");
            }

            ServerPacket packet = new ServerPacket(467);
            packet.AppendUInt(Room.RoomId);
            Session.SendPacket(packet);

            packet = new ServerPacket(456);
            packet.AppendUInt(Room.RoomId);
            Session.SendPacket(packet);

            packet = new ServerPacket(472);
            packet.AppendBoolean(Room.Hidewall);
            UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId).SendMessage(packet);

            RoomData Data = new RoomData();
            Data.Fill(Room);

            packet = new ServerPacket(454);
            packet.AppendBoolean(false);
            Data.Serialize(packet, false);
            packet.AppendBoolean(false);
            packet.AppendBoolean(false);
            Session.SendPacket(packet);
        }
        public void parse(GameClient Session, ClientPacket Packet)
        {
            Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

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

            string PlacementData = Packet.PopFixedString();
            string[] DataBits = PlacementData.Split(' ');
            uint ItemId = uint.Parse(DataBits[0]);

            UserItem Item = Session.GetHabbo().GetInventoryComponent().GetItem(ItemId);

            if (Item == null)
            {
                return;
            }

            switch (Item.GetBaseItem().InteractionType.ToLower())
            {
                case "dimmer":

                    if (Room.ItemCountByType("dimmer") >= 1)
                    {
                        Session.SendNotif("You can only have one moodlight in a room.");
                        return;
                    }

                    break;
            }

            // Wall Item
            if (DataBits[1].StartsWith(":"))
            {
                string WallPos = Room.WallPositionCheck(":" + PlacementData.Split(':')[1]);

                if (WallPos == null)
                {
                    ServerPacket packet = new ServerPacket(516);
                    packet.AppendInt32(11);
                    Session.SendPacket(packet);

                    return;
                }

                RoomItem RoomItem = new RoomItem(Item.Id, Room.RoomId, Item.BaseItem, Item.ExtraData, 0, 0, 0.0, 0, WallPos);

                if (Room.SetWallItem(Session, RoomItem))
                {
                    Session.GetHabbo().GetInventoryComponent().RemoveItem(ItemId);
                }
            }
            // Floor Item
            else
            {
                int X = int.Parse(DataBits[1]);
                int Y = int.Parse(DataBits[2]);
                int Rot = int.Parse(DataBits[3]);

                RoomItem RoomItem = new RoomItem(Item.Id, Room.RoomId, Item.BaseItem, Item.ExtraData, 0, 0, 0, 0, "");

                if (Room.SetFloorItem(Session, RoomItem, X, Y, Rot, true))
                {
                    Session.GetHabbo().GetInventoryComponent().RemoveItem(ItemId);
                }
            }
        }