Module:Sandbox/User:Alsang: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
(make table to check pages and recipes for stonemason) |
(Replaced content with "local p = {} function p.main() return end return p") Tag: Replaced |
||
(84 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
p = {} |
local p = {} |
||
function p.main() |
function p.main() |
||
local variants = {'Basic','Moderate','Fine','Strong','Superior','Perfect'} |
|||
local rocks ={'flint','basalt','andesite','granite','deathstone'} |
|||
local weapons = {'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 allWeapons = {} |
|||
for i,item in ipairs(variants) do |
|||
for j,jtem in ipairs(weapons) do |
|||
table.insert(allWeapons,{name=variants[i] .. ' ' .. weapons[j]}) |
|||
table.insert(allWeapons,{name=weapons[j] .. ' (' .. variants[i] .. ')'}) |
|||
end |
|||
end |
|||
⚫ | |||
for i,item in ipairs(allWeapons) do |
|||
local query = mw.smw.ask('[[Name::' .. item.name .. ']]|?Uses facility #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
allWeapons[i].facility = query[1].data |
|||
end |
|||
local query = mw.smw.ask('[[Name::' .. item.name .. ']]|?Activity XP #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
allWeapons[i].XP = query[1].data |
|||
end |
|||
local query = mw.smw.ask('[[Name::' .. item.name .. ']]|?Activity duration #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
allWeapons[i].duration = query[1].data |
|||
end |
|||
local query = mw.smw.ask('[[Name::' .. item.name .. ']]|?Activity KP #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
allWeapons[i].KP = query[1].data |
|||
end |
|||
local query = mw.smw.ask('[[Name::' .. item.name .. ']]|?Recipe output #- = data|mainlabel=-') |
|||
if type(query)=='table' then |
|||
allWeapons[i].output = query[1].data |
|||
end |
|||
end |
|||
local out = mw.html.create('table') |
|||
out:addClass('wikitable sortable') |
|||
out:tag('th') |
|||
out:wikitext('Page') |
|||
out:done() |
|||
out:tag('th') |
|||
out:wikitext('Output') |
|||
out:done() |
|||
out:tag('th') |
|||
out:wikitext('Facility') |
|||
out:done() |
|||
out:tag('th') |
|||
out:wikitext('XP') |
|||
out:done() |
|||
out:tag('th') |
|||
out:wikitext('KP') |
|||
out:done() |
|||
out:tag('th') |
|||
out:wikitext('duration') |
|||
out:done() |
|||
for i,item in ipairs(allWeapons) do |
|||
out:tag('td') |
|||
out:wikitext('[[' .. item.name .. ']]') |
|||
out:done() |
|||
out:tag('td') |
|||
out:wikitext(allWeapons[i].output) |
|||
out:done() |
|||
out:tag('td') |
|||
out:wikitext(allWeapons[i].facility) |
|||
out:done() |
|||
out:tag('td') |
|||
out:wikitext(allWeapons[i].XP) |
|||
out:done() |
|||
out:tag('td') |
|||
out:wikitext(allWeapons[i].KP) |
|||
out:done() |
|||
out:tag('td') |
|||
out:wikitext(allWeapons[i].duration) |
|||
out:done() |
|||
end |
|||
⚫ | |||
--for debugging |
|||
--return '<pre>'..mw.text.jsonEncode(allWeapons, mw.text.JSON_PRETTY)..'</pre>' |
|||
end |
end |
Latest revision as of 12:51, 6 January 2025
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.