sorry for my pool language.
Code Select
Private Sub pop_packet(ByVal apacket() As Byte, ByVal alen As Integer)
Dim buffer(1024 * 32) As Byte
Dim result As Integer
If alen = apacket(0) Then
result = D2Packets.D2Packets.D2GSCompression.DecompressData(apacket, 1, alen - 1, buffer)
Else
result = D2Packets.D2Packets.D2GSCompression.DecompressData(apacket, 2, alen - 2, buffer)
End If
Dim i, len As Integer
i = 0
Do While i < result
If buffer(i) < &HB4 Then
If packetsize(buffer(i)) > 0 Then
len = packetsize(buffer(i))
ElseIf packetsize(buffer(i)) = -1 Then
Select Case buffer(i)
Case &H26
Dim ll As Integer = 10
Dim xo As Byte = 0
Do Until xo = 2
ll = ll + 1
If buffer(i + ll) = 0 Then
xo += 1
End If
Loop
len = ll + 1
Case &H5B
len = 36
Case &H94
len = buffer(i + 1) * 3 + 6
Case &HA8
len = buffer(i + 6)
Case &HAA
len = buffer(i + 6)
Case &HAC
len = buffer(i + 12)
Case &HAE
len = buffer(i + 6)
Case &H9C
len = buffer(i + 2)
Case &H9D
len = buffer(i + 2)
Case &HAC
len = buffer(i + 12)
Case &HAF
len = 2
Case Else
len = 2
End Select
End If
Dim tmp_packet(len - 1) As Byte
System.Array.Copy(buffer, i, tmp_packet, 0, len)
i = i + len
this_game.onpacketreceive(tmp_packet, len)
End If
Loop
End Sub