Ejemplo n.º 1
0
 //Process commands from the user
 private void CmdAO(string[] words)
 {
     if (words.Length < 2)
     {
         SayToUser("Usage: /ao on/off/notecard path");
     }
     else if (words[1] == "on")
     {
         //Turn AO on
         AOOn();
         SayToUser("AO started");
     }
     else if (words[1] == "off")
     {
         //Turn AO off
         AOOff();
         SayToUser("AO stopped");
     }
     else
     {
         //Load notecard from path
         //exemple: /ao Objects/My AOs/wetikon/config.txt
         string[] tmp = new string[words.Length - 1];
         //join the arguments together with spaces, to
         //take care of folder and item names with spaces in them
         for (int i = 1; i < words.Length; i++)
         {
             tmp[i - 1] = words[i];
         }
         // add a delegate to monitor inventory infos
         proxy.AddDelegate(PacketType.InventoryDescendents, Direction.Incoming, this.inventoryPacketDelegate);
         RequestFindObjectByPath(frame.InventoryRoot, String.Join(" ", tmp));
     }
 }
Ejemplo n.º 2
0
 public ProfileFunPlugin(PubComb plug)
 {
     plugin     = plug;
     form       = new SimpleProfForm1(this);
     this.frame = plug.frame;
     shared     = plugin.SharedInfo;
     this.proxy = plug.proxy;
     proxy.AddDelegate(PacketType.AvatarPropertiesReply, Direction.Incoming, new PacketDelegate(inAvatar));
     RefreshDownloadsTimer.Elapsed += new System.Timers.ElapsedEventHandler(RefreshDownloadsTimer_Elapsed);
     RefreshDownloadsTimer.Start();
     proxy.AddDelegate(PacketType.AgentMovementComplete, Direction.Incoming, delegate(Packet packet, IPEndPoint sim)
     {
         shared.RegionHandle = ((AgentMovementCompletePacket)packet).Data.RegionHandle;
         return(packet);
     });
     proxy.AddDelegate(PacketType.AgentUpdate, Direction.Outgoing, delegate(Packet packet, IPEndPoint sim)
     {
         AgentUpdatePacket.AgentDataBlock p = ((AgentUpdatePacket)packet).AgentData;
         shared.CameraPosition = p.CameraCenter;
         shared.CameraAtAxis   = p.CameraAtAxis;
         shared.CameraLeftAxis = p.CameraLeftAxis;
         shared.CameraUpAxis   = p.CameraUpAxis;
         shared.Far            = p.Far;
         shared.ip             = sim.Address;
         shared.port           = sim.Port;
         return(packet);
     });
 }
Ejemplo n.º 3
0
        private void cmdAddLogger_Click(object sender, EventArgs e)
        {
            if (!cboLogged.Items.Contains(cboToLog.SelectedItem))
            {
                PacketType type = (PacketType)cboToLog.SelectedItem;

                cboLogged.Items.Add(type);

                Proxy.AddDelegate(type, Direction.Incoming, new PacketDelegate(IncomingPacketHandler));
                Proxy.AddDelegate(type, Direction.Outgoing, new PacketDelegate(OutgoingPacketHandler));
            }
        }
Ejemplo n.º 4
0
Archivo: CliInt.cs Proyecto: zadark/par
 public CliIntPlugin(PubComb plug)
 {
     plugin = plug;
     form   = new CliIntForm1(this);
     //plug.tabform.addATab(form, "CliInt");
     this.frame = plug.frame;
     this.proxy = plug.proxy;
     proxy.AddDelegate(PacketType.AlertMessage, Direction.Incoming, new PacketDelegate(this.InAlertMessageHandler));
     proxy.AddDelegate(PacketType.ObjectUpdate, Direction.Incoming, new PacketDelegate(this.UpdateHandler));
     proxy.AddDelegate(PacketType.ImprovedTerseObjectUpdate, Direction.Incoming, new PacketDelegate(this.TerseUpdateHandler));
     interceptor.Name = "idontexist";
 }
Ejemplo n.º 5
0
 // CmdLog: handle a /log command
 private void CmdLog(string[] words)
 {
     if (words.Length != 2)
     {
         SayToUser("Usage: /log <packet name>");
     }
     else if (words[1] == "*")
     {
         LogAll();
         SayToUser("logging all packets");
     }
     else
     {
         PacketType pType;
         try
         {
             pType = packetTypeFromName(words[1]);
         }
         catch (ArgumentException)
         {
             SayToUser("Bad packet name: " + words[1]);
             return;
         }
         loggedPackets[pType] = null;
         proxy.AddDelegate(pType, Direction.Incoming, new PacketDelegate(LogPacketIn));
         proxy.AddDelegate(pType, Direction.Outgoing, new PacketDelegate(LogPacketOut));
         SayToUser("logging " + words[1]);
     }
 }
