To use this Module, use the wrapper template Template:Item uses.
Usage
Pass the item you want the list for as the first argument, like so:
{{Item uses|Portable Lab}}
Which gives:
Research Costs Part 1 1
Combat Ready Part 2 1
Everything is Crystals Part 2 1
Increase Safe Pocket Size 7.1 1
K-Marks Generator Cap 6.3 2
Supply Crate Level 7.2 1
local p = {} --p stands for package
p.loadedData = mw.loadJsonData( "Module:Item infobox/itemData.json" )
local args = mw.getCurrentFrame().args
-- find the item data for our input arg
for k, v in pairs(p.loadedData) do
if args[1] == v["inGameName"] then
if args[2] == nil or args[2] == '' then
p.data = p.loadedData[k]
break
end
end
end
function p.main( frame )
local useData = p.data['uses']
local wikitext = ''
-- missions
local missionData = useData['missions']
for index, value in pairs(missionData) do
local name = mw.text.split(value['inGameName'], " Part ", true)
wikitext = wikitext .. '[[' .. name[1] .. '#Part_' .. name[2] .. '-0|' .. value['inGameName'] .. ']] ' .. value['amount'] .. '<br>'
end
-- jobs
local jobData = useData['jobs']
for index, value in pairs(jobData) do
wikitext = wikitext .. '[[' .. value['inGameName'] .. ']] ' .. value['amount'] .. '<br>'
end
-- quarters
local quarterData = useData['quarters']
for index, value in pairs(quarterData) do
wikitext = wikitext .. '[[Personal Quarters|' .. value['inGameName'] .. ']] ' .. value['amount'] .. '<br>'
end
-- forge
local forgeData = useData['forge']
for index, value in pairs(forgeData) do
wikitext = wikitext .. '{{Icon|' .. value['inGameName'] .. '}} [[The Forge|' .. value['inGameName'] .. ']] ' .. value['amount'] .. '<br>'
end
-- printing
local printData = useData['printing']
for index, value in pairs(printData) do
wikitext = wikitext .. '{{Icon link|' .. value['inGameName'] .. '}} ' .. value['amount'] .. '<br>'
end
return frame:preprocess(wikitext)
end
return p