From 41f74f589603c84c93bcf4038eae203905907b2c Mon Sep 17 00:00:00 2001 From: Sumsebrum Date: Mon, 27 Sep 2021 13:40:02 +0200 Subject: [PATCH] DR Level Icon Text by ManneN1 --- Modules/Diminishings.lua | 71 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/Modules/Diminishings.lua b/Modules/Diminishings.lua index 3d46253..2a2c1d2 100644 --- a/Modules/Diminishings.lua +++ b/Modules/Diminishings.lua @@ -44,6 +44,9 @@ local Diminishings = Gladdy:NewModule("Diminishings", nil, { drHalfColor = {r = 1, g = 1, b = 0, a = 1 }, drQuarterColor = {r = 1, g = 0.7, b = 0, a = 1 }, drNullColor = {r = 1, g = 0, b = 0, a = 1 }, + drLevelTextEnabled = false, + drLevelTextFont = "DorisPP", + drLevelTextFontScale = 1, drWidthFactor = 1, drCategories = defaultCategories(), drDuration = 18 @@ -59,6 +62,16 @@ local function getDiminishColor(dr) end end +local function getDiminishText(dr) + if dr == 0.5 then + return "½" + elseif dr == 0.25 then + return "¼" + else + return "ø" + end +end + function Diminishings:Initialize() self.frames = {} self:RegisterMessage("UNIT_DEATH", "ResetUnit", "AURA_FADE", "UNIT_DESTROYED") @@ -133,6 +146,15 @@ function Diminishings:CreateFrame(unit) icon.timeText:SetJustifyH("CENTER") icon.timeText:SetPoint("CENTER", icon, "CENTER", 0, 1) + icon.drLevelText = icon.cooldownFrame:CreateFontString(nil, "OVERLAY") + icon.drLevelText:SetDrawLayer("OVERLAY") + icon.drLevelText:SetFont(Gladdy:SMFetch("font", "drLevelTextFont"), 10, "OUTLINE") + icon.drLevelText:SetTextColor(getDiminishColor(1)) + icon.drLevelText:SetShadowOffset(1, -1) + icon.drLevelText:SetShadowColor(0, 0, 0, 1) + icon.drLevelText:SetJustifyH("CENTER") + icon.drLevelText:SetPoint("BOTTOM", icon, "BOTTOM", 0, 0) + icon.diminishing = 1 drFrame["icon" .. i] = icon @@ -198,6 +220,9 @@ function Diminishings:UpdateFrame(unit) icon.timeText:SetFont(Gladdy:SMFetch("font", "drFont"), (Gladdy.db.drIconSize/2 - 1) * Gladdy.db.drFontScale, "OUTLINE") icon.timeText:SetTextColor(Gladdy.db.drFontColor.r, Gladdy.db.drFontColor.g, Gladdy.db.drFontColor.b, Gladdy.db.drFontColor.a) + icon.drLevelText:SetFont(Gladdy:SMFetch("font", "drLevelTextFont"), (Gladdy.db.drIconSize/2 - 1) * Gladdy.db.drLevelTextFontScale, "OUTLINE") + icon.drLevelText:SetTextColor(getDiminishColor(icon.diminishing)) + icon.cooldown:SetWidth(icon:GetWidth() - icon:GetWidth()/16) icon.cooldown:SetHeight(icon:GetHeight() - icon:GetHeight()/16) icon.cooldown:ClearAllPoints() @@ -214,6 +239,13 @@ function Diminishings:UpdateFrame(unit) icon.border:SetVertexColor(Gladdy.db.drBorderColor.r, Gladdy.db.drBorderColor.g, Gladdy.db.drBorderColor.b, Gladdy.db.drBorderColor.a) end + if Gladdy.db.drLevelTextEnabled then + icon.drLevelText:Show() + icon.drLevelText:SetText(getDiminishText(icon.diminishing)) + else + icon.drLevelText:Hide() + end + icon:ClearAllPoints() if (Gladdy.db.drCooldownPos == "LEFT") then if (i == 1) then @@ -565,10 +597,47 @@ function Diminishings:GetOptions() }), }, }, + level = { + type = "group", + name = L["Level Text"], + order = 5, + args = { + headerBorder = { + type = "header", + name = L["DR Level"], + order = 1, + }, + drLevelTextEnabled = Gladdy:option({ + type = "toggle", + name = L["DR Level Text Enabled"], + desc = L["Shows the current DR Level on the DR icon."], + order = 2, + width = "full", + }), + drLevelTextFont = Gladdy:option({ + type = "select", + name = L["Font"], + desc = L["Font of the cooldown"], + order = 3, + dialogControl = "LSM30_Font", + values = AceGUIWidgetLSMlists.font, + }), + drLevelTextFontScale = Gladdy:option({ + type = "range", + name = L["Font scale"], + desc = L["Scale of the text"], + order = 4, + min = 0.1, + max = 2, + step = 0.1, + width = "full", + }), + }, + }, border = { type = "group", name = L["Border"], - order = 5, + order = 6, args = { headerBorder = { type = "header",