Ejemplo n.º 6
0
 // Creates the entry points for dealing with received/transmitted packets
 private void InitializePacketDelegates()
 {
     // outbound packets
     proxy.AddDelegate(PacketType.AgentAnimation, Direction.Outgoing, new PacketDelegate(ProcessAgentAnimation));
     // inbound packets
     proxy.AddDelegate(PacketType.ObjectProperties, Direction.Incoming, new PacketDelegate(ProcessObjectProperties));
     proxy.AddDelegate(PacketType.ObjectUpdate, Direction.Incoming, new PacketDelegate(ProcessObjectUpdate));
     proxy.AddDelegate(PacketType.ObjectPropertiesFamily, Direction.Incoming, new PacketDelegate(ProcessObjectPropertiesFamily));
     proxy.AddDelegate(PacketType.KillObject, Direction.Incoming, new PacketDelegate(ProcessKillObject));
     proxy.AddDelegate(PacketType.LogoutReply, Direction.Incoming, new PacketDelegate(ProcessLogoutReply));
     proxy.AddDelegate(PacketType.TeleportStart, Direction.Incoming, new PacketDelegate(ProcessTeleportStart));
     proxy.AddDelegate(PacketType.TeleportProgress, Direction.Incoming, new PacketDelegate(ProcessTeleportProgress));
     proxy.AddDelegate(PacketType.CompletePingCheck, Direction.Incoming, new PacketDelegate(ProcessCompletePingCheck));
     proxy.AddDelegate(PacketType.AvatarAnimation, Direction.Incoming, new PacketDelegate(ProcessAvatarAnimation));
 }
Ejemplo n.º 7
0
    // RegisterDelegates: register delegates for each packet in an array of packet maps
    private static void RegisterDelegates(Proxy proxy, MapPacket[] maps)
    {
        foreach (MapPacket map in maps)
        {
            if (map != null)
            {
                loggedPackets[map.Name] = null;

                if (map.Name != "ChatFromViewer")
                {
                    proxy.AddDelegate(map.Name, Direction.Incoming, new PacketDelegate(AnalyzeIn));
                    proxy.AddDelegate(map.Name, Direction.Outgoing, new PacketDelegate(AnalyzeOut));
                }
            }
        }
    }
Ejemplo n.º 8
0
 private void InitAvatarTracking()
 {
     mParseImprovedTerseObjectUpdatePackets = true;
     mAvatarPosition    = Vector3.Zero;
     mAvatarOrientation = Rotation.Zero;
     mProxy.AddDelegate(PacketType.ImprovedTerseObjectUpdate, Direction.Incoming, mProxy_ImprovedTerseObjectUpdatePacketReceived);
 }
Ejemplo n.º 9
0
Archivo: CliInt.cs Proyecto: zadark/par
 // Interceptory finding code is mainly from ClientAO with some edits.
 /// <summary>
 /// Begins the process to find the interceptor from a path.
 /// </summary>
 /// <param name="path"></param>
 private void FindIntercept(string path)
 {
     //Load notecard from path
     //exemple: /ao Objects/My AOs/wetikon/config.txt
     // add a delegate to monitor inventory infos
     proxy.AddDelegate(PacketType.InventoryDescendents, Direction.Incoming, this.inventoryPacketDelegate);
     RequestFindObjectByPath(frame.InventoryRoot, path);
 }
Ejemplo n.º 10
0
 public SitBlockPlugin(PubComb plug)
 {
     plugin     = plug;
     form       = new SitBlockForm1(this);
     this.frame = plug.frame;
     this.proxy = plug.proxy;
     this.brand = "SitBlock";
     proxy.AddDelegate(PacketType.AgentRequestSit, Direction.Outgoing, new PacketDelegate(sitp));
 }
Ejemplo n.º 11
0
Archivo: Lyra.cs Proyecto: zadark/par
 public LyraPlugin(PubComb plug)
 {
     //formthread = new Thread(new ThreadStart(delegate()
     //{
     //    form = new LyraForm1(this);
     //    Application.Run(form);
     //}));
     //formthread.SetApartmentState(ApartmentState.STA);
     //formthread.Start();
     plugin = plug;
     form   = new LyraForm1(this);
     //plug.tabform.addATab(form, "LYRA");
     this.frame = plug.frame;
     this.proxy = plug.proxy;
     // this.brand = "Lyra";
     proxy.AddDelegate(PacketType.ChatFromViewer, Direction.Outgoing, new PacketDelegate(SimChat));
     proxy.AddDelegate(PacketType.AgentUpdate, Direction.Outgoing, new PacketDelegate(Age));
 }
Ejemplo n.º 12
0
 // CmdLog: handle a /log command
 private static void CmdLog(string[] words)
 {
     if (words.Length != 2)
     {
         SayToUser("Usage: /log <packet name>");
     }
     else if (words[1] == "*")
     {
         LogAll();
         SayToUser("logging all packets");
     }
     else
     {
         loggedPackets[words[1]] = null;
         if (words[1] != "ChatFromViewer")
         {
             proxy.AddDelegate(words[1], Direction.Incoming, new PacketDelegate(AnalyzeIn));
             proxy.AddDelegate(words[1], Direction.Outgoing, new PacketDelegate(AnalyzeOut));
         }
         SayToUser("logging " + words[1]);
     }
 }
Ejemplo n.º 13
0
 public IMLocatePlugin(PubComb plug)
 {
     form = new IMHistForm1(this);
     //    Application.Run(form);
     //}));
     //formthread.SetApartmentState(ApartmentState.STA);
     //formthread.Start();
     plugin     = plug;
     this.frame = plug.frame;
     this.proxy = plug.proxy;
     //this.brand = "IMLocate";
     proxy.AddDelegate(PacketType.ImprovedInstantMessage, Direction.Incoming, new PacketDelegate(IMs));
 }
