Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="UserInfo"></param>
        /// <param name="Request"></param>
        public void RequestTeleport(NetworkInfo userInfo, TeleportLocationRequestPacket request)
        {
            if (Grid.ContainsKey(request.Info.RegionHandle))
            {
                RegionInfo Region = Grid[request.Info.RegionHandle];
                libsecondlife.Packets.TeleportStartPacket TeleportStart = new TeleportStartPacket();
                TeleportStart.Info.TeleportFlags = 16;
                _server.SendPacket(TeleportStart, true, userInfo);

                libsecondlife.Packets.TeleportFinishPacket Teleport = new TeleportFinishPacket();
                Teleport.Info.AgentID        = userInfo.User.AgentID;
                Teleport.Info.RegionHandle   = request.Info.RegionHandle;
                Teleport.Info.SimAccess      = 13;
                Teleport.Info.SeedCapability = new byte[0];

                System.Net.IPAddress oIP = System.Net.IPAddress.Parse(Region.IPAddress.Address);
                byte[] byteIP            = oIP.GetAddressBytes();
                uint   ip = (uint)byteIP[3] << 24;
                ip += (uint)byteIP[2] << 16;
                ip += (uint)byteIP[1] << 8;
                ip += (uint)byteIP[0];

                Teleport.Info.SimIP         = ip;
                Teleport.Info.SimPort       = Region.IPAddress.Port;
                Teleport.Info.LocationID    = 4;
                Teleport.Info.TeleportFlags = 1 << 4;;
                _server.SendPacket(Teleport, true, userInfo);

                //this._agentManager.RemoveAgent(userInfo);
            }
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
Archivo: High.cs Proyecto: zadark/par
        public void doTp(Vector3 where)
        {
            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   = shared.RegionHandle;
            tp.Info.Position       = where;
            tp.Info.LookAt         = where;
            proxy.InjectPacket(tp, Direction.Outgoing);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="regionHandle"></param>
        /// <param name="position"></param>
        /// <param name="lookAt"></param>
        /// <returns></returns>
        public bool Teleport(ulong regionHandle, LLVector3 position, LLVector3 lookAt)
        {
            TeleportStat = TeleportStatus.None;

            TeleportLocationRequestPacket teleport = new TeleportLocationRequestPacket();

            teleport.AgentData.AgentID   = Client.Network.AgentID;
            teleport.AgentData.SessionID = Client.Network.SessionID;
            teleport.Info.LookAt         = lookAt;
            teleport.Info.Position       = position;

            teleport.Info.RegionHandle = regionHandle;

            Client.Log("Teleporting to region " + regionHandle.ToString(), Helpers.LogLevel.Info);

            // Start the timeout check
            TeleportTimeout = false;
            TeleportTimer.Start();

            Client.Network.SendPacket(teleport);

            while (TeleportStat != TeleportStatus.Failed && TeleportStat != TeleportStatus.Finished && !TeleportTimeout)
            {
                Client.Tick();
            }

            TeleportTimer.Stop();

            if (TeleportTimeout)
            {
                TeleportMessage = "Teleport timed out.";
                TeleportStat    = TeleportStatus.Failed;

                if (OnTeleport != null)
                {
                    OnTeleport(TeleportMessage, TeleportStat);
                }
            }
            else
            {
                if (OnTeleport != null)
                {
                    OnTeleport(TeleportMessage, TeleportStat);
                }
            }

            return(TeleportStat == TeleportStatus.Finished);
        }
Ejemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="regionHandle"></param>
        /// <param name="position"></param>
        /// <param name="lookAt"></param>
        /// <param name="tc"></param>
        public void BeginTeleport(ulong regionHandle, LLVector3 position, LLVector3 lookAt, TeleportCallback tc)
        {
            OnBeginTeleport = tc;

            TeleportLocationRequestPacket teleport = new TeleportLocationRequestPacket();

            teleport.AgentData.AgentID   = Client.Network.AgentID;
            teleport.AgentData.SessionID = Client.Network.SessionID;
            teleport.Info.LookAt         = lookAt;
            teleport.Info.Position       = position;
            teleport.Info.RegionHandle   = regionHandle;

            Client.Log("Teleporting to region " + regionHandle.ToString(), Helpers.LogLevel.Info);

            Client.Network.SendPacket(teleport);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Request teleport to a another simulator
        /// </summary>
        /// <param name="regionHandle">handle of region to teleport agent to</param>
        /// <param name="position"><seealso cref="Vector3"/> position in destination sim to teleport to</param>
        /// <param name="lookAt"><seealso cref="Vector3"/> direction in destination sim agent will look at</param>
        public void RequestTeleport(ulong regionHandle, Vector3 position, Vector3 lookAt)
        {
            if (Client.Network.CurrentSim != null &&
                Client.Network.CurrentSim.Caps != null &&
                Client.Network.CurrentSim.Caps.IsEventQueueRunning)
            {
                TeleportLocationRequestPacket teleport = new TeleportLocationRequestPacket();
                teleport.AgentData.AgentID = Client.Self.AgentID;
                teleport.AgentData.SessionID = Client.Self.SessionID;
                teleport.Info.LookAt = lookAt;
                teleport.Info.Position = position;
                teleport.Info.RegionHandle = regionHandle;

                Logger.Log("Requesting teleport to region handle " + regionHandle.ToString(), Helpers.LogLevel.Info, Client);

                Client.Network.SendPacket(teleport);
            }
            else
            {
                teleportMessage = "CAPS event queue is not running";
                teleportEvent.Set();
                teleportStat = TeleportStatus.Failed;
            }
        }
Ejemplo n.º 7
0
Archivo: High.cs Proyecto: zadark/par
 public void doTp(Vector3 where)
 {
     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 = shared.RegionHandle;
     tp.Info.Position = where;
     tp.Info.LookAt = where;
     proxy.InjectPacket(tp, Direction.Outgoing);
 }
Ejemplo n.º 8
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="regionHandle"></param>
        /// <param name="position"></param>
        /// <param name="lookAt"></param>
        /// <returns></returns>
        public bool Teleport(ulong regionHandle, LLVector3 position, LLVector3 lookAt)
        {
            TeleportStat = TeleportStatus.None;

            TeleportLocationRequestPacket teleport = new TeleportLocationRequestPacket();
            teleport.AgentData.AgentID = Client.Network.AgentID;
            teleport.AgentData.SessionID = Client.Network.SessionID;
            teleport.Info.LookAt = lookAt;
            teleport.Info.Position = position;

            teleport.Info.RegionHandle = regionHandle;

            Client.Log("Teleporting to region " + regionHandle.ToString(), Helpers.LogLevel.Info);

            // Start the timeout check
            TeleportTimeout = false;
            TeleportTimer.Start();

            Client.Network.SendPacket(teleport);

            while (TeleportStat != TeleportStatus.Failed && TeleportStat != TeleportStatus.Finished && !TeleportTimeout)
            {
                Client.Tick();
            }

            TeleportTimer.Stop();

            if (TeleportTimeout)
            {
                TeleportMessage = "Teleport timed out.";
                TeleportStat = TeleportStatus.Failed;

                if (OnTeleport != null) { OnTeleport(TeleportMessage, TeleportStat); }
            }
            else
            {
                if (OnTeleport != null) { OnTeleport(TeleportMessage, TeleportStat); }
            }

            return (TeleportStat == TeleportStatus.Finished);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="regionHandle"></param>
        /// <param name="position"></param>
        /// <param name="lookAt"></param>
        /// <param name="tc"></param>
        public void BeginTeleport(ulong regionHandle, LLVector3 position, LLVector3 lookAt, TeleportCallback tc)
        {
            OnBeginTeleport = tc;

            TeleportLocationRequestPacket teleport = new TeleportLocationRequestPacket();
            teleport.AgentData.AgentID = Client.Network.AgentID;
            teleport.AgentData.SessionID = Client.Network.SessionID;
            teleport.Info.LookAt = lookAt;
            teleport.Info.Position = position;
            teleport.Info.RegionHandle = regionHandle;

            Client.Log("Teleporting to region " + regionHandle.ToString(), Helpers.LogLevel.Info);

            Client.Network.SendPacket(teleport);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="UserInfo"></param>
        /// <param name="Request"></param>
        public void RequestTeleport(NetworkInfo userInfo, TeleportLocationRequestPacket request)
        {
            if(Grid.ContainsKey(request.Info.RegionHandle))
            {
                RegionInfo Region = Grid[request.Info.RegionHandle];
                libsecondlife.Packets.TeleportStartPacket TeleportStart = new TeleportStartPacket();
                TeleportStart.Info.TeleportFlags = 16;
                _server.SendPacket(TeleportStart, true, userInfo);

                libsecondlife.Packets.TeleportFinishPacket Teleport = new TeleportFinishPacket();
                Teleport.Info.AgentID = userInfo.User.AgentID;
                Teleport.Info.RegionHandle = request.Info.RegionHandle;
                Teleport.Info.SimAccess = 13;
                Teleport.Info.SeedCapability = new byte[0];

                System.Net.IPAddress oIP = System.Net.IPAddress.Parse(Region.IPAddress.Address);
                byte[] byteIP = oIP.GetAddressBytes();
                uint ip=(uint)byteIP[3]<<24;
                ip+=(uint)byteIP[2]<<16;
                ip+=(uint)byteIP[1]<<8;
                ip+=(uint)byteIP[0];

                Teleport.Info.SimIP = ip;
                Teleport.Info.SimPort = Region.IPAddress.Port;
                Teleport.Info.LocationID = 4;
                Teleport.Info.TeleportFlags = 1 << 4;;
                _server.SendPacket(Teleport, true, userInfo);

                //this._agentManager.RemoveAgent(userInfo);
            }
        }
Ejemplo n.º 11
0
        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;
        }