• Welcome to Valhalla Legends Archive.
 

0x101: Unknown Version

Started by Tazo, June 16, 2003, 08:58 AM

Previous topic - Next topic

Camel

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

Tazo

can someone help me.. -.-

Arta

Once again, camel is being.. well.. a camel.

DarkMinion

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);
}

K

#19
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);
}

Skywing

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

Kp

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*
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

K

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.

Skywing

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?

K

What is this "MPQ localeid" of which you speak? the DWORD after the product version ?

Adron

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?

Skywing

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

Arta