Quantcast

Added a custom tag for Rehok (health:current:sl-rehok)

Repooc [11-02-16 - 20:57]
Added a custom tag for Rehok (health:current:sl-rehok)
Filename
ElvUI_SLE/modules/unitframes/unitframes.lua
diff --git a/ElvUI_SLE/modules/unitframes/unitframes.lua b/ElvUI_SLE/modules/unitframes/unitframes.lua
index 165e677..52d3009 100644
--- a/ElvUI_SLE/modules/unitframes/unitframes.lua
+++ b/ElvUI_SLE/modules/unitframes/unitframes.lua
@@ -7,6 +7,27 @@ local _G = _G
 local UnitGetTotalAbsorbs = UnitGetTotalAbsorbs

 function SUF:NewTags()
+	_G["ElvUF"].Tags.Events['health:current:sl-rehok'] = 'UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_CONNECTION PLAYER_FLAGS_CHANGED'
+	_G["ElvUF"].Tags.Methods['health:current:sl-rehok'] = function(unit)
+		local status = UnitIsDead(unit) and L["Dead"] or UnitIsGhost(unit) and L["Ghost"] or not UnitIsConnected(unit) and L["Offline"]
+		if (status) then
+			return status
+		else
+		    local curHealth = UnitHealth(unit)
+			local perHealth = (UnitHealth(unit)/UnitHealthMax(unit))*100
+		    local id = UnitIsDead("player")
+		    if curHealth >= 1e9 then
+		        return format("%.2fB", curHealth / 1e9) .. " | " .. format("%.0f", perHealth)
+		    elseif curHealth >= 1e6 then
+		        return format("%.2fM", curHealth / 1e6) .. " | " .. format("%.0f", perHealth)
+		    elseif curHealth >= 1e3 then
+		        return format("%.0fk", curHealth / 1e3) .. " | " .. format("%.0f", perHealth)
+		    else
+		        return format("%d", curHealth) .. " | " .. format("%.1f", perHealth)
+		    end
+		end
+    end
+
 	_G["ElvUF"].Tags.Methods["range:sl"] = function(unit)
 		local name, server = T.UnitName(unit)
 		local rangeText = ''