Esempio n. 1
0
        /// <summary>
        ///     Make a new copy of the land data
        /// </summary>
        /// <returns></returns>
        public LandData Copy()
        {
            LandData landData = new LandData();

            landData._AABBMax          = _AABBMax;
            landData._AABBMin          = _AABBMin;
            landData._area             = _area;
            landData._auctionID        = _auctionID;
            landData._authBuyerID      = _authBuyerID;
            landData._category         = _category;
            landData._claimDate        = _claimDate;
            landData._claimPrice       = _claimPrice;
            landData._globalID         = _globalID;
            landData._groupID          = _groupID;
            landData._groupPrims       = _groupPrims;
            landData._otherPrims       = _otherPrims;
            landData._ownerPrims       = _ownerPrims;
            landData._selectedPrims    = _selectedPrims;
            landData._isGroupOwned     = _isGroupOwned;
            landData._localID          = _localID;
            landData._landingType      = _landingType;
            landData._mediaAutoScale   = _mediaAutoScale;
            landData._mediaID          = _mediaID;
            landData._mediaURL         = _mediaURL;
            landData._musicURL         = _musicURL;
            landData._ownerID          = _ownerID;
            landData._bitmap           = (byte[])_bitmap.Clone();
            landData._description      = _description;
            landData._flags            = _flags;
            landData._name             = _name;
            landData._status           = _status;
            landData._passHours        = _passHours;
            landData._passPrice        = _passPrice;
            landData._salePrice        = _salePrice;
            landData._snapshotID       = _snapshotID;
            landData._userLocation     = _userLocation;
            landData._userLookAt       = _userLookAt;
            landData._otherCleanTime   = _otherCleanTime;
            landData._mediaType        = _mediaType;
            landData._mediaDescription = _mediaDescription;
            landData._mediaWidth       = _mediaWidth;
            landData._mediaHeight      = _mediaHeight;
            landData._mediaLoop        = _mediaLoop;
            landData._obscureMusic     = _obscureMusic;
            landData._obscureMedia     = _obscureMedia;

            landData._parcelAccessList.Clear();

            foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList)
            {
                ParcelManager.ParcelAccessEntry newEntry = new ParcelManager.ParcelAccessEntry();
                newEntry.AgentID = entry.AgentID;
                newEntry.Flags   = entry.Flags;
                newEntry.Time    = entry.Time;

                landData._parcelAccessList.Add(newEntry);
            }

            return(landData);
        }
Esempio n. 2
0
        public DateTime llAddToLandBanList(string avatar, double hours)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return(DateTime.Now);
            }

            IParcelManagementModule parcelManagement = World.RequestModuleInterface <IParcelManagementModule>();

            if (parcelManagement != null)
            {
                LandData land =
                    parcelManagement.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData;
                if (land.OwnerID == m_host.OwnerID)
                {
                    ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
                    UUID key;
                    if (UUID.TryParse(avatar, out key))
                    {
                        entry.AgentID = key;
                        entry.Flags   = AccessList.Ban;
                        entry.Time    = DateTime.Now.AddHours(hours);
                        land.ParcelAccessList.Add(entry);
                    }
                }
            }
            return(PScriptSleep(m_sleepMsOnAddToLandBanList));
        }
