Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: spear on April 03, 2005, 02:06 PM

Title: Help 0X7F
Post by: spear on April 03, 2005, 02:06 PM
Hey. Im trying to parse 0X7F (Clan member update), and I am almost totally lost. So far, all I have been able to get out of it is this:
(My packet dump:)

Unidentified Packet: 0x7F Recieved On: 4/3/2005 At: 1:55:23 PM
0000:  FF 7F 0D 00 41 72 6D 79 7A 00 03 01 00            ÿ..Spear.....



Asc(Mid(Data, 10 + Len(Trim(Split(Mid(Data, 10), Chr(0))(0))) + 1, 1))

This returns 0 or 1, depending if the user is going offline or comming offline.
That's all fine and dandy, but I am struggling to get the username and the rank, in the same way I got the the online/offline status, so I can use it appropriatley in my Clan list.
If somebody could show me how to get these, (username/rank), it would help me tons.
Any help would be greatly appreciated.
Title: Re: Help 0X7F
Post by: UserLoser. on April 03, 2005, 02:23 PM
I know you're new and all, and we should be nice to new people.. but if you wrote the rest of the bot you should be able to pick apart the packet into a string and three bytes
Title: Re: Help 0X7F
Post by: BaDDBLooD on April 03, 2005, 02:57 PM
Quote from: UserLoser on April 03, 2005, 02:23 PM
I know you're new and all, and we should be nice to new people.. but if you wrote the rest of the bot you should be able to pick apart the packet into a string and three bytes

It is possible he is using a Open Source Project as a starting point, or.... something else.
Title: Re: Help 0X7F
Post by: Soul Taker on April 03, 2005, 06:44 PM
Then he should be researching this kind of stuff.
Title: Re: Help 0X7F
Post by: BaDDBLooD on April 03, 2005, 07:44 PM
Quote from: Soul Taker on April 03, 2005, 06:44 PM
Then he should be researching this kind of stuff.

Yeah.. ok, you got me on that one.
Title: Re: Help 0X7F
Post by: spear on April 03, 2005, 10:35 PM
Could anybody reccomend some sites where I could reasearch this?
Title: Re: Help 0X7F
Post by: spear on April 04, 2005, 02:13 PM
That doesnt help me find the stuff withing the packet and 'extract it', all that does is tell me that it's there. Well no duh...
Title: Re: Help 0X7F
Post by: Blaze on April 04, 2005, 02:23 PM
Learn VB?
Title: Re: Help 0X7F
Post by: Warrior on April 04, 2005, 02:33 PM
http://bnetdocs.valhallalegends.com/content.php?Section=d&id=8
Title: Re: Help 0X7F
Post by: spear on April 04, 2005, 03:13 PM
Quote from: Blaze on April 04, 2005, 02:23 PM
Learn VB?

Right, that was a pretty stupid reply. I'm asking for websites where I can learn about this stuff, so yeah...
Title: Re: Help 0X7F
Post by: Blaze on April 04, 2005, 03:15 PM
If you know the language, taking a string here, and a string there shouldn't be to difficult.
Title: Re: Help 0X7F
Post by: Hdx on April 04, 2005, 06:12 PM
0000:  FF 7F 0D 00 41 72 6D 79 7A 00 03 01 00            ÿ...Spear...
Quote(STRING)     Username
(BYTE)        Rank
(BOOLEAN)    Online (8-bit)
(BYTE)        Unknown
Hurm, lets work through this:
FF 7F 0D 00 ÿ... The header, Dont need this, toss it. So the next thing to come would be a String....
41 72 6D 79 7A 00 Spear. Strings for *most* Binary servers are Null terminated, so the string ends at Chr$(&H0), So you trim it off resulting in: Spear
Next to come is a Byte, for the rank.
03 . Byte = 1 byte.. the smallest thing above a bit... This byte is used to determin the rank, so compare it to this list:
Quote0x00: Initiate that has been in the clan for less than one week
0x01: Initiate that has been in the clan for over one week
0x02: Member
0x03: Officer
0x04: Leader
and you get the person is an Officer. Now next to come is a Boolean(8-bit).
01 .a boolean (8-bit) is just a byte, that only has two possible values, 0 and 1. 1 byte = 8 bits, Just fyi. The value ofp this one is 1, so he is online. Next is the unknow, dont need it so jsut get rid of it.

