[1.13c] Stat modification and single-player CE questions

This forum is for discussions on how to edit what can not be edited through the txt files, needless to say this isn't about battle net hacking.

Moderators: Nefarius, Havvoric

Post Reply
Posts: 1
Joined: Wed Jul 01, 2020 2:32 pm
United States of America

[1.13c] Stat modification and single-player CE questions

Post by dicene » Wed Apr 21, 2021 9:11 pm

I'm doing a little bit of D2 modification to try and enhance the single player experience in a few ways I've not necessarily seen before in my relatively limited modded D2 playing(hoping to do some things like auto potion pickup and management, maybe converting junk items to gold, automatic re-hire of your merc on death, and a dedicated TP button). I think I know how I'll go about most of these things, what to hook to, and I have a lot of the basics working(examining packets to monitor item drops, deaths, etc).

The problem I'm running into is that certain changes appear to be surface-only. Modifying player stats, for instance, through the AddPlayerStat(D2COMMON:10551) functions DO update the value of gold in your inventory or the number of unused skill points, but don't actually update the values where it counts. With gold, for instance, I see five places where my gold value is stored in memory, two of which update immediately when dropping gold, three of which update a few ticks later. But when I add gold via AddPlayerStat, it updates two of those but the change never propogates to the other three, and the gold doesn't exist or get saved to the character in reality.

I've come to figure out this is because D2 runs a server and client in the same process even in Single-player, which makes sense why I'm seeing packets via an intercept GamePacketRecv_Interception on D2Client:0xACE61. I have even watched the Get Gold packets that get sent on picking up gold.

My questions:

Do changes to the player via AddPlayerStat and similar functions only update the Client's copy of the player, and if so, would I need to send those updated stats in some manner to the Server via a packet, or is there some other mechanism for updating the Server's player state?

I see that PlugY, for example, is using these functions to set player gold and skill amounts on the player when using the shared stash and respecting, but it also seems to be doing something after that to update the player state, but I'm having trouble figuring out what exactly it's doing at that point.

Is there any documentation or reference somewhere that goes into more detail on the internal client and server system and how information is communicated between the two?

Sorry if I've missed this information somewhere on the forum(I have done hours of reading posts and searching) or if this is against the rules to ask about. Looked like, from stickies, that client-server questions not related to BNet functionality were acceptable.

Post Reply

Return to “Code Editing”