Module:Sandbox/User:Alsang: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
No edit summary
No edit summary
Line 4: Line 4:
local variants = {'Basic','Moderate','Fine','Strong','Superior','Perfect'}
local variants = {'Basic','Moderate','Fine','Strong','Superior','Perfect'}
local weapons = {'Hammerfist','Throwing Stones','Stone Slab Shield',
local weapons1 = {'Hammerfist','Throwing Stones','Stone Slab Shield',
'Stone Mace','Stone Discs','War Hammer',
'Stone Mace','Stone Discs','War Hammer',
'Bolas','Stone Chunk Shield','Double Headed Hammer',
'Bolas','Stone Chunk Shield','Double Headed Hammer',
'Throwing Clubs','Great Stone Mace',' Polished Stone Shield',
'Throwing Clubs','Great Stone Mace',' Polished Stone Shield',
'Throwing Hammers','Great Hammer','Sling'}
'Throwing Hammers','Great Hammer','Sling'}
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'}
weapons = weapons1
local allWeapons = {}
local allWeapons = {}
Line 59: Line 71:
:done()
:done()
:tag('th')
:tag('th')
:wikitext('Wrong Page')
:wikitext('Item name')
:done()
:tag('th')
:wikitext('Item')
:done()
:done()
:tag('th')
:tag('th')
Line 78: Line 87:
:tag('th')
:tag('th')
:wikitext('duration')
:wikitext('duration')
:done()
:tag('th')
:wikitext('Wrong Page (shouldnt exist)')
:done()
:done()
:done()
:done()
Line 85: Line 97:
:tag('td')
:tag('td')
:wikitext(item.pagename)
:wikitext(item.pagename)
:done()
:tag('td')
:wikitext(item.wrongname)
:done()
:done()
:tag('td')
:tag('td')
Line 106: Line 115:
:tag('td')
:tag('td')
:wikitext(item.duration)
:wikitext(item.duration)
:done()
:tag('td')
:wikitext(item.wrongname)
:done()
:done()
Line 173: Line 185:
:done()
:done()
:tag('th')
:tag('th')
:wikitext('Item')
:wikitext('Item name')
:done()
:done()
:tag('th')
:tag('th')
Line 193: Line 205:
:wikitext('duration')
:wikitext('duration')
:done()
: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

function p.metals()
local metals ={'Laterite Iron','Folrian Cabranese','Sylentnite Flantium','Maloic Adathril',
'Limonite Iron','Aulsian Cabranese','Yehrite Flantium','Rigic Adathril',
'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')
:tag('th')
:wikitext('Wrong page name (shouldnt exist)')
: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()
:done()
:done()
for i,item in ipairs(allStones) do
for i,item in ipairs(allMetals) do
local row = out:tag('tr')
local row = out:tag('tr')
:tag('td')
:tag('td')
Line 224: Line 350:
:wikitext(item.duration)
:wikitext(item.duration)
:done()
:done()
:done()
:done()
end
return out
--for debugging
--return '<pre>'..mw.text.jsonEncode(allWeapons, mw.text.JSON_PRETTY)..'</pre>'
end

function p.bones()
local bones ={'Crooked Goat Horn',
'Yellowing Rams Horn',
'Streaky Bone Spike',
'Cracked Femur Shard',
'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
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(allBones) do
local row = out:tag('tr')
:tag('td')
:tag('td')
:wikitext(item.wrongname)
: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()