Valhalla Legends Forums Archive | Battle.net Bot Development | War3 Statstring Parsing

AuthorMessageTime
-Drew-
Okay just wrote this up with some help from some other post's. If noone has it, feel free. My intention is to see if anyone sees any problem with the code. Please let me know. As for some of the values; I have the game, but i don't know each detail so im going off of what i have read.

[code]

..The parsing sub

Public Sub ParseStatString(ByVal Statstring As String, ByRef outBuf As String)
Dim Values() As String
Dim cType As String
    Select Case Left$(Statstring, 4)
   
        Case "PX3W"
            If Len(Statstring) = 4 Then
                Call strcpy(outBuf, "Warcraft III Expansion: Frozen Throne.")
                Exit Sub
            Else
                Call strcpy(outBuf, "Warcraft III Expansion: Frozen Throne, ")
                Call strcpy(outBuf, ParseW3String(Statstring, outBuf))
            End If
        Case "3RAW"
            If Len(Statstring) = 4 Then
                Call strcpy(outBuf, "Warcraft III: Reign of Chaos.")
                Exit Sub
            Else
                Call strcpy(outBuf, "Warcraft III: Reign of Chaos, ")
                Call strcpy(outBuf, ParseW3String(Statstring, outBuf))
            End If


And the Function...

Public Function ParseW3String(ByVal Stats As String, ByRef outBuf As String)
Dim BestRace As String, Tier As String, Level As String
Dim Icon As String, Values() As String, Clan As String

    Values() = Split(Mid$(Stats, 6), " ")
   
    Tier = Mid(Values(0), 1, 1)
   
    Select Case UCase(Mid$(Values(0), 2, 1))
        Case "R"
            BestRace = "Random"
           
            Select Case Tier
                Case 1: Icon = "Peon"
                Case 2: Icon = "Green Dragon Whelp"
                Case 3: Icon = "Blue Drake"
                Case 4: Icon = "Red Dragon"
                Case 5: Icon = "Deathwing"
            End Select
        Case "N"
            BestRace = "Night Elf"
           
            Select Case Tier
                Case 1: Icon = "Peon"
                Case 2: Icon = "Archer"
                Case 3: Icon = "Druid of the Claw"
                Case 4: Icon = "Priestess of the Moon"
                Case 5: Icon = "Furion Stormrage"
            End Select
        Case "O"
            BestRace = "Orc"
           
            Select Case Tier
                Case 1: Icon = "Peon"
                Case 2: Icon = "Grunt"
                Case 3: Icon = "Tauren"
                Case 4: Icon = "Farseer"
                Case 5: Icon = "Thrall"
            End Select
        Case "U"
            BestRace = "Undead"
           
            Select Case Tier
                Case 1: Icon = "Peon"
                Case 2: Icon = "Ghoul"
                Case 3: Icon = "Abomination"
                Case 4: Icon = "Lich"
                Case 5: Icon = "Tichondrius"
            End Select
        Case "H"
            BestRace = "Human"
           
            Select Case Tier
                Case 1: Icon = "Peon"
                Case 2: Icon = "Footmen"
                Case 3: Icon = "Knight"
                Case 4: Icon = "Archmage"
                Case 5: Icon = "Medivh"
            End Select
    End Select
   
    Level = Values(1)
   
    If UBound(Values) = 2 Then
        Clan = StrReverse(Values(2))
        Call sprintf(outBuf, "Tier-%s(%s), %s Icon, is level %s and with Clan %s", Tier, Icon, BestRace, Level, Clan)
    Else
        Call sprintf(outBuf, "Tier-%s(%s), %s Icon, and is level %s", Tier, Icon, BestRace, Level)
    End If
   
End Function
[/code]

Thanks..

-Edit, made code perdier
September 24, 2006, 9:27 AM
MyStiCaL
[quote author=-Drew- link=topic=15779.msg158864#msg158864 date=1159090052]
Okay just wrote this up with some help from some other post's. [/quote]

[quote author=topaz link=topic=15779.msg158868#msg158868 date=1159094155]
Anyone else get the feeling this is leeched too?
[/quote]

this is where the retarded-ness would begin.

*cough DUH, there's other post(s) here that have full code to the same thing, why would you even say somthing let alone say somthing so someone could post something else as useless.


[code]
Select Case Left$(Statstring, 4)
   

         Case "PX3W"
            If Len(Statstring) = 4 Then
                Call strcpy(outBuf, "Warcraft III Expansion: Frozen Throne.")
                Exit Sub
            Else
                Call strcpy(outBuf, "Warcraft III Expansion: Frozen Throne, ")
                Call strcpy(outBuf, ParseW3String(Statstring, outBuf))
            End If
       
        Case "3RAW"
            If Len(Statstring) = 4 Then
                Call strcpy(outBuf, "Warcraft III: Reign of Chaos.")
                Exit Sub
            Else
                Call strcpy(outBuf, "Warcraft III: Reign of Chaos, ")
                Call strcpy(outBuf, ParseW3String(Statstring, outBuf))
            End If
[/code]


Len here looks a lil odd to me =\
September 24, 2006, 11:00 AM
-Drew-
Look i really don't care to argue over this kinda of crap. I wrote the code from line 1, no copy, no pasting. Only reference i could find was this post https://davnit.net/bnet/vL/index.php?topic=2984.0 and this on battle.net for the icons of each tier http://www.battle.net/war3/ladder/war3-ladder-info-laddericons.aspx?Gateway=Azeroth My Biggest question was i couldnt find anything saying there was a difference in W3XP.

If i post code that is not mine, i will say so; I don't have any issues with that.
September 24, 2006, 11:13 AM
rabbit
Yeah.  So where are the sprintf() and strcpy() functions?  You realize strcpy(str1, str2) is the same as str1 = str1 & str2?  You also leave ParseStatString() and it's switch completely unclosed.
September 24, 2006, 12:12 PM
RealityRipple
I think he was showing a sample from that sub, not the whole thing. the whole sub is sort of public domain now. you can find it everywhere.

Some notes on it: i've noticed people just put the best race and icon into a generic statstring text, like "Best race: Human. Icon: Footman" why not do it in a more friendly way, maybe with some other info? Like so: "Human Footman (25 wins)". Just my two bits.
September 24, 2006, 9:03 PM
Quarantine
[quote author=rabbit link=topic=15779.msg158872#msg158872 date=1159099972]
Yeah.  So where are the sprintf() and strcpy() functions?  You realize strcpy(str1, str2) is the same as str1 = str1 & str2?  You also leave ParseStatString() and it's switch completely unclosed.
[/quote]

I'd think strcpy would be faster, although the speed gain is probably small.
September 24, 2006, 9:07 PM
RealityRipple
[code]Public Sub strcpy(ByRef Source As String, ByVal nText As String)
    Source = Source & nText
End Sub[/code]

There is no difference. I saw no use in it, so I don't use it anymore.
September 24, 2006, 9:09 PM
FrOzeN
Considering the function strcpy() doesn't exist in VB6 it would be slower/faster depending on how you created it.

Assuming you just did,
[code]Public Sub strcpy(ByRef Source As String, ByVal nText As String)
    Source = Source & nText
End Sub[/code]
Then it would be slower as you'd already be doing that exact code, except now it has to parse it through a function. If you were maybe calling it from an external .dll written in say C++ then it *may* be faster to combine the strings.

Either way, it's not going to make any noticeable difference. I'm pretty sure the code to parse WarCraft 3 strings was originally written in by C++ (and released) then someone converted it over, and just created the strcpy & sprintf functions to make the conversion easier. Since then, numerous sources codes I've looked through all seem to contain this function but no one has actually credited where it originally came from, and I'm pretty sure not every VB6 coders first thought is to create the function strcpy to combine strings.
September 25, 2006, 5:43 AM
RealityRipple
I got my original statstring code from some old d1 bot... I then edited it alot because the war3 stuff was wrong, it didn't provide enough d2 info (like what act they're on [yes, that IS in the statstring]), and it was lacking in a lot of areas. It also now has Game Statstrings. Final result: http://realityripple.com/Uploads/modParseStats.bas
September 25, 2006, 6:45 AM
-Drew-
That's exactly what i wanted; W3XP and WAR3 do differ, noticed it in your code. I guess i didn't check the difference between xp and non-xp on the website, just found all of it.
Thanks Ripple
September 25, 2006, 7:16 AM
RealityRipple
Ya, each race got a new icon... and there's Tournament icons. I think there's links to these places in BNetDocs, but here:
WAR3 Icons: http://www.battle.net/war3/ladder/war3-ladder-info-laddericons.aspx
W3XP Icons: http://www.battle.net/war3/ladder/w3xp-ladder-info-laddericons.aspx
September 25, 2006, 7:18 AM
-Drew-
okay here's something i just noticed...

[code]
0000:  FF 0F 2C 00 01 00 00 00 00 00 00 00 4E 00 00 00  ÿ,........N...
0010:  00 00 00 00 0D F0 AD BA 0D F0 AD BA 47 65 4B 00  .....ð­º.ð­ºGeK.
0020:  50 58 33 57 20 47 50 43 57 20 30 00              PX3W GPCW 0.....

0000:  FF 0F 2F 00 01 00 00 00 00 00 00 00 0F 00 00 00  ÿ/...........
0010:  00 00 00 00 0D F0 AD BA 0D F0 AD BA 62 4C 69 6E  .....ð­º.ð­ºbLin
0020:  6B 7A 00 50 58 33 57 20 47 50 43 57 20 30 00      kz.PX3W GPCW 0..
[/code]

These people both had an amlost completely different statstring. Is this more of the tournament stuff? I didn't see anything like this in your w3 parsing

My Statstring was..
[code]
0000:  FF 0F 31 00 01 00 00 00 00 00 00 00 00 00 00 00  ÿ1............
0010:  00 00 00 00 0D F0 AD BA 0D F0 AD BA 4F 78 69 4B  .....ð­º.ð­ºOxiK
0020:  6C 65 61 6E 00 33 52 41 57 20 31 4F 33 57 20 32  lean.3RAW 1O3W 2
0030:  00                                                ................
[/code]


September 25, 2006, 7:28 AM
RealityRipple
Looks like they're in a clan. :)
September 25, 2006, 7:41 AM
FrOzeN
Ah, just remembered. Awhile back Darkness documented a lot of the stuff on his website. http://www.geocities.com/wizardguy@sbcglobal.net/statparse.txt :)
September 25, 2006, 8:24 AM
RealityRipple
It's a bit wrong...

[quote]'================================ 9 ==================================
' Product                        | Returns
'=====================================================================
' Starcraft                      | Empty String.
' Starcraft: Brood War            | Empty String.
' Starcraft Japanese              | Empty String.
' Starcraft: Shareware            | Empty String.
' Warcraft II: Battle.net Edition | Empty String.
' Diablo                          | Returns True if it is a Diablo bot, otherwise it returns False.
' Diablo: Shareware              | Returns True if it is a Diablo: Shareware bot, otherwise it returns False.
' Diablo II                      | Empty String.
' Diablo II: Lord of Destruction  | Empty String.
' WarCraft III: Reign of Chaos    | Empty String.
' WarCraft III: The Frozen Throne | Empty String.
' Chat Bot                        | Empty String.
' Unknown                        | Empty String.[/quote]
the d1 stuff. Diablo is always 0, Diablo Shareware is always 1 (it's a spawn boolean, like sc/war2's 5th number). And that d2 info is pitiful.
September 25, 2006, 8:34 AM
FrOzeN
[quote author=RealityRipple link=topic=15779.msg158970#msg158970 date=1159173257]
It's a bit wrong...

<snipped>

the d1 stuff. Diablo is always 0, Diablo Shareware is always 1 (it's a spawn boolean, like sc/war2's 5th number). And that d2 info is pitiful.
[/quote]
Eh, it's about 2 years old and at the time it was the only documentation around other than some source codes.

[EDIT] Also, seeing as Battle.net has killed of the ladder system and implemented it into a website or something. Do the ladder variables in the statstring still get parsed the same way?
September 25, 2006, 9:00 AM
RealityRipple
Ladder variables for what? SC? yes. W2? yes.
September 25, 2006, 9:23 AM
FrOzeN
[quote author=RealityRipple link=topic=15779.msg158977#msg158977 date=1159176235]
Ladder variables for what? SC? yes. W2? yes.
[/quote]
Eh, you answered my question. But to verify, yeah for SC/BW/WC2, the ones that replace some of the zero's inside a typical statstring like "PXES 0 0 0 0 0 0 0 0 PXES".
September 25, 2006, 10:42 AM
RealityRipple
Those are all still completely usable, even though ladder is closed on all realms except europe. EX: [quote]RealityRipple [313ms.] is on Starcraft: 100 normal game wins, with a rating of 1377 and a rank of 766 on the ladder.[/quote]
September 25, 2006, 10:46 AM

Search