Esempio n. 3
0
        public bool IsBannedFromLand(UUID avatar)
        {
            if (m_scene.Permissions.IsAdministrator(avatar))
            {
                return(false);
            }

            if (LandData.ParcelAccessList.Count > 0)
            {
                ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry
                {
                    AgentID = avatar, Flags = AccessList.Ban
                };
                entry = LandData.ParcelAccessList.Find(delegate(ParcelManager.ParcelAccessEntry pae)
                {
                    if (entry.AgentID == pae.AgentID &&
                        entry.Flags == pae.Flags)
                    {
                        return(true);
                    }
                    return(false);
                });

                //See if they are on the list, but make sure the owner isn't banned
                if (entry.AgentID == avatar && LandData.OwnerID != avatar)
                {
                    //They are banned, so lets send them a notice about this parcel
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 4
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (lvwBlackList.SelectedItems.Count > 0)
            {
                try
                {
                    //ParcelManager.ParcelAccessEntry p1 = new ParcelManager.ParcelAccessEntry();
                    //p1.AgentID = (UUID)lvwBlackList.SelectedItems[0].Tag;
                    //p1.Flags = AccessList.Ban;

                    ParcelManager.ParcelAccessEntry person = new ParcelManager.ParcelAccessEntry();

                    person = (ParcelManager.ParcelAccessEntry)lvwBlackList.SelectedItems[0].Tag;
                    //person.Flags = AccessList.Access;

                    blacklist.Remove(person);
                    parcel.AccessBlackList = blacklist;
                    parcel.AccessBlackList.Remove(person);
                    this.parcel.Update(client.Network.CurrentSim, false);

                    client.Parcels.RequestParcelAccessList(client.Network.CurrentSim, parcel.LocalID, AccessList.Ban, 1);

                    button2.Enabled = false;
                }
                catch {; }
            }
        }
Esempio n. 5
0
        private void lvwBlackList_DoubleClick(object sender, EventArgs e)
        {
            if (lvwBlackList.SelectedItems.Count > 0)
            {
                ParcelManager.ParcelAccessEntry person = (ParcelManager.ParcelAccessEntry)lvwBlackList.SelectedItems[0].Tag;

                (new frmProfile(instance, lvwBlackList.SelectedItems[0].Text, person.AgentID)).Show();
            }
        }
 /// <summary>
 ///   Builds the landaccess data from a data record.
 /// </summary>
 /// <param name = "row">datarecord with landaccess data</param>
 /// <returns></returns>
 private static ParcelManager.ParcelAccessEntry BuildLandAccessData(IDataRecord row)
 {
     ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry
     {
         AgentID = new UUID((Guid)row["AccessUUID"]),
         Flags   = (AccessList)Convert.ToInt32(row["Flags"]),
         Time    = new DateTime()
     };
     return(entry);
 }
Esempio n. 7
0
        public void UpdateAccessList(uint flags, UUID transactionID,
                                     int sequenceID, int sections,
                                     List <ParcelManager.ParcelAccessEntry> entries,
                                     IClientAPI remote_client)
        {
            LandData newData = LandData.Copy();

            if ((!m_listTransactions.ContainsKey(flags)) ||
                m_listTransactions[flags] != transactionID)
            {
                m_listTransactions[flags] = transactionID;

                List <ParcelManager.ParcelAccessEntry> toRemove =
                    new List <ParcelManager.ParcelAccessEntry>();

                foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList)
                {
                    if (entry.Flags == (AccessList)flags)
                    {
                        toRemove.Add(entry);
                    }
                }

                foreach (ParcelManager.ParcelAccessEntry entry in toRemove)
                {
                    newData.ParcelAccessList.Remove(entry);
                }

                // Checked here because this will always be the first
                // and only packet in a transaction
                if (entries.Count == 1 && entries[0].AgentID == UUID.Zero)
                {
                    m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);

                    return;
                }
            }

            foreach (ParcelManager.ParcelAccessEntry entry in entries)
            {
                ParcelManager.ParcelAccessEntry temp =
                    new ParcelManager.ParcelAccessEntry();

                temp.AgentID = entry.AgentID;
                temp.Time    = entry.Time;
                temp.Flags   = (AccessList)flags;

                newData.ParcelAccessList.Add(temp);
            }

            m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
        }
Esempio n. 8
0
        /// <summary>
        /// Rebuild the access list from the database
        /// </summary>
        /// <param name="LandData"></param>
        private void BuildParcelAccessList(LandData LandData)
        {
            List <string> Query = GD.Query("ParcelID", LandData.GlobalID, "parcelaccess", "AccessID, Flags, Time");

            ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
            for (int i = 0; i < Query.Count; i += 3)
            {
                entry.AgentID = UUID.Parse(Query[i]);
                entry.Flags   = (AccessList)int.Parse(Query[i + 1]);
                entry.Time    = new DateTime(long.Parse(Query[i + 2]));
                LandData.ParcelAccessList.Add(entry);
                entry = new ParcelManager.ParcelAccessEntry();
            }
        }
