-- This file is part of CyrHUD -- -- (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/>. CyrHUD = CyrHUD or {} CyrHUD.ScoringBar = {} CyrHUD.ScoringBar.type = "ScoringBar" CyrHUD.ScoringBar.__index = CyrHUD.ScoringBar setmetatable(CyrHUD.ScoringBar, { __call = function(cls, ...) return cls.new(...) end }) local bar = CyrHUD.ScoringBar local AD = ALLIANCE_ALDMERI_DOMINION local DC = ALLIANCE_DAGGERFALL_COVENANT local EP = ALLIANCE_EBONHEART_PACT function CyrHUD.ScoringBar.new(campaign) local self = setmetatable({}, CyrHUD.ScoringBar) self.campaign = campaign or GetCurrentCampaignId() self:update() return self end function bar:update() local time = CyrHUD.formatTime(GetSecondsUntilCampaignScoreReevaluation(cID), true) self.ad_points = GetCampaignAlliancePotentialScore(self.campaign, AD) self.dc_points = GetCampaignAlliancePotentialScore(self.campaign, DC) self.ep_points = GetCampaignAlliancePotentialScore(self.campaign, EP) self.ad_pop = GetSelectionCampaignPopulationData(self.campaign, AD) self.dc_pop = GetSelectionCampaignPopulationData(self.campaign, DC) self.ep_pop = GetSelectionCampaignPopulationData(self.campaign, EP) end local TEXT_TIME = "txt4" local ICON_DC, ICON_EP, ICON_AD = "img1", "img2", "img3" local TEXT_DC, TEXT_EP, TEXT_AD = "txt1", "txt2", "txt3" function bar:configureLabel(label) d("Configuring label for status bar") label:exposeControls(3,4) label:getControl(ICON_DC):SetTexture(CyrHUD.info[DC].flag) label:getControl(ICON_EP):SetTexture(CyrHUD.info[EP].flag) label:getControl(ICON_AD):SetTexture(CyrHUD.info[AD].flag) label:positionControl(TEXT_TIME, 90, 40, 10, 5) label:positionControl(ICON_DC, 20, 40, 80, 5) label:positionControl(TEXT_DC, 50, 40, 100, 5) label:positionControl(ICON_EP, 20, 40, 150, 5) label:positionControl(TEXT_EP, 50, 40, 170, 5) label:positionControl(ICON_AD, 20, 40, 220, 5) label:positionControl(TEXT_AD, 50, 40, 240, 5) label:getControl(TEXT_DC):SetColor(CyrHUD.info[DC].color:UnpackRGBA()) label:getControl(TEXT_EP):SetColor(CyrHUD.info[EP].color:UnpackRGBA()) label:getControl(TEXT_AD):SetColor(CyrHUD.info[AD].color:UnpackRGBA()) if CyrHUD.cfg.showPopBars then label:getControl(ICON_DC):SetColor(CyrHUD.info[DC].color:UnpackRGBA()) label:getControl(ICON_EP):SetColor(CyrHUD.info[EP].color:UnpackRGBA()) label:getControl(ICON_AD):SetColor(CyrHUD.info[AD].color:UnpackRGBA()) end end function bar:updateLabel(label) local pre = "+" local time = GetSecondsUntilCampaignScoreReevaluation(self.campaign) label:getControl(TEXT_TIME):SetText(CyrHUD.formatTime(time, true)) label:getControl(TEXT_DC):SetText(pre .. self.dc_points) label:getControl(TEXT_EP):SetText(pre .. self.ep_points) label:getControl(TEXT_AD):SetText(pre .. self.ad_points) end