Module:Sandbox/User:Alsang: Difference between revisions

no edit summary
(make table to check pages and recipes for stonemason)
No edit summary
(82 intermediate revisions by the same user not shown)
Line 1:
p = {}
 
p.query = '[[Category:Guardian Equipment]] AND [[Variant type::~*]] AND [[Category:Armorer]]|?#-=name|limit=500'
 
function p.main()
 
local results = mw.smw.ask(p.query)
local out = mw.html.create('table')
local variants = {'Basic','Moderate','Fine','Strong','Superior','Perfect'}
:addClass('wikitable sortable')
local rocks ={'flint','basalt','andesite','granite','deathstone'}
for _,page in ipairs(results) do
local weapons = {'Hammerfist','Throwing Stones','Stone Slab Shield',
out:tag('tr')
'Stone Mace','Stone Discs','War Hammer',
:tag('th')
'Bolas','Stone Chunk Shield','Double Headed Hammer',
:wikitext('[[' .. page.name .. ']]')
'Throwing Clubs','Great Stone Mace',' Polished Stone Shield',
:done()
'Throwing Hammers','Great Hammer','Sling'}
:tag('td')
:wikitext('[[' .. page.name .. ' (basic)]]')
local allWeapons = {}
:done()
for i,item in ipairs(variants) do
:tag('td')
for j,jtem in ipairs(weapons) do
:wikitext('[[' .. page.name .. ' (moderate)]]')
table.insert(allWeapons,{name=variants[i] .. ' ' .. weapons[j]})
:done()
table.insert(allWeapons,{name=weapons[j] .. ' (' .. variants[i] .. ')'})
:tag('td')
end
:wikitext('[[' .. page.name .. ' (fine)]]')
:done()
:tag('td')
:wikitext('[[' .. page.name .. ' (strong)]]')
:done()
:tag('td')
:wikitext('[[' .. page.name .. ' (superior)]]')
:done()
:tag('td')
:wikitext('[[' .. page.name .. ' (perfect)]]')
:done()
:done()
end
return out
end
 
function p.main2()
for i,item in ipairs(allWeapons) do
local queryresults = mw.smw.ask('[[Name::' p.. item.name .. ']]|?Uses facility #- = data|mainlabel=-'query)
if type(query)=='table' then
allWeapons[i].facility = query[1].data
end
local query = mw.smw.ask('[[Name::' .. item.name .. ']]|?Activity XP #- = data|mainlabel=-')
if type(query)=='table' then
allWeapons[i].XP = query[1].data
end
local query = mw.smw.ask('[[Name::' .. item.name .. ']]|?Activity duration #- = data|mainlabel=-')
if type(query)=='table' then
allWeapons[i].duration = query[1].data
end
local query = mw.smw.ask('[[Name::' .. item.name .. ']]|?Activity KP #- = data|mainlabel=-')
if type(query)=='table' then
allWeapons[i].KP = query[1].data
end
local query = mw.smw.ask('[[Name::' .. item.name .. ']]|?Recipe output #- = data|mainlabel=-')
if type(query)=='table' then
allWeapons[i].output = query[1].data
end
end
local out = mw.html.create('table')
out:addClass('wikitable sortable')
for _,page in ipairs(results) do
out:tag('th')
out:wikitexttag('Pagetr')
out :donetag('th')
:attr{ rowspan = '2' }
out:tag('th')
out :wikitext('Output[[' .. page.name .. ']]')
out :done()
out :tag('thtd')
out :wikitext('Facility[[File:' .. page.name .. ' (basic).png]]')
out :done()
out :tag('thtd')
out :wikitext('XP[[File:' .. page.name .. ' (moderate).png]]')
out :done()
out :tag('thtd')
out :wikitext('KP[[File:' .. page.name .. ' (fine).png]]')
out :done()
out :tag('thtd')
out :wikitext('duration[[File:' .. page.name .. ' (strong).png]]')
out :done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (superior).png]]')
for i,item in ipairs(allWeapons) do
out:tagdone('td')
:tag('td')
out:wikitext('[[' .. item.name .. ']]')
:wikitext('[[File:' .. page.name .. ' (perfect).png]]')
out:done()
out:tagdone('td')
:done()
out:wikitext(allWeapons[i].output)
out:donetag('tr')
out:tag('td')
out:wikitext(allWeapons'[i][File:' .facility. page.name .. ' (basic) dye.png]]')
out:done()
out:tag('td')
out:wikitext(allWeapons'[i][File:' .XP. page.name .. ' (moderate) dye.png]]')
out:done()
out:tag('td')
out:wikitext(allWeapons'[i][File:' .KP. page.name .. ' (fine) dye.png]]')
out:done()
out:tag('td')
out:wikitext(allWeapons'[i][File:' .duration. page.name .. ' (strong) dye.png]]')
out:done()
:tag('td')
end
:wikitext('[[File:' .. page.name .. ' (superior) dye.png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (perfect) dye.png]]')
:done()
:done()
end
return out
--for debugging
--return '<pre>'..mw.text.jsonEncode(allWeapons, mw.text.JSON_PRETTY)..'</pre>'
end
 
 
return p
20,118

edits