Valhalla Legends Forums Archive | Battle.net Bot Development | Grabbing Game List

AuthorMessageTime
botmaster
I want to beable to grab the current open games in d2 I noticed you need to send 0A but the recv is all weird will i need to decompress the packet or anything?
December 20, 2003, 7:21 PM
Killa
i made this for realm games awhile ago,im sure it could be coded alot better but it gives you an example of how to do it.
[code]
Public Count As Integer
Public Function Parsegames(Data As String)
Dim a As Integer
Dim gamename As String
Dim other As Integer
Dim game As String
Dim games As Integer
Dim z As Integer
a = Len(Data)
a = a - 2
other = 15
game = Mid(Data, other)
gamename = Split(game, HexToStr("00"))(0)
games = games + Len(gamename)
If gamename = "" Then
Else
Call Form3.List1.AddItem(gamename, Count)
Count = Count + 1
End If
If Not Len(Mid(Data, 14 + games)) = 3 Then
Do
DoEvents
game = ""
gamename = ""
game = Mid(Data, 16 + games)
gamename = Split(game, HexToStr("00"))(0)
games = games + Len(gamename) + 16
If gamename = "" Then
Else
Call Form3.List1.AddItem(gamename, Count)
Count = Count + 1
End If
Loop Until games = a
End If
End Function
Public Function HexToStr(ByVal Hex1 As String) As String
Dim strTemp As String, strReturn As String, i As Long
Hex1 = Replace(Hex1, " ", "")
If Len(Hex1) Mod 2 <> 0 Then Exit Function

