Module:Shop: Difference between revisions

Changed to wikitable class
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 16: Line 16:


function p._main(args)
function p._main(args)
local out = mw.html.create('table'):addClass('wikitable sortable ' .. (args.class or ''))
local out = mw.html.create('table'):addClass('article-table wikitable sortable ' .. (args.class or ''))
local delim = args.delim or ';;'
local delim = args.delim or ';;'
local currency = args.currency or 'Dough'
local currency = args.currency or 'Dough'
Line 34: Line 34:
local data = p.splitParams(raw, delim)
local data = p.splitParams(raw, delim)
data.size = data.size or args.size or '35' -- first column image size
data.size = data.size or args.size or '35' -- first column image size
data.currency = data.currency or currency
data.currency = currency
data.cost_delim = data.cost_delim or args.cost_delim or ','
data.cost_delim = data.cost_delim or args.cost_delim or ','
out:tag('tr'):node(p.ItemRow(data, args))
out:tag('tr'):node(p.ItemRow(data, args))
Line 85: Line 85:
if not data[1] and lib.isNotEmpty(data.x) and data.x ~= '1' then i.cell:wikitext('×', data.x, ' per ') end
if not data[1] and lib.isNotEmpty(data.x) and data.x ~= '1' then i.cell:wikitext('×', data.x, ' per ') end
if tonumber(i.value) == nil then
if tonumber(i.value) == nil then
local items = lib.split(i.value, data.cost_delim)
local items = lib.split(i.value, data.cost_delim or ',')
for a, item in ipairs(items) do
for a, item in ipairs(items) do
local name, amount = string.match(item, '^(.-)%*(.-)$')
local name, amount = string.match(item, '^(.-)%*(.-)$')
Line 93: Line 93:
name = name,
name = name,
link = name,
link = name,
count = TS(amount*i.mult) .. (i.mult2>0 and (' (' .. TS(amount*i.mult2) .. ')') or ''),
count = (TS(amount * i.mult) .. (i.mult2 > 0 and (' (' .. TS(amount * i.mult2) .. ')') or '')),
notext = 1,
notext = 1,
size = 25
size = 25
Line 132: Line 132:
info.text = data.text or specific
info.text = data.text or specific
info['type'] = data['type']
info['type'] = data['type']
if (data['type'] == 'Light Cone') then
 
info.suffix = 'Icon'
--So we don't have dupe pages for Inspo Cards (etc.) and thousands of redirects.
end
if (data['type'] == 'Inspo Card') then
info.text = ('Inspo Card: ' .. info.text)
end
if (data['type'] == 'Eye Color') then
info.text = ('Eye Color: ' .. info.text)
end
if (data['type'] == 'Eye Style') then
info.text = ('Eye Style: ' .. info.text)
end
if (data['type'] == 'Hair Color') then
info.text = ('Hair Color: ' .. info.text)
end
if (data['type'] == 'Hairstyle') then
info.text = ('Hairstyle: ' .. info.text)
end
row:tag('td'):node(Item(info))
row:tag('td'):node(Item(info))
if (not args.nocat) then category:wikitext('[[Category:Sells ', specific:gsub('&', 'and'), '|', specific, ']]') end
if (not args.nocat) then category:wikitext('[[Category:Sells ', specific, '|', specific, ']]') end
end
end
if cost then
if cost then