Valhalla Legends Forums Archive | Battle.net Bot Development | Accepting Invites

AuthorMessageTime
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.
[code]
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
[/code]

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?
June 7, 2004, 9:16 PM
Stealth
[code].InsertDWORD Asc(StrReverse(clantag))[/code]

I'm pretty sure taking Asc() of more than one character at a time is not a good idea.
June 8, 2004, 12:46 AM
The-FooL
Yeah, thats not the prob, I already fixed that lol.
June 8, 2004, 2:18 AM
BaDDBLooD
Could you post The Packet Format? Send / Recieve ( Or What you know so far )

EDIT: Also Packetlog?
June 8, 2004, 2:39 AM
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?
June 8, 2004, 2:54 AM
LordNevar
Stealth is correct, in order to decline you should be using the byte &H4, not &H6.
June 8, 2004, 3:01 AM
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 )
June 8, 2004, 3:44 AM
The-FooL
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:
[code]
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
[/code]

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

[code]
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 ..
[/code]
June 8, 2004, 7:43 PM

Search