Commit 3a0f54ab authored by Blazeflack's avatar Blazeflack

Added new tag to collection "deficit:name:colors"

It will display deficit health with healthcolor, and show name at full health with namecolor.
parent 590caee6
......@@ -21,6 +21,8 @@ local UnitPowerType = UnitPowerType
local UnitPower = UnitPower
local UnitPowerMax = UnitPowerMax
--GLOBALS: _TAGS
local textFormatStyles = {
["CURRENT"] = "%.1f",
["CURRENT_MAX"] = "%.1f - %.1f",
......@@ -116,7 +118,7 @@ ElvUF.Tags.Methods["health:percent:hidefull"] = function(unit)
return String
end
ElvUF.Tags.Events["health:current:hidefull"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_CONNECTION"
ElvUF.Tags.Events["health:current:hidefull"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH"
ElvUF.Tags.Methods["health:current:hidefull"] = function(unit)
local min, max = UnitHealth(unit), UnitHealthMax(unit)
local deficit = max - min
......@@ -131,7 +133,7 @@ ElvUF.Tags.Methods["health:current:hidefull"] = function(unit)
return String
end
ElvUF.Tags.Events["health:current-percent:hidefull"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_CONNECTION"
ElvUF.Tags.Events["health:current-percent:hidefull"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH"
ElvUF.Tags.Methods["health:current-percent:hidefull"] = function(unit)
local min, max = UnitHealth(unit), UnitHealthMax(unit)
local deficit = max - min
......@@ -191,5 +193,22 @@ ElvUF.Tags.Methods["power:current-percent:hidefull"] = function(unit)
String = GetFormattedText(min, max, "CURRENT_PERCENT", true)
end
return String
end
ElvUF.Tags.Events["deficit:name:colors"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_NAME_UPDATE"
ElvUF.Tags.Methods["deficit:name:colors"] = function(unit)
local missinghp = _TAGS['missinghp'](unit)
local String
if missinghp then
local healthcolor = _TAGS['healthcolor'](unit)
String = format("%s-%s|r", healthcolor, missinghp)
else
local name = _TAGS['name'](unit)
local namecolor = _TAGS['namecolor'](unit)
String = format("%s%s|r", namecolor, name)
end
return String
end
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment