Module:Shiren 3 Wii Dungeon Items table: Difference between revisions
Jump to navigation
Jump to search
(Created page with "-------------------------------------------------------------------------------- -- -- Module:Shiren 3 Dungeon Items table -- -------------------------------------------------------------------------------- local p = {} local mw = require('mw') function p.main(frame) local args = frame.args local categoryArg = args["category"] local themeArg = args["theme"] local output = {} -- Header row table.insert(output, '<table class="templateTheme" style="text-align: cen...") |
mNo edit summary |
||
Line 14: | Line 14: | ||
local output = {} | local output = {} | ||
-- Header row | -- Header row | ||
table.insert(output, '<table class="templateTheme" style="text-align: center; width: 100%;">') | if themeArg then | ||
table.insert(output, '<table class="templateTheme shiren3' .. frame:preprocess('{{lc:' .. themeArg .. '}}') .. '" style="text-align: center; width: 100%;">') | |||
else | |||
table.insert(output, '<table class="templateTheme" style="text-align: center; width: 100%;">') | |||
end | |||
table.insert(output, '<tr>') | table.insert(output, '<tr>') | ||
if categoryArg then | if categoryArg then | ||
table.insert(output, '<th class="templatePrimary" colspan="4" style="border-radius: 1rem 1rem 0 0; height:7.5rem;">[[File:Shiren 3 - ' .. frame:preprocess('{{#switch:' .. categoryArg .. ' | Armbands=Armband | Weapons=Weapon | Shields=Shield | Herbs=Herb | Riceballs=Riceball | Monster Meats=Monster Meat | Jars=Jar | Projectiles=Arrows | Scrolls=Scroll | Staves=Staff | Traps=Trap | Miscellaneous=Jar Fragment | Gitan=Gitan Bag | #default={{{category|}}} }}') .. '.png|50x50px]]<br>' .. frame:expandTemplate{title = "Shiren3Wii", args = {(categoryArg or "")}} .. '</th>') | |||
else | else | ||
table.insert(output, '<th class="templatePrimary" colspan="4" style="border-radius: 1rem 1rem 0 0; height:7.5rem;">' .. frame:expandTemplate{title = "Research"} .. '</th>') | |||
end | end | ||
table.insert(output, '</tr>') | table.insert(output, '</tr>') |
Revision as of 20:41, 30 March 2023
This template generates a list of items present in a dungeon for Shiren the Wanderer 3.
Usage
{{#invoke:Shiren 3 Wii Dungeon Items table|main | type = | category = | item_1 = ... | item_n = }}
Example
{{#invoke:Shiren 3 Wii Dungeon Items table|main | type = past | category = Scroll | item_1 = Escape Scroll | item_2 = Light Scroll }}
File:Shiren 3 - Scroll.png Scroll | |||
---|---|---|---|
English | Japanese | Floors | Item Frequency |
Escape Scroll | Script error: No such module "Shiren 3 Item Data Cell". | [Research required] | [Research required] |
Light Scroll | Script error: No such module "Shiren 3 Item Data Cell". | [Research required] | [Research required] |
--------------------------------------------------------------------------------
--
-- Module:Shiren 3 Dungeon Items table
--
--------------------------------------------------------------------------------
local p = {}
local mw = require('mw')
function p.main(frame)
local args = frame.args
local categoryArg = args["category"]
local themeArg = args["theme"]
local output = {}
-- Header row
if themeArg then
table.insert(output, '<table class="templateTheme shiren3' .. frame:preprocess('{{lc:' .. themeArg .. '}}') .. '" style="text-align: center; width: 100%;">')
else
table.insert(output, '<table class="templateTheme" style="text-align: center; width: 100%;">')
end
table.insert(output, '<tr>')
if categoryArg then
table.insert(output, '<th class="templatePrimary" colspan="4" style="border-radius: 1rem 1rem 0 0; height:7.5rem;">[[File:Shiren 3 - ' .. frame:preprocess('{{#switch:' .. categoryArg .. ' | Armbands=Armband | Weapons=Weapon | Shields=Shield | Herbs=Herb | Riceballs=Riceball | Monster Meats=Monster Meat | Jars=Jar | Projectiles=Arrows | Scrolls=Scroll | Staves=Staff | Traps=Trap | Miscellaneous=Jar Fragment | Gitan=Gitan Bag | #default={{{category|}}} }}') .. '.png|50x50px]]<br>' .. frame:expandTemplate{title = "Shiren3Wii", args = {(categoryArg or "")}} .. '</th>')
else
table.insert(output, '<th class="templatePrimary" colspan="4" style="border-radius: 1rem 1rem 0 0; height:7.5rem;">' .. frame:expandTemplate{title = "Research"} .. '</th>')
end
table.insert(output, '</tr>')
table.insert(output, '<tr>')
table.insert(output, '<th class="templatePrimary" style="width: 25%;">English</th>')
table.insert(output, '<th class="templatePrimary" style="width: 25%;">Japanese</th>')
table.insert(output, '<th class="templatePrimary" style="width: 25%;">Floors</th>')
table.insert(output, '<th class="templatePrimary" style="width: 25%;">Item<br>Frequency</th>')
table.insert(output, '</tr>')
-- Data rows
for i = 1, 100 do
local itemArg = args["item_" .. i]
local floorArg = args["floor_" .. i]
local frequencyArg = args["frequency_" .. i]
if not itemArg and not floorArg and not frequencyArg then
break -- exit loop when no more rows are found
end
local rowData = {}
table.insert(rowData, '<tr class="itemsTableRow">')
if itemArg then
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Shiren3Wii", args = {(itemArg or "")}} .. '</td>')
else
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Research"} .. '</td>')
end
if itemArg then
table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Shiren 3 Item Data Cell|shiren3ItemDataCell|name=' .. (itemArg or "") .. '}}') .. '</td>')
else
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Research"} .. '</td>')
end
table.insert(rowData, '<td class="templateSecondary">' .. (floorArg or frame:expandTemplate{title = "Research"}) .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. (frequencyArg or frame:expandTemplate{title = "Research"}) .. '</td>')
table.insert(rowData, '</tr>')
table.insert(output, table.concat(rowData))
end
table.insert(output, '</table>')
return table.concat(output)
end
return p