Print out more information on connecting bots

0.7.4.1
Justin Clark-Casey (justincc) 2012-05-11 02:38:29 +01:00
parent f231ac39de
commit 480216f50f
2 changed files with 19 additions and 9 deletions

View File

@ -168,7 +168,7 @@ namespace pCampBot
b =>
{
Thread.Sleep(Random.Next(3000, 10000));
// m_log.DebugFormat("[pCAMPBOT]: For {0} performing action {1}", Name, b.GetType());
b.Action();
}

View File

@ -161,28 +161,34 @@ namespace pCampBot
Array.ForEach<string>(
cs.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b));
MainConsole.Instance.OutputFormat(
"[BOT MANAGER]: Starting {0} bots connecting to {1}, named {2} {3}_<n>",
botcount,
loginUri,
firstName,
lastNameStem);
MainConsole.Instance.OutputFormat("[BOT MANAGER]: Delay between logins is {0}ms", LoginDelay);
for (int i = 0; i < botcount; i++)
{
string lastName = string.Format("{0}_{1}", lastNameStem, i);
// We must give each bot its own list of instantiated behaviours since they store state.
List<IBehaviour> behaviours = new List<IBehaviour>();
// Hard-coded for now
if (behaviourSwitches.Contains("p"))
behaviours.Add(new PhysicsBehaviour());
if (behaviourSwitches.Contains("g"))
behaviours.Add(new GrabbingBehaviour());
if (behaviourSwitches.Contains("t"))
behaviours.Add(new TeleportBehaviour());
if (behaviourSwitches.Contains("c"))
behaviours.Add(new CrossBehaviour());
MainConsole.Instance.OutputFormat(
"[BOT MANAGER]: Bot {0} {1} configured for behaviours {2}",
firstName, lastName, string.Join(",", behaviours.ConvertAll<string>(b => b.Name).ToArray()));
StartBot(this, behaviours, firstName, lastName, password, loginUri);
}
@ -221,6 +227,10 @@ namespace pCampBot
BotManager bm, List<IBehaviour> behaviours,
string firstName, string lastName, string password, string loginUri)
{
MainConsole.Instance.OutputFormat(
"[BOT MANAGER]: Starting bot {0} {1}, behaviours are {2}",
firstName, lastName, string.Join(",", behaviours.ConvertAll<string>(b => b.Name).ToArray()));
Bot pb = new Bot(bm, behaviours, firstName, lastName, password, loginUri);
pb.OnConnected += handlebotEvent;