dkuwahara / D2NG

Next Gen Diablo 2 Clientless Library
GNU General Public License v3.0
42 stars 12 forks source link

Changing the bot for other versions of diablo 2 #41

Closed jcageman closed 4 years ago

jcageman commented 4 years ago

Apologies for trying to reach out via an issue, but i don't see a better way.

I am looking into making your bot work with another version of diablo 2, so far i have been able to rewrite the versioncheck such that i succesfully login, but i already noticed there are quite some differences in the communication compared to 1.14. Where do you get your information from? So far i have used https://bnetdocs.org/packet/index, but that information is not always correct for my version.

I already found https://github.com/lord2800/BNetSharp/blob/9753bfa60987aa8607a80b47b2b5455defc8cd51/bnet%23/BNet/Packets/BNCS/AuthCheck.cs

Which might be useful for you as well to write certain parts of the code.

Furthermore i've noticed that the key owner you pass is always "D2NG", might be dangerous, just as a headsup.

Thanks in advance!

dkuwahara commented 4 years ago

Most of what you're looking for happens during initial connection to BNCS.

https://github.com/dkuwahara/D2NG/blob/master/src/D2NG/BNCS/BattleNetChatServer.cs

What version of the game are you trying to connect to?

This older bot should work with 1.13 https://github.com/dkuwahara/OmegaBot

Older commits to this repo were implemented to work with 1.13 initially

jcageman commented 4 years ago

I am trying to connect to a 1.09 server. It seems the mcp communication is slightly different. Especially since some commands send only the command packet and afterwards the remainder of it in a separate packet. Thanks for the information, if i think i made useful changes for 1.14 ill make a pull request.

Do you use any tools to analyze faster besides for example wireshark?

jcageman commented 4 years ago

I managed to get as far as D2GS, but the initial packet it sends back is 0xa7 0x01, instead of 0xAF 0x00 (which is expected). I already traced a client and that shows the same behavior, which suggests i am succesfully connected, but clearly different communication than 1.14, any idea where i can find documentation for this version? Googling gave me nothing so far

jcageman commented 4 years ago

I just keep this as a tracking issue for now :)

Update: Found out the GameServer is slightly different than 1.14 and uses compression, i am now able to communicate with it and read packets like item stats. Made it all unit testable and i can now also read the exact stats of items (24 fhr 30 cold resist etc.). The model is slightly different though, so i had to make changes to some files, but your work helped a lot! Thanks!

If you are interested in particular parts of the code, feel free to let me know

bomber00 commented 4 years ago

@jcageman did you manage to get it working? I am also interested botting in 1.09. if you could help me I would be most grateful to you.

jcageman commented 4 years ago

@jcageman did you manage to get it working? I am also interested botting in 1.09. if you could help me I would be most grateful to you.

Yes, i got it working. what version of 1.09 are you targetting?

jcageman commented 4 years ago

@bomber00 I forked this repo and added my additional changes https://github.com/jcageman/D2NG

bomber00 commented 3 years ago

I'm not sure how to compile this and get it working, if you could help me I would be greatful. Private 1.09d realm #diablo 09

jcageman commented 3 years ago

I'm not sure how to compile this and get it working, if you could help me I would be greatful. Private 1.09d realm #diablo 09

have a look at https://github.com/jcageman/Diablo2Clientless1.09 it has quite good instructions. Otherwise create an issue there and we can discuss

dkuwahara commented 3 years ago

@jcageman really cool to see what you were able to do. Sorry I haven't been actively maintaining this but would love to incorporate a lot of the awesome work you've put in.

jcageman commented 3 years ago

Thanks! Do note that a lot of it is 1.09 related, hence you probably need to rewrite the packet parsing parts at least. Also the bots use the map API with normal difficulty, this has to do with the 1.09 map generation for other versions this should just be hell if you play hell difficulty

bomber00 commented 3 years ago

My server is using some sort of loader, not sure how to bypass it as game knows if I'm not using the loader. Gonna try and download and try it out. Sorry I'm not very good with this sort of thing but if you can help me get a simple meph or pindle bot working I can pay or donate some.

jcageman commented 3 years ago

My server is using some sort of loader, not sure how to bypass it as game knows if I'm not using the loader. Gonna try and download and try it out. Sorry I'm not very good with this sort of thing but if you can help me get a simple meph or pindle bot working I can pay or donate some.

that is not a problem. These bot's are clientless which means they don't even start the game. They just send the right data to the game server behaving exactly like the diablo 2 client.