Module:Sandbox/User:Alsang: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
No edit summary Tag: Manual revert |
No edit summary |
||
Line 2: | Line 2: | ||
function p.main() |
function p.main() |
||
return nil |
|||
end |
|||
function p.stone() |
|||
return p.makeTable('stone') |
|||
end |
|||
function p.metal() |
|||
return p.makeTable('metal') |
|||
end |
|||
function p.bone() |
|||
return p.makeTable('bone') |
|||
end |
|||
function p.makeTable(args) |
|||
local variants = {'basic','moderate','fine','strong','superior','perfect'} |
|||
local variants2 = {'Basic','Moderate','Fine','Strong','Superior','Perfect'} |
|||
local weaponsStone = { |
local weaponsStone = { |
||
'Hammerfist', |
'Hammerfist', |
||
Line 69: | Line 51: | ||
'Poleaxe', |
'Poleaxe', |
||
'Heavy Crossbow'} |
'Heavy Crossbow'} |
||
if args=='stone' then |
|||
weapons = weaponsStone |
|||
elseif args=='metal' then |
|||
weapons = weaponsMetal |
|||
elseif args=='bone' then |
|||
weapons = weaponsBone |
|||
else |
|||
return nil |
|||
end |
|||
local allWeapons = {} |
|||
for j,wep in ipairs(weapons) do |
|||
table.insert(allWeapons,{page='[[' .. wep .. ']]'}) |
|||
end |
|||
for i,var in ipairs(variants) do |
|||
for j,wep in ipairs(weapons) do |
|||
table.insert(allWeapons,{page='[[' .. wep .. ' (' .. var .. ')]]',wrong='[[' .. wep .. ' (' .. variants2[i] .. ')]]',redirect='[[' .. variants2[i] .. ' ' .. wep .. ']]'}) |
|||
end |
|||
end |
|||
for i,item in ipairs(allWeapons) do |
|||
local query = mw.smw.ask(item.page .. '|?Name #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
item.item = query[1].data |
|||
end |
|||
local query = mw.smw.ask(item.page .. '|?Uses facility #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
item.facility = query[1].data |
|||
end |
|||
end |
|||
local out = mw.html.create('table') |
local out = mw.html.create('table') |
||
Line 110: | Line 56: | ||
:tag('tr') |
:tag('tr') |
||
:tag('th') |
:tag('th') |
||
:wikitext(' |
:wikitext('Stone') |
||
:done() |
:done() |
||
:tag('th') |
:tag('th') |
||
:wikitext(' |
:wikitext('Metal') |
||
:done() |
:done() |
||
:tag('th') |
:tag('th') |
||
:wikitext(' |
:wikitext('Bone') |
||
:done() |
|||
:tag('th') |
|||
:wikitext('Redirect page') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Incorrect page name') |
|||
:done() |
:done() |
||
:done() |
:done() |
||
for i,item in ipairs( |
for i,item in ipairs(weaponsStone) do |
||
local row = out:tag('tr') |
local row = out:tag('tr') |
||
:tag('td') |
:tag('td') |
||
:wikitext( |
:wikitext('[[' .. weaponsStone[i] .. ']]') |
||
:done() |
:done() |
||
:tag('td') |
:tag('td') |
||
:wikitext( |
:wikitext('[[' .. weaponsMetal[i] .. ']]') |
||
:done() |
:done() |
||
:tag('td') |
:tag('td') |
||
:wikitext( |
:wikitext('[[' .. weaponsBone[i] .. ']]') |
||
:done() |
|||
:tag('td') |
|||
:wikitext(item.redirect) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.wrong) |
|||
:done() |
:done() |
||
:done() |
|||
:done() |
:done() |
||
end |
end |