Parcel of land, a portion of virtual real estate in a simulator
Example #1
0
 public override bool CallFunction(string[] args)
 {
     if (base.CallFunction(args) == true)
     {
         int localid = bot.GetClient.Parcels.GetParcelLocalID(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimPosition);
         if (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true)
         {
             targetparcel = bot.GetClient.Network.CurrentSim.Parcels[localid];
             return(true);
         }
         else
         {
             return(Failed("Unable to find parcel in memory, please wait and try again"));
         }
     }
     else
     {
         return(false);
     }
 }
Example #2
0
 /// <summary>
 /// Construct a new instance of the ParcelPropertiesEventArgs class
 /// </summary>
 /// <param name="simulator">The <see cref="Parcel"/> object containing the details</param>
 /// <param name="parcel">The <see cref="Parcel"/> object containing the details</param>
 /// <param name="result">The result of the request</param>
 /// <param name="selectedPrims">The number of primitieves your agent is 
 /// currently selecting and or sitting on in this parcel</param>
 /// <param name="sequenceID">The user assigned ID used to correlate a request with
 /// these results</param>
 /// <param name="snapSelection">TODO:</param>
 public ParcelPropertiesEventArgs(Simulator simulator, Parcel parcel, ParcelResult result, int selectedPrims,
     int sequenceID, bool snapSelection)
 {
     this.m_Simulator = simulator;
     this.m_Parcel = parcel;
     this.m_Result = result;
     this.m_SelectedPrims = selectedPrims;
     this.m_SequenceID = sequenceID;
     this.m_SnapSelection = snapSelection;
 }
