diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index 614b350011..0aaa226bcb 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -53,7 +53,7 @@ namespace pCampBot protected bool m_verbose = true; protected Random somthing = new Random(Environment.TickCount); protected int numbots = 0; - protected IConfig Previous_config; + private IConfig Config; /// /// Constructor Creates MainConsole.Instance to take commands and provide the place to write data @@ -81,16 +81,16 @@ namespace pCampBot m_console.Commands.AddCommand("bot", false, "shutdown", "shutdown", - "Gracefully shut down bots", HandleShutdown); + "Shutdown bots and exit", HandleShutdown); m_console.Commands.AddCommand("bot", false, "quit", "quit", - "Force quit (DANGEROUS, try shutdown first)", + "Shutdown bots and exit", HandleShutdown); - m_console.Commands.AddCommand("bot", false, "add bots", - "add bots ", - "Add more bots", HandleAddBots); +// m_console.Commands.AddCommand("bot", false, "add bots", +// "add bots ", +// "Add more bots", HandleAddBots); m_lBot = new List(); } @@ -102,71 +102,64 @@ namespace pCampBot /// The configuration for the bots to use public void dobotStartup(int botcount, IConfig cs) { - Previous_config = cs; + Config = cs; m_td = new Thread[botcount]; + + string firstName = cs.GetString("firstname"); + string lastNameStem = cs.GetString("lastname"); + string password = cs.GetString("password"); + string loginUri = cs.GetString("loginuri"); + for (int i = 0; i < botcount; i++) { - startupBot(i, cs); + string lastName = string.Format("{0}_{1}", lastNameStem, i); + startupBot(i, cs, firstName, lastName, password, loginUri); } } - /// - /// Add additional bots (and threads) to our bot pool - /// - /// How Many of them to add - public void addbots(int botcount) - { - int len = m_td.Length; - Thread[] m_td2 = new Thread[len + botcount]; - for (int i = 0; i < len; i++) - { - m_td2[i] = m_td[i]; - } - m_td = m_td2; - int newlen = len + botcount; - for (int i = len; i < newlen; i++) - { - startupBot(i, Previous_config); - } - } +// /// +// /// Add additional bots (and threads) to our bot pool +// /// +// /// How Many of them to add +// public void addbots(int botcount) +// { +// int len = m_td.Length; +// Thread[] m_td2 = new Thread[len + botcount]; +// for (int i = 0; i < len; i++) +// { +// m_td2[i] = m_td[i]; +// } +// m_td = m_td2; +// int newlen = len + botcount; +// for (int i = len; i < newlen; i++) +// { +// startupBot(i, Config); +// } +// } /// /// This starts up the bot and stores the thread for the bot in the thread array /// /// The position in the thread array to stick the bot's thread /// Configuration of the bot - public void startupBot(int pos, IConfig cs) + /// First name + /// Last name + /// Password + /// Login URI + public void startupBot(int pos, IConfig cs, string firstName, string lastName, string password, string loginUri) { - PhysicsBot pb = new PhysicsBot(cs); + PhysicsBot pb = new PhysicsBot(cs, firstName, lastName, password, loginUri); pb.OnConnected += handlebotEvent; pb.OnDisconnected += handlebotEvent; - if (cs.GetString("firstname", "random") == "random") pb.firstname = CreateRandomName(); - if (cs.GetString("lastname", "random") == "random") pb.lastname = CreateRandomName(); m_td[pos] = new Thread(pb.startup); - m_td[pos].Name = "CampBot_" + pos; + m_td[pos].Name = pb.Name; m_td[pos].IsBackground = true; m_td[pos].Start(); m_lBot.Add(pb); } - /// - /// Creates a random name for the bot - /// - /// - private string CreateRandomName() - { - string returnstring = ""; - string chars = "abcdefghijklmnopqrstuvwxyz0123456789"; - - for (int i = 0; i < 7; i++) - { - returnstring += chars.Substring(somthing.Next(chars.Length),1); - } - return returnstring; - } - /// /// High level connnected/disconnected events so we can keep track of our threads by proxy /// @@ -177,14 +170,14 @@ namespace pCampBot switch (eventt) { case EventType.CONNECTED: - m_log.Info("[ " + callbot.firstname + " " + callbot.lastname + "]: Connected"); + m_log.Info("[" + callbot.FirstName + " " + callbot.LastName + "]: Connected"); numbots++; break; case EventType.DISCONNECTED: - m_log.Info("[ " + callbot.firstname + " " + callbot.lastname + "]: Disconnected"); + m_log.Info("[" + callbot.FirstName + " " + callbot.LastName + "]: Disconnected"); m_td[m_lBot.IndexOf(callbot)].Abort(); numbots--; - if (numbots >1) + if (numbots <= 0) Environment.Exit(0); break; } @@ -223,17 +216,17 @@ namespace pCampBot Environment.Exit(0); } */ - - private void HandleAddBots(string module, string[] cmd) - { - int newbots = 0; - - if (cmd.Length > 2) - { - Int32.TryParse(cmd[2], out newbots); - } - if (newbots > 0) - addbots(newbots); - } +// +// private void HandleAddBots(string module, string[] cmd) +// { +// int newbots = 0; +// +// if (cmd.Length > 2) +// { +// Int32.TryParse(cmd[2], out newbots); +// } +// if (newbots > 0) +// addbots(newbots); +// } } } diff --git a/OpenSim/Tools/pCampBot/PhysicsBot.cs b/OpenSim/Tools/pCampBot/PhysicsBot.cs index 5d4af3144c..1531b27f40 100644 --- a/OpenSim/Tools/pCampBot/PhysicsBot.cs +++ b/OpenSim/Tools/pCampBot/PhysicsBot.cs @@ -45,10 +45,11 @@ namespace pCampBot public delegate void AnEvent(PhysicsBot callbot, EventType someevent); // event delegate for bot events public IConfig startupConfig; // bot config, passed from BotManager - public string firstname; - public string lastname; - public string password; - public string loginURI; + public string FirstName { get; private set; } + public string LastName { get; private set; } + public string Name { get; private set; } + public string Password { get; private set; } + public string LoginUri { get; private set; } public string saveDir; public string wear; @@ -60,16 +61,28 @@ namespace pCampBot protected Random somthing = new Random(Environment.TickCount);// We do stuff randomly here - //New instance of a SecondLife client + /// + /// New instance of a SecondLife client + /// public GridClient client = new GridClient(); protected string[] talkarray; + /// - /// + /// Constructor /// - /// nini config for the bot - public PhysicsBot(IConfig bsconfig) + /// + /// + /// + /// + /// + public PhysicsBot(IConfig bsconfig, string firstName, string lastName, string password, string loginUri) { + FirstName = firstName; + LastName = lastName; + Name = string.Format("{0} {1}", FirstName, LastName); + Password = password; + LoginUri = loginUri; startupConfig = bsconfig; readconfig(); talkarray = readexcuses(); @@ -116,10 +129,6 @@ namespace pCampBot /// public void readconfig() { - firstname = startupConfig.GetString("firstname", "random"); - lastname = startupConfig.GetString("lastname", "random"); - password = startupConfig.GetString("password", "12345"); - loginURI = startupConfig.GetString("loginuri"); wear = startupConfig.GetString("wear","no"); } @@ -136,7 +145,7 @@ namespace pCampBot /// public void startup() { - client.Settings.LOGIN_SERVER = loginURI; + client.Settings.LOGIN_SERVER = LoginUri; client.Settings.ALWAYS_DECODE_OBJECTS = false; client.Settings.AVATAR_TRACKING = false; client.Settings.OBJECT_TRACKING = false; @@ -153,10 +162,10 @@ namespace pCampBot client.Throttle.Total = 400000; client.Network.LoginProgress += this.Network_LoginProgress; client.Network.SimConnected += this.Network_SimConnected; - client.Network.Disconnected += this.Network_OnDisconnected; +// client.Network.Disconnected += this.Network_OnDisconnected; client.Objects.ObjectUpdate += Objects_NewPrim; //client.Assets.OnAssetReceived += Asset_ReceivedCallback; - if (client.Network.Login(firstname, lastname, password, "pCampBot", "Your name")) + if (client.Network.Login(FirstName, LastName, Password, "pCampBot", "Your name")) { if (OnConnected != null) { @@ -165,7 +174,7 @@ namespace pCampBot m_action.AutoReset = false; m_action.Elapsed += new ElapsedEventHandler(m_action_Elapsed); m_action.Start(); - OnConnected(this, EventType.CONNECTED); +// OnConnected(this, EventType.CONNECTED); if (wear == "save") { client.Appearance.SetPreviousAppearance(); @@ -180,7 +189,9 @@ namespace pCampBot } else { - MainConsole.Instance.Output(firstname + " " + lastname + " Can't login: " + client.Network.LoginMessage); + MainConsole.Instance.OutputFormat( + "{0} {1} cannot login: {2}", FirstName, LastName, client.Network.LoginMessage); + if (OnDisconnected != null) { OnDisconnected(this, EventType.DISCONNECTED); @@ -190,7 +201,7 @@ namespace pCampBot public void SaveDefaultAppearance() { - saveDir = "MyAppearance/" + firstname + "_" + lastname; + saveDir = "MyAppearance/" + FirstName + "_" + LastName; if (!Directory.Exists(saveDir)) { Directory.CreateDirectory(saveDir); @@ -384,6 +395,7 @@ namespace pCampBot { client.Assets.RequestImage(prim.Textures.DefaultTexture.TextureID, ImageType.Normal, Asset_TextureCallback_Texture); } + for (int i = 0; i < prim.Textures.FaceTextures.Length; i++) { if (prim.Textures.FaceTextures[i] != null) @@ -392,10 +404,10 @@ namespace pCampBot { client.Assets.RequestImage(prim.Textures.FaceTextures[i].TextureID, ImageType.Normal, Asset_TextureCallback_Texture); } - } } } + if (prim.Sculpt.SculptTexture != UUID.Zero) { client.Assets.RequestImage(prim.Sculpt.SculptTexture, ImageType.Normal, Asset_TextureCallback_Texture); diff --git a/OpenSim/Tools/pCampBot/README.txt b/OpenSim/Tools/pCampBot/README.txt index 7ecbde1ba9..c4fcf3393a 100644 --- a/OpenSim/Tools/pCampBot/README.txt +++ b/OpenSim/Tools/pCampBot/README.txt @@ -1,10 +1,13 @@ This is the PhysicsCamperbot libslBot tester. -This is designed to be run in standalone mode with authorize accounts -turned off as a way to stress test the simulator. It creates -clients that log in, randomly jump/walk around, and say excuses from +This is designed to stress test the simulator. It creates +clients that log in, randomly jump/walk around, and can say excuses from the BOFH. +Bots must have accounts already created. Each bot will have the same firstname and password +but their lastname will be appended with _ starting from 0. So if you have two bots called ima bot, their +first names will be ima_bot_0 and ima_bot_1. + *** WARNING *** Using this bot on a public grid could get you banned permanently, so just say No! to griefing! @@ -21,19 +24,8 @@ pCampBot.exe will end up in the regular opensim/bin folder ----- Running the bot ----- -windows: pCampBot.exe -botcount -loginuri -*nix: mono pCampBot.exe -botcount -loginuri - -The names it produces are random by default, however, you can specify -either a firstname or a lastname in the command line also. - -ex: pCampBot.exe -botcount -loginuri -lastname - -If you specify both a firstname *and* a lastname, you'll likely run -into trouble unless you're only running a single bot. In that case, -there's also a password option. - -pCampBot.exe -botcount 1 -loginuri http://somegrid.com:8002 -firstname SomeDude -lastname SomeDude -password GobbleDeGook +windows: pCampBot.exe -botcount -loginuri -firstname -lastname -password +*nix: mono pCampBot.exe -botcount -loginuri -firstname -lastname -password ----- Commands ----- @@ -41,4 +33,3 @@ The bot has console commands: help - lists the console commands and what they do shutdown - gracefully shuts down the bots quit - forcefully shuts things down leaving stuff unclean - 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 77110bf6b8..a69fbf03c9 100644 --- a/OpenSim/Tools/pCampBot/pCampBot.cs +++ b/OpenSim/Tools/pCampBot/pCampBot.cs @@ -95,9 +95,9 @@ namespace pCampBot "Spawns a set of bots to test an OpenSim region\n\n" + " -l, -loginuri loginuri for sim to log into (required)\n" + " -n, -botcount number of bots to start (default: 1)\n" + - " -firstname first name for the bot(s) (default: random string)\n" + - " -lastname lastname for the bot(s) (default: random string)\n" + - " -password password for the bots(s) (default: random string)\n" + + " -firstname first name for the bots\n" + + " -lastname lastname for the bots. Each lastname will have _ appended, e.g. Ima Bot_0\n" + + " -password password for the bots\n" + " -wear set appearance folder to load from (default: no)\n" + " -h, -help show this message" ); diff --git a/bin/PumaCode.SvnDotNet.dll b/bin/PumaCode.SvnDotNet.dll deleted file mode 100755 index ff91789f3d..0000000000 Binary files a/bin/PumaCode.SvnDotNet.dll and /dev/null differ