private void AppendParcelReport(StringBuilder report, ILandObject lo)
        {
            LandData ld = lo.LandData;

            ConsoleDisplayList cdl = new ConsoleDisplayList();
            cdl.AddRow("Parcel name", ld.Name);
            cdl.AddRow("Local ID", ld.LocalID);
            cdl.AddRow("Description", ld.Description);
            cdl.AddRow("Snapshot ID", ld.SnapshotID);
            cdl.AddRow("Area", ld.Area);
            cdl.AddRow("Starts", lo.StartPoint);
            cdl.AddRow("Ends", lo.EndPoint);
            cdl.AddRow("AABB Min", ld.AABBMin);
            cdl.AddRow("AABB Max", ld.AABBMax);
            string ownerName;
            if (ld.IsGroupOwned)
            {
                GroupRecord rec = m_groupManager.GetGroupRecord(ld.GroupID);
                ownerName = (rec != null) ? rec.GroupName : "Unknown Group";
            }
            else
            {
                ownerName = m_userManager.GetUserName(ld.OwnerID);
            }
            cdl.AddRow("Owner", ownerName);
            cdl.AddRow("Is group owned?", ld.IsGroupOwned);
            cdl.AddRow("GroupID", ld.GroupID);

            cdl.AddRow("Status", ld.Status);
            cdl.AddRow("Flags", (ParcelFlags)ld.Flags);           

            cdl.AddRow("Landing Type", (LandingType)ld.LandingType);
            cdl.AddRow("User Location", ld.UserLocation);
            cdl.AddRow("User look at", ld.UserLookAt);

            cdl.AddRow("Other clean time", ld.OtherCleanTime);

            cdl.AddRow("Max Prims", lo.GetParcelMaxPrimCount());
            IPrimCounts pc = lo.PrimCounts;
            cdl.AddRow("Owner Prims", pc.Owner);
            cdl.AddRow("Group Prims", pc.Group);
            cdl.AddRow("Other Prims", pc.Others);
            cdl.AddRow("Selected Prims", pc.Selected);
            cdl.AddRow("Total Prims", pc.Total);

            cdl.AddRow("Music URL", ld.MusicURL);
            cdl.AddRow("Obscure Music", ld.ObscureMusic);

            cdl.AddRow("Media ID", ld.MediaID);
            cdl.AddRow("Media Autoscale", Convert.ToBoolean(ld.MediaAutoScale));
            cdl.AddRow("Media URL", ld.MediaURL);
            cdl.AddRow("Media Type", ld.MediaType);
            cdl.AddRow("Media Description", ld.MediaDescription);
            cdl.AddRow("Media Width", ld.MediaWidth);
            cdl.AddRow("Media Height", ld.MediaHeight);
            cdl.AddRow("Media Loop", ld.MediaLoop);
            cdl.AddRow("Obscure Media", ld.ObscureMedia);

            cdl.AddRow("Parcel Category", ld.Category);

            cdl.AddRow("Claim Date", ld.ClaimDate);
            cdl.AddRow("Claim Price", ld.ClaimPrice);
            cdl.AddRow("Pass Hours", ld.PassHours);
            cdl.AddRow("Pass Price", ld.PassPrice);

            cdl.AddRow("Auction ID", ld.AuctionID);
            cdl.AddRow("Authorized Buyer ID", ld.AuthBuyerID);
            cdl.AddRow("Sale Price", ld.SalePrice);

            cdl.AddToStringBuilder(report);
        }
        private void HandleShowRegion(string module, string[] cmd)
        {
            if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene))
                return;

            RegionInfo ri = m_scene.RegionInfo;
            RegionSettings rs = ri.RegionSettings;

            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("Region information for {0}\n", m_scene.Name);

            ConsoleDisplayList dispList = new ConsoleDisplayList();
            dispList.AddRow("Region ID", ri.RegionID);
            dispList.AddRow("Region handle", ri.RegionHandle);
            dispList.AddRow("Region location", string.Format("{0},{1}", ri.RegionLocX, ri.RegionLocY));
            dispList.AddRow("Region size", string.Format("{0}x{1}", ri.RegionSizeX, ri.RegionSizeY));
            //dispList.AddRow("Region type", ri.RegionType);
            dispList.AddRow("Maturity", rs.Maturity);
            dispList.AddRow("Region address", ri.ServerURI);
            dispList.AddRow("From region file", ri.RegionFile);
            dispList.AddRow("External endpoint", ri.ExternalEndPoint);
            dispList.AddRow("Internal endpoint", ri.InternalEndPoint);
            dispList.AddRow("Access level", ri.AccessLevel);
            dispList.AddRow("Agent limit", rs.AgentLimit);
            dispList.AddRow("Max agent limit", ri.AgentCapacity);
            dispList.AddRow("Linkset capacity", ri.LinksetCapacity <= 0 ? "not set" : ri.LinksetCapacity.ToString());
            dispList.AddRow("Prim capacity", ri.ObjectCapacity);
            dispList.AddRow("Prim bonus", rs.ObjectBonus);
            dispList.AddRow("Max prims per user", ri.MaxPrimsPerUser < 0 ? "n/a" : ri.MaxPrimsPerUser.ToString());
            dispList.AddRow("Clamp prim size", ri.ClampPrimSize);
            dispList.AddRow("Non physical prim min size", ri.NonphysPrimMin <= 0 ? "not set" : string.Format("{0} m", ri.NonphysPrimMin));
            dispList.AddRow("Non physical prim max size", ri.NonphysPrimMax <= 0 ? "not set" : string.Format("{0} m", ri.NonphysPrimMax));
            dispList.AddRow("Physical prim min size", ri.PhysPrimMin <= 0 ? "not set" : string.Format("{0} m", ri.PhysPrimMin));
            dispList.AddRow("Physical prim max size", ri.PhysPrimMax <= 0 ? "not set" : string.Format("{0} m", ri.PhysPrimMax));

            dispList.AddRow("Allow Damage", rs.AllowDamage);
            dispList.AddRow("Allow Land join/divide", rs.AllowLandJoinDivide);
            dispList.AddRow("Allow land resell", rs.AllowLandResell);
            dispList.AddRow("Block fly", rs.BlockFly);
            dispList.AddRow("Block show in search", rs.BlockShowInSearch);
            dispList.AddRow("Block terraform", rs.BlockTerraform);
            dispList.AddRow("Covenant UUID", rs.Covenant);
            dispList.AddRow("Convenant change Unix time", rs.CovenantChangedDateTime);
            dispList.AddRow("Disable collisions", rs.DisableCollisions);
            dispList.AddRow("Disable physics", rs.DisablePhysics);
            dispList.AddRow("Disable scripts", rs.DisableScripts);
            dispList.AddRow("Restrict pushing", rs.RestrictPushing);
            dispList.AddRow("Fixed sun", rs.FixedSun);
            dispList.AddRow("Sun position", rs.SunPosition);
            dispList.AddRow("Sun vector", rs.SunVector);
            dispList.AddRow("Use estate sun", rs.UseEstateSun);
            dispList.AddRow("Telehub UUID", rs.TelehubObject);
            dispList.AddRow("Terrain lower limit", string.Format("{0} m", rs.TerrainLowerLimit));
            dispList.AddRow("Terrain raise limit", string.Format("{0} m", rs.TerrainRaiseLimit));
            dispList.AddRow("Water height", string.Format("{0} m", rs.WaterHeight));

            dispList.AddRow("Maptile static file", ri.MaptileStaticFile);
            dispList.AddRow("Maptile static UUID", ri.MaptileStaticUUID);
            dispList.AddRow("Last map refresh", ri.lastMapRefresh);
            dispList.AddRow("Last map UUID", ri.lastMapUUID);

            dispList.AddToStringBuilder(sb);

            MainConsole.Instance.Output(sb.ToString());
        }
        private void HandleShowScene(string module, string[] cmd)
        {
            if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene))
                return;

            SimStatsReporter r = m_scene.StatsReporter;
            float[] stats = r.LastReportedSimStats;

            float timeDilation            = stats[0];
            float simFps                  = stats[1];
            float physicsFps              = stats[2];
            float agentUpdates            = stats[3];
            float rootAgents              = stats[4];
            float childAgents             = stats[5];
            float totalPrims              = stats[6];
            float activePrims             = stats[7];
            float totalFrameTime          = stats[8];
