diff options
Diffstat (limited to 'OpenSim/Tools/pCampBot/pCampBot.cs')
-rw-r--r-- | OpenSim/Tools/pCampBot/pCampBot.cs | 72 |
1 files changed, 51 insertions, 21 deletions
diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs index 2707a49..b02f917 100644 --- a/OpenSim/Tools/pCampBot/pCampBot.cs +++ b/OpenSim/Tools/pCampBot/pCampBot.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.IO; | ||
29 | using System.Reflection; | 30 | using System.Reflection; |
30 | using System.Threading; | 31 | using System.Threading; |
31 | using log4net; | 32 | using log4net; |
@@ -50,28 +51,52 @@ namespace pCampBot | |||
50 | { | 51 | { |
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | 53 | ||
54 | public const string ConfigFileName = "pCampbot.ini"; | ||
55 | |||
53 | [STAThread] | 56 | [STAThread] |
54 | public static void Main(string[] args) | 57 | public static void Main(string[] args) |
55 | { | 58 | { |
56 | XmlConfigurator.Configure(); | 59 | XmlConfigurator.Configure(); |
57 | 60 | ||
58 | IConfig config = ParseConfig(args); | 61 | IConfig commandLineConfig = ParseConfig(args); |
59 | if (config.Get("help") != null || config.Get("loginuri") == null) | 62 | if (commandLineConfig.Get("help") != null || commandLineConfig.Get("loginuri") == null) |
60 | { | 63 | { |
61 | Help(); | 64 | Help(); |
62 | } | 65 | } |
63 | else if (config.Get("firstname") == null || config.Get("lastname") == null || config.Get("password") == null) | 66 | else if ( |
67 | commandLineConfig.Get("firstname") == null | ||
68 | || commandLineConfig.Get("lastname") == null | ||
69 | || commandLineConfig.Get("password") == null) | ||
64 | { | 70 | { |
65 | Console.WriteLine("ERROR: You must supply a firstname, lastname and password for the bots."); | 71 | Console.WriteLine("ERROR: You must supply a firstname, lastname and password for the bots."); |
66 | } | 72 | } |
67 | else | 73 | else |
68 | { | 74 | { |
69 | int botcount = config.GetInt("botcount", 1); | ||
70 | |||
71 | BotManager bm = new BotManager(); | 75 | BotManager bm = new BotManager(); |
72 | 76 | ||
77 | string iniFilePath = Path.GetFullPath(Path.Combine(Util.configDir(), ConfigFileName)); | ||
78 | |||
79 | if (File.Exists(iniFilePath)) | ||
80 | { | ||
81 | m_log.InfoFormat("[PCAMPBOT]: Reading configuration settings from {0}", iniFilePath); | ||
82 | |||
83 | IConfigSource configSource = new IniConfigSource(iniFilePath); | ||
84 | |||
85 | IConfig botConfig = configSource.Configs["Bot"]; | ||
86 | |||
87 | if (botConfig != null) | ||
88 | { | ||
89 | bm.InitBotSendAgentUpdates | ||
90 | = botConfig.GetBoolean("SendAgentUpdates", bm.InitBotSendAgentUpdates); | ||
91 | bm.InitBotRequestObjectTextures | ||
92 | = botConfig.GetBoolean("RequestObjectTextures", bm.InitBotRequestObjectTextures); | ||
93 | } | ||
94 | } | ||
95 | |||
96 | int botcount = commandLineConfig.GetInt("botcount", 1); | ||
97 | |||
73 | //startup specified number of bots. 1 is the default | 98 | //startup specified number of bots. 1 is the default |
74 | Thread startBotThread = new Thread(o => bm.dobotStartup(botcount, config)); | 99 | Thread startBotThread = new Thread(o => bm.dobotStartup(botcount, commandLineConfig)); |
75 | startBotThread.Name = "Initial start bots thread"; | 100 | startBotThread.Name = "Initial start bots thread"; |
76 | startBotThread.Start(); | 101 | startBotThread.Start(); |
77 | 102 | ||
@@ -95,7 +120,9 @@ namespace pCampBot | |||
95 | ArgvConfigSource cs = new ArgvConfigSource(args); | 120 | ArgvConfigSource cs = new ArgvConfigSource(args); |
96 | 121 | ||
97 | cs.AddSwitch("Startup", "botcount", "n"); | 122 | cs.AddSwitch("Startup", "botcount", "n"); |
123 | cs.AddSwitch("Startup", "from", "f"); | ||
98 | cs.AddSwitch("Startup", "loginuri", "l"); | 124 | cs.AddSwitch("Startup", "loginuri", "l"); |
125 | cs.AddSwitch("Startup", "start", "s"); | ||
99 | cs.AddSwitch("Startup", "firstname"); | 126 | cs.AddSwitch("Startup", "firstname"); |
100 | cs.AddSwitch("Startup", "lastname"); | 127 | cs.AddSwitch("Startup", "lastname"); |
101 | cs.AddSwitch("Startup", "password"); | 128 | cs.AddSwitch("Startup", "password"); |
@@ -113,23 +140,26 @@ namespace pCampBot | |||
113 | // You can either say no, to not load anything, yes, to load one of the default wearables, a folder | 140 | // You can either say no, to not load anything, yes, to load one of the default wearables, a folder |
114 | // name, to load an specific folder, or save, to save an avatar with some already existing wearables | 141 | // name, to load an specific folder, or save, to save an avatar with some already existing wearables |
115 | // worn to the folder MyAppearance/FirstName_LastName, and the load it. | 142 | // worn to the folder MyAppearance/FirstName_LastName, and the load it. |
143 | |||
116 | Console.WriteLine( | 144 | Console.WriteLine( |
117 | "usage: pCampBot <-loginuri loginuri> [OPTIONS]\n" + | 145 | "usage: pCampBot <-loginuri loginuri> [OPTIONS]\n" |
118 | "Spawns a set of bots to test an OpenSim region\n\n" + | 146 | + "Spawns a set of bots to test an OpenSim region\n\n" |
119 | " -l, -loginuri loginuri for sim to log into (required)\n" + | 147 | + " -l, -loginuri loginuri for grid/standalone (required)\n" |
120 | " -n, -botcount number of bots to start (default: 1)\n" + | 148 | + " -s, -start optional start location for bots. Can be \"last\", \"home\" or a specific location with or without co-ords (e.g. \"region1\" or \"region2/50/30/90\"\n" |
121 | " -firstname first name for the bots\n" + | 149 | + " -firstname first name for the bots\n" |
122 | " -lastname lastname for the bots. Each lastname will have _<bot-number> appended, e.g. Ima Bot_0\n" + | 150 | + " -lastname lastname for the bots. Each lastname will have _<bot-number> appended, e.g. Ima Bot_0\n" |
123 | " -password password for the bots\n" + | 151 | + " -password password for the bots\n" |
124 | " -b, behaviours behaviours for bots. Comma separated, e.g. p,g. Default is p\n" + | 152 | + " -n, -botcount optional number of bots to start (default: 1)\n" |
125 | " current options are:\n" + | 153 | + " -f, -from optional starting number for login bot names, e.g. 25 will login Ima Bot_25, Ima Bot_26, etc. (default: 0)" |
126 | " p (physics - bots constantly move and jump around)\n" + | 154 | + " -b, behaviours behaviours for bots. Comma separated, e.g. p,g. Default is p\n" |
127 | " g (grab - bots randomly click prims whether set clickable or not)\n" + | 155 | + " current options are:\n" |
128 | " n (none - bots do nothing)\n" + | 156 | + " p (physics - bots constantly move and jump around)\n" |
129 | " t (teleport - bots regularly teleport between regions on the grid)\n" + | 157 | + " g (grab - bots randomly click prims whether set clickable or not)\n" |
158 | + " n (none - bots do nothing)\n" | ||
159 | + " t (teleport - bots regularly teleport between regions on the grid)\n" | ||
130 | // " c (cross)" + | 160 | // " c (cross)" + |
131 | " -wear set appearance folder to load from (default: no)\n" + | 161 | + " -wear optional folder from which to load appearance data, \"no\" if there is no such folder (default: no)\n" |
132 | " -h, -help show this message"); | 162 | + " -h, -help show this message.\n"); |
133 | } | 163 | } |
134 | } | 164 | } |
135 | } | 165 | } |