from retail

This commit is contained in:
Bunny67
2021-03-07 19:42:16 +03:00
parent b3be159906
commit 6e530142d3
41 changed files with 2796 additions and 2128 deletions
+98 -27
View File
@@ -73,6 +73,17 @@ Private.group_hybrid_sort_types = {
descending = L["Descending"]
}
Private.time_format_types = {
[0] = L["WeakAuras Built-In (63:42 | 3:07 | 10 | 2.4)"],
[1] = L["Blizzard (2h | 3m | 10s | 2.4)"],
}
Private.time_precision_types = {
[1] = "12.3",
[2] = "12.34",
[3] = "12.345",
}
Private.precision_types = {
[0] = "12",
[1] = "12.3",
@@ -103,6 +114,8 @@ Private.unit_realm_name_types = {
always = L["Always include realm"]
}
local timeFormatter = {}
local simpleFormatters = {
--[[
AbbreviateNumbers = function(value, state)
@@ -120,7 +133,22 @@ local simpleFormatters = {
end,
round = function(value)
return (type(value) == "number") and Round(value) or value
end
end,
time = {
[0] = function(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,
-- Old Blizzard
[1] = function(value)
local fmt, time = SecondsToTimeAbbrev(value)
-- Remove the space between the value and unit
return fmt:gsub(" ", ""):format(time)
end
}
}
Private.format_types = {
@@ -165,34 +193,84 @@ Private.format_types = {
timed = {
display = L["Time Format"],
AddOptions = function(symbol, hidden, addOption, get)
addOption(symbol .. "_time_format", {
type = "select",
name = L["Format"],
width = WeakAuras.doubleWidth,
values = Private.time_format_types,
hidden = hidden
})
addOption(symbol .. "_time_dynamic_threshold", {
type = "range",
min = 0,
max = 60,
step = 1,
name = L["Increase Precision Below"],
width = WeakAuras.normalWidth,
hidden = hidden,
})
addOption(symbol .. "_time_precision", {
type = "select",
name = L["Precision"],
width = WeakAuras.normalWidth,
values = Private.precision_types,
hidden = hidden
})
addOption(symbol .. "_time_dynamic", {
type = "toggle",
name = L["Dynamic"],
desc = L["Increased Precision below 3s"],
width = WeakAuras.normalWidth,
values = Private.time_precision_types,
hidden = hidden,
disabled = function() return get(symbol .. "_time_precision") == 0 end
disabled = function() return get(symbol .. "_time_dynamic_threshold") == 0 end
})
end,
CreateFormatter = function(symbol, get)
local format = get(symbol .. "_time_format", 0)
local threshold = get(symbol .. "_time_dynamic_threshold", 60)
local precision = get(symbol .. "_time_precision", 1)
local dynamic = get(symbol .. "_time_dynamic", false)
if dynamic then
if precision == 1 or precision == 2 or precision == 3 then
precision = precision + 3
local mainFormater = simpleFormatters.time[format]
if not mainFormater then
mainFormater = simpleFormatters.time[0]
end
local formatter
if threshold == 0 then
formatter = function(value, state)
if type(value) ~= 'number' or value == math.huge then
return ""
end
if value <= 0 then
return ""
end
return mainFormater(value)
end
else
local formatString = "%." .. precision .. "f"
formatter = function(value, state)
if type(value) ~= 'number' or value == math.huge then
return ""
end
if value <= 0 then
return ""
end
if value < threshold then
return string.format(formatString, value)
else
return mainFormater(value, state)
end
end
end
return function(value, state)
return Private.dynamic_texts.p.func(value, state, precision)
local triggerNum, sym = string.match(symbol, "(.+)%.(.+)")
sym = sym or symbol
if sym == "p" or sym == "t" then
-- Special case %p and %t. Since due to how the formatting
-- work previously, the time formatter only formats %p and %t
-- if the progress type is timed!
return function(value, state)
if not state or state.progressType ~= "timed" then
return value
end
return formatter(value, state)
end
else
return formatter
end
end
},
@@ -885,18 +963,10 @@ Private.text_word_wrap = {
Elide = L["Elide"]
}
Private.event_types = {};
Private.category_event_prototype = {}
for name, prototype in pairs(Private.event_prototypes) do
if(prototype.type == "event") then
Private.event_types[name] = prototype.name;
end
end
Private.status_types = {};
for name, prototype in pairs(Private.event_prototypes) do
if(prototype.type == "status") then
Private.status_types[name] = prototype.name;
end
Private.category_event_prototype[prototype.type] = Private.category_event_prototype[prototype.type] or {}
Private.category_event_prototype[prototype.type][name] = prototype.name
end
Private.subevent_prefix_types = {
@@ -988,6 +1058,7 @@ Private.environmental_types = {
}
Private.combatlog_flags_check_type = {
Mine = L["Mine"],
InGroup = L["In Group"],
NotInGroup = L["Not in Group"]
}