Ejemplo n.º 14
0
    public static void Main(string[] args)
    {
        // configure the proxy
        client          = new SecondLife("../data/keywords.txt", "../data/message_template.msg");
        protocolManager = client.Protocol;
        ProxyConfig proxyConfig = new ProxyConfig("Analyst", "*****@*****.**", protocolManager, args);

        proxy = new Proxy(proxyConfig);

        // build the table of /command delegates
        InitializeCommandDelegates();

        // add delegates for login
        proxy.SetLoginRequestDelegate(new XmlRpcRequestDelegate(LoginRequest));
        proxy.SetLoginResponseDelegate(new XmlRpcResponseDelegate(LoginResponse));

        // add a delegate for outgoing chat
        proxy.AddDelegate("ChatFromViewer", Direction.Incoming, new PacketDelegate(ChatFromViewerIn));
        proxy.AddDelegate("ChatFromViewer", Direction.Outgoing, new PacketDelegate(ChatFromViewerOut));

        //  handle command line arguments
        foreach (string arg in args)
        {
            if (arg == "--log-all")
            {
                LogAll();
            }
            else if (arg == "--log-login")
            {
                logLogin = true;
            }
        }

        // start the proxy
        proxy.Start();
    }
Ejemplo n.º 15
0
    public static void Main(string[] args)
    {
        // configure the proxy
        ProxyConfig proxyConfig = new ProxyConfig("ChatConsole V2", "Austin Jennings / Andrew Ortman", args);

        proxy = new Proxy(proxyConfig);

        // set a delegate for when the client logs in
        proxy.SetLoginResponseDelegate(new XmlRpcResponseDelegate(Login));

        // add a delegate for incoming chat
        proxy.AddDelegate(PacketType.ChatFromSimulator, Direction.Incoming, new PacketDelegate(ChatFromSimulator));

        // start the proxy
        proxy.Start();
    }
Ejemplo n.º 16
0
Archivo: Penny.cs Proyecto: zadark/par
        public PennyPlugin(PubComb plug)
        {
            plugin = plug;
            //formthread = new Thread(new ThreadStart(delegate()
            //{
            form = new PennyForm1(this);
            //   Application.Run(form);
            //}));
            //formthread.SetApartmentState(ApartmentState.STA);
            //formthread.Start();


            this.frame = plugin.frame;
            this.proxy = plugin.proxy;
            //this.brand = "Penny";
            proxy.AddDelegate(PacketType.AgentSetAppearance, Direction.Outgoing, new PacketDelegate(ApHand));
        }
Ejemplo n.º 17
0
        private void Init(string[] args, ProxyConfig proxyConfig)
        {
            //bool externalPlugin = false;
            this.args = args;

            if (proxyConfig == null)
            {
                proxyConfig = new ProxyConfig("GridProxy", "Austin Jennings / Andrew Ortman", args, true);
            }
            proxy = new Proxy(proxyConfig);

            // add delegates for login
            proxy.AddLoginRequestDelegate(new XmlRpcRequestDelegate(LoginRequest));
            proxy.AddLoginResponseDelegate(new XmlRpcResponseDelegate(LoginResponse));

            // add a delegate for outgoing chat
            proxy.AddDelegate(PacketType.ChatFromViewer, Direction.Outgoing, new PacketDelegate(ChatFromViewerOut));

            //  handle command line arguments
            foreach (string arg in args)
            {
                if (arg == "--log-login")
                {
                    logLogin = true;
                }
                else if (arg.Substring(0, 2) == "--")
                {
                    int ipos = arg.IndexOf("=");
                    if (ipos != -1)
                    {
                        string sw  = arg.Substring(0, ipos);
                        string val = arg.Substring(ipos + 1);

                        Logger.Log("arg '" + sw + "' val '" + val + "'", Helpers.LogLevel.Debug);

                        if (sw == "--load")
                        {
                            //externalPlugin = true;
                            LoadPlugin(val);
                        }
                    }
                }
            }

            commandDelegates["/load"] = new CommandDelegate(CmdLoad);
        }
Ejemplo n.º 18
0
    public static void Main(string[] args)
    {
        // configure the proxy
        client          = new SecondLife("../data/keywords.txt", "../data/message_template.msg");
        protocolManager = client.Protocol;
        ProxyConfig proxyConfig = new ProxyConfig("ChatConsole", "*****@*****.**", protocolManager, args);

        proxy = new Proxy(proxyConfig);

        // set a delegate for when the client logs in
        proxy.SetLoginResponseDelegate(new XmlRpcResponseDelegate(Login));

        // add a delegate for incoming chat
        proxy.AddDelegate("ChatFromSimulator", Direction.Incoming, new PacketDelegate(ChatFromSimulator));

        // start the proxy
        proxy.Start();
    }
Ejemplo n.º 19
0
        public ProxyFrame(string[] args)
        {
            //bool externalPlugin = false;
            this.args = args;

            ProxyConfig proxyConfig = new ProxyConfig("SLProxy", "Austin Jennings / Andrew Ortman", args);

            proxy = new Proxy(proxyConfig);

            // add delegates for login
            proxy.SetLoginRequestDelegate(new XmlRpcRequestDelegate(LoginRequest));
            proxy.SetLoginResponseDelegate(new XmlRpcResponseDelegate(LoginResponse));

            // add a delegate for outgoing chat
            proxy.AddDelegate(PacketType.ChatFromViewer, Direction.Outgoing, new PacketDelegate(ChatFromViewerOut));

            //  handle command line arguments
            foreach (string arg in args)
            {
                if (arg == "--log-login")
                {
                    logLogin = true;
                }
                else if (arg.Substring(0, 2) == "--")
                {
                    int ipos = arg.IndexOf("=");
                    if (ipos != -1)
                    {
                        string sw  = arg.Substring(0, ipos);
                        string val = arg.Substring(ipos + 1);
                        Console.WriteLine("arg '" + sw + "' val '" + val + "'");
                        if (sw == "--load")
                        {
                            //externalPlugin = true;
                            LoadPlugin(val);
                        }
                    }
                }
            }

            commandDelegates["/load"] = new CommandDelegate(CmdLoad);
        }
