Quantcast

Added Auras option to hide the timer text

Repooc [08-16-14 - 20:53]
Added Auras option to hide the timer text
Filename
ElvUI_SLE/core/modules.lua
ElvUI_SLE/defaults/profile.lua
ElvUI_SLE/modules/auras.lua
ElvUI_SLE/modules/load_modules.xml
ElvUI_SLE/options/auras_c.lua
ElvUI_SLE/options/load_options.xml
diff --git a/ElvUI_SLE/core/modules.lua b/ElvUI_SLE/core/modules.lua
index ee97eeb..ae129b4 100644
--- a/ElvUI_SLE/core/modules.lua
+++ b/ElvUI_SLE/core/modules.lua
@@ -3,6 +3,7 @@ local unit

 local modules = {
 	['SLE_AutoRelease'] = { 'AceHook-3.0', 'AceEvent-3.0' },
+	['SLE_AuraTimers'] = { 'AceEvent-3.0' },
 	['SLE_DTPanels'] = { 'AceHook-3.0', 'AceEvent-3.0' },
 	['SLE_BackGrounds'] = { 'AceHook-3.0', 'AceEvent-3.0'},
 	['SLE_BagInfo'] = { 'AceHook-3.0', 'AceEvent-3.0', 'AceTimer-3.0'},
diff --git a/ElvUI_SLE/defaults/profile.lua b/ElvUI_SLE/defaults/profile.lua
index 7a3f21f..84c4102 100644
--- a/ElvUI_SLE/defaults/profile.lua
+++ b/ElvUI_SLE/defaults/profile.lua
@@ -1,6 +1,19 @@
 local E, L, V, P, G = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB

 P['sle'] = {
+	--Auras
+	['auras'] = {
+		['enable'] = false,
+		['buffs'] = {
+			['hideTimer'] = false,
+		},
+		['debuffs'] = {
+			['hideTimer'] = false,
+		},
+		['tempenchants'] = {
+			['hideTimer'] = false,
+		},
+	},
 	--Background frames
 	['backgrounds'] = {
 		['bottom'] = {
diff --git a/ElvUI_SLE/modules/auras.lua b/ElvUI_SLE/modules/auras.lua
new file mode 100644
index 0000000..26de7b9
--- /dev/null
+++ b/ElvUI_SLE/modules/auras.lua
@@ -0,0 +1,41 @@
+local E, L, V, P, G = unpack(ElvUI);
+local AT = E:GetModule('SLE_AuraTimers');
+local A = E:GetModule('Auras');
+
+function AT:UpdateAura(button, index)
+	if not E.db.sle.auras.enable then return end
+	local isDebuff
+	local filter = button:GetParent():GetAttribute('filter')
+	local unit = button:GetParent():GetAttribute("unit")
+	local name, _, _, _, dtype, duration, expiration = UnitAura(unit, index, filter)
+
+	if (name) then
+		if UnitBuff('player', name) then
+			isDebuff = false
+		elseif UnitDebuff('player', name) then
+			isDebuff = true
+		end
+
+		if isDebuff == false and E.db.sle.auras.buffs.hideTimer then
+			button.time:Hide()
+		elseif isDebuff == false then
+			button.time:Show()
+		end
+
+		if isDebuff == true and E.db.sle.auras.debuffs.hideTimer then
+			button.time:Hide()
+		elseif isDebuff == true then
+			button.time:Show()
+		end
+	end
+end
+
+function AT:UpdateTempEnchant(button, index)
+	--Might do tempenchant stuff later
+end
+
+function AT:Initialize()
+	if E.private.auras.enable ~= true then return end
+	hooksecurefunc(A, 'UpdateAura', AT.UpdateAura)
+	--hooksecurefunc(A, 'UpdateTempEnchant', AT.UpdateTempEnchant)
+end
\ No newline at end of file
diff --git a/ElvUI_SLE/modules/load_modules.xml b/ElvUI_SLE/modules/load_modules.xml
index ab6359d..c6d724a 100644
--- a/ElvUI_SLE/modules/load_modules.xml
+++ b/ElvUI_SLE/modules/load_modules.xml
@@ -1,4 +1,5 @@
 <Ui xmlns="http://www.blizzard.com/wow/ui/">
+	<Script file='auras.lua'/>
 	<Script file='autorelease.lua'/>
 	<Script file='backgrounds.lua'/>
 	<Include file='characterframe\load_characterframe.xml'/>
diff --git a/ElvUI_SLE/options/auras_c.lua b/ElvUI_SLE/options/auras_c.lua
new file mode 100644
index 0000000..231bbc3
--- /dev/null
+++ b/ElvUI_SLE/options/auras_c.lua
@@ -0,0 +1,60 @@
+local E, L, V, P, G = unpack(ElvUI);
+--local AT = E:GetModule('SLE_AuraTimers')
+
+local function configTable()
+	E.Options.args.sle.args.options.args.general.args.auras = {
+		type = "group",
+		name = L["Auras"],
+		order = 1,
+		args = {
+			header = {
+				order = 1,
+				type = "header",
+				name = L["Auras"],
+			},
+			intro = {
+				order = 2,
+				type = "description",
+				name = "Some aura changes",
+			},
+			enabled = {
+				order = 3,
+				type = "toggle",
+				name = L["Enable"],
+				--desc = L["Show/Hide UI buttons."],
+				get = function(info) return E.db.sle.auras.enable end,
+				set = function(info, value) E.db.sle.auras.enable = value end
+			},
+			space1 = {
+				order = 4,
+				type = 'description',
+				name = "",
+			},
+			space2 = {
+				order = 5,
+				type = 'description',
+				name = "",
+			},
+			buffs = {
+				order = 6,
+				type = "toggle",
+				name = "Hide Buffs Time",
+				--desc = L["Sets size of buttons"],
+				disabled = function() return not E.db.sle.auras.enable end,
+				get = function(info) return E.db.sle.auras.buffs.hideTimer end,
+				set = function(info, value) E.db.sle.auras.buffs.hideTimer = value end,
+			},
+			debuffs = {
+				order = 7,
+				type = "toggle",
+				name = "Hide Debuffs Time",
+				--desc = L['The spacing between buttons.'],
+				disabled = function() return not E.db.sle.auras.enable end,
+				get = function(info) return E.db.sle.auras.debuffs.hideTimer end,
+				set = function(info, value) E.db.sle.auras.debuffs.hideTimer = value end,
+			},
+		},
+	}
+end
+
+table.insert(E.SLEConfigs, configTable)
\ No newline at end of file
diff --git a/ElvUI_SLE/options/load_options.xml b/ElvUI_SLE/options/load_options.xml
index 8864c2a..9a42991 100644
--- a/ElvUI_SLE/options/load_options.xml
+++ b/ElvUI_SLE/options/load_options.xml
@@ -2,6 +2,7 @@
 	<Script file='core_c.lua'/>
 	<Script file='help_c.lua'/>
 	<Script file='media_c.lua'/>
+	<Script file='auras_c.lua'/>
 	<Script file='autorelease_c.lua'/>
 	<Script file='datatexts_c.lua'/>
 	<Script file='backgrounds_c.lua'/>