• Welcome to Valhalla Legends Archive.
 

0x82 (SID_CLANMEMBERINFO)

Started by vuther.de, March 07, 2005, 10:06 PM

Previous topic - Next topic

vuther.de

What have I been requesting wrong?
Here's what I've been sending:

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

MyndFyre

Quote from: CrAz3D on March 08, 2005, 09:34 PM
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
Silly Inner, you must be requesting something wrong?

Is the 'DateJoinned' supposed to be the date the user joinned the channel?
No, the date the user joined the clan.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

CrAz3D

Quote from: inner. on March 08, 2005, 09:50 PM
What have I been requesting wrong?
Here's what I've been sending:

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

Any idea, MyndFyre, what is wrong then?
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

UserLoser.

Quote from: CrAz3D on March 08, 2005, 09:54 PM
Quote from: inner. on March 08, 2005, 09:50 PM
What have I been requesting wrong?
Here's what I've been sending:

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

Any idea, MyndFyre, what is wrong then?

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):


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


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

vuther.de

#19
Here's what I've got from what you've said:

         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")


Here is my SetBuffer sub:

Public Sub SetBuffer(ByVal strNewBuffer As String, ByVal lngLength As Long)
m_Buffer = strNewBuffer
m_Size = lngLength
m_Position = 1
End Sub


Here is my ExtractLong function:

Public Function ExtractLong() As Long
Call CopyMemory(ExtractLong, ByVal Mid$(m_Buffer, m_Position, 4), 4)
End Function


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
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?

vuther.de

I've fixed it, thanks for helping me.

MyndFyre

Quote from: inner. on March 10, 2005, 12:20 AM
I've fixed it, thanks for helping me.
Would you PLEASE post HOW you fixed it?
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

vuther.de

Sure, as UserLoser told me on AIM, I was getting the filetime wrong. Here's what i was doing wrong:

ftDateJoined.dwLowDateTime = pbuffer.extractlong
ftDateJoined.dwHighDateTime = pbuffer.extractlong


Here's what I should of had:

ftDateJoined.dwLowDateTime = MakeLong(Mid(LastBytes, 1, 4))
ftDateJoined.dwHighDateTime = MakeLong(Mid(LastBytes, 5, 4))

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.

QwertyMonster

Quote from: inner. on March 10, 2005, 12:20 AM
I've fixed it, thanks for helping me.

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.

NetNX

Quote from: QwertyMonster on March 16, 2005, 09:38 AM
Quote from: inner. on March 10, 2005, 12:20 AM
I've fixed it, thanks for helping me.

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.

agreed