示例#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._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._simwideArea      = _simwideArea;
            landData._simwidePrims     = _simwidePrims;
            landData._dwell            = _dwell;

            landData._parcelAccessList.Clear();
            foreach (LandAccessEntry entry in _parcelAccessList)
            {
                LandAccessEntry newEntry = new LandAccessEntry();
                newEntry.AgentID = entry.AgentID;
                newEntry.Flags   = entry.Flags;
                newEntry.Expires = entry.Expires;

                landData._parcelAccessList.Add(newEntry);
            }

            return(landData);
        }
        public void setup()
        {
            // setup LandData object
            this.land = new LandData();
            this.land.AABBMax = new Vector3(1, 2, 3);
            this.land.AABBMin = new Vector3(129, 130, 131);
            this.land.Area = 128;
            this.land.AuctionID = 4;
            this.land.AuthBuyerID = new UUID("7176df0c-6c50-45db-8a37-5e78be56a0cd");
            this.land.Category = ParcelCategory.Residential;
            this.land.ClaimDate = 1;
            this.land.ClaimPrice = 2;
            this.land.GlobalID = new UUID("54ff9641-dd40-4a2c-b1f1-47dd3af24e50");
            this.land.GroupID = new UUID("d740204e-bbbf-44aa-949d-02c7d739f6a5");
            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 = 1;
            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();

            LandAccessEntry pae0 = new LandAccessEntry();
            pae0.AgentID = new UUID("62d65d45-c91a-4f77-862c-46557d978b6c");
            pae0.Flags = AccessList.Ban;
            pae0.Expires = 0;
            this.landWithParcelAccessList.ParcelAccessList.Add(pae0);

            LandAccessEntry pae1 = new LandAccessEntry();
            pae1.AgentID = new UUID("ec2a8d18-2378-4fe0-8b68-2a31b57c481e");
            pae1.Flags = AccessList.Access;
            pae1.Expires = 0;
            this.landWithParcelAccessList.ParcelAccessList.Add(pae1);
        }
示例#3
0
        public void llAddToLandBanList(string avatar, double hours)
        {
            m_host.AddScriptLPS(1);
            UUID key;
            ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
            if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned))
            {
                int expires = 0;
                if (hours != 0)
                    expires = Util.UnixTimeSinceEpoch() + (int)(3600.0 * hours);

                if (UUID.TryParse(avatar, out key))
                {
                    int idx = land.LandData.ParcelAccessList.FindIndex(
                            delegate(LandAccessEntry e)
                            {
                                if (e.AgentID == key && e.Flags == AccessList.Ban)
                                    return true;
                                return false;
                            });

                    if (idx != -1 && (land.LandData.ParcelAccessList[idx].Expires == 0 || (expires != 0 && expires < land.LandData.ParcelAccessList[idx].Expires)))
                        return;

                    if (idx != -1)
                        land.LandData.ParcelAccessList.RemoveAt(idx);

                    LandAccessEntry entry = new LandAccessEntry();

                    entry.AgentID = key;
                    entry.Flags = AccessList.Ban;
                    entry.Expires = expires;

                    land.LandData.ParcelAccessList.Add(entry);

                    World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land);
                }
            }
            ScriptSleep(100);
        }
示例#4
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._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._simwideArea = _simwideArea;
            landData._simwidePrims = _simwidePrims;
            landData._dwell = _dwell;
            landData.SeeAVs = SeeAVs;
            landData.AnyAVSounds = AnyAVSounds;
            landData.GroupAVSounds = GroupAVSounds;

            landData._parcelAccessList.Clear();
            foreach (LandAccessEntry entry in _parcelAccessList)
            {
                LandAccessEntry newEntry = new LandAccessEntry();
                newEntry.AgentID = entry.AgentID;
                newEntry.Flags = entry.Flags;
                newEntry.Expires = entry.Expires;

                landData._parcelAccessList.Add(newEntry);
            }

            return landData;
        }
        /// <summary>
        /// Creates the land access parameters.
        /// </summary>
        /// <param name="parcelAccessEntry">parcel access entry.</param>
        /// <param name="parcelID">parcel ID.</param>
        /// <returns></returns>
        private NpgsqlParameter[] CreateLandAccessParameters(LandAccessEntry parcelAccessEntry, UUID parcelID)
        {
            List<NpgsqlParameter> parameters = new List<NpgsqlParameter>();

            parameters.Add(_Database.CreateParameter("LandUUID", parcelID));
            parameters.Add(_Database.CreateParameter("AccessUUID", parcelAccessEntry.AgentID));
            parameters.Add(_Database.CreateParameter("Flags", parcelAccessEntry.Flags));
            parameters.Add(_Database.CreateParameter("Expires", parcelAccessEntry.Expires));

            return parameters.ToArray();
        }
