Esempio n. 1
0
        protected void doStuff(string sim, LLVector3 coords)
        {
            Client.Grid.OnRegionAdd += new GridRegionCallback(GridRegionHandler);

            Console.WriteLine("Caching estate sims...");
            Client.Grid.AddEstateSims();
            System.Threading.Thread.Sleep(3000);

            if (RegionHandle == 0)
            {
                Client.Grid.BeginGetGridRegion(sim, new GridRegionCallback(GridRegionHandler));

                int start = Environment.TickCount;

                while (RegionHandle == 0)
                {
                    Client.Tick();

                    if (Environment.TickCount - start > 10000)
                    {
                        Console.WriteLine("Region handle lookup failed");
                        Disconnect();
                        return;
                    }
                }
            }

            Client.Self.OnTeleport += new MainAvatar.TeleportCallback(Self_OnTeleport);

            DoneTeleporting = false;
            Client.Self.Teleport(RegionHandle, coords);

            while (!DoneTeleporting)
            {
                Client.Tick();
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            SecondLife client;

            if (args.Length < 5)
            {
                Console.WriteLine("Usage: name2key [loginfirstname] [loginlastname] [password] [firstname] [lastname]");
                return;
            }

            client = new SecondLife();

            // Setup the callback
            client.Network.RegisterCallback(PacketType.DirPeopleReply, new PacketCallback(QueryHandler));

            // Setup the login values
            Dictionary <string, object> loginParams = NetworkManager.DefaultLoginValues(args[0], args[1], args[2],
                                                                                        "00:00:00:00:00:00", "last", "Win", "0", "name2key", "*****@*****.**");

            if (!client.Network.Login(loginParams))
            {
                // Login failed
                Console.WriteLine("ERROR: " + client.Network.LoginError);
                return;
            }

            // Send the Query
            DirFindQueryPacket find = new DirFindQueryPacket();

            find.AgentData.AgentID    = client.Network.AgentID;
            find.AgentData.SessionID  = client.Network.SessionID;
            find.QueryData.QueryFlags = 1;
            find.QueryData.QueryText  = Helpers.StringToField(args[3] + " " + args[4]);
            find.QueryData.QueryID    = new LLUUID("00000000000000000000000000000001");
            find.QueryData.QueryStart = 0;

            client.Network.SendPacket((Packet)find);

            while (waiting)
            {
                client.Tick();
            }

            client.Network.Logout();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            if (args.Length < 3)
            {
                Console.WriteLine("Usage: ParcelDownloader [loginfirstname] [loginlastname] [password]");
                return;
            }

            client = new SecondLife();

            Dictionary <string, object> loginParams = NetworkManager.DefaultLoginValues(args[0], args[1], args[2],
                                                                                        "00:00:00:00:00:00", "last", "Win", "0", "ParcelDownload", "Adam \"Zaius\" Frisby <*****@*****.**>");

            if (!client.Network.Login(loginParams))
            {
                // Login failed
                Console.WriteLine("ERROR: " + client.Network.LoginError);
                return;
            }

            // The magic happens in these three lines
            client.Network.CurrentSim.Region.FillParcels();             // Tell libsl to download parcels
            System.Threading.Thread.Sleep(10000);                       // Give it some time to do it
            client.Tick();                                              // Let things happen

            // Dump some info about our parcels
            foreach (int pkey in client.Network.CurrentSim.Region.Parcels.Keys)
            {
                Parcel parcel = (Parcel)client.Network.CurrentSim.Region.Parcels[pkey];
                // Probably should comment this out :-)
                //parcel.Buy(client,false,new LLUUID());
                Console.WriteLine("<Parcel>");
                Console.WriteLine("\tName: " + parcel.Name);
                Console.WriteLine("\tSize: " + parcel.Area);
                Console.WriteLine("\tDesc: " + parcel.Desc);
            }

            client.Network.Logout();
            return;
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            SecondLife client;

            if (args.Length == 0 || (args.Length < 3 && args[0] != "--printmap"))
            {
                Console.WriteLine("Usage: sldump [--printmap] [--decrypt] [inputfile] [outputfile] [--protocol] [firstname] " +
                                  "[lastname] [password]");
                return;
            }

            if (args[0] == "--decrypt")
            {
                try
                {
                    ProtocolManager.DecodeMapFile(args[1], args[2]);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                }

                return;
            }

            client = new SecondLife();

            if (args[0] == "--printmap")
            {
                ProtocolManager protocol;

                try
                {
                    protocol = new ProtocolManager("message_template.msg", client);
                }
                catch (Exception e)
                {
                    // Error initializing the client, probably missing file(s)
                    Console.WriteLine(e.ToString());
                    return;
                }

                protocol.PrintMap();
                return;
            }

            // Setup the packet callback and disconnect event handler
            client.Network.RegisterCallback(PacketType.Default, new PacketCallback(DefaultHandler));
            client.Network.OnDisconnected += new DisconnectCallback(DisconnectHandler);

            Dictionary <string, object> loginParams = NetworkManager.DefaultLoginValues(args[0], args[1], args[2],
                                                                                        "0", "last", "Win", "0", "sldump", "*****@*****.**");

            // An example of how to pass additional options to the login server
            //loginParams["id0"] = "65e142a8d3c1ee6632259f111cb168c9";
            //loginParams["viewer_digest"] = "0e63550f-0991-a092-3158-b4206e728ffa";

            if (!client.Network.Login(loginParams /*, "http://127.0.0.1:8080/"*/))
            {
                // Login failed
                Console.WriteLine("Error logging in: " + client.Network.LoginError);
                return;
            }

            // Login was successful
            Console.WriteLine("Message of the day: " + client.Network.LoginValues["message"]);

            while (true)
            {
                client.Tick();
            }
        }
Esempio n. 5
0
        public void DownloadInventory()
        {
            ClearState();

            if (FolderDownloadStatus == null)
            {
                // Create status table
                FolderDownloadStatus = new Dictionary <LLUUID, DownloadRequest_Folder>();
            }
            else
            {
                if (FolderDownloadStatus.Count != 0)
                {
                    throw new Exception("Inventory Download requested while previous download in progress.");
                }
            }

            if (alFolderRequestQueue == null)
            {
                alFolderRequestQueue = new List <DownloadRequest_Folder>();
            }

            // Set last packet received to now, just so out time-out timer works
            LastPacketRecievedAtTick = Environment.TickCount;

            // Send Packet requesting the root Folder,
            // this should recurse through all folders
            RequestFolder(new DownloadRequest_Folder(slClient.Self.InventoryRootFolderUUID));

            while ((FolderDownloadStatus.Count > 0) || (alFolderRequestQueue.Count > 0))
            {
                if (FolderDownloadStatus.Count == 0)
                {
                    DownloadRequest_Folder dr = alFolderRequestQueue[0];
                    alFolderRequestQueue.RemoveAt(0);
                    RequestFolder(dr);
                }

                int curTick = Environment.TickCount;
                if ((curTick - LastPacketRecievedAtTick) > 10000)
                {
                    slClient.Log("Time-out while waiting for packets (" +
                                 ((curTick - LastPacketRecievedAtTick) / 1000) + " seconds since last packet)",
                                 Helpers.LogLevel.Warning);

                    // have to make a seperate list otherwise we run into modifying the original array
                    // while still enumerating it.
                    List <DownloadRequest_Folder> alRestartList = new List <DownloadRequest_Folder>();


                    foreach (DownloadRequest_Folder dr in FolderDownloadStatus.Values)
                    {
                        alRestartList.Add(dr);
                    }

                    LastPacketRecievedAtTick = Environment.TickCount;
                    foreach (DownloadRequest_Folder dr in alRestartList)
                    {
                        RequestFolder(dr);
                    }
                }

                slClient.Tick();
            }
        }