Beispiel #1
0
        /// <summary>
        ///     Notify the parcel owner each avatar that owns prims situated on their land.  This notification includes
        ///     aggregate details such as the number of prims.
        /// </summary>
        /// <param name="remote_client">
        ///     <see cref="IClientAPI" />
        /// </param>
        public void SendLandObjectOwners(IClientAPI remote_client)
        {
            if (m_scene.Permissions.CanViewObjectOwners(remote_client.AgentId, this))
            {
                IPrimCountModule primCountModule = m_scene.RequestModuleInterface <IPrimCountModule>();
                if (primCountModule != null)
                {
                    IPrimCounts primCounts = primCountModule.GetPrimCounts(LandData.GlobalID);
                    Dictionary <UUID, LandObjectOwners> owners = new Dictionary <UUID, LandObjectOwners>();
                    foreach (ISceneEntity grp in primCounts.Objects)
                    {
                        bool             newlyAdded = false;
                        LandObjectOwners landObj;
                        if (!owners.TryGetValue(grp.OwnerID, out landObj))
                        {
                            landObj = new LandObjectOwners();
                            owners.Add(grp.OwnerID, landObj);
                            newlyAdded = true;
                        }

                        landObj.Count += grp.PrimCount;
                        //Only do all of this once
                        if (newlyAdded)
                        {
                            if (grp.GroupID != UUID.Zero && grp.GroupID == grp.OwnerID)
                            {
                                landObj.GroupOwned = true;
                            }
                            else
                            {
                                landObj.GroupOwned = false;
                            }
                            if (landObj.GroupOwned)
                            {
                                landObj.Online = false;
                            }
                            else
                            {
                                IAgentInfoService presenceS = m_scene.RequestModuleInterface <IAgentInfoService>();
                                UserInfo          info      = presenceS.GetUserInfo(grp.OwnerID.ToString());
                                if (info != null)
                                {
                                    landObj.Online = info.IsOnline;
                                }
                            }
                            landObj.OwnerID = grp.OwnerID;
                        }
                        if (grp.RootChild.Rezzed > landObj.TimeLastRezzed)
                        {
                            landObj.TimeLastRezzed = grp.RootChild.Rezzed;
                        }
                    }
                    remote_client.SendLandObjectOwners(new List <LandObjectOwners>(owners.Values));
                }
            }
        }
Beispiel #2
0
        public void SendForceObjectSelect(int local_id, int request_type, List <UUID> returnIDs, IClientAPI remote_client)
        {
            if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this))
            {
                List <uint> resultLocalIDs = new List <uint>();
                try
                {
                    IPrimCountModule primCountModule = m_scene.RequestModuleInterface <IPrimCountModule>();
                    IPrimCounts      primCounts      = primCountModule.GetPrimCounts(LandData.GlobalID);
                    foreach (ISceneEntity obj in primCounts.Objects.Where(obj => obj.LocalId > 0))
                    {
                        if (request_type == ParcelManagementModule.LAND_SELECT_OBJECTS_OWNER &&
                            obj.OwnerID == LandData.OwnerID)
                        {
                            resultLocalIDs.Add(obj.LocalId);
                        }
                        else if (request_type == ParcelManagementModule.LAND_SELECT_OBJECTS_GROUP &&
                                 obj.GroupID == LandData.GroupID && LandData.GroupID != UUID.Zero)
                        {
                            resultLocalIDs.Add(obj.LocalId);
                        }
                        else if (request_type == ParcelManagementModule.LAND_SELECT_OBJECTS_OTHER &&
                                 obj.OwnerID != remote_client.AgentId)
                        {
                            resultLocalIDs.Add(obj.LocalId);
                        }
                        else if (request_type == (int)ObjectReturnType.List && returnIDs.Contains(obj.OwnerID))
                        {
                            resultLocalIDs.Add(obj.LocalId);
                        }
                        else if (request_type == (int)ObjectReturnType.Sell &&
                                 obj.OwnerID == remote_client.AgentId)
                        {
                            resultLocalIDs.Add(obj.LocalId);
                        }
                    }
                }
                catch (InvalidOperationException)
                {
                    MainConsole.Instance.Error("[LAND]: Unable to force select the parcel objects. Arr.");
                }

                remote_client.SendForceClientSelectObjects(resultLocalIDs);
            }
        }
        public void SendLandProperties(int sequence_id, bool snap_selection, int request_result,
                                       IClientAPI remote_client)
        {
            IEstateModule estateModule = m_scene.RequestModuleInterface <IEstateModule> ();

            // default is to not allow setting of Landmarks or Home. These can be overridden by the estate settings
            // 336723947 == AllowLandmark,AllowSetHome,PublicAllowed,AllowDirectTeleport,AllowParcelChanges,AllowVoice
            // ulong regionFlags = 336723974 & ~((uint)(OpenMetaverse.RegionFlags.AllowLandmark | OpenMetaverse.RegionFlags.AllowSetHome));
            ulong regionFlags = (uint)(OpenMetaverse.RegionFlags.PublicAllowed |
                                       OpenMetaverse.RegionFlags.AllowDirectTeleport |
                                       OpenMetaverse.RegionFlags.AllowParcelChanges |
                                       OpenMetaverse.RegionFlags.AllowVoice);

            if (estateModule != null)
            {
                regionFlags = estateModule.GetRegionFlags();
            }

            int seq_id;

            if (snap_selection && (sequence_id == 0))
            {
                seq_id = m_lastSeqId;
            }
            else
            {
                seq_id      = sequence_id;
                m_lastSeqId = seq_id;
            }

            int MaxPrimCounts = 0;
            IPrimCountModule primCountModule = m_scene.RequestModuleInterface <IPrimCountModule> ();

            if (primCountModule != null)
            {
                MaxPrimCounts = primCountModule.GetParcelMaxPrimCount(this);
            }

            remote_client.SendLandProperties(seq_id,
                                             snap_selection, request_result, LandData,
                                             (float)m_scene.RegionInfo.RegionSettings.ObjectBonus,
                                             MaxPrimCounts,
                                             m_scene.RegionInfo.ObjectCapacity, (uint)regionFlags);
        }
