Esempio n. 1
0
        /// <summary>Process an incoming packet and raise the appropriate events</summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The EventArgs object containing the packet data</param>
        protected void LandStatReplyHandler(object sender, PacketReceivedEventArgs e)
        {
            //if (OnLandStatReply != null || OnGetTopScripts != null || OnGetTopColliders != null)
            //if (OnGetTopScripts != null || OnGetTopColliders != null)
            {
                LandStatReplyPacket p = (LandStatReplyPacket)e.Packet;
                Dictionary<UUID, EstateTask> Tasks = new Dictionary<UUID, EstateTask>();

                foreach (LandStatReplyPacket.ReportDataBlock rep in p.ReportData)
                {
                    EstateTask task = new EstateTask();
                    task.Position = new Vector3(rep.LocationX, rep.LocationY, rep.LocationZ);
                    task.Score = rep.Score;
                    task.TaskID = rep.TaskID;
                    task.TaskLocalID = rep.TaskLocalID;
                    task.TaskName = Utils.BytesToString(rep.TaskName);
                    task.OwnerName = Utils.BytesToString(rep.OwnerName);
                    Tasks.Add(task.TaskID, task);
                }

                LandStatReportType type = (LandStatReportType)p.RequestData.ReportType;

                if (type == LandStatReportType.TopScripts)
                {
                    OnTopScriptsReply(new TopScriptsReplyEventArgs((int)p.RequestData.TotalObjectCount, Tasks));
                }
                else if (type == LandStatReportType.TopColliders)
                {
                    OnTopCollidersReply(new TopCollidersReplyEventArgs((int) p.RequestData.TotalObjectCount, Tasks));
                }

                /*
                if (OnGetTopColliders != null)
                {
                    //FIXME - System.UnhandledExceptionEventArgs
                    OnLandStatReply(
                        type,
                        p.RequestData.RequestFlags,
                        (int)p.RequestData.TotalObjectCount,
                        Tasks
                    );
                }
                */

            }
        }
Esempio n. 2
0
        private void LandStatCapsReplyHandler(string capsKey, IMessage message, Simulator simulator)
        {
            LandStatReplyMessage m = (LandStatReplyMessage)message;
            Dictionary<UUID, EstateTask> Tasks = new Dictionary<UUID, EstateTask>();

            foreach (LandStatReplyMessage.ReportDataBlock rep in m.ReportDataBlocks)
            {
                EstateTask task = new EstateTask();
                task.Position = rep.Location;
                task.Score = rep.Score;
                task.MonoScore = rep.MonoScore;
                task.TaskID = rep.TaskID;
                task.TaskLocalID = rep.TaskLocalID;
                task.TaskName = rep.TaskName;
                task.OwnerName = rep.OwnerName;
                Tasks.Add(task.TaskID, task);
            }

            LandStatReportType type = (LandStatReportType)m.ReportType;

            if (type == LandStatReportType.TopScripts)
            {
                OnTopScriptsReply(new TopScriptsReplyEventArgs((int)m.TotalObjectCount, Tasks));
            }
            else if (type == LandStatReportType.TopColliders)
            {
                OnTopCollidersReply(new TopCollidersReplyEventArgs((int)m.TotalObjectCount, Tasks));
            }
        }
Esempio n. 3
0
        /// <summary></summary>
        /// <param name="packet"></param>
        /// <param name="simulator"></param>
        private void LandStatReplyHandler(Packet packet, Simulator simulator)
        {
            //if (OnLandStatReply != null || OnGetTopScripts != null || OnGetTopColliders != null)
            if (OnGetTopScripts != null || OnGetTopColliders != null)
            {
                LandStatReplyPacket p = (LandStatReplyPacket)packet;
                List<EstateTask> Tasks = new List<EstateTask>();

                foreach (LandStatReplyPacket.ReportDataBlock rep in p.ReportData)
                {
                    EstateTask task = new EstateTask();
                    task.Position = new Vector3(rep.LocationX, rep.LocationY, rep.LocationZ);
                    task.Score = rep.Score;
                    task.TaskID = rep.TaskID;
                    task.TaskLocalID = rep.TaskLocalID;
                    task.TaskName = Utils.BytesToString(rep.TaskName);
                    task.OwnerName = Utils.BytesToString(rep.OwnerName);
                    Tasks.Add(task);
                }

                LandStatReportType type = (LandStatReportType)p.RequestData.ReportType;

                if (OnGetTopScripts != null && type == LandStatReportType.TopScripts)
                {
                    try { OnGetTopScripts((int)p.RequestData.TotalObjectCount, Tasks); }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                }
                else if (OnGetTopColliders != null && type == LandStatReportType.TopColliders)
                {
                    try { OnGetTopColliders((int)p.RequestData.TotalObjectCount, Tasks); }
                    catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
                }

                /*
                if (OnGetTopColliders != null)
                {
                    //FIXME - System.UnhandledExceptionEventArgs
                    OnLandStatReply(
                        type,
                        p.RequestData.RequestFlags,
                        (int)p.RequestData.TotalObjectCount,
                        Tasks
                    );
                }
                */

            }
        }