• Welcome to Valhalla Legends Archive.
 

Warcraft III GS

Started by PunK, December 09, 2008, 03:36 PM

Previous topic - Next topic

Ozzapoo

Well I've finally got my function to get the game names working (even though it was surprisingly long....)

However does anyone know how to interpret the statstrings? It shows up on my program like:

b30000000IY?Y?U?M?aqs]Eow?omoae]e?mim31/1?/w3yMa_gicam-Usewes
[

Ozzapoo

#16
I found this: http://bnetdocs.com/?op=doc&did=13
But I don't understand how the different values are seperated? Should I interpret this as a string, or should I interpret it as bytes?

Sixen

Quote from: Ozzapoo on December 16, 2008, 02:04 AM
I found this: http://bnetdocs.com/?op=doc&did=13
But I don't understand how the different values are seperated? Should I interpret this as a string, or should I interpret it as bytes?

The delimiter is a comma, it's all one string.
Blizzard Tech Support/Op W@R - FallenArms
The Chat Gem Lives!
http://www.diablofans.com
http://www.sixen.org

Ozzapoo

I can't see a comma though.. (nor can I find one)

Perhaps only the Starcraft statstrings are comma-delimited?

Barabajagal

You have to decode War3's map data:

Public Function DecodeMapData(ByVal Encoded As String, ByRef Decoded As String) As Long
Dim enc()  As Byte
Dim dec()  As Byte
Dim I      As Long
Dim J      As Long
Dim D      As Byte
Dim lngLen As Long
  enc = strConv(Encoded, vbFromUnicode)
  For I = 0 To UBound(enc)
    If (I Mod 8) Then
      ReDim Preserve dec(lngLen)
      dec(lngLen) = (enc(I) And ((RShift(D, 1 + J) Or Not 1)))
      J = J + 1
      lngLen = lngLen + 1
    Else
      J = 0
      D = enc(I)
    End If
  Next I
  Decoded = strConv(dec, vbUnicode)
  DecodeMapData = lngLen
End Function

Ozzapoo

#20
There's no vbFromUnicode in VB.Net =/
Could you explain to be how the statstring is encoded, so I can try to make a decoding function myself?

PunK

Hmm, I didn't bother to count the games...

Did you already resolve the packets without headers? If not, what about just assigning the packets based on there data content. Get the map values and if they are valid, send to the 0x09 buffer... In fact, you don't even need to decrypt the map values, you can just do something like this.

if datalen >= 300 and instr(data, "w3m") then parse0x09(data)

I guess something along those lines would work seeing how "w3m" appears in each statstring.

I still have the question on splitting the data up into segments. I've tried finding a method in which I could get the game name and I think I might have found a sloppy way...

Go through the buffer, parse the game values into Andy's W3 map decoder and if the value is good, then the string previous to the map data will be the map name.


Hero Wars Elite 4.3
b10000000Ia±aÕ›=ÙMËaqs]Eowomoae]Ikeso!Was«s!Emiue'!5/3c/w3mMami7ceIeasu

Ozzapoo

Battle.Net sends you 20 games every time you request a games list I think..

PunK



PunK

Don't use my idea on relating split packets with one another by the "w3m" string. It varies.

Ozzapoo

#26
What does RShift() do? Can someone post the code here? EDIT: Nevermind, found it.

Why does the function always just return three random characters? The characters are the same depending on the game, but they just seem random. Did I do something wrong?

I modifed the function slightly and made it return the decoded string directly. Please tell me if something is wrong:

    Public Function DecodeMapData(ByVal Encoded As String) As String
        Dim enc() As Byte
        Dim dec() As Byte
        Dim I As Long
        Dim J As Long
        Dim D As Byte
        Dim lngLen As Long
        enc = System.Text.UnicodeEncoding.Unicode.GetBytes(Encoded)
        For I = 0 To UBound(enc)
            If (I Mod 8) Then
                ReDim Preserve dec(lngLen)
                dec(lngLen) = (enc(I) And (D >> (1 + J) Or Not 1))
                J = J + 1
                lngLen = lngLen + 1
            Else
                J = 0
                D = enc(I)
            End If
        Next I
        Return System.Text.UnicodeEncoding.Unicode.GetString(dec)
    End Function

Does the length matter?