Example #3
0
        protected void ParcelPropertiesReplyHandler(string capsKey, IMessage message, Simulator simulator)
        {                        
            if (m_ParcelProperties != null || Client.Settings.PARCEL_TRACKING == true)
            {
                ParcelPropertiesMessage msg = (ParcelPropertiesMessage)message;
                
                Parcel parcel = new Parcel(msg.LocalID);

                parcel.AABBMax = msg.AABBMax;
                parcel.AABBMin = msg.AABBMin;
                parcel.Area = msg.Area;
                parcel.AuctionID = msg.AuctionID;
                parcel.AuthBuyerID = msg.AuthBuyerID;
                parcel.Bitmap = msg.Bitmap;
                parcel.Category = msg.Category;
                parcel.ClaimDate = msg.ClaimDate;
                parcel.ClaimPrice = msg.ClaimPrice;
                parcel.Desc = msg.Desc;
                parcel.Flags = msg.ParcelFlags;
                parcel.GroupID = msg.GroupID;
                parcel.GroupPrims = msg.GroupPrims;
                parcel.IsGroupOwned = msg.IsGroupOwned;
                parcel.Landing = msg.LandingType;
                parcel.MaxPrims = msg.MaxPrims;
                parcel.Media.MediaAutoScale = msg.MediaAutoScale;
                parcel.Media.MediaID = msg.MediaID;
                parcel.Media.MediaURL = msg.MediaURL;
                parcel.MusicURL = msg.MusicURL;
                parcel.Name = msg.Name;
                parcel.OtherCleanTime = msg.OtherCleanTime;
                parcel.OtherCount = msg.OtherCount;
                parcel.OtherPrims = msg.OtherPrims;
                parcel.OwnerID = msg.OwnerID;
                parcel.OwnerPrims = msg.OwnerPrims;
                parcel.ParcelPrimBonus = msg.ParcelPrimBonus;
                parcel.PassHours = msg.PassHours;
                parcel.PassPrice = msg.PassPrice;
                parcel.PublicCount = msg.PublicCount;
                parcel.RegionDenyAgeUnverified = msg.RegionDenyAgeUnverified;
                parcel.RegionDenyAnonymous = msg.RegionDenyAnonymous;
                parcel.RegionPushOverride = msg.RegionPushOverride;
                parcel.RentPrice = msg.RentPrice;
                ParcelResult result = msg.RequestResult;
                parcel.SalePrice = msg.SalePrice;
                int selectedPrims = msg.SelectedPrims;
                parcel.SelfCount = msg.SelfCount;
                int sequenceID = msg.SequenceID;
                parcel.SimWideMaxPrims = msg.SimWideMaxPrims;
                parcel.SimWideTotalPrims = msg.SimWideTotalPrims;
                bool snapSelection = msg.SnapSelection;
                parcel.SnapshotID = msg.SnapshotID;
                parcel.Status = msg.Status;
                parcel.TotalPrims = msg.TotalPrims;
                parcel.UserLocation = msg.UserLocation;
                parcel.UserLookAt = msg.UserLookAt;
                parcel.Media.MediaDesc = msg.MediaDesc;
                parcel.Media.MediaHeight = msg.MediaHeight;
                parcel.Media.MediaWidth = msg.MediaWidth;
                parcel.Media.MediaLoop = msg.MediaLoop;
                parcel.Media.MediaType = msg.MediaType;
                parcel.ObscureMedia = msg.ObscureMedia;
                parcel.ObscureMusic = msg.ObscureMusic;

                if (Client.Settings.PARCEL_TRACKING)
                {
                    lock (simulator.Parcels.Dictionary)
                        simulator.Parcels.Dictionary[parcel.LocalID] = parcel;

                    bool set = false;
                    int y, x, index, bit;
                    for (y = 0; y < 64; y++)
                    {
                        for (x = 0; x < 64; x++)
                        {
                            index = (y * 64) + x;
                            bit = index % 8;
                            index >>= 3;

                            if ((parcel.Bitmap[index] & (1 << bit)) != 0)
                            {
                                simulator.ParcelMap[y, x] = parcel.LocalID;
                                set = true;
                            }
                        }
                    }

                    if (!set)
                    {
                        Logger.Log("Received a parcel with a bitmap that did not map to any locations",
                            Helpers.LogLevel.Warning);
                    }
                }

                if (sequenceID.Equals(int.MaxValue) && WaitForSimParcel != null)
                    WaitForSimParcel.Set();

                // auto request acl, will be stored in parcel tracking dictionary if enabled
                if (Client.Settings.ALWAYS_REQUEST_PARCEL_ACL)
                    Client.Parcels.RequestParcelAccessList(simulator, parcel.LocalID,
                        AccessList.Both, sequenceID);

                // auto request dwell, will be stored in parcel tracking dictionary if enables
                if (Client.Settings.ALWAYS_REQUEST_PARCEL_DWELL)
                    Client.Parcels.RequestDwell(simulator, parcel.LocalID);

                // Fire the callback for parcel properties being received
                if (m_ParcelProperties != null)
                {
                    OnParcelProperties(new ParcelPropertiesEventArgs(simulator, parcel, result, selectedPrims, sequenceID, snapSelection));                    
                }

                // Check if all of the simulator parcels have been retrieved, if so fire another callback
                if (simulator.IsParcelMapFull() && m_SimParcelsDownloaded != null)
                {
                    OnSimParcelsDownloaded(new SimParcelsDownloadedEventArgs(simulator, simulator.Parcels, simulator.ParcelMap));
                }
            }
        }
        private static void SerializeParcel(Parcel parcel, UUID globalID, string filename)
        {
            StringWriter sw = new StringWriter();
            XmlTextWriter xtw = new XmlTextWriter(sw) { Formatting = Formatting.Indented };

            xtw.WriteStartDocument();
            xtw.WriteStartElement("LandData");

            xtw.WriteElementString("Area", Convert.ToString(parcel.Area));
            xtw.WriteElementString("AuctionID", Convert.ToString(parcel.AuctionID));
            xtw.WriteElementString("AuthBuyerID", parcel.AuthBuyerID.ToString());
            xtw.WriteElementString("Category", Convert.ToString((sbyte)parcel.Category));
            TimeSpan t = parcel.ClaimDate.ToUniversalTime() - Utils.Epoch;
            xtw.WriteElementString("ClaimDate", Convert.ToString((int)t.TotalSeconds));
            xtw.WriteElementString("ClaimPrice", Convert.ToString(parcel.ClaimPrice));
            xtw.WriteElementString("GlobalID", globalID.ToString());
            xtw.WriteElementString("GroupID", parcel.GroupID.ToString());
            xtw.WriteElementString("IsGroupOwned", Convert.ToString(parcel.IsGroupOwned));
            xtw.WriteElementString("Bitmap", Convert.ToBase64String(parcel.Bitmap));
            xtw.WriteElementString("Description", parcel.Desc);
            xtw.WriteElementString("Flags", Convert.ToString((uint)parcel.Flags));
            xtw.WriteElementString("LandingType", Convert.ToString((byte)parcel.Landing));
            xtw.WriteElementString("Name", parcel.Name);
            xtw.WriteElementString("Status", Convert.ToString((sbyte)parcel.Status));
            xtw.WriteElementString("LocalID", parcel.LocalID.ToString());
            xtw.WriteElementString("MediaAutoScale", Convert.ToString(parcel.Media.MediaAutoScale ? 1 : 0));
            xtw.WriteElementString("MediaID", parcel.Media.MediaID.ToString());
            xtw.WriteElementString("MediaURL", parcel.Media.MediaURL);
            xtw.WriteElementString("MusicURL", parcel.MusicURL);
            xtw.WriteElementString("OwnerID", parcel.OwnerID.ToString());

            xtw.WriteStartElement("ParcelAccessList");
            foreach (ParcelManager.ParcelAccessEntry pal in parcel.AccessBlackList)
            {
                xtw.WriteStartElement("ParcelAccessEntry");
                xtw.WriteElementString("AgentID", pal.AgentID.ToString());
                xtw.WriteElementString("Time", pal.Time.ToString("s"));
                xtw.WriteElementString("AccessList", Convert.ToString((uint)pal.Flags));
                xtw.WriteEndElement();
            }
            foreach (ParcelManager.ParcelAccessEntry pal in parcel.AccessWhiteList)
            {
                xtw.WriteStartElement("ParcelAccessEntry");
                xtw.WriteElementString("AgentID", pal.AgentID.ToString());
                xtw.WriteElementString("Time", pal.Time.ToString("s"));
                xtw.WriteElementString("AccessList", Convert.ToString((uint)pal.Flags));
                xtw.WriteEndElement();
            }
            xtw.WriteEndElement();

            xtw.WriteElementString("PassHours", Convert.ToString(parcel.PassHours));
            xtw.WriteElementString("PassPrice", Convert.ToString(parcel.PassPrice));
            xtw.WriteElementString("SalePrice", Convert.ToString(parcel.SalePrice));
            xtw.WriteElementString("SnapshotID", parcel.SnapshotID.ToString());
            xtw.WriteElementString("UserLocation", parcel.UserLocation.ToString());
            xtw.WriteElementString("UserLookAt", parcel.UserLookAt.ToString());
            xtw.WriteElementString("Dwell", "0");
            xtw.WriteElementString("OtherCleanTime", Convert.ToString(parcel.OtherCleanTime));

            xtw.WriteEndElement();

            xtw.Close();
            sw.Close();
            File.WriteAllText(filename, sw.ToString());
        }
