• Welcome to Valhalla Legends Archive.
 

Accepting Invites

Started by The-FooL, June 07, 2004, 04:16 PM

Previous topic - Next topic

The-FooL

I am working on getting my bot to accept invites into a WC3 Clan.  It can already send invites, but when accepting I get kicked off battle.net.

Case &H79 'CLAN INVITE
       Dim accp As Boolean, token As Long
       token = Asc(Mid(data, 2, 4))
       cookie = Asc(Mid(data, 5, 4))
       clantag = StrReverse(Mid$(data, 9, 4))
       clanname = KillNull(Mid$(data, 13))
       pos = 14 + Len(clanname)
       creator = KillNull(Mid$(data, pos))
       frmMain.AddChat ">>[Clan] You have been invited to join Clan: " & clanname & "[", vbYellow, True
       ..............
        With tcp
       If accp Then 'send invite response
           .InsertDWORD token
           .InsertDWORD cookie
           .InsertDWORD Asc(StrReverse(clantag))
           .InsertNTString creator
           .InsertBYTE &H6
           .sendPacket &H79
           frmMain.AddChat ">>[Clan] You have accepted the Invitation", vbGreen
       Else
           .InsertDWORD token
           .InsertDWORD cookie
           .InsertDWORD Asc(StrReverse(clantag))
           .InsertNTString creator
           .InsertBYTE &H6
           .sendPacket &H79
           frmMain.AddChat ">>[Clan] You have declined the Invitation", vbRed
       End If
       End With


Where I have the .... I ask the user if they want to accept the invite, and I have the accp value hold a True/False.  Everything is parsed fine as far as the Server>Client side, the tag, clan name, and person inviting are all being displayed correctly.  But I am disconnected upon sending the reply packet.  Ive looked on BNET Docs.  First of all, on the S>C message it does not show that there are actually 2 DWORDS before the Clan Tag.  And I have tried sending the response both with the token value and without, both times I am disconnected.  Anyone see what I am doing wrong?

Stealth

.InsertDWORD Asc(StrReverse(clantag))

I'm pretty sure taking Asc() of more than one character at a time is not a good idea.
- Stealth
Author of StealthBot

The-FooL

Yeah, thats not the prob, I already fixed that lol.

BaDDBLooD

#3
Could you post The Packet Format? Send / Recieve ( Or What you know so far )

EDIT: Also Packetlog?
There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

Stealth

Judging only from the code you posted, you appear to be sending exactly the same packet both times.

Wouldn't it have to be different to decline the invitation? Perhaps change that BYTE?
- Stealth
Author of StealthBot

LordNevar

Stealth is correct, in order to decline you should be using the byte &H4, not &H6.

A good fortune may forbode a bad luck, which may in turn disguise a good fortune.
The greatest trick the Devil ever pulled, was convincing the world he didn't exsist.

BaDDBLooD

i Noticed that.. but i just figured he had the same thing Twice because he just Copied it ( he hadn't done Decline yet )
There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

The-FooL

#7
Yeah, there are a buncha mistakes there.  I'm just gonna get unlazy and packet log my wc client.  I'll post the corrected code when I'm done.

[Edit]
In case anyone else has problems:

strCookie = Mid$(data, 5, 4)
       clantag = StrReverse(Mid$(data, 9, 4))
       cl = Mid(data, 9, 4) 'unmodified clan tag
       clanname = KillNull(Mid$(data, 13))
       pos = 14 + Len(clanname)
       creator = KillNull(Mid$(data, pos))

..............
If accp Then 'send invite response
           .InsertNonNTString strCookie
           .InsertNonNTString cl
           .InsertNTString creator
           .InsertBYTE &H6
           .sendPacket &H79
           frmMain.AddChat ">>[Clan] You have accepted the Invitation", vbGreen
       Else
       Dim toasend As Long
           .InsertNonNTString strCookie
           .InsertNonNTString cl
           .InsertNTString creator
           .InsertBYTE &H4
           .sendPacket &H79
           frmMain.AddChat ">>[Clan] You have declined the Invitation", vbRed
       End If
       End With


And packet logs of the wc client declining.  Note that the username of the inviter(our channel's bot) has the same name as the clan's name(don't get confused).


S>C
0000016E  ff 79 26 00 11 0e 06 00  x78 42 54 78 54 68 65 2d .y&..... xBTxThe-
0000017E  42 72 65 74 68 72 65 6e  00 54 68 65 2d 42 72 65 Brethren .The-Bre
0000018E  74 68 72 65 6e 00                                thren.

C>S
0000005A  ff 79 1a 00 11 0e 06 00  x78 B42 T54 x78 54 68 65 2d .y...... xBTxThe-
0000006A  42 72 65 74 68 72 65 6e  00 04                   Brethren ..