Module:Sandbox/User:Alsang: Difference between revisions

no edit summary
No edit summary
No edit summary
(45 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 weaponsStoneresults = {mw.smw.ask(p.query)
'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'}
local out = mw.html.create('table')
:addClass('wikitable sortable')
for _,page in ipairs(results) do
:tag('tr')
out:tag('tr')
:tag('th')
:wikitext('Stone[[' .. page.name .. ']]')
:done()
:tag('thtd')
:wikitext('Metal[[' .. page.name .. ' (basic)]]')
:done()
:tag('thtd')
:wikitext('Bone[[' .. page.name .. ' (moderate)]]')
:done()
:donetag('td')
:wikitext('[[' .. page.name .. ' (fine)]]')
for i,item in ipairs(weaponsStone) do
local row = out:tag('tr')
:tag('td')
:wikitext('[[' .. weaponsStone[i] .. ']]')
:done()
:tag('td')
:wikitext('[[' .. weaponsMetal[i] .. ']]')
:done()
:tag('td')
:wikitext('[[' .. weaponsBone[i] .. ']]')
:done()
:done()
:tag('td')
end
: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.intermediatesmain2()
local results = mw.smw.ask(p.query)
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',
'Potent Potion Station',
'Passive Potion Station',
'Workbench',
'One Handed Ranged Workbench (stonemason)',
'One Handed Melee Workbench (stonemason)',
'Two Handed Ranged Workbench (stonemason)',
'Two Handed Melee Workbench (stonemason)',
'Shield Work Rock',
'Stoneware Bench',
'One Handed Ranged Workbench (bonewright)',
'One Handed Melee Workbench (bonewright)',
'Two Handed Ranged Workbench (bonewright)',
'Two Handed Melee Workbench (bonewright)',
'Shield Vice',
'Knickknacks Workbench',
'Bone Grinder',
'Goblin Forge',
'Gnome Forge',
'Jewelry Bench'}
local allShops = {'Head Chef (shop)','Timber Merchant Shop','Leather Stall','Leather Goods','Waiter'}
local intermediateRecipes = {}
for _,item in ipairs(allRecipes) do
intermediate = true
-- check facility
for _,facility in ipairs(allFacilities) do
if item.facility==facility then
intermediate = false
end
-- check shops
for _,shop in ipairs(allShops) do
if item.seller==shop then
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
if intermediate then
table.insert(intermediateRecipes,item)
end
end
local out = mw.html.create('table')
:addClass('wikitable sortable')
for _,page in ipairs(results) do
:tag('tr')
out:tag('tr')
:tag('th')
:wikitext(attr{ rowspan = 'Page2') }
:wikitext('[[' .. page.name .. ']]')
:done()
:tag('thtd')
:wikitext('Variant[[File:' .. page.name .. ' (basic).png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (moderate).png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (fine).png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (strong).png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (superior).png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (perfect).png]]')
:done()
:done()
:tag('tr')
:tag('td')
for i,item in ipairs(intermediateRecipes) do
:wikitext('[[File:' .. page.name .. ' (basic) dye.png]]')
local row = out:tag('tr')
:tag('td')
:wikitext('[[' .. item.name .. ']]')
:done()
:tag('td')
:wikitext(item.variant)
:done()
:done()
:tag('td')
end
:wikitext('[[File:' .. page.name .. ' (moderate) dye.png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (fine) dye.png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (strong) dye.png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (superior) dye.png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (perfect) dye.png]]')
:done()
:done()
end
return out
end
 
 
return p
20,118

edits