Valhalla Legends Forums Archive | Battle.net Bot Development | [Resolved]MCP_CHARLIST2(0x19) Help..

AuthorMessageTime
Jaquio
Alright, I have gotten the bot able to Realm Connect but now when I send 0x19 and get it back, when I try to remove the proper info for MCP_CHARLOGON(0x07) I am only able to remove maybe 4-5 letters from my characters name.. I am using Joes 'Debuffer Class' to remove what I need and such. But it doesn't seem to be working properly could anyone help?
March 4, 2006, 7:54 PM
l2k-Shadow
perhaps you could help us out by posting your code so we could see your mistakes?
March 5, 2006, 3:29 AM
Jaquio
[quote author=l2k-Shadow link=topic=14428.msg147618#msg147618 date=1141529376]
perhaps you could help us out by posting your code so we could see your mistakes?
[/quote]

Ok.. here is my 0x19 Recv'd code.

[code]
        Case &H19
        'Debug.Print "Recv'd:0x19"
            With DB
                .Buffer = Data
                .RemoveHeader
                .RemoveWORD 'Unknown
                .RemoveDWORD 'Total amount of characters.
                .RemoveWORD 'Returned amount of characters.
                'Character Stuff
                .RemoveDWORD 'Seconds since January 1 00:00:00 UTC 1970
                .RemoveNTString 'Character name
                .RemoveWORD 'Flags
                .RemoveNTString 'Modified statstring
            End With
[/code]

I guess I must be doing something wrong?  :-\
March 5, 2006, 4:25 AM
Myndfyr
[quote author=Jaquio link=topic=14428.msg147620#msg147620 date=1141532756]
I guess I must be doing something wrong?  :-\
[/quote]

Either that, or Battle.net isn't working just for you!

A packet log would be appropriate too.
March 5, 2006, 5:00 AM
Jaquio
Nevermind, Hdx helped me. See, the Debuffer class I was using wasn't working properly. I used one Hdx gave me and it returned everything I needed, Joe I think you need to work on yours. Sorry for all the trouble if it wasn't for the bad debuffer class I wouldn't have gotten stuck.
March 5, 2006, 5:17 AM
l2k-Shadow
I just looked at Joe's debuffer class and found the following code:
[code]
'// Packet Debuffer
'// Written by Joe[x86]

Private m_sBuffer As String

Public Property Let Buffer(Buffer As String)
    Let m_sBuffer = Buffer
End Property

Public Property Get Buffer() As String
    Let Buffer = m_sBuffer
End Property

Public Function RemoveHeader(Optional Bytes As Long = 4) As String
    Let RemoveHeader = Mid(m_sBuffer, m_lPosition, Bytes)
    Let m_sBuffer = Mid(m_sBuffer, Bytes + 1)
End Function

Public Function RemoveNTString() As String
    Dim NTPos As String: Let NTPos = InStr(1, m_sBuffer, vbNullChar)
    If Not CBool(NTPos) Then Exit Sub
    Let RemoveNTString = Mid(m_sBuffer, 1, NTPos - 1)
    Let m_sBuffer = Mid(m_sBuffer, NTPos + 1)
End Function

Public Function RemoveWORD() As Integer
    Let RemoveWORD = GetWORD(Mid(m_sBuffer, 1, 2))
    Let m_sBuffer = Mid(m_sBuffer, 3)
End Function

Public Function RemoveDWORD() As Long
    Let RemoveDWORD = GetDWORD(Mid(m_sBuffer, 1, 4))
    Let m_sBuffer = Mid(m_sBuffer, 5)
End Function

Public Function RemoveQWORD() As Long
    Let RemoveQWORD = GetQWORD(Mid(m_sBuffer, 1, 8))
    Let m_sBuffer = Mid(m_sBuffer, 9)
End Function

Public Function RemoveVoid(Length As Byte) As String
    Let RemoveVoid = Mid(m_sBuffer, 1, Length)
    Let m_sBuffer = Mid(m_sBuffer, Length + 1)
End Function
[/code]

It's all dandy, except the fact that GetWORD/GetDWORD/GetQWORD functions aren't included.. I thought the point of a class module was to be independent. anyway more specifically i see some problems here:
[code]
Public Function RemoveNTString() As String
    Dim NTPos As String: Let NTPos = InStr(1, m_sBuffer, vbNullChar)
    If Not CBool(NTPos) Then Exit Sub
    Let RemoveNTString = Mid(m_sBuffer, 1, NTPos - 1)
    Let m_sBuffer = Mid(m_sBuffer, NTPos + 1)
End Function
[/code]

Since when does InStr() return a string? Now when we properly put it to the variable it is supposed to be:
[code]
If Not CBool(NTPos) Then Exit Sub
[/code]
is acceptable but
[code]
If NTPos > 0 Then
    Let RemoveNTString = Mid(m_sBuffer, 1, NTPos - 1)
    Let m_sBuffer = Mid(m_sBuffer, NTPos + 1)
End If
[/code]
a little easier there..
March 6, 2006, 5:28 AM
HdxBmx27
If anyone cares, the following is the class he is using now:
[code]Option Explicit
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
    (ByRef destination As Any, _
    ByRef Source As Any, _
    ByVal numbytes As Long)
Private strBuffer As String

Public Sub SetData(Data As String)
    strBuffer = Data
End Sub

Public Function GetData() As String
    GetData = strBuffer
End Function

Public Sub ClearData()
    strBuffer = vbNullString
End Sub

Public Function rFILETIME(Optional QWORD As Boolean = False) As String
    Dim strFT() As String, strTMP As String
    If Not QWORD Then
        strFT = Split(rNTString & Space(1), Space(1))
        If strFT(0) > 2147483647 Then strFT(0) = (strFT(0) - 4294967296#)
        If strFT(1) > 2147483647 Then strFT(1) = (strFT(1) - 4294967296#)
    Else
        ReDim strFT(0 To 1)
        strFT(1) = rDWORD
        strFT(0) = rDWORD
    End If
    rFILETIME = strFT(0) & Space(1) & strFT(1)
End Function

Public Function StripHeader() As Byte
    StripHeader = Asc(Mid(strBuffer, 2, 1))
    strBuffer = Mid(strBuffer, 5)
End Function

Public Function StripBNLSHeader() As Byte
    StripBNLSHeader = Asc(Mid(strBuffer, 3, 1))
    strBuffer = Mid(strBuffer, 4)
End Function

Public Function StripRealmHeader() As Byte
    StripRealmHeader = Asc(Mid(strBuffer, 3, 1))
    strBuffer = Mid(strBuffer, 4)
End Function

'//This removed a DWORD, but insted of returng it's integer value
'//this function returns its ASCII value. This would most commenly
'//be used for extracting the Product ID's/Platform ID's
'//Witch are infact, DWORDS, but look like strings.
Public Function rNonNTString() As String
    rNonNTString = Left(strBuffer, 4)
    strBuffer = Mid(strBuffer, 5)
End Function

Public Function rATString() As String
    On Error Resume Next
    rATString = Left(strBuffer, InStr(strBuffer, Chr(&HA)) - 1)
    strBuffer = Mid(strBuffer, Len(rATString) + 2)
End Function

Public Function rNTString() As String
    On Error Resume Next
    rNTString = Left(strBuffer, InStr(strBuffer, Chr(&H0)) - 1)
    strBuffer = Mid(strBuffer, Len(rNTString) + 2)
End Function

Public Function rDWORD() As Long
    Dim lReturn As Long, strTMP As String
    strTMP = Left(strBuffer, 4)
    Call CopyMemory(lReturn, ByVal strTMP, 4)
    rDWORD = lReturn
    strBuffer = Mid(strBuffer, 5)
End Function

Public Function rWORD() As Long
    Dim lReturn As Long, strTMP As String
    strTMP = Left(strBuffer, 2)
    Call CopyMemory(lReturn, ByVal strTMP, 2)
    rWORD = lReturn
    strBuffer = Mid(strBuffer, 3)
End Function

Public Function rBYTE() As Byte
    rBYTE = Asc(Left(strBuffer, 1))
    strBuffer = Mid(strBuffer, 2)
End Function
Public Function rVOID(Leng As Integer) As String
    If Len(strBuffer) < Leng Then Leng = Len(strBuffer)
    rVOID = Left(strBuffer, Leng)
    strBuffer = Mid(strBuffer, Leng + 1)
End Function
[/code]

I have a 'better' one it's a straight buffer class. having the functionality of both a buffer and debuffer class.
~-~(HDX)~-~
March 6, 2006, 6:18 AM

Search