12,787
edits
(_Currency: Conditional formatting for negative amounts, and refactor to avoid repeated string concatenation) |
(Use inline-flex instead of inline-block; reverse order of amount & image for _Currency) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 45: | Line 45: | ||
["Hardcore Adventure Speedrun"] = "svg", | ["Hardcore Adventure Speedrun"] = "svg", | ||
["Mastery Tokens"] = "gif", | ["Mastery Tokens"] = "gif", | ||
["Lesser Relics"] = "gif", | |||
["Prat, the Serpent of Fire"] = "svg", | ["Prat, the Serpent of Fire"] = "svg", | ||
["Unholy Prayers"] = "svg", | ["Unholy Prayers"] = "svg", | ||
Line 204: | Line 205: | ||
["Trickery Temple"] = "png", | ["Trickery Temple"] = "png", | ||
["Underwater City"] = "png", | ["Underwater City"] = "png", | ||
["Underwater Ruins"] = "png" | ["Underwater Ruins"] = "png", | ||
["Eye-conic Cave"] = "png", | |||
["Mucky Cave"] = "png", | |||
["Lost Temple"] = "png", | |||
["Ritual Site"] = "png", | |||
["Shipwreck Cove"] = "png", | |||
} | } | ||
} | } | ||
Line 783: | Line 789: | ||
if menu then | if menu then | ||
return '{| class="articletable" style="display:inline- | return '{| class="articletable" style="display:inline-flex;vertical-align:middle;"\r\n|-\r\n|' .. expIcon .. resultText .. '\r\n|}' | ||
elseif not noicon and not nospan then | elseif not noicon and not nospan then | ||
return '<span style="display:inline- | return '<span style="display:inline-flex">' .. expIcon .. resultText .. '</span>' | ||
else | else | ||
return resultText | return resultText | ||
Line 804: | Line 810: | ||
result = result.." Level "..level | result = result.." Level "..level | ||
result = '<span style="display:inline- | result = '<span style="display:inline-flex">'..result..'</span>' | ||
return result | return result | ||
end | end | ||
Line 831: | Line 837: | ||
result = result..p.Icon({linkname, img=iconname, type='item', notext=true, nospan=true, alt=altTextItem})..p.Icon({'Mastery', notext=true, nospan=true, alt=altTextMastery}) | result = result..p.Icon({linkname, img=iconname, type='item', notext=true, nospan=true, alt=altTextItem})..p.Icon({'Mastery', notext=true, nospan=true, alt=altTextMastery}) | ||
if showText then result = result..'[['..linkname..']] [[Mastery]]' end | if showText then result = result..'[['..linkname..']] [[Mastery]]' end | ||
result = '<span style="display:inline- | result = '<span style="display:inline-flex">'..result..'</span>' | ||
return result | return result | ||
end | end | ||
Line 845: | Line 851: | ||
function p._Currency(fileName, link, altText, amount, maxAmount) | function p._Currency(fileName, link, altText, amount, maxAmount) | ||
local ret = {} | local ret = {} | ||
table.insert(ret, '<span style="display:inline- | table.insert(ret, '<span style="display:inline-flex">') | ||
local sep = '' | |||
-- Currency amounts | -- Currency amounts | ||
if tonumber(amount) ~= nil then | if tonumber(amount) ~= nil then | ||
sep = ' ' | |||
local function numColour(amount) | local function numColour(amount) | ||
if tonumber(amount) < 0 then | if tonumber(amount) < 0 then | ||
Line 863: | Line 863: | ||
end | end | ||
end | end | ||
table.insert(ret, | table.insert(ret, numColour(amount)) | ||
if (tonumber(maxAmount) ~= nil and maxAmount > amount) then | if (tonumber(maxAmount) ~= nil and maxAmount > amount) then | ||
table.insert(ret, ' - ' .. numColour(maxAmount)) | table.insert(ret, ' - ' .. numColour(maxAmount)) | ||
end | end | ||
end | |||
-- Currency icon | |||
if fileName ~= nil then | |||
table.insert(ret, sep .. '[[File:' .. fileName .. '|25px') | |||
if link ~= nil then | |||
table.insert(ret, '|link=' .. link) | |||
end | |||
table.insert(ret, '|alt=' .. ((altText == nil and '') or altText) .. ']]') | |||
end | end | ||
table.insert(ret, '</span>') | table.insert(ret, '</span>') |