Skip to content
Permalink
Browse files

Fix list view using product icons for W3 icon "8" (WAR3 W3N3 or W3XP …

…W3N2).

- Moved and simplified helper function for getting imagelist position for W3 ladder icons.
  • Loading branch information...
nmbook committed Apr 11, 2016
1 parent 6948031 commit a7d9158f993155398549e19b8860f32ba49f4ff8
Showing with 37 additions and 175 deletions.
  1. +37 −4 trunk/clsUserStats.cls
  2. +0 −171 trunk/modParsing.bas
@@ -705,10 +705,9 @@ Public Property Get IconCode() As Integer

Case PRODUCT_WAR3, PRODUCT_W3XP
IconCode = _
GetRaceAndIcon(Val(Mid$(Icon(), 1, 1)), Mid$(Icon(), 2, 1), StrReverse$(Game), _
IIf(IsWCG, Icon, ""))

If (IconCode <> ICUNKNOWN) Then
GetW3ImageListPosition(Val(Mid$(Icon(), 1, 1)), Mid$(Icon(), 2, 1))

If IconCode > 0 Then
If (Game = PRODUCT_W3XP) Then
IconCode = (ICON_START_W3XP + IconCode)
Else
@@ -738,6 +737,40 @@ Public Property Get IconCode() As Integer
End If
End Property

Private Function GetW3ImageListPosition(ByVal Icon As String, ByRef Race As String) As Integer
Dim IMLPos As Integer
Dim PerTier As Integer

If Game = PRODUCT_WAR3 Then
PerTier = 5
Else
PerTier = 6
End If

Select Case Race
Case "H"
IMLPos = 1
Case "N"
IMLPos = 1 + (PerTier * 1)
Case "U"
IMLPos = 1 + (PerTier * 2)
Case "O"
IMLPos = 1 + (PerTier * 3)
Case "R"
IMLPos = 1 + (PerTier * 4)
Case "T", "D"
IMLPos = 1 + (PerTier * 5)
Case Else
IMLPos = 0
End Select

If StrictIsNumeric(Icon) And IMLPos > 0 Then
IMLPos = IMLPos + (CInt(Icon) - 1)
End If

GetW3ImageListPosition = IMLPos
End Function

Private Sub Parse()
On Error GoTo ERROR_HANDLER

@@ -712,177 +712,6 @@ Public Sub MakeArray(ByVal Text As String, ByRef nArray() As String)
Next i
End Sub

Public Function GetRaceAndIcon(ByRef Icon As String, ByRef Race As String, ByVal Product As String, Optional ByRef WCGCode As String) As Integer
Dim i As Integer, IMLPos As Integer
Dim PerTier As Integer

If Product = "3RAW" Then
PerTier = 5
Else
PerTier = 6
End If

'Debug.Print "Icon: " & Icon & "; Race: " & Race

Select Case Race
Case "H"
IMLPos = 1
i = 0
Race = "Human"
Case "N"
IMLPos = 1 + (PerTier * 1)
i = 10
Race = "Night Elves"
Case "U"
IMLPos = 1 + (PerTier * 2)
i = 20
Race = "Undead"
Case "O"
IMLPos = 1 + (PerTier * 3)
i = 30
Race = "Orcs"
Case "R"
IMLPos = 1 + (PerTier * 4)
i = 40
Race = "Random"
Case "T", "D"
IMLPos = 1 + (PerTier * 5)
i = 50
Race = "Tournament"

Case Else
IMLPos = 1 + (PerTier * 5)
i = 50
Race = "unknown"

End Select

If StrictIsNumeric(Icon) Then
i = i + CInt(Icon)
IMLPos = IMLPos + (CInt(Icon) - 1)
End If

