Module:Sandbox/User:Alsang: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
(make table to check pages and recipes for stonemason)
No edit summary
Line 1: Line 1:
p = {}
p = {}


function p.main()
function p.main(args)
local variants = {'Basic','Moderate','Fine','Strong','Superior','Perfect'}
local variants = {'Basic','Moderate','Fine','Strong','Superior','Perfect'}
Line 14: Line 14:
for i,item in ipairs(variants) do
for i,item in ipairs(variants) do
for j,jtem in ipairs(weapons) do
for j,jtem in ipairs(weapons) do
table.insert(allWeapons,{name=variants[i] .. ' ' .. weapons[j]})
table.insert(allWeapons,{pagename='[[' .. weapons[j] .. ' (' .. variants[i] .. ')]]'})
table.insert(allWeapons,{name=weapons[j] .. ' (' .. variants[i] .. ')'})
end
end
end
end
Line 21: Line 20:
for i,item in ipairs(allWeapons) do
for i,item in ipairs(allWeapons) do
local query = mw.smw.ask('[[Name::' .. item.name .. ']]|?Uses facility #- = data|mainlabel=-')
local query = mw.smw.ask(item.pagename .. '|?Uses facility #- = data|mainlabel=-')
if type(query)=='table' then
if type(query)=='table' then
allWeapons[i].facility = query[1].data
allWeapons[i].facility = query[1].data
end
end
local query = mw.smw.ask('[[Name::' .. item.name .. ']]|?Activity XP #- = data|mainlabel=-')
local query = mw.smw.ask(item.pagename .. '|?Activity XP #- = data|mainlabel=-')
if type(query)=='table' then
if type(query)=='table' then
allWeapons[i].XP = query[1].data
allWeapons[i].XP = query[1].data
end
end
local query = mw.smw.ask('[[Name::' .. item.name .. ']]|?Activity duration #- = data|mainlabel=-')
local query = mw.smw.ask(item.pagename .. '|?Activity duration #- = data|mainlabel=-')
if type(query)=='table' then
if type(query)=='table' then
allWeapons[i].duration = query[1].data
allWeapons[i].duration = query[1].data
end
end
local query = mw.smw.ask('[[Name::' .. item.name .. ']]|?Activity KP #- = data|mainlabel=-')
local query = mw.smw.ask(item.pagename .. '|?Activity KP #- = data|mainlabel=-')
if type(query)=='table' then
if type(query)=='table' then
allWeapons[i].KP = query[1].data
allWeapons[i].KP = query[1].data
end
end
local query = mw.smw.ask('[[Name::' .. item.name .. ']]|?Recipe output #- = data|mainlabel=-')
local query = mw.smw.ask(item.pagename .. '|?Recipe output #- = data|mainlabel=-')
if type(query)=='table' then
if type(query)=='table' then
allWeapons[i].output = query[1].data
allWeapons[i].output = query[1].data
end
local query = mw.smw.ask(item.pagename .. '|?Name #- = data|mainlabel=-')
if type(query)=='table' then
allWeapons[i].name = query[1].data
end
end
Line 49: Line 54:
local out = mw.html.create('table')
local out = mw.html.create('table')
out:addClass('wikitable sortable')
:addClass('wikitable sortable')
out:tag('th')
:tag('tr')
out:wikitext('Page')
:tag('th')
out:done()
:wikitext('Page')
out:tag('th')
:done()
out:wikitext('Output')
:tag('th')
out:done()
:wikitext('Name')
out:tag('th')
:done()
out:wikitext('Facility')
:tag('th')
out:done()
:wikitext('Output')
out:tag('th')
:done()
out:wikitext('XP')
:tag('th')
:wikitext('Facility')
out:done()
out:tag('th')
:done()
out:wikitext('KP')
:tag('th')
out:done()
:wikitext('XP')
out:tag('th')
:done()
out:wikitext('duration')
:tag('th')
out:done()
:wikitext('KP')
:done()
:tag('th')
:wikitext('duration')
:done()
:done()
for i,item in ipairs(allWeapons) do
for i,item in ipairs(allWeapons) do
out:tag('td')
local row = out:tag('tr')
out:wikitext('[[' .. item.name .. ']]')
:tag('td')
:wikitext(item.pagename)
out:done()
out:tag('td')
:done()
:tag('td')
out:wikitext(allWeapons[i].output)
out:done()
:wikitext(item.name)
out:tag('td')
:done()
:tag('td')
out:wikitext(allWeapons[i].facility)
out:done()
:wikitext(item.output)
out:tag('td')
:done()
out:wikitext(allWeapons[i].XP)
:tag('td')
:wikitext(item.facility)
out:done()
out:tag('td')
:done()
out:wikitext(allWeapons[i].KP)
:tag('td')
out:done()
:wikitext(item.XP)
out:tag('td')
:done()
:tag('td')
out:wikitext(allWeapons[i].duration)
out:done()
:wikitext(item.KP)
:done()
:tag('td')
:wikitext(item.duration)
:done()
:done()
:done()
end
end