• Welcome to Valhalla Legends Archive.
 
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - mime

#1
MyndFyre, big thanks.
#2
Hi all.

How to detect user client when he enters in  channel or when is already in a channel? (EID_JOIN and EID_SHOWUSER)

Thanks.
#4
Ringo, Thanks you for your answer :)


Compressed packet:

17 5f a0 14 c6 b1 b9 48 a8 35 8c a3 2f ff 82 1b ._.....H.5../...
f3 25 62 e8 66 6c e8 6f bf 02 2c bf dd 7b bd c2  ....


This compressed data without length bytes.

If to you it is not difficult, you can check up at yourselves these packets ?

I have just capture this package by means of Wireshark:


0000   f1 11 17 57 e8 05 31 ac 6e 52 2a 0d 63 28 cb ff
0010   e0 86 bf 32 56 2e 86 66 ce 86 fa fc 08 b2 bf dd
0020   7b bd c2 5d c2 65 c2 6d c2 75 d0 5d 8b 9f b8 ef
0030   68 79 b8 f9 68 06 dc 07 da 02 34 25 db 40 4a 7c
0040   0a 5c 3a af e3 e5 b6 db 6c be 30 bd dd de f7 f7
0050   77 df bb ee ee ef 7c 70 25 21 fb de 83 f9 1c d1
0060   ef 39 b9 c3 06 83 c1 ab 06 84 9b de f7 ef 30 34
0070   75 de f7 ba 6d ff ff e3 e0 f1 98 1a 14 9a ff fc
0080   3e eb 7f eb 79 dc 80 e4 04 80 ad ad e7 72 02 b7
0090   ad 90 12 03 eb 6b 7f ff fe b7 ad ad ff fc c6 bf
00a0   18 9f 9c c5 c3 97 48 72 b9 3d 41 f1 45 ce 50 19
00b0   9d 22 81 86 2a 0c 22 f1 d1 8c 23 3c e4 c8 f0 e8
00c0   cc 2f 90 27 30 2a 80 dc d0 e3 9a 56 c6 5c 3f 0c
00d0   80 21 10 f2 02 08 a3 a0 2c 84 4e 34 23 fa fc d6
00e0   b6 32 87 6c ad 15 43 d4 23 c8 59 73 31 30 b8 aa
00f0   4e 19 56 a4 5c 11 24 1f 40 38 3f 00 e8 89 e1 e0
0100   f6 02 59 61 a1 64 96 21 14 81 88 01 33 03 e0 fc
0110   77

// length 273


My program log:


Compressed data: // (without length bytes)

17 57 e8 05 31 ac 6e 52 2a 0d 63 28 cb ff e0 86 .W..1.nR*.c(....
bf 32 56 2e 86 66 ce 86 fa fc 08 b2 bf dd 7b bd .2V..f........{.
c2 5d c2 65 c2 6d c2 75 d0 5d 8b 9f b8 ef 68 79 .].e.m.u.]....hy
b8 f9 68 06 dc 07 da 02 34 25 db 40 4a 7c 0a 5c ..h.....4%.@J|.\
3a af e3 e5 b6 db 6c be 30 bd dd de f7 f7 77 df :.....l.0.....w.
bb ee ee ef 7c 70 25 21 fb de 83 f9 1c d1 ef 39 ....|p%!.......9
b9 c3 06 83 c1 ab 06 84 9b de f7 ef 30 34 75 de ............04u.
f7 ba 6d ff ff e3 e0 f1 98 1a 14 9a ff fc 3e eb ..m...........>.
7f eb 79 dc 80 e4 04 80 ad ad e7 72 02 b7 ad 90 .y........r....
12 03 eb 6b 7f ff fe b7 ad ad ff fc c6 bf 18 9f ...k...........
9c c5 c3 97 48 72 b9 3d 41 f1 45 ce 50 19 9d 22 ....Hr.=A.E.P.."
81 86 2a 0c 22 f1 d1 8c 23 3c e4 c8 f0 e8 cc 2f ..*."...#<...../
90 27 30 2a 80 dc d0 e3 9a 56 c6 5c 3f 0c 80 21 .'0*.....V.\?..!
10 f2 02 08 a3 a0 2c 84 4e 34 23 fa fc d6 b6 32 ......,.N4#....2
87 6c ad 15 43 d4 23 c8 59 73 31 30 b8 aa 4e 19 .l..C.#.Ys10..N.
56 a4 5c 11 24 1f 40 38 3f 00 e8 89 e1 e0 f6 02 V.\.$.@8?.......
59 61 a1 64 96 21 14 81 88 01 33 03 e0 fc 77     Ya.d.!....3...w
Length: 271

