aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Tools/pCampBot/BotManager.cs70
1 files changed, 60 insertions, 10 deletions
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 157c69c..2cbadef 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -98,6 +98,46 @@ namespace pCampBot
98 public Dictionary<ulong, GridRegion> RegionsKnown { get; private set; } 98 public Dictionary<ulong, GridRegion> RegionsKnown { get; private set; }
99 99
100 /// <summary> 100 /// <summary>
101 /// First name for bots
102 /// </summary>
103 private string m_firstName;
104
105 /// <summary>
106 /// Last name stem for bots
107 /// </summary>
108 private string m_lastNameStem;
109
110 /// <summary>
111 /// Password for bots
112 /// </summary>
113 private string m_password;
114
115 /// <summary>
116 /// Login URI for bots.
117 /// </summary>
118 private string m_loginUri;
119
120 /// <summary>
121 /// Start location for bots.
122 /// </summary>
123 private string m_startUri;
124
125 /// <summary>
126 /// Postfix bot number at which bot sequence starts.
127 /// </summary>
128 private int m_fromBotNumber;
129
130 /// <summary>
131 /// Wear setting for bots.
132 /// </summary>
133 private string m_wearSetting;
134
135 /// <summary>
136 /// Behaviour switches for bots.
137 /// </summary>
138 private HashSet<string> m_behaviourSwitches = new HashSet<string>();
139
140 /// <summary>
101 /// Constructor Creates MainConsole.Instance to take commands and provide the place to write data 141 /// Constructor Creates MainConsole.Instance to take commands and provide the place to write data
102 /// </summary> 142 /// </summary>
103 public BotManager() 143 public BotManager()
@@ -163,20 +203,26 @@ namespace pCampBot
163 /// <param name="cs">The configuration for the bots to use</param> 203 /// <param name="cs">The configuration for the bots to use</param>
164 public void dobotStartup(int botcount, IConfig startupConfig) 204 public void dobotStartup(int botcount, IConfig startupConfig)
165 { 205 {
166 string firstName = startupConfig.GetString("firstname"); 206 m_firstName = startupConfig.GetString("firstname");
167 string lastNameStem = startupConfig.GetString("lastname"); 207 m_lastNameStem = startupConfig.GetString("lastname");
168 string password = startupConfig.GetString("password"); 208 m_password = startupConfig.GetString("password");
169 string loginUri = startupConfig.GetString("loginuri"); 209 m_loginUri = startupConfig.GetString("loginuri");
170 string startLocation = startupConfig.GetString("start", "last"); 210 m_fromBotNumber = startupConfig.GetInt("from", 0);
171 int fromBotNumber = startupConfig.GetInt("from", 0); 211 m_wearSetting = startupConfig.GetString("wear", "no");
172 string wearSetting = startupConfig.GetString("wear", "no");
173 212
174 string startUri = ParseInputStartLocationToUri(startLocation); 213 m_startUri = ParseInputStartLocationToUri(startupConfig.GetString("start", "last"));
175 214
176 HashSet<string> behaviourSwitches = new HashSet<string>();
177 Array.ForEach<string>( 215 Array.ForEach<string>(
178 startupConfig.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b)); 216 startupConfig.GetString("behaviours", "p").Split(new char[] { ',' }), b => m_behaviourSwitches.Add(b));
217
218 ConnectBots(
219 botcount, m_firstName, m_lastNameStem, m_password, m_loginUri, m_startUri, m_fromBotNumber, m_wearSetting, m_behaviourSwitches);
220 }
179 221
222 private void ConnectBots(
223 int botcount, string firstName, string lastNameStem, string password, string loginUri, string startUri, int fromBotNumber, string wearSetting,
224 HashSet<string> behaviourSwitches)
225 {
180 MainConsole.Instance.OutputFormat( 226 MainConsole.Instance.OutputFormat(
181 "[BOT MANAGER]: Starting {0} bots connecting to {1}, location {2}, named {3} {4}_<n>", 227 "[BOT MANAGER]: Starting {0} bots connecting to {1}, location {2}, named {3} {4}_<n>",
182 botcount, 228 botcount,
@@ -194,7 +240,11 @@ namespace pCampBot
194 lock (m_bots) 240 lock (m_bots)
195 { 241 {
196 if (DisconnectingBots) 242 if (DisconnectingBots)
243 {
244 MainConsole.Instance.Output(
245 "[BOT MANAGER]: Aborting bot connection due to user-initiated disconnection");
197 break; 246 break;
247 }
198 248
199 string lastName = string.Format("{0}_{1}", lastNameStem, i + fromBotNumber); 249 string lastName = string.Format("{0}_{1}", lastNameStem, i + fromBotNumber);
200 250