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(args) |
|||
local p = {} |
|||
function p.minerPages() |
|||
local variants = {'Basic','Moderate','Fine','Strong','Superior','Perfect'} |
|||
local queryString = '[[Variant of::Flint||Andesite||Granite||Basalt||Deathstone||Iron Ore||Cabranese Ore||Adathril Ore||Flantium Ore||Mine Cart Work]]' |
|||
local weapons1 = {'Hammerfist','Throwing Stones','Stone Slab Shield', |
|||
'Stone Mace','Stone Discs','War Hammer', |
|||
return p.main(queryString) |
|||
'Bolas','Stone Chunk Shield','Double Headed Hammer', |
|||
'Throwing Clubs','Great Stone Mace',' Polished Stone Shield', |
|||
end |
|||
'Throwing Hammers','Great Hammer','Sling'} |
|||
local weapons2 = {'Hammerfist','Throwing Stones','Stone Slab Shield', |
|||
function p.foragerPages() |
|||
'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 weapons3 = {'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'} |
|||
weapons = weapons1 |
|||
local queryString = '[[Variant of::Kelp||Wallplant||Periwinkle||Shell||Potato||Pond Weed||Bellplant||Monument Piece||Water Lily||Starfish||Hogberries||Limpet||Nettle||Wrack]]' |
|||
return p.main(queryString) |
|||
end |
|||
function p.gathererPages1() |
|||
local allWeapons = {} |
|||
local queryString = '[[Variant of::Globeplant||Dandelion||Goat Horn||Apple||Leek||Haleberries||Rams Horn||Bitterfruit||Chestnut||Bone Spike]]' |
|||
for i,item in ipairs(variants) do |
|||
for j,jtem in ipairs(weapons) do |
|||
table.insert(allWeapons,{pagename='[[' .. jtem .. ' (' .. item .. ')]]',wrongname='[[' .. item .. ' ' .. jtem .. ']]'}) |
|||
end |
|||
end |
|||
return p.main(queryString) |
|||
for i,item in ipairs(allWeapons) do |
|||
end |
|||
local query = mw.smw.ask(item.pagename .. '|?Uses facility #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
function p.gathererPages2() |
|||
item.facility = query[1].data |
|||
local queryString = '[[Variant of::Tangfruit||Catkin||Femur Shard||Clover||Snake Scale||Orchid||Dock Leaf||Sage||Thistle]]' |
|||
return p.main(queryString) |
|||
end |
|||
function p.main(queryString) |
|||
local query = { |
|||
queryString, |
|||
'? #- = name', |
|||
'?Profession Level A = level', |
|||
'?Variant of #-= variant', |
|||
'sort = Variant of,Profession Level A', |
|||
'limit = 500' |
|||
} |
|||
local results = mw.smw.ask(query) |
|||
for _,page in ipairs(results) do |
|||
if string.find(page.name,'Mine') then |
|||
page.node = page.name |
|||
page.nodevar = page.variant |
|||
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.pagename .. '|?Activity XP #- = data|mainlabel=-') |
|||
page.JSON = (result and result[1] and result[1].data) or '' |
|||
if type( |
if type(query)=='table' then |
||
item.XP = query[1].data |
|||
page.JSON = table.concat(page.JSON,'<br>') |
|||
end |
|||
local query = mw.smw.ask(item.pagename .. '|?Activity duration #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
item.duration = query[1].data |
|||
end |
end |
||
local query = mw.smw.ask(item.pagename .. '|?Activity KP #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
item.KP = query[1].data |
|||
end |
|||
local query = mw.smw.ask(item.pagename .. '|?Recipe output #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
item.output = query[1].data |
|||
end |
|||
local query = mw.smw.ask(item.pagename .. '|?Name #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
item.name = query[1].data |
|||
end |
|||
end |
end |
||
Line 65: | Line 68: | ||
:tag('tr') |
:tag('tr') |
||
:tag('th') |
:tag('th') |
||
:wikitext(' |
:wikitext('Page') |
||
:done() |
:done() |
||
:tag('th') |
:tag('th') |
||
:wikitext(' |
:wikitext('Item name') |
||
:done() |
:done() |
||
:tag('th') |
:tag('th') |
||
:wikitext(' |
:wikitext('Recipe Output') |
||
:done() |
:done() |
||
:tag('th') |
:tag('th') |
||
:wikitext(' |
:wikitext('Facility') |
||
:done() |
:done() |
||
:tag('th') |
:tag('th') |
||
:wikitext(' |
:wikitext('XP') |
||
:done() |
:done() |
||
:tag('th') |
:tag('th') |
||
:wikitext(' |
:wikitext('KP') |
||
:done() |
|||
:tag('th') |
|||
:wikitext('duration') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Wrong Page (shouldnt exist)') |
|||
: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.pagename) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.name) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.output) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.facility) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.XP) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.KP) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.duration) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.wrongname) |
|||
:done() |
|||
:done() |
:done() |
||
:tag('td') |
|||
:wikitext('[['..item.nodevar..']]') |
|||
:done() |
:done() |
||
end |
|||
:tag('td') |
|||
:wikitext(item.level) |
|||
return out |
|||
:done() |
|||
:tag('td') |
|||
--for debugging |
|||
:wikitext('[['..item.name..']]') |
|||
--return '<pre>'..mw.text.jsonEncode(allWeapons, mw.text.JSON_PRETTY)..'</pre>' |
|||
:done() |
|||
:tag('td') |
|||
:wikitext('[['..item.node..']]') |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.JSON) |
|||
:done() |
|||
end |
|||
return out |
|||
end |
end |
||