示例#1
0
        /// <summary>
        /// 24 - "@X"
        /// </summary>
        public void UPDATEFLAT()
        {
            string[] Details = Request.Content.Split('/');
            int      roomID  = int.Parse(Details[0]);

            roomInformation Room = Engine.Game.Rooms.getRoomInformation(roomID);

            if (Room != null && Room.ownerID == Session.User.ID)
            {
                stringFunctions.filterVulnerableStuff(ref Details[1], true);
                Room.Name       = Details[1];
                Room.accessType = (roomAccessType)Enum.Parse(typeof(roomAccessType), Details[2]);
                Room.showOwner  = (Details[3] == "1");
                Room.updateSettings();
            }
        }
示例#2
0
        /// <summary>
        /// 153 - "BY"
        /// </summary>
        public void SETFLATCAT()
        {
            int[] Parameters = Request.getWiredParameters();
            int   roomID     = Parameters[0];
            int   categoryID = Parameters[1];

            roomCategoryInformation newCategory = Engine.Game.Rooms.getRoomCategory(categoryID);

            if (newCategory != null && newCategory.userRoleCanPutFlat(Session.User.Role)) // Valid category
            {
                roomInformation Room = Engine.Game.Rooms.getRoomInformation(roomID);
                if (Room != null && Room.ownerID == Session.User.ID && Room.categoryID != newCategory.ID) // Valid change
                {
                    Room.categoryID = newCategory.ID;
                    Room.updateSettings();
                    if (Engine.Game.Rooms.roomInstanceRunning(roomID))
                    {
                        Engine.Game.Rooms.getRoomInstance(roomID).Information = Room;
                    }
                }
            }
        }
示例#3
0
        /// <summary>
        /// 25 - "@Y"
        /// </summary>
        public void SETFLATINFO()
        {
            int roomID = 0;

            if (Request.Content[0] == '/') // Create room
            {
                roomID = int.Parse(Request.Content.Split('/')[1]);
            }
            else
            {
                roomID = int.Parse(Request.Content.Split('/')[0]);
            }

            roomInformation Room = Engine.Game.Rooms.getRoomInformation(roomID);

            if (Room != null && Room.ownerID == Session.User.ID) // Allowed to edit!
            {
                string[] Settings = Request.Content.Split(Convert.ToChar(13));
                for (int i = 1; i < Settings.Length; i++)
                {
                    int    keyLength = Settings[i].IndexOf('=');
                    string Key       = Settings[i].Substring(0, keyLength);
                    string Value     = Settings[i].Substring(keyLength + 1);

                    switch (Key)
                    {
                    case "description":
                    {
                        stringFunctions.filterVulnerableStuff(ref Value, true);
                        Room.Description = Value;
                    }
                    break;

                    case "allsuperuser":
                    {
                        Room.superUsers = (Value == "1");
                    }
                    break;

                    case "maxvisitors":
                    {
                        Room.maxVisitors = int.Parse(Value);
                        if (Room.maxVisitors < 10 || Room.maxVisitors > 50)
                        {
                            Room.maxVisitors = 25;
                        }
                    }
                    break;

                    case "password":
                    {
                        stringFunctions.filterVulnerableStuff(ref Value, false);
                        Room.Password = Value;
                    }
                    break;

                    default:     // Hax
                        return;
                    }
                }
                Room.updateSettings();
            }
        }