Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="client"></param>
        public void Update(SecondLife client)
        {
            ParcelPropertiesUpdatePacket request = new ParcelPropertiesUpdatePacket();

            request.AgentData.AgentID   = client.Network.AgentID;
            request.AgentData.SessionID = client.Network.SessionID;

            request.ParcelData.Flags   = 0xFFFFFFFF; // TODO: Probably very important
            request.ParcelData.LocalID = this.LocalID;

            request.ParcelData.AuthBuyerID    = this.AuthBuyerID;
            request.ParcelData.Category       = this.Category;
            request.ParcelData.Desc           = Helpers.StringToField(this.Desc);
            request.ParcelData.GroupID        = this.GroupID;
            request.ParcelData.LandingType    = this.LandingType;
            request.ParcelData.MediaAutoScale = this.MediaAutoScale;
            request.ParcelData.MediaID        = this.MediaID;
            request.ParcelData.MediaURL       = Helpers.StringToField(this.MediaURL);
            request.ParcelData.MusicURL       = Helpers.StringToField(this.MusicURL);
            request.ParcelData.Name           = Helpers.StringToField(this.Name);
            request.ParcelData.ParcelFlags    = this.ParcelFlags;
            request.ParcelData.PassHours      = this.PassHours;
            request.ParcelData.PassPrice      = this.PassPrice;
            request.ParcelData.SalePrice      = this.SalePrice;
            request.ParcelData.SnapshotID     = this.SnapshotID;
            request.ParcelData.UserLocation   = this.UserLocation;
            request.ParcelData.UserLookAt     = this.UserLookAt;

            client.Network.SendPacket((Packet)request, Sim);
            //Packet updatePacket = Packets.Parcel.ParcelPropertiesUpdate(client.Protocol, client.Avatar.ID, client.Network.SessionID, this);
            //Sim.SendPacket(updatePacket, true);
        }
Пример #2
0
        private void ParcelPropertiesUpdateHandler(Packet packet, LLAgent agent)
        {
            ParcelPropertiesUpdatePacket update = (ParcelPropertiesUpdatePacket)packet;

            SceneParcel parcel;

            if (m_parcels.TryGetParcel(update.ParcelData.LocalID, out parcel))
            {
                // TODO: Permissions check

                parcel.AuthBuyerID          = update.ParcelData.AuthBuyerID;
                parcel.Category             = (ParcelCategory)update.ParcelData.Category;
                parcel.Desc                 = Utils.BytesToString(update.ParcelData.Desc);
                parcel.Flags                = (ParcelFlags)update.ParcelData.ParcelFlags;
                parcel.GroupID              = update.ParcelData.GroupID;
                parcel.Landing              = (LandingType)update.ParcelData.LandingType;
                parcel.Media.MediaAutoScale = update.ParcelData.MediaAutoScale != 0;
                parcel.Media.MediaID        = update.ParcelData.MediaID;
                parcel.Media.MediaURL       = Utils.BytesToString(update.ParcelData.MediaURL);
                parcel.MusicURL             = Utils.BytesToString(update.ParcelData.MusicURL);
                parcel.Name                 = Utils.BytesToString(update.ParcelData.Name);
                parcel.PassHours            = update.ParcelData.PassHours;
                parcel.PassPrice            = update.ParcelData.PassPrice;
                parcel.SalePrice            = update.ParcelData.SalePrice;
                parcel.SnapshotID           = update.ParcelData.SnapshotID;
                parcel.LandingLocation      = update.ParcelData.UserLocation;
                parcel.LandingLookAt        = update.ParcelData.UserLookAt;

                m_parcels.AddOrUpdateParcel(parcel);

                if (update.ParcelData.Flags != 0)
                {
                    SendParcelProperties(parcel.LocalID, 0, false, ParcelResult.Single, agent);
                }
            }
            else
            {
                m_log.Warn("Got a ParcelPropertiesUpdate for an unknown parcel " + update.ParcelData.LocalID);
            }
        }
