• Welcome to Valhalla Legends Archive.
 

D2GS_GAMELOGON problem

Started by mime, November 29, 2009, 06:44 AM

Previous topic - Next topic

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

Packet log:

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



mime

#1
And so too does not work :(


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();


Log:

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


Hdx

#2
(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


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


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

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

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.

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


Also has received the answer

[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


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 (http://forum.valhallalegends.com/index.php?topic=11756.0) that it should be 02 5C :(

Purri

My send 0x68

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

Possible Character IDs:
0x00 - Amazon
0x01 - Sorceress
0x02 - Necromancer
0x03 - Paladin
0x04 - Barbarian
0x05 - Druid
0x06 - Assassin

  Case &HAF:   Call D2GSsend0x68(hD2GShash, hD2GSToken)
    Case &H5C02
        If Len(data) = 2 Then
         Call D2GSsend0x6B
         Call D2GSsend0x6D
            D2GS_PING = True
            Exit Sub
        Else


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

here chat log

[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]


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.

Purri

Quote from: mime on November 29, 2009, 05:28 PM
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.


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.