From 08e6eecc9f642084ea6e36141ced3d81f69ec457 Mon Sep 17 00:00:00 2001 From: Repooc Date: Wed, 2 Nov 2016 16:57:39 -0400 Subject: [PATCH] Added a custom tag for Rehok (health:current:sl-rehok) --- ElvUI_SLE/modules/unitframes/unitframes.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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 = '' -- 1.7.9.5