• Welcome to Valhalla Legends Archive.
 

Diablo II MCP | Realm help needed (C++)

Started by LordVader, February 24, 2005, 04:20 PM

Previous topic - Next topic

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: [email protected]

Or /msg LordVader on Useast, in channel Op DBD

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.

LordVader

Give me a minute and I'll post a few specifics Thanks btw in Advance for help  ;)

LordVader

#3
 From BnetDocs:

::::::::::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,

(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:

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.

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




UserLoser.

Quote from: LordVader on February 24, 2005, 05:18 PM
From BnetDocs:

::::::::::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,

(DWORD)Cookie
what generally should that be a random DWORD or anything in particular..
Cookie is whatever you want.  When a client message requires a cookie which isn't given, it can be anything.

Quote from: LordVader on February 24, 2005, 05:18 PM
(DWORD[5]) Hashed Realm password, what type of hashing should this be?
Exactly like your account's password hash

Quote from: LordVader on February 24, 2005, 05:18 PM
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.
It shows info to get the realm listing...

Quote from: LordVader on February 24, 2005, 05:18 PM
Also how do you choose what bnet ip to connect to or does just useast.battle.net etc..? for realm logins
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

LordVader

#5
Quote from: LordVader on February 24, 2005, 05:26 PM
0x40 is not well documented on bnet docs, I could use some info on that to get realm listing etc.

Quote from: UserLoser on February 24, 2005, 05:26 PM
It shows info to get the realm listing...

Soo

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   

Are basically useless, is it  safe to send 0x40  as null, and is the recieve 0x40 anything of use at anytime?

Quote from: LordVader on February 24, 2005, 05:26 PM
Also how do you choose what bnet ip to connect to or does just useast.battle.net etc..? for realm logins
Quote from: UserLoser on February 24, 2005, 05:26 PM
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


::::::::::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,

I see now over looked IP & Port in that.

LordVader


UserLoser.

Quote from: LordVader on February 24, 2005, 05:43 PM
Soo

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   

Are basically useless, is it  safe to send 0x40  as null, and is the recieve 0x40 anything of use at anytime?

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).

LordVader

#8
Quote from: UserLoser on February 24, 2005, 06:46 PM
Quote from: LordVader on February 24, 2005, 05:43 PM
Soo

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   

Are basically useless, is it  safe to send 0x40  as null, and is the recieve 0x40 anything of use at anytime?

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).

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..?

Soul Taker

No it's the list of realms, like if you connect to an Asian BNCS it will have three realms.

LordVader

I see, so depending on realm|server status just contains list of available servers realm|hubs basically thx.