prediction: add option to hide/set overheal amount

This commit is contained in:
shagu
2019-05-19 10:45:27 +02:00
parent 4384334636
commit bc36fa74d4
3 changed files with 31 additions and 7 deletions
+11
View File
@@ -261,6 +261,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "player", "energycolor", "1,1,.5,1")
pfUI:UpdateConfig("unitframes", "player", "ragecolor", "1,.5,.5,1")
pfUI:UpdateConfig("unitframes", "player", "focuscolor", "1,1,.75,1")
pfUI:UpdateConfig("unitframes", "player", "overhealperc", "20")
pfUI:UpdateConfig("unitframes", "target", "visible", "1")
pfUI:UpdateConfig("unitframes", "target", "showPVP", "0")
@@ -319,6 +320,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "target", "energycolor", "1,1,.5,1")
pfUI:UpdateConfig("unitframes", "target", "ragecolor", "1,.5,.5,1")
pfUI:UpdateConfig("unitframes", "target", "focuscolor", "1,1,.75,1")
pfUI:UpdateConfig("unitframes", "target", "overhealperc", "20")
pfUI:UpdateConfig("unitframes", "focus", "visible", "1")
pfUI:UpdateConfig("unitframes", "focus", "showPVP", "0")
@@ -376,6 +378,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "focus", "energycolor", "1,1,.5,1")
pfUI:UpdateConfig("unitframes", "focus", "ragecolor", "1,.5,.5,1")
pfUI:UpdateConfig("unitframes", "focus", "focuscolor", "1,1,.75,1")
pfUI:UpdateConfig("unitframes", "focus", "overhealperc", "20")
pfUI:UpdateConfig("unitframes", "group", "visible", "1")
pfUI:UpdateConfig("unitframes", "group", "showPVP", "0")
@@ -434,6 +437,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "group", "energycolor", "1,1,.5,1")
pfUI:UpdateConfig("unitframes", "group", "ragecolor", "1,.5,.5,1")
pfUI:UpdateConfig("unitframes", "group", "focuscolor", "1,1,.75,1")
pfUI:UpdateConfig("unitframes", "group", "overhealperc", "20")
pfUI:UpdateConfig("unitframes", "grouptarget", "visible", "1")
pfUI:UpdateConfig("unitframes", "grouptarget", "showPVP", "0")
@@ -491,6 +495,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "grouptarget", "energycolor", "1,1,.5,1")
pfUI:UpdateConfig("unitframes", "grouptarget", "ragecolor", "1,.5,.5,1")
pfUI:UpdateConfig("unitframes", "grouptarget", "focuscolor", "1,1,.75,1")
pfUI:UpdateConfig("unitframes", "grouptarget", "overhealperc", "20")
pfUI:UpdateConfig("unitframes", "grouppet", "visible", "1")
pfUI:UpdateConfig("unitframes", "grouppet", "showPVP", "0")
@@ -548,6 +553,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "grouppet", "energycolor", "1,1,.5,1")
pfUI:UpdateConfig("unitframes", "grouppet", "ragecolor", "1,.5,.5,1")
pfUI:UpdateConfig("unitframes", "grouppet", "focuscolor", "1,1,.75,1")
pfUI:UpdateConfig("unitframes", "grouppet", "overhealperc", "20")
pfUI:UpdateConfig("unitframes", "raid", "visible", "1")
pfUI:UpdateConfig("unitframes", "raid", "showPVP", "0")
@@ -605,6 +611,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "raid", "energycolor", "1,1,.5,1")
pfUI:UpdateConfig("unitframes", "raid", "ragecolor", "1,.5,.5,1")
pfUI:UpdateConfig("unitframes", "raid", "focuscolor", "1,1,.75,1")
pfUI:UpdateConfig("unitframes", "raid", "overhealperc", "10")
pfUI:UpdateConfig("unitframes", "ttarget", "visible", "1")
pfUI:UpdateConfig("unitframes", "ttarget", "showPVP", "0")
@@ -662,6 +669,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "ttarget", "energycolor", "1,1,.5,1")
pfUI:UpdateConfig("unitframes", "ttarget", "ragecolor", "1,.5,.5,1")
pfUI:UpdateConfig("unitframes", "ttarget", "focuscolor", "1,1,.75,1")
pfUI:UpdateConfig("unitframes", "ttarget", "overhealperc", "10")
pfUI:UpdateConfig("unitframes", "pet", "visible", "1")
pfUI:UpdateConfig("unitframes", "pet", "showPVP", "0")
@@ -719,6 +727,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "pet", "energycolor", "1,1,.5,1")
pfUI:UpdateConfig("unitframes", "pet", "ragecolor", "1,.5,.5,1")
pfUI:UpdateConfig("unitframes", "pet", "focuscolor", "1,1,.75,1")
pfUI:UpdateConfig("unitframes", "pet", "overhealperc", "20")
pfUI:UpdateConfig("unitframes", "ptarget", "visible", "0")
pfUI:UpdateConfig("unitframes", "ptarget", "showPVP", "0")
@@ -776,6 +785,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "ptarget", "energycolor", "1,1,.5,1")
pfUI:UpdateConfig("unitframes", "ptarget", "ragecolor", "1,.5,.5,1")
pfUI:UpdateConfig("unitframes", "ptarget", "focuscolor", "1,1,.75,1")
pfUI:UpdateConfig("unitframes", "ptarget", "overhealperc", "10")
pfUI:UpdateConfig("unitframes", "fallback", "visible", "1")
pfUI:UpdateConfig("unitframes", "fallback", "showPVP", "0")
@@ -833,6 +843,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "fallback", "energycolor", "1,1,.5,1")
pfUI:UpdateConfig("unitframes", "fallback", "ragecolor", "1,.5,.5,1")
pfUI:UpdateConfig("unitframes", "fallback", "focuscolor", "1,1,.75,1")
pfUI:UpdateConfig("unitframes", "fallback", "overhealperc", "10")
pfUI:UpdateConfig("bars", "bar1", "pageable", "1")
pfUI:UpdateConfig("bars", "bar2", "pageable", "1")
+14
View File
@@ -946,6 +946,19 @@ pfUI:RegisterModule("gui", 20400, function ()
".75:75%",
".90:90%",
},
["uf_overheal"] = {
"0:0%",
"10:10%",
"20:20%",
"30:30%",
"40:40%",
"50:50%",
"60:60%",
"70:70%",
"80:80%",
"90:90%",
"100:100%",
},
["uf_layout"] = {
"default:" .. T["Default"],
"tukui:TukUI"
@@ -1522,6 +1535,7 @@ pfUI:RegisterModule("gui", 20400, function ()
CreateConfig(U[c], T["Show Raid Mark"], C.unitframes[c], "raidicon", "checkbox")
CreateConfig(U[c], T["Raid Mark Size"], C.unitframes[c], "raidiconsize")
CreateConfig(U[c], T["Show Class Buff Indicators"], C.unitframes[c], "buff_indicator", "checkbox")
CreateConfig(U[c], T["Display Overheal"], C.unitframes[c], "overhealperc", "dropdown", pfUI.gui.dropdowns.uf_overheal)
CreateConfig(U[c], T["Healthbar"], nil, nil, "header")
CreateConfig(U[c], T["Health Bar Width"], C.unitframes[c], "width")
+6 -7
View File
@@ -170,25 +170,24 @@ pfUI:RegisterModule("prediction", function ()
end
function pfUI.prediction:UpdateUnitFrames(name, heal, ress)
OVERHEALPERCENT = OVERHEALPERCENT or 20
for id, frame in pairs(_G.pfUI.uf.frames) do
if frame:IsVisible() and frame.label and frame.id then
local overhealperc = tonumber(frame.config.overhealperc)
local unit = frame.label .. frame.id
local health, maxHealth = UnitHealth(unit), UnitHealthMax(unit)
if UnitName(unit) == name then
if ress and UnitIsDeadOrGhost(unit) then
frame.ressIcon:Show()
elseif heal and heal > 0 and (health < maxHealth or OVERHEALPERCENT > 0 ) then
elseif heal and heal > 0 and (health < maxHealth or overhealperc > 0 ) then
local width = frame.config.width
local height = frame.config.height
if frame.config.verticalbar == "0" then
local healthWidth = width * (health / maxHealth)
local incWidth = width * heal / maxHealth
if healthWidth + incWidth > width * (1+(OVERHEALPERCENT/100)) then
incWidth = width * (1+OVERHEALPERCENT/100) - healthWidth
if healthWidth + incWidth > width * (1+(overhealperc/100)) then
incWidth = width * (1+overhealperc/100) - healthWidth
end
if frame.config.invert_healthbar == "1" then
@@ -199,8 +198,8 @@ pfUI:RegisterModule("prediction", function ()
else
local healthHeight = height * (health / maxHealth)
local incHeight = height * heal / maxHealth
if healthHeight + incHeight > height * (1+(OVERHEALPERCENT/100)) then
incHeight = height * (1+OVERHEALPERCENT/100) - healthHeight
if healthHeight + incHeight > height * (1+(overhealperc/100)) then
incHeight = height * (1+overhealperc/100) - healthHeight
end
if frame.config.invert_healthbar == "1" then