Example #5
0
        private void Parcels_OnParcelProperties(Parcel parcel, ParcelManager.ParcelResult result, int sequenceID,
            bool snapSelection)
        {
            // Check if this is for a simulator we're concerned with
            if (!active_sims.Contains(parcel.Simulator)) return;

            // Warn about parcel property request errors and bail out
            if (result == ParcelManager.ParcelResult.NoData)
            {
                Logger.Log("ParcelDownloader received a NoData response, sequenceID " + sequenceID,
                    Helpers.LogLevel.Warning, Client);
                return;
            }

            // Warn about unexpected data and bail out
            if (!ParcelMarked.ContainsKey(parcel.Simulator))
            {
                Logger.Log("ParcelDownloader received unexpected parcel data for " + parcel.Simulator,
                    Helpers.LogLevel.Warning, Client);
                return;
            }

            int x, y, index, bit;
            int[,] markers = ParcelMarked[parcel.Simulator];

            // Add this parcel to the dictionary of LocalID -> Parcel mappings
            lock (Parcels[parcel.Simulator])
                if (!Parcels[parcel.Simulator].ContainsKey(parcel.LocalID))
                    Parcels[parcel.Simulator][parcel.LocalID] = parcel;

            // Request the access list for this parcel
            Client.Parcels.AccessListRequest(parcel.Simulator, parcel.LocalID, 
                ParcelManager.AccessList.Both, 0);

            // Mark this area as downloaded
            for (y = 0; y < 64; y++)
            {
                for (x = 0; x < 64; x++)
                {
                    if (markers[y, x] == 0)
                    {
                        index = (y * 64) + x;
                        bit = index % 8;
                        index >>= 3;

                        if ((parcel.Bitmap[index] & (1 << bit)) != 0)
                            markers[y, x] = parcel.LocalID;
                    }
                }
            }

            // Request parcel information for the next missing area
            for (y = 0; y < 64; y++)
            {
                for (x = 0; x < 64; x++)
                {
                    if (markers[y, x] == 0)
                    {
                        Client.Parcels.PropertiesRequest(parcel.Simulator,
                                                         (y + 1) * 4.0f, (x + 1) * 4.0f,
                                                         y * 4.0f, x * 4.0f, 0, false);

                        return;
                    }
                }
            }

            // If we get here, there are no more zeroes in the markers map
            lock (active_sims)
            {
                active_sims.Remove(parcel.Simulator);

                if (OnParcelsDownloaded != null)
                {
                    // This map is complete, fire callback
                    try { OnParcelsDownloaded(parcel.Simulator, Parcels[parcel.Simulator], markers); }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                }
            }
        }
