Module:Etrian 1 Dungeon DOEs table: Difference between revisions
Jump to navigation
Jump to search
(Created page with "-------------------------------------------------------------------------------- -- -- Module:Etrian 1 Dungeon DOEs 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...") |
mNo edit summary |
||
Line 16: | Line 16: | ||
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" 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 = {"DOEs"}} .. '</th>') | table.insert(output, '<th class="templatePrimary" colspan="2">' .. frame:expandTemplate{title = "Etrian1", args = {"DOEs"}} .. '</th>') | ||
table.insert(output, '</tr>') | table.insert(output, '</tr>') | ||
table.insert(output, '<tr>') | table.insert(output, '<tr>') | ||
table.insert(output, '<th class="templatePrimary" style="width: | table.insert(output, '<th class="templatePrimary" style="width: 45%;">English</th>') | ||
table.insert(output, '<th class="templatePrimary" style="width: | table.insert(output, '<th class="templatePrimary" style="width: 45%;">Japanese</th>') | ||
table.insert(output, '</tr>') | table.insert(output, '</tr>') | ||
-- Data rows | -- Data rows | ||
for i = 1, 100 do | for i = 1, 100 do | ||
local | local doeArg = args["doe_" .. i] | ||
local | local caseArg = args["case_" .. i] | ||
if not doeArg and not caseArg then | |||
if not | |||
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 class="monstersTableRow">') | table.insert(rowData, '<tr class="monstersTableRow">') | ||
table.insert(rowData, '<th class="templatePrimary">' .. frame:expandTemplate{title = "Etrian1Model", args = {( | table.insert(rowData, '<th class="templatePrimary">' .. frame:expandTemplate{title = "Etrian1Model", args = {(doeArg or "")}} ..'</th>') | ||
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Etrian1", args = {( | if caseArg then | ||
table.insert(rowData, '<td class="templateSecondary">' .. frame: | table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Etrian1", args = {(doeArg or "")}} .. ' (' .. caseArg .. ')</td>') | ||
table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Etrian 1 Monster Data Cell|etrian1MonsterDataCell|name=' .. ( | else | ||
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Etrian1", args = {(doeArg or "")}} .. '</td>') | |||
end | |||
table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Etrian 1 Monster Data Cell|etrian1MonsterDataCell|name=' .. (doeArg or "") .. '|getVar=ja}}') .. '</td>') | |||
table.insert(rowData, '</tr>') | table.insert(rowData, '</tr>') | ||
table.insert(output, table.concat(rowData)) | table.insert(output, table.concat(rowData)) |
Revision as of 19:49, 8 April 2023
This template generates a list of DOEs present in a dungeon for Etrian Mystery Dungeon.
Usage
{{#invoke:Etrian 1 Dungeon DOEs table|main | doe_1 = | case_1 = ... | doe_1 = | case_n = }}
Example
{{#invoke:Etrian 1 Dungeon DOEs table|main | doe_1 = Pooka | case_1 = Rare }}
Model | DOEs | |
---|---|---|
English | Japanese | |
![]() | Pooka (Rare) | プーカ |
--------------------------------------------------------------------------------
--
-- Module:Etrian 1 Dungeon DOEs 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 = {"DOEs"}} .. '</th>')
table.insert(output, '</tr>')
table.insert(output, '<tr>')
table.insert(output, '<th class="templatePrimary" style="width: 45%;">English</th>')
table.insert(output, '<th class="templatePrimary" style="width: 45%;">Japanese</th>')
table.insert(output, '</tr>')
-- Data rows
for i = 1, 100 do
local doeArg = args["doe_" .. i]
local caseArg = args["case_" .. i]
if not doeArg and not caseArg 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">' .. frame:expandTemplate{title = "Etrian1Model", args = {(doeArg or "")}} ..'</th>')
if caseArg then
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Etrian1", args = {(doeArg or "")}} .. ' (' .. caseArg .. ')</td>')
else
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Etrian1", args = {(doeArg or "")}} .. '</td>')
end
table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Etrian 1 Monster Data Cell|etrian1MonsterDataCell|name=' .. (doeArg or "") .. '|getVar=ja}}') .. '</td>')
table.insert(rowData, '</tr>')
table.insert(output, table.concat(rowData))
end
table.insert(output, '</table>')
return table.concat(output)
end
return p