Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="parcel"></param>
        /// <returns></returns>
        public bool RequestParcelInfo(DirectoryParcel parcel)
        {
            int attempts = 0;

Beginning:
            if (attempts++ > 3)
            {
                return(false);
            }

            Finished          = false;
            ParcelInfoTimeout = false;
            ParcelInfoParcel  = parcel;

            //    // Setup the timer
            //    Timer ParcelInfoTimer = new Timer(5000);
            //    ParcelInfoTimer.Elapsed += new ElapsedEventHandler(ParcelInfoTimerEvent);
            //    ParcelInfoTimeout = false;

            //    // Build the ParcelInfoRequest packet
            //    ParcelInfoRequestPacket request = new ParcelInfoRequestPacket();
            //    request.AgentData.AgentID = Client.Network.AgentID;
            //    request.AgentData.SessionID = Client.Network.SessionID;
            //    request.Data.ParcelID = parcel.ID;

            //    // Start the timer
            //    ParcelInfoTimer.Start();

            //    Client.Network.SendPacket((Packet)request);

            while (!Finished)
            {
                // FIXME: This can easily cause an infinite loop
                if (ParcelInfoTimeout)
                {
                    goto Beginning;
                }

                Client.Tick();
            }

            return(true);
        }
Пример #2
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);
        }
        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;
        }
Пример #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();
            }
        }
        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();
        }