Esempio n. 9
0
 public bool isRestrictedFromLand(UUID avatar)
 {
     if ((landData.Flags & (uint)Parcel.ParcelFlags.UseAccessList) > 0)
     {
         ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
         entry.AgentID = avatar;
         entry.Flags   = AccessList.Access;
         entry.Time    = new DateTime();
         if (!landData.ParcelAccessList.Contains(entry))
         {
             //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel
             return(true);
         }
     }
     return(false);
 }
Esempio n. 10
0
 public bool IsBannedFromLand(UUID avatar)
 {
     if ((LandData.Flags & (uint)ParcelFlags.UseBanList) > 0)
     {
         ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
         entry.AgentID = avatar;
         entry.Flags   = AccessList.Ban;
         entry.Time    = new DateTime();
         //See if they are on the list, but make sure the owner isn't banned
         if (LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar)
         {
             //They are banned, so lets send them a notice about this parcel
             return(true);
         }
     }
     return(false);
 }
Esempio n. 11
0
        /// <summary>
        /// The client wants to buy a pass for a parcel
        /// </summary>
        /// <param name="client"></param>
        /// <param name="fromID"></param>
        /// <param name="parcelLocalId"></param>
        private void ClientOnParcelBuyPass(IClientAPI client, UUID fromID, int parcelLocalId)
        {
            MainConsole.Instance.InfoFormat("[StarDustCurrency]: ClientOnParcelBuyPass {0}, {1}, {2}", client.Name, fromID,
                                            parcelLocalId);
            IScenePresence          agentSp          = Scene.GetScenePresence(client.AgentId);
            IParcelManagementModule parcelManagement = agentSp.Scene.RequestModuleInterface <IParcelManagementModule>();
            ILandObject             landParcel       = null;
            List <ILandObject>      land             = parcelManagement.AllParcels();

            foreach (ILandObject landObject in land)
            {
                if (landObject.LandData.LocalID == parcelLocalId)
                {
                    landParcel = landObject;
                }
            }
            if (landParcel != null)
            {
                MainConsole.Instance.Debug("[StarDustCurrency]: Base account: " + landParcel.LandData.OwnerID + " Agent ID: " + fromID +
                                           " Price:" +
                                           landParcel.LandData.PassPrice);
                bool giveResult = m_connector.UserCurrencyTransfer(landParcel.LandData.OwnerID, fromID, UUID.Zero, UUID.Zero,
                                                                   (uint)landParcel.LandData.PassPrice, "Parcel Pass",
                                                                   TransactionType.LandPassSale, UUID.Random());
                if (giveResult)
                {
                    ParcelManager.ParcelAccessEntry entry
                        = new ParcelManager.ParcelAccessEntry
                        {
                        AgentID = fromID,
                        Flags   = AccessList.Access,
                        Time    = DateTime.Now.AddHours(landParcel.LandData.PassHours)
                        };
                    landParcel.LandData.ParcelAccessList.Add(entry);
                    agentSp.ControllingClient.SendAgentAlertMessage("You have been added to the parcel access list.",
                                                                    false);
                }
            }
            else
            {
                MainConsole.Instance.ErrorFormat("[StarDustCurrency]: No parcel found for parcel id {0}", parcelLocalId);
                agentSp.ControllingClient.SendAgentAlertMessage("Opps, the internet blew up! Unable to find parcel.", false);
            }
        }