For i = 1 To Len(Hex1) Step 2
strReturn = strReturn & Chr(Val("&H" & Mid(Hex1, i, 2)))
Next i
HexToStr = strReturn
End Function
[/code]
December 20, 2003, 8:24 PM
botmaster
what packet am i looking for on the recv to call this?
December 20, 2003, 8:38 PM
botmaster
btw thanks for the help man
December 20, 2003, 8:40 PM
UserLoser.
[quote author=botmaster link=board=17;threadid=4365;start=0#msg36483 date=1071948115]
I want to beable to grab the current open games in d2 I noticed you need to send 0A but the recv is all weird will i need to decompress the packet or anything?
[/quote]

It isn't packet 0x0A. 0x0A is the length of the packet

Format of realm packets:
WORD Length including this WORD (+2)
BYTE ID
VOID Data

On Diablo II: Lord of Destruction (non-hardcore, non-ladder), to request a list of games you'd use packet 0x05:

DWORD 4
WORD 0
BYTE 0

From what I've seen, those are always the same.

To get info on a specific game (expansion, non-hardcore, non-ladder) you'd use packet 0x06:

WORD 6
STRING GameName

As far as parsing both 0x5 & 0x6 from server, i havn't looked into it at all. If & when i do, I'll post my results
December 20, 2003, 8:42 PM
Killa
that parses 0x05
December 20, 2003, 9:30 PM
botmaster
cant seem to get it to send the list at all i dont think im sending the right packet
December 21, 2003, 8:42 AM
botmaster
the 0x05, 0x06

would that be sent as a dword or what?
December 25, 2003, 11:06 AM
botmaster
got it to grab the list now just cant get it to get the game names in the text that one Public Function Parsegames(Data As String) is not working right :-/
December 25, 2003, 3:58 PM
botmaster
k got all of it working but the join game part

[code]
Public Function JoinGame(gamename As String)
Dim p As New PacketBuffer
p.InsertNonNTString "PX2D"
p.InsertNTString &H9
p.InsertNonNTString &H0
p.InsertNTString gamename
p.InsertNTString ""
p.SendPacket frmMain.WSbnet, &H22


End Function
[/code]
should that be the mcp server?
December 25, 2003, 5:09 PM
Soul Taker
Going off of memory, I don't believe you tell the MCP server you are joining a game. IIRC, you tell the chat server, which then tells you the game server to connect to.
December 26, 2003, 2:15 AM
UserLoser.
[quote author=Soul Taker link=board=17;threadid=4365;start=0#msg37138 date=1072404907]
Going off of memory, I don't believe you tell the MCP server you are joining a game. IIRC, you tell the chat server, which then tells you the game server to connect to.
[/quote]

Yes, you tell chat server you're joining, and you tell the realm server that you're creating
December 26, 2003, 5:19 PM
botmaster
what if i only want to join not make a game does it still need to goto 0x03 and 0x22?
December 26, 2003, 11:14 PM
botmaster
i have it sending and recving and even bnet says the bot is in a game but not in my game that i told it to join

[code]
0x03 : 0d 00 03 02 00 00 00 00 00 1f 00 00 00
0x04 : 0f 00 04 02 00 77 65 77 65 31 32 33 34 00 00
[/code]

those are the packets it put out...are those the right?

December 27, 2003, 10:08 PM
UserLoser.
You'll know if it's right if you're not getting IPbanned/disconnected after sending it
December 27, 2003, 10:19 PM
botmaster
i dont...but it does not join the game...but when i whois it says it's in game
December 27, 2003, 10:31 PM
botmaster
send this first
[code]
p.InsertBYTE &H2
p.InsertNTString Chr(0)
p.InsertBYTE &H0
p.InsertWORD &H0
p.InsertBYTE &H1
p.InsertBYTE &HFF
p.InsertBYTE &H8
p.InsertNTString gamename
p.InsertNTString ""
p.InsertBYTE &H0
p.SendRealmPacket frmMain.WSmcp, &H3
[/code]

on 0x03 recv

[code]
a.InsertBYTE &H2
a.InsertBYTE &H0
a.InsertNTString frmMain.Text4
a.InsertNTString ""
a.SendRealmPacket frmMain.WSmcp, &H4
[/code]

on 0x04 recv

[code]
ip = Asc(Mid(strTemp, 10, 1)) & "." & _
Asc(Mid(strTemp, 11, 1)) & "." & Asc(Mid(strTemp, 12, 1)) & "." & _
Asc(Mid(strTemp, 13, 1))




frmMain.wsgame.Close
frmMain.wsgame.RemoteHost = ip
frmMain.wsgame.RemotePort = 4000
frmMain.wsgame.Connect

Dim p As New PacketBuffer
p.InsertNonNTString "PX2D"

p.InsertDWORD &HA
p.InsertNTString frmMain.Text4
p.InsertNTString ""
p.SendPacket frmMain.WSbnet, &H22
[/code]

is there anything wrong with the way im sending it?
December 27, 2003, 11:13 PM
Soul Taker
Well the /whois and friends list locations are not really indicative of anything, since you send a packet to the chat server with a game name in it and that tells Bnet to change your location in /whois and such. You don't even have to send that, or leave chat, to be in a game.
December 27, 2003, 11:19 PM
UserLoser.
[quote author=botmaster link=board=17;threadid=4365;start=15#msg37267 date=1072564319]
i dont...but it does not join the game...but when i whois it says it's in game
[/quote]

So if /whois says JoeBob is using Diablo II: Lord of Destruction in a private game, then you might be in the game, but don't appear there to other users because you havn't sent anything to the D2GS
December 28, 2003, 12:08 AM
UserLoser.
[quote author=botmaster link=board=17;threadid=4365;start=15#msg37271 date=1072566795]
is there anything wrong with the way im sending it?
[/quote]

As i said before, you'll know if it's wrong if you're IPbanned/disconnected after sending
December 28, 2003, 12:09 AM
botmaster
figured out the problem

[code]
p.InsertBYTE &H2
p.InsertNTString Chr(0)
p.InsertBYTE &H0
p.InsertWORD &H0
p.InsertBYTE &H1
p.InsertBYTE &HFF
p.InsertBYTE &H8
p.InsertNTString gamename
p.InsertNTString vbNullString
p.InsertBYTE &H0
p.SendRealmPacket frmMain.WSmcp, &H3
[/code]


gives me

[code]
17 00 03 02 00 00 00 00 00 01 FF 08 77 65 77 65 31 32 33 34 00 00 00

What should i do to change the output of the packet to

17 00 03 02 00 00 00 00 00 01 FF 08 77 65 31 32 33 34 00 00 00

[/code]

December 28, 2003, 6:26 AM
botmaster
what's a good sniffer ethereal is not cutting it
December 28, 2003, 9:47 AM
botmaster
if anyone has any info on ingame packets thats what i am missing it wont join because i have not setup sending the reset of the packets to the gameserver i have compression and decompression from d2dark d2gs.dll if anyone can help let me know.
December 28, 2003, 11:45 AM
UserLoser.
d2dark d2gs.dll?
December 28, 2003, 5:44 PM
botmaster
yeah packet sniffer for 1.10 has compression and decompression
December 28, 2003, 11:24 PM
dRAgoN
[quote author=botmaster link=board=17;threadid=4365;start=15#msg37318 date=1072604869]
what's a good sniffer ethereal is not cutting it
[/quote]

WSPE, that is if your not on 2k or xp.
WSPE Pro, sucks the big one.
December 28, 2003, 11:47 PM
UserLoser.
CommView
December 29, 2003, 12:08 AM

Search