• Welcome to Valhalla Legends Archive.
 

[VB]Warcraft III Stat String Parsing

Started by Arthas, October 06, 2003, 10:06 PM

Previous topic - Next topic

Arthas

Okay, I read the function in botdev's documents section... But I can't seem to get the data required to use it...

Mostly I had a friend help me with the 0x0f stuff, so here's the function I use to fetch my values when I receive 0x0f:

Public Sub GetValues(ByVal DataBuf As String, ByRef Ping As Long, ByRef Flags As Long, ByRef Name As String, ByRef Txt As String)
   Dim A As Long, B As Long, c As Long, D As Long, E As Long, F As Long, recvbufpos As Long
   Name = ""
   Txt = ""
   recvbufpos = 5
   F = MakeLong(Mid$(DataBuf, recvbufpos, 4))
   recvbufpos = recvbufpos + 4
   A = CVL(Mid$(DataBuf, recvbufpos, 4))
   recvbufpos = recvbufpos + 4
   B = MakeLong(Mid$(DataBuf, recvbufpos, 4))
   recvbufpos = recvbufpos + 4
   c = MakeLong(Mid$(DataBuf, recvbufpos, 4))
   recvbufpos = recvbufpos + 4
   D = MakeLong(Mid$(DataBuf, recvbufpos, 4))
   recvbufpos = recvbufpos + 4
   E = MakeLong(Mid$(DataBuf, recvbufpos, 4))
   recvbufpos = recvbufpos + 4
   Flags = A
   Ping = B
   Call strcpy(Name, KillNull(Mid$(DataBuf, 29)))
   Call strcpy(Txt, KillNull(Mid$(DataBuf, Len(Name) + 30)))
End Sub


None of those values get me the info needed for war3 statstring parsing... Help?

Skywing

#1
Examine the "text" field in showuser, join, leave, (and sometimes, but not always - if the string is empty, ignore it) flags update messages.

You may want to associate this value with a username in your database of users currently in the channel.

Note that there is a very old bug with the Battle.net server software (AFAIK it has been in there since "the beginning") which causes the server to use the showuser chat event to communicate user stats updates.  It's fairly safe that this bug is here to stay, as new Blizzard clients (Diablo II and Warcraft III) actually work around it.

Unfortunately, it is not entirely possible to do this accurately, 100% of the time.  Because chat events are asynchronous, the server software has been known to transmit a stats update for a user before transmitting a notification of them joining the channel.  You should be prepared to handle this case, since it is actually fairly common (simply leave a link up in one of the Diablo II or Warcraft III homechannels for awhile and you should see it happen).

Arthas

This happends everytime:

[21:51:35]  Warcraft III The Frozen Throne: (Level: 1N3W, best race , xASx wins).

Looks funky to me... o_O

Arthas

Sorry, my bad, havn't done this in a long, long time.

Stealth

#4
The Warcraft III statstring is very easy to handle.

Username Product IconInfo [Level] [Clan]
Examples:
Stealth)DK( 3RAW 2R3W 10 89KD
BoNg)DK( PX3W 4R3W 17 89KD

Parsing it:

The product portion is straightforward, but you should take it into account when parsing the statstring because the icons are different between Reign of Chaos and Frozen Throne.

IconInfo: xy3W (Example: 2R3W)
x is the icon tier, in this case tier 2.
y is the icon race. Races are:
(R)andom
(N)ight Elf
(O)rc
(U)ndead
(H)uman

The 3W part of the icon info is constant AFAIK. Thus, for the example 2R3W, Stealth)DK( has a tier-2 Random Reign of Chaos icon of a dragon whelp. (The Tier-1 icon for all races is a peon.)

The level is straightforward. It is not reported if the player has not played any games and is not part of a clan. If the player has no games played, but is a clan member, the level will be reported as 0.

The clan portion contains the player's clan tag in a DWORD. Reversing the characters present will give you the tag.

BoNg)DK( PX3W 4R3W 17 89KD
Bong)DK( is using Frozen Throne, has a tier-4 Random icon (the dragon turtle), is level 17 and a member of Clan DK98.

Stealth)DK( 3RAW 2R3W 10 89KD
Stealth)DK( is using Warcraft III Reign of Chaos, has a tier-2 Random icon (a dragon whelp), is level 10 and a member of Clan DK98.

Hope that helps.
- Stealth
Author of StealthBot

Skywing

#5
Quote from: Stealth on October 06, 2003, 11:43 PM
The Warcraft III statstring is very easy to handle.

Username Product IconInfo [Level] [Clan]
Examples:
Stealth)DK( 3RAW 2R3W 10 89KD
BoNg)DK( PX3W 4R3W 17 89KD

Parsing it:

The product portion is straightforward, but you should take it into account when parsing the statstring because the icons are different between Reign of Chaos and Frozen Throne.

IconInfo: xy3W (Example: 2R3W)
x is the icon tier, in this case tier 2.
y is the icon race. Races are:
(R)andom
(N)ight Elf
(O)rc
(U)ndead
(H)uman

The 3W part of the icon info is constant AFAIK. Thus, for the example 2R3W, Stealth)DK( has a tier-2 Random Reign of Chaos icon of a dragon whelp. (The Tier-1 icon for all races is a peon.)

The level is straightforward. It is not reported if the player has not played any games and is not part of a clan. If the player has no games played, but is a clan member, the level will be reported as 0.

The clan portion contains the player's clan tag in a DWORD. Reversing the characters present will give you the tag.

BoNg)DK( PX3W 4R3W 17 89KD
Bong)DK( is using Frozen Throne, has a tier-4 Random icon (the dragon turtle), is level 17 and a member of Clan DK98.

Stealth)DK( 3RAW 2R3W 10 89KD
Stealth)DK( is using Warcraft III Reign of Chaos, has a tier-2 Random icon (a dragon whelp), is level 10 and a member of Clan DK98.

Hope that helps.
3W isn't constant, actually.  The game looks for it to know if the icon is a "built-in" icon, or if it should try and match an icon to user stats based on the data in the Warcraft III version of icons.bni (which is actually an MPQ).
In particular, for some of the special tournaments like KBK, you won't see the standard format user stats.