Beispiel #4
0
        public List <ISceneEntity> GetPrimsOverByOwner(UUID targetID, int flags)
        {
            List <ISceneEntity> prims           = new List <ISceneEntity>();
            IPrimCountModule    primCountModule = m_scene.RequestModuleInterface <IPrimCountModule>();
            IPrimCounts         primCounts      = primCountModule.GetPrimCounts(LandData.GlobalID);

            foreach (ISceneEntity obj in primCounts.Objects.Where(obj => obj.OwnerID == m_landData.OwnerID))
            {
                if (flags == 4)
                {
                    bool containsScripts = obj.ChildrenEntities().Any(child => child.Inventory.ContainsScripts());
                    if (!containsScripts)
                    {
                        continue;
                    }
                }
                prims.Add(obj);
            }
            return(prims);
        }
        public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice,
                                   int area)
        {
            if ((LandData.Flags & (uint)ParcelFlags.SellParcelObjects) == (uint)ParcelFlags.SellParcelObjects)
            {
                //Sell all objects on the parcel too
                IPrimCountModule primCountModule = m_scene.RequestModuleInterface <IPrimCountModule> ();
                IPrimCounts      primCounts      = primCountModule.GetPrimCounts(LandData.GlobalID);

                foreach (ISceneEntity obj in primCounts.Objects.Where(obj => obj.OwnerID == LandData.OwnerID))
                {
                    //Fix the owner/last owner
                    obj.SetOwnerId(avatarID);
                    //Then update all clients around
                    obj.ScheduleGroupUpdate(PrimUpdateFlags.FullUpdate);
                }
            }

            LandData.OwnerID      = avatarID;
            LandData.GroupID      = groupID;
            LandData.IsGroupOwned = groupOwned;
            LandData.AuctionID    = 0;
            LandData.ClaimDate    = Util.UnixTimeSinceEpoch();
            LandData.ClaimPrice   = claimprice;
            LandData.SalePrice    = 0;
            LandData.AuthBuyerID  = UUID.Zero;
            LandData.Flags       &= ~(uint)(
                ParcelFlags.ForSale |
                ParcelFlags.ForSaleObjects |
                ParcelFlags.SellParcelObjects |
                ParcelFlags.ShowDirectory);

            m_parcelManagementModule.UpdateLandObject(this);

            SendLandUpdateToAvatarsOverMe(true);
            //Send a full update to the client as well
            IScenePresence SP = m_scene.GetScenePresence(avatarID);

            SendLandUpdateToClient(SP.ControllingClient);
        }
