• Welcome to Valhalla Legends Archive.
 

Diablo II

Started by raylu, June 09, 2007, 12:19 PM

Previous topic - Next topic

raylu

#30
It seems like the 25th character of the statstring is level (yay, easy to parse :D) and the 26th is flags.
0x01000000 or 0x40 is ladder, I think (that wasn't in your post) and 0x08 isn't dead.
Pie?

Barabajagal

You don't even have a statstring parser? And ladder is the 29th byte (30th for how you're counting... i think you have an extra byte in there).

raylu

I might have counted wrong, o.0. I stuck the number in and was one off, so I adjusted there, thinking I had the indices wrong.

FO's statstring parser doesn't do D2.
Pie?

Barabajagal

#33
Well... I used to have my parse stats bas file in my uploads, but I guess I removed it. My bot's source code is still downloadable, but all you need is the parser...
Public Function ParseD2Stats(ByVal Stats As String)
Dim d2classes(0 To 7) As String
Dim statbuf           As String
Dim P()               As Byte
Dim Server            As String
Dim Name              As String
Dim sLen              As Byte
Dim CharClass         As Byte
Dim Female            As Boolean
Dim CharLevel         As Long
Dim Hardcore          As Boolean
Dim Dead              As Boolean
Dim Ladder            As Boolean
Dim Expansion         As Boolean
Dim D2Act             As String
Dim D2Title           As Integer
    d2classes(0) = "Amazon"
    d2classes(1) = "Sorceress"
    d2classes(2) = "Necromancer"
    d2classes(3) = "Paladin"
    d2classes(4) = "Barbarian"
    d2classes(5) = "Druid"
    d2classes(6) = "Assassin"
    d2classes(7) = "unknown class"
    If Len(Stats) > 4 Then
        sLen = GetServer(Stats, Server)
        sLen = GetCharacterName(Stats, sLen, Name)
        MakeArray Mid$(Stats, sLen), P()
    End If
    If Left$(Stats, 4) = "VD2D" Then
        statbuf = statbuf & "Diablo II: "
    Else
        statbuf = statbuf & "Diablo II Lord of Destruction: "
    End If
    If Len(Stats) = 4 Then
        statbuf = statbuf & "Open Character"
    Else
        CharClass = P(13) - 1
        If (CharClass < 0) Or (CharClass > 6) Then
            CharClass = 7
        End If
        If (CharClass = 0) Or (CharClass = 1) Or (CharClass = 6) Then
            Female = True
        End If
        CharLevel = P(25)
        Hardcore = P(26) And &H4
        Dead = P(26) And &H8
        Expansion = P(26) And &H20
        Ladder = Not (P(30) = 255)
        If Left$(Stats, 4) = "PX2D" And (P(26) And &H20) Then
            Select Case P(27)
                Case &H80
                    D2Act = "1 (Normal)"
                    D2Title = 0
                Case &H82
                    D2Act = "2 (Normal)"
                    D2Title = 0
                Case &H84
                    D2Act = "3 (Normal)"
                    D2Title = 0
                Case &H86
                    D2Act = "4/5 (Normal)"
                    D2Title = 0
                Case &H88
                    D2Act = "5 (Normal)"
                    D2Title = 0
                Case &H8A
                    D2Act = "1 (Nightmare)"
                    D2Title = 1
                Case &H8C
                    D2Act = "2 (Nightmare)"
                    D2Title = 1
                Case &H8E
                    D2Act = "3 (Nightmare)"
                    D2Title = 1
                Case &H90
                    D2Act = "4/5 (Nightmare)"
                    D2Title = 1
                Case &H92
                    D2Act = "5 (Nightmare)"
                    D2Title = 1
                Case &H94
                    D2Act = "1 (Hell)"
                    D2Title = 2
                Case &H96
                    D2Act = "2 (Hell)"
                    D2Title = 2
                Case &H98
                    D2Act = "3 (Hell)"
                    D2Title = 2
                Case &H9A
                    D2Act = "4/5 (Hell)"
                    D2Title = 2
                Case &H9C
                    D2Act = "5 (Hell)"
                    D2Title = 2
                Case &H9E
                    D2Act = vbNullString
                    D2Title = 3
                Case Else
                    D2Act = vbNullString
                    D2Title = P(27)
                End Select
            Select Case D2Title
                Case &H0
                    'Nothing
                Case &H1
                    If Hardcore Then
                        statbuf = statbuf & "Destroyer "
                    Else
                        statbuf = statbuf & "Slayer "
                    End If
                Case &H2
                    If Hardcore Then
                        statbuf = statbuf & "Conquerer "
                    Else
                        statbuf = statbuf & "Champion "
                    End If
                Case &H3
                    If Hardcore Then
                        statbuf = statbuf & "Guardian "
                    Else
                        If Not Female Then
                            statbuf = statbuf & "Patriarch "
                        Else
                            statbuf = statbuf & "Matriarch "
                        End If
                    End If
                Case Else
                    statbuf = statbuf & "Unknown (0x" & Hex$(P(27)) & ")"
            End Select
        Else
            Select Case P(27)
                Case &H80
                    D2Act = "1 (Normal)"
                    D2Title = 0
                Case &H82
                    D2Act = "2 (Normal)"
                    D2Title = 0
                Case &H84
                    D2Act = "3 (Normal)"
                    D2Title = 0
                Case &H86
                    D2Act = "4 (Normal)"
                    D2Title = 0
                Case &H88
                    D2Act = "1 (Nightmare)"
                    D2Title = 1
                Case &H8A
                    D2Act = "2 (Nightmare)"
                    D2Title = 1
                Case &H8C
                    D2Act = "3 (Nightmare)"
                    D2Title = 1
                Case &H8E
                    D2Act = "4 (Nightmare)"
                    D2Title = 1
                Case &H90
                    D2Act = "1 (Hell)"
                    D2Title = 2
                Case &H92
                    D2Act = "2 (Hell)"
                    D2Title = 2
                Case &H94
                    D2Act = "3 (Hell)"
                    D2Title = 2
                Case &H96
                    D2Act = "4 (Hell)"
                    D2Title = 2
                Case &H98
                    D2Act = vbNullString
                    D2Title = 3
                Case Else
                    D2Act = vbNullString
                    D2Title = 0
            End Select
            Select Case D2Title
                Case &H0
                    'Nothing
                Case &H1
                    If Not Female Then
                        If Hardcore Then
                            statbuf = statbuf & "Count "
                        Else
                            statbuf = statbuf & "Sir "
                        End If
                    Else
                        If Hardcore Then
                            statbuf = statbuf & "Countess "
                        Else
                            statbuf = statbuf & "Dame "
                        End If
                    End If
                Case &H2
                    If Not Female Then
                        If Hardcore Then
                            statbuf = statbuf & "Duke "
                        Else
                            statbuf = statbuf & "Lord "
                        End If
                    Else
                        If Hardcore Then
                            statbuf = statbuf & "Duchess "
                        Else
                            statbuf = statbuf & "Lady "
                        End If
                    End If
                Case &H3
                    If Not Female Then
                        If Hardcore Then
                            statbuf = statbuf & "King "
                        Else
                            statbuf = statbuf & "Baron "
                        End If
                    Else
                        If Hardcore Then
                            statbuf = statbuf & "Queen "
                        Else
                            statbuf = statbuf & "Baroness "
                        End If
                    End If
                Case Else
                    statbuf = statbuf & "Unknown (0x" & Hex$(P(27)) & ")"
            End Select
        End If
        statbuf = statbuf & Name & ", a "
        If Hardcore Then
            If Dead Then
                statbuf = statbuf & "dead hardcore "
            Else
                statbuf = statbuf & "hardcore "
            End If
        End If
        statbuf = statbuf & "level " & CharLevel & " "
        If Ladder Then statbuf = statbuf & "ladder "
        statbuf = statbuf & d2classes(CharClass) & IIf(LenB(D2Act) > 0, " in act " & D2Act, "") & " on realm " & Server & IIf(Expansion, " (Expansion)", "")
    End If
    ParseD2Stats = statbuf
End Function

Sorry for the length...

Edit: And yes, I know it's a bit weirdly written... but I'm lazy.

l2k-Shadow

more like source ripped, what's the point of sprintf in VB6, use string concatenation...

EDIT: he edited his post lol.
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

Barabajagal

#35
Ya, I just realized how old that code was. Also, as far as I know, I'm the only one who bothered to find out what all the act values mean... The original code was part of another bot (some d1 bot I ran across years ago), yes, but it's been quite edited. The code I've reposted was my rewritten version.

Edit: Also, I've heard rumors of another title by the name of "Archangel"... I believe Paul (Hell-Lord) mentioned an account of his on east attained it and he didn't have a clue how... I have yet to run across anything of the sort, so I didn't include it of course ;) .

Edit2: wow, I beat you to the change by ~20 seconds...

|