Пример #3
0
        void ParcelPropertiesUpdateHandler(Packet packet, Agent agent)
        {
            ParcelPropertiesUpdatePacket update = (ParcelPropertiesUpdatePacket)packet;

            Parcel parcel;

            if (parcels.TryGetValue(update.ParcelData.LocalID, out parcel))
            {
                parcel.AuthBuyerID          = update.ParcelData.AuthBuyerID;
                parcel.Category             = (Parcel.ParcelCategory)update.ParcelData.Category;
                parcel.Desc                 = Utils.BytesToString(update.ParcelData.Desc);
                parcel.Flags                = (Parcel.ParcelFlags)update.ParcelData.ParcelFlags;
                parcel.GroupID              = update.ParcelData.GroupID;
                parcel.Landing              = (Parcel.LandingType)update.ParcelData.LandingType;
                parcel.Media.MediaAutoScale = update.ParcelData.MediaAutoScale;
                parcel.Media.MediaID        = update.ParcelData.MediaID;
                parcel.Media.MediaURL       = Utils.BytesToString(update.ParcelData.MediaURL);
                parcel.MusicURL             = Utils.BytesToString(update.ParcelData.MusicURL);
                parcel.Name                 = Utils.BytesToString(update.ParcelData.Name);
                parcel.PassHours            = update.ParcelData.PassHours;
                parcel.PassPrice            = update.ParcelData.PassPrice;
                parcel.SalePrice            = update.ParcelData.SalePrice;
                parcel.SnapshotID           = update.ParcelData.SnapshotID;
                parcel.UserLocation         = update.ParcelData.UserLocation;
                parcel.UserLookAt           = update.ParcelData.UserLookAt;

                lock (parcels)
                    parcels[parcel.LocalID] = parcel;

                if (update.ParcelData.Flags != 0)
                {
                    SendParcelProperties(parcel.LocalID, 0, false, ParcelResult.Single, agent);
                }
            }
            else
            {
                Logger.Log("Got a ParcelPropertiesUpdate for an unknown parcel " + update.ParcelData.LocalID,
                           Helpers.LogLevel.Warning);
            }
        }
Пример #4
0
        /// <summary>
        /// Update the simulator with any local changes to this Parcel object
        /// </summary>
        /// <param name="simulator">Simulator to send updates to</param>
        /// <param name="wantReply">Whether we want the simulator to confirm
        /// the update with a reply packet or not</param>
        public void Update(Simulator simulator, bool wantReply)
        {
            Uri url = simulator.Caps.CapabilityURI("ParcelPropertiesUpdate");

            if (url != null)
            {
                ParcelPropertiesUpdateMessage req = new ParcelPropertiesUpdateMessage();
                req.AuthBuyerID = this.AuthBuyerID;
                req.Category = this.Category;
                req.Desc = this.Desc;
                req.GroupID = this.GroupID;
                req.Landing = this.Landing;
                req.LocalID = this.LocalID;
                req.MediaAutoScale = this.Media.MediaAutoScale;
                req.MediaDesc = this.Media.MediaDesc;
                req.MediaHeight = this.Media.MediaHeight;
                req.MediaID = this.Media.MediaID;
                req.MediaLoop = this.Media.MediaLoop;
                req.MediaType = this.Media.MediaType;
                req.MediaURL = this.Media.MediaURL;
                req.MediaWidth = this.Media.MediaWidth;
                req.MusicURL = this.MusicURL;
                req.Name = this.Name;
                req.ObscureMedia = this.ObscureMedia;
                req.ObscureMusic = this.ObscureMusic;
                req.ParcelFlags = this.Flags;
                req.PassHours = this.PassHours;
                req.PassPrice = (uint)this.PassPrice;
                req.SalePrice = (uint)this.SalePrice;
                req.SnapshotID = this.SnapshotID;
                req.UserLocation = this.UserLocation;
                req.UserLookAt = this.UserLookAt;
               
                OSDMap body = req.Serialize();

                CapsClient capsPost = new CapsClient(url);
                capsPost.BeginGetResponse(body, OSDFormat.Xml, simulator.Client.Settings.CAPS_TIMEOUT);
            }
            else
            {
                ParcelPropertiesUpdatePacket request = new ParcelPropertiesUpdatePacket();

                request.AgentData.AgentID = simulator.Client.Self.AgentID;
                request.AgentData.SessionID = simulator.Client.Self.SessionID;

                request.ParcelData.LocalID = this.LocalID;

                request.ParcelData.AuthBuyerID = this.AuthBuyerID;
                request.ParcelData.Category = (byte)this.Category;
                request.ParcelData.Desc = Utils.StringToBytes(this.Desc);
                request.ParcelData.GroupID = this.GroupID;
                request.ParcelData.LandingType = (byte)this.Landing;
                request.ParcelData.MediaAutoScale = (this.Media.MediaAutoScale) ? (byte)0x1 : (byte)0x0;
                request.ParcelData.MediaID = this.Media.MediaID;
                request.ParcelData.MediaURL = Utils.StringToBytes(this.Media.MediaURL.ToString());
                request.ParcelData.MusicURL = Utils.StringToBytes(this.MusicURL.ToString());
                request.ParcelData.Name = Utils.StringToBytes(this.Name);
                if (wantReply) request.ParcelData.Flags = 1;
                request.ParcelData.ParcelFlags = (uint)this.Flags;
                request.ParcelData.PassHours = this.PassHours;
                request.ParcelData.PassPrice = this.PassPrice;
                request.ParcelData.SalePrice = this.SalePrice;
                request.ParcelData.SnapshotID = this.SnapshotID;
                request.ParcelData.UserLocation = this.UserLocation;
                request.ParcelData.UserLookAt = this.UserLookAt;

                simulator.SendPacket(request);
            }

            UpdateOtherCleanTime(simulator);
            
        }
