from retail
This commit is contained in:
@@ -1196,6 +1196,53 @@ function Private.Modernize(data, oldSnapshot)
|
||||
end
|
||||
end
|
||||
|
||||
if data.internalVersion < 53 then
|
||||
local function ReplaceIn(text, table, prefix)
|
||||
local seenSymbols = {}
|
||||
Private.ParseTextStr(text, function(symbol)
|
||||
if not seenSymbols[symbol] then
|
||||
if table[prefix .. symbol .. "_format"] == "timed"
|
||||
and table[prefix .. symbol .. "_time_format"] == 0
|
||||
then
|
||||
table[prefix .. symbol .. "_time_legacy_floor"] = true
|
||||
end
|
||||
end
|
||||
seenSymbols[symbol] = symbol
|
||||
end)
|
||||
end
|
||||
|
||||
if data.regionType == "text" then
|
||||
ReplaceIn(data.displayText, data, "displayText_format_")
|
||||
end
|
||||
|
||||
if data.subRegions then
|
||||
for index, subRegionData in ipairs(data.subRegions) do
|
||||
if subRegionData.type == "subtext" then
|
||||
ReplaceIn(subRegionData.text_text, subRegionData, "text_text_format_")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if data.actions then
|
||||
if data.actions.start then
|
||||
ReplaceIn(data.actions.start.message, data.actions.start, "message_format_")
|
||||
end
|
||||
if data.actions.finish then
|
||||
ReplaceIn(data.actions.finish.message, data.actions.finish, "message_format_")
|
||||
end
|
||||
end
|
||||
|
||||
if data.conditions then
|
||||
for conditionIndex, condition in ipairs(data.conditions) do
|
||||
for changeIndex, change in ipairs(condition.changes) do
|
||||
if change.property == "chat" and change.value then
|
||||
ReplaceIn(change.value.message, change.value, "message_format_")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if data.internalVersion < 54 then
|
||||
for _, triggerData in ipairs(data.triggers) do
|
||||
if triggerData.trigger.type == "aura" then
|
||||
|
||||
+26
-5
@@ -122,8 +122,6 @@ Private.unit_realm_name_types = {
|
||||
always = L["Always include realm"]
|
||||
}
|
||||
|
||||
local timeFormatter = {}
|
||||
|
||||
local simpleFormatters = {
|
||||
--[[
|
||||
AbbreviateNumbers = function(value, state)
|
||||
@@ -156,6 +154,15 @@ local simpleFormatters = {
|
||||
-- Remove the space between the value and unit
|
||||
return fmt:gsub(" ", ""):format(time)
|
||||
end,
|
||||
-- Fixed built-in formatter
|
||||
[99] = function(value)
|
||||
value = ceil(value)
|
||||
if value > 60 then
|
||||
return string.format("%i:", math.floor(value / 60)) .. string.format("%02i", value % 60)
|
||||
else
|
||||
return string.format("%d", value)
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -229,16 +236,30 @@ Private.format_types = {
|
||||
hidden = hidden,
|
||||
disabled = function() return get(symbol .. "_time_dynamic_threshold") == 0 end
|
||||
})
|
||||
|
||||
addOption(symbol .. "_time_legacy_floor", {
|
||||
type = "toggle",
|
||||
name = L["Use Legacy floor rounding"],
|
||||
desc = L["Enables (incorrect) round down of seconds, which was the previous default behaviour."],
|
||||
width = WeakAuras.normalWidth,
|
||||
hidden = hidden,
|
||||
disabled = function() return get(symbol .. "_time_format", 0) ~= 0 end
|
||||
})
|
||||
end,
|
||||
CreateFormatter = function(symbol, get, wihoutColor, data)
|
||||
local format = get(symbol .. "_time_format", 0)
|
||||
local threshold = get(symbol .. "_time_dynamic_threshold", 60)
|
||||
local precision = get(symbol .. "_time_precision", 1)
|
||||
local legacyRoundingMode = get(symbol .. "_time_legacy_floor", false)
|
||||
|
||||
local mainFormater = simpleFormatters.time[format]
|
||||
if not mainFormater then
|
||||
mainFormater = simpleFormatters.time[0]
|
||||
if format == 0 and not legacyRoundingMode then
|
||||
format = 99
|
||||
end
|
||||
if not simpleFormatters.time[format] then
|
||||
format = 99
|
||||
end
|
||||
local mainFormater = simpleFormatters.time[format]
|
||||
|
||||
local formatter
|
||||
if threshold == 0 then
|
||||
formatter = function(value, state, trigger)
|
||||
|
||||
Reference in New Issue
Block a user