From 7cdd2b7accdcb787b7aed28b25c9fe27c21bd1f6 Mon Sep 17 00:00:00 2001 From: Darth Predator Date: Sat, 15 Apr 2017 02:59:29 +0300 Subject: [PATCH] Some new options --- ElvUI_SLE/defaults/profile.lua | 64 +++++++++++++++++++++++++++ ElvUI_SLE/modules/unitframes/unitframes.lua | 33 ++++++++++++++ ElvUI_SLE/options/unitframes_c.lua | 48 ++++++++++++++++++++ 3 files changed, 145 insertions(+) diff --git a/ElvUI_SLE/defaults/profile.lua b/ElvUI_SLE/defaults/profile.lua index c1dfa52..c23a16d 100644 --- a/ElvUI_SLE/defaults/profile.lua +++ b/ElvUI_SLE/defaults/profile.lua @@ -765,16 +765,40 @@ P["sle"] = { ["xoffset"] = 0, ["yoffset"] = 0, }, + ["auras"] = { + ["buffs"] = { + ["threshold"] = 4, + }, + ["debuffs"] = { + ["threshold"] = 4, + }, + }, ["higherPortrait"] = false, ["portraitAlpha"] = 0.35, }, ["target"] = { ["higherPortrait"] = false, ["portraitAlpha"] = 0.35, + ["auras"] = { + ["buffs"] = { + ["threshold"] = 4, + }, + ["debuffs"] = { + ["threshold"] = 4, + }, + }, }, ["focus"] = { ["higherPortrait"] = false, ["portraitAlpha"] = 0.35, + ["auras"] = { + ["buffs"] = { + ["threshold"] = 4, + }, + ["debuffs"] = { + ["threshold"] = 4, + }, + }, }, ["party"] = { ["offline"] = { @@ -789,6 +813,14 @@ P["sle"] = { ["xoffset"] = 0, ["yoffset"] = 0, }, + ["auras"] = { + ["buffs"] = { + ["threshold"] = 4, + }, + ["debuffs"] = { + ["threshold"] = 4, + }, + }, ["higherPortrait"] = false, ["portraitAlpha"] = 0.35, }, @@ -805,6 +837,14 @@ P["sle"] = { ["xoffset"] = 0, ["yoffset"] = 0, }, + ["auras"] = { + ["buffs"] = { + ["threshold"] = 4, + }, + ["debuffs"] = { + ["threshold"] = 4, + }, + }, ["higherPortrait"] = false, ["portraitAlpha"] = 0.35, }, @@ -817,6 +857,14 @@ P["sle"] = { ["texture"] = "ALERT", ["CustomTexture"] = "", }, + ["auras"] = { + ["buffs"] = { + ["threshold"] = 4, + }, + ["debuffs"] = { + ["threshold"] = 4, + }, + }, ["role"] = { ["xoffset"] = 0, ["yoffset"] = 0, @@ -825,10 +873,26 @@ P["sle"] = { ["portraitAlpha"] = 0.35, }, ["boss"] = { + ["auras"] = { + ["buffs"] = { + ["threshold"] = 4, + }, + ["debuffs"] = { + ["threshold"] = 4, + }, + }, ["higherPortrait"] = false, ["portraitAlpha"] = 0.35, }, ["arena"] = { + ["auras"] = { + ["buffs"] = { + ["threshold"] = 4, + }, + ["debuffs"] = { + ["threshold"] = 4, + }, + }, ["higherPortrait"] = false, ["portraitAlpha"] = 0.35, }, diff --git a/ElvUI_SLE/modules/unitframes/unitframes.lua b/ElvUI_SLE/modules/unitframes/unitframes.lua index 465c24e..ea047c4 100644 --- a/ElvUI_SLE/modules/unitframes/unitframes.lua +++ b/ElvUI_SLE/modules/unitframes/unitframes.lua @@ -160,6 +160,39 @@ function SUF:HealthPredictUpdate(frame) end end +function UF:UpdateAuraTimer(elapsed) + self.expiration = self.expiration - elapsed + if self.nextupdate > 0 then + self.nextupdate = self.nextupdate - elapsed + return + end + + if(self.expiration <= 0) then + self:SetScript('OnUpdate', nil) + + if(self.text:GetFont()) then + self.text:SetText('') + end + + return + end + + local timervalue, formatid + local unitID = self:GetParent():GetParent().unitframeType + local auraType = self:GetParent().type + if unitID and E.db.sle.unitframes.unit[unitID].auras then + timervalue, formatid, self.nextupdate = E:GetTimeInfo(self.expiration, E.db.sle.unitframes.unit[unitID].auras[auraType].threshold) + else + timervalue, formatid, self.nextupdate = E:GetTimeInfo(self.expiration, 4) + end + if self.text:GetFont() then + self.text:SetFormattedText(("%s%s|r"):format(E.TimeColors[formatid], E.TimeFormats[formatid][2]), timervalue) + elseif self:GetParent():GetParent().db then + self.text:FontTemplate(LSM:Fetch("font", E.db['unitframe'].font), self:GetParent():GetParent().db[auraType].fontSize, E.db['unitframe'].fontOutline) + self.text:SetFormattedText(("%s%s|r"):format(E.TimeColors[formatid], E.TimeFormats[formatid][2]), timervalue) + end +end + function SUF:Initialize() if not SLE.initialized or not E.private.unitframe.enable then return end SUF:NewTags() diff --git a/ElvUI_SLE/options/unitframes_c.lua b/ElvUI_SLE/options/unitframes_c.lua index 90da56d..d22a5fa 100644 --- a/ElvUI_SLE/options/unitframes_c.lua +++ b/ElvUI_SLE/options/unitframes_c.lua @@ -56,6 +56,52 @@ local function configTable() } return config end + + local function CreateAurasConfig(unitID) + local config = { + order = 6, + name = L["Auras"], + type = "group", + guiInline = true, + args = { + buffs = { + order = 1, + type = "group", + guiInline = true, + name = L["Buffs"], + get = function(info) return E.db.sle.unitframes.unit[unitID].auras.buffs[ info[#info] ] end, + set = function(info, value) E.db.sle.unitframes.unit[unitID].auras.buffs[ info[#info] ] = value; end, + args = { + threshold = { + type = "range", + order = 1, + name = L["Low Threshold"], + desc = L["Threshold before text turns red and is in decimal form. Set to -1 for it to never turn red"], + min = -1, max = 20, step = 1, + }, + }, + }, + debuffs = { + order = 2, + type = "group", + guiInline = true, + name = L["Debuffs"], + get = function(info) return E.db.sle.unitframes.unit[unitID].auras.debuffs[ info[#info] ] end, + set = function(info, value) E.db.sle.unitframes.unit[unitID].auras.debuffs[ info[#info] ] = value; end, + args = { + threshold = { + type = "range", + order = 1, + name = L["Low Threshold"], + desc = L["Threshold before text turns red and is in decimal form. Set to -1 for it to never turn red"], + min = -1, max = 20, step = 1, + }, + }, + }, + }, + } + return config + end E.Options.args.sle.args.modules.args.unitframes = { type = "group", @@ -183,6 +229,7 @@ local function configTable() }, }, + auras = CreateAurasConfig("player"), }, }, target = { @@ -205,6 +252,7 @@ local function configTable() get = function(info) return E.db.sle.unitframes.unit.target[ info[#info] ] end, set = function(info, value) E.db.sle.unitframes.unit.target[ info[#info] ] = value; UF:CreateAndUpdateUF('target'); end, }, + auras = CreateAurasConfig("target"), }, }, focus = { -- 1.7.9.5