Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: BaDDBLooD on November 08, 2004, 07:57 PM

Title: Diablo II Statstring Question
Post by: BaDDBLooD on November 08, 2004, 07:57 PM
I think i found Act inside the statstring.  When i use Asc() on act, i come up with 158 for Act 5 Hell, and 128 for act 1 norm.  Is this right? If it is right, can you explain why it's 158 and 128?

Thanks!
Title: Re: Diablo II Statstring Question
Post by: drivehappy on November 09, 2004, 01:13 AM
128 = 10000000B
158 = 10011110B

If your information is correct, I would assume act II would be 10010000B = 144.
Title: Re: Diablo II Statstring Question
Post by: Arta on November 09, 2004, 01:26 AM
Assuming no one can clarify, someone should ascertain what that value is for each act. Were does this value occur in the statstring?
Title: Re: Diablo II Statstring Question
Post by: Skywing on November 09, 2004, 01:36 PM
The proper way is:

unsigned Acts = (RealD2Stats[27] & 0x3E) >> 1;
Title: Re: Diablo II Statstring Question
Post by: UserLoser. on November 09, 2004, 03:43 PM
Quote from: BaDDBLooD on November 09, 2004, 03:16 PM
Where you Find difficulty, and >> 4 Bits.  I Believe that byte is act.  However, i am probly wrong.

It's actually the number of completed acts.  So you should know that on expansion each difficulty has five acts, while classic has four.
Title: Re: Diablo II Statstring Question
Post by: BrainScan on November 11, 2004, 07:57 PM
well, here is what I have found so far in the Diablo II statstring:

(working on the assumption that everything is one byte fields)

(I might be missing a couple bytes at the begining here)
BYTE: Head Armor Code
BYTE: Chest Armor Code
BYTE: Lower Body Armor Code (Legs)
BYTE: Right Arm Armor Code (from the character's perspective)
BYTE: Left Arm Armor Code
BYTE: Right Hand Item Code
BYTE: Unknown
BYTE: Left Hand Item Code
BYTE: Right Shoulder Pad (Boolean value I believe - Is the shoulder pad there or not...)
BYTE: Left Shoulder Pad
BYTE: Unknown
BYTE: Class
BYTE: Head Color Code
BYTE: Chest Color Code
BYTE: Lower Body Color Code
BYTE: Right Arm Color Code
BYTE: Left Arm Color Code
BYTE: Right Hand Item Color Code
BYTE: Unknown
BYTE: Left Hand Item Color Code
BYTE: Right Shoulder Color Code
BYTE: Left Shoulder Color Code
BYTE: Unknown
BYTE: Level
BYTE: Flags 1  ( 0x04 - Hardcore, 0x08 - Dead, 0x20 - Expansion)
BYTE: Flags 2  ( Kinda weird here  For Classic: 0x08 Beaten Normal, 0x10 beaten nightmare, 0x18 OR? 0x20 beaten Hell     For Expansion: 0x10 beaten normal, 0x18 beaten nightmare, 0x20 beaten hell )
BYTE: Unknown  <<< This where you are talking about??
BYTE: Unknown
BYTE: Ladder character (Boolean I think)
BYTE: Unknown
BYTE: Unknown
BYTE: 0x00 (Null-Terminator)


Just what I found by poking arround. I can't completely garentee the acuracy of it but it's a start. I can try to dig up my notes on some of the specifics if anyone is interested.

-BrainScan
Title: Re: Diablo II Statstring Question
Post by: UserLoser. on November 11, 2004, 08:49 PM
Happen to have the codes for each color and type of item?  I had a majority of them, but I lost everything recently..
Title: Re: Diablo II Statstring Question
Post by: Skywing on November 11, 2004, 09:25 PM
Quote from: BaDDBLooD on November 11, 2004, 09:18 PM
Quote from: Skywing on November 09, 2004, 01:36 PM
The proper way is:

unsigned Acts = (RealD2Stats[27] & 0x3E) >> 1;

Skywing, would you explain how you figured that out?
By looking at a lot of statstrings with known title combinations and searching for patterns.
Title: Re: Diablo II Statstring Question
Post by: Skywing on November 11, 2004, 10:04 PM
Assuming RealD2Stats is a char* pointing to the first byte past the comma immediately following the character name, mask off all bits in the 28th byte except 0x3E and bitshift the result to the right by one bit position.
Title: Re: Diablo II Statstring Question
Post by: BaDDBLooD on November 11, 2004, 10:12 PM
Quote from: Skywing on November 11, 2004, 10:04 PM
Assuming RealD2Stats is a char* pointing to the first byte past the comma immediately following the character name, mask off all bits in the 28th byte except 0x3E and bitshift the result to the right by one bit position.

Thanks a bunch skywing, imma go read up on bitwise operators now.  Hopefully after i do some research your response will click in my brain =)
Title: Re: Diablo II Statstring Question
Post by: Kp on November 11, 2004, 10:27 PM
Quote from: BaDDBLooD on November 11, 2004, 10:18 PMCan you give me a Example of the RealD2Stats Char*, in binary or hexadecimal so i can see how this works?

