From b63f076d005a1660b6546a0b99ae8822c99c478a Mon Sep 17 00:00:00 2001 From: d87 Date: Thu, 8 Oct 2020 19:41:14 +0700 Subject: [PATCH] Customizable Health Text --- Aptechka.lua | 4 ++-- Options/StatusConfig.lua | 6 ++++++ config.lua | 4 ++-- frame.lua | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Aptechka.lua b/Aptechka.lua index e69f431..334dcab 100644 --- a/Aptechka.lua +++ b/Aptechka.lua @@ -969,7 +969,7 @@ function Aptechka.FrameUpdateHealth(self, unit, event) if gradientHealthColor then FrameSetJob(self, config.HealthBarColor, true, "HealthBar", h) end - FrameSetJob(self, config.HealthDeficitStatus, ((hm-h) > hm*0.05), nil, h, hm ) + FrameSetJob(self, config.HealthTextStatus, ((hm-h) > hm*0.05), nil, h, hm ) local isDead = UnitIsDeadOrGhost(unit) if isDead then @@ -977,7 +977,7 @@ function Aptechka.FrameUpdateHealth(self, unit, event) local isGhost = UnitIsGhost(unit) local deadorghost = isGhost and config.GhostStatus or config.DeadStatus FrameSetJob(self, deadorghost, true) - FrameSetJob(self,config.HealthDeficitStatus, false ) + FrameSetJob(self,config.HealthTextStatus, false ) state.isDead = true state.isGhost = isGhost Aptechka.FrameUpdateDisplayPower(self, unit, true) diff --git a/Options/StatusConfig.lua b/Options/StatusConfig.lua index fede2f4..1e8ebfd 100644 --- a/Options/StatusConfig.lua +++ b/Options/StatusConfig.lua @@ -3,6 +3,8 @@ local addonName, ns = ... local L = Aptechka.L +local isClassic = WOW_PROJECT_ID == WOW_PROJECT_CLASSIC + function ns.MakeStatusConfig() local opt = { type = 'group', @@ -18,6 +20,7 @@ function ns.MakeStatusConfig() "MouseoverStatus", "MainTankStatus", "DispelStatus", + "HealthTextStatus", "RunicPowerStatus", "AltPowerStatus", "DebuffAlert1", @@ -25,6 +28,9 @@ function ns.MakeStatusConfig() "DebuffAlert3", "DebuffAlert4", } + if isClassic then + table.insert(configurableWidgets, "IncomingHealStatus") + end for i, status in ipairs(configurableWidgets) do opt.args[status] = { diff --git a/config.lua b/config.lua index 689cd38..be32add 100644 --- a/config.lua +++ b/config.lua @@ -54,8 +54,8 @@ config.DeadStatus = { name = "Dead", assignto = set("text2","health"), color = { config.GhostStatus = { name = "Ghost", assignto = set("text2","health"), color = {.05,.05,.05}, textcolor = {0,1,0}, text = "GHOST", priority = 62} config.OfflineStatus = { name = "Offline", assignto = set("text2","text3","health"), color = {.15,.15,.15}, textcolor = {0,1,0}, text = "OFFLINE", priority = 70} config.AwayStatus = { name = "AFK", assignto = set("text2","text3"), color = {.15,.15,.15}, textcolor = {1,0.8,0}, text = "AFK", priority = 15} --- config.IncomingHealStatus = { name = "IncomingHeal", assignto = set("text2"), color = { 0, 1, 0}, priority = 15 } -config.HealthDeficitStatus = { name = "HealthDeficit", assignto = set("text2"), color = { 54/255, 201/255, 99/256 }, priority = 10 } +config.IncomingHealStatus = { name = "IncHealText", assignto = set("text2"), color = { 0, 1, 0}, priority = 15 } +config.HealthTextStatus = { name = "HealthText", assignto = set("text2"), color = { 54/255, 201/255, 99/256 }, priority = 10 } config.UnitNameStatus = { name = "UnitName", assignto = set("text1"), classcolor = true, priority = 20 } config.HealthBarColor = { name = "HealthBar", assignto = set("health"), color = {1, .3, .3}, classcolor = true, priority = 10 } config.PowerBarColor = { name = "PowerBar", assignto = set("power"), color = {.5,.5,1}, priority = 20 } diff --git a/frame.lua b/frame.lua index 4719a53..6847f7d 100644 --- a/frame.lua +++ b/frame.lua @@ -201,7 +201,7 @@ local function formatMissingHealth(mh) end local contentNormalizers = {} -function contentNormalizers.HealthDeficit(job, state, contentType, ...) +function contentNormalizers.HealthText(job, state, contentType, ...) local timerType, cur, max, count, icon, text, r,g,b, texture, texCoords cur, max = ... text = string.format(formatMissingHealth(max - cur))