예제 #1
0
        public override string Execute(string[] args, UUID fromAgentID)
        {
            if (args.Length < 1)
            {
                return("Usage: sendgeneric method_name [value1 value2 ...]");
            }

            string methodName = args[0];

            GenericMessagePacket gmp = new GenericMessagePacket();

            gmp.AgentData.AgentID       = Client.Self.AgentID;
            gmp.AgentData.SessionID     = Client.Self.SessionID;
            gmp.AgentData.TransactionID = UUID.Zero;

            gmp.MethodData.Method  = Utils.StringToBytes(methodName);
            gmp.MethodData.Invoice = UUID.Zero;

            gmp.ParamList = new GenericMessagePacket.ParamListBlock[args.Length - 1];

            StringBuilder sb = new StringBuilder();

            for (int i = 1; i < args.Length; i++)
            {
                GenericMessagePacket.ParamListBlock paramBlock = new GenericMessagePacket.ParamListBlock();
                paramBlock.Parameter = Utils.StringToBytes(args[i]);
                gmp.ParamList[i - 1] = paramBlock;
                sb.AppendFormat(" {0}", args[i]);
            }

            Client.Network.SendPacket(gmp);

            return(string.Format("Sent generic message with method {0}, params{1}", methodName, sb));
        }
        public override string Execute(string[] args, UUID fromAgentID)
        {
            UUID target;

            if (args.Length < 1)
                return "Usage: sendgeneric method_name [value1 value2 ...]";

            string methodName = args[0];

            GenericMessagePacket gmp = new GenericMessagePacket();

            gmp.AgentData.AgentID = Client.Self.AgentID;
            gmp.AgentData.SessionID = Client.Self.SessionID;
            gmp.AgentData.TransactionID = UUID.Zero;

            gmp.MethodData.Method = Utils.StringToBytes(methodName);
            gmp.MethodData.Invoice = UUID.Zero;

            gmp.ParamList = new GenericMessagePacket.ParamListBlock[args.Length - 1];

            StringBuilder sb = new StringBuilder();

            for (int i = 1; i < args.Length; i++)
            {
                GenericMessagePacket.ParamListBlock paramBlock = new GenericMessagePacket.ParamListBlock();
                paramBlock.Parameter = Utils.StringToBytes(args[i]);
                gmp.ParamList[i - 1] = paramBlock;
                sb.AppendFormat(" {0}", args[i]);
            }

            Client.Network.SendPacket(gmp);

            return string.Format("Sent generic message with method {0}, params{1}", methodName, sb);
        }
예제 #3
0
파일: Handicap.cs 프로젝트: zadark/par
        public Packet OutAutoPilot(Packet packet, IPEndPoint sim)
        {
            GenericMessagePacket genMsg = (GenericMessagePacket)packet;

            if (form.getcheck())
            {
                if (Utils.BytesToString(genMsg.MethodData.Method).ToLower().Contains("autopilot"))
                {
                    {
                        try
                        {
                            uint GlobalX = uint.Parse(Utils.BytesToString(genMsg.ParamList[0].Parameter));
                            uint GlobalY = uint.Parse(Utils.BytesToString(genMsg.ParamList[1].Parameter));
                            form.addDebugInfo(genMsg.ParamList[2].Parameter.ToString());
                            form.addDebugInfo(Utils.BytesToHexString(genMsg.ParamList[2].Parameter, "Version43").Trim());
                            //float Z = float.Parse(Utils.BytesToString(genMsg.ParamList[2].Parameter).Trim()) + 2.0f;
                            //float Z = (float)(System.Convert.ToDouble(genMsg.ParamList[2].Parameter));
                            string before = System.Text.Encoding.GetEncoding("utf-8").GetString(genMsg.ParamList[2].Parameter);
                            float  Z      = (float)Double.Parse(before, System.Globalization.NumberStyles.Float, new System.Globalization.CultureInfo("en-us").NumberFormat) + 2.0f;


                            //float Z =Utils.TryParseDouble float.Parse(before);
                            form.addDebugInfo(Z.ToString());
                            form.addDebugInfo("\n");

                            uint MapX = (uint)(GlobalX & 0xFFFFFF00);
                            uint MapY = (uint)(GlobalY & 0xFFFFFF00);
                            if (MapX == 0 && MapY == 0)
                            {
                                return(null);
                            }
                            ulong RegionHandle = (((ulong)MapX) << 32) | ((ulong)MapY);

                            TeleportLocationRequestPacket tp = new TeleportLocationRequestPacket();
                            tp.Type                = PacketType.TeleportLocationRequest;
                            tp.AgentData           = new TeleportLocationRequestPacket.AgentDataBlock();
                            tp.AgentData.AgentID   = frame.AgentID;
                            tp.AgentData.SessionID = frame.SessionID;
                            tp.Info                = new TeleportLocationRequestPacket.InfoBlock();
                            tp.Info.RegionHandle   = RegionHandle;
                            tp.Info.Position       = new Vector3((float)(GlobalX & 0xFF), (float)(GlobalY & 0xFF), Z);
                            tp.Info.LookAt         = plugin.SharedInfo.CameraAtAxis;//tp.Info.Position;
                            Console.Write(tp.ToString());
                            proxy.InjectPacket(tp, Direction.Outgoing);
                            return(null);
                        }
                        catch (Exception e)
                        {
                            form.addDebugInfo("Fail" + e.ToString());
                        }
                    }
                }
            }
            return(packet);
        }