Example #6
0
        /// <summary>
        /// Parcel Properties reply handler for data that comes in over udp (deprecated)
        /// </summary>
        /// <param name="packet"></param>
        /// <param name="simulator"></param>
        private void ParcelPropertiesHandler(Packet packet, Simulator simulator)
        {
            if (OnParcelProperties != null || Client.Settings.PARCEL_TRACKING == true)
            {
                ParcelPropertiesPacket properties = (ParcelPropertiesPacket)packet;

                Parcel parcel = new Parcel(simulator, properties.ParcelData.LocalID);

                parcel.AABBMax = properties.ParcelData.AABBMax;
                parcel.AABBMin = properties.ParcelData.AABBMin;
                parcel.Area = properties.ParcelData.Area;
                parcel.AuctionID = properties.ParcelData.AuctionID;
                parcel.AuthBuyerID = properties.ParcelData.AuthBuyerID;
                parcel.Bitmap = properties.ParcelData.Bitmap;
                parcel.Category = (Parcel.ParcelCategory)(sbyte)properties.ParcelData.Category;
                parcel.ClaimDate = Helpers.UnixTimeToDateTime((uint)properties.ParcelData.ClaimDate);
                // ClaimPrice seems to always be zero?
                parcel.ClaimPrice = properties.ParcelData.ClaimPrice;
                parcel.Desc = Helpers.FieldToUTF8String(properties.ParcelData.Desc);
                parcel.GroupID = properties.ParcelData.GroupID;
                parcel.GroupPrims = properties.ParcelData.GroupPrims;
                parcel.IsGroupOwned = properties.ParcelData.IsGroupOwned;
                parcel.LandingType = properties.ParcelData.LandingType;
                parcel.MaxPrims = properties.ParcelData.MaxPrims;
                parcel.Media.MediaAutoScale = properties.ParcelData.MediaAutoScale;
                parcel.Media.MediaID = properties.ParcelData.MediaID;
                parcel.Media.MediaURL = Helpers.FieldToUTF8String(properties.ParcelData.MediaURL);
                parcel.MusicURL = Helpers.FieldToUTF8String(properties.ParcelData.MusicURL);
                parcel.Name = Helpers.FieldToUTF8String(properties.ParcelData.Name);
                parcel.OtherCleanTime = properties.ParcelData.OtherCleanTime;
                parcel.OtherCount = properties.ParcelData.OtherCount;
                parcel.OtherPrims = properties.ParcelData.OtherPrims;
                parcel.OwnerID = properties.ParcelData.OwnerID;
                parcel.OwnerPrims = properties.ParcelData.OwnerPrims;
                parcel.Flags = (Parcel.ParcelFlags)properties.ParcelData.ParcelFlags;
                parcel.ParcelPrimBonus = properties.ParcelData.ParcelPrimBonus;
                parcel.PassHours = properties.ParcelData.PassHours;
                parcel.PassPrice = properties.ParcelData.PassPrice;
                parcel.PublicCount = properties.ParcelData.PublicCount;
                parcel.RegionDenyAnonymous = properties.ParcelData.RegionDenyAnonymous;
                parcel.RegionPushOverride = properties.ParcelData.RegionPushOverride;
                parcel.RentPrice = properties.ParcelData.RentPrice;
                parcel.SalePrice = properties.ParcelData.SalePrice;
                parcel.SelectedPrims = properties.ParcelData.SelectedPrims;
                parcel.SelfCount = properties.ParcelData.SelfCount;
                parcel.SimWideMaxPrims = properties.ParcelData.SimWideMaxPrims;
                parcel.SimWideTotalPrims = properties.ParcelData.SimWideTotalPrims;
                parcel.SnapshotID = properties.ParcelData.SnapshotID;
                parcel.Status = (Parcel.ParcelStatus)(sbyte)properties.ParcelData.Status;
                parcel.TotalPrims = properties.ParcelData.TotalPrims;
                parcel.UserLocation = properties.ParcelData.UserLocation;
                parcel.UserLookAt = properties.ParcelData.UserLookAt;
                parcel.RegionDenyAgeUnverified = properties.AgeVerificationBlock.RegionDenyAgeUnverified;

                // store parcel in dictionary
                if (Client.Settings.PARCEL_TRACKING)
                {
                    lock (simulator.Parcels.Dictionary)
                        simulator.Parcels.Dictionary[parcel.LocalID] = parcel;

                    int y, x, index, bit;
                    for (y = 0; y < simulator.ParcelMap.GetLength(0); y++)
                    {
                        for (x = 0; x < simulator.ParcelMap.GetLength(1); x++)
                        {
                            if (simulator.ParcelMap[y, x] == 0)
                            {
                                index = (y * 64) + x;
                                bit = index % 8;
                                index >>= 3;

                                if ((parcel.Bitmap[index] & (1 << bit)) != 0)
                                    simulator.ParcelMap[y, x] = parcel.LocalID;
                            }
                        }
                    }
                }

                // auto request acl, will be stored in parcel tracking dictionary if enabled
                if (Client.Settings.ALWAYS_REQUEST_PARCEL_ACL)
                    Client.Parcels.AccessListRequest(simulator, properties.ParcelData.LocalID,
                        AccessList.Both, properties.ParcelData.SequenceID);

                // auto request dwell, will be stored in parcel tracking dictionary if enables
                if (Client.Settings.ALWAYS_REQUEST_PARCEL_DWELL)
                    Client.Parcels.DwellRequest(simulator, properties.ParcelData.LocalID);

                // Fire the callback for parcel properties being received
                if (OnParcelProperties != null)
                {
                    try
                    {
                        OnParcelProperties(parcel, (ParcelResult)properties.ParcelData.RequestResult,
                            properties.ParcelData.SequenceID, properties.ParcelData.SnapSelection);
                    }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                }

                // Check if all of the simulator parcels have been retrieved, if so fire another callback
                if (OnSimParcelsDownloaded != null && simulator.IsParcelMapFull())
                {
                    try { OnSimParcelsDownloaded(simulator, simulator.Parcels, simulator.ParcelMap); }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                }
            }
        }
