From a3e1b278a1d82e231f85bf0bf181ed79bbdaa7f2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 20 Aug 2013 18:41:09 +0100 Subject: Add pCampbot "show bot" console command to show more detailed information on a particular bot (e.g. what sims they are connected to) --- OpenSim/Tools/pCampBot/BotManager.cs | 49 +++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) (limited to 'OpenSim/Tools/pCampBot/BotManager.cs') diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index f5b5256..303c8dd 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -208,6 +208,10 @@ namespace pCampBot m_console.Commands.AddCommand( "bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowBotsStatus); + m_console.Commands.AddCommand( + "bot", false, "show bot", "show bot ", + "Shows the detailed status and settings of a particular bot.", HandleShowBotStatus); + m_bots = new List(); } @@ -549,7 +553,7 @@ namespace pCampBot totals[pb.ConnectionState]++; cdt.AddRow( - pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState, pb.ConnectionsCount); + pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState, pb.SimulatorsCount); } } @@ -563,6 +567,49 @@ namespace pCampBot MainConsole.Instance.Output(cdl.ToString()); } + private void HandleShowBotStatus(string module, string[] cmd) + { + if (cmd.Length != 4) + { + MainConsole.Instance.Output("Usage: show bot "); + return; + } + + string name = string.Format("{0} {1}", cmd[2], cmd[3]); + + Bot bot; + + lock (m_bots) + bot = m_bots.Find(b => b.Name == name); + + if (bot == null) + { + MainConsole.Instance.Output("No bot found with name {0}", name); + return; + } + + ConsoleDisplayList cdl = new ConsoleDisplayList(); + cdl.AddRow("Name", bot.Name); + cdl.AddRow("Status", bot.ConnectionState); + + Simulator currentSim = bot.Client.Network.CurrentSim; + cdl.AddRow("Region", currentSim != null ? currentSim.Name : "(none)"); + + List connectedSimulators = bot.Simulators; + List simulatorNames = connectedSimulators.ConvertAll(cs => cs.Name); + cdl.AddRow("Connections", string.Join(", ", simulatorNames)); + + MainConsole.Instance.Output(cdl.ToString()); + + MainConsole.Instance.Output("Settings"); + + ConsoleDisplayList statusCdl = new ConsoleDisplayList(); + GridClient botClient = bot.Client; + statusCdl.AddRow("SEND_AGENT_UPDATES", botClient.Settings.SEND_AGENT_UPDATES); + + MainConsole.Instance.Output(statusCdl.ToString()); + } + internal void Grid_GridRegion(object o, GridRegionEventArgs args) { lock (RegionsKnown) -- cgit v1.1