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?
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.
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
what packet am i looking for on the recv to call this?
btw thanks for the help man
Quote from: botmaster on December 20, 2003, 01:21 PM
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?
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
that parses 0x05
cant seem to get it to send the list at all i dont think im sending the right packet
the 0x05, 0x06
would that be sent as a dword or what?
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 :-/
k got all of it working but the join game part
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
should that be the mcp server?
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 from: Soul Taker on December 25, 2003, 08:15 PM
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.
Yes, you tell chat server you're joining, and you tell the realm server that you're creating
what if i only want to join not make a game does it still need to goto 0x03 and 0x22?
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
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
those are the packets it put out...are those the right?
You'll know if it's right if you're not getting IPbanned/disconnected after sending it
i dont...but it does not join the game...but when i whois it says it's in game
send this first
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
on 0x03 recv
a.InsertBYTE &H2
a.InsertBYTE &H0
a.InsertNTString frmMain.Text4
a.InsertNTString ""
a.SendRealmPacket frmMain.WSmcp, &H4
on 0x04 recv
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
is there anything wrong with the way im sending it?
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.
Quote from: botmaster on December 27, 2003, 04:31 PM
i dont...but it does not join the game...but when i whois it says it's in game
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
Quote from: botmaster on December 27, 2003, 05:13 PM
is there anything wrong with the way im sending it?
As i said before, you'll know if it's wrong if you're IPbanned/disconnected after sending
figured out the problem
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
gives me
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
what's a good sniffer ethereal is not cutting it
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.
d2dark d2gs.dll?
yeah packet sniffer for 1.10 has compression and decompression
Quote from: botmaster on December 28, 2003, 03:47 AM
what's a good sniffer ethereal is not cutting it
WSPE, that is if your not on 2k or xp.
WSPE Pro, sucks the big one.
CommView