Factor out constants

Sasky [04-03-15 - 06:52]
Factor out constants
Filename
ChampionBar.lua
EnlightenmentPoolBar.lua
diff --git a/ChampionBar.lua b/ChampionBar.lua
index 45e3752..1fc237e 100644
--- a/ChampionBar.lua
+++ b/ChampionBar.lua
@@ -36,6 +36,8 @@ Problem is a lot of the functions refer to local variables and/or self.
 Overwriting with a new version might keep the self variable the same
 ]]--

+EP_PER_CHAMPION_POINT = 100000
+ENLIGHTENMENT_MAX = 1200000

 ChampionBar = ChampionBar or {}

@@ -99,7 +101,7 @@ function ChampionBar.addLines()
     ChampionBar.lines = {}
     for i=1,11 do
         local line = WINDOW_MANAGER:CreateControl("ChampionBar_CPLine"..i, parent, CT_LINE)
-        local offset = ChampionBar.cpCurve(i*100000, 1200000)/1200000*maxwidth-1
+        local offset = ChampionBar.cpCurve(i*100000, ENLIGHTENMENT_MAX)/ENLIGHTENMENT_MAX*maxwidth-1
         line:SetAnchor(TOPLEFT, parent, TOPLEFT, offset, 0)
         line:SetAnchor(BOTTOMLEFT, parent, BOTTOMLEFT, offset, 0)
         line:SetThickness(1)
diff --git a/EnlightenmentPoolBar.lua b/EnlightenmentPoolBar.lua
index 7711b57..767b34e 100644
--- a/EnlightenmentPoolBar.lua
+++ b/EnlightenmentPoolBar.lua
@@ -38,7 +38,7 @@ end
 function EPBarType:Initialize()
     self.barGradient = { ZO_ColorDef:New("EEFF66"), ZO_ColorDef:New("EEFF00") }
     self.levelTypeText = GetString(SI_EXPERIENCE_CHAMPION_RANK_LABEL)
-    self.tooltipCurrentMaxFormat = 120000
+    self.tooltipCurrentMaxFormat = ZO_CommaDelimitNumber(ENLIGHTENMENT_MAX)
     self.icon = "EsoUI/Art/Champion/champion_points_health_icon-HUD-32.dds"
 end

@@ -77,7 +77,7 @@ function EPBarType:GetEnlightenedTooltip()
         "/",
         ZO_CommaDelimitNumber(self:GetLevelSize()),
         "\n(",
-        math.floor(ep/10000)/10, --CP
+        math.floor(ep/EP_PER_CHAMPION_POINT)/10, --CP
         " ",
         GetString(SI_CHAMPION_POINTS),
         ")"
@@ -90,7 +90,7 @@ function EPBarType:GetSecondaryBarType()
 end

 function EPBarType:GetLevelSize(rank)
-    return 1200000
+    return ENLIGHTENMENT_MAX
 end

 function EPBarType:GetLevel()