Beispiel #6
0
        public void SendLandProperties(int sequence_id, bool snap_selection, int request_result,
                                       IClientAPI remote_client)
        {
            IEstateModule estateModule = m_scene.RequestModuleInterface <IEstateModule>();
            ulong         regionFlags  = 336723974 &
                                         ~((uint)
                                           (OpenMetaverse.RegionFlags.AllowLandmark | OpenMetaverse.RegionFlags.AllowSetHome));

            if (estateModule != null)
            {
                regionFlags = estateModule.GetRegionFlags();
            }

            int seq_id;

            if (snap_selection && (sequence_id == 0))
            {
                seq_id = m_lastSeqId;
            }
            else
            {
                seq_id      = sequence_id;
                m_lastSeqId = seq_id;
            }

            int MaxPrimCounts = 0;
            IPrimCountModule primCountModule = m_scene.RequestModuleInterface <IPrimCountModule>();

            if (primCountModule != null)
            {
                MaxPrimCounts = primCountModule.GetParcelMaxPrimCount(this);
            }

            remote_client.SendLandProperties(seq_id,
                                             snap_selection, request_result, LandData,
                                             (float)m_scene.RegionInfo.RegionSettings.ObjectBonus,
                                             MaxPrimCounts,
                                             m_scene.RegionInfo.ObjectCapacity, (uint)regionFlags);
        }
 public void RegionLoaded(Scene scene)
 {
      m_userManager = m_scene.RequestModuleInterface<IUserManagement>();         
      m_primCountModule = m_scene.RequestModuleInterface<IPrimCountModule>();
      m_Dialog = m_scene.RequestModuleInterface<IDialogModule>();
 }
Beispiel #8
0
        public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client)
        {
            Dictionary <UUID, List <ISceneEntity> > returns =
                new Dictionary <UUID, List <ISceneEntity> >();

            IPrimCountModule primCountModule = m_scene.RequestModuleInterface <IPrimCountModule>();
            IPrimCounts      primCounts      = primCountModule.GetPrimCounts(LandData.GlobalID);

            if (type == (uint)ObjectReturnType.Owner)
            {
                foreach (ISceneEntity obj in primCounts.Objects.Where(obj => obj.OwnerID == m_landData.OwnerID))
                {
                    if (!returns.ContainsKey(obj.OwnerID))
                    {
                        returns[obj.OwnerID] =
                            new List <ISceneEntity>();
                    }
                    if (!returns[obj.OwnerID].Contains(obj))
                    {
                        returns[obj.OwnerID].Add(obj);
                    }
                }
            }
            else if (type == (uint)ObjectReturnType.Group && m_landData.GroupID != UUID.Zero)
            {
                foreach (ISceneEntity obj in primCounts.Objects.Where(obj => obj.GroupID == m_landData.GroupID))
                {
                    if (!returns.ContainsKey(obj.OwnerID))
                    {
                        returns[obj.OwnerID] =
                            new List <ISceneEntity>();
                    }
                    if (!returns[obj.OwnerID].Contains(obj))
                    {
                        returns[obj.OwnerID].Add(obj);
                    }
                }
            }
            else if (type == (uint)ObjectReturnType.Other)
            {
                foreach (ISceneEntity obj in primCounts.Objects.Where(obj => obj.OwnerID != m_landData.OwnerID &&
                                                                      (obj.GroupID != m_landData.GroupID ||
                                                                       m_landData.GroupID == UUID.Zero)))
                {
                    if (!returns.ContainsKey(obj.OwnerID))
                    {
                        returns[obj.OwnerID] =
                            new List <ISceneEntity>();
                    }
                    if (!returns[obj.OwnerID].Contains(obj))
                    {
                        returns[obj.OwnerID].Add(obj);
                    }
                }
            }
            else if (type == (uint)ObjectReturnType.List)
            {
                List <UUID> ownerlist = new List <UUID>(owners);
                foreach (ISceneEntity obj in primCounts.Objects.Where(obj => ownerlist.Contains(obj.OwnerID)))
                {
                    if (!returns.ContainsKey(obj.OwnerID))
                    {
                        returns[obj.OwnerID] =
                            new List <ISceneEntity>();
                    }
                    if (!returns[obj.OwnerID].Contains(obj))
                    {
                        returns[obj.OwnerID].Add(obj);
                    }
                }
            }
            else if (type == 1)
            {
                List <UUID> Tasks = new List <UUID>(tasks);
                foreach (ISceneEntity obj in primCounts.Objects.Where(obj => Tasks.Contains(obj.UUID)))
                {
                    if (!returns.ContainsKey(obj.OwnerID))
                    {
                        returns[obj.OwnerID] =
                            new List <ISceneEntity>();
                    }
                    if (!returns[obj.OwnerID].Contains(obj))
                    {
                        returns[obj.OwnerID].Add(obj);
                    }
                }
            }

            foreach (
                List <ISceneEntity> ol in
                returns.Values.Where(ol => m_scene.Permissions.CanReturnObjects(this, remote_client.AgentId, ol)))
            {
                //The return system will take care of the returned objects
                m_parcelManagementModule.AddReturns(ol[0].OwnerID, ol[0].Name, ol[0].AbsolutePosition,
                                                    "Parcel Owner Return", ol);
                //m_scene.returnObjects(ol.ToArray(), remote_client.AgentId);
            }
        }
