diff options
author | Justin Clark-Casey (justincc) | 2013-08-20 18:41:09 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-08-20 18:41:09 +0100 |
commit | a3e1b278a1d82e231f85bf0bf181ed79bbdaa7f2 (patch) | |
tree | ab031752a9ab84a0a89cb5d6e6d9f617c6304fa8 /OpenSim/Tools/pCampBot/BotManager.cs | |
parent | Add --regex options to "sit user name" and "stand user name" console commands... (diff) | |
download | opensim-SC-a3e1b278a1d82e231f85bf0bf181ed79bbdaa7f2.zip opensim-SC-a3e1b278a1d82e231f85bf0bf181ed79bbdaa7f2.tar.gz opensim-SC-a3e1b278a1d82e231f85bf0bf181ed79bbdaa7f2.tar.bz2 opensim-SC-a3e1b278a1d82e231f85bf0bf181ed79bbdaa7f2.tar.xz |
Add pCampbot "show bot" console command to show more detailed information on a particular bot (e.g. what sims they are connected to)
Diffstat (limited to 'OpenSim/Tools/pCampBot/BotManager.cs')
-rw-r--r-- | OpenSim/Tools/pCampBot/BotManager.cs | 49 |
1 files changed, 48 insertions, 1 deletions
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 | |||
208 | m_console.Commands.AddCommand( | 208 | m_console.Commands.AddCommand( |
209 | "bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowBotsStatus); | 209 | "bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowBotsStatus); |
210 | 210 | ||
211 | m_console.Commands.AddCommand( | ||
212 | "bot", false, "show bot", "show bot <first-name> <last-name>", | ||
213 | "Shows the detailed status and settings of a particular bot.", HandleShowBotStatus); | ||
214 | |||
211 | m_bots = new List<Bot>(); | 215 | m_bots = new List<Bot>(); |
212 | } | 216 | } |
213 | 217 | ||
@@ -549,7 +553,7 @@ namespace pCampBot | |||
549 | totals[pb.ConnectionState]++; | 553 | totals[pb.ConnectionState]++; |
550 | 554 | ||
551 | cdt.AddRow( | 555 | cdt.AddRow( |
552 | pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState, pb.ConnectionsCount); | 556 | pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState, pb.SimulatorsCount); |
553 | } | 557 | } |
554 | } | 558 | } |
555 | 559 | ||
@@ -563,6 +567,49 @@ namespace pCampBot | |||
563 | MainConsole.Instance.Output(cdl.ToString()); | 567 | MainConsole.Instance.Output(cdl.ToString()); |
564 | } | 568 | } |
565 | 569 | ||
570 | private void HandleShowBotStatus(string module, string[] cmd) | ||
571 | { | ||
572 | if (cmd.Length != 4) | ||
573 | { | ||
574 | MainConsole.Instance.Output("Usage: show bot <first-name> <last-name>"); | ||
575 | return; | ||
576 | } | ||
577 | |||
578 | string name = string.Format("{0} {1}", cmd[2], cmd[3]); | ||
579 | |||
580 | Bot bot; | ||
581 | |||
582 | lock (m_bots) | ||
583 | bot = m_bots.Find(b => b.Name == name); | ||
584 | |||
585 | if (bot == null) | ||
586 | { | ||
587 | MainConsole.Instance.Output("No bot found with name {0}", name); | ||
588 | return; | ||
589 | } | ||
590 | |||
591 | ConsoleDisplayList cdl = new ConsoleDisplayList(); | ||
592 | cdl.AddRow("Name", bot.Name); | ||
593 | cdl.AddRow("Status", bot.ConnectionState); | ||
594 | |||
595 | Simulator currentSim = bot.Client.Network.CurrentSim; | ||
596 | cdl.AddRow("Region", currentSim != null ? currentSim.Name : "(none)"); | ||
597 | |||
598 | List<Simulator> connectedSimulators = bot.Simulators; | ||
599 | List<string> simulatorNames = connectedSimulators.ConvertAll<string>(cs => cs.Name); | ||
600 | cdl.AddRow("Connections", string.Join(", ", simulatorNames)); | ||
601 | |||
602 | MainConsole.Instance.Output(cdl.ToString()); | ||
603 | |||
604 | MainConsole.Instance.Output("Settings"); | ||
605 | |||
606 | ConsoleDisplayList statusCdl = new ConsoleDisplayList(); | ||
607 | GridClient botClient = bot.Client; | ||
608 | statusCdl.AddRow("SEND_AGENT_UPDATES", botClient.Settings.SEND_AGENT_UPDATES); | ||
609 | |||
610 | MainConsole.Instance.Output(statusCdl.ToString()); | ||
611 | } | ||
612 | |||
566 | internal void Grid_GridRegion(object o, GridRegionEventArgs args) | 613 | internal void Grid_GridRegion(object o, GridRegionEventArgs args) |
567 | { | 614 | { |
568 | lock (RegionsKnown) | 615 | lock (RegionsKnown) |