Add support for Anima-charged combo points

Requested by Curseforge ticket 291
This commit is contained in:
Parnic
2020-11-28 20:37:12 -06:00
parent d44e62bee4
commit 06353d4974
3 changed files with 50 additions and 2 deletions

View File

@ -1,5 +1,9 @@
# Changelog
vNext:
- Added support for Anima-charged combo points for Kyrian covenant (ticket #291).
v1.13.0:
- Made compatible with 9.0

View File

@ -12,12 +12,20 @@ if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then
SPELL_POWER_COMBO_POINTS = Enum.PowerType.ComboPoints
end
local GetUnitChargedPowerPoints = GetUnitChargedPowerPoints
if not GetUnitChargedPowerPoints then
GetUnitChargedPowerPoints = function()
return nil
end
end
-- Constructor --
function ComboPoints.prototype:init()
ComboPoints.super.prototype.init(self, "ComboPoints")
self:SetDefaultColor("ComboPoints", 1, 1, 0)
self:SetDefaultColor("AnticipationPoints", 1, 0, 1)
self:SetDefaultColor("KyrianAnimaComboPoint", 0.3137254901960784, 0.3725490196078432, 1)
self.scalingEnabled = true
end
@ -274,11 +282,16 @@ function ComboPoints.prototype:Enable(core)
self:RegisterEvent("PLAYER_COMBO_POINTS", "UpdateComboPoints")
end
if IceHUD.WowVer >= 90000 then
self:RegisterEvent("UNIT_POWER_POINT_CHARGE", "UpdateChargedComboPoints")
end
if self.moduleSettings.comboMode == "Graphical" then
self.moduleSettings.comboMode = "Graphical Bar"
end
self:CreateComboFrame(true)
self:UpdateChargedComboPoints()
end
function ComboPoints.prototype:UpdateMaxComboPoints(event, unit, powerType)
@ -291,6 +304,13 @@ function ComboPoints.prototype:UpdateMaxComboPoints(event, unit, powerType)
end
end
function ComboPoints.prototype:UpdateChargedComboPoints()
local chargedPowerPoints = GetUnitChargedPowerPoints("player")
self.chargedPowerPointIndex = chargedPowerPoints and chargedPowerPoints[1]
self:CreateComboFrame()
self:UpdateComboPoints()
end
-- 'Protected' methods --------------------------------------------------------
-- OVERRIDE
@ -399,7 +419,12 @@ function ComboPoints.prototype:CreateComboFrame(forceTextureUpdate)
if (self.moduleSettings.gradient) then
g = g - ((1 / maxComboPoints)*i)
end
self.frame.graphical[i].texture:SetVertexColor(r, g, b)
if i == self.chargedPowerPointIndex then
self.frame.graphical[i].texture:SetVertexColor(self:GetColor("KyrianAnimaComboPoint"))
else
self.frame.graphical[i].texture:SetVertexColor(r, g, b)
end
self.frame.graphical[i]:Hide()
end

View File

@ -6,6 +6,13 @@ if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then
SPELL_POWER_COMBO_POINTS = Enum.PowerType.ComboPoints
end
local GetUnitChargedPowerPoints = GetUnitChargedPowerPoints
if not GetUnitChargedPowerPoints then
GetUnitChargedPowerPoints = function()
return nil
end
end
function ComboPointsBar.prototype:init()
ComboPointsBar.super.prototype.init(self, "ComboPointsBar")
@ -57,7 +64,6 @@ end
function ComboPointsBar.prototype:GetDefaultSettings()
local defaults = ComboPointsBar.super.prototype.GetDefaultSettings(self)
defaults.textVisible['lower'] = false
defaults.offset = 8
defaults.enabled = false
defaults.alwaysDisplay = false
@ -83,6 +89,18 @@ function ComboPointsBar.prototype:Enable(core)
else
self:RegisterEvent("PLAYER_COMBO_POINTS", "UpdateComboPoints")
end
if IceHUD.WowVer >= 90000 then
self:RegisterEvent("UNIT_POWER_POINT_CHARGE", "UpdateChargedComboPoints")
end
self:UpdateChargedComboPoints()
end
function ComboPointsBar.prototype:UpdateChargedComboPoints()
local chargedPowerPoints = GetUnitChargedPowerPoints("player")
self.chargedPowerPointIndex = chargedPowerPoints and chargedPowerPoints[1]
self:UpdateComboPoints()
end
function ComboPointsBar.prototype:CreateFrame()
@ -129,6 +147,7 @@ function ComboPointsBar.prototype:UpdateComboPoints(...)
end
self:SetBottomText1(points or "0")
self:SetBottomText2(self.chargedPowerPointIndex)
end
function ComboPointsBar.prototype:Update()