Valhalla Legends Archive

Programming => Battle.net Bot Development => Battle.net Bot Development References => Topic started by: Smurfling on April 24, 2003, 07:41 AM

Title: Packet 0x1C and 0x3C Information
Post by: Smurfling on April 24, 2003, 07:41 AM
Well, &H1C to create a game isn't really the problem. After sending &H1C i am receiving the server response &H1C with &H00000000, so all's fine.

I think i must be doing something wrong with &H3C for map auth... well i don't really know what's within the packet, i am just inserting the data from a packet logged from the original bw client.


       Dim po(15) As Object
       po(0) = "DWORD"
       po(1) = &H59490100
       po(2) = "DWORD"
       po(3) = &H99398E7D
       po(4) = "DWORD"
       po(5) = &H45DC24F0
       po(6) = "DWORD"
       po(7) = &H11E51CA
       po(8) = "DWORD"
       po(9) = &H66EA9E2
       po(10) = "DWORD"
       po(11) = &H427C452D
       po(12) = "NTSTRING"
       po(13) = "(4)Lost Temple.scm"
       po(14) = "PACKET"
       po(15) = &H3C


After sending &H3C i am receiving the server response &H3C with &H00000000, map auth failed.

What i am trying to do is create and then start a game. Can somebody help me with that? Does anybody know what the values are for?

<Edited to add some more info>
Title: Re:Broodwar Packets &H1C + &H3C
Post by: Tazo on April 24, 2003, 07:46 AM
Try using a packetbuffer class, its a whole lot easier ^^
Title: Re:Broodwar Packets &H1C + &H3C
Post by: Smurfling on April 24, 2003, 07:51 AM
QuoteTry using a packetbuffer class, its a whole lot easier ^^

I am using csb, just passing the object to csb.buildpacket("BNET",po) so

1) I can't use packetbuffer class
2) isn't it like a packetbuffer?  :P
Title: Re:Broodwar Packets &H1C + &H3C
Post by: Camel on April 24, 2003, 11:30 AM
Quote from: Andreas Strobl on April 24, 2003, 07:51 AM
QuoteTry using a packetbuffer class, its a whole lot easier ^^

I am using csb, just passing the object to csb.buildpacket("BNET",po) so

1) I can't use packetbuffer class
2) isn't it like a packetbuffer?  :P
CSB would be a lot more lightweight if it just had functions like InsertDWORD(Long), InsertWORD(Integer), InsertNTString(String), InsertNonNTString(String), SendPacket(Byte)
Title: Re:Broodwar Packets &H1C + &H3C
Post by: Smurfling on April 24, 2003, 12:08 PM
Quote from: Camel on April 24, 2003, 11:30 AM
Quote from: Andreas Strobl on April 24, 2003, 07:51 AM
QuoteTry using a packetbuffer class, its a whole lot easier ^^

I am using csb, just passing the object to csb.buildpacket("BNET",po) so

1) I can't use packetbuffer class
2) isn't it like a packetbuffer?  :P
CSB would be a lot more lightweight if it just had functions like InsertDWORD(Long), InsertWORD(Integer), InsertNTString(String), InsertNonNTString(String), SendPacket(Byte)

Yea that's true, but well i can't complain about csb... i am really glad cuphead made it  ;D
Title: Re:Broodwar Packets &H1C + &H3C
Post by: Mesiah / haiseM on April 24, 2003, 12:51 PM
might i add, that i was the one who presented the idea of packet "building" to cuphead :P
Title: Re:Broodwar Packets &H1C + &H3C
Post by: Banana fanna fo fanna on April 24, 2003, 07:52 PM
Why doesn't someone invent a way to automatically turn a Type into a serialized packet? Or is that too hard for VB to handle?
Title: Re:Broodwar Packets &H1C + &H3C
Post by: Yoni on April 24, 2003, 07:58 PM
St0rm: Yes.

Andreas: You seem to be using strings where you should be using enumerations. Look up "Enum" in your VB reference.
Title: Re:Broodwar Packets &H1C + &H3C
Post by: Smurfling on April 25, 2003, 02:46 AM
Quote from: Yoni on April 24, 2003, 07:58 PM
St0rm: Yes.