Sure.

01101111000000001111111111111000 (binary - taken from a common value in one of the temporary buffers)
Title: Re: Diablo II Statstring Question
Post by: Minux on November 14, 2004, 02:26 PM
Quote from: Skywing on November 09, 2004, 01:36 PM
The proper way is:

unsigned Acts = (RealD2Stats[27] & 0x3E) >> 1;

I thought I remembered the 28th byte being the difficulties you've completed. Which would help you determine the prefix for the character's name.


Difficulty = (Statstring[27] & 0x18) >> 3;


Quote
0000:  3D FF FF FF FF 35 FF FF FF FF FF 02 E2 FF FF FF   =ÿÿÿÿ5ÿÿÿÿÿâÿÿÿ
0010:  FF B3 FF FF FF FF FF 50 A8 9A FF FF FF FF FF      ÿ³ÿÿÿÿÿP¨šÿÿÿÿÿ.

This is the statstring I got and when I use Skywing's little code I get "Act: 13". Perhaps I screwed something up...... :(
Title: Re: Diablo II Statstring Question
Post by: Skywing on November 14, 2004, 02:37 PM
That statstring is too short. strlen(RealD2Stats) should be 33.
Title: Re: Diablo II Statstring Question
Post by: Minux on November 14, 2004, 03:55 PM
Quote from: Skywing on November 14, 2004, 02:37 PM
That statstring is too short. strlen(RealD2Stats) should be 33.

Made the adjustment, no change in result.

Quote
0000:  84 80 FF 01 01 01 01 2C FF 51 02 02 FF 07 FF FF   ,,€ÿ,ÿQÿÿÿ
0010:  FF FF FF FF FF FF FF FF FF 59 A8 9E FF FF FF FF   ÿÿÿÿÿÿÿÿÿY¨žÿÿÿÿ
0020:  FF                                                ÿ...............

Again using

Act = (Statstring[28] & 0x3E) >> 1;


Resulted in Act: 15 :(
Title: Re: Diablo II Statstring Question
Post by: Skywing on November 14, 2004, 03:59 PM
Yes, and that's the number of acts that your character has completed.  Based on how many acts there are per difficulty setting (4 for classic, 5 for expansion), you can find out how many difficulty levels the character has completed.
Title: Re: Diablo II Statstring Question
Post by: Minux on November 14, 2004, 04:11 PM
Quote from: Skywing on November 14, 2004, 03:59 PM
Yes, and that's the number of acts that your character has completed.  Based on how many acts there are per difficulty setting (4 for classic, 5 for expansion), you can find out how many difficulty levels the character has completed.

Thanks for clearing that up, it finally makes sense!!

Edit: Is the difficulty method I am using accurate? Or am I just wasting my time with it?