If LenB(WCGCode) > 0 Then
' This is a WCG PLAYER or OTHER PERSON
Select Case StrReverse(WCGCode)
'*** Special icons for WCG added 6/24/07 ***
Case Is = "WCRF"
Icon = "WCG Referee"
IMLPos = IC_WCRF
Case Is = "WCPL"
Icon = "WCG Player"
IMLPos = IC_WCPL
Case Is = "WCGO"
Icon = "WCG Gold Medalist"
IMLPos = IC_WCGO
Case Is = "WCSI"
Icon = "WCG Silver Medalist"
IMLPos = IC_WCSI
Case Is = "WCBR"
Icon = "WCG Bronze Medalist"
IMLPos = IC_WCBR
Case Is = "WCPG"
Icon = "WCG Professional Gamer"
IMLPos = IC_WCPG
Case Else
Icon = "unknown"
IMLPos = ICUNKNOWN ' 37 (38)
End Select
Else
If Product = "3RAW" Then
Select Case i
'Peon Icon
Case 1, 11, 21, 31, 41
Icon = "peon"
'Human Icons
Case 2: Icon = "footman"
Case 3: Icon = "knight"
Case 4: Icon = "Archmage"
Case 5: Icon = "Medivh"
'Night Elf Icons
Case 12: Icon = "archer"
Case 13: Icon = "druid of the claw"
Case 14: Icon = "Priestess of the Moon"
Case 15: Icon = "Furion"
'Undead Icons
Case 22: Icon = "ghoul"
Case 23: Icon = "abomination"
Case 24: Icon = "Lich"
Case 25: Icon = "Tichondrius"
'Orc Icons
Case 32: Icon = "grunt"
Case 33: Icon = "tauren"
Case 34: Icon = "Far Seer"
Case 35: Icon = "Thrall"
'Random Icons
Case 42: Icon = "dragon whelp"
Case 43: Icon = "blue dragon"
Case 44: Icon = "red dragon"
Case 45: Icon = "Deathwing"
'else
Case Else
Icon = "unknown"
IMLPos = ICUNKNOWN ' 26
End Select
Else
Select Case i
'Peon Icon
Case 1, 11, 21, 31, 41, 51
Icon = "peon"
'Human Icons
Case 2: Icon = "rifleman"
Case 3: Icon = "sorceress"
Case 4: Icon = "spellbreaker"
Case 5: Icon = "Blood Mage"
Case 6: Icon = "Jaina Proudmore"
'Night Elf Icons
Case 12: Icon = "huntress"
Case 13: Icon = "druid of the talon"
Case 14: Icon = "dryad"
Case 15: Icon = "Keeper of the Grove"
Case 16: Icon = "Maiev"
'Undead Icons
Case 22: Icon = "crypt fiend"
Case 23: Icon = "banshee"
Case 24: Icon = "destroyer"
Case 25: Icon = "Crypt Lord"
Case 26: Icon = "Sylvanas"
'Orc Icons
Case 32: Icon = "headhunter"
Case 33: Icon = "shaman"
Case 34: Icon = "Spirit Walker"
Case 35: Icon = "Shadow Hunter"
Case 36: Icon = "Rexxar"
'Random Icons
Case 42: Icon = "myrmidon"
Case 43: Icon = "siren"
Case 44: Icon = "dragon turtle"
Case 45: Icon = "sea witch"
Case 46: Icon = "Illidan"
'Tournament Icons
Case 52: Icon = "Felguard"
Case 53: Icon = "infernal"
Case 54: Icon = "doomguard"
Case 55: Icon = "pit lord"
Case 56: Icon = "Archimonde"
'Everything else
Case Else
Icon = "unknown"
IMLPos = ICUNKNOWN ' 37 (38)

End Select
End If
End If

If IMLPos > frmChat.imlIcons.ListImages.Count Then
IMLPos = ICUNKNOWN
End If
'Debug.Print "Icon: " & Icon & "; Race: " & Race & "; IMLPos: " & IMLPos

GetRaceAndIcon = IMLPos

End Function

Public Function Conv(ByVal RawString As String) As Long
Dim lReturn As Long

0 comments on commit a7d9158

Please sign in to comment.
You can’t perform that action at this time.