Пример #5
0
        /// <summary>
        /// Update the simulator with any local changes to this Parcel object
        /// </summary>
        /// <param name="wantReply">Whether we want the simulator to confirm
        /// the update with a reply packet or not</param>
        public void Update(bool wantReply)
        {
            ParcelPropertiesUpdatePacket request = new ParcelPropertiesUpdatePacket();

            request.AgentData.AgentID = Simulator.Client.Self.AgentID;
            request.AgentData.SessionID = Simulator.Client.Self.SessionID;

            request.ParcelData.LocalID = this.LocalID;

            request.ParcelData.AuthBuyerID = this.AuthBuyerID;
            request.ParcelData.Category = (byte)this.Category;
            request.ParcelData.Desc = Helpers.StringToField(this.Desc);
            request.ParcelData.GroupID = this.GroupID;
            request.ParcelData.LandingType = this.LandingType;
            request.ParcelData.MediaAutoScale = this.MediaAutoScale;
            request.ParcelData.MediaID = this.MediaID;
            request.ParcelData.MediaURL = Helpers.StringToField(this.MediaURL);
            request.ParcelData.MusicURL = Helpers.StringToField(this.MusicURL);
            request.ParcelData.Name = Helpers.StringToField(this.Name);
            if (wantReply) request.ParcelData.Flags = 1;
            request.ParcelData.ParcelFlags = (uint)this.Flags;
            request.ParcelData.PassHours = this.PassHours;
            request.ParcelData.PassPrice = this.PassPrice;
            request.ParcelData.SalePrice = this.SalePrice;
            request.ParcelData.SnapshotID = this.SnapshotID;
            request.ParcelData.UserLocation = this.UserLocation;
            request.ParcelData.UserLookAt = this.UserLookAt;

            Simulator.Client.Network.SendPacket(request, Simulator);

            UpdateOtherCleanTime();
        }