Example #7
0
        /// <summary>
        /// ParcelProperties replies sent over CAPS
        /// </summary>
        /// <param name="capsKey">Not used (will always be ParcelProperties)</param>
        /// <param name="llsd">LLSD Structured data</param>
        /// <param name="simulator">Object representing simulator</param>
        private void ParcelPropertiesReplyHandler(string capsKey, LLSD llsd, Simulator simulator)
        {

            if (OnParcelProperties != null || Client.Settings.PARCEL_TRACKING == true)
            {

                LLSDMap map = (LLSDMap)llsd;
                LLSDMap parcelDataBlock = (LLSDMap)(((LLSDArray)map["ParcelData"])[0]);
                LLSDMap ageVerifyBlock = (LLSDMap)(((LLSDArray)map["AgeVerificationBlock"])[0]);
                LLSDMap mediaDataBlock = (LLSDMap)(((LLSDArray)map["MediaData"])[0]);

                Parcel parcel = new Parcel(simulator, parcelDataBlock["LocalID"].AsInteger());

                parcel.AABBMax.FromLLSD(parcelDataBlock["AABBMax"]);
                parcel.AABBMin.FromLLSD(parcelDataBlock["AABBMin"]);
                parcel.Area = parcelDataBlock["Area"].AsInteger();
                parcel.AuctionID = (uint)parcelDataBlock["AuctionID"].AsInteger();
                parcel.AuthBuyerID = parcelDataBlock["AuthBuyerID"].AsUUID();
                parcel.Bitmap = parcelDataBlock["Bitmap"].AsBinary();
                parcel.Category = (Parcel.ParcelCategory)parcelDataBlock["Category"].AsInteger();
                parcel.ClaimDate = Helpers.UnixTimeToDateTime((uint)parcelDataBlock["ClaimDate"].AsInteger());
                parcel.ClaimPrice = parcelDataBlock["ClaimPrice"].AsInteger();
                parcel.Desc = parcelDataBlock["Desc"].AsString();
                
                // TODO: this probably needs to happen when the packet is deserialized.
                byte[] bytes = parcelDataBlock["ParcelFlags"].AsBinary();
                if (BitConverter.IsLittleEndian)
                    Array.Reverse(bytes);
                parcel.Flags = (Parcel.ParcelFlags)BitConverter.ToUInt32(bytes, 0);
                parcel.GroupID = parcelDataBlock["GroupID"].AsUUID();
                parcel.GroupPrims = parcelDataBlock["GroupPrims"].AsInteger();
                parcel.IsGroupOwned = parcelDataBlock["IsGroupOwned"].AsBoolean();
                parcel.LandingType = (byte)parcelDataBlock["LandingType"].AsInteger();
                parcel.LocalID = parcelDataBlock["LocalID"].AsInteger();
                parcel.MaxPrims = parcelDataBlock["MaxPrims"].AsInteger();
                parcel.Media.MediaAutoScale = (byte)parcelDataBlock["MediaAutoScale"].AsInteger(); 
                parcel.Media.MediaID = parcelDataBlock["MediaID"].AsUUID();
                parcel.Media.MediaURL = parcelDataBlock["MediaURL"].AsString();
                parcel.MusicURL = parcelDataBlock["MusicURL"].AsString();
                parcel.Name = parcelDataBlock["Name"].AsString();
                parcel.OtherCleanTime = parcelDataBlock["OtherCleanTime"].AsInteger();
                parcel.OtherCount = parcelDataBlock["OtherCount"].AsInteger();
                parcel.OtherPrims = parcelDataBlock["OtherPrims"].AsInteger();
                parcel.OwnerID = parcelDataBlock["OwnerID"].AsUUID();
                parcel.OwnerPrims = parcelDataBlock["OwnerPrims"].AsInteger();
                parcel.ParcelPrimBonus = (float)parcelDataBlock["ParcelPrimBonus"].AsReal();
                parcel.PassHours = (float)parcelDataBlock["PassHours"].AsReal();
                parcel.PassPrice = parcelDataBlock["PassPrice"].AsInteger();
                parcel.PublicCount = parcelDataBlock["PublicCount"].AsInteger();
                parcel.RegionDenyAgeUnverified = ageVerifyBlock["RegionDenyAgeUnverified"].AsBoolean();
                parcel.RegionDenyAnonymous = parcelDataBlock["RegionDenyAnonymous"].AsBoolean();
                parcel.RegionPushOverride = parcelDataBlock["RegionPushOverride"].AsBoolean();
                parcel.RentPrice = parcelDataBlock["RentPrice"].AsInteger();
                parcel.RequestResult = parcelDataBlock["RequestResult"].AsInteger();
                parcel.SalePrice = parcelDataBlock["SalePrice"].AsInteger();
                parcel.SelectedPrims = parcelDataBlock["SelectedPrims"].AsInteger();
                parcel.SelfCount = parcelDataBlock["SelfCount"].AsInteger();
                parcel.SequenceID = parcelDataBlock["SequenceID"].AsInteger();
                parcel.Simulator = simulator;
                parcel.SimWideMaxPrims = parcelDataBlock["SimWideMaxPrims"].AsInteger();
                parcel.SimWideTotalPrims = parcelDataBlock["SimWideTotalPrims"].AsInteger();
                parcel.SnapSelection = parcelDataBlock["SnapSelection"].AsBoolean();
                parcel.SnapshotID = parcelDataBlock["SnapshotID"].AsUUID();
                parcel.Status = (Parcel.ParcelStatus)parcelDataBlock["Status"].AsInteger();
                parcel.TotalPrims = parcelDataBlock["TotalPrims"].AsInteger();
                parcel.UserLocation.FromLLSD(parcelDataBlock["UserLocation"]);
                parcel.UserLookAt.FromLLSD(parcelDataBlock["UserLookAt"]);
                parcel.Media.MediaDesc = mediaDataBlock["MediaDesc"].AsString();
                parcel.Media.MediaHeight = mediaDataBlock["MediaHeight"].AsInteger();
                parcel.Media.MediaWidth = mediaDataBlock["MediaWidth"].AsInteger();
                parcel.Media.MediaLoop = mediaDataBlock["MediaLoop"].AsBoolean();
                parcel.Media.MediaType = mediaDataBlock["MediaType"].AsString();
                parcel.ObscureMedia = mediaDataBlock["ObscureMedia"].AsBoolean();
                parcel.ObscureMusic = mediaDataBlock["ObscureMusic"].AsBoolean();

                if (Client.Settings.PARCEL_TRACKING)
                {
                    lock (simulator.Parcels.Dictionary)
                        simulator.Parcels.Dictionary[parcel.LocalID] = parcel;

                    int y, x, index, bit;
                    for (y = 0; y < simulator.ParcelMap.GetLength(0); y++)
                    {
                        for (x = 0; x < simulator.ParcelMap.GetLength(1); x++)
                        {
                            if (simulator.ParcelMap[y, x] == 0)
                            {
                                index = (y * 64) + x;
                                bit = index % 8;
                                index >>= 3;

                                if ((parcel.Bitmap[index] & (1 << bit)) != 0)
                                    simulator.ParcelMap[y, x] = parcel.LocalID;
                            }
                        }

                    }
                }

                // auto request acl, will be stored in parcel tracking dictionary if enabled
                if (Client.Settings.ALWAYS_REQUEST_PARCEL_ACL)
                    Client.Parcels.AccessListRequest(simulator, parcel.LocalID,
                        AccessList.Both, parcel.SequenceID);

                // auto request dwell, will be stored in parcel tracking dictionary if enables
                if (Client.Settings.ALWAYS_REQUEST_PARCEL_DWELL)
                    Client.Parcels.DwellRequest(simulator, parcel.LocalID);

                // Fire the callback for parcel properties being received
                if (OnParcelProperties != null)
                {
                    try
                    {
                        OnParcelProperties(parcel, (ParcelResult)parcel.RequestResult,
                          parcel.SequenceID, parcel.SnapSelection);
                    }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                }

                // Check if all of the simulator parcels have been retrieved, if so fire another callback
                if (OnSimParcelsDownloaded != null && simulator.IsParcelMapFull())
                {
                    try { OnSimParcelsDownloaded(simulator, simulator.Parcels, simulator.ParcelMap); }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                }
            }
        }
