DR Level Icon Text by ManneN1

This commit is contained in:
Sumsebrum 2021-09-27 13:40:02 +02:00
parent 69c1eca49b
commit 41f74f5896

View File

@ -44,6 +44,9 @@ local Diminishings = Gladdy:NewModule("Diminishings", nil, {
drHalfColor = {r = 1, g = 1, b = 0, a = 1 }, drHalfColor = {r = 1, g = 1, b = 0, a = 1 },
drQuarterColor = {r = 1, g = 0.7, b = 0, a = 1 }, drQuarterColor = {r = 1, g = 0.7, b = 0, a = 1 },
drNullColor = {r = 1, g = 0, b = 0, a = 1 }, drNullColor = {r = 1, g = 0, b = 0, a = 1 },
drLevelTextEnabled = false,
drLevelTextFont = "DorisPP",
drLevelTextFontScale = 1,
drWidthFactor = 1, drWidthFactor = 1,
drCategories = defaultCategories(), drCategories = defaultCategories(),
drDuration = 18 drDuration = 18
@ -59,6 +62,16 @@ local function getDiminishColor(dr)
end end
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() function Diminishings:Initialize()
self.frames = {} self.frames = {}
self:RegisterMessage("UNIT_DEATH", "ResetUnit", "AURA_FADE", "UNIT_DESTROYED") self:RegisterMessage("UNIT_DEATH", "ResetUnit", "AURA_FADE", "UNIT_DESTROYED")
@ -133,6 +146,15 @@ function Diminishings:CreateFrame(unit)
icon.timeText:SetJustifyH("CENTER") icon.timeText:SetJustifyH("CENTER")
icon.timeText:SetPoint("CENTER", icon, "CENTER", 0, 1) 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 icon.diminishing = 1
drFrame["icon" .. i] = icon 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: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.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:SetWidth(icon:GetWidth() - icon:GetWidth()/16)
icon.cooldown:SetHeight(icon:GetHeight() - icon:GetHeight()/16) icon.cooldown:SetHeight(icon:GetHeight() - icon:GetHeight()/16)
icon.cooldown:ClearAllPoints() 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) icon.border:SetVertexColor(Gladdy.db.drBorderColor.r, Gladdy.db.drBorderColor.g, Gladdy.db.drBorderColor.b, Gladdy.db.drBorderColor.a)
end end
if Gladdy.db.drLevelTextEnabled then
icon.drLevelText:Show()
icon.drLevelText:SetText(getDiminishText(icon.diminishing))
else
icon.drLevelText:Hide()
end
icon:ClearAllPoints() icon:ClearAllPoints()
if (Gladdy.db.drCooldownPos == "LEFT") then if (Gladdy.db.drCooldownPos == "LEFT") then
if (i == 1) 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 = { border = {
type = "group", type = "group",
name = L["Border"], name = L["Border"],
order = 5, order = 6,
args = { args = {
headerBorder = { headerBorder = {
type = "header", type = "header",