• Welcome to Valhalla Legends Archive.
 

Packet 0x09 Information #2

Started by Smurfling, May 13, 2003, 09:14 AM

Previous topic - Next topic

Smurfling

Fine, finally you made it - i'm bored getting asked how to parse 0x09 so here it is. I know there are better ways for coding but i'm currently trying to get all working, then i can think about smarter ways.

Oh yea, thats VB .NET Code so don't be suprised if things like Encoding or Col don't work for 6.0  ::)


  Private Sub Parse0x09(ByVal Data As String)
       frmList.ListView1.Items.Clear()
       Dim GameHeader As String
       Dim GameCount As Integer
       Dim GameU1 As String
       Dim GameTyp As String
       Dim GameU2 As String
       Dim GameU3 As String
       Dim GamePort As String
       Dim GameIP As String
       Dim GameU4 As String
       Dim GameU5 As String
       Dim GameStatus As String
       Dim GameLatency As String
       Dim GameName As String
       Dim GamePass As String
       Dim GameInfo As String
       Dim Games As String
       Dim i As Integer
       Dim GameRest As String
       Dim GameLen As Integer

       GameHeader = Mid(Data, 1, 4)
       GameCount = Asc(Mid(Data, 5, 4))
       Games = Mid(Data, 9)

       For i = 1 To GameCount
           GameU1 = Mid(Games, 1, 4)
           GameTyp = Asc(Mid(Games, 5, 2))
           GameU2 = Mid(Games, 7, 2)
           GameU3 = Mid(Games, 9, 2)
           GamePort = Mid(Games, 11, 2)
           GameIP = Mid(Games, 13, 4)
           GameU4 = Mid(Games, 17, 4)
           GameU5 = Mid(Games, 21, 4)
           GameStatus = Asc(Mid(Games, 25, 4))
           GameLatency = Asc(Mid(Games, 29, 4))
           GameRest = Mid(Games, 33)

           GameName = Mid(GameRest, 1, InStr(GameRest, Chr(0)) - 1)
           GameRest = Mid(GameRest, InStr(GameRest, Chr(0)) + 1)
           GamePass = Mid(GameRest, 1, InStr(GameRest, Chr(0)) - 1)
           If GamePass = "" Then GamePass = "-"
           GameRest = Mid(GameRest, InStr(GameRest, Chr(0)) + 1)
           GameInfo = Mid(GameRest, 1, InStr(GameRest, Chr(0)) - 1)
           Games = Mid(GameRest, InStr(GameRest, Chr(0)) + 1)
           Dim BEU As System.Text.Encoding = BEU.BigEndianUnicode
           Dim Bytes() As Byte
           Bytes = BEU.GetBytes(GameIP.ToCharArray())
           GameIP = Bytes(1) & "." & Bytes(3) & "." & Bytes(5) & "." & Bytes(7)
           Bytes = BEU.GetBytes(GamePort.ToCharArray())
           GamePort = Bytes(1) & Bytes(3)
           Dim UserItemA As New ListViewItem()
           UserItemA.Text = GameName
           UserItemA.SubItems.Add(GamePass)
           UserItemA.SubItems.Add(GetGameTyp(GameTyp))
           UserItemA.SubItems.Add(GameLatency)
           UserItemA.SubItems.Add(GameInfo)
           UserItemA.SubItems.Add(GameIP)
           UserItemA.SubItems.Add(GamePort)
           Select Case GameStatus
               Case EGameStatus.Open
                   UserItemA.ForeColor = Col.Green
                   UserItemA.Tag = "Status: Open"
               Case EGameStatus.Full
                   UserItemA.ForeColor = Col.Red
                   UserItemA.Tag = "Status: Full"
               Case EGameStatus.Done
                   UserItemA.ForeColor = Col.Red
                   UserItemA.Tag = "Status: Done"
               Case EGameStatus.Started
                   UserItemA.ForeColor = Col.Red
                   UserItemA.Tag = "Status: Started"
           End Select
           frmList.ListView1.Items.Add(UserItemA)
       Next

       frmList.ShowDialog()
   End Sub


Edit: Btw, The GameU* Strings are things i don't know what they'r standing for, so if somebody knows and could give me a little hint, ...  ;D

drivehappy

Probably just unwanted/un-needed data. You could pretty much figure it out for yourself, just look at what the values are then compare different packets you receive.

Mesiah / haiseM

#2
Thanks to moonshine, and dragon (no thanks to moonshine telling me dragon helped.)



String ",34,12,5,1,4,1,ebe6d08d,,,"   Game Options

