diff options
Merge branch 'master' of git://opensimulator.org/git/opensim
Diffstat (limited to 'OpenSim/Tools/pCampBot/BotManager.cs')
-rw-r--r-- | OpenSim/Tools/pCampBot/BotManager.cs | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index 0aaa226..03bb820 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs | |||
@@ -53,13 +53,20 @@ namespace pCampBot | |||
53 | protected bool m_verbose = true; | 53 | protected bool m_verbose = true; |
54 | protected Random somthing = new Random(Environment.TickCount); | 54 | protected Random somthing = new Random(Environment.TickCount); |
55 | protected int numbots = 0; | 55 | protected int numbots = 0; |
56 | private IConfig Config; | 56 | public IConfig Config { get; private set; } |
57 | |||
58 | /// <summary> | ||
59 | /// Track the assets we have and have not received so we don't endlessly repeat requests. | ||
60 | /// </summary> | ||
61 | public Dictionary<UUID, bool> AssetsReceived { get; private set; } | ||
57 | 62 | ||
58 | /// <summary> | 63 | /// <summary> |
59 | /// Constructor Creates MainConsole.Instance to take commands and provide the place to write data | 64 | /// Constructor Creates MainConsole.Instance to take commands and provide the place to write data |
60 | /// </summary> | 65 | /// </summary> |
61 | public BotManager() | 66 | public BotManager() |
62 | { | 67 | { |
68 | AssetsReceived = new Dictionary<UUID, bool>(); | ||
69 | |||
63 | m_console = CreateConsole(); | 70 | m_console = CreateConsole(); |
64 | MainConsole.Instance = m_console; | 71 | MainConsole.Instance = m_console; |
65 | 72 | ||
@@ -113,7 +120,7 @@ namespace pCampBot | |||
113 | for (int i = 0; i < botcount; i++) | 120 | for (int i = 0; i < botcount; i++) |
114 | { | 121 | { |
115 | string lastName = string.Format("{0}_{1}", lastNameStem, i); | 122 | string lastName = string.Format("{0}_{1}", lastNameStem, i); |
116 | startupBot(i, cs, firstName, lastName, password, loginUri); | 123 | startupBot(i, this, firstName, lastName, password, loginUri); |
117 | } | 124 | } |
118 | } | 125 | } |
119 | 126 | ||
@@ -146,9 +153,9 @@ namespace pCampBot | |||
146 | /// <param name="lastName">Last name</param> | 153 | /// <param name="lastName">Last name</param> |
147 | /// <param name="password">Password</param> | 154 | /// <param name="password">Password</param> |
148 | /// <param name="loginUri">Login URI</param> | 155 | /// <param name="loginUri">Login URI</param> |
149 | public void startupBot(int pos, IConfig cs, string firstName, string lastName, string password, string loginUri) | 156 | public void startupBot(int pos, BotManager bm, string firstName, string lastName, string password, string loginUri) |
150 | { | 157 | { |
151 | PhysicsBot pb = new PhysicsBot(cs, firstName, lastName, password, loginUri); | 158 | PhysicsBot pb = new PhysicsBot(bm, firstName, lastName, password, loginUri); |
152 | 159 | ||
153 | pb.OnConnected += handlebotEvent; | 160 | pb.OnConnected += handlebotEvent; |
154 | pb.OnDisconnected += handlebotEvent; | 161 | pb.OnDisconnected += handlebotEvent; |
@@ -165,18 +172,20 @@ namespace pCampBot | |||
165 | /// </summary> | 172 | /// </summary> |
166 | /// <param name="callbot"></param> | 173 | /// <param name="callbot"></param> |
167 | /// <param name="eventt"></param> | 174 | /// <param name="eventt"></param> |
168 | public void handlebotEvent(PhysicsBot callbot, EventType eventt) | 175 | private void handlebotEvent(PhysicsBot callbot, EventType eventt) |
169 | { | 176 | { |
170 | switch (eventt) | 177 | switch (eventt) |
171 | { | 178 | { |
172 | case EventType.CONNECTED: | 179 | case EventType.CONNECTED: |
173 | m_log.Info("[" + callbot.FirstName + " " + callbot.LastName + "]: Connected"); | 180 | m_log.Info("[" + callbot.FirstName + " " + callbot.LastName + "]: Connected"); |
174 | numbots++; | 181 | numbots++; |
182 | // m_log.InfoFormat("NUMBOTS {0}", numbots); | ||
175 | break; | 183 | break; |
176 | case EventType.DISCONNECTED: | 184 | case EventType.DISCONNECTED: |
177 | m_log.Info("[" + callbot.FirstName + " " + callbot.LastName + "]: Disconnected"); | 185 | m_log.Info("[" + callbot.FirstName + " " + callbot.LastName + "]: Disconnected"); |
178 | m_td[m_lBot.IndexOf(callbot)].Abort(); | 186 | m_td[m_lBot.IndexOf(callbot)].Abort(); |
179 | numbots--; | 187 | numbots--; |
188 | // m_log.InfoFormat("NUMBOTS {0}", numbots); | ||
180 | if (numbots <= 0) | 189 | if (numbots <= 0) |
181 | Environment.Exit(0); | 190 | Environment.Exit(0); |
182 | break; | 191 | break; |