Valhalla Legends Forums Archive | Battle.net Bot Development | Diablo II MCP | Realm help needed (C++)

AuthorMessageTime
LordVader
I'm working on getting realm character logins going on my bot, have looked thru bnetdocs and done alot of packet logging so got most info I need.

Was wondering if someone who's been thru this would let me pick their brain a little bit..

Programming in C++ but imagine someone who's done it in VB would do just as well  :P


If so PM me or Email: leoxavior@inninntia.com

Or /msg LordVader on Useast, in channel Op DBD
February 24, 2005, 10:20 PM
EpicOfTimeWasted
Is there anything specific that you need help with, or just general stuff?  I got basic realm support (connecting, creating/deleting/selecting/converting to D2XP a character) done for my C++ library before I decided to overhaul the whole thing, so I should be able to help.  Don't like IM/PMs though, since it makes it harder for other people searching to find what they're looking for.
February 24, 2005, 10:39 PM
LordVader
Give me a minute and I'll post a few specifics Thanks btw in Advance for help  ;)
February 24, 2005, 10:56 PM
LordVader
From BnetDocs:
[code]
::::::::::SEND 0x3E::::::::::
Packet ID: 0x3E
Direction: Client -> Server (Sent)
Format:
(DWORD) Cookie
(DWORD[5]) Hashed realm password
(STRING) Realm title
Remarks: Realm password is always 'password'
Related Links: [S>0x3E] SID_LOGONREALMEX,
[/code]
(DWORD)Cookie
what generally should that be a random DWORD or anything in particular..


(DWORD[5]) Hashed Realm password, what type of hashing should this be, general calhash function?

To connect, fully on a character into chat, im assuming this sequence is correct:
[code]
Diablo II/Lord of Destruction MPC Logon (D2DV/D2XP)
X-Sha-1
//base NLS type login
SEND ->  Protocol byte (01)
SEND -> Unknown (0x50)
RECV <- Unknown (0x25)
SEND -> Unknown (0x25) [Optional reply with exact recv value: get(), for ping value or other]
RECV <- Unknown (0x50)
SEND -> Unknown (0x51)
RECV <- Unknown (0x51)
SEND -> Unknown (0x3A)
RECV <- Unknown (0x3A)
//step into mcp
SEND -> Unknown (0x3e)
SEND -> Unknown (0x40)
RECV <- Unknown (0x3e)
RECV <- Unknown (0x40)
SEND -> Unknown (0x3e)
RECV <- Unknown (0x3e)
SEND -> Unknown (0x4D)
//enter chat | channel
SEND -> Unknown (0x0A)
SEND -> Unknown (0x0B)
SEND -> Unknown (0x0C)
RECV <- Unknown (0x0B)
RECV <- Unknown (0x0A)
[/code]
-- You've now entered chat.

0x40 is not well documented on bnet docs, I could use some info on that to get realm listing etc.

Also how do you choose what bnet ip to connect to or does just useast.battle.net etc..? for realm logins