Esempio n. 12
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (lvwBlackList.Items.Count > 0)   // && lstMembers2.Columns[0].ToString != "none")
            {
                Stream tstream;
                saveFileDialog1.Filter           = "CSV files (*.csv)|*.csv|All files (*.*)|*.*";
                saveFileDialog1.FilterIndex      = 1;
                saveFileDialog1.RestoreDirectory = true;

                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        if ((tstream = saveFileDialog1.OpenFile()) != null)
                        {
                            StreamWriter SW = new StreamWriter(tstream);

                            string parcelname = client.Network.CurrentSim.ToString() + "/" + txtParcelname.Text.Replace(",", " ");

                            SW.WriteLine("Land: " + parcelname + ",List Type: Blacklist,Ttl avatars: " + lvwBlackList.Items.Count.ToString(CultureInfo.CurrentCulture));
                            SW.WriteLine(",,");
                            SW.WriteLine("Name,UUID,");

                            for (int i = 0; i < lvwBlackList.Items.Count; i++)
                            {
                                ParcelManager.ParcelAccessEntry person = (ParcelManager.ParcelAccessEntry)lvwBlackList.Items[i].Tag;
                                string personame = lvwBlackList.Items[i].Text;

                                string line = personame + "," + person.AgentID.ToString() + ",";
                                SW.WriteLine(line);
                            }

                            SW.Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        //MessageBox.Show(ex.Message);
                        reporter.Show(ex);
                    }
                }
            }
        }
        public void setup()
        {
            // setup LandData object
            this.land                = new LandData();
            this.land.AABBMax        = new Vector3(0, 0, 0);
            this.land.AABBMin        = new Vector3(128, 128, 128);
            this.land.Area           = 128;
            this.land.AuctionID      = 0;
            this.land.AuthBuyerID    = new UUID();
            this.land.Category       = ParcelCategory.Residential;
            this.land.ClaimDate      = 0;
            this.land.ClaimPrice     = 0;
            this.land.GlobalID       = new UUID("54ff9641-dd40-4a2c-b1f1-47dd3af24e50");
            this.land.GroupID        = new UUID("d740204e-bbbf-44aa-949d-02c7d739f6a5");
            this.land.GroupPrims     = 0;
            this.land.Description    = "land data to test LandDataSerializer";
            this.land.Flags          = (uint)(ParcelFlags.AllowDamage | ParcelFlags.AllowVoiceChat);
            this.land.LandingType    = (byte)LandingType.Direct;
            this.land.Name           = "LandDataSerializerTest Land";
            this.land.Status         = ParcelStatus.Leased;
            this.land.LocalID        = 0;
            this.land.MediaAutoScale = (byte)0x01;
            this.land.MediaID        = new UUID("d4452578-2f25-4b97-a81b-819af559cfd7");
            this.land.MediaURL       = "http://videos.opensimulator.org/bumblebee.mp4";
            this.land.OwnerID        = new UUID("1b8eedf9-6d15-448b-8015-24286f1756bf");

            this.landWithParcelAccessList = this.land.Copy();
            this.landWithParcelAccessList.ParcelAccessList.Clear();

            ParcelManager.ParcelAccessEntry pae0 = new ParcelManager.ParcelAccessEntry();
            pae0.AgentID = new UUID("62d65d45-c91a-4f77-862c-46557d978b6c");
            pae0.Flags   = AccessList.Ban;
            pae0.Time    = new DateTime(2009, 10, 01);
            this.landWithParcelAccessList.ParcelAccessList.Add(pae0);

            ParcelManager.ParcelAccessEntry pae1 = new ParcelManager.ParcelAccessEntry();
            pae1.AgentID = new UUID("ec2a8d18-2378-4fe0-8b68-2a31b57c481e");
            pae1.Flags   = AccessList.Access;
            pae1.Time    = new DateTime(2010, 10, 20);
            this.landWithParcelAccessList.ParcelAccessList.Add(pae1);
        }
        /// <summary>
        ///   Rebuild the access list from the database
        /// </summary>
        /// <param name = "LandData"></param>
        private void BuildParcelAccessList(LandData LandData)
        {
            QueryFilter filter = new QueryFilter();

            filter.andFilters["ParcelID"] = LandData.GlobalID;
            List <string> Query = GD.Query(new string[3] {
                "AccessID",
                "Flags",
                "Time"
            }, "parcelaccess", filter, null, null, null);

            ParcelManager.ParcelAccessEntry entry;
            for (int i = 0; i < Query.Count; i += 3)
            {
                entry         = new ParcelManager.ParcelAccessEntry();
                entry.AgentID = UUID.Parse(Query[i]);
                entry.Flags   = (AccessList)Enum.Parse(typeof(AccessList), Query[i + 1]);
                entry.Time    = new DateTime(long.Parse(Query[i + 2]));
                LandData.ParcelAccessList.Add(entry);
            }
        }
        /// <summary>
        ///     The client wants to buy a pass for a parcel
        /// </summary>
        /// <param name="client"></param>
        /// <param name="fromID"></param>
        /// <param name="parcelLocalId"></param>
        private void ClientOnParcelBuyPass(IClientAPI client, UUID fromID, int parcelLocalId)
        {
            IScenePresence          agentSp          = m_scene.GetScenePresence(client.AgentId);
            IParcelManagementModule parcelManagement = agentSp.Scene.RequestModuleInterface <IParcelManagementModule>();
            ILandObject             landParcel       = null;
            List <ILandObject>      land             = parcelManagement.AllParcels();

            foreach (ILandObject landObject in land)
            {
                if (landObject.LandData.LocalID == parcelLocalId)
                {
                    landParcel = landObject;
                }
            }
            if (landParcel != null)
            {
                bool giveResult = m_connector.UserCurrencyTransfer(landParcel.LandData.OwnerID, fromID, UUID.Zero,
                                                                   UUID.Zero,
                                                                   (uint)landParcel.LandData.PassPrice, "Parcel Pass",
                                                                   TransactionType.LandPassSale, UUID.Random());
                if (giveResult)
                {
                    ParcelManager.ParcelAccessEntry entry
                        = new ParcelManager.ParcelAccessEntry
                        {
                        AgentID = fromID,
                        Flags   = AccessList.Access,
                        Time    = DateTime.Now.AddHours(landParcel.LandData.PassHours)
                        };
                    landParcel.LandData.ParcelAccessList.Add(entry);
                    agentSp.ControllingClient.SendAgentAlertMessage("You have been added to the parcel access list.",
                                                                    false);
                }
            }
            else
            {
                agentSp.ControllingClient.SendAgentAlertMessage("Unable to find parcel.", false);
            }
        }
