Use constant for max veteran rank. Bump for ESO2.1

Scott Yeskie [09-01-15 - 06:40]
Use constant for max veteran rank. Bump for ESO2.1
Filename
ChampionBar.lua
ChampionBar.txt
EnlightenmentPoolBar.lua
VPMaxBar.lua
diff --git a/ChampionBar.lua b/ChampionBar.lua
index 806bf08..5f22ebe 100644
--- a/ChampionBar.lua
+++ b/ChampionBar.lua
@@ -20,6 +20,8 @@
 EP_PER_CHAMPION_POINT = 100000
 ENLIGHTENMENT_MAX = 1200000

+MAX_VETERAN_RANK = 16 --Since for some stupid reason, MAXIMUM_VETERAN_RANK is 50
+
 ChampionBar = ChampionBar or {}

 function ChampionBar.replaceBars()
@@ -39,7 +41,8 @@ end
 function ChampionBar.replaceHandlers()
     function PLAYER_PROGRESS_BAR:RefreshSecondaryBar()
         local secondaryBarInfo = self:GetSecondaryBarInfo()
-        if secondaryBarInfo then
+        local hasSecondaryBar = secondaryBarInfo ~= nil
+        if hasSecondaryBar then
             local current = secondaryBarInfo:GetCurrent()
             local max = secondaryBarInfo:GetLevelSize(secondaryBarInfo:GetLevel())
             if max == nil then
@@ -51,15 +54,18 @@ function ChampionBar.replaceHandlers()
             local gradient = secondaryBarInfo:GetBarGradient()
             ZO_StatusBar_SetGradientColor(self.secondaryBarControl, gradient)
             ZO_StatusBar_SetGradientColor(self.enlightenedBarControl, gradient)
+            --Begin difference from base ESOUI code
             local icon = secondaryBarInfo:GetIcon()
             if icon then
                 self.secondaryBarLevelTypeIcon:SetTexture(icon)
             end
             self.secondaryBarLevelTypeIcon:SetHidden(not icon)
             local txt = current == 0 and "" or string.upper(GetString(SI_ENLIGHTENED))
-            self.secondaryBarControl:GetNamedChild("SecondaryLevelType"):SetText(txt)
+            self.secondaryBarLevelTypeLabel:SetText(txt)
+            --End difference from base ESOUI code
         end
-        self.secondaryBarControl:SetHidden(secondaryBarInfo == nil)
+        self.secondaryBarLevelTypeIcon:SetHidden(not hasSecondaryBar)
+        self.secondaryBarControl:SetHidden(not hasSecondaryBar)
     end

     --Hook first, then restore for showing bar on login
@@ -103,7 +109,7 @@ function ChampionBar.addLines()
 end

 function ChampionBar.onLevelup(_, unit, vr)
-    if unit == "player" and vr == 14 then
+    if unit == "player" and vr == MAX_VETERAN_RANK then
         ChampionBar.initMaxLevel()
         EVENT_MANAGER:UnregisterForEvent("ChampionBar", EVENT_VETERAN_RANK_UPDATE)
     end
@@ -127,7 +133,7 @@ end

 function ChampionBar.init()
     --Only show for max VR characters
-    if GetUnitLevel("player") ~= 50 or GetUnitVeteranRank("player") ~= 14 then
+    if GetUnitLevel("player") ~= 50 or GetUnitVeteranRank("player") ~= MAX_VETERAN_RANK then
         ChampionBar.initLowerLevel()
     else
         ChampionBar.initMaxLevel()
@@ -135,4 +141,4 @@ function ChampionBar.init()
     EVENT_MANAGER:UnregisterForEvent("ChampionBar", EVENT_PLAYER_ACTIVATED)
 end

-EVENT_MANAGER:RegisterForEvent("ChampionBar", EVENT_PLAYER_ACTIVATED, function() ChampionBar.init() end)
\ No newline at end of file
+EVENT_MANAGER:RegisterForEvent("ChampionBar", EVENT_PLAYER_ACTIVATED, function() ChampionBar.init() end)
diff --git a/ChampionBar.txt b/ChampionBar.txt
index 95bd7b8..5b3688a 100644
--- a/ChampionBar.txt
+++ b/ChampionBar.txt
@@ -1,6 +1,6 @@
-## APIVersion: 100011
+## APIVersion: 100012
 ## Title: ChampionBar
-## Version: 1.0.1
+## Version: 1.0.2
 ## Author: Sasky

 lang/en.lua
diff --git a/EnlightenmentPoolBar.lua b/EnlightenmentPoolBar.lua
index 8ee65f8..28a7b65 100644
--- a/EnlightenmentPoolBar.lua
+++ b/EnlightenmentPoolBar.lua
@@ -113,6 +113,10 @@ function EPBarType:GetShownAttribute()
     return GetChampionPointAttributeForRank(level)
 end

+function EPBarType:GetLevelTypeText()
+    return GetString(SI_EXPERIENCE_CHAMPION_RANK_LABEL)
+end
+
 function EPBarType:GetIcon()
     return "/esoui/art/champion/champion_star_burst.dds"
-end
\ No newline at end of file
+end
diff --git a/VPMaxBar.lua b/VPMaxBar.lua
index 7a5cc96..1914616 100644
--- a/VPMaxBar.lua
+++ b/VPMaxBar.lua
@@ -96,6 +96,12 @@ function VPMaxBarType:GetShownAttribute()
     return GetChampionPointAttributeForRank(level)
 end

+function VPMaxBarType:GetLevelTypeText()
+    if not IsInGamepadPreferredMode() then
+        return self.levelTypeText
+    end
+end
+
 local CHAMPION_ATTRIBUTE_HUD_ICONS =
 {
     [ATTRIBUTE_HEALTH] = "EsoUI/Art/Champion/champion_points_health_icon-HUD-32.dds",
@@ -105,4 +111,4 @@ local CHAMPION_ATTRIBUTE_HUD_ICONS =

 function VPMaxBarType:GetIcon()
     return CHAMPION_ATTRIBUTE_HUD_ICONS[self:GetShownAttribute()]
-end
\ No newline at end of file
+end