Example #8
0
        /// <summary>
        /// Search Places - All Options
        /// </summary>
        /// <param name="findFlags">One of the Values from the DirFindFlags struct, ie: AgentOwned, GroupOwned, etc.</param>
        /// <param name="searchCategory">One of the values from the SearchCategory Struct, ie: Any, Linden, Newcomer</param>
        /// <param name="searchText">String Text to search for</param>
        /// <param name="simulatorName">String Simulator Name to search in</param>
        /// <param name="groupID">LLUID of group you want to recieve results for</param>
        /// <param name="transactionID">Transaction (Query) ID which can be associated with results from your request.</param>
        /// <returns>Transaction (Query) ID which can be associated with results from your request.</returns>
        public Guid StartPlacesSearch(DirFindFlags findFlags, Parcel.ParcelCategory searchCategory, string searchText, string simulatorName, Guid groupID, Guid transactionID)
        {
            PlacesQueryPacket find = new PlacesQueryPacket();
            find.AgentData.AgentID = Client.Self.AgentID;
            find.AgentData.SessionID = Client.Self.SessionID;
            find.AgentData.QueryID = groupID;

            find.TransactionData.TransactionID = transactionID;

            find.QueryData.QueryText = Utils.StringToBytes(searchText);
            find.QueryData.QueryFlags = (uint)findFlags;
            find.QueryData.Category = (sbyte)searchCategory;
            find.QueryData.SimName = Utils.StringToBytes(simulatorName);
            
            Client.Network.SendPacket(find);
            return transactionID;
        }
Example #9
0
 /// <summary>
 ///  Search Places 
 /// </summary>
 /// <param name="findFlags">One of the Values from the DirFindFlags struct, ie: AgentOwned, GroupOwned, etc.</param>
 /// <param name="searchCategory">One of the values from the SearchCategory Struct, ie: Any, Linden, Newcomer</param>
 /// <param name="groupID">LLUID of group you want to recieve results for</param>
 /// <param name="transactionID">Transaction (Query) ID which can be associated with results from your request.</param>
 /// <returns>Transaction (Query) ID which can be associated with results from your request.</returns>
 public Guid StartPlacesSearch(DirFindFlags findFlags, Parcel.ParcelCategory searchCategory, Guid groupID, Guid transactionID)
 {
     return StartPlacesSearch(findFlags, searchCategory, String.Empty, String.Empty, groupID, transactionID);
 }