Ejemplo n.º 20
0
    public static void Main(string[] args)
    {
        libslAssembly = Assembly.Load("libsecondlife");
        if (libslAssembly == null)
        {
            throw new Exception("Assembly load exception");
        }

        ProxyConfig proxyConfig = new ProxyConfig("Analyst V2", "Austin Jennings / Andrew Ortman", args);

        proxy = new Proxy(proxyConfig);

        // build the table of /command delegates
        InitializeCommandDelegates();

        // add delegates for login
        proxy.SetLoginRequestDelegate(new XmlRpcRequestDelegate(LoginRequest));
        proxy.SetLoginResponseDelegate(new XmlRpcResponseDelegate(LoginResponse));

        // add a delegate for outgoing chat
        proxy.AddDelegate(PacketType.ChatFromViewer, Direction.Outgoing, new PacketDelegate(ChatFromViewerOut));

        //  handle command line arguments
        foreach (string arg in args)
        {
            if (arg == "--log-all")
            {
                LogAll();
            }
            else if (arg == "--log-login")
            {
                logLogin = true;
            }
        }

        // start the proxy
        proxy.Start();
    }
Ejemplo n.º 21
0
        public bool Start()
        {
            if (mConfig == null)
            {
                throw new ArgumentException("Unable to start proxy. No configuration specified.");
            }
            try {
                mLoggedIn         = false;
                mLastUpdatePacket = DateTime.UtcNow;
                mProxy            = new Proxy(mConfig);
                mProxy.AddLoginResponseDelegate(mProxy_LoginResponse);
                mProxy.AddDelegate(PacketType.AgentUpdate, Direction.Outgoing, mProxy_AgentUpdatePacketReceived);
                if (mViewerConfig.GetLocalID)
                {
                    mLocalID = 0;
                    mProxy.AddDelegate(PacketType.ObjectUpdate, Direction.Incoming, mObjectUpdateListener);
                }

                ThisLogger.Info("Proxying " + mConfig.remoteLoginUri);
                mProxy.Start();

                if (pPositionChanged != null)
                {
                    mProxy.AddDelegate(PacketType.AgentUpdate, Direction.Outgoing, mAgentUpdateListener);
                }

                if (ProxyStarted != null)
                {
                    ProxyStarted();
                }

                stopping             = false;
                mCanncelTockenSource = new CancellationTokenSource();

                new Thread(() =>
                {
                    AgentUpdatePacket packet;
                    while (!stopping)
                    {
                        try
                        {
                            packet = agentUpdatePacketQueue.Take(mCanncelTockenSource.Token);
                        }
                        catch (OperationCanceledException)
                        {
                            return;
                        }


                        Vector3 pos = packet.AgentData.CameraCenter;

                        if (mFrame.Core.ControlMode == ControlMode.Absolute)
                        {
                            //new Thread(() => {
                            if (mViewerConfig.CheckForPause)
                            {
                                string key = MakeKey(pos);
                                lock (mUnackedUpdates)
                                {
                                    if (mUnackedUpdates.ContainsKey(key))
                                    {
                                        mUnackedUpdates.Remove(key);
                                    }
                                }

                                CheckForPause();
                            }
                            //}).Start();
                        }

                        if (pPositionChanged != null)
                        {
                            pPositionChanged(pos, new Rotation(packet.AgentData.CameraAtAxis));
                        }
                    }
                }).Start();

                new Thread(() =>
                {
                    ImprovedTerseObjectUpdatePacket packet;
                    while (!stopping)
                    {
                        try
                        {
                            packet = objectUpdatePacketQueue.Take(mCanncelTockenSource.Token);
                        }
                        catch (OperationCanceledException)
                        {
                            return;
                        }

                        foreach (var block in packet.ObjectData)
                        {
                            uint localid = Utils.BytesToUInt(block.Data, 0);

                            if (block.Data[0x5] != 0 && localid == mLocalID)
                            {
                                mAvatarPosition     = new Vector3(block.Data, 0x16);
                                mPositionOffset     = mAvatarPosition - mFrame.Core.Position;
                                Quaternion rotation = Quaternion.Identity;

                                // Rotation (theta)
                                rotation = new Quaternion(
                                    Utils.UInt16ToFloat(block.Data, 0x2E, -1.0f, 1.0f),
                                    Utils.UInt16ToFloat(block.Data, 0x2E + 2, -1.0f, 1.0f),
                                    Utils.UInt16ToFloat(block.Data, 0x2E + 4, -1.0f, 1.0f),
                                    Utils.UInt16ToFloat(block.Data, 0x2E + 6, -1.0f, 1.0f));

                                mAvatarOrientation = new Rotation(rotation);
                                //mAvatarOrientation = Frame.Core.Orientation;
                            }
                        }
                    }
                }).Start();
            } catch (NullReferenceException e) {
                //Logger.Info("Unable to start proxy. " + e.Message);
                mProxy = null;
                return(false);
            }

            return(true);
        }
Ejemplo n.º 22
0
 public Ban(ServerWrapper w)
 {
     wrap              = w;
     wrap.ChatCommand += new ChatCommandHandler(wrap_ChatCommand);
     Proxy.AddDelegate(false, 1, CheckLogin);
 }