示例#6
0
        public void UpdateAccessList(uint flags, UUID transactionID,
                int sequenceID, int sections,
                List<LandAccessEntry> entries,
                IClientAPI remote_client)
        {
            LandData newData = LandData.Copy();

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

                List<LandAccessEntry> toRemove =
                        new List<LandAccessEntry>();

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

                foreach (LandAccessEntry 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 (LandAccessEntry entry in entries)
            {
                LandAccessEntry temp =
                        new LandAccessEntry();

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

                newData.ParcelAccessList.Add(temp);
            }

            m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
        }
示例#7
0
        public List<LandAccessEntry>  CreateAccessListArrayByFlag(AccessList flag)
        {
            ExpireAccessList();

            List<LandAccessEntry> list = new List<LandAccessEntry>();
            foreach (LandAccessEntry entry in LandData.ParcelAccessList)
            {
                if (entry.Flags == flag)
                   list.Add(entry);
            }
            if (list.Count == 0)
            {
                LandAccessEntry e = new LandAccessEntry();
                e.AgentID = UUID.Zero;
                e.Flags = 0;
                e.Expires = 0;

                list.Add(e);
            }

            return list;
        }
        public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
        {
            ScenePresence targetAvatar = null;
            ScenePresence parcelManager = null;

            // Must have presences
            if (!m_scene.TryGetScenePresence(target, out targetAvatar) ||
                !m_scene.TryGetScenePresence(client.AgentId, out parcelManager))
                return;

            // Cannot eject estate managers or gods
            if (m_scene.Permissions.IsAdministrator(target))
                return;

            // Check if you even have permission to do this
            ILandObject land = m_scene.LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
            if (!m_scene.Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze) &&
                !m_scene.Permissions.IsAdministrator(client.AgentId))
                return;
            Vector3 pos = m_scene.GetNearestAllowedPosition(targetAvatar, land);

            targetAvatar.TeleportWithMomentum(pos, null);
            targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname);
            parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected.");

            if ((flags & 1) != 0) // Ban TODO: Remove magic number
            {
                LandAccessEntry entry = new LandAccessEntry();
                entry.AgentID = targetAvatar.UUID;
                entry.Flags = AccessList.Ban;
                entry.Expires = 0; // Perm

                land.LandData.ParcelAccessList.Add(entry);
            }
        }
示例#9
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="row"></param>
 /// <param name="entry"></param>
 /// <param name="parcelID"></param>
 private static void fillLandAccessRow(DataRow row, LandAccessEntry entry, UUID parcelID)
 {
     row["LandUUID"] = parcelID.ToString();
     row["AccessUUID"] = entry.AgentID.ToString();
     row["Flags"] = entry.Flags;
 }
示例#10
0
 /// <summary>
 /// Build a land access entry from the persisted data.
 /// </summary>
 /// <param name="row"></param>
 /// <returns></returns>
 private static LandAccessEntry buildLandAccessData(DataRow row)
 {
     LandAccessEntry entry = new LandAccessEntry();
     entry.AgentID = new UUID((string)row["AccessUUID"]);
     entry.Flags = (AccessList)row["Flags"];
     entry.Expires = 0;
     return entry;
 }
示例#11
0
        public static void ProcessParcelAccessList(LandData ld, XmlTextReader xtr)
        {
            if (!xtr.IsEmptyElement)
            {
                while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
                {
                    LandAccessEntry lae = new LandAccessEntry();

                    xtr.ReadStartElement("ParcelAccessEntry");

                    ExternalRepresentationUtils.ExecuteReadProcessors<LandAccessEntry>(lae, m_laeProcessors, xtr);

                    xtr.ReadEndElement();

                    ld.ParcelAccessList.Add(lae);
                }
            }

            xtr.Read();
        }
示例#12
0
 /// <summary>
 /// Builds the landaccess data from a data record.
 /// </summary>
 /// <param name="row">datarecord with landaccess data</param>
 /// <returns></returns>
 private static LandAccessEntry BuildLandAccessData(IDataRecord row)
 {
     LandAccessEntry entry = new LandAccessEntry();
     entry.AgentID = new UUID((Guid)row["AccessUUID"]);
     entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]);
     entry.Expires = 0;
     return entry;
 }