This commit is contained in:
Bunny67
2020-07-26 14:29:54 +03:00
parent 368a646da5
commit 0dfc91e3a3
6 changed files with 20 additions and 33 deletions
+11 -11
View File
@@ -5725,13 +5725,13 @@ WeakAuras.dynamic_texts = {
return ""
end
local remainingStr = "";
local remainingStr = "";
if remaining == math.huge then
remainingStr = " ";
remainingStr = " ";
elseif remaining > 60 then
remainingStr = string.format("%i:", math.floor(remaining / 60));
remaining = remaining % 60;
remainingStr = remainingStr..string.format("%02i", remaining);
remainingStr = string.format("%i:", math.floor(remaining / 60));
remaining = remaining % 60;
remainingStr = remainingStr..string.format("%02i", remaining);
elseif remaining > 0 then
if progressPrecision == 4 and remaining <= 3 then
remainingStr = remainingStr..string.format("%.1f", remaining);
@@ -5745,7 +5745,7 @@ WeakAuras.dynamic_texts = {
remainingStr = remainingStr..string.format("%.".. progressPrecision .."f", remaining);
end
else
remainingStr = " ";
remainingStr = " ";
end
return remainingStr
end
@@ -5770,13 +5770,13 @@ WeakAuras.dynamic_texts = {
if type(duration) ~= "number" then
return ""
end
local durationStr = "";
local durationStr = "";
if math.abs(duration) == math.huge or tostring(duration) == "nan" then
durationStr = " ";
elseif duration > 60 then
durationStr = string.format("%i:", math.floor(duration / 60));
duration = duration % 60;
durationStr = durationStr..string.format("%02i", duration);
durationStr = string.format("%i:", math.floor(duration / 60));
duration = duration % 60;
durationStr = durationStr..string.format("%02i", duration);
elseif duration > 0 then
if totalPrecision == 4 and duration <= 3 then
durationStr = durationStr..string.format("%.1f", duration);
@@ -5790,7 +5790,7 @@ WeakAuras.dynamic_texts = {
durationStr = durationStr..string.format("%."..totalPrecision.."f", duration);
end
else
durationStr = " ";
durationStr = " ";
end
return durationStr
end
-1
View File
@@ -1360,7 +1360,6 @@ function WeakAuras.MatchInfo(data, children, target)
if childDiff then
info.modified = info.modified + 1
info.diffs[newIndex] = childDiff
else
end
end
end
+6 -16
View File
@@ -103,7 +103,7 @@ end
SLASH_WEAKAURAS1, SLASH_WEAKAURAS2 = "/weakauras", "/wa";
function SlashCmdList.WEAKAURAS(input)
local args, msg = {}
local args, msg = {}, nil
for v in string.gmatch(input, "%S+") do
if not msg then
msg = v
@@ -351,9 +351,7 @@ function WeakAuras.validate(input, default)
for field, defaultValue in pairs(default) do
if(type(defaultValue) == "table" and type(input[field]) ~= "table") then
input[field] = {};
elseif(input[field] == nil) then
input[field] = defaultValue;
elseif(type(input[field]) ~= type(defaultValue)) then
elseif(input[field] == nil) or (type(input[field]) ~= type(defaultValue)) then
input[field] = defaultValue;
end
if(type(input[field]) == "table") then
@@ -6462,13 +6460,8 @@ function WeakAuras.ReplacePlaceHolders(textStr, region, customFunc, useHiddenSta
end
end
elseif state == 1 then -- Percent Start State
if char == 37 then
start = currentPos
elseif char == 123 then
if char == 123 then
start = currentPos + 1
elseif (char >= 48 and char <= 57) or (char >= 65 and char <= 90) or (char >= 97 and char <= 122) or char == 46 then
-- 0-9a-zA-Z or dot character
start = currentPos
else
start = currentPos
end
@@ -6480,6 +6473,7 @@ function WeakAuras.ReplacePlaceHolders(textStr, region, customFunc, useHiddenSta
result = result .. ValueForSymbol(symbol, region, customFunc, regionState, regionStates, useHiddenStates, formatters)
if char == 37 then
-- Do nothing
else
start = currentPos
end
@@ -6521,13 +6515,8 @@ function WeakAuras.ParseTextStr(textStr, symbolCallback)
local char = string.byte(textStr, currentPos);
if state == 0 then -- Normal State
elseif state == 1 then -- Percent Start State
if char == 37 then
start = currentPos
elseif char == 123 then
if char == 123 then
start = currentPos + 1
elseif (char >= 48 and char <= 57) or (char >= 65 and char <= 90) or (char >= 97 and char <= 122) or char == 46 then
-- 0-9a-zA-Z or dot character
start = currentPos
else
start = currentPos
end
@@ -6538,6 +6527,7 @@ function WeakAuras.ParseTextStr(textStr, symbolCallback)
local symbol = string.sub(textStr, start, currentPos - 1)
symbolCallback(symbol)
if char == 37 then
-- Do nothing
else
start = currentPos
end
+1 -3
View File
@@ -92,9 +92,7 @@ function spellCache.GetIcon(name)
if (icons) then
if (icons.spells) then
for spellId, icon in pairs(icons.spells) do
if (not bestMatch) then
bestMatch = spellId
elseif(type(spellId) == "number" and IsSpellKnown(spellId)) then
if not bestMatch or (type(spellId) == "number" and IsSpellKnown(spellId)) then
bestMatch = spellId
end
end
+1 -1
View File
@@ -82,7 +82,7 @@ local function createOptions(id, data)
local textJustify = ""
if data.justify == "CENTER" then
-- CENTER is default
elseif data.justify == "LEFT" then
textJustify = " " .. L["and aligned left"]
elseif data.justify == "RIGHT" then
@@ -105,7 +105,7 @@ local function createOptions(parentData, data, index, subIndex)
local textJustify = ""
if data.text_justify == "CENTER" then
-- CENTER is default
elseif data.text_justify == "LEFT" then
textJustify = " " .. L["and aligned left"]
elseif data.text_justify == "RIGHT" then