Module:Icons: Difference between revisions

no edit summary
(Undo revision 66451 by Auron956 (talk))
Tag: Undo
No edit summary
Tag: Manual revert
(5 intermediate revisions by 3 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 843: Line 849:
end
end


function p._Currency(fileName, link, altText, amt, maxAmt)
function p._Currency(fileName, link, altText, amount, maxAmount)
local amtText = nil
local ret = {}
if tonumber(amt) ~= nil then
table.insert(ret, '<span style="display:inline-block">')
amtText = formatnum(amt)
-- Currency icon
if maxAmt ~= nil and maxAmt >= amt then
if fileName ~= nil then
amtText = amtText .. ' - ' .. formatnum(maxAmt)
table.insert(ret, '[[File:' .. fileName .. '|25px')
if link ~= nil then
table.insert(ret, '|link=' .. link)
end
end
table.insert(ret, '|alt=' .. ((altText == nil and '') or altText) .. ']]')
end
end
 
-- Currency amounts
local fileText = ''
if tonumber(amount) ~= nil then
if fileName ~= nil then
local function numColour(amount)
fileText = '[[File:' .. fileName .. '|25px'
if tonumber(amount) < 0 then
if link ~= nil then
return '<span style="color:red;">' .. formatnum(amount) .. '</span>'
fileText = fileText .. '|link=' .. link
else
return formatnum(amount)
end
end
table.insert(ret, '&nbsp;' .. numColour(amount))
if (tonumber(maxAmount) ~= nil and maxAmount > amount) then
table.insert(ret, ' - ' .. numColour(maxAmount))
end
end
fileText = fileText .. '|alt=' .. ((altText == nil and '') or altText) .. ']]'
end
end
 
table.insert(ret, '</span>')
return '<span style="display:inline-block">' .. fileText .. (amtText ~= nil and '&nbsp;' .. amtText or '') .. '</span>'
return table.concat(ret)
end
end


432

edits