aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-08-19 19:38:20 +0100
committerJustin Clark-Casey (justincc)2013-08-19 19:38:20 +0100
commita90a5f52dd5f053a83a09fdd70ca08148ef641ce (patch)
treee3988b8959bce2c59ff33d46c730d755adeec1ed
parentRemove mono compiler warnings from UserProfilesModule (diff)
downloadopensim-SC_OLD-a90a5f52dd5f053a83a09fdd70ca08148ef641ce.zip
opensim-SC_OLD-a90a5f52dd5f053a83a09fdd70ca08148ef641ce.tar.gz
opensim-SC_OLD-a90a5f52dd5f053a83a09fdd70ca08148ef641ce.tar.bz2
opensim-SC_OLD-a90a5f52dd5f053a83a09fdd70ca08148ef641ce.tar.xz
Show number of connections each bot has established in "show bots" command.
-rw-r--r--OpenSim/Tools/pCampBot/Bot.cs15
-rw-r--r--OpenSim/Tools/pCampBot/BotManager.cs17
2 files changed, 24 insertions, 8 deletions
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs
index 32bf32b..be7a5a1 100644
--- a/OpenSim/Tools/pCampBot/Bot.cs
+++ b/OpenSim/Tools/pCampBot/Bot.cs
@@ -97,6 +97,19 @@ namespace pCampBot
97 /// </summary> 97 /// </summary>
98 public ConnectionState ConnectionState { get; private set; } 98 public ConnectionState ConnectionState { get; private set; }
99 99
100 /// <summary>
101 /// The number of connections that this bot has to different simulators.
102 /// </summary>
103 /// <value>Includes both root and child connections.</value>
104 public int ConnectionsCount
105 {
106 get
107 {
108 lock (Client.Network.Simulators)
109 return Client.Network.Simulators.Count;
110 }
111 }
112
100 public string FirstName { get; private set; } 113 public string FirstName { get; private set; }
101 public string LastName { get; private set; } 114 public string LastName { get; private set; }
102 public string Name { get; private set; } 115 public string Name { get; private set; }
@@ -144,7 +157,7 @@ namespace pCampBot
144 ConnectionState = ConnectionState.Disconnected; 157 ConnectionState = ConnectionState.Disconnected;
145 158
146 behaviours.ForEach(b => b.Initialize(this)); 159 behaviours.ForEach(b => b.Initialize(this));
147 160
148 Client = new GridClient(); 161 Client = new GridClient();
149 162
150 Random = new Random(Environment.TickCount);// We do stuff randomly here 163 Random = new Random(Environment.TickCount);// We do stuff randomly here
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index dee02c3..8f31bdf 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -395,8 +395,11 @@ namespace pCampBot
395 395
396 private void HandleShowStatus(string module, string[] cmd) 396 private void HandleShowStatus(string module, string[] cmd)
397 { 397 {
398 string outputFormat = "{0,-30} {1, -30} {2,-14}"; 398 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
399 MainConsole.Instance.OutputFormat(outputFormat, "Name", "Region", "Status"); 399 cdt.AddColumn("Name", 30);
400 cdt.AddColumn("Region", 30);
401 cdt.AddColumn("Status", 14);
402 cdt.AddColumn("Connections", 11);
400 403
401 Dictionary<ConnectionState, int> totals = new Dictionary<ConnectionState, int>(); 404 Dictionary<ConnectionState, int> totals = new Dictionary<ConnectionState, int>();
402 foreach (object o in Enum.GetValues(typeof(ConnectionState))) 405 foreach (object o in Enum.GetValues(typeof(ConnectionState)))
@@ -409,19 +412,19 @@ namespace pCampBot
409 Simulator currentSim = pb.Client.Network.CurrentSim; 412 Simulator currentSim = pb.Client.Network.CurrentSim;
410 totals[pb.ConnectionState]++; 413 totals[pb.ConnectionState]++;
411 414
412 MainConsole.Instance.OutputFormat( 415 cdt.AddRow(
413 outputFormat, 416 pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState, pb.ConnectionsCount);
414 pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState);
415 } 417 }
416 } 418 }
417 419
420 MainConsole.Instance.Output(cdt.ToString());
421
418 ConsoleDisplayList cdl = new ConsoleDisplayList(); 422 ConsoleDisplayList cdl = new ConsoleDisplayList();
419 423
420 foreach (KeyValuePair<ConnectionState, int> kvp in totals) 424 foreach (KeyValuePair<ConnectionState, int> kvp in totals)
421 cdl.AddRow(kvp.Key, kvp.Value); 425 cdl.AddRow(kvp.Key, kvp.Value);
422 426
423 427 MainConsole.Instance.Output(cdl.ToString());
424 MainConsole.Instance.OutputFormat("\n{0}", cdl.ToString());
425 } 428 }
426 429
427 /* 430 /*