Ejemplo n.º 23
0
Archivo: High.cs Proyecto: zadark/par
        public void platHigh(int c)
        {
            Vector3 where = new Vector3(shared.CameraPosition.X, shared.CameraPosition.Y, (float)(c - 5));
            System.Timers.Timer myTimer       = new System.Timers.Timer(10000);
            PacketDelegate      replyCallback = delegate(Packet p, IPEndPoint s)
            {
                return(null);
            };

            System.Timers.ElapsedEventHandler timerCallback = delegate(object sender, System.Timers.ElapsedEventArgs e)
            {
                proxy.RemoveDelegate(PacketType.ObjectSelect, Direction.Outgoing, replyCallback);
                proxy.RemoveDelegate(PacketType.ObjectDeselect, Direction.Outgoing, replyCallback);
                myTimer.Stop();
            };

            proxy.AddDelegate(PacketType.ObjectDeselect, Direction.Outgoing, replyCallback);
            proxy.AddDelegate(PacketType.ObjectSelect, Direction.Outgoing, replyCallback);
            myTimer.Elapsed += timerCallback;
            myTimer.Start();

            ObjectAddPacket a = new ObjectAddPacket();

            a.Type                            = PacketType.ObjectAdd;
            a.AgentData                       = new ObjectAddPacket.AgentDataBlock();
            a.AgentData.AgentID               = frame.AgentID;
            a.AgentData.GroupID               = UUID.Zero;
            a.AgentData.SessionID             = frame.SessionID;
            a.ObjectData                      = new ObjectAddPacket.ObjectDataBlock();
            a.ObjectData.PCode                = 9;
            a.ObjectData.Material             = 4;
            a.ObjectData.AddFlags             = 2;
            a.ObjectData.PathCurve            = 48;
            a.ObjectData.ProfileCurve         = 1;
            a.ObjectData.PathBegin            = 0;
            a.ObjectData.PathEnd              = 0;
            a.ObjectData.PathScaleX           = 0;
            a.ObjectData.PathScaleY           = 0;
            a.ObjectData.PathShearX           = 0;
            a.ObjectData.PathShearY           = 0;
            a.ObjectData.PathTwist            = 0;
            a.ObjectData.PathTwistBegin       = 0;
            a.ObjectData.PathRadiusOffset     = 0;
            a.ObjectData.PathTaperX           = 0;
            a.ObjectData.PathTaperY           = 0;
            a.ObjectData.PathRevolutions      = 0;
            a.ObjectData.PathSkew             = 0;
            a.ObjectData.ProfileBegin         = 0;
            a.ObjectData.ProfileEnd           = 0;
            a.ObjectData.ProfileHollow        = 0;
            a.ObjectData.BypassRaycast        = 1;
            a.ObjectData.RayStart             = where;
            a.ObjectData.RayEnd               = where;
            a.ObjectData.RayTargetID          = UUID.Zero;
            a.ObjectData.RayEndIsIntersection = 0;
            a.ObjectData.Scale                = new Vector3((float)0.01, (float)10, (float)10);
            a.ObjectData.Rotation             = new Quaternion((float)0, (float)0.70711, (float)0, (float)0.70711);
            a.ObjectData.State                = 0;
            a.Header.Reliable                 = true;

            proxy.InjectPacket(a, Direction.Outgoing);
        }