Пример #6
0
        /// <summary>
        /// Update the simulator with any local changes to this Parcel object
        /// </summary>
        /// <param name="simulator">Simulator to send updates to</param>
        /// <param name="wantReply">Whether we want the simulator to confirm
        /// the update with a reply packet or not</param>
        public void Update(Simulator simulator, bool wantReply)
        {
            Uri url = simulator.Caps.CapabilityURI("ParcelPropertiesUpdate");

            if (url != null)
            {
                OSDMap body = new OSDMap();
                body["auth_buyer_id"] =  OSD.FromUUID(this.AuthBuyerID);
                body["auto_scale"] =  OSD.FromInteger(this.Media.MediaAutoScale);
                body["category"] = OSD.FromInteger((byte)this.Category);
                body["description"] = OSD.FromString(this.Desc);
                body["flags"] =  OSD.FromBinary(Utils.EmptyBytes);
                body["group_id"] = OSD.FromUUID(this.GroupID);
                body["landing_type"] = OSD.FromInteger((byte)this.Landing);
                body["local_id"] = OSD.FromInteger(this.LocalID);
                body["media_desc"] = OSD.FromString(this.Media.MediaDesc);
                body["media_height"] = OSD.FromInteger(this.Media.MediaHeight);
                body["media_id"] = OSD.FromUUID(this.Media.MediaID);
                body["media_loop"] = OSD.FromInteger(this.Media.MediaLoop ? 1 : 0);
                body["media_type"] = OSD.FromString(this.Media.MediaType);
                body["media_url"] = OSD.FromString(this.Media.MediaURL);
                body["media_width"] = OSD.FromInteger(this.Media.MediaWidth);
                body["music_url"] = OSD.FromString(this.MusicURL);
                body["name"] = OSD.FromString(this.Name);
                body["obscure_media"]= OSD.FromInteger(this.ObscureMedia ? 1 : 0);
                body["obscure_music"] = OSD.FromInteger(this.ObscureMusic ? 1 : 0);

                byte[] flags = Utils.IntToBytes((int)this.Flags); ;
                if (BitConverter.IsLittleEndian)
                    Array.Reverse(flags);
                body["parcel_flags"] = OSD.FromBinary(flags);

                body["pass_hours"] = OSD.FromReal(this.PassHours);
                body["pass_price"] = OSD.FromInteger(this.PassPrice);
                body["sale_price"] = OSD.FromInteger(this.SalePrice);
                body["snapshot_id"] = OSD.FromUUID(this.SnapshotID);
                OSDArray uloc = new OSDArray();
                uloc.Add(OSD.FromReal(this.UserLocation.X));
                uloc.Add(OSD.FromReal(this.UserLocation.Y));
                uloc.Add(OSD.FromReal(this.UserLocation.Z));
                body["user_location"] = uloc;
                OSDArray ulat = new OSDArray();
                ulat.Add(OSD.FromReal(this.UserLocation.X));
                ulat.Add(OSD.FromReal(this.UserLocation.Y));
                ulat.Add(OSD.FromReal(this.UserLocation.Z));
                body["user_look_at"] = ulat;

                //Console.WriteLine("OSD REQUEST\n{0}", body.ToString());

                byte[] postData = StructuredData.OSDParser.SerializeLLSDXmlBytes(body);
                //Console.WriteLine("{0}", OSDParser.SerializeLLSDXmlString(body));
                CapsClient capsPost = new CapsClient(url);
                capsPost.StartRequest(postData);

            }
            else
            {

                ParcelPropertiesUpdatePacket request = new ParcelPropertiesUpdatePacket();

                request.AgentData.AgentID = simulator.Client.Self.AgentID;
                request.AgentData.SessionID = simulator.Client.Self.SessionID;

                request.ParcelData.LocalID = this.LocalID;

                request.ParcelData.AuthBuyerID = this.AuthBuyerID;
                request.ParcelData.Category = (byte)this.Category;
                request.ParcelData.Desc = Utils.StringToBytes(this.Desc);
                request.ParcelData.GroupID = this.GroupID;
                request.ParcelData.LandingType = (byte)this.Landing;
                request.ParcelData.MediaAutoScale = this.Media.MediaAutoScale;
                request.ParcelData.MediaID = this.Media.MediaID;
                request.ParcelData.MediaURL = Utils.StringToBytes(this.Media.MediaURL);
                request.ParcelData.MusicURL = Utils.StringToBytes(this.MusicURL);
                request.ParcelData.Name = Utils.StringToBytes(this.Name);
                if (wantReply) request.ParcelData.Flags = 1;
                request.ParcelData.ParcelFlags = (uint)this.Flags;
                request.ParcelData.PassHours = this.PassHours;
                request.ParcelData.PassPrice = this.PassPrice;
                request.ParcelData.SalePrice = this.SalePrice;
                request.ParcelData.SnapshotID = this.SnapshotID;
                request.ParcelData.UserLocation = this.UserLocation;
                request.ParcelData.UserLookAt = this.UserLookAt;

                simulator.SendPacket(request, true);
            }

            UpdateOtherCleanTime(simulator);
            
        }