Andreas: You seem to be using strings where you should be using enumerations. Look up "Enum" in your VB reference.



   Enum MapAuthParts
       P1 = &H59490100
       P2 = &H99398E7D
       P3 = &H7D45DC24
       P4 = &HF0011E51
       P5 = &HCA066EA9
       P6 = &HE2427C45
   End Enum

       Dim po(15) As Object
       po(0) = "DWORD"
       po(1) = MapAuthParts.P1
       po(2) = "DWORD"
       po(3) = MapAuthParts.P2
       po(4) = "DWORD"
       po(5) = MapAuthParts.P3
       po(6) = "DWORD"
       po(7) = MapAuthParts.P4
       po(8) = "DWORD"
       po(9) = MapAuthParts.P5
       po(10) = "DWORD"
       po(11) = MapAuthParts.P6
       po(12) = "NTSTRING"
       po(13) = "-(4)Lost Temple.scm"
       po(14) = "PACKET"
       po(15) = &H3C
       csb.BuildPacket("BNET", po)


I think you told me to try this? Well it still isn't working for me... Think i tried too much - changed a bit, changed it again, and now i got a disc and don't know what i changed to get the it  ;D

[09:50:51]  InGame: Creating Game Hansi a
[09:50:51]  InGame: Game Creation Successfull
[09:50:55]  InGame: Starting Game
[09:50:55]  InGame:  FF 3C 08 00 00 00 00 00
[09:50:55]  InGame: Map Authorization Failed
[09:50:55]  InGame: Leaving Game
[09:51:33]  BdNBot's record:
[09:51:33]  Normal games: 0-0-1
[09:51:33]  Ladder games: 0-0-0


btw + 1 for Yoni for posting the first real reply to my topic  ;)

Edit: Hmm just tried to do the map auth with a different map and different values... still didn't get it to send me FF 3C 08 00 01 00 00 00. I must be doing something different then the values wrong. Is this the right packet order to get a game started?

Create it: &H1C
Left Channel: &H10
Start it: &H3C
Title: Re:Broodwar Packets &H1C + &H3C
Post by: Tazo on April 25, 2003, 08:46 AM
im just guessing, but shouldn't you leave the channel first?
Title: Re:Broodwar Packets &H1C + &H3C
Post by: pianka on April 25, 2003, 09:47 AM
Quote from: laurion on April 25, 2003, 08:46 AM
im just guessing, but shouldn't you leave the channel first?
As far as I know, you do leave the channel first, I don't do much game packet handeling, so my knowledge is limited, but my rejoin function uses a game rejoin instead of a void rejoin (it's a ton faster) and it leaves the channel before it joins the game...
Title: Re:Broodwar Packets &H1C + &H3C
Post by: UserLoser on April 25, 2003, 04:27 PM
Isn't there UDP involved...?
Title: Re:Broodwar Packets &H1C + &H3C
Post by: Mesiah / haiseM on April 25, 2003, 08:27 PM
there sure is, you gotsta be sendin them udp packets before u try kickin it wit da 0x3C homes.
Title: Re:Broodwar Packets &H1C + &H3C
Post by: Camel on April 25, 2003, 11:30 PM
Quote from: St0rm.iD on April 24, 2003, 07:52 PM
Why doesn't someone invent a way to automatically turn a Type into a serialized packet? Or is that too hard for VB to handle?

there's no point in diong that in vb, because you can't use pointers, so you would have to copymemory from the type to a string in order to send it. it's much more simple to write functions to construct packets or use a packet buffer. using types is not out of the reach of vb, it's just undesirable.

i suppose one could do something like:
Type FullPacket
   PacketHeader As Byte
   PacketID As Byte
   PacketLength As Integer
   Data As Integer
End Type

Public Sub SendPacket(PacketID As Byte, Data As String)
   Dim MyPacket As FullPacket
   MyPacket.PacketHeader = CByte(&HFF)
   MyPacket.PacketID = PacketID
   MyPacket.PacketLength = Len(Data)
   MyPacket.Data = Data
   SCK.SendData MyPacket
End Sub

btw, that's totally untested code

one could make types for each different packet, convert them to strings, and call that function, or write seperate types and functions for each packet


[edit] for the record, i just deal with everything as strings, and organize my code so it's readable ;)
               hashout = _
                   MKL(KeyCount) & _
                   MKL(IIf(frmSetup.Spawn, 1, 0)) & _
                   hashout
               
               SendPacket &H51, _
                   MKL(seed) & _
                   MKL(version) & _
                   MKL(CheckSum) & _
                   hashout & _
                   ExeInfo & Chr(0) & _
                   Left(frmSetup.uLogin, 15) & Chr(0)


[edit2] sendpacket() calls makepacket():
Public Function MakePacket(ByVal ID As Long, ByVal Data As String)
   MakePacket = Chr(&HFF) & Chr(ID) & MKI(Len(Data) + 4) & Data
