Fix Charged combo points feature flag

This commit is contained in:
Parnic
2022-09-18 22:35:19 -05:00
parent 0af47119e3
commit 9fc90551e2
2 changed files with 30 additions and 39 deletions

View File

@ -13,13 +13,6 @@ if Enum and Enum.PowerType then
SPELL_POWER_COMBO_POINTS = Enum.PowerType.ComboPoints SPELL_POWER_COMBO_POINTS = Enum.PowerType.ComboPoints
end end
local GetUnitChargedPowerPoints = GetUnitChargedPowerPoints
if not GetUnitChargedPowerPoints then
GetUnitChargedPowerPoints = function()
return nil
end
end
-- Constructor -- -- Constructor --
function ComboPoints.prototype:init() function ComboPoints.prototype:init()
ComboPoints.super.prototype.init(self, "ComboPoints") ComboPoints.super.prototype.init(self, "ComboPoints")
@ -229,7 +222,6 @@ function ComboPoints.prototype:GetOptions()
order = 35 order = 35
} }
if GetUnitChargedPowerPoints then
opts["bShowAnimaCharged"] = { opts["bShowAnimaCharged"] = {
type = 'toggle', type = 'toggle',
width = 'double', width = 'double',
@ -245,9 +237,11 @@ function ComboPoints.prototype:GetOptions()
disabled = function() disabled = function()
return not self.moduleSettings.enabled return not self.moduleSettings.enabled
end, end,
hidden = function()
return not GetUnitChargedPowerPoints
end,
order = 36 order = 36
} }
end
return opts return opts
end end
@ -330,9 +324,11 @@ function ComboPoints.prototype:UpdateMaxComboPoints(event, unit, powerType)
end end
function ComboPoints.prototype:UpdateChargedComboPoints() function ComboPoints.prototype:UpdateChargedComboPoints()
if GetUnitChargedPowerPoints then
self.chargedPowerPoints = GetUnitChargedPowerPoints("player") self.chargedPowerPoints = GetUnitChargedPowerPoints("player")
self:CreateComboFrame() self:CreateComboFrame()
self:UpdateComboPoints() self:UpdateComboPoints()
end
end end
-- 'Protected' methods -------------------------------------------------------- -- 'Protected' methods --------------------------------------------------------

View File

@ -6,13 +6,6 @@ if Enum and Enum.PowerType then
SPELL_POWER_COMBO_POINTS = Enum.PowerType.ComboPoints SPELL_POWER_COMBO_POINTS = Enum.PowerType.ComboPoints
end end
local GetUnitChargedPowerPoints = GetUnitChargedPowerPoints
if not GetUnitChargedPowerPoints then
GetUnitChargedPowerPoints = function()
return nil
end
end
function ComboPointsBar.prototype:init() function ComboPointsBar.prototype:init()
ComboPointsBar.super.prototype.init(self, "ComboPointsBar") ComboPointsBar.super.prototype.init(self, "ComboPointsBar")
@ -98,9 +91,11 @@ function ComboPointsBar.prototype:Enable(core)
end end
function ComboPointsBar.prototype:UpdateChargedComboPoints() function ComboPointsBar.prototype:UpdateChargedComboPoints()
if GetUnitChargedPowerPoints then
local chargedPowerPoints = GetUnitChargedPowerPoints("player") local chargedPowerPoints = GetUnitChargedPowerPoints("player")
self.chargedPowerPointIndex = chargedPowerPoints and chargedPowerPoints[1] self.chargedPowerPointIndex = chargedPowerPoints and chargedPowerPoints[1]
self:UpdateComboPoints() self:UpdateComboPoints()
end
end end
function ComboPointsBar.prototype:CreateFrame() function ComboPointsBar.prototype:CreateFrame()