Module:Etrian 2 Dungeon Traps table: Difference between revisions
Jump to navigation
Jump to search
(Created page with "-------------------------------------------------------------------------------- -- -- Module:Etrian 2 Dungeon Traps table -- -------------------------------------------------------------------------------- local p = {} local mw = require('mw') function p.main(frame) local args = frame.args local output = {} -- Header row table.insert(output, '<table class="templateTheme" style="text-align: center; margin: auto; width: 50%;">') table.insert(output, '<tr>') tabl...") |
mNo edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
-- | -- | ||
-- | -- Module:Etrian 2 Dungeon Traps table | ||
-- | -- | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
Line 12: | Line 12: | ||
local output = {} | local output = {} | ||
-- Header row | -- Header row | ||
table.insert(output, '<table class=" | table.insert(output, '<table class="wikitable" style="text-align: center; margin: auto; width: 50%;">') | ||
table.insert(output, '<tr>') | table.insert(output, '<tr>') | ||
table.insert(output, '<th | table.insert(output, '<th rowspan="2" style="width: 10%;">Model</th>') | ||
table.insert(output, '<th | table.insert(output, '<th colspan="2">' .. frame:expandTemplate{title = "Etrian2", args = {"Traps"}} .. '</th>') | ||
table.insert(output, '<th | table.insert(output, '<th rowspan="2" style="width: 40%;">Floors</th>') | ||
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, '</tr>') | table.insert(output, '</tr>') | ||
-- Data rows | -- Data rows | ||
Line 30: | Line 30: | ||
end | end | ||
local rowData = {} | local rowData = {} | ||
table.insert(rowData, '<tr | table.insert(rowData, '<tr>') | ||
table.insert(rowData, '<th | table.insert(rowData, '<th>[[File:Etrian 2 - ' .. (trapArg or "") .. '.png]]</th>') | ||
table.insert(rowData, '<td | table.insert(rowData, '<td>' .. frame:expandTemplate{title = "Etrian2", args = {(trapArg or "")}} .. '</td>') | ||
table.insert(rowData, '<td | table.insert(rowData, '<td>' .. frame:preprocess('{{#invoke:Etrian 2 Trap Data Cell|etrian2TrapDataCell|name=' .. (trapArg or "") .. '}}') .. '</td>') | ||
table.insert(rowData, '<td | table.insert(rowData, '<td>' .. (floorArg or "") .. '</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:12, 25 January 2025
This template generates a list of traps present in a dungeon for Etrian Mystery Dungeon.
Usage
{{#invoke:Etrian 2 Dungeon Traps table|main | trap_1 = | floor_1 = ... | trap_n = | floor_n = }}
Example
{{#invoke:Etrian 2 Dungeon Traps table|main | trap_1 = Arrow Trap | floor_1 = 1 - 3 | trap_2 = Boulder Trap | floor_2 = 1 - 3 | trap_3 = Slowness Trap | floor_3 = 1 - 3 }}
Model | Traps | Floors | |
---|---|---|---|
English | Japanese | ||
![]() | Arrow Trap | 木の矢の罠 | 1 - 3 |
![]() | Boulder Trap | 落石の罠 | 1 - 3 |
![]() | Slowness Trap | 鈍足の罠 | 1 - 3 |
--------------------------------------------------------------------------------
--
-- Module:Etrian 2 Dungeon Traps table
--
--------------------------------------------------------------------------------
local p = {}
local mw = require('mw')
function p.main(frame)
local args = frame.args
local output = {}
-- Header row
table.insert(output, '<table class="wikitable" style="text-align: center; margin: auto; width: 50%;">')
table.insert(output, '<tr>')
table.insert(output, '<th rowspan="2" style="width: 10%;">Model</th>')
table.insert(output, '<th colspan="2">' .. frame:expandTemplate{title = "Etrian2", args = {"Traps"}} .. '</th>')
table.insert(output, '<th rowspan="2" style="width: 40%;">Floors</th>')
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, '</tr>')
-- Data rows
for i = 1, 100 do
local trapArg = args["trap_" .. i]
local floorArg = args["floor_" .. i]
if not trapArg and not floorArg then
break -- exit loop when no more rows are found
end
local rowData = {}
table.insert(rowData, '<tr>')
table.insert(rowData, '<th>[[File:Etrian 2 - ' .. (trapArg or "") .. '.png]]</th>')
table.insert(rowData, '<td>' .. frame:expandTemplate{title = "Etrian2", args = {(trapArg or "")}} .. '</td>')
table.insert(rowData, '<td>' .. frame:preprocess('{{#invoke:Etrian 2 Trap Data Cell|etrian2TrapDataCell|name=' .. (trapArg or "") .. '}}') .. '</td>')
table.insert(rowData, '<td>' .. (floorArg or "") .. '</td>')
table.insert(rowData, '</tr>')
table.insert(output, table.concat(rowData))
end
table.insert(output, '</table>')
return table.concat(output)
end
return p