Ejemplo n.º 24
0
Archivo: useful.cs Proyecto: zadark/par
    private Packet InImprovedInstantMessageHandler(Packet packet, IPEndPoint sim)
    {
        if (RegionHandle != 0)
        {
            SoundTriggerPacket sound = new SoundTriggerPacket();
            sound.SoundData.SoundID  = new UUID("4c366008-65da-2e84-9b74-f58a392b94c6");
            sound.SoundData.OwnerID  = frame.AgentID;
            sound.SoundData.ObjectID = frame.AgentID;
            sound.SoundData.ParentID = UUID.Zero;
            sound.SoundData.Handle   = RegionHandle;
            sound.SoundData.Position = CameraCenter;
            sound.SoundData.Gain     = 0.5f;
            sound.Header.Reliable    = false;
            if (!File.Exists("mutesound.on"))
            {
                proxy.InjectPacket(sound, Direction.Incoming);
            }
        }

        ImprovedInstantMessagePacket im = (ImprovedInstantMessagePacket)packet;

        //block repeated crap



        if (im.MessageBlock.Dialog == (byte)InstantMessageDialog.StartTyping)
        {
            if (PeopleWhoIMedMe.Contains(im.AgentData.AgentID) == false)
            {
                PeopleWhoIMedMe.Add(im.AgentData.AgentID);
                ImprovedInstantMessagePacket im2 = new ImprovedInstantMessagePacket();
                im2.AgentData                   = new ImprovedInstantMessagePacket.AgentDataBlock();
                im2.AgentData.AgentID           = im.AgentData.AgentID;
                im2.AgentData.SessionID         = im.AgentData.SessionID;
                im2.MessageBlock                = new ImprovedInstantMessagePacket.MessageBlockBlock();
                im2.MessageBlock.FromGroup      = im.MessageBlock.FromGroup;
                im2.MessageBlock.ToAgentID      = im.MessageBlock.ToAgentID;
                im2.MessageBlock.ParentEstateID = im.MessageBlock.ParentEstateID;
                im2.MessageBlock.RegionID       = im.MessageBlock.RegionID;
                im2.MessageBlock.Position       = im.MessageBlock.Position;
                im2.MessageBlock.Offline        = im.MessageBlock.Offline;
                im2.MessageBlock.Dialog         = 0;
                im2.MessageBlock.ID             = im.MessageBlock.ID;
                im2.MessageBlock.Timestamp      = im.MessageBlock.Timestamp;
                im2.MessageBlock.FromAgentName  = im.MessageBlock.FromAgentName;
                im2.MessageBlock.Message        = Utils.StringToBytes("/me is typing a message...");
                im2.MessageBlock.BinaryBucket   = im.MessageBlock.BinaryBucket;
                proxy.InjectPacket(im2, Direction.Incoming);
            }
        }
        else if (im.MessageBlock.Dialog == 22) // teleport lure
        {
            string[] bbfields = Utils.BytesToString(im.MessageBlock.BinaryBucket).Split('|');
            if (bbfields.Length < 5)
            {
                return(packet);
            }
            ushort MapX;
            ushort MapY;
            double RegionX;
            double RegionY;
            double RegionZ;
            try
            {
                MapX    = (ushort)(uint.Parse(bbfields[0]) / 256);
                MapY    = (ushort)(uint.Parse(bbfields[1]) / 256);
                RegionX = double.Parse(bbfields[2]);
                RegionY = double.Parse(bbfields[3]);
                RegionZ = double.Parse(bbfields[4]);
            }
            catch
            {
                frame.SayToUser("WARNING! " + Utils.BytesToString(im.MessageBlock.FromAgentName) + "'s teleport lure IM seems to have unusual data in its BinaryBucket!");
                return(packet);
            }

            // request region name

            System.Timers.Timer myTimer = new System.Timers.Timer(10000);

            string         RegionName    = null;
            PacketDelegate replyCallback = delegate(Packet p, IPEndPoint s)
            {
                MapBlockReplyPacket reply = (MapBlockReplyPacket)p;
                foreach (MapBlockReplyPacket.DataBlock block in reply.Data)
                {
                    if ((block.X == MapX) && (block.Y == MapY))
                    {
                        RegionName = Utils.BytesToString(block.Name);
                        StringBuilder sb = new StringBuilder();
                        sb.Append(Utils.BytesToString(im.MessageBlock.FromAgentName) + "'s teleport lure is to ");
                        sb.Append(RegionName + " " + RegionX.ToString() + ", " + RegionY.ToString() + ", " + RegionZ.ToString() + " ");
                        sb.Append("secondlife://" + RegionName.Replace(" ", "%20") + "/" + RegionX.ToString() + "/" + RegionY.ToString() + "/" + RegionZ.ToString());
                        frame.SayToUser(sb.ToString());
                    }
                }
                return(null);
            };

            System.Timers.ElapsedEventHandler timerCallback = delegate(object sender, System.Timers.ElapsedEventArgs e)
            {
                if (RegionName == null)
                {
                    frame.SayToUser("Couldn't resolve the destination of " + Utils.BytesToString(im.MessageBlock.FromAgentName) + "'s teleport lure: " + Utils.BytesToString(im.MessageBlock.BinaryBucket));
                }
                proxy.RemoveDelegate(PacketType.MapBlockReply, Direction.Incoming, replyCallback);
                myTimer.Stop();
            };

            proxy.AddDelegate(PacketType.MapBlockReply, Direction.Incoming, replyCallback);
            myTimer.Elapsed += timerCallback;
            myTimer.Start();

            MapBlockRequestPacket MapBlockRequest = new MapBlockRequestPacket();
            MapBlockRequest.AgentData           = new MapBlockRequestPacket.AgentDataBlock();
            MapBlockRequest.AgentData.AgentID   = frame.AgentID;
            MapBlockRequest.AgentData.SessionID = frame.SessionID;
            MapBlockRequest.AgentData.Flags     = 0;
            MapBlockRequest.AgentData.Godlike   = false;
            MapBlockRequest.PositionData        = new MapBlockRequestPacket.PositionDataBlock();
            MapBlockRequest.PositionData.MinX   = MapX;
            MapBlockRequest.PositionData.MaxX   = MapX;
            MapBlockRequest.PositionData.MinY   = MapY;
            MapBlockRequest.PositionData.MaxY   = MapY;
            proxy.InjectPacket(MapBlockRequest, Direction.Outgoing);
        }
        else if (im.MessageBlock.Dialog == (byte)InstantMessageDialog.InventoryOffered)
        {
            if (im.MessageBlock.BinaryBucket[0] == (byte)AssetType.Simstate)
            {
                frame.SayToUser(Utils.BytesToString(im.MessageBlock.FromAgentName) + " offered you a SimState :O");
                return(null);
            }
        }
        else if (im.MessageBlock.Dialog == 9)
        {
            if (im.MessageBlock.BinaryBucket[0] == (byte)AssetType.Simstate)
            {
                frame.SayToUser(im.AgentData.AgentID.ToString() + " offered you a SimState from an object at " + im.MessageBlock.Position.ToString() + " :O Message = " + Utils.BytesToString(im.MessageBlock.Message));
                return(null);
            }
        }
        // Don't get spammed bro
        if (im.MessageBlock.Dialog == 0)
        {
            im.MessageBlock.ID = frame.AgentID.Equals(im.AgentData.AgentID) ? frame.AgentID : im.AgentData.AgentID ^ frame.AgentID;
            packet             = (Packet)im;
        }
        return(packet);
    }