February 24, 2005, 11:18 PM
UserLoser.
[quote author=LordVader link=topic=10703.msg101434#msg101434 date=1109287106]
From BnetDocs:
[code]
::::::::::SEND 0x3E::::::::::
Packet ID: 0x3E
Direction: Client -> Server (Sent)
Format:
(DWORD) Cookie
(DWORD[5]) Hashed realm password
(STRING) Realm title
Remarks: Realm password is always 'password'
Related Links: [S>0x3E] SID_LOGONREALMEX,
[/code]
(DWORD)Cookie
what generally should that be a random DWORD or anything in particular..
[/quote]
Cookie is whatever you want.  When a client message requires a cookie which isn't given, it can be anything.

[quote author=LordVader link=topic=10703.msg101434#msg101434 date=1109287106]
(DWORD[5]) Hashed Realm password, what type of hashing should this be?
[/quote]
Exactly like your account's password hash

[quote author=LordVader link=topic=10703.msg101434#msg101434 date=1109287106]
To connect, fully on a character into chat, im assuming this sequence is correct:

Diablo II/Lord of Destruction MPC Logon (D2DV/D2XP)
X-Sha-1
//base NLS type login
SEND ->  Protocol byte (01)
SEND -> Unknown (0x50)
RECV <- Unknown (0x25)
SEND -> Unknown (0x25) [Optional reply with exact recv value: get(), for ping value or other]
RECV <- Unknown (0x50)
SEND -> Unknown (0x51)
RECV <- Unknown (0x51)
SEND -> Unknown (0x3A)
RECV <- Unknown (0x3A)
//step into mcp
SEND -> Unknown (0x3e)
SEND -> Unknown (0x40)
RECV <- Unknown (0x3e)
RECV <- Unknown (0x40)
SEND -> Unknown (0x3e)
RECV <- Unknown (0x3e)
SEND -> Unknown (0x4D)
//enter chat | channel
SEND -> Unknown (0x0A)
SEND -> Unknown (0x0B)
SEND -> Unknown (0x0C)
RECV <- Unknown (0x0B)
RECV <- Unknown (0x0A)
-- You've now entered chat.

0x40 is not well documented on bnet docs, I could use some info on that to get realm listing etc.
[/quote]
It shows info to get the realm listing...

[quote author=LordVader link=topic=10703.msg101434#msg101434 date=1109287106]
Also how do you choose what bnet ip to connect to or does just useast.battle.net etc..? for realm logins
[/quote]
I don't understand the question since it seems you've been on Battle.net already, but for the realm server, the IP address and port to use is given in the 0x3E response from the Battle.net chat server
February 24, 2005, 11:26 PM
LordVader
[quote author=LordVader link=topic=10703.msg101435#msg101435 date=1109287601]
0x40 is not well documented on bnet docs, I could use some info on that to get realm listing etc.
[/quote]

[quote author=UserLoser link=topic=10703.msg101435#msg101435 date=1109287601]
It shows info to get the realm listing...
[/quote]

Soo
[code]
Sent packet 0x40, Length 4:
0000 FF 40 04 00                                     ˙@..

Rcvd packet 0x40, Length 51:
0000 FF 40 33 00 00 00 00 00 01 00 00 00 01 00 00 00 ˙@3.............
0010 55 53 45 61 73 74 00 52 65 61 6C 6D 20 66 6F 72 USEast.Realm for
0020 20 74 68 65 20 55 53 20 45 61 73 74 20 43 6F 61  the US East Coa
0030 73 74 00   
[/code]
Are basically useless, is it  safe to send 0x40  as null, and is the recieve 0x40 anything of use at anytime?

[quote author=LordVader link=topic=10703.msg101435#msg101435 date=1109287601]
Also how do you choose what bnet ip to connect to or does just useast.battle.net etc..? for realm logins
[/quote]
[quote author=UserLoser link=topic=10703.msg101435#msg101435 date=1109287601]
I don't understand the question since it seems you've been on Battle.net already, but for the realm server, the IP address and port to use is given in the 0x3E response from the Battle.net chat server
[/quote]

[code]
::::::::::RECV 0x3E::::::::::
Packet ID: 0x3E
Direction: Server -> Client (Received)
Format:
(DWORD) Cookie
(DWORD) Status
(DWORD[2]) MCP Chunk 1
(DWORD) IP
(DWORD) Port
(DWORD[12]) MCP Chunk 2
(STRING) BNCS unique name
(WORD) Unknown
Remarks: This packet supplies the data neccessary to connect to an MCP server.
The cookie value is defined in the first DWORD of SID_LOGONREALMEX and is simply returned by Battle.net.
If the length of the message (not including header) is greater than 8,
the client should continue to logon to the MCP. Otherwise,
the 'status' field is interpreted as an error code:

0x80000001: Realm is unavailable
0x80000002: Realm logon failed

Any other value indicates failure.

The first part of the MCP Chunk that must be sent to the MCP server includes the Status and Cookie DWORDS, making MCP Chunk 1 the first 4 DWORDS of the packet.
Related Links: [C>0x3E] SID_LOGONREALMEX,
[/code]
I see now over looked IP & Port in that.
February 24, 2005, 11:43 PM
LordVader
The rest i think i found
here
February 25, 2005, 12:10 AM
UserLoser.
[quote author=LordVader link=topic=10703.msg101438#msg101438 date=1109288589]
Soo
[code]
Sent packet 0x40, Length 4:
0000 FF 40 04 00                                    ˙@..

Rcvd packet 0x40, Length 51:
0000 FF 40 33 00 00 00 00 00 01 00 00 00 01 00 00 00 ˙@3.............
0010 55 53 45 61 73 74 00 52 65 61 6C 6D 20 66 6F 72 USEast.Realm for
0020 20 74 68 65 20 55 53 20 45 61 73 74 20 43 6F 61  the US East Coa
0030 73 74 00 
[/code]
Are basically useless, is it  safe to send 0x40  as null, and is the recieve 0x40 anything of use at anytime?
[/quote]

I hope I am understanding you correctly.  They could be useless if you hardcoded a realm list into your client, but who does that?  You can send that any time you are logged on to Battle.net (except maybe while in a game).
February 25, 2005, 12:46 AM
LordVader
[quote author=UserLoser link=topic=10703.msg101470#msg101470 date=1109292406]
[quote author=LordVader link=topic=10703.msg101438#msg101438 date=1109288589]
Soo
[code]
Sent packet 0x40, Length 4:
0000 FF 40 04 00                                     ˙@..

Rcvd packet 0x40, Length 51:
0000 FF 40 33 00 00 00 00 00 01 00 00 00 01 00 00 00 ˙@3.............
0010 55 53 45 61 73 74 00 52 65 61 6C 6D 20 66 6F 72 USEast.Realm for
0020 20 74 68 65 20 55 53 20 45 61 73 74 20 43 6F 61  the US East Coa
0030 73 74 00   
[/code]
Are basically useless, is it  safe to send 0x40  as null, and is the recieve 0x40 anything of use at anytime?
[/quote]

I hope I am understanding you correctly.  They could be useless if you hardcoded a realm list into your client, but who does that?  You can send that any time you are logged on to Battle.net (except maybe while in a game).
[/quote]

More curious as to what uses this has(assuming it's not useless) and when it would be used, is this the Game realm(server) to connect to(?) when you join a game or create a game etc..?
February 25, 2005, 2:23 AM
Soul Taker
No it's the list of realms, like if you connect to an Asian BNCS it will have three realms.
February 25, 2005, 12:12 PM
LordVader
I see, so depending on realm|server status just contains list of available servers realm|hubs basically thx.
February 25, 2005, 8:36 PM

Search