Bugfixes
Sasky [04-01-15 - 06:14]
Bugfixes
Move overwrite to a delay
Add enlightenment tooltip
diff --git a/ChampionBar.lua b/ChampionBar.lua
index 524be6f..6245997 100644
--- a/ChampionBar.lua
+++ b/ChampionBar.lua
@@ -17,9 +17,29 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
============================================================================]]
+--[[TODO: Fix animation at beginning
+Old VPbar values get cached from the initial and show a levelup to the value.
+
+Possible points to hit:
+[line 661]
+.pendingShowIncrease => Set in PPB:ShowIncrease
+
+[line 687]
+could be coming in through :RefreshCurrentBar -> :SetBarValue.
+ - probably not able to hijack then restore, though
+
+[line 773] => looks like the pendingShowIncrease is where it's coming in
+
+[line 893] => :ClearIncreaseData() Could prevent it going into increase
+
+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
+]]--
+
+
ChampionBar = ChampionBar or {}
-local function replaceBars()
+function ChampionBar.replaceBars()
local ppb = PLAYER_PROGRESS_BAR
ppb.barTypeClasses[PPB_CLASS_EP] = ChampionBar.EPBarType
ppb.barTypeClasses[PPB_CLASS_VP] = ChampionBar.VPMaxBarType
@@ -30,10 +50,10 @@ local function replaceBars()
PPB_VP = ppb:InstantiateBarType(PPB_CLASS_VP)
PPB_CP = ppb:InstantiateBarType(PPB_CLASS_CP)
PPB_EP = ppb:InstantiateBarType(PPB_CLASS_EP)
- ppb:InitializeLastValues()
+ ppb:RefreshCurrentBar()
end
-local function replaceHandlers()
+function ChampionBar.replaceHandlers()
function PLAYER_PROGRESS_BAR:RefreshSecondaryBar()
local secondaryBarInfo = self:GetSecondaryBarInfo()
if secondaryBarInfo then
@@ -60,7 +80,7 @@ local function replaceHandlers()
end
end
-local function registerEvents()
+function ChampionBar.registerEvents()
EVENT_MANAGER:RegisterForEvent("ChampionBar", EVENT_CHAMPION_POINT_GAINED, function()
local vpbar = PLAYER_PROGRESS_BAR.barTypes[PPB_VP];
vpbar.icon = vpbar:GetIcon()
@@ -68,16 +88,21 @@ local function registerEvents()
end)
end
-local function onAddOnLoaded(_, addonName)
- if addonName ~= "ChampionBar" then return end
+function ChampionBar.init()
--Only show for max VR characters
if GetUnitLevel("player") ~= 50 or GetUnitVeteranRank("player") ~= 14 then
--TODO: Add handler for levelup for if hit VR14
return
end
- replaceBars()
- replaceHandlers()
- registerEvents()
+ if PLAYER_PROGRESS_BAR.barTypeClasses then
+ ChampionBar.replaceBars()
+ ChampionBar.replaceHandlers()
+ ChampionBar.registerEvents()
+
+ end
+ EVENT_MANAGER:UnregisterForEvent("ChampionBar", EVENT_PLAYER_ACTIVATED)
end
-EVENT_MANAGER:RegisterForEvent("ChampionBar", EVENT_ADD_ON_LOADED, onAddOnLoaded)
\ No newline at end of file
+ChampionBar.readinStatus = (ZO_PlayerProgressBar_OnInitialized == nil)
+--Currently just calling after finished. TOOD: Figure out how to prefill values
+EVENT_MANAGER:RegisterForEvent("ChampionBar", EVENT_PLAYER_ACTIVATED, function() zo_callLater(ChampionBar.init,6000) end)
\ No newline at end of file
diff --git a/ChampionBar.txt b/ChampionBar.txt
index 5aad8cc..66950a4 100644
--- a/ChampionBar.txt
+++ b/ChampionBar.txt
@@ -1,6 +1,6 @@
## APIVersion: 100011
## Title: CyrHUD
-## Version: 1.0.0
+## Version: 0.9
## Author: Sasky
VPMaxBar.lua
diff --git a/EnlightenmentPoolBar.lua b/EnlightenmentPoolBar.lua
index 1fca211..bbc39ea 100644
--- a/EnlightenmentPoolBar.lua
+++ b/EnlightenmentPoolBar.lua
@@ -23,6 +23,7 @@
ChampionBar = ChampionBar or {}
local EPBarType = ZO_Object:Subclass()
ChampionBar.EPBarType = EPBarType
+PPB_CLASS_EP = 5
function EPBarType:New(barTypeClass, barTypeId)
local obj = ZO_Object.New(self)
@@ -35,7 +36,7 @@ end
function EPBarType:Initialize()
self.barGradient = { ZO_ColorDef:New("EEFF66"), ZO_ColorDef:New("EEFF00") }
- self.levelTypeText = "Enlightenment Pool"
+ self.levelTypeText = GetString(SI_EXPERIENCE_CHAMPION_RANK_LABEL)
self.tooltipCurrentMaxFormat = 120000
self.icon = "EsoUI/Art/Champion/champion_points_health_icon-HUD-32.dds"
end
@@ -67,7 +68,17 @@ function EPBarType:GetEnlightenedPool()
end
function EPBarType:GetEnlightenedTooltip()
- return "Enlightenment: " .. self:GetCurrent() .. "/" ..self:GetLevelSize()
+ local ep = GetEnlightenedPool()
+ local msg = {
+ "Enlightenment: ",
+ ep,
+ "/",
+ self:GetLevelSize(),
+ "\n(",
+ math.floor(ep/10000)/10, --CP
+ " Champion Points)"
+ }
+ return table.concat(msg, "")
end
function EPBarType:GetSecondaryBarType()
@@ -83,6 +94,7 @@ function EPBarType:GetLevel()
end
function EPBarType:GetCurrent()
+ -- math.sqrt(GetEnlightenedPool())*math.sqrt(self:GetLevelSize())
return GetEnlightenedPool()
end
diff --git a/VPMaxBar.lua b/VPMaxBar.lua
index 0c091d6..15b50fa 100644
--- a/VPMaxBar.lua
+++ b/VPMaxBar.lua
@@ -22,7 +22,7 @@
---
ChampionBar = ChampionBar or {}
local VPMaxBarType = ZO_Object:Subclass()
-ChampionBar.VPMaxBarType =VPMaxBarType
+ChampionBar.VPMaxBarType = VPMaxBarType
function VPMaxBarType:New(barTypeClass, barTypeId)
local obj = ZO_Object.New(self)