예제 #4
0
        /// <summary>
        /// Start a request for Avatar Picks
        /// </summary>
        /// <param name="avatarid">UUID of the avatar</param>
        public void RequestAvatarPicks(LLUUID avatarid)
        {
            GenericMessagePacket gmp = new GenericMessagePacket();

            gmp.AgentData.AgentID       = Client.Self.AgentID;
            gmp.AgentData.SessionID     = Client.Self.SessionID;
            gmp.AgentData.TransactionID = LLUUID.Zero;

            gmp.MethodData.Method      = Helpers.StringToField("avatarpicksrequest");
            gmp.MethodData.Invoice     = LLUUID.Zero;
            gmp.ParamList              = new GenericMessagePacket.ParamListBlock[1];
            gmp.ParamList[0]           = new GenericMessagePacket.ParamListBlock();
            gmp.ParamList[0].Parameter = Helpers.StringToField(avatarid.ToString());

            Client.Network.SendPacket(gmp);
        }
예제 #5
0
        /// <summary>
        /// Ask for a notification of friend's online status
        /// </summary>
        /// <param name="friendID">Friend's UUID</param>
        public void RequestOnlineNotification(UUID friendID)
        {
            GenericMessagePacket gmp = new GenericMessagePacket();

            gmp.AgentData.AgentID       = Client.Self.AgentID;
            gmp.AgentData.SessionID     = Client.Self.SessionID;
            gmp.AgentData.TransactionID = UUID.Zero;

            gmp.MethodData.Method      = Utils.StringToBytes("requestonlinenotification");
            gmp.MethodData.Invoice     = UUID.Zero;
            gmp.ParamList              = new GenericMessagePacket.ParamListBlock[1];
            gmp.ParamList[0]           = new GenericMessagePacket.ParamListBlock();
            gmp.ParamList[0].Parameter = Utils.StringToBytes(friendID.ToString());

            Client.Network.SendPacket(gmp);
        }
예제 #6
0
        /// <summary>
        /// Start a request for details of a specific profile pick
        /// </summary>
        /// <param name="avatarid">UUID of the avatar</param>
        /// <param name="pickid">UUID of the profile pick</param>
        public void RequestPickInfo(UUID avatarid, UUID pickid)
        {
            GenericMessagePacket gmp = new GenericMessagePacket();

            gmp.AgentData.AgentID       = Client.Self.AgentID;
            gmp.AgentData.SessionID     = Client.Self.SessionID;
            gmp.AgentData.TransactionID = UUID.Zero;

            gmp.MethodData.Method      = Utils.StringToBytes("pickinforequest");
            gmp.MethodData.Invoice     = UUID.Zero;
            gmp.ParamList              = new GenericMessagePacket.ParamListBlock[2];
            gmp.ParamList[0]           = new GenericMessagePacket.ParamListBlock();
            gmp.ParamList[0].Parameter = Utils.StringToBytes(avatarid.ToString());
            gmp.ParamList[1]           = new GenericMessagePacket.ParamListBlock();
            gmp.ParamList[1].Parameter = Utils.StringToBytes(pickid.ToString());

            Client.Network.SendPacket(gmp);
        }
