Back to ericjwin
Hex Worksheet
Zonfire's D2 v1.10 File Structure
Before Hex editing your char, it's best to make sure you have some Stat points, Skill points, Gold on person and Gold in stash. That way, your Hex offsets(locations) will always be the same.
D2 V1.10 – information for dynamic decoding for character stats
After “gf” header (67h, 66h) @ (2FDh,2FEh), look for the value of the next 9 bits (starting at 2FFh), to determine any extra stat ID bits, followed by the stat bits. If a stat value is zero, then it is just "missing" from the character file:
There is also a stat “if” Footer, the location of the “if” Footer varies depending on which stats are "missing"
0: 9 bits, + 10 bits Strength
1: 9 bits, + 10 bits Energy
2: 9 bits, + 10 bits Dexterity
3: 9 bits, + 10 bits Vitality
4: 9 bits, + 10 bits Stat Points Remaining
5: 9 bits, + 8 bits Skill Choices Remaining
6: 9 bits, + 21 bits Current Life (/256)
7: 9 bits, + 21 bits Maximum Life (/256)
8: 9 bits, + 21 bits Current Mana (/256)
9: 9 bits, + 21 bits Maximum Mana (/256)
A: 9 bits, + 21 bits Current Stamina (/256)
B: 9 bits, + 21 bits Maximum Stamina (/256)
C: 9 bits, + 7 bits Level
D: 9 bits, + 32 bits Experience
E: 9 bits, + 25 bits Gold on Person
F: 9 bits, + 25 bits Gold in Stash
Example, ‘forward bytes’, after “gf” header:
00 28 08 F0 80 00 0F 06 50 40 40 81 02 01 06 00 70 C0 01 00 1C 80 00 70 02 24 00 9C 00 0A 00 AE C0 02 80
2B C0 80 D0 A0 10 03 00 C0 81 16 00 80 07 08 00 00 FE 03
Reverse order of the above example bytes:
03 FE 00 00 08 07 80 00 16 81 C0 00 03 10 A0 D0 80 C0 2B 80 02 C0 AE 00 0A 00 9C 00 24 02 70 00 80 1C 00
01 C0 70 00 06 01 02 81 40 40 50 06 0F 00 80 F0 08 28 00
Reverse Binary: 00000011 11111110 00000000 00000000 00001000 00000111 10000000 00000000 00010110 10000001
11000000 00000000 00000011 00010000 10100000 11010000 10000000 11000000 00101011 10000000 00000010
11000000 10101110 00000000 00001010 00000000 10011100 00000000 00100100 00000010 01110000 00000000
10000000 00011100 00000000 00000001 11000000 01110000 00000000 00000110 00000001 00000010 10000001
01000000 01000000 01010000 00000110 00001111 00000000 10000000 11110000 00001000 00101000 00000000
Decoded values for Example:
0: Strength = 20
1: Energy = 15
2: Dexterity = 30
3: Vitality = 20
4: Stat Points Left = 10
5: Skill Points Left = 1
6: Current Life = 56
7: Maximum Life = 56
8: Current Mana = 19
9: Maximum Mana = 19
A: Current Stamina = 87
B: Maximum Stamina = 87
C: Level = 4
D: Experience = 6277
E: Gold on Person = 90
F: Gold in Stash = 8
I figured out the (almost) obvious:
The 'extra' 8 bits for Current Life, etc. are just the fractional part of these stats.
So, 'these' six Stats are actually 21 bits long, but divide the value by 256, as was required before with V1.09D.
Or, another way to do it...
Forward Hex, bytewise reverse binary:
The | is the bit field boundary
00 28 08 F0 80 00 0F 06 50 40 40
00000000 0|0010100 000|10000 0000|1111 000000|01 00000000 11110000 01100000 00001010 00000010 00000010
81 02 01 06 00 70 C0 01 00 1C 80
10000001 01000000 10000000 01100000 00000000 00001110 00000011 10000000 00000000 00111000 10000000
00 70 02 24 00 9C 00 0A 00 AE C0
00000000 00001110 01000000 00100100 00000000 00111001 00000000 01010000 00000000 01110101 00000011
02 80 2B C0 80 D0 A0 10 03 00 C0
01000000 00000001 11010100 00000011 00000001 00001011 00000101 00001000 11000000 00000000 00000011
81 16 00 80 07 08 00 00 FE 03
10000001 00010110 00000000 00000001 00000111 00010000 00000000 00000000 01111111 11000000
e.g. Strength:
9 bit StatID = 0 (9 bit reverse binary = 000000000)
10 bit Value = 20 (10 bit reverse binary = 0010100000)
00000000 0|0010100 000|
So, to change your strength to 182 (10 bit reverse binary = 0110110100)
You would change 00000000 0|0010100 000| to 00000000 0|0110110 100|
Then your Forward Hex, bytewise reverse binary would be
00 6C 09 -- 00000000 0|0110110 100|10000
So, change 00 28 08 to 00 6C 09
e.g. Energy:
9 bit StatID = 1 (9 bit reverse binary = 100000000)
10 bit Value = 15 (10 bit reverse binary = 0000001111)
10000 0000|1111 00000|
So, to change your Energy to 434 (10 bit reverse binary = 0100110110)
You would change 10000 0000|1111 00000| to 10000 0000|0100 110110|
Then your Forward Hex, bytewise reverse binary would be
08 20 9B -- 000|10000 0000|0100 110110|01
So, change 00 28 08 F0 80 to 00 28 08 20 9B