Exemplo n.º 1
0
 public void SendLandStatReply(uint reportType, uint requestFlags, uint resultCount, LandStatReportItem[] lsrpia)
 {
 }
        private void HandleLandStatRequest(int parcelID, uint reportType, uint requestFlags, string filter, IClientAPI remoteClient)
        {
            if (!Scene.Permissions.CanIssueEstateCommand(remoteClient.AgentId, false))
                return;

            Dictionary<uint, float> sceneData = null;

            if (reportType == 1)
            {
                sceneData = Scene.PhysicsScene.GetTopColliders();
            }
            else if (reportType == 0)
            {
                IScriptModule scriptModule = Scene.RequestModuleInterface<IScriptModule>();

                if (scriptModule != null)
                    sceneData = scriptModule.GetObjectScriptsExecutionTimes();
            }

            List<LandStatReportItem> SceneReport = new List<LandStatReportItem>();
            if (sceneData != null)
            {
                var sortedSceneData
                    = sceneData.Select(
                        item => new { Measurement = item.Value, Part = Scene.GetSceneObjectPart(item.Key) });

                sortedSceneData.OrderBy(item => item.Measurement);

                int items = 0;

                foreach (var entry in sortedSceneData)
                {
                    // The object may have been deleted since we received the data.
                    if (entry.Part == null)
                        continue;

                    // Don't show scripts that haven't executed or where execution time is below one microsecond in
                    // order to produce a more readable report.
                    if (entry.Measurement < 0.001)
                        continue;

                    items++;
                    SceneObjectGroup so = entry.Part.ParentGroup;

                    LandStatReportItem lsri = new LandStatReportItem();
                    lsri.LocationX = so.AbsolutePosition.X;
                    lsri.LocationY = so.AbsolutePosition.Y;
                    lsri.LocationZ = so.AbsolutePosition.Z;
                    lsri.Score = entry.Measurement;
                    lsri.TaskID = so.UUID;
                    lsri.TaskLocalID = so.LocalId;
                    lsri.TaskName = entry.Part.Name;
                    lsri.OwnerName = UserManager.GetUserName(so.OwnerID);

                    if (filter.Length != 0)
                    {
                        if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter)))
                        {
                        }
                        else
                        {
                            continue;
                        }
                    }

                    SceneReport.Add(lsri);

                    if (items >= 100)
                        break;
                }
            }

            remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray());
        }
Exemplo n.º 3
0
 public void SendLandStatReply(uint reportType, uint requestFlags, uint resultCount, LandStatReportItem[] lsrpia)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 4
0
        private void HandleLandStatRequest(int parcelID, uint reportType, uint requestFlags, string filter, IClientAPI remoteClient)
        {
            Dictionary<uint, float> SceneData = new Dictionary<uint,float>();
            List<UUID> uuidNameLookupList = new List<UUID>();

            if (reportType == 1)
            {
                SceneData = m_scene.PhysicsScene.GetTopColliders();
            }
            else if (reportType == 0)
            {
                SceneData = m_scene.SceneGraph.GetTopScripts();
            }

            List<LandStatReportItem> SceneReport = new List<LandStatReportItem>();
            lock (SceneData)
            {
                foreach (uint obj in SceneData.Keys)
                {
                    SceneObjectPart prt = m_scene.GetSceneObjectPart(obj);
                    if (prt != null)
                    {
                        if (prt.ParentGroup != null)
                        {
                            SceneObjectGroup sog = prt.ParentGroup;
                            if (sog != null)
                            {
                                LandStatReportItem lsri = new LandStatReportItem();
                                lsri.LocationX = sog.AbsolutePosition.X;
                                lsri.LocationY = sog.AbsolutePosition.Y;
                                lsri.LocationZ = sog.AbsolutePosition.Z;
                                lsri.Score = SceneData[obj];
                                lsri.TaskID = sog.UUID;
                                lsri.TaskLocalID = sog.LocalId;
                                lsri.TaskName = sog.GetPartName(obj);
                                if (m_scene.CommsManager.UUIDNameCachedTest(sog.OwnerID))
                                {
                                    lsri.OwnerName = m_scene.CommsManager.UUIDNameRequestString(sog.OwnerID);
                                }
                                else
                                {
                                    lsri.OwnerName = "waiting";
                                    lock (uuidNameLookupList)
                                        uuidNameLookupList.Add(sog.OwnerID);
                                }

                                if (filter.Length != 0)
                                {
                                    if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter)))
                                    {
                                    }
                                    else
                                    {
                                        continue;
                                    }
                                }

                                SceneReport.Add(lsri);
                            }
                        }
                    }

                }
            }
            remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport);

            if (uuidNameLookupList.Count > 0)
                LookupUUID(uuidNameLookupList);
        }
Exemplo n.º 5
0
        private void HandleLandStatRequest(int parcelID, uint reportType, uint requestFlags, string filter, IClientAPI remoteClient)
        {
            if (!m_scene.Permissions.CanIssueEstateCommand(remoteClient.AgentId, false))
                return;

            Dictionary<uint, float> SceneData = new Dictionary<uint,float>();
            
            if (reportType == (uint)OpenMetaverse.EstateTools.LandStatReportType.TopColliders)
            {
                SceneData = m_scene.SceneGraph.PhysicsScene.GetTopColliders();
            }
            else if (reportType == (uint)OpenMetaverse.EstateTools.LandStatReportType.TopScripts)
            {
                IScriptModule scriptModule = m_scene.RequestModuleInterface<IScriptModule>();
                SceneData = scriptModule.GetTopScripts(m_scene.RegionInfo.RegionID);
            }

            List<LandStatReportItem> SceneReport = new List<LandStatReportItem>();
            lock (SceneData)
            {
                foreach (uint obj in SceneData.Keys)
                {
                    SceneObjectPart prt = m_scene.GetSceneObjectPart(obj);
                    if (prt != null)
                    {
                        if (prt.ParentGroup != null)
                        {
                            SceneObjectGroup sog = prt.ParentGroup;
                            if (sog != null)
                            {
                                LandStatReportItem lsri = new LandStatReportItem();
                                lsri.Location = sog.AbsolutePosition;
                                lsri.Score = SceneData[obj];
                                lsri.TaskID = sog.UUID;
                                lsri.TaskLocalID = sog.LocalId;
                                lsri.TaskName = sog.GetPartName(obj);
                                lsri.TimeModified = sog.RootPart.Rezzed;
                                OpenSim.Services.Interfaces.UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, sog.OwnerID);
                                if (account != null)
                                    lsri.OwnerName = account.Name;
                                else
                                    lsri.OwnerName = "Unknown";

                                if (filter.Length != 0)
                                {
                                    //Its in the filter, don't check it
                                    if (requestFlags == 2) //Owner name
                                    {
                                        if (!lsri.OwnerName.Contains(filter))
                                            continue;
                                    }
                                    if (requestFlags == 4)//Object name
                                    {
                                        if (!lsri.TaskName.Contains(filter))
                                            continue;
                                    }
                                }

                                SceneReport.Add(lsri);
                            }
                        }
                    }

                }
            }
            remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray());
        }