Valhalla Legends Forums Archive | Battle.net Bot Development | 0x82 (SID_CLANMEMBERINFO)

AuthorMessageTime
inner.
I've been trying to parse this packet and it has been a big hassle, i've asked like 2/3 people have none of them could figure this out. The status always returns 0, the rank works, clan works, and date joined doesn't really work.
Here's my code for my parsing:
[code]       
Case &H82
Dim strClanName As String, intPosition As Integer, bytRank As Byte, strDateJoined As String
   
    intPosition = 9

'status
bytStatus = Asc(Mid(strData, intPosition, 1))
    intPosition = intPosition + Len(bytStatus)

'clan name
strClanName = KillNull(Mid(strData, intPosition, InStr(intPosition, strData, Chr(0)) - 1))
    intPosition = intPosition + Len(strClanName) + 1

'rank
bytRank = Asc(Mid(strData, intPosition, 1))
    intPosition = intPosition + Len(bytRank)

'date joined
strDateJoined = Asc(Mid(strData, intPosition, 8))
    intPosition = intPosition + Len(strDateJoined)

AddChat vbBlue, "Status: " & GetStatus(bytStatus)
AddChat vbBlue, "Clan name: " & strClanName
AddChat vbBlue, "Rank: " & GetRankName(bytRank)

FT = StringToFileTime(strDateJoined)
Call FileTimeToSystemTime(FT, ST)
AddChat vbBlue, "Date joined: " & ST.wMonth & "/" & ST.wDay & "/" & ST.wYear & " @ " & Format(ST.wHour & ":" & ST.w
Minute & ":" & ST.wSecond, "HH:MM:SS ampm")
[/code]
March 8, 2005, 4:06 AM
UserLoser.
What does it output?  Supply packet logs, too
March 8, 2005, 4:08 AM
inner.
[11:33:59 PM] Status: 0
[11:33:59 PM] Clan name: Dark Council
[11:33:59 PM] Rank: Grunt
[11:33:59 PM] Date joined: 1/1/1601 @ 11:27:11 AM