----------------- Game Options ------------------

",34,12,5,1,4,1,ebe6d08d,,,"
 ^^ ^^ ^ ^ ^ ^ ^^^^^^^^
  5  7 1 4 2 3    6


1. Game speed
2. Game type
3. Game penalty
4. Map icon
5. Map size
6. Timestamp of some sort
7. ?
------------------------------------

Game speed goes as follows:
0 = slowest
1 = slower
2 = slow
3 = normal
4 = fast
5 = faster
6 = fastest
none = default (ladder uses this, default=fast)

------------------------------------
Game type goes as follows:
2 = Melee
3 = Free for all
4 = 1 on 1
9 = Ladder
A = Use Map Settings
F = Top vs. Bottom

------------------------------------
Penalty goes as follows:
1 = no penalty on disconnected
2 = loss on disconnect

------------------------------------
Map icons go as follows:
1 = Blue Blizzard Checkmark Icon
2 = Ladder Map Icon
3 = Green GF icon
4 = KBK challenger icon
none = default (no icon)

------------------------------------
Map size goes as follows:

a) You take the number (34).
b) You take the first number (3) and multiply it by 32
c) 3 * 32 = 96

d) You take the second number (4) and multiply it by 32
e) 4 * 32 = 128

f) Your map size is now 96x128

summary:  your number is 34. (3 * 32) x (4 * 32) = 96x128

------------------------------------


Not sure if thats what you were looking for, but im sure this can assist some people.
]HighBrow Innovations
Coming soon...

AIM Online Status: 

Smurfling

Quote from: MesiaH on May 13, 2003, 09:29 PM
Thanks to moonshine



String ",34,12,5,1,4,1,ebe6d08d,,,"   Game Options

----------------- Game Options ------------------

",34,12,5,1,4,1,ebe6d08d,,,"
 ^^ ^^ ^ ^ ^ ^ ^^^^^^^^
  5  7 1 4 2 3    6


1. Game speed
2. Game type
3. Game penalty
4. Map icon
5. Map size
6. Timestamp of some sort
7. ?
------------------------------------

Game speed goes as follows:
0 = slowest
1 = slower
2 = slow
3 = normal
4 = fast
5 = faster
6 = fastest
none = default (ladder uses this, default=fast)

------------------------------------
Game type goes as follows:
2 = Melee
3 = Free for all
4 = 1 on 1
9 = Ladder
A = Use Map Settings
F = Top vs. Bottom

------------------------------------
Penalty goes as follows:
1 = no penalty on disconnected
2 = loss on disconnect

------------------------------------
Map icons go as follows:
1 = Blue Blizzard Checkmark Icon
2 = Ladder Map Icon
3 = Green GF icon
4 = KBK challenger icon
none = default (no icon)

------------------------------------
Map size goes as follows:

a) You take the number (34).
b) You take the first number (3) and multiply it by 32
c) 3 * 32 = 96

d) You take the second number (4) and multiply it by 32
e) 4 * 32 = 128

f) Your map size is now 96x128

summary:  your number is 34. (3 * 32) x (4 * 32) = 96x128

------------------------------------


Not sure if thats what you were looking for, but im sure this can assist some people.

This is the game info required when sending &H1C (Creating the game). Already figured that out but thx anyway for trying to help.

Arta

IIRC, 'Timestamp of some sort' is the checksum of the map.

Skywing

Lots of those fields actually depend on the game type (for instance, the same field means different things in "Greed" and "Sudden Death").
IIRC, iconcode 5 is/was Gamefixx.

Undeference

This is for all bnet games (excluding of course diablo)?

"This is the game info required when sending &H1C (Creating the game). Already figured that out but thx anyway for trying to help." &H=hex value...you could say hex:1C (Although I suppose your way looks more elite-lol).

Zakath

The best way to say it is using the "0x" base prefix: 0x1c. It's the clearest and most easily recognizable.
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.

l)ragon

Quote from: Arta[vL] on May 14, 2003, 10:10 AM
IIRC, 'Timestamp of some sort' is the checksum of the map.

To test out Arta's comment i went and did some packet logs just because i was bored, anyway what i found is if Arta was right the Stamp should in essence change for each map, in each of my logs for numerus maps that part stayed the same.
1st question: is it rather if it was a checksum of the map why wouldent it change the log that, that string up there mesiah posted is Chalenger.scm i loged that map aswell to try and see if it was any diferant or the same yet it came out to be the string i expected it to be the same as the rest.
Question #2: how did you come to the point of it being the checksum and not something else.

