Valhalla Legends Forums Archive | Battle.net Bot Development | D2GS_GAMELOGON problem

AuthorMessageTime
mime
Hello  I have troubles with D2GS_GAMELOGON packet.

After sending I'm not receive response from server...

What do I do not correctly?

My source:
[code]
printMsg("Send D2GS_GAMELOGON (0x" + PacketIDs.D2GS_GAMELOGON  + ") packet...");
Buffer b = new Buffer();
b.addByte((byte)PacketIDs.D2GS_GAMELOGON);
b.addDWord(d2gshash);
b.addWord((short)d2gstoken);
b.addByte((byte)0x04); // class
b.addDWord(0x0B);
b.addDWord(0xED5DCC50);
b.addDWord(0x91A519B6);
b.addByte((byte)0x00);
b.addNTString("DrugFree"); // name (null-terminated string)
b.addByte((byte)0x00); // unused byte 1
b.addByte((byte)0x00); // unused byte 2
b.addByte((byte)0x00); // unused byte 3
b.addByte((byte)0x00); // unused byte 4
b.addByte((byte)0x00); // unused byte 5
b.addByte((byte)0x00); // unused byte 6
b.addByte((byte)0x00); // unused byte 7

System.out.println("\n" + b);
d2gsOut.write(b.getBytes());
d2gsOut.flush();
[/code]
Packet log:
[code]
[14:34:30]: {D2GS} Connect to D2GS...
[14:34:30]: {D2GS} Connected successfully!
[14:34:30]: {D2GS} Receive...
af 1
[14:34:30]: {D2GS} Congratulations! You are in the game now!
[14:34:30]: Send D2GS_GAMELOGON (0x68) packet...

68 b0 66 00 00 3a 02 04 0b 00 00 00 50 cc 5d ed h.f..:......P.].
b6 19 a5 91 b6 19 a5 91 00 44 72 75 67 46 72 65 .........DrugFre
65 00 00 00 00 00 00 00 00                       e........
Length: 41

[14:34:30]: {D2GS} Read response...

[/code]
November 29, 2009, 12:44 PM
mime
And so too does not work :(

[code]
b.addByte((byte)PacketIDs.D2GS_GAMELOGON);
b.addDWord(d2gshash);
b.addWord((short)d2gstoken);
b.addByte((byte)0x04);
b.addDWord(0x0B);
b.addDWord(0xED5DCC50);
b.addDWord(0x91A519B6);
b.addByte((byte)0x00);
b.addNTString("DrugFree"); // name (null-terminated string)
b.addByte((byte)0xB3);
b.addByte((byte)0x6F);
b.addByte((byte)0x4B);
b.addByte((byte)0x00);
b.addByte((byte)0x00);
b.addByte((byte)0x00);
b.addByte((byte)0x00);
System.out.println("\n" + b);
d2gsOut.write(b.getBytes());
d2gsOut.flush(); [/code]

Log:
[code]
[15:08:42]: Send D2GS_GAMELOGON (0x68) packet...

68 b0 66 00 00 0d 02 04 0b 00 00 00 50 cc 5d ed h.f.........P.].
b6 19 a5 91 00 44 72 75 67 46 72 65 65 00 b3 6f .....DrugFree..o
4b 00 00 00 00                                  K....
Length: 37
[15:08:42]: {D2GS} Read response...

[/code]
November 29, 2009, 1:09 PM
HdxBmx27
[code](DWORD)    D2GS Server Hash
(WORD)    D2GS Server Token
(BYTE)    Character ID
(DWORD)    Version byte
(DWORD)    Unknown - Suggested Const (0xED5DCC50)
(DWORD)    Unknown - Suggested Const (0x91A519B6)
(BYTE)    Unknown - Suggested (0x00)
(BYTE[16]) Character name[/code]

[code]68          h - Packet ID
b0 66 00 00 .f.. - Server Hash (Doesn't look right 0.o)
3a 02      :. - Server Token
04          . - Class ID Barb
0b 00 00 00 .... - Ver Byte (should be 0x0C)
50 cc 5d ed P.]. - Unknown
b6 19 a5 91 .... - Unknown
b6 19 a5 91 .... - Unknown (You inserted it twice)
00          . - Unknown
44 72 75 67 46 72 65 65 00 00 00 00 00 00 00 00 DrugFree........ - Charcter Name[/code]

[code]68          h    - Packet ID
b0 66 00 00 .f.. - Server Hash (Doesn't look right 0.o)
0d 02      ..  - Server Token
04          .    - Class ID - Barb
0b 00 00 00 .... - Ver Byte (should be 0x0C)
50 cc 5d ed P.]. - Unknown
b6 19 a5 91 .... - Unknown
00          .    - Unknown
44 72 75 67 46 72 65 65 00 b3 6f 4b 00 00 00 00 DrugFree..oK.... - Character Name[/code]
November 29, 2009, 6:25 PM
mime
Hdx, thanks.

I not correctly read the d2gsHash from  S->С MCP_JOIN_GAME ...

