Module:Sandbox/User:Alsang: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
No edit summary |
No edit summary |
||
(54 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
p = {} |
|||
local p = {} |
|||
function p.main(args) |
|||
function p.minerPages() |
|||
local queryString = '[[Variant of::Flint||Andesite||Granite||Basalt||Deathstone||Iron Ore||Cabranese Ore||Adathril Ore||Flantium Ore||Mine Cart Work]]' |
|||
local variants = {'Basic','Moderate','Fine','Strong','Superior','Perfect'} |
|||
local weapons1 = {'Hammerfist','Throwing Stones','Stone Slab Shield', |
|||
return p.main(queryString) |
|||
'Stone Mace','Stone Discs','War Hammer', |
|||
'Bolas','Stone Chunk Shield','Double Headed Hammer', |
|||
end |
|||
'Throwing Clubs','Great Stone Mace',' Polished Stone Shield', |
|||
'Throwing Hammers','Great Hammer','Sling'} |
|||
function p.foragerPages() |
|||
local weapons2 = {'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 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'} |
|||
local queryString = '[[Variant of::Kelp||Wallplant||Periwinkle||Shell||Potato||Pond Weed||Bellplant||Monument Piece||Water Lily||Starfish||Hogberries||Limpet||Nettle||Wrack]]' |
|||
weapons = weapons1 |
|||
return p.main(queryString) |
|||
local allWeapons = {} |
|||
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 |
|||
for i,item in ipairs(allWeapons) do |
|||
local query = mw.smw.ask(item.pagename .. '|?Uses facility #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
item.facility = query[1].data |
|||
end |
|||
local query = mw.smw.ask(item.pagename .. '|?Activity XP #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
item.XP = query[1].data |
|||
end |
|||
local query = mw.smw.ask(item.pagename .. '|?Activity duration #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
item.duration = query[1].data |
|||
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 |
|||
local out = mw.html.create('table') |
|||
:addClass('wikitable sortable') |
|||
:tag('tr') |
|||
:tag('th') |
|||
:wikitext('Page') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Item name') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Recipe Output') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Facility') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('XP') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('KP') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('duration') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Wrong Page (shouldnt exist)') |
|||
:done() |
|||
:done() |
|||
for i,item in ipairs(allWeapons) do |
|||
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() |
|||
end |
|||
return out |
|||
--for debugging |
|||
--return '<pre>'..mw.text.jsonEncode(allWeapons, mw.text.JSON_PRETTY)..'</pre>' |
|||
end |
end |
||
function p. |
function p.gathererPages1() |
||
local queryString = '[[Variant of::Globeplant||Dandelion||Goat Horn||Apple||Leek||Haleberries||Rams Horn||Bitterfruit||Chestnut||Bone Spike]]' |
|||
local variants = {'Coarse','Rugged','Average','Fine','Sturdy','Perfect'} |
|||
local stones ={'Flint','Basalt','Andesite','Granite','Deathstone'} |
|||
return p.main(queryString) |
|||
local allStones = {} |
|||
for i,item in ipairs(variants) do |
|||
for j,jtem in ipairs(stones) do |
|||
table.insert(allStones,{pagename='[[' .. item .. ' ' .. jtem .. ' (Etched)]]',resource='[[' .. item .. ' ' .. jtem .. ']]'}) |
|||
end |
|||
end |
|||
for i,item in ipairs(allStones) do |
|||
local query = mw.smw.ask(item.pagename .. '|?Uses facility #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
item.facility = query[1].data |
|||
end |
|||
local query = mw.smw.ask(item.pagename .. '|?Activity XP #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
item.XP = query[1].data |
|||
end |
|||
local query = mw.smw.ask(item.pagename .. '|?Activity duration #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
item.duration = query[1].data |
|||
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 |
|||
local out = mw.html.create('table') |
|||
:addClass('wikitable sortable') |
|||
:tag('tr') |
|||
:tag('th') |
|||
:wikitext('Page name') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Item name') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Resource') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Recipe Output') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Facility') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('XP') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('KP') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('duration') |
|||
:done() |
|||
:done() |
|||
for i,item in ipairs(allStones) do |
|||
local row = out:tag('tr') |
|||
:tag('td') |
|||
:wikitext(item.pagename) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.name) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.resource) |
|||
: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() |
|||
:done() |
|||
:done() |
|||
end |
|||
return out |
|||
--for debugging |
|||
--return '<pre>'..mw.text.jsonEncode(allWeapons, mw.text.JSON_PRETTY)..'</pre>' |
|||
end |
end |
||
function p. |
function p.gathererPages2() |
||
local queryString = '[[Variant of::Tangfruit||Catkin||Femur Shard||Clover||Snake Scale||Orchid||Dock Leaf||Sage||Thistle]]' |
|||
local metals ={'Laterite Iron','Folrian Cabranese','Sylentnite Flantium','Maloic Adathril', |
|||
'Limonite Iron','Aulsian Cabranese','Yehrite Flantium','Rigic Adathril', |
|||
return p.main(queryString) |
|||
'Goethite Iron','Babian Cabranese','Holmitite Flantium','Portoic Adathril', |
|||
'Hematite Iron','Morian Cabranese','Amirite Flantium','Caric Adathril', |
|||
'Magnetite Iron','Shaprian Cabranese','Eysite Flantium','Masic Adathril', |
|||
'Siderite Iron','Temberian Cabranese','Seethalite Flantium','Fortoic Adathril'} |
|||
local allMetals = {} |
|||
for i,item in ipairs(metals) do |
|||
table.insert(allMetals,{pagename='[[' .. item .. ' Ingot]]',resource='[[' .. item .. ' Ore]]'}) |
|||
end |
|||
for i,item in ipairs(allMetals) do |
|||
local query = mw.smw.ask(item.pagename .. '|?Uses facility #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
item.facility = query[1].data |
|||
end |
|||
local query = mw.smw.ask(item.pagename .. '|?Activity XP #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
item.XP = query[1].data |
|||
end |
|||
local query = mw.smw.ask(item.pagename .. '|?Activity duration #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
item.duration = query[1].data |
|||
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 |
|||
local out = mw.html.create('table') |
|||
:addClass('wikitable sortable') |
|||
:tag('tr') |
|||
:tag('th') |
|||
:wikitext('Page name') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Item name') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Resource') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Recipe Output') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Facility') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('XP') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('KP') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('duration') |
|||
:done() |
|||
:done() |
|||
for i,item in ipairs(allMetals) do |
|||
local row = out:tag('tr') |
|||
:tag('td') |
|||
:wikitext(item.pagename) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.name) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.resource) |
|||
: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() |
|||
:done() |
|||
:done() |
|||
end |
|||
return out |
|||
--for debugging |
|||
--return '<pre>'..mw.text.jsonEncode(allWeapons, mw.text.JSON_PRETTY)..'</pre>' |
|||
end |
end |
||
function p. |
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 |
|||
local bones ={'Crooked Goat Horn', |
|||
if string.find(page.name,'Mine') then |
|||
'Yellowing Rams Horn', |
|||
page.node = page.name |
|||
'Streaky Bone Spike', |
|||
else |
|||
'Cracked Femur Shard', |
|||
page.node = page.name .. ' (skill node)' |
|||
'Gray Goat Horn', |
|||
'Mottled Rams Horn', |
|||
'Dappled Bone Spike', |
|||
'Dusty Femur Shard', |
|||
'Ridged Goat Horn', |
|||
'Sturdy Rams Horn', |
|||
'Bistre Bone Spike', |
|||
'Weathered Femur Shard', |
|||
'Smooth Goat Horn', |
|||
'Chunky Rams Horn', |
|||
'Pointed Bone Spike', |
|||
'Striated Femur Shard', |
|||
'Long Goat Horn', |
|||
'Pristine Rams Horn', |
|||
'Jagged Bone Spike', |
|||
'Sharp Femur Shard', |
|||
'Robust Goat Horn', |
|||
'Immaculate Rams Horn', |
|||
'Razor Bone Spike', |
|||
'Chunky Femur Shard'} |
|||
local allBones = {} |
|||
for i,item in ipairs(bones) do |
|||
table.insert(allBones,{pagename='[[' .. item .. ' (Brewed)]]',resource='[[' .. item .. ']]'}) |
|||
end |
|||
for i,item in ipairs(allBones) do |
|||
local query = mw.smw.ask(item.pagename .. '|?Uses facility #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
item.facility = query[1].data |
|||
end |
end |
||
local result = mw.smw.ask('[['..page.node..']]|?Activity JSON = data') |
|||
page.JSON = (result and result[1] and result[1].data) or '' |
|||
local query = mw.smw.ask(item.pagename .. '|?Activity XP #- = data|mainlabel=-') |
|||
if type( |
if type(page.JSON)=='table' then |
||
page.JSON = table.concat(page.JSON,'<br>') |
|||
item.XP = query[1].data |
|||
end |
end |
||
local query = mw.smw.ask(item.pagename .. '|?Activity duration #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
item.duration = query[1].data |
|||
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 433: | Line 63: | ||
:tag('tr') |
:tag('tr') |
||
:tag('th') |
:tag('th') |
||
:wikitext(' |
:wikitext('Variant') |
||
:done() |
:done() |
||
:tag('th') |
:tag('th') |
||
:wikitext(' |
:wikitext('Level') |
||
:done() |
:done() |
||
:tag('th') |
:tag('th') |
||
:wikitext(' |
:wikitext('Page') |
||
:done() |
:done() |
||
:tag('th') |
:tag('th') |
||
:wikitext(' |
:wikitext('Node') |
||
:done() |
:done() |
||
:tag('th') |
:tag('th') |
||
:wikitext(' |
:wikitext('Node JSON') |
||
:done() |
|||
:tag('th') |
|||
:wikitext('XP') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('KP') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('duration') |
|||
:done() |
:done() |
||
:done() |
:done() |
||
for i,item in ipairs(allBones) do |
|||
local row = out:tag('tr') |
|||
:tag('td') |
|||
:wikitext(item.pagename) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.name) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.resource) |
|||
: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() |
|||
:done() |
|||
:done() |
|||
end |
|||
return out |
|||
--for debugging |
|||
--return '<pre>'..mw.text.jsonEncode(allWeapons, mw.text.JSON_PRETTY)..'</pre>' |
|||
end |
|||
for i, item in ipairs(results) do |
|||
function p.metalgoods() |
|||
local row = out:tag('tr') |
|||
allJewels = { |
|||
{pagename = '[[Bangle Shinerium Jewelry]]', lvl = 20, tablematerial = '[[Softglow Shinerium]]'}, |
|||
{pagename = '[[Locket Shinerium Jewelry]]', lvl = 26, tablematerial = '[[Softglow Shinerium]]'}, |
|||
{pagename = '[[Circlet Shinerium Jewelry]]', lvl = 32, tablematerial = '[[Glitterstream Shinerium]]'}, |
|||
{pagename = '[[Bangle Silver Jewelry]]', lvl = 39, tablematerial = '[[Winterspirit Silver]]'}, |
|||
{pagename = '[[Locket Silver Jewelry]]', lvl = 43, tablematerial = '[[Winterspirit Silver]]'}, |
|||
{pagename = '[[Earrings Shinerium Jewelry]]', lvl = 49, tablematerial = '[[Glitterstream Shinerium]]'}, |
|||
{pagename = '[[Pendant Shinerium Jewelry]]', lvl = 56, tablematerial = '[[Firefly Shinerium]]'}, |
|||
{pagename = '[[Necklace Shinerium Jewelry]]', lvl = 60, tablematerial = '[[Firefly Shinerium]]'}, |
|||
{pagename = '[[Earrings Silver Jewelry]]', lvl = 67, tablematerial = '[[Brightspire Silver]]'}, |
|||
{pagename = '[[Locket Gold Jewelry]]', lvl = 73, tablematerial = '[[Hearthlight Gold]]'}, |
|||
{pagename = '[[Necklace Silver Jewelry]]', lvl = 77, tablematerial = '[[Brightspire Silver]]'}, |
|||
{pagename = '[[Earrings Gold Jewelry]]', lvl = 84, tablematerial = '[[Hearthlight Gold]]'}, |
|||
{pagename = '[[Circlet Silver Jewelry]]', lvl = 90, tablematerial = '[[Gallant Silver]]'}, |
|||
{pagename = '[[Ring Shinerium Jewelry]]', lvl = 95, tablematerial = '[[Resplendent Shinerium]]'}, |
|||
{pagename = '[[Choker Shinerium Jewelry]]', lvl = 101, tablematerial = '[[Resplendent Shinerium]]'}, |
|||
{pagename = '[[Earrings Purpladium Jewelry]]', lvl = 107, tablematerial = '[[Violet Purpladium]]'}, |
|||
{pagename = '[[Ring Silver Jewelry]]', lvl = 112, tablematerial = '[[Gallant Silver]]'}, |
|||
{pagename = '[[Pendant Silver Jewelry]]', lvl = 118, tablematerial = '[[Fullmoon Silver]]'}, |
|||
{pagename = '[[Bangle Gold Jewelry]]', lvl = 122, tablematerial = '[[Lionsmane Gold]]'}, |
|||
{pagename = '[[Ring Gold Jewelry]]', lvl = 129, tablematerial = '[[Lionsmane Gold]]'}, |
|||
{pagename = '[[Choker Silver Jewelry]]', lvl = 135, tablematerial = '[[Fullmoon Silver]]'}, |
|||
{pagename = '[[Necklace Gold Jewelry]]', lvl = 140, tablematerial = '[[Hightower Gold]]'}, |
|||
{pagename = '[[Ring Purpladium Jewelry]]', lvl = 146, tablematerial = '[[Violet Purpladium]]'}, |
|||
{pagename = '[[Bracelet Shinerium Jewelry]]', lvl = 152, tablematerial = '[[Lastwish Shinerium]]'}, |
|||
{pagename = '[[Signet Ring Shinerium Jewelry]]', lvl = 157, tablematerial = '[[Lastwish Shinerium]]'}, |
|||
{pagename = '[[Choker Gold Jewelry]]', lvl = 163, tablematerial = '[[Hightower Gold]]'}, |
|||
{pagename = '[[Locket Purpladium Jewelry]]', lvl = 169, tablematerial = '[[Mulberry Purpladium]]'}, |
|||
{pagename = '[[Bracelet Silver Jewelry]]', lvl = 174, tablematerial = '[[Whitestar Silver]]'}, |
|||
{pagename = '[[Signet Ring Silver Jewelry]]', lvl = 180, tablematerial = '[[Whitestar Silver]]'}, |
|||
{pagename = '[[Choker Purpladium Jewelry]]', lvl = 187, tablematerial = '[[Mulberry Purpladium]]'}, |
|||
{pagename = '[[Cuff Links Shinerium Jewelry]]', lvl = 191, tablematerial = '[[Constellation Shinerium]]'}, |
|||
{pagename = '[[Bracelet Gold Jewelry]]', lvl = 197, tablematerial = '[[Morningsun Gold]]'}, |
|||
{pagename = '[[Signet Ring Gold Jewelry]]', lvl = 206}, |
|||
{pagename = '[[Brooch Shinerium Jewelry]]', lvl = 226}, |
|||
{pagename = '[[Necklace Purpladium Jewelry]]', lvl = 247}, |
|||
{pagename = '[[Circlet Gold Jewelry]]', lvl = 260}, |
|||
{pagename = '[[Bangle Purpladium Jewelry]]', lvl = 280}, |
|||
{pagename = '[[Pendant Gold Jewelry]]', lvl = 301}, |
|||
{pagename = '[[Cuff Links Silver Jewelry]]', lvl = 314}, |
|||
{pagename = '[[Brooch Silver Jewelry]]', lvl = 334}, |
|||
{pagename = '[[Signet Ring Purpladium Jewelry]]', lvl = 355}, |
|||
{pagename = '[[Bracelet Purpladium Jewelry]]', lvl = 368}, |
|||
{pagename = '[[Circlet Purpladium Jewelry]]', lvl = 388}, |
|||
{pagename = '[[Brooch Gold Jewelry]]', lvl = 409}, |
|||
{pagename = '[[Cuff Links Gold Jewelry]]', lvl = 422}, |
|||
{pagename = '[[Pendant Purpladium Jewelry]]', lvl = 442}, |
|||
{pagename = '[[Brooch Purpladium Jewelry]]', lvl = 463}, |
|||
{pagename = '[[Cuff Links Purpladium Jewelry]]', lvl = 476}, |
|||
} |
|||
for i,item in ipairs(allJewels) do |
|||
--level |
|||
local query = mw.smw.ask(item.pagename .. '|?Uses facility #- = data|mainlabel=-') |
|||
:tag('td') |
|||
if type(query)=='table' then |
|||
:wikitext(item.variant) |
|||
item.facility = query[1].data |
|||
end |
|||
local query = mw.smw.ask(item.pagename .. '|?Activity XP #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
item.XP = query[1].data |
|||
end |
|||
local query = mw.smw.ask(item.pagename .. '|?Activity duration #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
item.duration = query[1].data |
|||
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 .. '|?Uses item #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
item.input = 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 |
|||
local query = mw.smw.ask(item.pagename .. '|?Profession Level A #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
item.recipelvl = query[1].data |
|||
end |
|||
end |
|||
local out = mw.html.create('table') |
|||
:addClass('wikitable sortable') |
|||
:tag('tr') |
|||
:tag('th') |
|||
:wikitext('Page name') |
|||
:done() |
:done() |
||
:tag(' |
:tag('td') |
||
:wikitext( |
:wikitext(item.level) |
||
:done() |
:done() |
||
:tag(' |
:tag('td') |
||
:wikitext(' |
:wikitext('[['..item.name..']]') |
||
:done() |
:done() |
||
:tag(' |
:tag('td') |
||
:wikitext(' |
:wikitext('[['..item.node..']]') |
||
:done() |
:done() |
||
:tag(' |
:tag('td') |
||
:wikitext( |
:wikitext(item.JSON) |
||
:done() |
:done() |
||
end |
|||
:wikitext('Recipe Resource') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Facility') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Item lvl') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('XP') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('KP') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('duration') |
|||
:done() |
|||
:done() |
|||
for i,item in ipairs(allJewels) do |
|||
local row = out:tag('tr') |
|||
:tag('td') |
|||
:wikitext(item.pagename) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.lvl) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.tablematerial) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.name) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.output) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.input[1]) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.facility) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.recipelvl) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.XP) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.KP) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.duration) |
|||
:done() |
|||
:done() |
|||
:done() |
|||
end |
|||
return out |
return out |
||
--for debugging |
|||
--return '<pre>'..mw.text.jsonEncode(allWeapons, mw.text.JSON_PRETTY)..'</pre>' |
|||
end |
end |
||
Latest revision as of 00:24, 21 December 2024
Module documentation
This documentation is transcluded from Module:Sandbox/User:Alsang/doc. [edit] [history] [purge]
This module does not have any documentation. Please consider adding documentation at Module:Sandbox/User:Alsang/doc. [edit]
Module:Sandbox/User:Alsang's function main is invoked by Template:Sandbox/User:Alsang.
local p = {}
function p.minerPages()
local queryString = '[[Variant of::Flint||Andesite||Granite||Basalt||Deathstone||Iron Ore||Cabranese Ore||Adathril Ore||Flantium Ore||Mine Cart Work]]'
return p.main(queryString)
end
function p.foragerPages()
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 queryString = '[[Variant of::Globeplant||Dandelion||Goat Horn||Apple||Leek||Haleberries||Rams Horn||Bitterfruit||Chestnut||Bone Spike]]'
return p.main(queryString)
end
function p.gathererPages2()
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
else
page.node = page.name .. ' (skill node)'
end
local result = mw.smw.ask('[['..page.node..']]|?Activity JSON = data')
page.JSON = (result and result[1] and result[1].data) or ''
if type(page.JSON)=='table' then
page.JSON = table.concat(page.JSON,'<br>')
end
end
local out = mw.html.create('table')
:addClass('wikitable sortable')
:tag('tr')
:tag('th')
:wikitext('Variant')
:done()
:tag('th')
:wikitext('Level')
:done()
:tag('th')
:wikitext('Page')
:done()
:tag('th')
:wikitext('Node')
:done()
:tag('th')
:wikitext('Node JSON')
:done()
:done()
for i, item in ipairs(results) do
local row = out:tag('tr')
--level
:tag('td')
:wikitext(item.variant)
:done()
:tag('td')
:wikitext(item.level)
:done()
:tag('td')
:wikitext('[['..item.name..']]')
:done()
:tag('td')
:wikitext('[['..item.node..']]')
:done()
:tag('td')
:wikitext(item.JSON)
:done()
end
return out
end
return p