option to invert raidframes and show missing hp

This commit is contained in:
shagu
2016-10-19 22:24:26 +02:00
parent 55db423606
commit 36bc7248bd
4 changed files with 30 additions and 2 deletions
+2
View File
@@ -15,6 +15,8 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "target", "width", "200")
pfUI:UpdateConfig("unitframes", "target", "height", "50")
pfUI:UpdateConfig("unitframes", "target", "pheight", "10")
pfUI:UpdateConfig("unitframes", "raid", "invert_healthbar", "0")
pfUI:UpdateConfig("unitframes", "raid", "show_missing", "0")
pfUI:UpdateConfig("unitframes", "raid", "clickcast", "")
pfUI:UpdateConfig("unitframes", "raid", "clickcast_shift", "")
pfUI:UpdateConfig("unitframes", "raid", "clickcast_alt", "")
+2
View File
@@ -516,6 +516,8 @@ pfUI:RegisterModule("gui", function ()
pfUI.gui:CreateConfig(pfUI.gui.uf, "Target width", pfUI_config.unitframes.target, "width")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Target height", pfUI_config.unitframes.target, "height")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Target powerbar height", pfUI_config.unitframes.target, "pheight")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Invert Raid-healthbar", pfUI_config.unitframes.raid, "invert_healthbar", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Show missing HP on raidframes", pfUI_config.unitframes.raid, "show_missing", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Click-cast on Raidframe", pfUI_config.unitframes.raid, "clickcast")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Click-cast on Raidframe (Shift)", pfUI_config.unitframes.raid, "clickcast_shift")
pfUI.gui:CreateConfig(pfUI.gui.uf, "Click-cast on Raidframe (Alt)", pfUI_config.unitframes.raid, "clickcast_alt")
+15 -1
View File
@@ -54,7 +54,9 @@ pfUI:RegisterModule("raid", function ()
pfUI.uf.raid[i].hp.bar:SetPoint("BOTTOMRIGHT", pfUI.uf.raid[i].hp, "BOTTOMRIGHT", -3, 3)
pfUI.uf.raid[i].hp.bar:SetStatusBarColor(0,1,0)
pfUI.uf.raid[i].hp.bar:SetMinMaxValues(0, 100)
pfUI.uf.raid[i].hp.bar:SetValue(0)
pfUI.uf.raid[i].power = CreateFrame("Frame",nil, pfUI.uf.raid[i])
pfUI.uf.raid[i].power:SetBackdrop(pfUI.backdrop)
@@ -191,6 +193,12 @@ pfUI:RegisterModule("raid", function ()
local hpReal = UnitHealth("raid"..this.id)
local hpDiff = abs(hpReal - hpDisplay)
if pfUI_config.unitframes.raid.invert_healthbar == "1" then
hpDisplay = this.hp.bar:GetValue()
hpReal = UnitHealthMax("raid"..this.id) - UnitHealth("raid"..this.id)
hpDiff = abs(hpReal - hpDisplay)
end
if hpDisplay < hpReal then
this.hp.bar:SetValue(hpDisplay + ceil(hpDiff / pfUI_config.unitframes.animation_speed))
elseif hpDisplay > hpReal then
@@ -224,7 +232,13 @@ pfUI:RegisterModule("raid", function ()
this.power.bar:SetValue(0)
end
if UnitName("raid"..this.id) then
this.caption:SetText(UnitName("raid"..this.id))
if UnitHealthMax("raid"..this.id) ~= UnitHealth("raid"..this.id) and pfUI_config.unitframes.raid.show_missing == "1" then
this.caption:SetText("-" .. UnitHealthMax("raid"..this.id) - UnitHealth("raid"..this.id))
this.caption:SetTextColor(1,.3,.3)
else
this.caption:SetText(UnitName("raid"..this.id))
this.caption:SetTextColor(1,1,1)
end
this.caption:SetAllPoints(this.hp.bar)
end
end)
+11 -1
View File
@@ -243,6 +243,10 @@ pfUI:RegisterModule("thirdparty", function ()
local healed = HealComm:getHeal(UnitName(unit))
local health, maxHealth = UnitHealth(unit), UnitHealthMax(unit)
if strsub(unit,0,4) == "raid" and pfUI_config.unitframes.raid.invert_healthbar == "1" then
health = maxHealth - health
end
if( healed > 0 and (health < maxHealth or OVERHEALPERCENT > 0 )) and frame:IsVisible() then
frame.incHeal:Show()
local healthWidth = frame:GetWidth() * (health / maxHealth)
@@ -252,7 +256,13 @@ pfUI:RegisterModule("thirdparty", function ()
end
frame.incHeal:SetWidth(incWidth)
frame.incHeal:ClearAllPoints()
frame.incHeal:SetPoint("TOPLEFT", frame, "TOPLEFT", healthWidth-3, -3)
if strsub(unit,0,4) == "raid" and pfUI_config.unitframes.raid.invert_healthbar == "1" then
frame.incHeal:SetPoint("TOPLEFT", frame, "TOPLEFT", 3, -3)
frame.incHeal:SetFrameStrata("HIGH")
else
frame.incHeal:SetPoint("TOPLEFT", frame, "TOPLEFT", healthWidth-3, -3)
end
else
frame.incHeal:Hide()
end