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