Пример #7
0
        /// <summary>
        /// Update the simulator with any local changes to this Parcel object
        /// </summary>
        /// <param name="simulator">Simulator to send updates to</param>
        /// <param name="wantReply">Whether we want the simulator to confirm
        /// the update with a reply packet or not</param>
        public void Update(Simulator simulator, bool wantReply)
        {
            Uri url = simulator.Caps.CapabilityURI("ParcelPropertiesUpdate");

            if (url != null)
            {
                ParcelPropertiesUpdateMessage req = new ParcelPropertiesUpdateMessage();
                req.AuthBuyerID = this.AuthBuyerID;
                req.Category = this.Category;
                req.Desc = this.Desc;
                req.GroupID = this.GroupID;
                req.Landing = this.Landing;
                req.LocalID = this.LocalID;
                req.MediaAutoScale = this.Media.MediaAutoScale;
                req.MediaDesc = this.Media.MediaDesc;
                req.MediaHeight = this.Media.MediaHeight;
                req.MediaID = this.Media.MediaID;
                req.MediaLoop = this.Media.MediaLoop;
                req.MediaType = this.Media.MediaType;
                req.MediaURL = this.Media.MediaURL;
                req.MediaWidth = this.Media.MediaWidth;
                req.MusicURL = this.MusicURL;
                req.Name = this.Name;
                req.ObscureMedia = this.ObscureMedia;
                req.ObscureMusic = this.ObscureMusic;
                req.ParcelFlags = this.Flags;
                req.PassHours = this.PassHours;
                req.PassPrice = (uint)this.PassPrice;
                req.SalePrice = (uint)this.SalePrice;
                req.SnapshotID = this.SnapshotID;
                req.UserLocation = this.UserLocation;
                req.UserLookAt = this.UserLookAt;

                //OSDMap body = new OSDMap();
                //body["auth_buyer_id"] =  OSD.FromUUID(this.AuthBuyerID);
                //body["auto_scale"] =  OSD.FromBoolean(this.Media.MediaAutoScale);
                //body["category"] = OSD.FromInteger((byte)this.Category);
                //body["description"] = OSD.FromString(this.Desc);
                //body["flags"] =  OSD.FromBinary(Utils.EmptyBytes);
                //body["group_id"] = OSD.FromUUID(this.GroupID);
                //body["landing_type"] = OSD.FromInteger((byte)this.Landing);
                //body["local_id"] = OSD.FromInteger(this.LocalID);
                //body["media_desc"] = OSD.FromString(this.Media.MediaDesc);
                //body["media_height"] = OSD.FromInteger(this.Media.MediaHeight);
                //body["media_id"] = OSD.FromUUID(this.Media.MediaID);
                //body["media_loop"] = OSD.FromInteger(this.Media.MediaLoop ? 1 : 0);
                //body["media_type"] = OSD.FromString(this.Media.MediaType);
                //body["media_url"] = OSD.FromString(this.Media.MediaURL);
                //body["media_width"] = OSD.FromInteger(this.Media.MediaWidth);
                //body["music_url"] = OSD.FromString(this.MusicURL);
                //body["name"] = OSD.FromString(this.Name);
                //body["obscure_media"]= OSD.FromInteger(this.ObscureMedia ? 1 : 0);
                //body["obscure_music"] = OSD.FromInteger(this.ObscureMusic ? 1 : 0);

                //byte[] flags = Utils.IntToBytes((int)this.Flags); ;
                //if (BitConverter.IsLittleEndian)
                //    Array.Reverse(flags);
                //body["parcel_flags"] = OSD.FromBinary(flags);

                //body["pass_hours"] = OSD.FromReal(this.PassHours);
                //body["pass_price"] = OSD.FromInteger(this.PassPrice);
                //body["sale_price"] = OSD.FromInteger(this.SalePrice);
                //body["snapshot_id"] = OSD.FromUUID(this.SnapshotID);
                //OSDArray uloc = new OSDArray();
                //uloc.Add(OSD.FromReal(this.UserLocation.X));
                //uloc.Add(OSD.FromReal(this.UserLocation.Y));
                //uloc.Add(OSD.FromReal(this.UserLocation.Z));
                //body["user_location"] = uloc;
                //OSDArray ulat = new OSDArray();
                //ulat.Add(OSD.FromReal(this.UserLocation.X));
                //ulat.Add(OSD.FromReal(this.UserLocation.Y));
                //ulat.Add(OSD.FromReal(this.UserLocation.Z));
                //body["user_look_at"] = ulat;

                OSDMap body = req.Serialize();

                CapsClient capsPost = new CapsClient(url);
                capsPost.BeginGetResponse(body, OSDFormat.Xml, simulator.Network.CapsTimeout);
            }
            else
            {
                ParcelPropertiesUpdatePacket request = new ParcelPropertiesUpdatePacket();

                request.AgentData.AgentID = simulator.Network.AgentID;
                request.AgentData.SessionID = simulator.Network.SessionID;

                request.ParcelData.LocalID = this.LocalID;

                request.ParcelData.AuthBuyerID = this.AuthBuyerID;
                request.ParcelData.Category = (byte)this.Category;
                request.ParcelData.Desc = Utils.StringToBytes(this.Desc);
                request.ParcelData.GroupID = this.GroupID;
                request.ParcelData.LandingType = (byte)this.Landing;
                request.ParcelData.MediaAutoScale = (this.Media.MediaAutoScale) ? (byte)0x1 : (byte)0x0;
                request.ParcelData.MediaID = this.Media.MediaID;
                request.ParcelData.MediaURL = Utils.StringToBytes(this.Media.MediaURL.ToString());
                request.ParcelData.MusicURL = Utils.StringToBytes(this.MusicURL.ToString());
                request.ParcelData.Name = Utils.StringToBytes(this.Name);
                if (wantReply) request.ParcelData.Flags = 1;
                request.ParcelData.ParcelFlags = (uint)this.Flags;
                request.ParcelData.PassHours = this.PassHours;
                request.ParcelData.PassPrice = this.PassPrice;
                request.ParcelData.SalePrice = this.SalePrice;
                request.ParcelData.SnapshotID = this.SnapshotID;
                request.ParcelData.UserLocation = this.UserLocation;
                request.ParcelData.UserLookAt = this.UserLookAt;

                simulator.SendPacket(request);
            }

            UpdateOtherCleanTime(simulator);
            
        }
