Skip to content

Commit

Permalink
Added AlternatePowerStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
d87 committed Sep 12, 2020
1 parent d4ffb75 commit 42489e7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
17 changes: 15 additions & 2 deletions Aptechka.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,9 @@ end
function Aptechka.UNIT_CONNECTION(self, event, unit)
Aptechka:ForEachUnitFrame(unit, Aptechka.FrameUpdateConnection)
end

local Enum_RunicPower = Enum.PowerType.RunicPower
local Enum_Alternate = Enum.PowerType.Alternate
function Aptechka.FrameUpdatePower(frame, unit, ptype)
if ptype == "MANA" then-- not frame.power.disabled then
local powerMax = UnitPowerMax(unit)
Expand All @@ -1157,14 +1160,23 @@ function Aptechka.FrameUpdatePower(frame, unit, ptype)
if not Aptechka:UnitIsTank(unit) then
return FrameSetJob(frame, config.RunicPowerStatus, false)
end
local powerMax = UnitPowerMax(unit)
local power = UnitPower(unit)
local powerMax = UnitPowerMax(unit, Enum_RunicPower)
local power = UnitPower(unit, Enum_RunicPower)
if power > 40 then
local p = power/powerMax
FrameSetJob(frame, config.RunicPowerStatus, true, "PROGRESS", p)
else
FrameSetJob(frame, config.RunicPowerStatus, false)
end
elseif ptype == "ALTERNATE" then
local powerMax = UnitPowerMax(unit, Enum_Alternate)
local power = UnitPower(unit, Enum_Alternate)
if power > 0 then
local p = power/powerMax
FrameSetJob(frame, config.AlternatePowerStatus, true, "PROGRESS", p)
else
FrameSetJob(frame, config.AlternatePowerStatus, false)
end
end
end
function Aptechka.UNIT_POWER_UPDATE(self, event, unit, ptype)
Expand Down Expand Up @@ -1718,6 +1730,7 @@ local function updateUnitButton(self, unit)
Aptechka.FrameUpdateDisplayPower(self, unit)
local ptype = select(2,UnitPowerType(owner))
Aptechka.FrameUpdatePower(self, unit, ptype)
Aptechka.FrameUpdatePower(self, unit, "ALTERNATE")
end
Aptechka.FrameUpdateThreat(self, unit)
Aptechka.FrameUpdateMindControl(self, unit)
Expand Down
1 change: 1 addition & 0 deletions Options/StatusConfig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function ns.MakeStatusConfig()
"MainTankStatus",
"DispelStatus",
"RunicPowerStatus",
"AlternatePowerStatus",
}

for i, status in ipairs(configurableWidgets) do
Expand Down
1 change: 1 addition & 0 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ config.LOSStatus = { name = "OutOfSight", assignto = set("healfeedback"), scale
config.DispelStatus = { name = "Dispel", assignto = set("raidbuff"), scale = 2, hscale = 2, spin = true, priority = 86 }
config.StaggerStatus = { name = "Stagger", assignto = set("text2"), priority = 20 }
config.RunicPowerStatus = { name = "RunicPower", assignto = set("mitigation"), priority = 10, color = { 0, 0.82, 1 } }
config.AlternatePowerStatus = { name = "AlternatePower", assignto = set("mitigation"), priority = 30, color = { 0.8, 0, 0.3 } }

config.SummonPending = { name = "SUMMON_PENDING", set("text2"), color = {1,0.7,0}, text = "PENDING", priority = 50 }
config.SummonAccepted = { name = "SUMMON_ACCEPTED", set("text2"), color = {0,1,0}, text = "ACCEPTED", priority = 51 }
Expand Down
6 changes: 6 additions & 0 deletions frame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1741,6 +1741,12 @@ local TextTypeHandlers = {
self.text:SetTextColor(helpers.PercentColor(stagger))
self.text:SetFormattedText("%.0f%%", stagger*100)
end,
["PROGRESS"] = function(self, job, state, contentType, ...)
local perc = ...
self.text:SetTextColor(helpers.PercentColor(perc))
-- self.text:SetTextColor(GetTextColor(job))
self.text:SetFormattedText("%.0f%%", perc*100)
end,
["UnitName"] = function(self, job, state, contentType, ...)
self.text:SetText(state.name)
self:SetScript("OnUpdate", nil)
Expand Down

0 comments on commit 42489e7

Please sign in to comment.