Module:Etrian 1 Dungeon Traps table: Difference between revisions
Jump to navigation
Jump to search
(Created page with "-------------------------------------------------------------------------------- -- -- Module:Etrian 1 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>') ta...") |
mNo edit summary |
||
Line 1: | Line 1: | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
-- | -- | ||
-- | -- Module:Etrian 1 Dungeon Traps table | ||
-- | -- | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
Revision as of 18:47, 26 March 2023
This template generates a list of traps present in a dungeon for Etrian Mystery Dungeon.
Usage
{{#invoke:Etrian 1 Dungeon Traps table|main | trap_1 = | floor_1 = ... | trap_n = | floor_n = }}
Example
{{#invoke:Etrian 1 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 and Floor Tiles | Floors | |
---|---|---|---|
English | Japanese | ||
![]() | [[Etrian 1:|]] | 1 - 3 | |
![]() | [[Etrian 1:|]] | 1 - 3 | |
![]() | [[Etrian 1:|]] | 1 - 3 |
--------------------------------------------------------------------------------
--
-- Module:Etrian 1 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>')
table.insert(output, '<th class="templatePrimary" rowspan="2" style="border-radius: 1rem 0 0 0; width: 10%;">Model</th>')
table.insert(output, '<th class="templatePrimary" colspan="2">' .. frame:expandTemplate{title = "Etrian1", args = {"Traps and Floor Tiles"}} .. '</th>')
table.insert(output, '<th class="templatePrimary" rowspan="2" style="border-radius: 0 1rem 0 0; width: 40%;">Floors</th>')
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, '</tr>')
-- Data rows
for i = 1, 100 do
local trapArg = args["trap_" .. i]
local floorArg = args["floor_" .. i]
if not monsterArg and not floorArg then
break -- exit loop when no more rows are found
end
local rowData = {}
table.insert(rowData, '<tr class="monstersTableRow">')
table.insert(rowData, '<th class="templatePrimary">[[File:Etrian 1 - ' .. (trapArg or "") .. '.png]]</th>')
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Etrian1", args = {(monsterArg or "")}} .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Etrian 1 Trap Data Cell|etrian1TrapDataCell|name=' .. (monsterArg or "") .. '}}') .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. (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