add decimal option

This commit is contained in:
pepopo978
2025-01-08 09:36:20 -08:00
parent e75b821a09
commit 4077585841
4 changed files with 32 additions and 2 deletions
+7
View File
@@ -74,6 +74,11 @@ L:RegisterTranslations("enUS", function()
["Max Rows"] = true,
["Max Columns"] = true,
["Curse Ordering"] = true,
["Decimal Duration"] = true,
["Decimal Duration Desc"] = "Show 1 decimal place for curse durations when less than 10 seconds remaining.",
["Order applied"] = true,
["Expiring soonest -> latest"] = true,
["Expiring latest -> soonest"] = true,
["Order applied"] = true,
["Expiring soonest -> latest"] = true,
["Expiring latest -> soonest"] = true,
@@ -240,6 +245,8 @@ L:RegisterTranslations("zhCN", function()
["Max Rows"] = "最大行数",
["Max Columns"] = "最大列数",
["Curse Ordering"] = "诅咒排序",
["Decimal Duration"] = "小数持续时间",
["Decimal Duration Desc"] = "当剩余时间少于10秒时,显示1位小数.",
["Order applied"] = "应用顺序",
["Expiring soonest -> latest"] = "即将到期->最新",
["Expiring latest -> soonest"] = "最新->即将到期",
+9 -1
View File
@@ -320,7 +320,15 @@ function curses:TimeRemaining(curseData)
dhReduction = curses:GetDarkHarvestReduction(curseData)
end
return math.ceil(curseData.duration - (GetTime() - curseData.start) - dhReduction)
local remaining = curseData.duration - (GetTime() - curseData.start) - dhReduction
if Cursive.db.profile.curseshowdecimals and remaining < 10 then
-- round to 1 decimal point
remaining = math.floor(remaining * 10) / 10
else
remaining = math.ceil(remaining)
end
return remaining
end
function curses:EnableResistSound(guid)
+15
View File
@@ -32,6 +32,7 @@ Cursive:RegisterDefaults("profile", {
textsize = 9,
curseordering = L["Expiring soonest -> latest"],
curseshowdecimals = false,
filterincombat = true,
filterhostile = true,
@@ -170,6 +171,7 @@ local barOptions = {
type = "text",
name = L["Curse Ordering"],
desc = L["Curse Ordering"],
order = 72,
get = function()
return Cursive.db.profile.curseordering
end,
@@ -178,6 +180,19 @@ local barOptions = {
Cursive.db.profile.curseordering = v
end,
},
["curseshowdecimals"] = {
type = "toggle",
name = L["Decimal Duration"],
desc = L["Decimal Duration Desc"],
order = 74,
get = function()
return Cursive.db.profile.curseshowdecimals
end,
set = function(v)
Cursive.db.profile.curseshowdecimals = v
Cursive.UpdateFramesFromConfig()
end,
},
["spacing"] = {
type = "range",
name = L["Spacing"],
+1 -1
View File
@@ -524,7 +524,7 @@ ui:SetScript("OnUpdate", function()
if (this.tick or 1) > GetTime() then
return
else
this.tick = GetTime() + .2
this.tick = GetTime() + .1
end
if not ui.rootBarFrame then