Ejemplo n.º 1
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
                 *  );
                 * }
                 */
            }
        }
Ejemplo n.º 2
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 LLVector3(rep.LocationX, rep.LocationY, rep.LocationZ);
                    task.Score = rep.Score;
                    task.TaskID = rep.TaskID;
                    task.TaskLocalID = rep.TaskLocalID;
                    task.TaskName = Helpers.FieldToUTF8String(rep.TaskName);
                    task.OwnerName = Helpers.FieldToUTF8String(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) { Client.Log(e.ToString(), Helpers.LogLevel.Error); }
                }
                else if (OnGetTopColliders != null && type == LandStatReportType.TopColliders)
                {
                    try { OnGetTopColliders((int)p.RequestData.TotalObjectCount, Tasks); }
                    catch (Exception e) { Client.Log(e.ToString(), Helpers.LogLevel.Error); }
                }

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

            }
        }