[code]
[11:31:44 PM] BNET: Packet sent: 0x82
[11:31:44 PM] Output dump: 0000:  00 00 00 00 00 00 43 44 6D 65 63 63 61 5B 44 43   ......CDmecca[DC
0010:  5D 00                                             ]...............
[11:31:45 PM] BNET: Packet received: 0x82
[11:31:45 PM] Output dump: 0000:  FF 82 1F 00 00 00 00 00 00 44 61 72 6B 20 43 6F   ÿ‚......Dark Co
0010:  75 6E 63 69 6C 00 02 60 38 8D 0B AD 1B C5 01      uncil.`8? ­Å.
[/code]
March 8, 2005, 4:32 AM
UserLoser.
I don't think Asc(Mid(strData, intPosition, 8)) is correct
March 8, 2005, 5:12 AM
inner.
Why? What's wrong with it?
March 8, 2005, 6:09 AM
UserLoser.
[quote author=inner. link=topic=10852.msg102819#msg102819 date=1110262163]
Why? What's wrong with it?
[/quote]

For one it's a filetime struct, not a string.  Secondly, Asc() cannot return anything larger than an 8-bit value, and a filetime struct consists of two 32-bit values
March 8, 2005, 1:44 PM
inner.
So what should I do?
March 8, 2005, 5:37 PM
CrAz3D
mid(data,position,8)
give that a whirley do
March 8, 2005, 10:36 PM
Kp
Cast it to a FILETIME struct? :P
March 8, 2005, 10:38 PM
CrAz3D
Why would he do that? ::)
March 8, 2005, 10:48 PM
Myndfyr
[quote author=CrAz3D link=topic=10852.msg102918#msg102918 date=1110322125]
Why would he do that? ::)
[/quote]

Because that's what it is?  ::)
March 8, 2005, 11:42 PM
inner.
Craz3d, that doesn't work.
March 9, 2005, 12:16 AM
CrAz3D
[quote author=MyndFyre link=topic=10852.msg102928#msg102928 date=1110325348]
[quote author=CrAz3D link=topic=10852.msg102918#msg102918 date=1110322125]
Why would he do that? ::)
[/quote]

Because that's what it is?  ::)
[/quote]My eyes were misread I guess, [quote author=CrAz3D link=topic=10852.msg102918#msg102918 date=1110322125][/quote] was meant as sarcasm as he already knew it was a FileTime
March 9, 2005, 12:53 AM
inner.
Ok well, I still cannot get this to work, pissing the hell out of me :'(
March 9, 2005, 3:04 AM
CrAz3D
[quote][8:34:17 PM] Status: 0
[8:34:17 PM] Clan name: Dark Council
[8:34:17 PM] Rank: 2
[8:34:17 PM] Date joined: 3/8/2005 @ 08:31:56 PM
[/quote]Silly Inner, you must be requesting something wrong?

Is the 'DateJoinned' supposed to be the date the user joinned the channel?
March 9, 2005, 3:34 AM
inner.
What have I been requesting wrong?
Here's what I've been sending:
[code]
Select Case Len(strTag)
    Case 2: strTag = strTag & vbNullChar & vbNullChar
    Case 3: strTag = strTag & vbNullChar
    End Select
   
    With pbuffer
    .InsertDWORD &H0
    .InsertNonNTString StrReverse(strTag)
    .InsertNTString strMember
    .sendPacket &H82
    End With
[/code]
March 9, 2005, 3:50 AM
Myndfyr
[quote author=CrAz3D link=topic=10852.msg102969#msg102969 date=1110339268]
[quote][8:34:17 PM] Status: 0
[8:34:17 PM] Clan name: Dark Council
[8:34:17 PM] Rank: 2
[8:34:17 PM] Date joined: 3/8/2005 @ 08:31:56 PM
[/quote]Silly Inner, you must be requesting something wrong?

Is the 'DateJoinned' supposed to be the date the user joinned the channel?
[/quote]
No, the date the user joined the clan.
March 9, 2005, 3:51 AM
CrAz3D
[quote author=inner. link=topic=10852.msg102972#msg102972 date=1110340243]
What have I been requesting wrong?
Here's what I've been sending:
[code]
Select Case Len(strTag)
    Case 2: strTag = strTag & vbNullChar & vbNullChar
    Case 3: strTag = strTag & vbNullChar
    End Select
   
    With pbuffer
    .InsertDWORD &H0
    .InsertNonNTString StrReverse(strTag)
    .InsertNTString strMember
    .sendPacket &H82
    End With
[/code]
[/quote]
Any idea, MyndFyre, what is wrong then?
March 9, 2005, 3:54 AM
UserLoser.
[quote author=CrAz3D link=topic=10852.msg102974#msg102974 date=1110340447]
[quote author=inner. link=topic=10852.msg102972#msg102972 date=1110340243]
What have I been requesting wrong?
Here's what I've been sending:
[code]
Select Case Len(strTag)
    Case 2: strTag = strTag & vbNullChar & vbNullChar
    Case 3: strTag = strTag & vbNullChar
    End Select
   
    With pbuffer
    .InsertDWORD &H0
    .InsertNonNTString StrReverse(strTag)
    .InsertNTString strMember
    .sendPacket &H82
    End With
[/code]
[/quote]
Any idea, MyndFyre, what is wrong then?
[/quote]

I'll just reply because I've been asked enough on AIM about this from somebody here..

First of all, do it properly, don't be lazy and write crappy stuff.  Why not use CopyMemory?


The way I'd do it (this isn't my actual code I use, but it'd be something similar):

[code]
Function ExtractLong() As Long
    'Make sure we can advance in the buffer before doing this...
    Call CopyMemory(ExtractLong, ByVal Mid$(m_Buffer, m_Position, 4), 4)
End Function

Function OnGetClanMemberInfo(<params>) As PacketVerificationCode
    ' <Check packet size here, make sure it's valid>

    If (packet is valid length) Then
        Dim Cookie As Long
        Dim Status As Byte, Rank As Byte
        Dim ClanName As String
        Dim DateJoined as FILETIME
       
        Cookie = m_Parse.ExtractLong()
        Status = m_Parse.ExtractByte()
        ClanName = m_Parse.ExtractString()
        Rank = m_Parse.ExtractByte()
       
        'Now here we could do this two ways, but I'll show you one which I'd think is easier for you to comprehend (and don't take that the wrong way..)
        DateJoined.dwHighPart = m_Parse.ExtractLong()
        DateJoined.dwLowPart = m_Parse.ExtractLong()
       
        'Here we convert the FILETIME struct to a SYSTEMTIME struct, handle, get username based off of cookie, display, do whatever, etc.
    End If

End Function
[/code]

As far as m_Parse class functions, you should be able to replicate them pretty easy.  Remember, this is off the top of my head, so I don't recall exactly if dwHighPart comes first or not in the struct
March 9, 2005, 4:43 AM
inner.
Here's what I've got from what you've said:
[code]
        Case &H82
Dim lngCookie As Long
Dim bytRank As Byte
Dim intPosition As Integer
Dim ftDateJoined As FILETIME
Dim strClanName As String
   
intPosition = 9
pbuffer.SetBuffer strData, Len(strData)

'cookie
lngCookie = pbuffer.GetDWORD(strData)

'status
bytStatus = Asc(Mid(strData, intPosition, 1))
    intPosition = intPosition + Len(bytStatus)

'clan name
strClanName = KillNull(Mid(strData, intPosition, InStr(intPosition, strData, Chr(0)) - 1))
    intPosition = intPosition + Len(strClanName) + 1

'rank
bytRank = Asc(Mid(strData, intPosition, 1))
    intPosition = intPosition + Len(bytRank)

'date joined
ftDateJoined.dwHighDateTime = pbuffer.ExtractLong()
ftDateJoined.dwLowDateTime = pbuffer.ExtractLong()

AddChat vbBlue, "Status: " & bytStatus
AddChat vbBlue, "Clan name: " & strClanName
AddChat vbBlue, "Rank: " & bytRank

Call FileTimeToLocalFileTime(ftDateJoined, ftDateJoined)
Call FileTimeToSystemTime(ftDateJoined, ST)
AddChat vbBlue, "Date joined: " & ST.wMonth & "/" & ST.wDay & "/" & ST.wYear & " @ " & Format(ST.wHour & ":" & ST.wMinute & ":" & ST.wSecond, "HH:MM:SS ampm")
[/code]

Here is my SetBuffer sub:
[code]
Public Sub SetBuffer(ByVal strNewBuffer As String, ByVal lngLength As Long)
m_Buffer = strNewBuffer
m_Size = lngLength
m_Position = 1
End Sub
[/code]

Here is my ExtractLong function:
[code]
Public Function ExtractLong() As Long
Call CopyMemory(ExtractLong, ByVal Mid$(m_Buffer, m_Position, 4), 4)
End Function
[/code]

Here is what it outputs:
[quote]
[12:53:56 AM] Status: 0
[12:53:56 AM] Clan name: Dark Council
[12:53:56 AM] Rank: 1
[12:53:56 AM] Date joined: 2/8/1629 @ 05:06:40 PM
[/quote]
It gives the same Date Joined for everyone I request.
Everything works except status and Date joined. But for now I want to worry about Date joined.
Anyone know what's wrong?
March 9, 2005, 5:03 AM
inner.
I've fixed it, thanks for helping me.
March 10, 2005, 6:20 AM
Myndfyr
[quote author=inner. link=topic=10852.msg103160#msg103160 date=1110435641]
I've fixed it, thanks for helping me.
[/quote]
Would you PLEASE post HOW you fixed it?
March 10, 2005, 7:27 AM
inner.
Sure, as UserLoser told me on AIM, I was getting the filetime wrong. Here's what i was doing wrong:
[code]
ftDateJoined.dwLowDateTime = pbuffer.extractlong
ftDateJoined.dwHighDateTime = pbuffer.extractlong
[/code]

Here's what I should of had:
[code]
ftDateJoined.dwLowDateTime = MakeLong(Mid(LastBytes, 1, 4))
ftDateJoined.dwHighDateTime = MakeLong(Mid(LastBytes, 5, 4))
[/code]
March 10, 2005, 8:33 PM
NetNX
From one newb to another ~_^ Try an incoming packet buffer they work wonders! from what i hear that mid() shit isn't too great.
March 16, 2005, 3:31 PM
QwertyMonster
[quote author=inner. link=topic=10852.msg103160#msg103160 date=1110435641]
I've fixed it, thanks for helping me.
[/quote]

So it was an easy mistake, reading what was wrong. Try to keep checking your work, and not always rely on other people to find your mistakes. This isnt a flame btw.
March 16, 2005, 3:38 PM
NetNX
[quote author=QwertyMonster link=topic=10852.msg104050#msg104050 date=1110987498]
[quote author=inner. link=topic=10852.msg103160#msg103160 date=1110435641]
I've fixed it, thanks for helping me.
[/quote]

So it was an easy mistake, reading what was wrong. Try to keep checking your work, and not always rely on other people to find your mistakes. This isnt a flame btw.
[/quote]

agreed
March 16, 2005, 3:41 PM

Search