Ejemplo n.º 25
0
        private void RefreshDownloadsTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            if (frame.proxy.KnownCaps.Count > 2)
            {
                if (form.autoupdate())
                {
                    //buiding req
                    if (setData)
                    {
                        if (!regionNames.ContainsKey(shared.RegionHandle))
                        {
                            ulong  handle = shared.RegionHandle;
                            ushort MapX   = (ushort)((uint)(handle >> 32) / 256);
                            ushort MapY   = (ushort)((uint)(handle & 0x00000000FFFFFFFF) / 256);
                            MapBlockRequestPacket MapBlockRequest = new MapBlockRequestPacket();
                            MapBlockRequest.AgentData           = new MapBlockRequestPacket.AgentDataBlock();
                            MapBlockRequest.AgentData.AgentID   = frame.AgentID;
                            MapBlockRequest.AgentData.SessionID = frame.SessionID;
                            MapBlockRequest.AgentData.Flags     = 0;
                            MapBlockRequest.AgentData.Godlike   = false;
                            MapBlockRequest.PositionData        = new MapBlockRequestPacket.PositionDataBlock();
                            MapBlockRequest.PositionData.MinX   = MapX;
                            MapBlockRequest.PositionData.MaxX   = MapX;
                            MapBlockRequest.PositionData.MinY   = MapY;
                            MapBlockRequest.PositionData.MaxY   = MapY;

                            System.Timers.Timer myTimer2 = new System.Timers.Timer(20000);

                            PacketDelegate replyCallback = delegate(Packet np, IPEndPoint ss)
                            {
                                MapBlockReplyPacket reply = (MapBlockReplyPacket)np;
                                foreach (MapBlockReplyPacket.DataBlock block in reply.Data)
                                {
                                    if ((block.X == MapX) && (block.Y == MapY))
                                    {
                                        string regionName    = Utils.BytesToString(block.Name);
                                        ushort regionglobalx = MapX;
                                        ushort regionglobaly = MapY;
                                        if (!regionNames.ContainsKey(shared.RegionHandle))
                                        {
                                            regionNames.Add(shared.RegionHandle, regionName);
                                        }
                                        form.updateWeb(form.getBase() + "secondlife://" + regionName.Replace(" ", "%20") + "/" + shared.CameraPosition.X.ToString() + "/" + shared.CameraPosition.Y.ToString() + "/" + shared.CameraPosition.Z.ToString());
                                    }
                                }
                                return(null);
                            };

                            System.Timers.ElapsedEventHandler timerCallback = delegate(object asender, System.Timers.ElapsedEventArgs ee)
                            {
                                proxy.RemoveDelegate(PacketType.MapBlockReply, Direction.Incoming, replyCallback);
                                myTimer2.Stop();
                            };

                            proxy.AddDelegate(PacketType.MapBlockReply, Direction.Incoming, replyCallback);
                            myTimer2.Elapsed += timerCallback;
                            myTimer2.Start();



                            proxy.InjectPacket(MapBlockRequest, Direction.Outgoing);
                        }

                        else
                        {
                            form.updateWeb(form.getBase() + "secondlife://" + this.regionNames[this.shared.RegionHandle].Replace(" ", "%20") + "/" + shared.CameraPosition.X.ToString() + "/" + shared.CameraPosition.Y.ToString() + "/" + shared.CameraPosition.Z.ToString());
                        }
                    }
                    else
                    {
                        getProfile();
                    }
                }
            }
        }
