Module:Etrian 1 Dungeon Bosses table: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
-- | -- | ||
-- | -- Module:Etrian 1 Dungeon Bosses 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 = "Etrian1", args = {"Bosses"}} .. '</th>') | ||
table.insert(output, '<th rowspan="2" style="width: 13%;">' .. frame:expandTemplate{title = "Etrian1", args = {"Experience"}} .. '</th>') | |||
table.insert(output, '<th rowspan="2" style="width: 13%;">' .. frame:expandTemplate{title = "Etrian1", args = {"HP"}} .. '</th>') | |||
table.insert(output, '<th rowspan="2" style="width: 13%;">Floor</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 25: | Line 28: | ||
local bossArg = args["boss_" .. i] | local bossArg = args["boss_" .. i] | ||
local caseArg = args["case_" .. i] | local caseArg = args["case_" .. i] | ||
if not bossArg and not caseArg then | local floorArg = args["floor_" .. i] | ||
if not bossArg and not caseArg and not floorArg 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, '<th | table.insert(rowData, '<th>' .. frame:expandTemplate{title = "Etrian1Model", args = {(bossArg or "")}} ..'</th>') | ||
if caseArg then | if caseArg then | ||
table.insert(rowData, '<td | table.insert(rowData, '<td>' .. frame:expandTemplate{title = "Etrian1", args = {(bossArg or "")}} .. '<br>(' .. caseArg .. ')</td>') | ||
else | else | ||
table.insert(rowData, '<td | table.insert(rowData, '<td>' .. frame:expandTemplate{title = "Etrian1", args = {(bossArg or "")}} .. '</td>') | ||
end | end | ||
table.insert(rowData, '<td | table.insert(rowData, '<td>' .. frame:preprocess('{{#invoke:Etrian 1 Monster Data Cell|etrian1MonsterDataCell|name=' .. (bossArg or "") .. '|getVar=ja}}') .. '</td>') | ||
table.insert(rowData, '<td>' .. frame:preprocess('{{#invoke:Etrian 1 Monster Data Cell|etrian1MonsterDataCell|name=' .. (bossArg or "") .. '|getVar=exp}}') .. '</td>') | |||
table.insert(rowData, '<td>' .. frame:preprocess('{{#invoke:Etrian 1 Monster Data Cell|etrian1MonsterDataCell|name=' .. (bossArg or "") .. '|getVar=hp}}') .. '</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:27, 25 January 2025
This template generates a list of bosses present in a dungeon for Etrian Mystery Dungeon.
Usage
{{#invoke:Etrian 1 Dungeon Bosses table|main | boss_1 = | case_1 = ... | boss_n = | case_n = }}
Example
{{#invoke:Etrian 1 Dungeon Bosses table|main | boss_1 = Stone Hulk | case_1 = Rare }}
Model | Bosses | Experience | HP | Floor | |
---|---|---|---|---|---|
English | Japanese | ||||
![]() | Stone Hulk (Rare) | 剛腕の石灰魔人 | 1,280 | 888 |
--------------------------------------------------------------------------------
--
-- Module:Etrian 1 Dungeon Bosses 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 = "Etrian1", args = {"Bosses"}} .. '</th>')
table.insert(output, '<th rowspan="2" style="width: 13%;">' .. frame:expandTemplate{title = "Etrian1", args = {"Experience"}} .. '</th>')
table.insert(output, '<th rowspan="2" style="width: 13%;">' .. frame:expandTemplate{title = "Etrian1", args = {"HP"}} .. '</th>')
table.insert(output, '<th rowspan="2" style="width: 13%;">Floor</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 bossArg = args["boss_" .. i]
local caseArg = args["case_" .. i]
local floorArg = args["floor_" .. i]
if not bossArg and not caseArg and not floorArg then
break -- exit loop when no more rows are found
end
local rowData = {}
table.insert(rowData, '<tr>')
table.insert(rowData, '<th>' .. frame:expandTemplate{title = "Etrian1Model", args = {(bossArg or "")}} ..'</th>')
if caseArg then
table.insert(rowData, '<td>' .. frame:expandTemplate{title = "Etrian1", args = {(bossArg or "")}} .. '<br>(' .. caseArg .. ')</td>')
else
table.insert(rowData, '<td>' .. frame:expandTemplate{title = "Etrian1", args = {(bossArg or "")}} .. '</td>')
end
table.insert(rowData, '<td>' .. frame:preprocess('{{#invoke:Etrian 1 Monster Data Cell|etrian1MonsterDataCell|name=' .. (bossArg or "") .. '|getVar=ja}}') .. '</td>')
table.insert(rowData, '<td>' .. frame:preprocess('{{#invoke:Etrian 1 Monster Data Cell|etrian1MonsterDataCell|name=' .. (bossArg or "") .. '|getVar=exp}}') .. '</td>')
table.insert(rowData, '<td>' .. frame:preprocess('{{#invoke:Etrian 1 Monster Data Cell|etrian1MonsterDataCell|name=' .. (bossArg or "") .. '|getVar=hp}}') .. '</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