Valhalla Legends Forums Archive | General Programming | [VB] MCP DataArrival Problems

AuthorMessageTime
inner.
For some odd reason, my bot isn't getting to DataArrival while trying to connect to MCP for Diablo II.

Here's a what I'm doing:

Parsing 0x3E:
[code]
        Case &H3E
       
        Dim lngStatus As Long, IP As Long
   
        lngStatus = objPBuffer.GetDWORD(Mid(strData, 9, 4))
        IP = objPBuffer.GetDWORD(Mid(strData, 5, 4))

        With MCP(Index)
            .MCPChunk1 = Mid(strData, 5, 16)
            .MCPChunk2 = Mid(strData, 29, 48)
            .Uniquename = Mid$(strData, 77)
            '.MCPChunk1 = Mid(strData, 13, 8)
            '.MCPChunk2 = Mid(strData, 25, 48)
        End With
           
        AddChat Index, vbGray, "Attempting to connect to MCP server"

        frmMain.sckRealm(Index).Close
        frmMain.sckRealm(Index).Connect MakeServ(Mid$(Mid$(strData, 17, 8), 5, 4)), 6112
[/code]

sckRealm_Connect:
[code]
Private Sub sckRealm_Connect(Index As Integer)

AddChat Index, &H85A69A, "Connected to the MCP Server!"

sckRealm(Index).SendData Chr(1)

With objPBuffer
    .InsertNonNTString MCP(Index).MCPChunk1 & MCP(Index).MCPChunk2
    .InsertNTString MCP(Index).Uniquename
    .SendMCPPacket Index, &H1
End With
End Sub
[/code]

Packetlog:
[code]
48  192.168.0.100:2519  63.241.83.18:6112  72  Send 
0000  01 47 00 01 3F F1 53 6E E4 05 2F 00 17 E0 00 00    .G..?.Sn../.....
0010  00 00 00 00 68 C3 03 06 D8 A7 70 54 50 58 32 44    ....h.....pTPX2D
0020  36 38 58 49 3F F1 53 6E 00 00 00 00 31 77 81 77    68XI?.Sn....1w.w
0030  26 65 B8 2C 72 BB A5 36 AB 45 89 00 69 6E 6E 65    &e.,r..6.E..inne
0040  72 2E 64 65 00 F1 67 00                            r.de..g.
[/code]

Not sure why it's not going to it..

EDIT: Added packet log's.
July 8, 2006, 3:36 AM
inner.
Wow, I forgot to kill the null for uniqueusername, fixed.
July 8, 2006, 4:03 AM
warz
Kill the null?
July 9, 2006, 5:19 AM
UserLoser
[quote]
[code]
frmMain.sckRealm(Index).Connect MakeServ(Mid$(Mid$(strData, 17, 8), 5, 4)), 6112
[/code]
[/quote]

One of the dumbest lines of code I've ever seen.
July 9, 2006, 6:23 AM
warz
That second call to Mid would be trying to read past the end of the first argument. When calling Mid, providing another call to Mid with static dimensions as the first argument, why not just reduce it to one call?
July 9, 2006, 2:09 PM

Search