Example #1
0
        /// <summary>
        /// Activates a room user and makes it appear in the door of the room.
        /// </summary>
        /// <param name="Session">The Woodpecker.Sessions.Session object of the user that is ready to interact with the room.</param>
        public void startUser(Session Session)
        {
            if (!enteringSessions.Contains(Session.ID)) // Invalid entry
            {
                return;
            }

            roomUser newUser = new roomUser(Session);

            if (Session.authenticatedTeleporter == 0)
            {
                roomModel Model = this.getModel();
                if (Model == null)
                {
                    return;
                }
                newUser.X = Model.doorX;
                newUser.Y = Model.doorY;
                newUser.Z = Model.doorZ;
            }
            else
            {
                Items.floorItem pItem = this.getFloorItem(Session.authenticatedTeleporter);
                if (pItem != null && pItem.Definition.Behaviour.isTeleporter)
                {
                    newUser.X = pItem.X;
                    newUser.Y = pItem.Y;
                    newUser.Z = pItem.Z;
                    Session.authenticatedTeleporter = 0;

                    this.broadcoastTeleportActivity(pItem.ID, Session.User.Username, false);
                }
                else
                {
                    return; // Invalid item used to enter flat
                }
            }
            newUser.ID = this.getFreeRoomUnitIdentifier();

            if (this.Information.isUserFlat)
            {
                newUser.isOwner = (Session.User.Username == this.Information.Owner ||
                                   Session.User.hasFuseRight("fuse_any_room_controller"));

                newUser.hasRights = (newUser.isOwner ||
                                     this.Information.superUsers ||
                                     Engine.Game.Rooms.userHasRightsInRoom(Session.User.ID, this.roomID));

                newUser.refreshRights();
            }

            // User has entered
            Session.roomID = this.roomID;

            this.enteringSessions.Remove(Session.ID);
            this.roomUsers.Add(Session.ID, newUser);

            this.castRoomUnit(newUser.ToString());
            this.updateUserAmount();
        }
Example #2
0
        /// <summary>
        /// 96 - "A`"
        /// </summary>
        public void ASSIGNRIGHTS()
        {
            if (Session.roomInstance.sessionHasFlatAdmin(Session.ID))
            {
                roomUser Target = Session.roomInstance.getRoomUser(Request.Content);
                if (Target == null || Target.hasRights) // Invalid
                {
                    return;
                }

                Target.hasRights = true;
                Target.refreshRights();
                ObjectTree.Game.Rooms.addRoomRights(Session.roomID, Target.Session.User.ID);
            }
        }
Example #3
0
        /// <summary>
        /// 97 - "Aa"
        /// </summary>
        public void REMOVERIGHTS()
        {
            if (Session.roomInstance.sessionHasFlatAdmin(Session.ID))
            {
                roomUser Target = Session.roomInstance.getRoomUser(Request.Content);
                if (Target == null || !Target.hasRights || Target.isOwner) // Invalid
                {
                    return;
                }

                Target.hasRights = false;
                Target.refreshRights();
                Target.Session.gameConnection.sendMessage(new Net.Game.Messages.serverMessage(43)); // "@k"
                ObjectTree.Game.Rooms.removeRoomRights(Session.roomID, Target.Session.User.ID);
            }
        }