Quantcast

Merge branch 'master' of git.tukui.org:repooc/elvui-shadowandlight

Repooc [11-08-14 - 22:03]
Merge branch 'master' of git.tukui.org:repooc/elvui-shadowandlight
Filename
ElvUI_SLE/modules/unitframes.lua
diff --git a/ElvUI_SLE/modules/unitframes.lua b/ElvUI_SLE/modules/unitframes.lua
index 7a59554..fd0281b 100644
--- a/ElvUI_SLE/modules/unitframes.lua
+++ b/ElvUI_SLE/modules/unitframes.lua
@@ -9,9 +9,10 @@ local format = format
 local styles = {
 	['CURRENT'] = '%s',
 	['CURRENT_MAX'] = '%s - %s',
-	['CURRENT_PERCENT'] =  '%s - %s%%',
+	['CURRENT_PERCENT'] =  '%s | %s%%',
 	['CURRENT_MAX_PERCENT'] = '%s - %s | %s%%',
-	['DEFICIT'] = '-%s'
+	['DEFICIT'] = '-%s',
+	['DARTH_HEAL'] = '-%s / %s | %s%%',
 }

 local function GetFormattedTextSLE(style, min, max)
@@ -31,13 +32,21 @@ local function GetFormattedTextSLE(style, min, max)
 			return format(useStyle, deficit)
 		end
 	elseif style == 'CURRENT' or ((style == 'CURRENT_MAX' or style == 'CURRENT_MAX_PERCENT' or style == 'CURRENT_PERCENT') and min == max) then
-			return format(styles['CURRENT'], min)
+		return format(styles['CURRENT'], min)
 	elseif style == 'CURRENT_MAX' then
-			return format(useStyle, min, max)
+		return format(useStyle, min, max)
 	elseif style == 'CURRENT_PERCENT' then
-			return format(useStyle, min, format("%.1f", min / max * 100))
+		return format(useStyle, min, format("%.1f", min / max * 100))
 	elseif style == 'CURRENT_MAX_PERCENT' then
-			return format(useStyle, min, max, format("%.1f", min / max * 100))
+		return format(useStyle, min, max, format("%.1f", min / max * 100))
+	elseif style == "DARTH_HEAL" then
+		local deficit = max - min
+		if deficit <= 0 then
+			return format(styles["CURRENT_PERCENT"], min, format("%.1f", min / max * 100))
+		else
+			return format(useStyle, deficit, min, format("%.1f", min / max * 100))
+		end
+
 	end
 end

@@ -143,6 +152,18 @@ local function AddTags()
 			return GetFormattedTextSLE('CURRENT_MAX_PERCENT', min, max)
 		end
 	end
+
+	ElvUF.Tags.Events['health:sl:darth-heal'] = 'UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_CONNECTION'
+	ElvUF.Tags.Methods['health:sl:darth-heal'] = function(unit)
+		local min, max = UnitHealth(unit), UnitHealthMax(unit)
+		local status = not UnitIsConnected(unit) and L['Offline'] or UnitIsGhost(unit) and L['Ghost'] or UnitIsDead(unit) and DEAD
+
+		if (status) then
+			return status
+		else
+			return GetFormattedTextSLE('DARTH_HEAL', min, max)
+		end
+	end

 	ElvUF.Tags.Events['power:current:sl'] = 'UNIT_POWER_FREQUENT UNIT_MAXPOWER'
 	ElvUF.Tags.Methods['power:current:sl'] = function(unit)