예제 #7
0
        /// <summary>
        /// Use the autopilot sim function to move the avatar to a new position
        /// </summary>
        /// <remarks>The z value is currently not handled properly by the simulator</remarks>
        /// <param name="globalX">Integer value for the global X coordinate to move to</param>
        /// <param name="globalY">Integer value for the global Y coordinate to move to</param>
        /// <param name="z">Floating-point value for the Z coordinate to move to</param>
        /// <example>AutoPilot(252620, 247078, 20.2674);</example>
        public void AutoPilot(ulong globalX, ulong globalY, float z)
        {
            GenericMessagePacket autopilot = new GenericMessagePacket();

            autopilot.AgentData.AgentID      = Client.Network.AgentID;
            autopilot.AgentData.SessionID    = Client.Network.SessionID;
            autopilot.MethodData.Invoice     = new LLUUID();
            autopilot.MethodData.Method      = Helpers.StringToField("autopilot");
            autopilot.ParamList              = new GenericMessagePacket.ParamListBlock[3];
            autopilot.ParamList[0]           = new GenericMessagePacket.ParamListBlock();
            autopilot.ParamList[0].Parameter = Helpers.StringToField(globalX.ToString());
            autopilot.ParamList[1]           = new GenericMessagePacket.ParamListBlock();
            autopilot.ParamList[1].Parameter = Helpers.StringToField(globalY.ToString());
            autopilot.ParamList[2]           = new GenericMessagePacket.ParamListBlock();
            // TODO: Do we need to prevent z coordinates from being sent in 1.4827e-18 notation?
            autopilot.ParamList[2].Parameter = Helpers.StringToField(z.ToString());

            Client.Network.SendPacket(autopilot);
        }
예제 #8
0
        public override string Execute(string[] args, UUID fromAgentID)
        {
            if (args.Length == 0)
                return "Usage: preference message";

            for (int i = 0; i < args.Length; i++)
            {
                string message = args[i];
                GenericMessagePacket packet = new GenericMessagePacket();
                packet.AgentData.AgentID = Client.Self.AgentID;
                packet.AgentData.SessionID = Client.Self.SessionID;
                packet.AgentData.TransactionID = UUID.Zero;
                packet.MethodData.Invoice = UUID.Zero;
                packet.MethodData.Method = Utils.StringToBytes("ClientPreference");
                packet.ParamList = new GenericMessagePacket.ParamListBlock[1];
                packet.ParamList[0] = new GenericMessagePacket.ParamListBlock();
                packet.ParamList[0].Parameter = Utils.StringToBytes(message);
                Client.Network.SendPacket(packet, Client.Network.CurrentSim);
            }
            return String.Format("Set preference [{0}]", String.Join(",",args));
        }
예제 #9
0
        public override void SendRexObjectProperties(UUID id, RexObjectProperties x)
        {
            GenericMessagePacket gmp = new GenericMessagePacket();
            gmp.MethodData.Method = Utils.StringToBytes("RexPrimData");

            byte[] temprexprimdata = x.GetRexPrimDataToBytes(true); //send urls to ng-clients
            int numlines = 0;
            int i = 0;

            if (temprexprimdata != null)
            {
                while (i <= temprexprimdata.Length)
                {
                    numlines++;
                    i += 200;
                }
            }

            gmp.ParamList = new GenericMessagePacket.ParamListBlock[1 + numlines];
            gmp.ParamList[0] = new GenericMessagePacket.ParamListBlock();
            gmp.ParamList[0].Parameter = Utils.StringToBytes(id.ToString());

            for (i = 0; i < numlines; i++)
            {
                gmp.ParamList[i + 1] = new GenericMessagePacket.ParamListBlock();

                if ((temprexprimdata.Length - i * 200) < 200)
                {
                    gmp.ParamList[i + 1].Parameter = new byte[temprexprimdata.Length - i * 200];
                    Buffer.BlockCopy(temprexprimdata, i * 200, gmp.ParamList[i + 1].Parameter, 0, temprexprimdata.Length - i * 200);
                }
                else
                {
                    gmp.ParamList[i + 1].Parameter = new byte[200];
                    Buffer.BlockCopy(temprexprimdata, i * 200, gmp.ParamList[i + 1].Parameter, 0, 200);
                }
            }

            OutPacket(gmp, ThrottleOutPacketType.Task);
        }
