30 using System.Reflection;
31 using System.Threading;
35 using OpenSim.Framework;
36 using OpenSim.Framework.Console;
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54 public const string ConfigFileName =
"pCampBot.ini";
57 public static void Main(
string[] args)
59 XmlConfigurator.Configure();
61 IConfig commandLineConfig = ParseConfig(args);
62 if (commandLineConfig.Get(
"help") != null || commandLineConfig.Get(
"loginuri") == null)
67 commandLineConfig.Get(
"firstname") == null
68 || commandLineConfig.Get(
"lastname") == null
69 || commandLineConfig.Get(
"password") == null)
71 Console.WriteLine(
"ERROR: You must supply a firstname, lastname and password for the bots.");
77 string iniFilePath = Path.GetFullPath(Path.Combine(Util.configDir(), ConfigFileName));
79 if (
File.Exists(iniFilePath))
81 m_log.InfoFormat(
"[PCAMPBOT]: Reading configuration settings from {0}", iniFilePath);
83 IConfigSource configSource =
new IniConfigSource(iniFilePath);
85 IConfig botManagerConfig = configSource.Configs[
"BotManager"];
87 if (botManagerConfig != null)
89 bm.LoginDelay = botManagerConfig.GetInt(
"LoginDelay", bm.LoginDelay);
92 IConfig botConfig = configSource.Configs[
"Bot"];
94 if (botConfig != null)
96 bm.InitBotSendAgentUpdates
97 = botConfig.GetBoolean(
"SendAgentUpdates", bm.InitBotSendAgentUpdates);
98 bm.InitBotRequestObjectTextures
99 = botConfig.GetBoolean(
"RequestObjectTextures", bm.InitBotRequestObjectTextures);
103 int botcount = commandLineConfig.GetInt(
"botcount", 1);
104 bool startConnected = commandLineConfig.Get(
"connect") != null;
106 bm.CreateBots(botcount, commandLineConfig);
109 bm.ConnectBots(botcount);
115 MainConsole.Instance.Prompt();
119 m_log.ErrorFormat(
"Command error: {0}", e);
125 private static IConfig ParseConfig(String[] args)
128 ArgvConfigSource cs =
new ArgvConfigSource(args);
130 cs.AddSwitch(
"Startup",
"connect",
"c");
131 cs.AddSwitch(
"Startup",
"botcount",
"n");
132 cs.AddSwitch(
"Startup",
"from",
"f");
133 cs.AddSwitch(
"Startup",
"loginuri",
"l");
134 cs.AddSwitch(
"Startup",
"start",
"s");
135 cs.AddSwitch(
"Startup",
"firstname");
136 cs.AddSwitch(
"Startup",
"lastname");
137 cs.AddSwitch(
"Startup",
"password");
138 cs.AddSwitch(
"Startup",
"behaviours",
"b");
139 cs.AddSwitch(
"Startup",
"help",
"h");
140 cs.AddSwitch(
"Startup",
"wear");
142 IConfig ol = cs.Configs[
"Startup"];
146 private static void Help()
154 "Usage: pCampBot -loginuri <loginuri> -firstname <first-name> -lastname <last-name> -password <password> [OPTIONS]\n"
155 +
"Spawns a set of bots to test an OpenSim region\n\n"
156 +
" -l, -loginuri loginuri for grid/standalone (required)\n"
157 +
" -s, -start start location for bots (default: last) (optional). Can be \"last\", \"home\" or a specific location with or without co-ords (e.g. \"region1\" or \"region2/50/30/90\"\n"
158 +
" -firstname first name for the bots (required)\n"
159 +
" -lastname lastname for the bots (required). Each lastname will have _<bot-number> appended, e.g. Ima Bot_0\n"
160 +
" -password password for the bots (required)\n"
161 +
" -n, -botcount number of bots to start (default: 1) (optional)\n"
162 +
" -f, -from starting number for login bot names, e.g. 25 will login Ima Bot_25, Ima Bot_26, etc. (default: 0) (optional)\n"
163 +
" -c, -connect connect all bots at startup (optional)\n"
164 +
" -b, behaviours behaviours for bots. Comma separated, e.g. p,g (default: p) (optional)\n"
165 +
" current options are:\n"
166 +
" p (physics - bots constantly move and jump around)\n"
167 +
" g (grab - bots randomly click prims whether set clickable or not)\n"
168 +
" n (none - bots do nothing)\n"
169 +
" t (teleport - bots regularly teleport between regions on the grid)\n"
171 +
" -wear folder from which to load appearance data, \"no\" if there is no such folder (default: no) (optional)\n"
172 +
" -h, -help show this message.\n");
static void Main(string[] args)
EventType
Event Types from the BOT. Add new events here
Thread/Bot manager for the application