Example #10
0
        private void UpdateLand(Parcel parceln)
        {
            if (!netcom.IsLoggedIn)
                return;

            if (InvokeRequired)
            {
                BeginInvoke(new MethodInvoker(delegate()
                {
                    UpdateLand(parceln);
                }));

                return;
            }

            try
            {
                //if (parceln == null) return;

                //if (currentparcelid != 0)
                //{
                //    if (currentparcelid != parceln.LocalID)
                //    {
                //        currentparcelid = parceln.LocalID;
                //        this.parcel = parceln;
                //    }
                //}
                //else
                //{
                //    currentparcelid = parceln.LocalID;
                //    this.parcel = parceln;
                //}

                //currentparcelid = parceln.LocalID;
                this.parcel = parceln;

                //List<Simulator> connectedsims = client.Network.Simulators;

                this.instance.Config.CurrentConfig.pURL = @parcel.MusicURL;
                tlblParcel.Text = parcel.Name.ToString();

               // client.Parcels.RequestDwell(client.Network.CurrentSim, parcel.LocalID);

                List<UUID> avIDs = new List<UUID>();
                avIDs.Add(parcel.OwnerID);
                avIDs.Add(parcel.GroupID);

                client.Avatars.UUIDNameReply += new EventHandler<UUIDNameReplyEventArgs>(Avatars_OnAvatarNames);
                client.Avatars.RequestAvatarNames(avIDs);

                tb1.Visible = false;
                tb2.Visible = false;
                tb3.Visible = false;
                tb4.Visible = false;
                tb5.Visible = false;
                tb6.Visible = false;
                tb7.Visible = false;

                //set them to false incase of parcel change
                Aboutlandforsale = false;
                AboutlandAllowFly = false;
                AboutlandCreateObj = false;
                AllowOtherScripts = false;
                AboutlandRestrictPush = false;
                AboutlandAllowDamage = false;
                AboutAllowGroupObjectEntry = false;
                AboutAllowAllObjectEntry = false;
                AboutlandGroupCreateObj = false;
                AllowGroupScripts = false;
                Allowcreatelm = false;
                AllowTerraform = false;
                AboutShow = false;
                AboutMature = false;

                // update some things so we have public access in About Land dialog
                // TODO: This is good work but it should be at app level i.e. METAboltIntance.cs and not here. Luke

                if ((parcel.Flags & ParcelFlags.AllowFly) != ParcelFlags.AllowFly)
                {
                    tb1.Visible = true;
                    AboutlandAllowFly = true;
                }
                if ((parcel.Flags & ParcelFlags.CreateObjects) != ParcelFlags.CreateObjects)
                {
                    tb2.Visible = true;
                    AboutlandCreateObj = true;
                }
                if ((parcel.Flags & ParcelFlags.CreateGroupObjects) != ParcelFlags.CreateGroupObjects)
                {
                    AboutlandGroupCreateObj = true;
                }
                if ((parcel.Flags & ParcelFlags.AllowOtherScripts) != ParcelFlags.AllowOtherScripts)
                {
                    tb3.Visible = true;
                    AllowOtherScripts = true;
                }
                if ((parcel.Flags & ParcelFlags.AllowGroupScripts) != ParcelFlags.AllowGroupScripts)
                {
                    AllowGroupScripts = true;
                }
                if ((parcel.Flags & ParcelFlags.RestrictPushObject) == ParcelFlags.RestrictPushObject)
                {
                    tb4.Visible = true;
                    AboutlandRestrictPush = true;
                }
                if ((parcel.Flags & ParcelFlags.ShowDirectory) == ParcelFlags.ShowDirectory)
                {
                    AboutShow = true;
                }
                if ((parcel.Flags & ParcelFlags.MaturePublish) == ParcelFlags.MaturePublish)
                {
                    AboutMature = true;
                }
                if ((parcel.Flags & ParcelFlags.AllowDamage) != ParcelFlags.AllowDamage)
                {
                    tb5.Visible = true;
                    AboutlandAllowDamage = true;
                }
                if ((parcel.Flags & ParcelFlags.ForSale) == ParcelFlags.ForSale)
                {
                    tb6.Visible = true;
                    Aboutlandforsale = true;
                }
                if ((parcel.Flags & ParcelFlags.AllowAPrimitiveEntry) == ParcelFlags.AllowAPrimitiveEntry)
                {
                    AboutAllowAllObjectEntry = true;
                }
                if ((parcel.Flags & ParcelFlags.AllowGroupObjectEntry) == ParcelFlags.AllowGroupObjectEntry)
                {
                    AboutAllowGroupObjectEntry = true;
                }
                if ((parcel.Flags & ParcelFlags.AllowLandmark) == ParcelFlags.AllowLandmark)
                {
                    Allowcreatelm = true;
                }
                if ((parcel.Flags & ParcelFlags.AllowTerraform) == ParcelFlags.AllowTerraform)
                {
                    AllowTerraform = true;
                }
                if ((parcel.Flags & ParcelFlags.AllowVoiceChat) != ParcelFlags.AllowVoiceChat)
                {
                    tb7.Visible = true;
                    instance.AllowVoice = false;
                }
                else
                {
                    instance.AllowVoice = true;
                }

                // Log tp/lm location into history
                DateTime timestamp = DateTime.Now;

                timestamp = this.instance.State.GetTimeStamp(timestamp);

                string strInfo = string.Format(CultureInfo.CurrentCulture, "{0}/{1}/{2}/{3}", client.Network.CurrentSim.Name,
                                                                            Math.Round(instance.SIMsittingPos().X, 0),
                                                                            Math.Round(instance.SIMsittingPos().Y, 0),
                                                                            Math.Round(instance.SIMsittingPos().Z, 0));
                strInfo = "http://slurl.com/secondlife/" + strInfo;

                if (strInfolast == strInfo) return;

                strInfolast = strInfo;

                try
                {
                    DataRow dr = instance.TP.NewRow();
                    dr["time"] = timestamp.ToString();
                    dr["name"] = this.parcel.Name;
                    dr["slurl"] = strInfo;
                    instance.TP.Rows.Add(dr);
                }
                catch
                {
                    ;
                }
            }
            catch (Exception ex)
            {
                string serr = ex.Message;
                Logger.Log(String.Format(CultureInfo.CurrentCulture, "Land properties (main form) {0}", serr), Helpers.LogLevel.Error);
                //reporter.Show(ex);
            }
        }