예제 #10
0
        /// <summary>
        /// Use the autopilot sim function to move the avatar to a new position
        /// </summary>
        /// <remarks>The z value is currently not handled properly by the simulator</remarks>
        /// <param name="globalX">Integer value for the global X coordinate to move to</param>
        /// <param name="globalY">Integer value for the global Y coordinate to move to</param>
        /// <param name="z">Floating-point value for the Z coordinate to move to</param>
        public void AutoPilot(ulong globalX, ulong globalY, float z)
        {
            GenericMessagePacket autopilot = new GenericMessagePacket();

            autopilot.AgentData.AgentID = Client.Self.AgentID;
            autopilot.AgentData.SessionID = Client.Self.SessionID;
            autopilot.AgentData.TransactionID = UUID.Zero;
            autopilot.MethodData.Invoice = UUID.Zero;
            autopilot.MethodData.Method = Utils.StringToBytes("autopilot");
            autopilot.ParamList = new GenericMessagePacket.ParamListBlock[3];
            autopilot.ParamList[0] = new GenericMessagePacket.ParamListBlock();
            autopilot.ParamList[0].Parameter = Utils.StringToBytes(globalX.ToString());
            autopilot.ParamList[1] = new GenericMessagePacket.ParamListBlock();
            autopilot.ParamList[1].Parameter = Utils.StringToBytes(globalY.ToString());
            autopilot.ParamList[2] = new GenericMessagePacket.ParamListBlock();
            autopilot.ParamList[2].Parameter = Utils.StringToBytes(z.ToString());

            Client.Network.SendPacket(autopilot);
        }
예제 #11
0
        /// <summary>
        /// Start a request for details of a specific profile classified
        /// </summary>
        /// <param name="avatarid">UUID of the avatar</param>
        /// <param name="classifiedid">UUID of the profile classified</param>
        public void RequestClassifiedInfo(UUID avatarid, UUID classifiedid)
        {
            GenericMessagePacket gmp = new GenericMessagePacket();

            gmp.AgentData.AgentID = Client.Self.AgentID;
            gmp.AgentData.SessionID = Client.Self.SessionID;
            gmp.AgentData.TransactionID = UUID.Zero;

            gmp.MethodData.Method = Utils.StringToBytes("classifiedinforequest");
            gmp.MethodData.Invoice = UUID.Zero;
            gmp.ParamList = new GenericMessagePacket.ParamListBlock[2];
            gmp.ParamList[0] = new GenericMessagePacket.ParamListBlock();
            gmp.ParamList[0].Parameter = Utils.StringToBytes(avatarid.ToString());
            gmp.ParamList[1] = new GenericMessagePacket.ParamListBlock();
            gmp.ParamList[1].Parameter = Utils.StringToBytes(classifiedid.ToString());

            Client.Network.SendPacket(gmp);
        }
예제 #12
0
        /// <summary>
        /// Ask for a notification of friend's online status
        /// </summary>
        /// <param name="friendID">Friend's UUID</param>
        public void RequestOnlineNotification(UUID friendID)
        {
            GenericMessagePacket gmp = new GenericMessagePacket();

            gmp.AgentData.AgentID = Client.Self.AgentID;
            gmp.AgentData.SessionID = Client.Self.SessionID;
            gmp.AgentData.TransactionID = UUID.Zero;

            gmp.MethodData.Method = Utils.StringToBytes("requestonlinenotification");
            gmp.MethodData.Invoice = UUID.Zero;
            gmp.ParamList = new GenericMessagePacket.ParamListBlock[1];
            gmp.ParamList[0] = new GenericMessagePacket.ParamListBlock();
            gmp.ParamList[0].Parameter = Utils.StringToBytes(friendID.ToString());

            Client.Network.SendPacket(gmp);
        }
예제 #13
0
        /// <summary>
        /// Use the autopilot sim function to move the avatar to a new
        /// position. Uses double precision to get precise movements
        /// </summary>
        /// <remarks>The z value is currently not handled properly by the simulator</remarks>
        /// <param name="globalX">Global X coordinate to move to</param>
        /// <param name="globalY">Global Y coordinate to move to</param>
        /// <param name="z">Z coordinate to move to</param>
        public void AutoPilot(double globalX, double globalY, double z)
        {
            GenericMessagePacket autopilot = new GenericMessagePacket();

            autopilot.AgentData.AgentID = Client.Self.AgentID;
            autopilot.AgentData.SessionID = Client.Self.SessionID;
            autopilot.AgentData.TransactionID = LLUUID.Zero;
            autopilot.MethodData.Invoice = LLUUID.Zero;
            autopilot.MethodData.Method = Helpers.StringToField("autopilot");
            autopilot.ParamList = new GenericMessagePacket.ParamListBlock[3];
            autopilot.ParamList[0] = new GenericMessagePacket.ParamListBlock();
            autopilot.ParamList[0].Parameter = Helpers.StringToField(globalX.ToString());
            autopilot.ParamList[1] = new GenericMessagePacket.ParamListBlock();
            autopilot.ParamList[1].Parameter = Helpers.StringToField(globalY.ToString());
            autopilot.ParamList[2] = new GenericMessagePacket.ParamListBlock();
            autopilot.ParamList[2].Parameter = Helpers.StringToField(z.ToString());

            Client.Network.SendPacket(autopilot);
        }
