-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How does the map part work? #430
Comments
Hi @ffMathy, its been a while since I've played D2R so my knowledge may be slightly out of date. A lot of tools interact directly with D2 / D2R eg reading / writing memory, generally these can be detected pretty easily and get your account banned, so I wanted to look for a way to get player and map data without interacting directly with the diablo2 process. In the old days of diablo2 it was very easy to intercept game packets as they were not encrypted, so you could use a packet sniffer (even on a separate machine) to read game packets, with these packets you get a lot of information about the current state of the game, where the player is, where the monsters are and their stats. But the only information about the map you can sniff is the mapseed and difficulty. So to make a fully external maphack the map needs to be generated given the seed and difficulty, since the map generation is very similar (exactly the same?) between versions of diablo2 we can use an older version of diablo2 to generate the map then export it into a file. With the older diablo2 clients (<=1.13c), the initialization process is somewhat well documented with the old bots. Using https://github.com/blacha/diablo2/blob/master/packages/map/README.md#fixing-offsets The map generation library https://github.com/blacha/diablo2/blob/master/packages/map/map/d2_client.c#L112 a full diablo2 classic client is spun up and initialized, then a game world can be created and then dumped into a JSON file https://github.com/blacha/diablo2/blob/master/packages/map/map/d2_client.c#L446 when D2R first came out it encrypted the packets so it made it significantly harder to intercept them, but then it also had the map seed sitting in memory, Since I game under linux it was somewhat hard for me to find the exact location of the seed in memory consistently. I ended up dumping a copy of the game memory and using https://github.com/blacha/memoryscanner to look for known game structures which included the mapseed https://github.com/blacha/diablo2/blob/master/packages/memory/src/struts/d2r.act.ts#L9, Some time later D2R updated and started hiding the seed in memory too which is about the time I stopped playing D2R. TLDR: Getting map data from D2R is hard but the map generation is the same between versions so just grab the map seed from D2R and use a old client to generate the map. |
Sorry for my late reply, and thank you so much for the answer. If I only want to find out how to do this on offline accounts (so no banning), can I then somehow intercept the map from the memory itself in D2R? Or is this also hidden now? |
I haven't looked too much at offline mode, I would imagine its somewhat hidden in memory. In offline mode you can extract the seed from the save files, In the older clients you can even set the seed when you start the game with From there you can generate the map from the seed. |
Very interesting @blacha! And this would work for Diablo 2 Resurrected as well? |
looks like the d2r hero editors let you change map seeds |
I'm not very familiar with C, which seems to be what the map part of this project is written in.
Does this inject itself into the memory of Diablo 2 somehow?
Can you explain a bit how it works in really high level terms?
I'm asking because I'd love to contribute, and also know your thoughts on what's holding back this from supporting D2R directly.
I know it says it supports D2R, but my understanding is that D2 1.13c is still needed?
The text was updated successfully, but these errors were encountered: