Module:Etrian 1 Dungeon Items table: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
(15 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
-- | -- | ||
-- | -- Module:Etrian 1 Dungeon Items table | ||
-- | -- | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
Line 13: | Line 13: | ||
local output = {} | local output = {} | ||
-- Header row | -- Header row | ||
table.insert(output, '<table class=" | table.insert(output, '<table class="wikitable" style="text-align: center; width: 100%;">') | ||
table.insert(output, '<tr>') | table.insert(output, '<tr>') | ||
table.insert(output, '<th | if categoryArg then | ||
table.insert(output, '<th colspan="4" style="height: 7.5rem;">[[File:Etrian 1 - ' .. frame:preprocess('{{#switch:' .. categoryArg .. ' | Accessories=Accessory | Armors=Armor | Sigils=Sigil | Weapons=Weapon | Shields=Shield | Bottles=Bottle | Scrolls=Scroll | Staves=Staff | Books=Book | Misc.|Others=Ariadne Thread | #default={{{category|}}} }}') .. '.png|alt=' .. (categoryArg or "") .. '.|50x50px]]<br>' .. frame:expandTemplate{title = "Etrian1", args = {(categoryArg or "")}} .. '</th>') | |||
else | |||
table.insert(output, '<th colspan="4" style="height: 7.5rem;">' .. frame:expandTemplate{title = "Research"} .. '</th>') | |||
end | |||
table.insert(output, '</tr>') | table.insert(output, '</tr>') | ||
table.insert(output, '<tr>') | table.insert(output, '<tr>') | ||
table.insert(output, '<th | table.insert(output, '<th style="width: 25%;">English</th>') | ||
table.insert(output, '<th | table.insert(output, '<th style="width: 25%;">Japanese</th>') | ||
table.insert(output, '<th | table.insert(output, '<th style="width: 25%;">Floors</th>') | ||
table.insert(output, '<th | table.insert(output, '<th style="width: 25%;">Item<br>Frequency</th>') | ||
table.insert(output, '</tr>') | table.insert(output, '</tr>') | ||
-- Data rows | -- Data rows | ||
Line 28: | Line 32: | ||
local floorArg = args["floor_" .. i] | local floorArg = args["floor_" .. i] | ||
local frequencyArg = args["frequency_" .. i] | local frequencyArg = args["frequency_" .. i] | ||
if not | if not itemArg and not floorArg and not frequencyArg then | ||
break -- exit loop when no more rows are found | break -- exit loop when no more rows are found | ||
end | end | ||
local rowData = {} | local rowData = {} | ||
table.insert(rowData, '<tr | table.insert(rowData, '<tr>') | ||
table.insert(rowData, '<td | |||
if itemArg then | |||
table.insert(rowData, '<td | table.insert(rowData, '<td>' .. frame:expandTemplate{title = "Etrian1", args = {(itemArg or "")}} .. '</td>') | ||
table.insert(rowData, '<td | table.insert(rowData, '<td>' .. frame:preprocess('{{#invoke:Etrian 1 Item Data Cell|etrian1ItemDataCell|name=' .. (itemArg or "") .. '}}') .. '</td>') | ||
else | |||
table.insert(rowData, '<td>' .. frame:expandTemplate{title = "Research"} .. '</td>') | |||
table.insert(rowData, '<td>' .. frame:expandTemplate{title = "Research"} .. '</td>') | |||
end | |||
table.insert(rowData, '<td>' .. (floorArg or frame:expandTemplate{title = "Research"}) .. '</td>') | |||
table.insert(rowData, '<td>' .. (frequencyArg or frame:expandTemplate{title = "Research"}) .. '</td>') | |||
table.insert(rowData, '</tr>') | table.insert(rowData, '</tr>') | ||
table.insert(output, table.concat(rowData)) | table.insert(output, table.concat(rowData)) |
Latest revision as of 21:21, 25 January 2025
This template generates a list of items present in a dungeon for Etrian Mystery Dungeon.
Usage
{{#invoke:Etrian 1 Dungeon Items table|main | category = | item_1 = | floor_1 = | frequency_1 = ... | item_n = | floor_n = | frequency_n = }}
Example
{{#invoke:Etrian 1 Dungeon Items table|main | category = Scrolls | item_1 = Confuse Scroll | floor_1 = 1 - 3 | frequency_1 = 25.00% | item_2 = Light Scroll | floor_2 = 1 - 3 | frequency_2 = 25.00% }}
![]() Scrolls | |||
---|---|---|---|
English | Japanese | Floors | Item Frequency |
Confuse Scroll | 混乱の巻物 | 1 - 3 | 25.00% |
Light Scroll | あかりの巻物 | 1 - 3 | 25.00% |
--------------------------------------------------------------------------------
--
-- Module:Etrian 1 Dungeon Items table
--
--------------------------------------------------------------------------------
local p = {}
local mw = require('mw')
function p.main(frame)
local args = frame.args
local categoryArg = args["category"]
local output = {}
-- Header row
table.insert(output, '<table class="wikitable" style="text-align: center; width: 100%;">')
table.insert(output, '<tr>')
if categoryArg then
table.insert(output, '<th colspan="4" style="height: 7.5rem;">[[File:Etrian 1 - ' .. frame:preprocess('{{#switch:' .. categoryArg .. ' | Accessories=Accessory | Armors=Armor | Sigils=Sigil | Weapons=Weapon | Shields=Shield | Bottles=Bottle | Scrolls=Scroll | Staves=Staff | Books=Book | Misc.|Others=Ariadne Thread | #default={{{category|}}} }}') .. '.png|alt=' .. (categoryArg or "") .. '.|50x50px]]<br>' .. frame:expandTemplate{title = "Etrian1", args = {(categoryArg or "")}} .. '</th>')
else
table.insert(output, '<th colspan="4" style="height: 7.5rem;">' .. frame:expandTemplate{title = "Research"} .. '</th>')
end
table.insert(output, '</tr>')
table.insert(output, '<tr>')
table.insert(output, '<th style="width: 25%;">English</th>')
table.insert(output, '<th style="width: 25%;">Japanese</th>')
table.insert(output, '<th style="width: 25%;">Floors</th>')
table.insert(output, '<th 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>')
if itemArg then
table.insert(rowData, '<td>' .. frame:expandTemplate{title = "Etrian1", args = {(itemArg or "")}} .. '</td>')
table.insert(rowData, '<td>' .. frame:preprocess('{{#invoke:Etrian 1 Item Data Cell|etrian1ItemDataCell|name=' .. (itemArg or "") .. '}}') .. '</td>')
else
table.insert(rowData, '<td>' .. frame:expandTemplate{title = "Research"} .. '</td>')
table.insert(rowData, '<td>' .. frame:expandTemplate{title = "Research"} .. '</td>')
end
table.insert(rowData, '<td>' .. (floorArg or frame:expandTemplate{title = "Research"}) .. '</td>')
table.insert(rowData, '<td>' .. (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