Пример #8
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="client"></param>
        public void Update(SecondLife client)
        {
            ParcelPropertiesUpdatePacket request = new ParcelPropertiesUpdatePacket();

            request.AgentData.AgentID = client.Network.AgentID;
            request.AgentData.SessionID = client.Network.SessionID;

            request.ParcelData.Flags = 0xFFFFFFFF; // TODO: Probably very important
            request.ParcelData.LocalID = this.LocalID;

            request.ParcelData.AuthBuyerID = this.AuthBuyerID;
            request.ParcelData.Category = this.Category;
            request.ParcelData.Desc = Helpers.StringToField(this.Desc);
            request.ParcelData.GroupID = this.GroupID;
            request.ParcelData.LandingType = this.LandingType;
            request.ParcelData.MediaAutoScale = this.MediaAutoScale;
            request.ParcelData.MediaID = this.MediaID;
            request.ParcelData.MediaURL = Helpers.StringToField(this.MediaURL);
            request.ParcelData.MusicURL = Helpers.StringToField(this.MusicURL);
            request.ParcelData.Name = Helpers.StringToField(this.Name);
            request.ParcelData.ParcelFlags = this.ParcelFlags;
            request.ParcelData.PassHours = this.PassHours;
            request.ParcelData.PassPrice = this.PassPrice;
            request.ParcelData.SalePrice = this.SalePrice;
            request.ParcelData.SnapshotID = this.SnapshotID;
            request.ParcelData.UserLocation = this.UserLocation;
            request.ParcelData.UserLookAt = this.UserLookAt;

            client.Network.SendPacket((Packet)request, Sim);
            //Packet updatePacket = Packets.Parcel.ParcelPropertiesUpdate(client.Protocol, client.Avatar.ID, client.Network.SessionID, this);
            //Sim.SendPacket(updatePacket, true);
        }