will someone elaborate more on this thx.
*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*ˆ¨¯¯¨ˆ*^~·.,l)ragon,.-·~^*ˆ¨¯¯¨ˆ*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*

indulgence

#9
Quote from: Andreas Strobl on May 13, 2003, 09:14 AM
Fine, finally you made it - i'm bored getting asked how to parse 0x09 so here it is. I know there are better ways for coding but i'm currently trying to get all working, then i can think about smarter ways.

Oh yea, thats VB .NET Code so don't be suprised if things like Encoding or Col don't work for 6.0  ::)


  Private Sub Parse0x09(ByVal Data As String)
       frmList.ListView1.Items.Clear()
       Dim GameHeader As String
       Dim GameCount As Integer
       Dim GameU1 As String
       Dim GameTyp As String
       Dim GameU2 As String
       Dim GameU3 As String
       Dim GamePort As String
       Dim GameIP As String
       Dim GameU4 As String
       Dim GameU5 As String
       Dim GameStatus As String
       Dim GameLatency As String
       Dim GameName As String
       Dim GamePass As String
       Dim GameInfo As String
       Dim Games As String
       Dim i As Integer
       Dim GameRest As String
       Dim GameLen As Integer

       GameHeader = Mid(Data, 1, 4)
       GameCount = Asc(Mid(Data, 5, 4))
       Games = Mid(Data, 9)

       For i = 1 To GameCount
           GameU1 = Mid(Games, 1, 4)
           GameTyp = Asc(Mid(Games, 5, 2))
           GameU2 = Mid(Games, 7, 2)
           GameU3 = Mid(Games, 9, 2)
           GamePort = Mid(Games, 11, 2)
           GameIP = Mid(Games, 13, 4)
           GameU4 = Mid(Games, 17, 4)
           GameU5 = Mid(Games, 21, 4)
           GameStatus = Asc(Mid(Games, 25, 4))
           GameLatency = Asc(Mid(Games, 29, 4))
           GameRest = Mid(Games, 33)

           GameName = Mid(GameRest, 1, InStr(GameRest, Chr(0)) - 1)
           GameRest = Mid(GameRest, InStr(GameRest, Chr(0)) + 1)
           GamePass = Mid(GameRest, 1, InStr(GameRest, Chr(0)) - 1)
           If GamePass = "" Then GamePass = "-"
           GameRest = Mid(GameRest, InStr(GameRest, Chr(0)) + 1)
           GameInfo = Mid(GameRest, 1, InStr(GameRest, Chr(0)) - 1)
           Games = Mid(GameRest, InStr(GameRest, Chr(0)) + 1)
           Dim BEU As System.Text.Encoding = BEU.BigEndianUnicode
           Dim Bytes() As Byte
           Bytes = BEU.GetBytes(GameIP.ToCharArray())
           GameIP = Bytes(1) & "." & Bytes(3) & "." & Bytes(5) & "." & Bytes(7)
           Bytes = BEU.GetBytes(GamePort.ToCharArray())
           GamePort = Bytes(1) & Bytes(3)
           Dim UserItemA As New ListViewItem()
           UserItemA.Text = GameName
           UserItemA.SubItems.Add(GamePass)
           UserItemA.SubItems.Add(GetGameTyp(GameTyp))
           UserItemA.SubItems.Add(GameLatency)
           UserItemA.SubItems.Add(GameInfo)
           UserItemA.SubItems.Add(GameIP)
           UserItemA.SubItems.Add(GamePort)
           Select Case GameStatus
               Case EGameStatus.Open
                   UserItemA.ForeColor = Col.Green
                   UserItemA.Tag = "Status: Open"
               Case EGameStatus.Full
                   UserItemA.ForeColor = Col.Red
                   UserItemA.Tag = "Status: Full"
               Case EGameStatus.Done
                   UserItemA.ForeColor = Col.Red
                   UserItemA.Tag = "Status: Done"
               Case EGameStatus.Started
                   UserItemA.ForeColor = Col.Red
                   UserItemA.Tag = "Status: Started"
           End Select
           frmList.ListView1.Items.Add(UserItemA)
       Next

       frmList.ShowDialog()
   End Sub


Edit: Btw, The GameU* Strings are things i don't know what they'r standing for, so if somebody knows and could give me a little hint, ...  ;D

This could be much prettier if you used a User Defined Type  -- you could get rid of a lot of those ugly Dim's with the added benefit of making a single public variable of said type and then you can be able to access that data easily outside of that function...
<3