Valhalla Legends Forums Archive | Battle.net Bot Development | D2 help ~_~

AuthorMessageTime
NetNX
Alright.... um im fiddling with huk chat's source code and i want it to join a game but when i try to get the game's ip it fucks up and gives me some random ipaddress

OutPut:
[08:18:08] Joining game: kion4/qwe
[08:18:08] Etheran's packet for joing a game has sucessfully been sent...
[08:18:08] Realm Socket: Failed to parse ID = 0
[08:18:08] Received 0x03.
[08:18:08] Game doesn't exist, creating it.
[08:18:08] Received 0x04.
[08:18:08] Raw Packet Recieved!: [08:18:08] Packet In Hexidecimal:02003F0300003FF0CA218DD6572600000000
[08:18:08] IPDATA: !?ÖW
[08:18:08] 33.141.214.87
[08:18:08] Server Ip Obtained!:33.141.214.87
[08:18:29] D2GameSocket:The attempt to connect timed out
[08:18:56] BNLS Connection has ended!

Code:
[code]
Private Sub sckRealm_DataArrival(ByVal bytesTotal As Long)
Dim id As Byte
Dim Length As Integer
Dim Header As String
Dim PacketData As String

Dim CurrentPacket As clsBnetPacket
Set CurrentPacket = New clsBnetPacket

Dim Data As String
Dim PacketID As Integer

sckRealm.GetData Data

RealmRecvBuf.AddData Data

While RealmRecvBuf.FullRealmPacket
Packet = RealmRecvBuf.GetRealmPacket
Call CurrentPacket.FillRealmValues(Packet)


Select Case CurrentPacket.id
Case &H1 'startup packet
'check for non-zero
If InStr(CurrentPacket.PacketData, Chr(&H1)) <> 0 Then
AddChat vbRed, "Error in your MCP."
sckBnet.Close
Else
AddChat vbGreen, "MCP Chunk was accepted by BNet."
'woohoo, we passed
frmCharacterOptions.Show
End If

Case &H2 'create character 0 pass, non-zero fail
If InStr(CurrentPacket.PacketData, Chr(&H1)) <> 0 Then
AddChat vbRed, "Error creating your character!"
Else
AddChat vbGreen, "Character created!"
End If
Case &H7 'logon - 0 pass, non-zero fail
If InStr(CurrentPacket.PacketData, Chr(&H1)) <> 0 Then
AddChat vbRed, "Logon unsuccessfull!"
Else
AddChat vbGreen, "Logon successfull!!"
With packetbuf
.SendRealmPacket sckRealm, &H12


.InsertNonNTString StrReverse("D2XP")
.SendPacket sckBnet, &HB
.InsertNTString BotData.Bnet.charname
.InsertNTString BotData.Bnet.RealmTitle & "," & BotData.Bnet.charname
.SendPacket sckBnet, &HA



'.InsertDWORD &H2
'.InsertNTString "Clan ~AoD~~"
'.sendPacket sckBnet, &HC
End With
End If
Case &H17
Dim mcount As Long
mcount = Asc(Mid(CurrentPacket.PacketData, 3, 1))
pos = 9
Dim tmpData As String
tmpData = CurrentPacket.PacketData
frmCharacterOptions.lsvCharacters.ListItems.Clear
For I = 1 To mcount
pA = Split(Mid(tmpData, pos), Chr(0), 3)
frmCharacterOptions.lsvCharacters.ListItems.Add , , pA(0)
frmCharacterOptions.lsvCharacters.ListItems(frmCharacterOptions.lsvCharacters.ListItems.count).Tag = pA(1)
tmpData = pA(2)
pos = 1
Next I
Case &H12

packetbuf.InsertNonNTString StrReverse(BotData.Bnet.Product)
packetbuf.SendPacket sckBnet, &HB
packetbuf.InsertNTString BotData.Bnet.charname
packetbuf.InsertNTString BotData.Bnet.RealmTitle & "," & BotData.Bnet.charname
packetbuf.SendPacket sckBnet, &HA
'plog PacketData

Case &H3
AddChat vbYellow, "Received 0x03."
If Right(StrToHex(CurrentPacket.PacketData), 4) = &H0 Then
AddChat vbWhite, "Game doesn't exist, creating it."
With packetbuf
.InsertBYTE &H2
.InsertBYTE &H0
.InsertNTString Form1.Text1
.InsertNTString Form1.Text2
.SendRealmPacket sckRealm, &H4
'
.InsertDWORD &H1
.InsertDWORD &H0
.InsertDWORD &H0
.InsertDWORD &H0
.InsertDWORD &H0
.InsertNTString Form1.Text1
.InsertNTString Form1.Text2
.InsertBYTE &H0
.SendPacket sckBnet, &H1C
End With
Else
AddChat vbYellow, "Game exists!"
End If

Case &H4
AddChat vbYellow, "Received 0x04."
AddChat vbRed, "Raw Packet Recieved!: " & CurrentPacket.PacketData
AddChat vbWhite, "Packet In Hexidecimal:" & StrToHex(CurrentPacket.PacketData)
Dim FinIp As String
ip = Mid(CurrentPacket.PacketData, 10, 4)
AddChat vbGreen, "IPDATA: " & ip
For I = 1 To 4
tmpIp = Mid(ip, I, 1)
FinIp = FinIp & Asc(tmpIp)
If I <> 4 Then FinIp = FinIp & "."
Next I
Dim ipb As String
strTemp = CurrentPacket.PacketData
ipb = Asc(Mid(strTemp, 10, 1)) & "." & _
Asc(Mid(strTemp, 11, 1)) & "." & Asc(Mid(strTemp, 12, 1)) & "." & _
Asc(Mid(strTemp, 13, 1))
AddChat vbCyan, ipb
AddChat vbGreen, "Server Ip Obtained!:" & FinIp
sckD2Game.Close
DoEvents
'sckD2Game.RemoteHost = FinIp
'sckD2Game.RemotePort = 4000
sckD2Game.Connect FinIp, 4000

With packetbuf
.InsertNonNTString "PX2D"
.InsertNTString &H9
.InsertNonNTString &H0
.InsertNTString Form1.Text1
.InsertNTString Form1.Text2
.SendPacket sckBnet, &H22
End With

Case Else
AddChat vbRed, "Realm Socket: Failed to parse ID = " & PacketID
End Select
Wend
End Sub
[/code]
July 4, 2004, 12:34 PM
NetNX
i got it all fixed ... another question dose anyone have any ingame documention of packets ?
July 6, 2004, 10:17 PM
ChR0NiC
http://www.ethereal.com <~ Works Wonders
July 6, 2004, 10:36 PM
Myndfyr
[quote author=NetNX link=board=17;threadid=7561;start=0#msg68903 date=1089152236]
i got it all fixed ... another question dose anyone have any ingame documention of packets ?
[/quote]

What did you do to fix it?
July 7, 2004, 12:01 AM

Search