aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tools/pCampBot
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Tools/pCampBot')
-rw-r--r--OpenSim/Tools/pCampBot/BotManager.cs169
-rw-r--r--OpenSim/Tools/pCampBot/PhysicsBot.cs171
-rw-r--r--OpenSim/Tools/pCampBot/README.txt25
-rw-r--r--OpenSim/Tools/pCampBot/pCampBot.cs6
4 files changed, 219 insertions, 152 deletions
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 614b350..b05bd6d 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -49,17 +49,22 @@ namespace pCampBot
49 49
50 protected CommandConsole m_console; 50 protected CommandConsole m_console;
51 protected List<PhysicsBot> m_lBot; 51 protected List<PhysicsBot> m_lBot;
52 protected Thread[] m_td;
53 protected bool m_verbose = true;
54 protected Random somthing = new Random(Environment.TickCount); 52 protected Random somthing = new Random(Environment.TickCount);
55 protected int numbots = 0; 53 protected int numbots = 0;
56 protected IConfig Previous_config; 54 public IConfig Config { get; private set; }
55
56 /// <summary>
57 /// Track the assets we have and have not received so we don't endlessly repeat requests.
58 /// </summary>
59 public Dictionary<UUID, bool> AssetsReceived { get; private set; }
57 60
58 /// <summary> 61 /// <summary>
59 /// Constructor Creates MainConsole.Instance to take commands and provide the place to write data 62 /// Constructor Creates MainConsole.Instance to take commands and provide the place to write data
60 /// </summary> 63 /// </summary>
61 public BotManager() 64 public BotManager()
62 { 65 {
66 AssetsReceived = new Dictionary<UUID, bool>();
67
63 m_console = CreateConsole(); 68 m_console = CreateConsole();
64 MainConsole.Instance = m_console; 69 MainConsole.Instance = m_console;
65 70
@@ -81,16 +86,21 @@ namespace pCampBot
81 86
82 m_console.Commands.AddCommand("bot", false, "shutdown", 87 m_console.Commands.AddCommand("bot", false, "shutdown",
83 "shutdown", 88 "shutdown",
84 "Gracefully shut down bots", HandleShutdown); 89 "Shutdown bots and exit", HandleShutdown);
85 90
86 m_console.Commands.AddCommand("bot", false, "quit", 91 m_console.Commands.AddCommand("bot", false, "quit",
87 "quit", 92 "quit",
88 "Force quit (DANGEROUS, try shutdown first)", 93 "Shutdown bots and exit",
89 HandleShutdown); 94 HandleShutdown);
90 95
91 m_console.Commands.AddCommand("bot", false, "add bots", 96 m_console.Commands.AddCommand("bot", false, "show status",
92 "add bots <number>", 97 "show status",
93 "Add more bots", HandleAddBots); 98 "Shows the status of all bots",
99 HandleShowStatus);
100
101// m_console.Commands.AddCommand("bot", false, "add bots",
102// "add bots <number>",
103// "Add more bots", HandleAddBots);
94 104
95 m_lBot = new List<PhysicsBot>(); 105 m_lBot = new List<PhysicsBot>();
96 } 106 }
@@ -102,69 +112,63 @@ namespace pCampBot
102 /// <param name="cs">The configuration for the bots to use</param> 112 /// <param name="cs">The configuration for the bots to use</param>
103 public void dobotStartup(int botcount, IConfig cs) 113 public void dobotStartup(int botcount, IConfig cs)
104 { 114 {
105 Previous_config = cs; 115 Config = cs;
106 m_td = new Thread[botcount]; 116
117 string firstName = cs.GetString("firstname");
118 string lastNameStem = cs.GetString("lastname");
119 string password = cs.GetString("password");
120 string loginUri = cs.GetString("loginuri");
121
107 for (int i = 0; i < botcount; i++) 122 for (int i = 0; i < botcount; i++)
108 { 123 {
109 startupBot(i, cs); 124 string lastName = string.Format("{0}_{1}", lastNameStem, i);
125 startupBot(i, this, firstName, lastName, password, loginUri);
110 } 126 }
111 } 127 }
112 128
113 /// <summary> 129// /// <summary>
114 /// Add additional bots (and threads) to our bot pool 130// /// Add additional bots (and threads) to our bot pool
115 /// </summary> 131// /// </summary>
116 /// <param name="botcount">How Many of them to add</param> 132// /// <param name="botcount">How Many of them to add</param>
117 public void addbots(int botcount) 133// public void addbots(int botcount)
118 { 134// {
119 int len = m_td.Length; 135// int len = m_td.Length;
120 Thread[] m_td2 = new Thread[len + botcount]; 136// Thread[] m_td2 = new Thread[len + botcount];
121 for (int i = 0; i < len; i++) 137// for (int i = 0; i < len; i++)
122 { 138// {
123 m_td2[i] = m_td[i]; 139// m_td2[i] = m_td[i];
124 } 140// }
125 m_td = m_td2; 141// m_td = m_td2;
126 int newlen = len + botcount; 142// int newlen = len + botcount;
127 for (int i = len; i < newlen; i++) 143// for (int i = len; i < newlen; i++)
128 { 144// {
129 startupBot(i, Previous_config); 145// startupBot(i, Config);
130 } 146// }
131 } 147// }
132 148
133 /// <summary> 149 /// <summary>
134 /// This starts up the bot and stores the thread for the bot in the thread array 150 /// This starts up the bot and stores the thread for the bot in the thread array
135 /// </summary> 151 /// </summary>
136 /// <param name="pos">The position in the thread array to stick the bot's thread</param> 152 /// <param name="pos">The position in the thread array to stick the bot's thread</param>
137 /// <param name="cs">Configuration of the bot</param> 153 /// <param name="cs">Configuration of the bot</param>
138 public void startupBot(int pos, IConfig cs) 154 /// <param name="firstName">First name</param>
155 /// <param name="lastName">Last name</param>
156 /// <param name="password">Password</param>
157 /// <param name="loginUri">Login URI</param>
158 public void startupBot(int pos, BotManager bm, string firstName, string lastName, string password, string loginUri)
139 { 159 {
140 PhysicsBot pb = new PhysicsBot(cs); 160 PhysicsBot pb = new PhysicsBot(bm, firstName, lastName, password, loginUri);
141 161
142 pb.OnConnected += handlebotEvent; 162 pb.OnConnected += handlebotEvent;
143 pb.OnDisconnected += handlebotEvent; 163 pb.OnDisconnected += handlebotEvent;
144 if (cs.GetString("firstname", "random") == "random") pb.firstname = CreateRandomName();
145 if (cs.GetString("lastname", "random") == "random") pb.lastname = CreateRandomName();
146
147 m_td[pos] = new Thread(pb.startup);
148 m_td[pos].Name = "CampBot_" + pos;
149 m_td[pos].IsBackground = true;
150 m_td[pos].Start();
151 m_lBot.Add(pb);
152 }
153 164
154 /// <summary> 165 lock (m_lBot)
155 /// Creates a random name for the bot 166 m_lBot.Add(pb);
156 /// </summary>
157 /// <returns></returns>
158 private string CreateRandomName()
159 {
160 string returnstring = "";
161 string chars = "abcdefghijklmnopqrstuvwxyz0123456789";
162 167
163 for (int i = 0; i < 7; i++) 168 Thread pbThread = new Thread(pb.startup);
164 { 169 pbThread.Name = pb.Name;
165 returnstring += chars.Substring(somthing.Next(chars.Length),1); 170 pbThread.IsBackground = true;
166 } 171 pbThread.Start();
167 return returnstring;
168 } 172 }
169 173
170 /// <summary> 174 /// <summary>
@@ -172,19 +176,20 @@ namespace pCampBot
172 /// </summary> 176 /// </summary>
173 /// <param name="callbot"></param> 177 /// <param name="callbot"></param>
174 /// <param name="eventt"></param> 178 /// <param name="eventt"></param>
175 public void handlebotEvent(PhysicsBot callbot, EventType eventt) 179 private void handlebotEvent(PhysicsBot callbot, EventType eventt)
176 { 180 {
177 switch (eventt) 181 switch (eventt)
178 { 182 {
179 case EventType.CONNECTED: 183 case EventType.CONNECTED:
180 m_log.Info("[ " + callbot.firstname + " " + callbot.lastname + "]: Connected"); 184 m_log.Info("[" + callbot.FirstName + " " + callbot.LastName + "]: Connected");
181 numbots++; 185 numbots++;
186// m_log.InfoFormat("NUMBOTS {0}", numbots);
182 break; 187 break;
183 case EventType.DISCONNECTED: 188 case EventType.DISCONNECTED:
184 m_log.Info("[ " + callbot.firstname + " " + callbot.lastname + "]: Disconnected"); 189 m_log.Info("[" + callbot.FirstName + " " + callbot.LastName + "]: Disconnected");
185 m_td[m_lBot.IndexOf(callbot)].Abort();
186 numbots--; 190 numbots--;
187 if (numbots >1) 191// m_log.InfoFormat("NUMBOTS {0}", numbots);
192 if (numbots <= 0)
188 Environment.Exit(0); 193 Environment.Exit(0);
189 break; 194 break;
190 } 195 }
@@ -195,10 +200,9 @@ namespace pCampBot
195 /// </summary> 200 /// </summary>
196 public void doBotShutdown() 201 public void doBotShutdown()
197 { 202 {
198 foreach (PhysicsBot pb in m_lBot) 203 lock (m_lBot)
199 { 204 foreach (PhysicsBot pb in m_lBot)
200 pb.shutdown(); 205 pb.shutdown();
201 }
202 } 206 }
203 207
204 /// <summary> 208 /// <summary>
@@ -216,6 +220,21 @@ namespace pCampBot
216 doBotShutdown(); 220 doBotShutdown();
217 } 221 }
218 222
223 private void HandleShowStatus(string module, string[] cmd)
224 {
225 string outputFormat = "{0,-30} {1,-14}";
226 MainConsole.Instance.OutputFormat(outputFormat, "Name", "Status");
227
228 lock (m_lBot)
229 {
230 foreach (PhysicsBot pb in m_lBot)
231 {
232 MainConsole.Instance.OutputFormat(
233 outputFormat, pb.Name, (pb.IsConnected ? "Connected" : "Disconnected"));
234 }
235 }
236 }
237
219 /* 238 /*
220 private void HandleQuit(string module, string[] cmd) 239 private void HandleQuit(string module, string[] cmd)
221 { 240 {
@@ -223,17 +242,17 @@ namespace pCampBot
223 Environment.Exit(0); 242 Environment.Exit(0);
224 } 243 }
225 */ 244 */
226 245//
227 private void HandleAddBots(string module, string[] cmd) 246// private void HandleAddBots(string module, string[] cmd)
228 { 247// {
229 int newbots = 0; 248// int newbots = 0;
230 249//
231 if (cmd.Length > 2) 250// if (cmd.Length > 2)
232 { 251// {
233 Int32.TryParse(cmd[2], out newbots); 252// Int32.TryParse(cmd[2], out newbots);
234 } 253// }
235 if (newbots > 0) 254// if (newbots > 0)
236 addbots(newbots); 255// addbots(newbots);
237 } 256// }
238 } 257 }
239} 258}
diff --git a/OpenSim/Tools/pCampBot/PhysicsBot.cs b/OpenSim/Tools/pCampBot/PhysicsBot.cs
index 5d4af31..a8b2426 100644
--- a/OpenSim/Tools/pCampBot/PhysicsBot.cs
+++ b/OpenSim/Tools/pCampBot/PhysicsBot.cs
@@ -29,56 +29,85 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using System.IO; 31using System.IO;
32using System.Reflection;
32using System.Threading; 33using System.Threading;
33using System.Timers; 34using System.Timers;
35using log4net;
34using OpenMetaverse; 36using OpenMetaverse;
35using OpenMetaverse.Assets; 37using OpenMetaverse.Assets;
36using Nini.Config; 38using Nini.Config;
37using OpenSim.Framework; 39using OpenSim.Framework;
38using OpenSim.Framework.Console; 40using OpenSim.Framework.Console;
39using Timer=System.Timers.Timer; 41using Timer = System.Timers.Timer;
40 42
41namespace pCampBot 43namespace pCampBot
42{ 44{
43 public class PhysicsBot 45 public class PhysicsBot
44 { 46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48
45 public delegate void AnEvent(PhysicsBot callbot, EventType someevent); // event delegate for bot events 49 public delegate void AnEvent(PhysicsBot callbot, EventType someevent); // event delegate for bot events
46 public IConfig startupConfig; // bot config, passed from BotManager
47 50
48 public string firstname; 51 public BotManager BotManager { get; private set; }
49 public string lastname; 52 private IConfig startupConfig; // bot config, passed from BotManager
50 public string password; 53
51 public string loginURI; 54 /// <summary>
55 /// Is this bot connected to the grid?
56 /// </summary>
57 public bool IsConnected { get; private set; }
58
59 public string FirstName { get; private set; }
60 public string LastName { get; private set; }
61 public string Name { get; private set; }
62 public string Password { get; private set; }
63 public string LoginUri { get; private set; }
52 public string saveDir; 64 public string saveDir;
53 public string wear; 65 public string wear;
54 66
55 public event AnEvent OnConnected; 67 public event AnEvent OnConnected;
56 public event AnEvent OnDisconnected; 68 public event AnEvent OnDisconnected;
57 69
58 protected Timer m_action; // Action Timer 70 /// <summary>
71 /// Keep a track of the continuously acting thread so that we can abort it.
72 /// </summary>
73 private Thread m_actionThread;
74
59 protected List<uint> objectIDs = new List<uint>(); 75 protected List<uint> objectIDs = new List<uint>();
60 76
61 protected Random somthing = new Random(Environment.TickCount);// We do stuff randomly here 77 protected Random somthing = new Random(Environment.TickCount);// We do stuff randomly here
62 78
63 //New instance of a SecondLife client 79 /// <summary>
80 /// New instance of a SecondLife client
81 /// </summary>
64 public GridClient client = new GridClient(); 82 public GridClient client = new GridClient();
65 83
66 protected string[] talkarray; 84 protected string[] talkarray;
85
67 /// <summary> 86 /// <summary>
68 /// 87 /// Constructor
69 /// </summary> 88 /// </summary>
70 /// <param name="bsconfig">nini config for the bot</param> 89 /// <param name="bm"></param>
71 public PhysicsBot(IConfig bsconfig) 90 /// <param name="firstName"></param>
91 /// <param name="lastName"></param>
92 /// <param name="password"></param>
93 /// <param name="loginUri"></param>
94 public PhysicsBot(BotManager bm, string firstName, string lastName, string password, string loginUri)
72 { 95 {
73 startupConfig = bsconfig; 96 FirstName = firstName;
97 LastName = lastName;
98 Name = string.Format("{0} {1}", FirstName, LastName);
99 Password = password;
100 LoginUri = loginUri;
101
102 BotManager = bm;
103 startupConfig = bm.Config;
74 readconfig(); 104 readconfig();
75 talkarray = readexcuses(); 105 talkarray = readexcuses();
76 } 106 }
77 107
78 //We do our actions here. This is where one would 108 //We do our actions here. This is where one would
79 //add additional steps and/or things the bot should do 109 //add additional steps and/or things the bot should do
80 110 private void Action()
81 void m_action_Elapsed(object sender, ElapsedEventArgs e)
82 { 111 {
83 while (true) 112 while (true)
84 { 113 {
@@ -95,11 +124,11 @@ namespace pCampBot
95 } 124 }
96 125
97 // TODO: unused: Vector3 pos = client.Self.SimPosition; 126 // TODO: unused: Vector3 pos = client.Self.SimPosition;
98 Vector3 newpos = new Vector3(somthing.Next(255), somthing.Next(255), somthing.Next(255)); 127 Vector3 newpos = new Vector3(somthing.Next(1, 254), somthing.Next(1, 254), somthing.Next(1, 254));
99 client.Self.Movement.TurnToward(newpos); 128 client.Self.Movement.TurnToward(newpos);
100 129
101 client.Self.Movement.AtPos = true; 130 client.Self.Movement.AtPos = true;
102 Thread.Sleep(somthing.Next(3000,13000)); 131 Thread.Sleep(somthing.Next(3000, 13000));
103 client.Self.Movement.AtPos = false; 132 client.Self.Movement.AtPos = false;
104 client.Self.Jump(true); 133 client.Self.Jump(true);
105 134
@@ -116,10 +145,6 @@ namespace pCampBot
116 /// </summary> 145 /// </summary>
117 public void readconfig() 146 public void readconfig()
118 { 147 {
119 firstname = startupConfig.GetString("firstname", "random");
120 lastname = startupConfig.GetString("lastname", "random");
121 password = startupConfig.GetString("password", "12345");
122 loginURI = startupConfig.GetString("loginuri");
123 wear = startupConfig.GetString("wear","no"); 148 wear = startupConfig.GetString("wear","no");
124 } 149 }
125 150
@@ -128,6 +153,9 @@ namespace pCampBot
128 /// </summary> 153 /// </summary>
129 public void shutdown() 154 public void shutdown()
130 { 155 {
156 if (m_actionThread != null)
157 m_actionThread.Abort();
158
131 client.Network.Logout(); 159 client.Network.Logout();
132 } 160 }
133 161
@@ -136,7 +164,7 @@ namespace pCampBot
136 /// </summary> 164 /// </summary>
137 public void startup() 165 public void startup()
138 { 166 {
139 client.Settings.LOGIN_SERVER = loginURI; 167 client.Settings.LOGIN_SERVER = LoginUri;
140 client.Settings.ALWAYS_DECODE_OBJECTS = false; 168 client.Settings.ALWAYS_DECODE_OBJECTS = false;
141 client.Settings.AVATAR_TRACKING = false; 169 client.Settings.AVATAR_TRACKING = false;
142 client.Settings.OBJECT_TRACKING = false; 170 client.Settings.OBJECT_TRACKING = false;
@@ -155,32 +183,32 @@ namespace pCampBot
155 client.Network.SimConnected += this.Network_SimConnected; 183 client.Network.SimConnected += this.Network_SimConnected;
156 client.Network.Disconnected += this.Network_OnDisconnected; 184 client.Network.Disconnected += this.Network_OnDisconnected;
157 client.Objects.ObjectUpdate += Objects_NewPrim; 185 client.Objects.ObjectUpdate += Objects_NewPrim;
158 //client.Assets.OnAssetReceived += Asset_ReceivedCallback; 186
159 if (client.Network.Login(firstname, lastname, password, "pCampBot", "Your name")) 187 if (client.Network.Login(FirstName, LastName, Password, "pCampBot", "Your name"))
160 { 188 {
161 if (OnConnected != null) 189 IsConnected = true;
190
191 Thread.Sleep(somthing.Next(1000, 10000));
192 m_actionThread = new Thread(Action);
193 m_actionThread.Start();
194
195// OnConnected(this, EventType.CONNECTED);
196 if (wear == "save")
162 { 197 {
163 m_action = new Timer(somthing.Next(1000, 10000)); 198 client.Appearance.SetPreviousAppearance();
164 m_action.Enabled = true; 199 SaveDefaultAppearance();
165 m_action.AutoReset = false; 200 }
166 m_action.Elapsed += new ElapsedEventHandler(m_action_Elapsed); 201 else if (wear != "no")
167 m_action.Start(); 202 {
168 OnConnected(this, EventType.CONNECTED); 203 MakeDefaultAppearance(wear);
169 if (wear == "save")
170 {
171 client.Appearance.SetPreviousAppearance();
172 SaveDefaultAppearance();
173 }
174 else if (wear != "no")
175 {
176 MakeDefaultAppearance(wear);
177 }
178 client.Self.Jump(true);
179 } 204 }
205 client.Self.Jump(true);
180 } 206 }
181 else 207 else
182 { 208 {
183 MainConsole.Instance.Output(firstname + " " + lastname + " Can't login: " + client.Network.LoginMessage); 209 MainConsole.Instance.OutputFormat(
210 "{0} {1} cannot login: {2}", FirstName, LastName, client.Network.LoginMessage);
211
184 if (OnDisconnected != null) 212 if (OnDisconnected != null)
185 { 213 {
186 OnDisconnected(this, EventType.DISCONNECTED); 214 OnDisconnected(this, EventType.DISCONNECTED);
@@ -190,7 +218,7 @@ namespace pCampBot
190 218
191 public void SaveDefaultAppearance() 219 public void SaveDefaultAppearance()
192 { 220 {
193 saveDir = "MyAppearance/" + firstname + "_" + lastname; 221 saveDir = "MyAppearance/" + FirstName + "_" + LastName;
194 if (!Directory.Exists(saveDir)) 222 if (!Directory.Exists(saveDir))
195 { 223 {
196 Directory.CreateDirectory(saveDir); 224 Directory.CreateDirectory(saveDir);
@@ -216,7 +244,7 @@ namespace pCampBot
216 { 244 {
217 if (asset.Decode()) 245 if (asset.Decode())
218 { 246 {
219 File.WriteAllBytes(Path.Combine(saveDir, String.Format("{1}.{0}", 247 File.WriteAllBytes(Path.Combine(saveDir, String.Format("{1}.{0}",
220 asset.AssetType.ToString().ToLower(), 248 asset.AssetType.ToString().ToLower(),
221 asset.WearableType)), asset.AssetData); 249 asset.WearableType)), asset.AssetData);
222 } 250 }
@@ -366,8 +394,21 @@ namespace pCampBot
366 394
367 public void Network_OnDisconnected(object sender, DisconnectedEventArgs args) 395 public void Network_OnDisconnected(object sender, DisconnectedEventArgs args)
368 { 396 {
369 if (OnDisconnected != null) 397// m_log.ErrorFormat("Fired Network_OnDisconnected");
398
399// if (
400// (args.Reason == NetworkManager.DisconnectType.SimShutdown
401// || args.Reason == NetworkManager.DisconnectType.NetworkTimeout)
402// && OnDisconnected != null)
403
404 if (
405 (args.Reason == NetworkManager.DisconnectType.ClientInitiated
406 || args.Reason == NetworkManager.DisconnectType.ServerInitiated
407 || args.Reason == NetworkManager.DisconnectType.NetworkTimeout)
408 && OnDisconnected != null)
409// if (OnDisconnected != null)
370 { 410 {
411 IsConnected = false;
371 OnDisconnected(this, EventType.DISCONNECTED); 412 OnDisconnected(this, EventType.DISCONNECTED);
372 } 413 }
373 } 414 }
@@ -382,39 +423,55 @@ namespace pCampBot
382 { 423 {
383 if (prim.Textures.DefaultTexture.TextureID != UUID.Zero) 424 if (prim.Textures.DefaultTexture.TextureID != UUID.Zero)
384 { 425 {
385 client.Assets.RequestImage(prim.Textures.DefaultTexture.TextureID, ImageType.Normal, Asset_TextureCallback_Texture); 426 GetTexture(prim.Textures.DefaultTexture.TextureID);
386 } 427 }
428
387 for (int i = 0; i < prim.Textures.FaceTextures.Length; i++) 429 for (int i = 0; i < prim.Textures.FaceTextures.Length; i++)
388 { 430 {
389 if (prim.Textures.FaceTextures[i] != null) 431 UUID textureID = prim.Textures.FaceTextures[i].TextureID;
390 {
391 if (prim.Textures.FaceTextures[i].TextureID != UUID.Zero)
392 {
393 client.Assets.RequestImage(prim.Textures.FaceTextures[i].TextureID, ImageType.Normal, Asset_TextureCallback_Texture);
394 }
395 432
433 if (textureID != null && textureID != UUID.Zero)
434 {
435 GetTexture(textureID);
396 } 436 }
397 } 437 }
398 } 438 }
439
399 if (prim.Sculpt.SculptTexture != UUID.Zero) 440 if (prim.Sculpt.SculptTexture != UUID.Zero)
400 { 441 {
401 client.Assets.RequestImage(prim.Sculpt.SculptTexture, ImageType.Normal, Asset_TextureCallback_Texture); 442 GetTexture(prim.Sculpt.SculptTexture);
402 } 443 }
403 } 444 }
404 } 445 }
405 446
447 private void GetTexture(UUID textureID)
448 {
449 lock (BotManager.AssetsReceived)
450 {
451 // Don't request assets more than once.
452 if (BotManager.AssetsReceived.ContainsKey(textureID))
453 return;
454
455 BotManager.AssetsReceived[textureID] = false;
456 client.Assets.RequestImage(textureID, ImageType.Normal, Asset_TextureCallback_Texture);
457 }
458 }
459
406 460
407 public void Asset_TextureCallback_Texture(TextureRequestState state, AssetTexture assetTexture) 461 public void Asset_TextureCallback_Texture(TextureRequestState state, AssetTexture assetTexture)
408 { 462 {
409 //TODO: Implement texture saving and applying 463 //TODO: Implement texture saving and applying
410 } 464 }
411 465
412 public void Asset_ReceivedCallback(AssetDownload transfer,Asset asset) 466 public void Asset_ReceivedCallback(AssetDownload transfer, Asset asset)
413 { 467 {
414 if (wear == "save") 468 lock (BotManager.AssetsReceived)
415 { 469 BotManager.AssetsReceived[asset.AssetID] = true;
416 SaveAsset((AssetWearable) asset); 470
417 } 471// if (wear == "save")
472// {
473// SaveAsset((AssetWearable) asset);
474// }
418 } 475 }
419 476
420 public string[] readexcuses() 477 public string[] readexcuses()
diff --git a/OpenSim/Tools/pCampBot/README.txt b/OpenSim/Tools/pCampBot/README.txt
index 7ecbde1..c4fcf33 100644
--- a/OpenSim/Tools/pCampBot/README.txt
+++ b/OpenSim/Tools/pCampBot/README.txt
@@ -1,10 +1,13 @@
1This is the PhysicsCamperbot libslBot tester. 1This is the PhysicsCamperbot libslBot tester.
2 2
3This is designed to be run in standalone mode with authorize accounts 3This is designed to stress test the simulator. It creates <N>
4turned off as a way to stress test the simulator. It creates <N> 4clients that log in, randomly jump/walk around, and can say excuses from
5clients that log in, randomly jump/walk around, and say excuses from
6the BOFH. 5the BOFH.
7 6
7Bots must have accounts already created. Each bot will have the same firstname and password
8but their lastname will be appended with _<bot-number> starting from 0. So if you have two bots called ima bot, their
9first names will be ima_bot_0 and ima_bot_1.
10
8*** WARNING *** 11*** WARNING ***
9Using this bot on a public grid could get you banned permanently, so 12Using this bot on a public grid could get you banned permanently, so
10just say No! to griefing! 13just say No! to griefing!
@@ -21,19 +24,8 @@ pCampBot.exe will end up in the regular opensim/bin folder
21 24
22----- Running the bot ----- 25----- Running the bot -----
23 26
24windows: pCampBot.exe -botcount <N> -loginuri <URI> 27windows: pCampBot.exe -botcount <N> -loginuri <URI> -firstname <bot-first-name> -lastname <bot-last-name-stem> -password <bot-password>
25*nix: mono pCampBot.exe -botcount <N> -loginuri <URI> 28*nix: mono pCampBot.exe -botcount <N> -loginuri <URI> -firstname <bot-first-name> -lastname <bot-last-name-stem> -password <bot-password>
26
27The names it produces are random by default, however, you can specify
28either a firstname or a lastname in the command line also.
29
30ex: pCampBot.exe -botcount <N> -loginuri <URI> -lastname <lastname>
31
32If you specify both a firstname *and* a lastname, you'll likely run
33into trouble unless you're only running a single bot. In that case,
34there's also a password option.
35
36pCampBot.exe -botcount 1 -loginuri http://somegrid.com:8002 -firstname SomeDude -lastname SomeDude -password GobbleDeGook
37 29
38----- Commands ----- 30----- Commands -----
39 31
@@ -41,4 +33,3 @@ The bot has console commands:
41 help - lists the console commands and what they do 33 help - lists the console commands and what they do
42 shutdown - gracefully shuts down the bots 34 shutdown - gracefully shuts down the bots
43 quit - forcefully shuts things down leaving stuff unclean 35 quit - forcefully shuts things down leaving stuff unclean
44 addbots N - adds N number of random bots. (replace 'N' with a number)
diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs
index 77110bf..a69fbf0 100644
--- a/OpenSim/Tools/pCampBot/pCampBot.cs
+++ b/OpenSim/Tools/pCampBot/pCampBot.cs
@@ -95,9 +95,9 @@ namespace pCampBot
95 "Spawns a set of bots to test an OpenSim region\n\n" + 95 "Spawns a set of bots to test an OpenSim region\n\n" +
96 " -l, -loginuri loginuri for sim to log into (required)\n" + 96 " -l, -loginuri loginuri for sim to log into (required)\n" +
97 " -n, -botcount number of bots to start (default: 1)\n" + 97 " -n, -botcount number of bots to start (default: 1)\n" +
98 " -firstname first name for the bot(s) (default: random string)\n" + 98 " -firstname first name for the bots\n" +
99 " -lastname lastname for the bot(s) (default: random string)\n" + 99 " -lastname lastname for the bots. Each lastname will have _<bot-number> appended, e.g. Ima Bot_0\n" +
100 " -password password for the bots(s) (default: random string)\n" + 100 " -password password for the bots\n" +
101 " -wear set appearance folder to load from (default: no)\n" + 101 " -wear set appearance folder to load from (default: no)\n" +
102 " -h, -help show this message" 102 " -h, -help show this message"
103 ); 103 );