jackpoz / BotFarm

Application used to spawn WoW automated players compatible with 3.3.5a version only.
GNU General Public License v2.0
84 stars 68 forks source link

Unhandled Exception: System.IndexOutOfRangeException #13

Closed ghost closed 9 years ago

ghost commented 9 years ago

Using your uploaded files @ https://ci.appveyor.com/project/jackpoz/botfarm/build/artifacts, BotFarm will not get past this point in the startup process. The same happens if I compile the source in VS2013 Update 5, following the guide by compiling the CLI source first and then use the cli.dll in the C# source before compiling BotFarm.sln - looks OK for the x64 compile, no errors and no warnings.

Only thing that changes is the path to the source files in the output in the BotFarm console window:

Waiting for BotFactory account to login
botfarm - Authentication succeeded!
botfarm - Requesting realm list

Unhandled Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Client.AutomatedGame.PresentRealmList(WorldServerList realmList) in c:\projects\botfarm\Client\AutomatedGame.cs:line 204
   at Client.Authentication.Network.AuthSocket.ReadCallback(IAsyncResult result) in c:\projects\botfarm\Client\Authentication\Network\AuthSocket.cs:line 365
   at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Net.ContextAwareResult.Complete(IntPtr userToken)
   at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
   at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

Configuration file BotFarm.exe.config : http://pastebin.com/UuPCbihJ (absolute path to map, vmap & mmap folders, correct account info etc.)

Below is the output from a Debug compile. Not sure if the extra info is more useful than the above.

Waiting for BotFactory account to login
botfarm - Authentication succeeded!
botfarm - Requesting realm list

Unhandled Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Client.Authentication.WorldServerList.get_Item(Int32 index) in c:\Build\BotFarm_x64\Client\Authentication\WorldServerList.cs:line 25
   at Client.AutomatedGame.PresentRealmList(WorldServerList realmList) in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 204
   at Client.Authentication.Network.AuthSocket.HandleRealmList() in c:\Build\BotFarm_x64\Client\Authentication\Network\AuthSocket.cs:line 319
   at Client.Authentication.Network.AuthSocket.ReadCallback(IAsyncResult result) in c:\Build\BotFarm_x64\Client\Authentication\Network\AuthSocket.cs:line 365
   at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Net.ContextAwareResult.Complete(IntPtr userToken)
   at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
   at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
jackpoz commented 9 years ago
<setting name="RealmID" serializeAs="String">
    <value>1</value>
</setting>

is this value correct ? if you have only 1 realm than you want to specify 0 there instead of 1

ghost commented 9 years ago

OK. I thought the realm ID would be 1 for the first realm, like in auth.realmlist.id, reading the value from the database. I will test it again with 0 instead then.


OK, it worked. Don't know why I did not try that before. Why does it say "Unknown account name" on some of the lines?

Waiting for BotFactory account to login
botfarm - Authentication succeeded!
botfarm - Requesting realm list
botfarm - Connecting to realm Trinity
Setting up bot factory with 5 bots
Creating new bot
Creating new bot
Creating new bot
Creating new bot
Creating new bot
BOT1365667768 - Connecting to realmlist...
BOT468557332 - Connecting to realmlist...
BOT287047341 - Connecting to realmlist...
BOT40867380 - Connecting to realmlist...
BOT1815253304 - Connecting to realmlist...
BOT1815253304 - Unknown account name
BOT1365667768 - Unknown account name
BOT40867380 - Unknown account name
BOT468557332 - Unknown account name
BOT287047341 - Unknown account name
Finished setting up bot factory with 5 bots in 00:00:01.0521350

I created the accounts admin, admins, botfarm, before running the BotFarm files and made sure that there is at least 1 character in the account on each of them.

ghost commented 9 years ago

By the way, does this console output look normal, that it will look like this even if everything is correct?

botfarm - Server has closed the connection
botfarm - Authentication succeeded!
botfarm - Requesting realm list
botfarm - Connecting to realm Trinity
botfarm - An item with the same key has already been added.    at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Client.AutomatedGame.UpdateObjectHandler.HandleUpdateData() in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 796
   at Client.AutomatedGame.UpdateObjectHandler.HandleUpdatePacket(InPacket packet) in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 620
   at Client.AutomatedGame.HandleCompressedUpdateObject(InPacket packet) in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 497
   at Client.World.Network.WorldSocket.HandlePacket(InPacket packet) in c:\Build\BotFarm_x64\Client\World\Network\WorldSocket.cs:line 386
botfarm - An item with the same key has already been added.    at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Client.AutomatedGame.UpdateObjectHandler.HandleUpdateData() in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 796
   at Client.AutomatedGame.UpdateObjectHandler.HandleUpdatePacket(InPacket packet) in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 620
   at Client.AutomatedGame.HandleCompressedUpdateObject(InPacket packet) in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 497
   at Client.World.Network.WorldSocket.HandlePacket(InPacket packet) in c:\Build\BotFarm_x64\Client\World\Network\WorldSocket.cs:line 386
botfarm - An item with the same key has already been added.    at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Client.AutomatedGame.UpdateObjectHandler.HandleUpdateData() in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 796
   at Client.AutomatedGame.UpdateObjectHandler.HandleUpdatePacket(InPacket packet) in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 620
   at Client.AutomatedGame.HandleCompressedUpdateObject(InPacket packet) in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 497
   at Client.World.Network.WorldSocket.HandlePacket(InPacket packet) in c:\Build\BotFarm_x64\Client\World\Network\WorldSocket.cs:line 386