Example #11
0
        public static string Serialize(Parcel landData)
        {
            StringWriter sw = new StringWriter();
            XmlTextWriter xtw = new XmlTextWriter(sw);
            xtw.Formatting = Formatting.Indented;

            xtw.WriteStartDocument();
            xtw.WriteStartElement("LandData");

            xtw.WriteElementString("Area", Convert.ToString(landData.Area));
            xtw.WriteElementString("AuctionID", Convert.ToString(landData.AuctionID));
            xtw.WriteElementString("AuthBuyerID", landData.AuthBuyerID.ToString());
            xtw.WriteElementString("Category", Convert.ToString((sbyte)landData.Category));
            xtw.WriteElementString("ClaimDate", Convert.ToString(landData.ClaimDate));
            xtw.WriteElementString("ClaimPrice", Convert.ToString(landData.ClaimPrice));
            xtw.WriteElementString("GlobalID", landData.GlobalID.ToString());
            xtw.WriteElementString("GroupID", landData.GroupID.ToString());
            xtw.WriteElementString("IsGroupOwned", Convert.ToString(landData.IsGroupOwned));
            xtw.WriteElementString("Bitmap", Convert.ToBase64String(landData.Bitmap));
            xtw.WriteElementString("Description", landData.Desc);
            xtw.WriteElementString("Flags", Convert.ToString((uint)landData.Flags));
            xtw.WriteElementString("LandingType", Convert.ToString((byte)landData.Landing));
            xtw.WriteElementString("Name", landData.Name);
            xtw.WriteElementString("Status", Convert.ToString((sbyte)landData.Status));
            xtw.WriteElementString("LocalID", landData.LocalID.ToString());
            var Media = landData.Media;
            xtw.WriteElementString("MediaAutoScale", Convert.ToString(Media.MediaAutoScale));
            xtw.WriteElementString("MediaID", Media.MediaID.ToString());
            xtw.WriteElementString("MediaURL", Media.MediaURL);
            xtw.WriteElementString("MusicURL", landData.MusicURL);
            xtw.WriteElementString("OwnerID", landData.OwnerID.ToString());

            xtw.WriteStartElement("ParcelAccessList");
            foreach (var pal in landData.AccessWhiteList)
            {
                xtw.WriteStartElement("ParcelAccessEntry");
                xtw.WriteElementString("AgentID", pal.AgentID.ToString());
                xtw.WriteElementString("Time", pal.Time.ToString());
                xtw.WriteElementString("AccessList", Convert.ToString((uint)pal.Flags));
                xtw.WriteEndElement();
            }
            foreach (var pal in landData.AccessBlackList)
            {
                xtw.WriteStartElement("ParcelAccessEntry");
                xtw.WriteElementString("AgentID", pal.AgentID.ToString());
                xtw.WriteElementString("Time", pal.Time.ToString());
                xtw.WriteElementString("AccessList", Convert.ToString((uint)pal.Flags));
                xtw.WriteEndElement();
            }
            xtw.WriteEndElement();

            xtw.WriteElementString("PassHours", Convert.ToString(landData.PassHours));
            xtw.WriteElementString("PassPrice", Convert.ToString(landData.PassPrice));
            xtw.WriteElementString("SalePrice", Convert.ToString(landData.SalePrice));
            xtw.WriteElementString("SnapshotID", landData.SnapshotID.ToString());
            xtw.WriteElementString("UserLocation", landData.UserLocation.ToString());
            xtw.WriteElementString("UserLookAt", landData.UserLookAt.ToString());
            //todo xtw.WriteElementString("Dwell", landData.info.Dwell.ToString());
            xtw.WriteElementString("Dwell", 0.ToString());
            xtw.WriteElementString("OtherCleanTime", Convert.ToString(landData.OtherCleanTime));

            xtw.WriteEndElement();

            xtw.Close();
            sw.Close();

            return sw.ToString();
        }
Example #12
0
 private void Parcels_OnParcelProperties(Simulator simulator, Parcel parcel, ParcelResult result, int selectedPrims, int sequenceID, bool snapSelection)
 {
     string pcl = parcel.Name;
     //this.parcel = parcel;
     //BeginInvoke(new MethodInvoker(UpdateLand));
 }
Example #13
0
 public void Parcels_OnParcelProperties(Simulator simulator, Parcel parcel, ParcelResult result, int selectedPrims, int sequenceID, bool snapSelection)
 {
     lock (parcels)
     {
         if (parcels.ContainsKey(parcel.LocalID)) return;
         parcels[parcel.LocalID] = parcel;
     }
     simulator.Client.Parcels.RequestSelectObjects(parcel.LocalID, (ObjectReturnType)31, parcel.OwnerID);
     //ParcelSelectObjects(simulator, parcel.LocalID, parcel.OwnerID);
     //SimRegion r = SimRegion.GetRegion(simulator);
     //r.Parcels_OnParcelProperties(simulator, parcel, result, selectedPrims, sequenceID, snapSelection);
 }
Example #14
0
 bool ParcelAllowsEntry(Parcel P, UUID uUID)
 {
     // assume all parcels do
     if (P == null) return true;
     if ((P.Flags & ParcelFlags.UseAccessList) != 0)
     {
         foreach (var af in P.AccessWhiteList)
         {
             if (af.AgentID == uUID)
             {
                 return true;
             }
         }
         return false;
     }
     if ((P.Flags & ParcelFlags.UseAccessGroup) != 0)
     {
         UUID G = P.GroupID;
         if (G == UUID.Zero) return true;
         GroupPowers gp =  TheWorldSystem.GetGroupPowers(uUID, G);
         Client.Groups.RequestCurrentGroups();
         return false;
     }
     if ((P.Flags & ParcelFlags.UseBanList) != 0)
     {
         foreach (var af in P.AccessBlackList)
         {
             if (af.AgentID == uUID)
             {
                 return false;
             }
         }                
         return true;
     }
     return true;
 }
 public RegionParcel(Parcel p)
 {
     name = p.Name;
     description = p.Desc;
     group_uuid = p.GroupID;
     owner_uuid = p.OwnerID;
 }