예제 #14
0
        /// <summary>
        /// Use the autopilot sim function to move the avatar to a new position
        /// </summary>
        /// <remarks>The z value is currently not handled properly by the simulator</remarks>
        /// <param name="globalX">Integer value for the global X coordinate to move to</param>
        /// <param name="globalY">Integer value for the global Y coordinate to move to</param>
        /// <param name="z">Floating-point value for the Z coordinate to move to</param>
        /// <example>AutoPilot(252620, 247078, 20.2674);</example>
        public void AutoPilot(ulong globalX, ulong globalY, float z)
        {
            GenericMessagePacket autopilot = new GenericMessagePacket();

            autopilot.AgentData.AgentID = Client.Network.AgentID;
            autopilot.AgentData.SessionID = Client.Network.SessionID;
            autopilot.MethodData.Invoice = new LLUUID();
            autopilot.MethodData.Method = Helpers.StringToField("autopilot");
            autopilot.ParamList = new GenericMessagePacket.ParamListBlock[3];
            autopilot.ParamList[0] = new GenericMessagePacket.ParamListBlock();
            autopilot.ParamList[0].Parameter = Helpers.StringToField(globalX.ToString());
            autopilot.ParamList[1] = new GenericMessagePacket.ParamListBlock();
            autopilot.ParamList[1].Parameter = Helpers.StringToField(globalY.ToString());
            autopilot.ParamList[2] = new GenericMessagePacket.ParamListBlock();
            // TODO: Do we need to prevent z coordinates from being sent in 1.4827e-18 notation?
            autopilot.ParamList[2].Parameter = Helpers.StringToField(z.ToString());

            Client.Network.SendPacket(autopilot);
        }
예제 #15
0
        /// <summary>
        /// Start a request for details of a specific profile pick
        /// </summary>
        /// <param name="avatarid">UUID of the avatar</param>
        /// <param name="pickid">UUID of the profile pick</param>
        public void RequestPickInfo(LLUUID avatarid, LLUUID pickid)
        {
            GenericMessagePacket gmp = new GenericMessagePacket();

            gmp.AgentData.AgentID = Client.Self.AgentID;
            gmp.AgentData.SessionID = Client.Self.SessionID;
            gmp.AgentData.TransactionID = LLUUID.Zero;

            gmp.MethodData.Method = Helpers.StringToField("pickinforequest");
            gmp.MethodData.Invoice = LLUUID.Zero;
            gmp.ParamList = new GenericMessagePacket.ParamListBlock[2];
            gmp.ParamList[0] = new GenericMessagePacket.ParamListBlock();
            gmp.ParamList[0].Parameter = Helpers.StringToField(avatarid.ToString());
            gmp.ParamList[1] = new GenericMessagePacket.ParamListBlock();
            gmp.ParamList[1].Parameter = Helpers.StringToField(pickid.ToString());

            Client.Network.SendPacket(gmp);
        }
예제 #16
0
        /// <summary>
        /// Start a request for details of a specific profile pick
        /// </summary>
        /// <param name="avatarid">Guid of the avatar</param>
        /// <param name="pickid">Guid of the profile pick</param>
        public void RequestPickInfo(Guid avatarid, Guid pickid)
        {
            GenericMessagePacket gmp = new GenericMessagePacket();

            gmp.AgentData.AgentID = Client.Self.AgentID;
            gmp.AgentData.SessionID = Client.Self.SessionID;
            gmp.AgentData.TransactionID = Guid.Empty;

            gmp.MethodData.Method = Utils.StringToBytes("pickinforequest");
            gmp.MethodData.Invoice = Guid.Empty;
            gmp.ParamList = new GenericMessagePacket.ParamListBlock[2];
            gmp.ParamList[0] = new GenericMessagePacket.ParamListBlock();
            gmp.ParamList[0].Parameter = Utils.StringToBytes(avatarid.ToString());
            gmp.ParamList[1] = new GenericMessagePacket.ParamListBlock();
            gmp.ParamList[1].Parameter = Utils.StringToBytes(pickid.ToString());

            Client.Network.SendPacket(gmp);
        }