Module:Shop

local getArgs = require('Module:Arguments').getArgs local p = {}

function p.main(frame) local args = getArgs(frame) return p._main(args) end

function p._main(args) local IS = require("Module:IS").main local TableColor = require('Module:TableColor').main local item = IS({args[1]}) or "nil" local name = args[1] or '??' local price = args[2] or '??' local sprite = args["sprite"] or nil local color = args["color"] or nil local row = mw.html.create local cells = mw.html.create

local currencies = { "Poké", "Ekop", "Rupi", "Royal Gem", "Event Token", "Heart Scale", "Yellow Shard", "Red Shard", "Blue Shard", "Green Shard", "Big Mushroom", "Mushroom" }

if sprite then item = IS({sprite}) end

if price then for _, currency in pairs(currencies) do			if string.match(price, currency) then price = IS({currency}).." "..price end end end cells :tag('td'):wikitext(item) :done :tag('td'):wikitext(name) :done :tag('td'):wikitext(price):css("text-align", "left") :done

if color then row :tag('tr'):css('background-color', "#"..TableColor({"row", color})) :node(cells) else row :tag('tr'):css('background-color', "#"..TableColor({"row"})) :node(cells) end

return tostring(row) end

return p