Editing Module:Sandbox/User:Alsang
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
p = {} |
|||
function p.main() |
|||
local p = {} |
|||
return nil |
|||
end |
|||
function p. |
function p.stone() |
||
return p.makeTable('stone') |
|||
local queryString = '[[Variant of::Globeplant||Dandelion||Apple||Haleberries||Chestnut||Catkin||Clover||Snake Scale||Orchid||Dock Leaf||Sage||Thistle]]' |
|||
return p.main(queryString) |
|||
end |
end |
||
function p. |
function p.metal() |
||
return p.makeTable('metal') |
|||
local queryString = '[[Variant of::Bone Spike||Femur Shard||Goat Horn||Rams Horn]]' |
|||
return p.main(queryString) |
|||
end |
end |
||
function p. |
function p.bone() |
||
return p.makeTable('bone') |
|||
local queryString = '[[Variant of::Leek||Bitterfruit||Tangfruit]]' |
|||
return p.main(queryString) |
|||
end |
end |
||
function p.makeTable(args) |
|||
local variants = {'basic','moderate','fine','strong','superior','perfect'} |
|||
local variants2 = {'Basic','Moderate','Fine','Strong','Superior','Perfect'} |
|||
local weaponsStone = { |
|||
'Hammerfist', |
|||
'Throwing Stones', |
|||
'Stone Slab Shield', |
|||
'Stone Mace', |
|||
'Stone Discs', |
|||
'War Hammer', |
|||
'Bolas', |
|||
'Stone Chunk Shield', |
|||
'Double Headed Hammer', |
|||
'Throwing Clubs', |
|||
'Great Stone Mace', |
|||
' Polished Stone Shield', |
|||
'Throwing Hammers', |
|||
'Great Hammer', |
|||
'Sling'} |
|||
local weaponsMetal = { |
|||
'Rapier ', |
|||
'Throwing Twinblades', |
|||
'Metal Kite Shield', |
|||
'Flanged Mace', |
|||
'Throwing Rings', |
|||
'Shortsword', |
|||
'Metal Javelins', |
|||
'Metal Heater Shield', |
|||
'Longsword', |
|||
'Throwing Knives', |
|||
'Broadsword', |
|||
'Metal Buckler', |
|||
'Throwing Axes', |
|||
'Battleaxe', |
|||
'Metal Bow'} |
|||
local weaponsBone = { |
|||
'Truncheon', |
|||
'Blowpipe', |
|||
'Wooden Round Shield', |
|||
'Cudgel', |
|||
'Javelins', |
|||
'Club', |
|||
'Light Crossbow', |
|||
'Wooden Square Shield', |
|||
'Quarterstaff', |
|||
'Recurve Bow', |
|||
'Spear', |
|||
'Wooden Hexagon Shield', |
|||
'Longbow', |
|||
'Poleaxe', |
|||
'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 |
|||
function p.main(queryString) |
|||
for j,wep in ipairs(weapons) do |
|||
table.insert(allWeapons,{page='[[' .. wep .. ' (' .. var .. ')]]',wrongPage1='[[' .. wep .. ' (' .. variants2[i] .. ')]]',wrongPage2='[[' .. var .. ' ' .. wep .. ']]'}) |
|||
local query = { |
|||
end |
|||
queryString, |
|||
end |
|||
'? #- = name', |
|||
'?Profession Level A = level', |
|||
'?Variant of #-= variant', |
|||
'sort = Variant of,Profession Level A', |
|||
'limit = 500' |
|||
} |
|||
local results = mw.smw.ask(query) |
|||
for |
for i,item in ipairs(allWeapons) do |
||
if string.find(page.name,'Mine') then |
|||
local query = mw.smw.ask(item.page .. '|?Name #- = data|mainlabel=-') |
|||
page.node = page.name |
|||
if type(query)=='table' then |
|||
page.nodevar = page.variant |
|||
item.item = query[1].data |
|||
else |
|||
page.node = page.name .. ' (skill node)' |
|||
page.nodevar = page.variant .. ' (skill node)' |
|||
end |
end |
||
local result = mw.smw.ask('[['..page.node..']]|?Activity JSON = data') |
|||
local query = mw.smw.ask(item.page .. '|?Uses facility #- = data|mainlabel=-') |
|||
page.JSON = (result and result[1] and result[1].data) or '' |
|||
if type( |
if type(query)=='table' then |
||
item.facility = query[1].data |
|||
page.JSON = table.concat(page.JSON,'<br>') |
|||
end |
end |
||
end |
end |
||
Line 48: | Line 110: | ||
:tag('tr') |
:tag('tr') |
||
:tag('th') |
:tag('th') |
||
:wikitext(' |
:wikitext('Name of page') |
||
:done() |
:done() |
||
:tag('th') |
:tag('th') |
||
:wikitext(' |
:wikitext('Item on page') |
||
:done() |
:done() |
||
:tag('th') |
:tag('th') |
||
:wikitext(' |
:wikitext('Recipe Facility') |
||
:done() |
:done() |
||
:tag('th') |
:tag('th') |
||
:wikitext(' |
:wikitext('Incorrect page names') |
||
:done() |
|||
:tag('th') |
|||
:wikitext('Node') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Node JSON') |
|||
:done() |
:done() |
||
:done() |
:done() |
||
for i, item in ipairs(results) do |
|||
local row = out:tag('tr') |
|||
for i,item in ipairs(allWeapons) do |
|||
--level |
|||
:tag(' |
local row = out:tag('tr') |
||
: |
:tag('td') |
||
:wikitext(item.page) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.item) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.facility) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.wrongPage1) |
|||
:wikitext('<br>') |
|||
:wikitext(item.wrongPage2) |
|||
:done() |
|||
:done() |
:done() |
||
:tag('td') |
|||
:wikitext('[['..item.nodevar..']]') |
|||
:done() |
:done() |
||
end |
|||
:tag('td') |
|||
:wikitext(item.level) |
|||
return out |
|||
:done() |
|||
:tag('td') |
|||
:wikitext('[['..item.name..']]') |
|||
:done() |
|||
:tag('td') |
|||
:wikitext('[['..item.node..']]') |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.JSON) |
|||
:done() |
|||
end |
|||
return out |
|||
end |
end |
||