Module:Etrian 2 Dungeon DOEs table

MDFW - The Mystery Dungeon Tree of Information.
Revision as of 16:58, 28 June 2024 by Beignet (talk | contribs) (Created page with "-------------------------------------------------------------------------------- -- -- Module:Etrian 2 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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Template-info.png Documentation

This template generates a list of DOEs present in a dungeon for Etrian Mystery Dungeon 2.

Usage

{{#invoke:Etrian 2 Dungeon DOEs table|main
  | doe_1  = 
  | case_1 = 
  ...
  | doe_1  = 
  | case_n = 
}}

Example

{{#invoke:Etrian 2 Dungeon DOEs table|main
  | doe_1  = Big Moth
  | case_1 = Rare
}}
ModelDOEsExperience
EnglishJapanese
Big Moth's model.Big Moth
(Rare)
Script error: The function "Etrian2MonsterDataCell" does not exist.Script error: The function "Etrian2MonsterDataCell" does not exist.

--------------------------------------------------------------------------------
--
--			Module:Etrian 2 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="width: 10%;">Model</th>')
	table.insert(output, '<th class="templatePrimary" colspan="2">' .. frame:expandTemplate{title = "Etrian2", args = {"DOEs"}} .. '</th>')
	table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 20%;">' .. frame:expandTemplate{title = "Etrian2", args = {"Experience"}} .. '</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 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 = "Etrian2Model", args = {(doeArg or "")}} ..'</th>')
		if caseArg then
			table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Etrian2", args = {(doeArg or "")}} .. '<br>(' .. caseArg .. ')</td>')
		else
			table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Etrian2", args = {(doeArg or "")}} .. '</td>')
		end
		table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Etrian 2 Monster Data Cell|Etrian2MonsterDataCell|name=' .. (doeArg or "") .. '|getVar=ja}}') .. '</td>')
		table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Etrian 2 Monster Data Cell|Etrian2MonsterDataCell|name=' .. (doeArg or "") .. '|getVar=exp}}') .. '</td>')
		table.insert(rowData, '</tr>')
		table.insert(output, table.concat(rowData))
	end
	table.insert(output, '</table>')
	return table.concat(output)
end

return p