Quantcast

Added range tag [range:sl]

Repooc [03-16-14 - 07:22]
Added range tag [range:sl]
Filename
CHANGELOG.txt
ElvUI_SLE/modules/datatexts/range.lua
ElvUI_SLE/modules/unitframes/tags.lua
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 8337dba..e86a791 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -9,6 +9,7 @@ v1.87
 - Updated the Enhanced Incompatible Message so it can be ignored/Disable Enhanced Addon before reporting issues
 - Some backend clean up
 - Changed Minimap Icons to enable/disable skinning of the icons, and enable/disable the bar if skinning is enabled.
+- Added new tag [range:sl] to show range on frames like target, focus and such

 v1.86 March 11, 2014
 - Added option to Show/Hide Squareminimap Bar during pet battles
diff --git a/ElvUI_SLE/modules/datatexts/range.lua b/ElvUI_SLE/modules/datatexts/range.lua
index 04cdf04..d86d97b 100644
--- a/ElvUI_SLE/modules/datatexts/range.lua
+++ b/ElvUI_SLE/modules/datatexts/range.lua
@@ -1,7 +1,7 @@
 local E, L, V, P, G = unpack(ElvUI)
 local DT = E:GetModule('DataTexts')

-local rc = LibStub("LibRangeCheck-2.0")
+local RC = LibStub("LibRangeCheck-2.0")
 local displayString = ''
 local lastPanel
 local int = 1
@@ -16,7 +16,7 @@ local function OnUpdate(self, t)
 	if int > 0 then return end
 	int = .25

-	local min, max = rc:GetRange('target')
+	local min, max = RC:GetRange('target')
 	if not forceUpdate and (min == curMin and max == curMax) then return end

 	curMin = min
@@ -42,7 +42,7 @@ local function OnEvent(self, event)
 end

 local function ValueColorUpdate(hex, r, g, b)
-	displayString = string.join("", "%s: ", hex, "%d|r - ", hex, "%d|r")
+	displayString = string.join("", "%s: ", hex, "%d|r-", hex, "%d|r")

 	if lastPanel ~= nil then
 		OnEvent(lastPanel)
diff --git a/ElvUI_SLE/modules/unitframes/tags.lua b/ElvUI_SLE/modules/unitframes/tags.lua
index 3d09722..60136a1 100755
--- a/ElvUI_SLE/modules/unitframes/tags.lua
+++ b/ElvUI_SLE/modules/unitframes/tags.lua
@@ -1,5 +1,24 @@
 local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore

+local RC = LibStub("LibRangeCheck-2.0")
+
+ElvUF.Tags.Methods['range:sl'] = function(unit)
+	local name, server = UnitName(unit)
+	local rangeText = ''
+	local min, max = RC:GetRange(unit)
+	curMin = min
+	curMax = max
+
+	if(server and server ~= "") then
+		name = format("%s-%s", name, server)
+	end
+
+	if min and max and (name ~= UnitName('player')) then
+		rangeText = curMin.."-"..curMax
+	end
+	return rangeText
+end
+
 ElvUF.Tags.Events['health:current:sl'] = 'UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_CONNECTION'
 ElvUF.Tags.Methods['health:current:sl'] = function(unit)
 	local min, max = UnitHealth(unit), UnitHealthMax(unit)