End Function
Title: Re:Broodwar Packets &H1C + &H3C
Post by: dxoigmn on April 26, 2003, 12:33 AM
I'd much rather use a PacketBuffer.  Makes code much simpler and easier to read and you can reuse the class for different things such at botnet, d2gs, mcp, and the bncs file protocol.  As an example:


Public Sub writeUserData(Fields() As String, Values() As String)

   Dim oPBuf As New CPacketBuffer
   
   oPBuf.Insert CLng(1)
   oPBuf.Insert UBound(Fields) + 1
   oPBuf.Insert CByte(0)
   oPBuf.Insert Fields()
   oPBuf.Insert Values()
   BNCSClient.SendData oPBuf.BNCSPacket(SID_WRITEUSERDATA)
   
   Set oPBuf = Nothing

End Sub


Edit: In my CPacketBuffer class there are other subroutines to create packets from the buffer: MCPPacket(), FILEPacket(), BOTNETPacket(), and D2GSPacket().
Title: Re:Broodwar Packets &H1C + &H3C
Post by: Smurfling on May 13, 2003, 05:54 AM
LoL took me too long to handle but finally got it accepting &H1C and &H3C (for both, standard and ladder).

So after changing the game status from created to open to started the game should run and i don't get any errors back. I didn't thought about the time you need to stay in game to have no draw yet so i remained ingame for 2 mins. After that i tried sending the report but somehow bnet always bans me  >:(

Does BNet check the report header and text?  I don't know what most values are for, just know the result,users,slots, report header & text. Anyone can help me out there?


   Private Sub GameReport()
       AddChat(Col.Gainsboro, "InGame: ", Col.White, "Sending Game Report")

       Dim po(15) As Object
       po(0) = "DWORD"           'Whats that for?
       po(1) = &H0
       po(2) = "DWORD"           'Player Slots
       po(3) = &H8
       po(4) = "DWORD"           'Game Result - Here a Win
       po(5) = &H1
       po(6) = "DWORD"           'Whats that for?
       po(7) = &H0
       po(8) = "DWORD"           'Whats that for?
       po(9) = &H0
       po(10) = "DWORD"           'Whats that for?
       po(11) = &H0
       po(10) = "DWORD"           'Whats that for?
       po(11) = &H0
       po(10) = "DWORD"           'Whats that for?
       po(11) = &H0
       po(10) = "DWORD"           'Whats that for?
       po(11) = &H0
       po(10) = "DWORD"           'Whats that for?
       po(11) = &H0
       po(12) = "STRING"           'Users in game
       po(13) = Username
       po(10) = "DWORD"           'Whats that for?
       po(11) = &H0
       po(10) = "DWORD"           'Whats that for?
       po(11) = &H0
       po(12) = "STRING"           'Report Header
       po(13) = "On map Lost Temple:"
       po(12) = "BYTE"           'Split?
       po(13) = &HA
       po(12) = "BYTE"           'NT?
       po(13) = &H0
       po(12) = "STRING"           'Report header
       po(13) = Username & " was a BdNBot and played for " & MF(GameDuration / 60000) & " minutes."
       po(12) = "BYTE"           'Split?
       po(13) = &HA
       po(12) = "BYTE"           'Split?
       po(13) = &HA
       po(12) = "STRING"           Report text
       po(13) = "BdNBot Likes To Play Battle.Net Games ;)"
       po(14) = "PACKET"
       po(15) = &H2C
       csb.BuildPacket("BNET", po)
Title: Re:Broodwar Packets &H1C + &H3C
Post by: iago on May 13, 2003, 12:27 PM
It's really easy to figure out, just get into a few games, log the packets, and compare.  

There are some things that you really ought to figure out yourself, and I think this is one of them :-P
Title: Re:Broodwar Packets &H1C + &H3C
Post by: Smurfling on May 14, 2003, 04:21 AM

      po(4) = "DWORD"           'Game Result Player1
       po(5) = &H1
       po(6) = "DWORD"           'Game Result Player2
       po(7) = &H0
       po(8) = "DWORD"           'Game Result Player3
       po(9) = &H0
       po(10) = "DWORD"           'Game Result Player4
       po(11) = &H0
       po(10) = "DWORD"           'Game Result Player5
       po(11) = &H0
       po(10) = "DWORD"           'Game Result Player6
       po(11) = &H0
       po(10) = "DWORD"           'Game Result Player7
       po(11) = &H0
       po(10) = "DWORD"           'Game Result Player8
       po(11) = &H0


Ah think i got the first, 8 DWORD's for the Results of max 8 Players. If there weren't all player slots full the DWORD = &H0