Valhalla Legends Forums Archive | Battle.net Bot Development References | Packet 0x09 Information #2

AuthorMessageTime
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 ::)

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

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
May 13, 2003, 2:14 PM
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.
May 13, 2003, 9:33 PM
MesiaH
Thanks to moonshine, and dragon (no thanks to moonshine telling me dragon helped.)

[code]

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

------------------------------------[/code]

Not sure if thats what you were looking for, but im sure this can assist some people.
May 14, 2003, 2:29 AM
Smurfling
[quote author=MesiaH link=board=17;threadid=1321;start=0#msg9917 date=1052879378]
Thanks to moonshine

[code]

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

------------------------------------[/code]

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

This is the game info required when sending &H1C (Creating the game). Already figured that out but thx anyway for trying to help.
May 14, 2003, 9:14 AM
Arta
IIRC, 'Timestamp of some sort' is the checksum of the map.
May 14, 2003, 3:10 PM
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.
May 20, 2003, 4:09 PM
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).
May 20, 2003, 9:49 PM
Zakath
The best way to say it is using the "0x" base prefix: 0x1c. It's the clearest and most easily recognizable.
May 20, 2003, 11:29 PM
dRAgoN
[quote author=Arta[vL] link=board=17;threadid=1321;start=0#msg9950 date=1052925009]
IIRC, 'Timestamp of some sort' is the checksum of the map.
[/quote]

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.
June 2, 2003, 2:26 AM
indulgence
[quote author=Andreas Strobl link=board=17;threadid=1321;start=0#msg9856 date=1052835262]
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 ::)

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

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

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...
June 3, 2003, 10:04 AM

Search