diff --git a/ChampionBar.lua b/ChampionBar.lua index 10f9673..6c08058 100644 --- a/ChampionBar.lua +++ b/ChampionBar.lua @@ -17,25 +17,6 @@ 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 -]]-- - EP_PER_CHAMPION_POINT = 100000 ENLIGHTENMENT_MAX = 1200000 @@ -75,11 +56,19 @@ function ChampionBar.replaceHandlers() self.secondaryBarLevelTypeIcon:SetTexture(icon) end self.secondaryBarLevelTypeIcon:SetHidden(not icon) - local txt = current == 0 and "" or "ENLIGHTENED" + local txt = current == 0 and "" or string.upper(GetString(SI_ENLIGHTENED)) self.secondaryBarControl:GetNamedChild("SecondaryLevelType"):SetText(txt) end self.secondaryBarControl:SetHidden(secondaryBarInfo == nil) end + + --Hook first, then restore for showing bar on login + local originalFn = PLAYER_PROGRESS_BAR.ShowIncrease + function PLAYER_PROGRESS_BAR.ShowIncrease(self, barType, startLevel, start, stop, increaseSound, waitBeforeShowMS, owner) + local bar = ChampionBar.VPMaxBarType + originalFn(self, barType,bar:GetLevel(), bar:GetCurrent(), bar:GetCurrent(), increaseSound, waitBeforeShowMS, owner) + PLAYER_PROGRESS_BAR.ShowIncrease = originalFn + end end function ChampionBar.cpCurve(val, max) @@ -87,10 +76,11 @@ function ChampionBar.cpCurve(val, max) end function ChampionBar.registerEvents() - EVENT_MANAGER:RegisterForEvent("ChampionBar", EVENT_CHAMPION_POINT_GAINED, function() + EVENT_MANAGER:RegisterForEvent("ChampionBar", EVENT_CHAMPION_POINT_GAINED, function() local vpbar = PLAYER_PROGRESS_BAR.barTypes[PPB_VP]; vpbar.icon = vpbar:GetIcon() vpbar.barGradient = vpbar:GetBarGradient() + vpbar.barGlowColor = vpbar.barGradient[2] end) end @@ -114,25 +104,34 @@ end function ChampionBar.onLevelup(_, unit, vr) if unit == "player" and vr == 14 then - ChampionBar.init() + ChampionBar.initMaxLevel() end end -function ChampionBar.init() - --Only show for max VR characters - if GetUnitLevel("player") ~= 50 or GetUnitVeteranRank("player") ~= 14 then - EVENT_MANAGER:RegisterForEvent("ChampionBar", EVENT_VETERAN_RANK_UPDATE, ChampionBar.onLevelup) - return - end +function ChampionBar.initMaxLevel() if PLAYER_PROGRESS_BAR.barTypeClasses then ChampionBar.replaceBars() ChampionBar.replaceHandlers() ChampionBar.registerEvents() ChampionBar.addLines() end +end + +function ChampionBar.initLowerLevel() + -- Show enlightenment pool in tooltip + PLAYER_PROGRESS_BAR.barTypes[PPB_CP].GetEnlightenedTooltip = ChampionBar.EPBarType.GetEnlightenedTooltip + + EVENT_MANAGER:RegisterForEvent("ChampionBar", EVENT_VETERAN_RANK_UPDATE, ChampionBar.onLevelup) +end + +function ChampionBar.init() + --Only show for max VR characters + if GetUnitLevel("player") ~= 50 or GetUnitVeteranRank("player") ~= 14 then + ChampionBar.initLowerLevel() + return + end + ChampionBar.initMaxLevel() EVENT_MANAGER:UnregisterForEvent("ChampionBar", EVENT_PLAYER_ACTIVATED) end -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 +EVENT_MANAGER:RegisterForEvent("ChampionBar", EVENT_PLAYER_ACTIVATED, function() ChampionBar.init() end) \ No newline at end of file diff --git a/ChampionBar.txt b/ChampionBar.txt index f78d361..9e70524 100644 --- a/ChampionBar.txt +++ b/ChampionBar.txt @@ -1,6 +1,6 @@ ## APIVersion: 100011 ## Title: ChampionBar -## Version: 0.9.4 +## Version: 1.0.0 ## Author: Sasky lang/en.lua diff --git a/VPMaxBar.lua b/VPMaxBar.lua index 61036dd..1c5976d 100644 --- a/VPMaxBar.lua +++ b/VPMaxBar.lua @@ -36,7 +36,7 @@ end function VPMaxBarType:Initialize() self.barGradient = ZO_CP_BAR_GRADIENT_COLORS[self:GetShownAttribute()] - self.barGlowColor = ZO_ColorDef:New(1,1,1,.3) + self.barGlowColor = ZO_CP_BAR_GRADIENT_COLORS[self:GetShownAttribute()][2] self.levelTypeText = GetString(SI_EXPERIENCE_CHAMPION_RANK_LABEL) self.tooltipCurrentMaxFormat = SI_CHAMPION_POINTS_CURRENT_MAX self.icon = self:GetIcon() diff --git a/lang/es.lua b/lang/es.lua new file mode 100644 index 0000000..848a0e9 --- /dev/null +++ b/lang/es.lua @@ -0,0 +1,23 @@ +--[[============================================================================ + This file is a part of ChampionBar + + Copyright (C) 2015 Scott Yeskie (Sasky) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + ============================================================================]] + +ZO_CreateStringId("SI_ENLIGHTENED", "Iluminado") +ZO_CreateStringId("SI_ENLIGHTENMENT", "Iluminación") +ZO_CreateStringId("SI_CHAMPION_POINTS", "Puntos de Campeón") +