Decompressed data:

59 02 00 00 00 04 44 72 75 67 46 72 65 65 00 00 Y.....DrugFree..
00 00 00 00 00 00 00 00 00 00 aa 00 02 00 00 00 ................
0c 69 59 f9 ff 1f 76 00 02 00 00 00 94 13 02 00 .iY...v.........
00 00 00 00 01 02 00 01 01 00 01 d9 00 01 da 00 ................
01 db 00 01 dc 00 01 04 00 01 05 00 01 03 00 01 ................
7f 00 14 82 00 01 8a 00 14 8d 00 01 91 00 14 94 ...............
00 06 95 00 14 99 00 03 9b 00 01 23 00 02 00 00 ...........#....
00 00 8a 00 ff ff ff ff 97 5e 01 00 01 01 01 01 .........^......
00 01 00 01 00 00 00 00 01 01 01 00 00 01 00 00 ................
00 01 01 00 00 01 01 01 01 01 00 01 00 00 77 28 ..............w(
06 00 00 00 00 00 01 00 01 00 04 00 00 00 00 00 ................
00 00 19 10 01 00 01 00 1d 00 01 18 05 10 81 11 ................
05 10 25 00 01 00 01 00 01 00 01 00 00 00 01 00 ..%.............
09 10 01 02 01 00 01 00 01 00 01 12 00 00 01 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
8a 81 00 00 09 10 4d 14 00 00 00 00 00 00 00 00 ......M.........
00 00 00 00 00 00 29 00 00 00 80 00 00 00 00     ......)........
Length: 271



It is correct?
#5
Where it is possible to find the code of GetPacketSize function from ringo's dll?
#6
Quote from: Purri on December 06, 2009, 12:51 PM
Packet: 0x59
01 00 00 00 04 44 72 75 67 46 72 65 65 00 00 00 .....DrugFree...
00 00 00 00 00 00 00 00 00                       .........
Length: 25


Even Length is 25, you need to skip first byte and start parsing at Length: 26. Hard to explaing with bad english

