Valhalla Legends Forums Archive | Battle.net Bot Development | [C++] SID_AUTH_INFO problem

AuthorMessageTime
Okee
I've never had a problem with SID_AUTH_INFO before, but now I am and am not sure what's wrong with it. It's the same as it is in some of my other projects and they work. Anyways, here's my code...

[code]
void SendAuthInfo(SOCKET sckBNET)
{
if(szLocalAccountInfo.Connected) {
Print(hBNChat, WHITE, "Sending authentication info for %s\n", szLocalAccountInfo.szGameAbbr);
dBuf.add((int)0);
dBuf.add((int)'IX86');
dBuf.add(szLocalAccountInfo.szGameAbbr);
dBuf.add((int)szLocalAccountInfo.lVerByte);
dBuf.add((int)0);
dBuf.add((int)0);
dBuf.add((int)480);
dBuf.add((int)1033);
dBuf.add((int)1033);
dBuf.add("USA");
dBuf.add("United States");

SendPacket(sckBNET, SID_AUTH_INFO);
} else {
Print(hBNChat, RED, "Error while connecting\n");
}
}
[/code]

and here's a packet log of the same function being sent to asia.battle.net -

[quote]
1  Hide  Hide  1  Send 
0000  01                                                .

2  Hide  Hide  59  Send 
0000  FF 50 3B 00 00 00 00 00 36 38 58 49 52 41 54 53    .P;.....68XIRATS
0010  00 CD 00 00 00 00 00 00 00 00 00 00 00 E0 01 00    ................
0020  00 09 04 00 00 09 04 00 00 55 53 41 00 55 6E 69    .........USA.Uni
0030  74 65 64 20 53 74 61 74 65 73 00                  ted States.

[/quote]

Anyone able to tell what's not being formed right by the packet log, or the function itself? Maybe the version byte? I'm unsure.
July 10, 2005, 10:56 PM
UserLoser.
szLocalAccountInfo.szGameAbbr is a string. add is taking in the string and adding it to the outgoing buffer, but also adding a null terminator.   Store the game tag in an integer, not a string.
July 10, 2005, 10:59 PM
Okee
Thanks that fixed it. I made a simple function for it. Here it is..

[code]
int LocalAccountInfo::iGameAbbr(void) {
int iAbbr = 'STAR';

if(!strcmp(szLocalAccountInfo.szGameAbbr, "RATS"))
int iAbbr = 'STAR';
if(!strcmp(szLocalAccountInfo.szGameAbbr, "PXES"))
int iAbbr = 'SEXP';
if(!strcmp(szLocalAccountInfo.szGameAbbr, "NB2W"))
int iAbbr = 'W2BN';
if(!strcmp(szLocalAccountInfo.szGameAbbr, "VD2D"))
int iAbbr = 'D2DV';
if(!strcmp(szLocalAccountInfo.szGameAbbr, "PX2D"))
int iAbbr = 'D2XP';
if(!strcmp(szLocalAccountInfo.szGameAbbr, "3RAW"))
int iAbbr = 'WAR3';
if(!strcmp(szLocalAccountInfo.szGameAbbr, "PX3W"))
int iAbbr = 'W3XP';

return iAbbr;
}
[/code]
July 10, 2005, 11:43 PM
LoRd
... or you could just, as UserLoser said, store them properly to begin with and eliminate the need for such a pointless procedure.
July 11, 2005, 12:06 AM
Okee
I could, except that hours of work on my bots UI revolve around that variable. I'd have to change a lot to fix that. I'm really just trying to get it functional before I begin to work on the efficeincy of it.
July 11, 2005, 12:37 AM
Kp
There's something seriously wrong with your design if it'd take you hours to update all the code associated with a version checking variable.
July 11, 2005, 12:57 AM
Okee
Probably - but then again, I am dealing with my first ever UI for a bot written in C++.
July 11, 2005, 1:10 AM
Myndfyr
[quote author=Okee link=topic=12165.msg120088#msg120088 date=1121044203]
Probably - but then again, I am dealing with my first ever UI for a bot written in C++.
[/quote]
What does a user interface have to do with version checking code?
July 11, 2005, 3:24 AM
Okee
Well, I have quite a bit of functions and procedures that print certain things to list boxes, or drop down menus pertaining to the current product selected. A large portion of them revolve around my char variable that contains the product abbreviation. I know I could probably change it all the work with an int variable in less than 'hours', but I was just blowing it out of proportion. I'm just saying that quick fix worked faster than going back and making all my strcmp's, and other things dealing with char's, compatible with an int.

Looking back on it I do realize I did it in a sort of non-efficient manner - but it's just how it happened. :-\

Anywho, I appreciate any and all help I've received so far, no matter how strange and far from the norm it might have seemed.
July 11, 2005, 7:20 AM

Search