コード例 #1
0
        /// <summary>
        /// Handler event for this plugin.
        /// </summary>
        /// <param name="b">A currently active RestBot</param>
        /// <param name="Parameters">none</param>
        /// <remarks>This will return (some) avatar data associated with the current session ID</remarks>
        /// if that session is known to exist.</remarks>
        public override string Process(RestBot b, Dictionary <string, string> Parameters)
        {
            if (b == null)                      // should be impossible
            {
                return("<error>invalid request</error>");
            }

            /// Note: the description below is outdated! (gwyneth 20220504)
            /// <value>Constructs a XML response with the following data:
            /// <list type="bullet">
            ///   <item>
            ///     <description>Avatar first name</description>
            ///   </item>
            ///   <item>
            ///     <description>Avatar last name</description>
            ///   </item>
            ///   <item>
            ///     <description>Avatar last namekey (UUID)</description>
            ///   </item>
            ///   <item>
            ///     <description>Current status, same as returned by the "status" member function</description>
            ///   </item>
            ///   <item>
            ///     <description>Session ID (redundant)</description>
            ///   </item>
            ///   <item>
            ///     <description>Uptime (not sure if it's just seconds since login, or date/time of login; assuming the latter)</description>
            ///   </item>
            ///   <item>
            ///     <description>Start position: can be "home", "last", or an URI describing region and position</description>
            ///   </item>
            /// </list>
            /// </value>
            string response = $@"<{MethodName}>
	<FirstName>{b.First}</FirstName>
	<LastName>{b.Last}</LastName>
	<name>{b.First} {b.Last}</name>
	<key>{b.Client.Self.AgentID.ToString()}</key>
	<status>{b.myStatus.ToString()}</status>
	<session_id>{b.sessionid.ToString()}</session_id>
	<uptime>{b.getUptimeISO8601()}</uptime>
	<start>{b.Start}</start>
	<CurrentSim>{b.Client.Network.CurrentSim.ToString()}</CurrentSim>
	<Position>{b.Client.Self.SimPosition.X},{b.Client.Self.SimPosition.Y},{b.Client.Self.SimPosition.Z}</Position>
	<Rotation>{b.Client.Self.SimRotation.X},{b.Client.Self.SimRotation.Y},{b.Client.Self.SimRotation.Z},{b.Client.Self.SimRotation.W}</Rotation>
</{MethodName}>
";

            return(response);
        } // end Process