Module:Sandbox/User:Alsang: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
No edit summary
No edit summary
Line 87: Line 87:
function p.intermediates()
function p.intermediates()
local allRecipes = mw.smw.ask('[[Recipe JSON::~*]]|? #- = name|?Uses facility = facility|?-Sold item.Sold by #- = seller|limit=1200')
local allRecipes = mw.smw.ask('[[Recipe JSON::~*]]|? #- = name|?Uses facility = facility|?-Sold item.Sold by #- = seller|?Variant of = variant|limit=1200')
local allFacilities = {'Standard Potion Station',
local allFacilities = {'Standard Potion Station',
Line 110: Line 110:
'Jewelry Bench'}
'Jewelry Bench'}
local allShops = {'Head Chef (shop)','Timber Merchant Shop','Leather stall','Leather Goods'}
local allShops = {'Head Chef (shop)','Timber Merchant Shop','Leather stall','Leather Goods','Waiter'}
local intermediateRecipes = {}
local intermediateRecipes = {}
for i,item in ipairs(allRecipes) do
for _,item in ipairs(allRecipes) do
intermediate = true
intermediate = true
-- check facility
-- check facility
for f,facility in ipairs(allFacilities) do
for _,facility in ipairs(allFacilities) do
if item.facility==facility then
if item.facility==facility then
intermediate = false
intermediate = false
Line 124: Line 124:
-- check shops
-- check shops
for s,shop in ipairs(allShops) do
for _,shop in ipairs(allShops) do
if item.seller==shop then
if item.seller==shop then
intermediate = false
intermediate = false
end
if type(item.seller)=='table' then
for _,seller in ipairs(item.seller) do
if seller==shop then
intermediate = false
end
end
end
end
end
end
Line 132: Line 139:
end
end
if intermediate then
if intermediate then
table.insert(intermediateRecipes,item.name)
table.insert(intermediateRecipes,item)
end
end
Line 142: Line 149:
:tag('th')
:tag('th')
:wikitext('Page')
:wikitext('Page')
:done()
:tag('th')
:wikitext('Variant')
:done()
:done()
:done()
:done()
Line 148: Line 158:
local row = out:tag('tr')
local row = out:tag('tr')
:tag('td')
:tag('td')
:wikitext('[[' .. item .. ']]')
:wikitext('[[' .. item.name .. ']]')
:done()
:tag('td')
:wikitext(item.variant)
:done()
:done()
:done()
:done()