IsParcelMapFull() public method

Checks simulator parcel map to make sure it has downloaded all data successfully
public IsParcelMapFull ( ) : bool
return bool
Beispiel #1
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); }
                }
            }
        }
Beispiel #2
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));
                }
            }
        }
Beispiel #3
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); }
                }
            }
        }