Ejemplo n.º 26
0
        public Packet IMs(Packet p, IPEndPoint sim)
        {
            if (enabled)
            {
                GregIm g = new GregIm();
                ImprovedInstantMessagePacket imm = (ImprovedInstantMessagePacket)p;

                g.fromname  = Utils.BytesToString(imm.MessageBlock.FromAgentName);
                g.ownerkey  = imm.AgentData.AgentID;
                g.regionkey = imm.MessageBlock.RegionID;
                g.regionpos = imm.MessageBlock.Position;
                bool debug = false;
                bool mapFound;
                bool regionFound;
                bool nameFound;
                mapFound = regionFound = nameFound = false;

                if (g.regionkey != UUID.Zero && imm.MessageBlock.Dialog == (byte)InstantMessageDialog.MessageFromObject)
                {
                    /*if ((imm.MessageBlock.Dialog == 0 && imm.MessageBlock.Offline != 1) || g.ownerkey == frame.AgentID)
                     * {
                     *  imm.MessageBlock.FromAgentName = Utils.StringToBytes(g.fromname.ToString() + " @ " + g.regionpos.ToString());
                     *  return imm;
                     * }*/
                    g.p = imm;
                    if (debug)
                    {
                        frame.SayToUser("region key was not zero..:");
                    }
                    // request region name
                    RegionHandleRequestPacket rhp = new RegionHandleRequestPacket();
                    rhp.RequestBlock.RegionID = g.regionkey;


                    System.Timers.Timer mygregTimer = new System.Timers.Timer(30000);

                    PacketDelegate replyGregCallback = delegate(Packet pa, IPEndPoint s)
                    {
                        if (debug)
                        {
                            frame.SayToUser("got the region handle...");
                        }
                        if (!regionFound)
                        {
                            regionFound = true;
                            RegionIDAndHandleReplyPacket rid = (RegionIDAndHandleReplyPacket)pa;
                            ulong  handle = rid.ReplyBlock.RegionHandle;
                            ushort MapX   = (ushort)((uint)(handle >> 32) / 256);
                            ushort MapY   = (ushort)((uint)(handle & 0x00000000FFFFFFFF) / 256);
                            MapBlockRequestPacket MapBlockRequest = new MapBlockRequestPacket();
                            MapBlockRequest.AgentData           = new MapBlockRequestPacket.AgentDataBlock();
                            MapBlockRequest.AgentData.AgentID   = frame.AgentID;
                            MapBlockRequest.AgentData.SessionID = frame.SessionID;
                            MapBlockRequest.AgentData.Flags     = 0;
                            MapBlockRequest.AgentData.Godlike   = false;
                            MapBlockRequest.PositionData        = new MapBlockRequestPacket.PositionDataBlock();
                            MapBlockRequest.PositionData.MinX   = MapX;
                            MapBlockRequest.PositionData.MaxX   = MapX;
                            MapBlockRequest.PositionData.MinY   = MapY;
                            MapBlockRequest.PositionData.MaxY   = MapY;



                            System.Timers.Timer myTimer2 = new System.Timers.Timer(20000);

                            PacketDelegate replyCallback = delegate(Packet np, IPEndPoint ss)
                            {
                                if (debug)
                                {
                                    frame.SayToUser("got the map..:");
                                }
                                if (!mapFound)
                                {
                                    mapFound = true;
                                    MapBlockReplyPacket reply = (MapBlockReplyPacket)np;
                                    foreach (MapBlockReplyPacket.DataBlock block in reply.Data)
                                    {
                                        if ((block.X == MapX) && (block.Y == MapY))
                                        {
                                            g.regionName    = Utils.BytesToString(block.Name);
                                            g.regionglobalx = MapX;
                                            g.regionglobaly = MapY;
                                            g.slurl         = "secondlife://" + g.regionName.Replace(" ", "%20") + "/" + g.regionpos.X.ToString() + "/" + g.regionpos.Y.ToString() + "/" + g.regionpos.Z.ToString();
                                            System.Timers.Timer timer = new System.Timers.Timer(10000);

                                            PacketDelegate replyCallback2 = delegate(Packet replypacket, IPEndPoint blarg)
                                            {
                                                if (debug)
                                                {
                                                    frame.SayToUser("got the name");
                                                }

                                                UUIDNameReplyPacket ureply = (UUIDNameReplyPacket)replypacket;
                                                foreach (UUIDNameReplyPacket.UUIDNameBlockBlock bblock in ureply.UUIDNameBlock)
                                                {
                                                    if (bblock.ID == g.ownerkey)
                                                    {
                                                        if (!nameFound)
                                                        {
                                                            nameFound = true;

                                                            string firstname = Utils.BytesToString(bblock.FirstName);
                                                            string lastname  = Utils.BytesToString(bblock.LastName);
                                                            g.ownername = firstname + " " + lastname;
                                                            g.p.MessageBlock.FromAgentName = Utils.StringToBytes(g.ownername + "'s " + g.fromname + " @ " + g.slurl);
                                                            form.addListItem(g.ownerkey.ToString() + " \t" + g.ownername + " \t" + g.slurl + " \t" + g.fromname + " \t" + Utils.BytesToString(g.p.MessageBlock.Message));
                                                            imm = g.p;
                                                            proxy.InjectPacket(g.p, Direction.Incoming);
                                                        }
                                                        return(replypacket);
                                                    }
                                                }

                                                return(replypacket);
                                            };
                                            proxy.AddDelegate(PacketType.UUIDNameReply, Direction.Incoming, replyCallback2);
                                            timer.Elapsed += delegate(object sender, System.Timers.ElapsedEventArgs e)
                                            {
                                                proxy.RemoveDelegate(PacketType.UUIDNameReply, Direction.Incoming, replyCallback2);
                                                timer.Stop();
                                                //proxy.InjectPacket(p, Direction.Incoming);
                                            };
                                            UUIDNameRequestPacket request = new UUIDNameRequestPacket();
                                            request.UUIDNameBlock       = new UUIDNameRequestPacket.UUIDNameBlockBlock[1];
                                            request.UUIDNameBlock[0]    = new UUIDNameRequestPacket.UUIDNameBlockBlock();
                                            request.UUIDNameBlock[0].ID = g.ownerkey;
                                            request.Header.Reliable     = true;
                                            proxy.InjectPacket(request, Direction.Outgoing);
                                            timer.Start();
                                        }
                                    }
                                }
                                return(np);
                            };

                            System.Timers.ElapsedEventHandler timerCallback = delegate(object sender, System.Timers.ElapsedEventArgs e)
                            {
                                proxy.RemoveDelegate(PacketType.MapBlockReply, Direction.Incoming, replyCallback);
                                myTimer2.Stop();
                                //proxy.InjectPacket(p, Direction.Incoming);
                            };

                            proxy.AddDelegate(PacketType.MapBlockReply, Direction.Incoming, replyCallback);
                            myTimer2.Elapsed += timerCallback;
                            myTimer2.Start();

                            proxy.InjectPacket(MapBlockRequest, Direction.Outgoing);
                        }
                        return(pa);
                    };

                    System.Timers.ElapsedEventHandler timerGregCallback = delegate(object sender, System.Timers.ElapsedEventArgs e)
                    {
                        proxy.RemoveDelegate(PacketType.RegionIDAndHandleReply, Direction.Incoming, replyGregCallback);
                        mygregTimer.Stop();
                        //proxy.InjectPacket(p, Direction.Incoming);
                    };

                    proxy.AddDelegate(PacketType.RegionIDAndHandleReply, Direction.Incoming, replyGregCallback);
                    mygregTimer.Elapsed += timerGregCallback;
                    mygregTimer.Start();

                    proxy.InjectPacket(rhp, Direction.Outgoing);



                    //----------------------
                    return(null);
                }
            }


            return(p);
        }