Make bar nonlinear with lines
Sasky [04-03-15 - 06:47]
Make bar nonlinear with lines
diff --git a/ChampionBar.lua b/ChampionBar.lua
index 6245997..45e3752 100644
--- a/ChampionBar.lua
+++ b/ChampionBar.lua
@@ -80,6 +80,10 @@ function ChampionBar.replaceHandlers()
end
end
+function ChampionBar.cpCurve(val, max)
+ return math.sqrt(val)*math.sqrt(max)
+end
+
function ChampionBar.registerEvents()
EVENT_MANAGER:RegisterForEvent("ChampionBar", EVENT_CHAMPION_POINT_GAINED, function()
local vpbar = PLAYER_PROGRESS_BAR.barTypes[PPB_VP];
@@ -88,6 +92,24 @@ function ChampionBar.registerEvents()
end)
end
+function ChampionBar.addLines()
+ local parent = PLAYER_PROGRESS_BAR.secondaryBarControl
+ local maxwidth = parent:GetWidth()
+ local linecolor = ZO_ColorDef:New("6b5d39")
+ 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
+ line:SetAnchor(TOPLEFT, parent, TOPLEFT, offset, 0)
+ line:SetAnchor(BOTTOMLEFT, parent, BOTTOMLEFT, offset, 0)
+ line:SetThickness(1)
+ line:SetColor(linecolor:UnpackRGBA())
+ line:SetDrawLayer(DL_OVERLAY)
+ table.insert(ChampionBar.lines, line)
+ end
+
+end
+
function ChampionBar.init()
--Only show for max VR characters
if GetUnitLevel("player") ~= 50 or GetUnitVeteranRank("player") ~= 14 then
@@ -98,7 +120,7 @@ function ChampionBar.init()
ChampionBar.replaceBars()
ChampionBar.replaceHandlers()
ChampionBar.registerEvents()
-
+ ChampionBar.addLines()
end
EVENT_MANAGER:UnregisterForEvent("ChampionBar", EVENT_PLAYER_ACTIVATED)
end
diff --git a/EnlightenmentPoolBar.lua b/EnlightenmentPoolBar.lua
index d705ded..7711b57 100644
--- a/EnlightenmentPoolBar.lua
+++ b/EnlightenmentPoolBar.lua
@@ -98,8 +98,7 @@ function EPBarType:GetLevel()
end
function EPBarType:GetCurrent()
- -- ChampionBar.cpCurve(GetEnlightenedPool(),self:GetLevelSize())
- return GetEnlightenedPool()
+ return ChampionBar.cpCurve(GetEnlightenedPool(),self:GetLevelSize())
end
function EPBarType:GetBarGradient()