shadowsight announce option added

This commit is contained in:
Sumsebrum 2021-06-20 01:00:55 +02:00
parent 0d7bd3c688
commit 4148e775a9

View File

@ -10,6 +10,7 @@ local ShadowsightTimer = Gladdy:NewModule("Shadowsight Timer", nil, {
shadowsightTimerRelPoint2 = "CENTER", shadowsightTimerRelPoint2 = "CENTER",
shadowsightTimerX = 0, shadowsightTimerX = 0,
shadowsightTimerY = 0, shadowsightTimerY = 0,
shadowsightAnnounce = true,
}) })
function ShadowsightTimer:OnEvent(event, ...) function ShadowsightTimer:OnEvent(event, ...)
@ -120,12 +121,14 @@ function ShadowsightTimer.OnUpdate(self, elapsed)
if (self.timeSinceLastUpdate > 0.1) then if (self.timeSinceLastUpdate > 0.1) then
self.font:SetFormattedText(floor(self.endTime / 60) .. ":" .. "%02d", self.endTime - floor(self.endTime / 60) * 60) self.font:SetFormattedText(floor(self.endTime / 60) .. ":" .. "%02d", self.endTime - floor(self.endTime / 60) * 60)
self.timeSinceLastUpdate = 0; self.timeSinceLastUpdate = 0;
if floor(self.endTime) == 15 then if floor(self.endTime) == 15 and Gladdy.db.shadowsightAnnounce then
Gladdy:SendMessage("SHADOWSIGHT", L["Shadowsight up in %ds"]:format(15)) Gladdy:SendMessage("SHADOWSIGHT", L["Shadowsight up in %ds"]:format(15))
end end
end end
if self.endTime <= 0 then if self.endTime <= 0 then
Gladdy:SendMessage("SHADOWSIGHT", L["Shadowsight up!"]) if Gladdy.db.shadowsightAnnounce then
Gladdy:SendMessage("SHADOWSIGHT", L["Shadowsight up!"])
end
self:SetScript("OnUpdate", nil) self:SetScript("OnUpdate", nil)
self.font:SetText("0:00") self.font:SetText("0:00")
self.font:SetTextColor(0, 1, 0) self.font:SetTextColor(0, 1, 0)
@ -146,10 +149,17 @@ function ShadowsightTimer:GetOptions()
order = 3, order = 3,
width = "full", width = "full",
}), }),
shadowsightAnnounce = Gladdy:option({
type = "toggle",
name = L["Announce"],
--desc = L["Turns countdown before the start of an arena match on/off."],
order = 4,
width = "full",
}),
shadowsightTimerScale = Gladdy:option({ shadowsightTimerScale = Gladdy:option({
type = "range", type = "range",
name = L["Scale"], name = L["Scale"],
order = 4, order = 5,
min = 0.1, min = 0.1,
max = 5, max = 5,
step = 0.1, step = 0.1,