I'm getting the response 0x101 on my 0x51..I don't know whats wrong with it, take a look..
Public Sub 0x50()
With PBuffer
.InsertDWORD &H0
.InsertNonNTString "68XIPXES"
.InsertDWORD &HC7
.InsertDWORD &H0
.InsertDWORD &H0
.InsertDWORD &H360
.InsertDWORD GetSystemDefaultLCID
.InsertDWORD GetSystemDefaultLangID
.InsertNTString "USA"
.InsertNTString "United States"
.SendPacket &H50
End With
End Sub
Thanks in advance..
By the way, I'm getting the error on the 0x50, not the 0x51.
Private Const SID_AUTH_INFO as Long = &H50
Public Sub Send0x50(ByVal SocketHandle As Long, ByVal VersionByte As Long)
Set PacketBuffer = New CPacketBuffer
PacketBuffer.InsertDWORD &H0
PacketBuffer.InsertDWORD PacketBuffer.GetDWORD(StrReverse("IX86"))
PacketBuffer.InsertDWORD PacketBuffer.GetDWORD(StrReverse("SEXP"))
PacketBuffer.InsertDWORD VersionByte
PacketBuffer.InsertDWORD &H0
PacketBuffer.InsertDWORD &H0
PacketBuffer.InsertDWORD &H0
PacketBuffer.InsertDWORD GetSystemDefaultLCID
PacketBuffer.InsertDWORD GetSystemDefaultLangID
PacketBuffer.InsertNTString "USA"
PacketBuffer.InsertNTString "United States"
PacketBuffer.SendBNCSPacket SocketHandle, SID_AUTH_INFO
Set PacketBuffer = Nothing
End Sub
You should attempt not to hardcode anything...
while i'm at it I think I will post a few more gems! :)
Public Sub Send0x10(ByVal SocketHandle As Long)
Set PacketBuffer = New CPacketBuffer
PacketBuffer.InsertDWORD &H2
PacketBuffer.SendBNLSPacket SocketHandle, &H10
Set PacketBuffer = Nothing
End Sub
Public Sub Send0x0E(ByVal SocketHandle As Long, ByVal BotID As String)
Set PacketBuffer = New CPacketBuffer
PacketBuffer.InsertNTString BotID
PacketBuffer.SendBNLSPacket SocketHandle, &HE
Set PacketBuffer = Nothing
End Sub
Public Sub Send0x0F(ByVal SocketHandle As Long, ByVal ServerCode As Long, ByVal BotPassword As String)
Set PacketBuffer = New CPacketBuffer
PacketBuffer.InsertDWORD BNLSChecksum(BotPassword, ServerCode)
PacketBuffer.SendBNLSPacket SocketHandle, &HF
Set PacketBuffer = Nothing
End Sub
Quote from: TheMinistered on June 16, 2003, 11:24 AM
Private Const SID_AUTH_INFO as Long = &H50
Public Sub Send0x50(ByVal SocketHandle As Long, ByVal VersionByte As Long)
Set PacketBuffer = New CPacketBuffer
PacketBuffer.InsertDWORD &H0
PacketBuffer.InsertDWORD PacketBuffer.GetDWORD(StrReverse("IX86SEXP"))
PacketBuffer.InsertDWORD VersionByte
PacketBuffer.InsertDWORD &H0
PacketBuffer.InsertDWORD &H0
PacketBuffer.InsertDWORD &H0
PacketBuffer.InsertDWORD GetSystemDefaultLCID
PacketBuffer.InsertDWORD GetSystemDefaultLangID
PacketBuffer.InsertNTString "USA"
PacketBuffer.InsertNTString "United States"
PacketBuffer.SendBNCSPacket SocketHandle, SID_AUTH_INFO
Set PacketBuffer = Nothing
End Sub
You should attempt not to hardcode anything...
Err... You just hardcoded the game locale and the country shortname/country name.
Yes, I did... that is why I said you should _attempt_ to not hardcode. By the way, your problem is this "68XIPXES" line... check mine for correctness :D
Quote from: laurion on June 16, 2003, 08:58 AM
I'm getting the response 0x101 on my 0x51..I don't know whats wrong with it, take a look..
When does the error occur? If you get SID_AUTH_INFO wrong, you'll never get as far as receiving 0x101 in SID_AUTH_CHECK. Battle.net would just disconnect you, and most likely IPBan too. If you're getting invalid version, your problem will be with SID_AUTH_CHECK, unless you're getting your version byte wrong, which you aren't.
I don't *think* that is right arta... I posted wrong code (but edited it later), if you try using the code skywing quoted it will weild undesired results without a socket closure (i *think*)
You don't think what's right?
arta is saying that if 0x50 is wrong, you will never get around to recieving 0x51, if you are than ur 0x50 is correct.
Quote from: Skywing on June 16, 2003, 11:33 AMErr... You just hardcoded the game locale and the country shortname/country name.
what's wrong with that? blizz would have to decide to ban entire countries for that to become a flaw in one's bot...
i just send random values. iirc, the only time it makes a difference is for /time (unless you join country specific channels)
Quote from: Camel on June 16, 2003, 09:57 PM
Quote from: Skywing on June 16, 2003, 11:33 AMErr... You just hardcoded the game locale and the country shortname/country name.
what's wrong with that? blizz would have to decide to ban entire countries for that to become a flaw in one's bot...
i just send random values. iirc, the only time it makes a difference is for /time (unless you join country specific channels)
What's wrong with that is it sucks for localization purposes to assume English and ignore the user's settings. Not to mention that it changes what languages friends notifications will be sent in.
Now I have
Public Sub 0x50()
With PBuffer
.InsertDWORD &H0
.InsertDWORD PBuffer.GetDWORD(StrReverse("IX86"))
.InsertDWORD PBuffer.GetDWORD(StrReverse("SEXP"))
.InsertDWORD &HC7
.InsertDWORD &H0
.InsertDWORD &H0
.InsertDWORD &H360
.InsertDWORD GetSystemDefaultLCID
.InsertDWORD GetSystemDefaultLangID
.InsertNTString "USA"
.InsertNTString "United States"
.SendPacket &H50
End With
End Sub
and still no luck..
Quote from: Skywing on June 17, 2003, 02:39 AM
Not to mention that it changes what languages friends notifications will be sent in.
perhaps that's a reason to assume it's english?
Because you think that everybody in the world speaks english?
Wasn't one of the main reasons NBBot was originally created because the CHAT protocol didn't support certain Swedish characters?
In any case, languages can be a big deal. Ask any of the many members of vL and this forum who live on the other side of the big lake from those of us in North America.
ah okay it seems i've made a big assumption i shouldnt have
for a chat bot, i entirely agree--the values should be determined based on system settings. however, my bot is a not-for-newbies ops bot. it's critical for many of the functions that it does to work that the strings be in english. for that reason, my bot will always connect to bnet in english. what the end-user sees, however, can be customized (command names, ranks, etc).
can someone help me.. -.-
Once again, camel is being.. well.. a camel.
Skywing is right...hardcoding things can lead to problems.
void SendAuthInfo(unsigned long dwGame, unsigned char uVersion)
{
dBuf.add((int)0); //protocol
dBuf.add((int)'IX86'); //platform
dBuf.add(dwGame); //game
dBuf.add((int)uVersion); //game version byte
dBuf.add((int)0);
struct sockaddr_in sLocalAddr;
int iLocalLen = sizeof(sLocalAddr);
getsockname(sBNET, (struct sockaddr *)&sLocalAddr, &iLocalLen);
dBuf.add((int)sLocalAddr.sin_addr.s_addr); //dword ip
TIME_ZONE_INFORMATION Tzi;
unsigned long dwResult = GetTimeZoneInformation(&Tzi);
dBuf.add(Tzi.Bias + (dwResult == TIME_ZONE_ID_DAYLIGHT ? Tzi.DaylightBias : 0)); //time zone
dBuf.add((int)GetUserDefaultLCID()); //language
dBuf.add((int)GetUserDefaultLangID());
char szBuffer[0x41];
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVCTRYNAME, szBuffer, 0x40);
dBuf.add(szBuffer);
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SENGCOUNTRY, szBuffer, 0x40);
dBuf.add(szBuffer);
SendPacket(SID_AUTH_INFO);
}
QuoteNot to mention that it changes what languages friends notifications will be sent in.
Really? I can't seem to get mine in anything but english...Am I missing something?
void CBotBase::SendAuthInfo()
{
TIME_ZONE_INFORMATION tziInfo;
char szLocaleBuffer[255];
char szLocalHost[80];
DWORD dwTzId = GetTimeZoneInformation(&tziInfo);
DWORD dwLocalIP = MAKEIPADDRESS(127,0,0,1);
DWORD dwLangId = MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN);
DWORD dwLCID = MAKELCID(dwLangId, SORT_GERMAN_PHONE_BOOK);
if (!gethostname(szLocalHost, sizeof(szLocalHost)))
{
LPHOSTENT hLocal = gethostbyname(szLocalHost);
if (hLocal && hLocal->h_addr_list)
memcpy(&dwLocalIP, hLocal->h_addr_list[0], 4);
}
BNCSPacket p;
p.Command = SID_AUTH_INFO;
p.dInsert(0);
p.sInsert("68XI", false);
p.sInsert(m_product.ProductCode(), false);
p.dInsert(m_product.VersionByte());
p.dInsert(0x00);
p.dInsert(dwLocalIP);
// Thanks DM, I was wondering why my time information was off by an hour half the time :P
p.dInsert(tziInfo.Bias + ( dwTzId == TIME_ZONE_ID_DAYLIGHT ? tziInfo.DaylightBias : 0 ) );
p.dInsert(dwLCID);
p.dInsert(dwLangId);
GetLocaleInfo(dwLCID, LOCALE_SABBREVCTRYNAME, szLocaleBuffer, sizeof(szLocaleBuffer));
p.sInsert(szLocaleBuffer, true);
GetLocaleInfo(dwLCID, LOCALE_SENGCOUNTRY, szLocaleBuffer, sizeof(szLocaleBuffer));
p.sInsert(szLocaleBuffer, true);
BNCSManager.Send(p);
}
The MPQ localeid specifier determines which languages friends notifications about you will be sent in. I know this is kind of backwards (it'd be best if friends notifications were received in the language you specify, instead of sent, but that's how the Battle.net programmer felt like doing it).
Quote from: Skywing on June 20, 2003, 04:38 PM
The MPQ localeid specifier determines which languages friends notifications about you will be sent in. I know this is kind of backwards (it'd be best if friends notifications were received in the language you specify, instead of sent, but that's how the Battle.net programmer felt like doing it).
Just don't befriend anyone who speaks a language other than your own and you'll never notice that it's backwards. ;) After all, no one on battle.net speaks a second(/third/fourth) language well enough to talk to people from other countries anyway... *cough*
Quote from: Skywing on June 20, 2003, 04:38 PM
The MPQ localeid specifier determines which languages friends notifications about you will be sent in.
I'm still seeing friends notifications about my bot in english.
Quote from: K on June 20, 2003, 06:41 PM
Quote from: Skywing on June 20, 2003, 04:38 PM
The MPQ localeid specifier determines which languages friends notifications about you will be sent in.
I'm still seeing friends notifications about my bot in english.
Which field did you change? LCID/LangID or MPQ locale?
What is this "MPQ localeid" of which you speak? the DWORD after the product version ?
Quote from: Skywing on June 20, 2003, 04:38 PM
The MPQ localeid specifier determines which languages friends notifications about you will be sent in. I know this is kind of backwards (it'd be best if friends notifications were received in the language you specify, instead of sent, but that's how the Battle.net programmer felt like doing it).
Wow, so people see me join channels in Swedish?
Quote from: Adron on June 21, 2003, 09:56 AM
Quote from: Skywing on June 20, 2003, 04:38 PM
The MPQ localeid specifier determines which languages friends notifications about you will be sent in. I know this is kind of backwards (it'd be best if friends notifications were received in the language you specify, instead of sent, but that's how the Battle.net programmer felt like doing it).
Wow, so people see me join channels in Swedish?
Not with Starcraft, which isn't localized like that. IIRC, only Warcraft III sets the MPQ localeid to something other than language neutral.
The MPQ localeid is one of the fields which is always zero for non-Warcraft III games and is nonzero for Warcraft III :)
*cough*
BnetDocs (http://www.valhallalegends.com/arta/bnetdocs/content.php?id=50&Sender=C).