• Welcome to Valhalla Legends Archive.
 

0x72 problem

Started by Vague, March 27, 2005, 08:02 PM

Previous topic - Next topic

Vague

I have successfully added full clan support to a personal chat bot of mine, however I'm stuck at 0x72. According to bnetdocs it comes in this manner..

DWORD: Token
DWORD: Tag
STRING: Clan Name
ect...

and the rest isn't needed to reply.
I don't know where the problem is really....

The tag comes in reversed, so I don't know if I have to reverse it to send it out, or leave it as it is. (I've tried both) So I'm guessing my problem is with the Token.


Heres some code I used to convert these to a DWORD, any help would be appreciated.

Data = Mid$(Data, 5)
s = Left$(Data, 4)
Do Until s = ""
  i = Asc(Left$(s, 1))
  inviteString(0) = inviteString(0) & Hex(i)
  s = Mid$(s, 2)
Loop
Data = Mid$(Data, 5)
'sets token

Data = Mid$(Data, 5)
s = Left$(Data, 4)
Do Until s = ""
  i = Asc(Left$(s, 1))
  inviteString(1) = inviteString(1) & Hex(i)
  s = Mid$(s, 2)
Loop
Data = Mid$(Data, 5)
'sets tag

inviteString(2) = Left$(Data, InStr(Data, Chr$(0)) - 1)
'sets clan name



then to accept I do...

    PBuffer.InsertDWORD "&H" & inviteString(0)
    PBuffer.InsertDWORD "&H" & inviteString(1)
    PBuffer.InsertNTString inviteString(2)
    PBuffer.InsertBYTE &H6
    PBuffer.sendPacket &H72


I have really tried several times to figure this one out and I can't do so. Bnetdocs has  been a lot of help on the other packets but this one has me.

Newby

Quote from: Vague on March 27, 2005, 08:02 PM
I have successfully added full clan support to a personal chat bot of mine, however I'm stuck at 0x72.

Apparently you haven't.

Please put your code in code tags.
- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

Hdx

I would suggest you learn how to deal with DWORDS.
Look into GetDWORD()
Public Function GetDWORD(Data As String) As Long
    Dim lReturn As Long
    Call CopyMemory(lReturn, ByVal Data, 4)
    GetDWORD = lReturn
End Function


Quote
Data = Mid$(Data, 5)
'sets token

Data = Mid$(Data, 5)
That could be our problem.. Your compleetly removing a dword there. Ever tryed looing at the values of your vareables?
Also look into a Packet DEBuffer class,Like this crappy one I wrote: http://hdx.no-ip.org/Files/clsRemoveBuffer.cls
~-~(HDX)~-~

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

Mephisto

Quote from: Vague on March 27, 2005, 08:02 PM
I have successfully added full clan support to a personal chat bot of mine, however I'm stuck at 0x72. According to bnetdocs it comes in this manner..

DWORD: Token
DWORD: Tag
STRING: Clan Name
ect...

and the rest isn't needed to reply.
I don't know where the problem is really....

The tag comes in reversed, so I don't know if I have to reverse it to send it out, or leave it as it is. (I've tried both) So I'm guessing my problem is with the Token.


Heres some code I used to convert these to a DWORD, any help would be appreciated.

Data = Mid$(Data, 5)
s = Left$(Data, 4)
Do Until s = ""
  i = Asc(Left$(s, 1))
  inviteString(0) = inviteString(0) & Hex(i)
  s = Mid$(s, 2)
Loop
Data = Mid$(Data, 5)
'sets token

Data = Mid$(Data, 5)
s = Left$(Data, 4)
Do Until s = ""
  i = Asc(Left$(s, 1))
  inviteString(1) = inviteString(1) & Hex(i)
  s = Mid$(s, 2)
Loop
Data = Mid$(Data, 5)
'sets tag

inviteString(2) = Left$(Data, InStr(Data, Chr$(0)) - 1)
'sets clan name



then to accept I do...

    PBuffer.InsertDWORD "&H" & inviteString(0)
    PBuffer.InsertDWORD "&H" & inviteString(1)
    PBuffer.InsertNTString inviteString(2)
    PBuffer.InsertBYTE &H6
    PBuffer.sendPacket &H72


I have really tried several times to figure this one out and I can't do so. Bnetdocs has  been a lot of help on the other packets but this one has me.

I only read the first part of your post, but in regards to the clan tag being reversed is simply because it's a DWORD and when Battle.net sends you a DWORD (I'm assuming they use multi-character literal constants as in 'SEXP' or 'CLANTAG') it is reversed because of endianess.

Warrior

Quote from: Vague on March 27, 2005, 08:02 PM
So I'm guessing my problem is with the Token.

...

You know you can use GetTickCount() for the token correct?


This packet is sent when a mass invite is performed (I think?) so it will return all the users

(DWORD)       Token
(DWORD)       Clan Tag
(STRING)     Clan Name
(STRING)     Inviter's username
(BYTE)        Number of users being invited
(STRING[])    List of users being invited

The Token isn't of much use to use but you should parse the rest, then loop through the rest using the byte sent to you as a limit extracting each string.

Now that  you have recieved the packet I believe you either send an accept or a decline (clan status codes)

An accept should look like this


With botBuffer
        .addDWORD GetTickCount()
        .addDWORD .getDWORD("ClanTagHere")
        .addString "Clan Name Here"
        .addByte STATUS_ACCEPT
        .sendPacket SID_CLANSENDINVITE, cBNCS
End With


or something.
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?

Vague

#5
Yeah I'm not fully understanding on the pbuffer, and pdebuffer. I'm still learning, but when I have things explained the first time I don't forget.

ps: Thanks Warrior I understood what you were saying best.

Mephisto

Quote from: Warrior on March 27, 2005, 08:51 PM
Quote from: Vague on March 27, 2005, 08:02 PM
So I'm guessing my problem is with the Token.

...

You know you can use GetTickCount() for the token correct?


This packet is sent when a mass invite is performed (I think?) so it will return all the users

(DWORD)       Token
(DWORD)       Clan Tag
(STRING)     Clan Name
(STRING)     Inviter's username
(BYTE)        Number of users being invited
(STRING[])    List of users being invited

The Token isn't of much use to use but you should parse the rest, then loop through the rest using the byte sent to you as a limit extracting each string.

Now that  you have recieved the packet I believe you either send an accept or a decline (clan status codes)

An accept should look like this


With botBuffer
        .addDWORD GetTickCount()
        .addDWORD .getDWORD("ClanTagHere")
        .addString "Clan Name Here"
        .addByte STATUS_ACCEPT
        .sendPacket SID_CLANSENDINVITE, cBNCS
End With


or something.

Keep in mind though that the token is important in many of the other clan packets in order for the client to respond to the appropriate request.