It's not that hard, just work form the biginning of the packet, and remove what you have parsed. Untill you eaither get good, or make a Packet-DeBuffer object, you'll use a lot of Data = Mid(Data, #)'s

I HIGHLY suggest you do some other work with binary values, before you get into a Bnet bot.
~-~(HDX)~-~
Title: Re: Help 0X7F
Post by: MyndFyre on April 04, 2005, 06:30 PM
Quote from: HdxBmx27 on April 04, 2005, 06:12 PM
Strings for *most* Binary servers are Null terminated
I am not meaning to pick on you, but this particular statement is erroneous.  Strings for all of Battle.net's binary protocol are null-terminated.  However, it is often an inefficient way to store strings in terms of speed for reading.  The C language encodes strings with a null terminator, allowing for variable-length strings of as much length as memory allows.  Other languages -- Pascal comes to mind -- prefix the string with a byte indicating its length.  So for instance, the string "Spear" would be encoded:
05 53 70 65 61 72
Strings encoded this way are called "Pascal strings."
Other languages use a similar method of encoding strings, but instead of using a single byte to encode the length -- which limits the length of the string to 255 -- they use two bytes.  These strings are called "Wide Pascal" strings and can store up to 65,535 characters.

So just as a heads-up -- don't assume that all strings in all binary formats are null-terminated.  I know since .NET strings are interned, there is a performance hit associated with making strings by reading them a character at a time, and so .NET strings are stored as Wide Pascal when using the Framework's binary reader/writer classes.
Title: Re: Help 0X7F
Post by: Hdx on April 04, 2005, 06:38 PM
Well, Thanks for that information, But I was pertaing to the Chr$(&HA) terminated strings used in Some parts of D2GS, and D2 Realm. But thats for telling me things I don't know, I'll try and remeber it.

Anything else you fnd even slightly errorus? (besides grammar and spelling)
~-~(HDX)~-~
Title: Re: Help 0X7F
Post by: Kp on April 04, 2005, 09:37 PM
Byte is not the next biggest thing after bit.  A nibble (4 bits) comes between them.
Title: Re: Help 0X7F
Post by: UserLoser. on April 04, 2005, 09:38 PM
Quote from: HdxBmx27 on April 04, 2005, 06:12 PM
0000:  FF 7F 0D 00 41 72 6D 79 7A 00 03 01 00            ÿ...Spear...
Quote(STRING)     Username
(BYTE)        Rank
(BOOLEAN)    Online (8-bit)
(BYTE)        Unknown
Hurm, lets work through this:
FF 7F 0D 00 ÿ... The header, Dont need this, toss it. So the next thing to come would be a String....
41 72 6D 79 7A 00 Spear. Strings for *most* Binary servers are Null terminated, so the string ends at Chr$(&H0), So you trim it off resulting in: Spear
Next to come is a Byte, for the rank.
03 . Byte = 1 byte.. the smallest thing above a bit... This byte is used to determin the rank, so compare it to this list:
Quote0x00: Initiate that has been in the clan for less than one week
0x01: Initiate that has been in the clan for over one week
0x02: Member
0x03: Officer
0x04: Leader
and you get the person is an Officer. Now next to come is a Boolean(8-bit).
01 .a boolean (8-bit) is just a byte, that only has two possible values, 0 and 1. 1 byte = 8 bits, Just fyi. The value ofp this one is 1, so he is online. Next is the unknow, dont need it so jsut get rid of it.

It's not that hard, just work form the biginning of the packet, and remove what you have parsed. Untill you eaither get good, or make a Packet-DeBuffer object, you'll use a lot of Data = Mid(Data, #)'s

I HIGHLY suggest you do some other work with binary values, before you get into a Bnet bot.
~-~(HDX)~-~

Actually, a boolean in VB is two bytes