Esempio n. 16
0
        public void updateAccessList(uint flags, List <ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client)
        {
            LandData newData = landData.Copy();

            if (entries.Count == 1 && entries[0].AgentID == UUID.Zero)
            {
                entries.Clear();
            }

            List <ParcelManager.ParcelAccessEntry> toRemove = new List <ParcelManager.ParcelAccessEntry>();

            foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList)
            {
                if (entry.Flags == (AccessList)flags)
                {
                    toRemove.Add(entry);
                }
            }

            foreach (ParcelManager.ParcelAccessEntry entry in toRemove)
            {
                newData.ParcelAccessList.Remove(entry);
            }
            foreach (ParcelManager.ParcelAccessEntry entry in entries)
            {
                ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry();
                temp.AgentID = entry.AgentID;
                temp.Time    = new DateTime(); //Pointless? Yes.
                temp.Flags   = (AccessList)flags;

                if (!newData.ParcelAccessList.Contains(temp))
                {
                    newData.ParcelAccessList.Add(temp);
                }
            }

            m_scene.LandChannel.UpdateLandObject(landData.LocalID, newData);
        }
Esempio n. 17
0
        public bool IsRestrictedFromLand(UUID avatar)
        {
            if (m_scene.Permissions.IsAdministrator(avatar))
            {
                return(false);
            }

            if ((LandData.Flags & (uint)ParcelFlags.UseAccessList) > 0)
            {
                ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
                entry.AgentID = avatar;
                entry.Flags   = AccessList.Access;
                entry.Time    = new DateTime();

                //If they are not on the access list and are not the owner
                if (!LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar)
                {
                    //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 18
0
        /// <summary>
        ///   Reify/deserialize landData
        /// </summary>
        /// <param name = "serializedLandData"></param>
        /// <returns></returns>
        /// <exception cref = "System.Xml.XmlException"></exception>
        public static LandData Deserialize(string serializedLandData)
        {
            LandData landData = new LandData();

            StringReader  sr  = new StringReader(serializedLandData);
            XmlTextReader xtr = new XmlTextReader(sr);

            xtr.ReadStartElement("LandData");

            landData.Area           = Convert.ToInt32(xtr.ReadElementString("Area"));
            landData.AuctionID      = Convert.ToUInt32(xtr.ReadElementString("AuctionID"));
            landData.AuthBuyerID    = UUID.Parse(xtr.ReadElementString("AuthBuyerID"));
            landData.Category       = (ParcelCategory)Convert.ToSByte(xtr.ReadElementString("Category"));
            landData.ClaimDate      = Convert.ToInt32(xtr.ReadElementString("ClaimDate"));
            landData.ClaimPrice     = Convert.ToInt32(xtr.ReadElementString("ClaimPrice"));
            landData.GlobalID       = UUID.Parse(xtr.ReadElementString("GlobalID"));
            landData.GroupID        = UUID.Parse(xtr.ReadElementString("GroupID"));
            landData.IsGroupOwned   = Convert.ToBoolean(xtr.ReadElementString("IsGroupOwned"));
            landData.Bitmap         = Convert.FromBase64String(xtr.ReadElementString("Bitmap"));
            landData.Description    = xtr.ReadElementString("Description");
            landData.Flags          = Convert.ToUInt32(xtr.ReadElementString("Flags"));
            landData.LandingType    = Convert.ToByte(xtr.ReadElementString("LandingType"));
            landData.Name           = xtr.ReadElementString("Name");
            landData.Status         = (ParcelStatus)Convert.ToSByte(xtr.ReadElementString("Status"));
            landData.LocalID        = Convert.ToInt32(xtr.ReadElementString("LocalID"));
            landData.MediaAutoScale = Convert.ToByte(xtr.ReadElementString("MediaAutoScale"));
            landData.MediaID        = UUID.Parse(xtr.ReadElementString("MediaID"));
            landData.MediaURL       = xtr.ReadElementString("MediaURL");
            landData.MusicURL       = xtr.ReadElementString("MusicURL");
            landData.OwnerID        = UUID.Parse(xtr.ReadElementString("OwnerID"));

            landData.ParcelAccessList = new List <ParcelManager.ParcelAccessEntry>();
            xtr.Read();
            if (xtr.Name != "ParcelAccessList")
            {
                throw new XmlException(String.Format("Expected \"ParcelAccessList\" element but got \"{0}\"", xtr.Name));
            }

            if (!xtr.IsEmptyElement)
            {
                while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
                {
                    ParcelManager.ParcelAccessEntry pae = new ParcelManager.ParcelAccessEntry();

                    xtr.ReadStartElement("ParcelAccessEntry");
                    pae.AgentID = UUID.Parse(xtr.ReadElementString("AgentID"));
                    pae.Time    = Convert.ToDateTime(xtr.ReadElementString("Time"));
                    pae.Flags   = (AccessList)Convert.ToUInt32(xtr.ReadElementString("AccessList"));
                    xtr.ReadEndElement();

                    landData.ParcelAccessList.Add(pae);
                }
            }
            xtr.Read();

            landData.PassHours    = Convert.ToSingle(xtr.ReadElementString("PassHours"));
            landData.PassPrice    = Convert.ToInt32(xtr.ReadElementString("PassPrice"));
            landData.SalePrice    = Convert.ToInt32(xtr.ReadElementString("SalePrice"));
            landData.SnapshotID   = UUID.Parse(xtr.ReadElementString("SnapshotID"));
            landData.UserLocation = Vector3.Parse(xtr.ReadElementString("UserLocation"));
            landData.UserLookAt   = Vector3.Parse(xtr.ReadElementString("UserLookAt"));
            // No longer used here
            xtr.ReadElementString("Dwell");
            landData.OtherCleanTime = Convert.ToInt32(xtr.ReadElementString("OtherCleanTime"));

            xtr.ReadEndElement();

            xtr.Close();
            sr.Close();

            return(landData);
        }
Esempio n. 19
0
        /// <summary>
        ///   Make a new copy of the land data
        /// </summary>
        /// <returns></returns>
        public LandData Copy()
        {
            LandData landData = new LandData
            {
                _AABBMax          = _AABBMax,
                _AABBMin          = _AABBMin,
                _area             = _area,
                _auctionID        = _auctionID,
                _authBuyerID      = _authBuyerID,
                _category         = _category,
                _claimDate        = _claimDate,
                _claimPrice       = _claimPrice,
                _globalID         = _globalID,
                _groupID          = _groupID,
                _isGroupOwned     = _isGroupOwned,
                _localID          = _localID,
                _landingType      = _landingType,
                _mediaAutoScale   = _mediaAutoScale,
                _mediaID          = _mediaID,
                _mediaURL         = _mediaURL,
                _musicURL         = _musicURL,
                _ownerID          = _ownerID,
                _bitmap           = (byte[])_bitmap.Clone(),
                _description      = _description,
                _flags            = _flags,
                _name             = _name,
                _status           = _status,
                _passHours        = _passHours,
                _passPrice        = _passPrice,
                _salePrice        = _salePrice,
                _snapshotID       = _snapshotID,
                _userLocation     = _userLocation,
                _userLookAt       = _userLookAt,
                _otherCleanTime   = _otherCleanTime,
                _dwell            = _dwell,
                _mediaType        = _mediaType,
                _mediaDescription = _mediaDescription,
                _mediaWidth       = _mediaWidth,
                _mediaHeight      = _mediaHeight,
                _mediaLoop        = _mediaLoop,
                _MediaLoopSet     = _MediaLoopSet,
                _obscureMusic     = _obscureMusic,
                _obscureMedia     = _obscureMedia,
                _regionID         = _regionID,
                _regionHandle     = _regionHandle,
                _infoUUID         = _infoUUID,
                _Maturity         = _Maturity,
                _private          = _private
            };


            landData._parcelAccessList.Clear();
#if (!ISWIN)
            foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList)
            {
                ParcelManager.ParcelAccessEntry newEntry = new ParcelManager.ParcelAccessEntry
                {
                    AgentID = entry.AgentID, Flags = entry.Flags, Time = entry.Time
                };
                landData._parcelAccessList.Add(newEntry);
            }
#else
            foreach (ParcelManager.ParcelAccessEntry newEntry in _parcelAccessList.Select(entry => new ParcelManager.ParcelAccessEntry
            {
                AgentID = entry.AgentID,
                Flags = entry.Flags,
                Time = entry.Time
            }))
            {
                landData._parcelAccessList.Add(newEntry);
            }
#endif

            return(landData);
        }
Esempio n. 20
0
        public bool IsRestrictedFromLand(UUID avatar)
        {
            if (m_scene.Permissions.GenericParcelPermission(avatar, this, (ulong)1))
            {
                return(false);
            }

            if ((LandData.Flags & (uint)ParcelFlags.UsePassList) > 0 ||
                (LandData.Flags & (uint)ParcelFlags.UseAccessList) > 0)
            {
                if (LandData.ParcelAccessList.Count > 0)
                {
                    ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
                    bool found = false;
                    foreach (
                        ParcelManager.ParcelAccessEntry pae in
                        LandData.ParcelAccessList.Where(
                            pae => avatar == pae.AgentID && AccessList.Access == pae.Flags))
                    {
                        found = true;
                        entry = pae;
                        break;
                    }

                    //If they are not on the access list and are not the owner
                    if (!found)
                    {
                        if ((LandData.Flags & (uint)ParcelFlags.UseAccessGroup) != 0)
                        {
                            IScenePresence SP = m_scene.GetScenePresence(avatar);
                            if (SP != null && LandData.GroupID == SP.ControllingClient.ActiveGroupId)
                            {
                                //They are a part of the group, let them in
                                return(false);
                            }
                            else
                            {
                                //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel
                                return(true);
                            }
                        }
                        else
                        {
                            //No group checking, not on the access list, restricted
                            return(true);
                        }
                    }
                    else
                    {
                        //If it does, we need to check the time
                        if (entry.Time.Ticks < DateTime.Now.Ticks)
                        {
                            //Time expired, remove them
                            LandData.ParcelAccessList.Remove(entry);
                            return(true);
                        }
                        return(false);
                    }
                }
                else if ((LandData.Flags & (uint)ParcelFlags.UseAccessGroup) > 0)
                {
                    IScenePresence SP = m_scene.GetScenePresence(avatar);
                    if (SP != null && LandData.GroupID == SP.ControllingClient.ActiveGroupId)
                    {
                        //They are a part of the group, let them in
                        return(false);
                    }
                    else
                    {
                        //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel
                        return(true);
                    }
                }
                return(true);
            }
            return(false);
        }