26? Why? As I understand, length of 0x59  packet == 25 (without packetId).
#7
I cannot find packets  yet 0x9D, 0x26, 0x9C ... : (
#8
Hello, I have some problem with parsing d2gs decompressed data. At the parse I meet unknown packets...

It is an example of decompressing and parse of  first big packet after game logon:

Compressed packet:

17 5f a0 14 c6 b1 b9 48 a8 35 8c a3 2f ff 82 1b ._.....H.5../...
f3 25 62 e8 66 6c e8 6f bf 02 2c bf dd 7b bd c2 .%b.fl.o..,..{..
5d c2 65 c2 6d c2 75 d0 5d 8b 9f b8 ef 68 79 b8 ].e.m.u.]....hy.
f9 68 06 dc 07 da 02 34 25 db 40 4a 7c 0a 5c 3a .h.....4%.@J|.\:
bf 8f 96 db 6d b2 f8 c2 f7 77 7b df dd df 7e ef ....m....w{...~.
bb bb bd f1 c0 94 87 ef 7a 0f e4 73 47 bc e6 e7 ........z..sG...
0c 1a 0f 06 ac 1a 12 6f 7b df bc c0 d1 d7 7b de .......o{.....{.
e9 b7 ff ff 8f 83 c6 60 68 52 6b ff f0 fb ad ff .......`hRk.....
ad e7 72 03 90 12 02 b6 b7 9d c8 0a de b6 40 48 ..r...........@H
0f ad ad ff ff fa de b6 b7 ff f3 1b f1 89 f9 cc ................
5c 39 74 87 2b 93 d4 1f 14 5c e5 01 99 d2 28 18 \9t.+....\....(.
62 a0 c2 2f 1d 18 c2 33 ce 4c 8f 0e 8c c2 f9 02 b../...3.L......
73 02 a8 0d cd 1f 9a 56 c6 5c 3f 0c 80 21 10 f2 s......V.\?..!..
02 08 a3 a0 2c 84 4e 34 5f df 9a d6 c6 50 ed 95 ....,.N4_....P..
a2 a8 7a 84 79 0b 2e 66 26 17 15 49 c3 2a d4 8b ..z.y..f&..I.*..
82 24 83 e8 07 07 e0 1d 11 3c 3c 1e c0 4b 2c 34 .$.......<<..K,4
2c 92 c4 22 90 31 00 26 60 7c 1f 8e e0          ,..".1.&`|...
Length: 269

Decompressed packet:

59 01 00 00 00 04 44 72 75 67 46 72 65 65 00 00 Y.....DrugFree..
00 00 00 00 00 00 00 00 00 00 aa 00 01 00 00 00 ................
0c 69 59 f9 ff 1f 76 00 01 00 00 00 94 13 01 00 .iY...v.........
00 00 00 00 01 02 00 01 01 00 01 d9 00 01 da 00 ................
01 db 00 01 dc 00 01 04 00 01 05 00 01 03 00 01 ................
7f 00 14 82 00 01 8a 00 14 8d 00 01 91 00 14 94 ...............
00 06 95 00 14 99 00 03 9b 00 01 23 00 01 00 00 ...........#....
00 00 8a 00 ff ff ff ff 97 5e 01 00 01 01 01 01 .........^......
00 01 00 01 00 00 00 00 01 01 01 00 00 01 00 00 ................
00 01 01 00 00 01 01 01 01 01 00 01 00 00 77 28 ..............w(
06 00 00 00 00 00 01 00 01 00 04 00 00 00 00 00 ................
00 00 19 10 01 00 01 00 1d 00 01 18 05 10 81 11 ................
05 10 25 00 01 00 01 00 01 00 01 00 00 00 01 00 ..%.............
09 10 01 02 01 00 01 00 01 00 01 12 00 00 01 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
8a 81 00 00 09 10 4d 14 00 00 00 00 00 00 00 00 ......M.........
00 00 00 00 00 00 29 00 00 00 80 00 00          ......)......
Length: 269

Start parsing...

Packet: 0x59
01 00 00 00 04 44 72 75 67 46 72 65 65 00 00 00 .....DrugFree...
00 00 00 00 00 00 00 00 00                      .........
Length: 25

Packet: 0xaa
00 01 00 00 00 0c 69 59 f9 ff 1f                ......iY...
Length: 11

Packet: 0x76
00 01 00 00 00                                  .....
Length: 5

Packet: 0x94
01 00 00 00 00 00 01 02 00 01 01 00 01 d9 00 01 ................
da 00 01 db 00 01 dc 00 01 04 00 01 05 00 01 03 ................
00 01 7f 00 14 82 00 01 8a 00 14 8d 00 01 91 00 ...............
14 94 00 06 95 00 14 99 00 03 9b 00 01 23 00    .............#.
Length: 63

Here the beginning of unknown packets ...


The remained data :

02 00 00 00 00 8a 00 ff ff ff ff 97 5e 01 00 01 ............^...
01 01 01 00 01 00 01 00 00 00 00 01 01 01 00 00 ................
01 00 00 00 01 01 00 00 01 01 01 01 01 00 01 00 ................
00 77 28 06 00 00 00 00 00 01 00 01 00 04 00 00 .w(.............
00 00 00 00 00 19 10 01 00 01 00 1d 00 01 18 05 ................
10 81 11 05 10 25 00 01 00 01 00 01 00 01 00 00 .....%..........
00 01 00 09 10 01 02 01 00 01 00 01 00 01 12 00 ................
00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 8a 81 00 00 09 10 4d 14 00 00 00 00 00 .........M......
00 00 00 00 00 00 00 00 00 29 00 00 00 80 00 00 .........)......
00 00                                            ..
Length: 162


In what a problem? May be wrong length?

Thanks.

#9
If will change ">>" on ">>>" the same result :(
#10
Camel, I have made as you have told, move out all in one gamePacketDecode method.

Method gamePacketDecode and main method:
public byte[] gamePacketDecode(byte[] packet) {

// get packet length and offset
int size, offset;

int x;
if (packet[0] < 0xF0) { // if length == 1 byte, offset = 1;
   size = packet[0] - 1;
   offset = 1;
} else {
   x = (packet[0] & 0xF) << 8; // if length == 2 byte, offset = 2;
   size = x + packet[1] - 2;
   offset = 2;
}

System.out.println("Length:" + size);
System.out.println("Offset:" + offset);

int a = 0, b = 0, c = 0, d = 0;

int index;
int cnt = 0x20;
int outmax = size;
int maxcnt = outmax;

byte[] outdata = new byte[size];
byte[] indata = new byte[size];
// coppy packet without size byte
System.arraycopy(packet, offset, packet, 0, size);

int inix = 0; // index of indata array
int outix = 0; // index of outdata array
while (true) {
   if (cnt >= 0x8) {
while (size > 0 && cnt >= 8) {
   cnt -= 0x8;
   size--;
   a = indata[inix++] << cnt;
   b |= a;
}
   }

   index = charIndex[b >> 0x18];
   a = charTable[index];
   d = (b >> (0x18 - a)) & bitMasks[a];
   c = charTable[index + 2 * d + 2];

   cnt += c;
   if (cnt > 0x20) {
size = outmax - maxcnt;
break;
   }

   if (maxcnt-- == 0)
break;

   a = charTable[index + 2 * d + 1];
   outdata[outix++] = (byte) a;

   b <<= (c & 0xFF);
}

return outdata;
   }

   public static void main(String[] args) {
D2GSPacketDecoder decoder = new D2GSPacketDecoder();
byte[] packet = { 0x07, 0x1f, 0x7f, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xc0 };
byte[] decPacket = decoder.gamePacketDecode(packet);
System.out.println("Packet:");
for (int ix = 0; ix < decPacket.length; ix++) {
   System.out.print(Integer.toHexString(decPacket[ix]) + " ");
}
   }


Method output:

Length:6
Offset:1
Packet:
2f 2f 2f 2f 0 0


I followed an example of a packet from here: http://forum.valhallalegends.com/index.php?topic=14507.msg153465#msg153465

compressed packet: 07 1f 7f ff ff ff c0
decompressed packet: 8F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

But my method return  2f 2f 2f 2f 0 0 :(

Please, prompt what to make that the program worked correctly?
#11
I create the buffer with the size which function getpacketsize () returns and I transfer it the buffer in gamepacketdecode.

http://pastebin.com/m5410ca3a
#12
Camel,
Yes, Java have  ">>>" not sign right-shift, but not have "<<<" ...

I am familiar with bitwise and bit shift operators, but I can not understand as to apply them to this code : (

Please prompt how to force to work the program.

I replase operator ">>" on ">>>" but the program does not work all the same ...

Sorry for silly questions.
#13
Hi, I rewrote the code to Java, but it does not work. : (

Here's the code:
http://pastebin.com/m389b1923

the line 188 is throw exception java.lang.ArrayIndexOutOfBoundsException: -1

What am I doing wrong?

Help please.

Thanks!
#14
Hello who can help ported  this http://forum.valhallalegends.com/index.php?topic=585.msg4318#msg4318 code on Java ?

I will be very grateful for any help.
#15
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.