//            float netFrameTime            = stats.StatsBlock[9].StatValue; // Ignored - not used by OpenSimulator
            float physicsFrameTime        = stats[10];
            float otherFrameTime          = stats[11];
//            float imageFrameTime          = stats.StatsBlock[12].StatValue; // Ignored
            float inPacketsPerSecond      = stats[13];
            float outPacketsPerSecond     = stats[14];
            float unackedBytes            = stats[15];
//            float agentFrameTime          = stats.StatsBlock[16].StatValue; // Not really used
            float pendingDownloads        = stats[17];
            float pendingUploads          = stats[18];
            float activeScripts           = stats[19];
            float scriptLinesPerSecond    = stats[20];

            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("Scene statistics for {0}\n", m_scene.RegionInfo.RegionName);

            ConsoleDisplayList dispList = new ConsoleDisplayList();
            dispList.AddRow("Time Dilation", timeDilation);
            dispList.AddRow("Sim FPS", simFps);
            dispList.AddRow("Physics FPS", physicsFps);
            dispList.AddRow("Avatars", rootAgents);
            dispList.AddRow("Child agents", childAgents);
            dispList.AddRow("Total prims", totalPrims);
            dispList.AddRow("Scripts", activeScripts);
            dispList.AddRow("Script lines processed per second", scriptLinesPerSecond);
            dispList.AddRow("Physics enabled prims", activePrims);
            dispList.AddRow("Total frame time", totalFrameTime);
            dispList.AddRow("Physics frame time", physicsFrameTime);
            dispList.AddRow("Other frame time", otherFrameTime);
            dispList.AddRow("Agent Updates per second", agentUpdates);
            dispList.AddRow("Packets processed from clients per second", inPacketsPerSecond);
            dispList.AddRow("Packets sent to clients per second", outPacketsPerSecond);
            dispList.AddRow("Bytes unacknowledged by clients", unackedBytes);
            dispList.AddRow("Pending asset downloads to clients", pendingDownloads);
            dispList.AddRow("Pending asset uploads from clients", pendingUploads);

            dispList.AddToStringBuilder(sb);

            MainConsole.Instance.Output(sb.ToString());
        }
        private void GetAttachmentsReport(ScenePresence sp, StringBuilder sb)
        {
            sb.AppendFormat("Animations for {0}\n", sp.Name);

            ConsoleDisplayList cdl = new ConsoleDisplayList() { Indent = 2 };
            ScenePresenceAnimator spa = sp.Animator;
            AnimationSet anims = sp.Animator.Animations;

            string cma = spa.CurrentMovementAnimation;
            cdl.AddRow(
                "Current movement anim", 
                string.Format("{0}, {1}", DefaultAvatarAnimations.GetDefaultAnimation(cma), cma));

            UUID defaultAnimId = anims.DefaultAnimation.AnimID;
            cdl.AddRow(
                "Default anim", 
                string.Format("{0}, {1}", defaultAnimId, sp.Animator.GetAnimName(defaultAnimId)));

            UUID implicitDefaultAnimId = anims.ImplicitDefaultAnimation.AnimID;
            cdl.AddRow(
                "Implicit default anim", 
                string.Format("{0}, {1}", 
                    implicitDefaultAnimId, sp.Animator.GetAnimName(implicitDefaultAnimId)));

            cdl.AddToStringBuilder(sb);

            ConsoleDisplayTable cdt = new ConsoleDisplayTable() { Indent = 2 };
            cdt.AddColumn("Animation ID", 36);
            cdt.AddColumn("Name", 20);
            cdt.AddColumn("Seq", 3);
            cdt.AddColumn("Object ID", 36);

            UUID[] animIds;
            int[] sequenceNumbers;
            UUID[] objectIds;

            sp.Animator.Animations.GetArrays(out animIds, out sequenceNumbers, out objectIds);

            for (int i = 0; i < animIds.Length; i++)
            {
                UUID animId = animIds[i];
                string animName = sp.Animator.GetAnimName(animId);
                int seq = sequenceNumbers[i];
                UUID objectId = objectIds[i];

                cdt.AddRow(animId, animName, seq, objectId);
            }

            cdt.AddToStringBuilder(sb);
            sb.Append("\n");
        }