I have correctly received d2gsHash and change a packet as you have told.
[code]
Buffer b = new Buffer();
b.addByte((byte) PacketIDs.D2GS_GAMELOGON);
b.addDWord(d2gshash);
b.addWord((short) d2gstoken);
b.addByte((byte) 0x04);
b.addDWord(0x0B); // version byte 0x0B
b.addDWord(0xED5DCC50);
b.addDWord(0x91A519B6);
b.addByte((byte) 0x00);
b.addNTString("DrugFree"); // name (null-terminated string)
b.addByte((byte) 0xb3);
b.addByte((byte) 0x6F);
b.addByte((byte) 0x4B);
b.addByte((byte) 0x00);
b.addByte((byte) 0x00);
b.addByte((byte) 0x00);
b.addByte((byte) 0x00);
[/code]

Also has received the answer
[code]
[22:33:28]: Send D2GS_GAMELOGON (0x68) packet...

68 6e ac 8d 38 0a 02 04 0b 00 00 00 50 cc 5d ed hn..8.......P.].
b6 19 a5 91 00 44 72 75 67 46 72 65 65 00 b3 6f .....DrugFree..o
4b 00 00 00 00                                   K....
Length: 37

[22:33:28]: {D2GS} Read response...
6 7a 9 2e ef 5c
[/code]

But if to specify VersinByte 0x0C that of the answer will not be ... :[

Response  6 7a 9 2e ef 5c is correctly? I  read here (https://davnit.net/bnet/vL/index.php?topic=11756.0) that it should be 02 5C :(
November 29, 2009, 8:44 PM
Purri
My send 0x68
[code]
Public Sub D2GSsend0x68(hD2GShash As Long, hD2GSToken As Integer)
Dim tmpStr As String, pdBuf As String
    pdBuf = HexToStr("00 00 00 00 8F D4 77 3A 18 AE 6F 4B 00 00 00 00")
    Call CopyMemory(ByVal pdBuf, ByVal CStr(hplayer & vbNullChar), Len(hplayer) + 1)
    Call iClear
    Call iDWORD(hD2GShash)  ---(DWORD) D2GS Server Hash
  Call iWORD(hD2GSToken) ---(WORD) D2GS Server Token
    Call iBYTE(&H3) ---(BYTE) Character ID (paladin)
    Call iDWORD(&HC) ---(DWORD) Version byte (Currently 0x0C)
    Call iDWORD(&HED5DCC50) ---(DWORD) Unknown - Suggested Const (0xED5DCC50)
    Call iDWORD(&H91A519B6) ---(DWORD) Unknown - Suggested Const (0x91A519B6)
    Call iBYTE(&H0) ---(BYTE) Unknown - Suggested (0x00)
    Call iSTRING(pdBuf) --(STRING) Character name
    Call iHEADER(&H68, D2GS_HEADER)
    Call iPacket(Form1.D2GS_SOCKET.SocketHandle)
    ShowChat vbGreen, "D2GS 0x68 Create Game."
  Form1.D2GS_PING = True
End Sub
[/code]
Possible Character IDs:
0x00 - Amazon
0x01 - Sorceress
0x02 - Necromancer
0x03 - Paladin
0x04 - Barbarian
0x05 - Druid
0x06 - Assassin
[code]
  Case &HAF:  Call D2GSsend0x68(hD2GShash, hD2GSToken)
    Case &H5C02
        If Len(data) = 2 Then
        Call D2GSsend0x6B
        Call D2GSsend0x6D
            D2GS_PING = True
            Exit Sub
        Else
[/code]

So if you get 02 5c response from server, just send 0x6B. with first ping packet

here chat log
[code]
[0:41:10] Show D2GS Event.
[0:41:18] Creating Normal game! Game number: 2
[0:41:18] Joining created game..
[0:41:18] 0x1c sent
[0:41:18] 0x22 sent - Version:  0x0C
[0:41:18] Leave chat - 0x10
[0:41:18] Connecting now D2GS (213.248.106.35:4000)
[0:41:18] Connected!
[0:41:18]  AF 01
[0:41:18] Hash: 410450814
[0:41:18] Token: 491
[0:41:18] Character name: Fatalyz
[0:41:18] D2GS 0x68 Create Game.
[0:41:18] D2GS pingtimer is alive.
  01 00 04 00 30 00 01 01 00 2F 00 00 00 00 00 00    ....0..../......
  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
  00 00 00 00 00 00 00 00    ........
[0:41:19]  02 5C
[0:41:19] 0x6B sent Enter game.
[0:41:19] 0x59 Player Fatalyz, Paladin. [-125892792]

[/code]
November 29, 2009, 10:46 PM
mime
Purri, yes I get 02 5c, and send D2GS_ENTERGAMEENVIRONMENT and 0x6B  and d2g2_ping packets.

But, I have some questions...

What to specify in argument:
(DWORD) Tick Count in D2GS_PING packet? I specify const number 20 and send  every 6 seconds ...

After sending 0x6B packet the server sends me a very big quantity of data. How to parse they?

Thanks.
November 29, 2009, 11:28 PM
Purri
[quote author=mime link=topic=18120.msg183780#msg183780 date=1259537291]
Purri, yes I get 02 5c, and send D2GS_ENTERGAMEENVIRONMENT and 0x6B  and d2g2_ping packets.

But, I have some questions...

What to specify in argument:
(DWORD) Tick Count in D2GS_PING packet? I specify const number 20 and send  every 6 seconds ...

After sending 0x6B packet the server sends me a very big quantity of data. How to parse they?

Thanks.

[/quote]

D2GS_PING DWORD you can use GetTickCount() function.

And after you send 0x6B and you get in game, all data is compressed, tbh AF 01 tells to client that next packets gonna be compressed.
November 30, 2009, 12:33 AM

Search