Beispiel #9
0
        public void DisableLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client)
        {
            Dictionary <UUID, List <ISceneEntity> > disabled =
                new Dictionary <UUID, List <ISceneEntity> >();

            IPrimCountModule primCountModule = m_scene.RequestModuleInterface <IPrimCountModule>();
            IPrimCounts      primCounts      = primCountModule.GetPrimCounts(LandData.GlobalID);

            if (type == (uint)ObjectReturnType.Owner)
            {
                foreach (ISceneEntity obj in primCounts.Objects.Where(obj => obj.OwnerID == m_landData.OwnerID))
                {
                    if (!disabled.ContainsKey(obj.OwnerID))
                    {
                        disabled[obj.OwnerID] =
                            new List <ISceneEntity>();
                    }

                    disabled[obj.OwnerID].Add(obj);
                }
            }
            else if (type == (uint)ObjectReturnType.Group && m_landData.GroupID != UUID.Zero)
            {
                foreach (ISceneEntity obj in primCounts.Objects.Where(obj => obj.GroupID == m_landData.GroupID))
                {
                    if (!disabled.ContainsKey(obj.OwnerID))
                    {
                        disabled[obj.OwnerID] =
                            new List <ISceneEntity>();
                    }

                    disabled[obj.OwnerID].Add(obj);
                }
            }
            else if (type == (uint)ObjectReturnType.Other)
            {
                foreach (ISceneEntity obj in primCounts.Objects.Where(obj => obj.OwnerID != m_landData.OwnerID &&
                                                                      (obj.GroupID != m_landData.GroupID ||
                                                                       m_landData.GroupID == UUID.Zero)))
                {
                    if (!disabled.ContainsKey(obj.OwnerID))
                    {
                        disabled[obj.OwnerID] =
                            new List <ISceneEntity>();
                    }
                    disabled[obj.OwnerID].Add(obj);
                }
            }
            else if (type == (uint)ObjectReturnType.List)
            {
                List <UUID> ownerlist = new List <UUID>(owners);
                foreach (ISceneEntity obj in primCounts.Objects.Where(obj => ownerlist.Contains(obj.OwnerID)))
                {
                    if (!disabled.ContainsKey(obj.OwnerID))
                    {
                        disabled[obj.OwnerID] =
                            new List <ISceneEntity>();
                    }
                    disabled[obj.OwnerID].Add(obj);
                }
            }
            else if (type == 1)
            {
                List <UUID> Tasks = new List <UUID>(tasks);
                foreach (ISceneEntity obj in primCounts.Objects.Where(obj => Tasks.Contains(obj.UUID)))
                {
                    if (!disabled.ContainsKey(obj.OwnerID))
                    {
                        disabled[obj.OwnerID] =
                            new List <ISceneEntity>();
                    }
                    disabled[obj.OwnerID].Add(obj);
                }
            }

            IScriptModule[] modules = m_scene.RequestModuleInterfaces <IScriptModule>();
            foreach (List <ISceneEntity> ol in disabled.Values)
            {
                foreach (ISceneEntity group in ol)
                {
                    if (m_scene.Permissions.CanEditObject(group.UUID, remote_client.AgentId))
                    {
                        foreach (IScriptModule module in modules)
                        {
                            //Disable the entire object
                            foreach (ISceneChildEntity part in group.ChildrenEntities())
                            {
                                foreach (TaskInventoryItem item in part.Inventory.GetInventoryItems())
                                {
                                    if (item.InvType == (int)InventoryType.LSL)
                                    {
                                        module.SuspendScript(item.ItemID);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }