Author | Message | Time |
---|---|---|
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. | March 28, 2005, 2:02 AM |
Newby | [quote author=Vague link=topic=11071.msg105847#msg105847 date=1111975320] I have successfully added full clan support to a personal chat bot of mine, however I'm stuck at 0x72. [/quote] Apparently you haven't. Please put your code in code tags. | March 28, 2005, 2:12 AM |
HdxBmx27 | I would suggest you learn how to deal with DWORDS. Look into GetDWORD() [code]Public Function GetDWORD(Data As String) As Long Dim lReturn As Long Call CopyMemory(lReturn, ByVal Data, 4) GetDWORD = lReturn End Function [/code] [quote] Data = Mid$(Data, 5) 'sets token Data = Mid$(Data, 5)[/quote] 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)~-~ | March 28, 2005, 2:48 AM |
Mephisto | [quote author=Vague link=topic=11071.msg105847#msg105847 date=1111975320] 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. [/quote] 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. | March 28, 2005, 2:50 AM |
Quarantine | [quote author=Vague link=topic=11071.msg105847#msg105847 date=1111975320] So I'm guessing my problem is with the Token. [/quote] ... 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 [code] With botBuffer .addDWORD GetTickCount() .addDWORD .getDWORD("ClanTagHere") .addString "Clan Name Here" .addByte STATUS_ACCEPT .sendPacket SID_CLANSENDINVITE, cBNCS End With [/code] or something. | March 28, 2005, 2:51 AM |
Vague | 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. | March 28, 2005, 5:43 AM |
Mephisto | [quote author=Warrior link=topic=11071.msg105858#msg105858 date=1111978273] [quote author=Vague link=topic=11071.msg105847#msg105847 date=1111975320] So I'm guessing my problem is with the Token. [/quote] ... 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 [code] With botBuffer .addDWORD GetTickCount() .addDWORD .getDWORD("ClanTagHere") .addString "Clan Name Here" .addByte STATUS_ACCEPT .sendPacket SID_CLANSENDINVITE, cBNCS End With [/code] or something. [/quote] 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. | March 28, 2005, 10:54 AM |