diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs index 27c086ed63..d418288434 100644 --- a/OpenSim/Tools/pCampBot/Bot.cs +++ b/OpenSim/Tools/pCampBot/Bot.cs @@ -97,11 +97,20 @@ namespace pCampBot /// public ConnectionState ConnectionState { get; private set; } + public List Simulators + { + get + { + lock (Client.Network.Simulators) + return new List(Client.Network.Simulators); + } + } + /// /// The number of connections that this bot has to different simulators. /// /// Includes both root and child connections. - public int ConnectionsCount + public int SimulatorsCount { get { diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index f5b5256d7b..303c8dd878 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)