Exemplo n.º 1
0
        public static void setHandItem(ref roomUser User, string Item)
        {
            int ID = 0;
            if (int.TryParse(Item, out ID))
            {
                try
                {
                    string carryStatus = "";
                    string useStatus = "";
                    handItemType iType = handItemTypes[ID];
                    if(iType == handItemType.eat)
                    {
                        carryStatus = "carryf";
                        useStatus = "eat";
                    }
                    else if(iType == handItemType.drink)
                    {
                        carryStatus = "carryd";
                        useStatus = "drink";
                    }
                    else if(iType == handItemType.item)
                    {
                        carryStatus = "cri";
                        useStatus = "usei";
                    }

                    User.removeStatus("dance");
                    User.addStatus("handitem", carryStatus, ID.ToString(), 120, useStatus, 12, 1);
                }
                catch { }
            }
        }
Exemplo n.º 2
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();
                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
                    || ObjectTree.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();
        }