Attribute VB_Name = "modIconParsing"
Public Function GetClientIcon(Index As Integer, Statstring As String, Flags As Long, Optional Rank As Integer = -1) As Integer
    On Error GoTo hErr
    If Len(Statstring) < 4 Then GetClientIcon = 17: Exit Function
    Dim IconIndex As Integer
    Select Case StrReverse$(Left$(Statstring, 4))
        Case "WAR3": IconIndex = 6
        Case "W3XP": IconIndex = 7
        Case "DSHR": IconIndex = 8
        Case "DRTL": IconIndex = 9
        Case "D2DV": IconIndex = 10
        Case "D2XP": IconIndex = 11
        Case "SSHR": IconIndex = 12
        Case "JSTR": IconIndex = 13
        Case "STAR": IconIndex = 14
        Case "SEXP": IconIndex = 15
        Case "W2BN": IconIndex = 16
        Case "CHAT": IconIndex = 18
        Case Else:   IconIndex = 17
    End Select
    If (Flags And &H2) Then IconIndex = 5
    If options.DisableClanIcons = False Then
        Select Case Rank
            Case 0, 1: IconIndex = 19
            Case 2: IconIndex = 20
            Case 3: IconIndex = 21
            Case 4: IconIndex = 22
        End Select
    End If
    If (Flags And &H1) Then IconIndex = 1
    If (Flags And &H8) Then IconIndex = 2
    If (Flags And &H4) Then IconIndex = 3
    If (Flags And &H20) Then IconIndex = 4
    GetClientIcon = IconIndex
    Exit Function
hErr:
    GetClientIcon = 17
    ErrorHandler Err.Number, Err.Description, Erl, "IconParse", "GetClientIcon"
End Function