botfarm - The given key was not present in the dictionary.    at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Client.AutomatedGame.UpdateObjectHandler.HandleMonsterMovementPacket(InPacket packet) in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 639
   at Client.AutomatedGame.HandleMonsterMove(InPacket packet) in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 503
   at Client.World.Network.WorldSocket.HandlePacket(InPacket packet) in c:\Build\BotFarm_x64\Client\World\Network\WorldSocket.cs:line 386
botfarm - The given key was not present in the dictionary.    at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Client.AutomatedGame.UpdateObjectHandler.HandleMonsterMovementPacket(InPacket packet) in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 639
   at Client.AutomatedGame.HandleMonsterMove(InPacket packet) in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 503
   at Client.World.Network.WorldSocket.HandlePacket(InPacket packet) in c:\Build\BotFarm_x64\Client\World\Network\WorldSocket.cs:line 386
botfarm - Server has closed the connection
botfarm - Authentication succeeded!
botfarm - Requesting realm list
botfarm - Connecting to realm Trinity
botfarm - An item with the same key has already been added.    at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Client.AutomatedGame.UpdateObjectHandler.HandleUpdateData() in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 796
   at Client.AutomatedGame.UpdateObjectHandler.HandleUpdatePacket(InPacket packet) in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 620
   at Client.AutomatedGame.HandleCompressedUpdateObject(InPacket packet) in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 497
   at Client.World.Network.WorldSocket.HandlePacket(InPacket packet) in c:\Build\BotFarm_x64\Client\World\Network\WorldSocket.cs:line 386
botfarm - An item with the same key has already been added.    at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Client.AutomatedGame.UpdateObjectHandler.HandleUpdateData() in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 796
   at Client.AutomatedGame.UpdateObjectHandler.HandleUpdatePacket(InPacket packet) in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 620
   at Client.AutomatedGame.HandleCompressedUpdateObject(InPacket packet) in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 497
   at Client.World.Network.WorldSocket.HandlePacket(InPacket packet) in c:\Build\BotFarm_x64\Client\World\Network\WorldSocket.cs:line 386
botfarm - An item with the same key has already been added.    at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Client.AutomatedGame.UpdateObjectHandler.HandleUpdateData() in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 796
   at Client.AutomatedGame.UpdateObjectHandler.HandleUpdatePacket(InPacket packet) in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 620
   at Client.AutomatedGame.HandleCompressedUpdateObject(InPacket packet) in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 497
   at Client.World.Network.WorldSocket.HandlePacket(InPacket packet) in c:\Build\BotFarm_x64\Client\World\Network\WorldSocket.cs:line 386
botfarm - Server has closed the connection
botfarm - Authentication succeeded!
botfarm - Requesting realm list
botfarm - Connecting to realm Trinity
botfarm - An item with the same key has already been added.    at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Client.AutomatedGame.UpdateObjectHandler.HandleUpdateData() in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 796
   at Client.AutomatedGame.UpdateObjectHandler.HandleUpdatePacket(InPacket packet) in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 620
   at Client.AutomatedGame.HandleCompressedUpdateObject(InPacket packet) in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 497
   at Client.World.Network.WorldSocket.HandlePacket(InPacket packet) in c:\Build\BotFarm_x64\Client\World\Network\WorldSocket.cs:line 386
botfarm - An item with the same key has already been added.    at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Client.AutomatedGame.UpdateObjectHandler.HandleUpdateData() in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 796
   at Client.AutomatedGame.UpdateObjectHandler.HandleUpdatePacket(InPacket packet) in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 620
   at Client.AutomatedGame.HandleCompressedUpdateObject(InPacket packet) in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 497
   at Client.World.Network.WorldSocket.HandlePacket(InPacket packet) in c:\Build\BotFarm_x64\Client\World\Network\WorldSocket.cs:line 386
botfarm - An item with the same key has already been added.    at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Client.AutomatedGame.UpdateObjectHandler.HandleUpdateData() in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 796
   at Client.AutomatedGame.UpdateObjectHandler.HandleUpdatePacket(InPacket packet) in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 620
   at Client.AutomatedGame.HandleCompressedUpdateObject(InPacket packet) in c:\Build\BotFarm_x64\Client\AutomatedGame.cs:line 497
   at Client.World.Network.WorldSocket.HandlePacket(InPacket packet) in c:\Build\BotFarm_x64\Client\World\Network\WorldSocket.cs:line 386
jackpoz commented 9 years ago

Why does it say "Unknown account name" on some of the lines?

did you read carefully https://github.com/jackpoz/BotFarm/blob/master/README.md , in particular

fill the Username and Password fields with an account with ".account create" permissions

?

ghost commented 9 years ago

Yes, I have got 4 accounts in the DB, all of them are gmlevel 3 and with characters. If any of them had been lower in gmlevel or without characters, I could understand it. I tried using any of those accounts in the form. I also created one account with the same name and password as the default, admin/admin.

jackpoz commented 9 years ago

gmlevel 3 and ".account create" permissions are 2 different things. you should log ingame with the account you chose and write ".account create" and verify it actually creates an account with the username and password you'll specify. This is the same I wrote at https://github.com/jackpoz/BotFarm/issues/11#issuecomment-139989947

If gmlevel 3 doesn't include ".account create" and you think that's an issue, please report it on TC tracker

jackpoz commented 9 years ago

https://github.com/jackpoz/BotFarm/commit/a4648c21767cb0c6f1c124d16eabc5f60e396d31