From 81e7216ada900938aa9353aec6ebf785663341bd Mon Sep 17 00:00:00 2001 From: shagu Date: Thu, 25 Apr 2019 21:28:55 +0200 Subject: [PATCH] unitframes: option that replaces name by missing health --- api/unitframes.lua | 18 ++++++++++++++++++ env/translations_deDE.lua | 2 ++ env/translations_enUS.lua | 2 ++ env/translations_esES.lua | 2 ++ env/translations_frFR.lua | 2 ++ env/translations_koKR.lua | 2 ++ env/translations_ruRU.lua | 2 ++ env/translations_zhCN.lua | 2 ++ env/translations_zhTW.lua | 2 ++ modules/gui.lua | 2 ++ 10 files changed, 36 insertions(+) diff --git a/api/unitframes.lua b/api/unitframes.lua index 58fa531a..c6782142 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -1953,6 +1953,24 @@ function pfUI.uf:GetStatusValue(unit, pos) else return unit:GetColor("health") .. pfUI.api.Abbreviate(hp) end + elseif config == "namehealth" then + local health = ceil(hp - hpmax) + if UnitIsDead(unitstr) then + return unit:GetColor("health") .. DEAD + elseif health == 0 then + return unit:GetColor("unit") .. UnitName(unitstr) + else + return unit:GetColor("health") .. pfUI.api.Abbreviate(health) + end + elseif config == "shortnamehealth" then + local health = ceil(hp - hpmax) + if UnitIsDead(unitstr) then + return unit:GetColor("health") .. DEAD + elseif health == 0 then + return unit:GetColor("unit") .. strsub(UnitName(unitstr), 0, 3) + else + return unit:GetColor("health") .. pfUI.api.Abbreviate(health) + end elseif config == "healthminmax" then return unit:GetColor("health") .. pfUI.api.Abbreviate(hp) .. "/" .. pfUI.api.Abbreviate(hpmax) diff --git a/env/translations_deDE.lua b/env/translations_deDE.lua index 34765985..79543627 100644 --- a/env/translations_deDE.lua +++ b/env/translations_deDE.lua @@ -382,9 +382,11 @@ pfUI_translation["deDE"] = { ["ms"] = nil, ["N/A"] = nil, ["Name"] = nil, + ["Name | Health Missing"] = nil, ["Nameplates"] = nil, ["Nameplate Width"] = nil, ["Name (Short)"] = nil, + ["Name (Short) | Health Missing"] = nil, ["Native"] = nil, ["Network Down"] = nil, ["Network Latency"] = nil, diff --git a/env/translations_enUS.lua b/env/translations_enUS.lua index 600fab3f..f439ff4e 100644 --- a/env/translations_enUS.lua +++ b/env/translations_enUS.lua @@ -382,9 +382,11 @@ pfUI_translation["enUS"] = { ["ms"] = nil, ["N/A"] = nil, ["Name"] = nil, + ["Name | Health Missing"] = nil, ["Nameplates"] = nil, ["Nameplate Width"] = nil, ["Name (Short)"] = nil, + ["Name (Short) | Health Missing"] = nil, ["Native"] = nil, ["Network Down"] = nil, ["Network Latency"] = nil, diff --git a/env/translations_esES.lua b/env/translations_esES.lua index c9df3a55..e84998b8 100644 --- a/env/translations_esES.lua +++ b/env/translations_esES.lua @@ -382,9 +382,11 @@ pfUI_translation["esES"] = { ["ms"] = "ms", ["N/A"] = "N/D", ["Name"] = "Nombre", + ["Name | Health Missing"] = nil, ["Nameplates"] = "Placas identificativas", ["Nameplate Width"] = "Ancho de las placas identificativas", ["Name (Short)"] = "Nombre (corto)", + ["Name (Short) | Health Missing"] = nil, ["Native"] = "Nativo", ["Network Down"] = "Velocidad de bajada", ["Network Latency"] = "Latencia de red", diff --git a/env/translations_frFR.lua b/env/translations_frFR.lua index 50734046..6f7ce112 100644 --- a/env/translations_frFR.lua +++ b/env/translations_frFR.lua @@ -382,9 +382,11 @@ pfUI_translation["frFR"] = { ["ms"] = nil, ["N/A"] = nil, ["Name"] = "Nom", + ["Name | Health Missing"] = nil, ["Nameplates"] = "Barres de vie flottantes", ["Nameplate Width"] = "Largeur des barres de vie flottantes", ["Name (Short)"] = "Nom (Court)", + ["Name (Short) | Health Missing"] = nil, ["Native"] = nil, ["Network Down"] = "Débit Descendant", ["Network Latency"] = "Latence Réseau", diff --git a/env/translations_koKR.lua b/env/translations_koKR.lua index 7845cd2c..07b126d0 100644 --- a/env/translations_koKR.lua +++ b/env/translations_koKR.lua @@ -382,9 +382,11 @@ pfUI_translation["koKR"] = { ["ms"] = "핑", ["N/A"] = nil, ["Name"] = "이름", + ["Name | Health Missing"] = nil, ["Nameplates"] = "상바", ["Nameplate Width"] = "상바 넓이", ["Name (Short)"] = nil, + ["Name (Short) | Health Missing"] = nil, ["Native"] = nil, ["Network Down"] = "네트워크 다운로드", ["Network Latency"] = "네트워크 지연 시간", diff --git a/env/translations_ruRU.lua b/env/translations_ruRU.lua index f68d58fa..afaacd64 100644 --- a/env/translations_ruRU.lua +++ b/env/translations_ruRU.lua @@ -382,9 +382,11 @@ pfUI_translation["ruRU"] = { ["ms"] = "мс", ["N/A"] = "Н/Д", ["Name"] = "Имя", + ["Name | Health Missing"] = nil, ["Nameplates"] = "Индикаторы здоровья", ["Nameplate Width"] = "Ширина индикатора здоровья", ["Name (Short)"] = "Короткое имя", + ["Name (Short) | Health Missing"] = nil, ["Native"] = "Родная", ["Network Down"] = "Сеть отдача", ["Network Latency"] = "Задержка сети", diff --git a/env/translations_zhCN.lua b/env/translations_zhCN.lua index f236d456..1ba2f59a 100644 --- a/env/translations_zhCN.lua +++ b/env/translations_zhCN.lua @@ -382,9 +382,11 @@ pfUI_translation["zhCN"] = { ["ms"] = "毫秒", ["N/A"] = "无", ["Name"] = "名字", + ["Name | Health Missing"] = nil, ["Nameplates"] = "姓名板", ["Nameplate Width"] = "姓名板宽度", ["Name (Short)"] = "名字 (短)", + ["Name (Short) | Health Missing"] = nil, ["Native"] = "本地", ["Network Down"] = "下行速率", ["Network Latency"] = "网络延迟", diff --git a/env/translations_zhTW.lua b/env/translations_zhTW.lua index b1e3937a..4d13f583 100644 --- a/env/translations_zhTW.lua +++ b/env/translations_zhTW.lua @@ -382,9 +382,11 @@ pfUI_translation["zhTW"] = { ["ms"] = "毫秒", ["N/A"] = "", ["Name"] = "名字", + ["Name | Health Missing"] = nil, ["Nameplates"] = "姓名板", ["Nameplate Width"] = "姓名板高度", ["Name (Short)"] = "名字 (短)", + ["Name (Short) | Health Missing"] = nil, ["Native"] = "本地", ["Network Down"] = "下行速率", ["Network Latency"] = "網路延遲", diff --git a/modules/gui.lua b/modules/gui.lua index 311499cc..fc3cda4b 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -962,6 +962,8 @@ pfUI:RegisterModule("gui", 20400, function () "nameshort:" .. T["Name (Short)"], "level:" .. T["Level"], "class:" .. T["Class"], + "namehealth:" .. T["Name | Health Missing"], + "shortnamehealth:" .. T["Name (Short) | Health Missing"], "healthdyn:" .. T["Health - Auto"], "health:" .. T["Health - Current"], "healthmax:" .. T["Health - Max"],