Module:Rescue Team DX Dungeon Traps table

MDFW - The Mystery Dungeon Tree of Information.
Revision as of 20:33, 14 October 2023 by Adkuate (talk | contribs) (Created page with "-------------------------------------------------------------------------------- -- -- Module:Rescue Team 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>')...")
(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 traps present in a dungeon for Pokémon Mystery Dungeon: Rescue Team DX.

Usage

{{#invoke:Rescue Team DX Dungeon Traps table|main
  | trap_1      = 
  | floors_1    = 
  ...
  | trap_n      = 
  | floors_n    = 
}}

Example

{{#invoke:Rescue Team DX Dungeon Traps table|main
  | trap_1      = Wonder Tile
  | floors_1    = 1 - 3
}}
SpriteTraps and Floor TilesFloorsFrequency
EnglishJapanese
File:Rescue Team DX - Wonder Tile sprite.pngWonder TileScript error: The function "rescueTeamDXTrapDataCell" does not exist.1 - 3

--------------------------------------------------------------------------------
--
--				Module:Rescue Team 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="width: 10%;">Sprite</th>')
	table.insert(output, '<th class="templatePrimary" colspan="2">' .. frame:expandTemplate{title = "RescueTeamDX", args = {"Traps and Floor Tiles"}} .. '</th>')
	table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 20%;">Floors</th>')
	table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 20%;">Frequency</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 floorsArg = args["floors_" .. i]
		local frequencyArg = args["frequency_" .. i]
		if not trapArg and not floorsArg and not frequencyArg then
			break -- exit loop when no more rows are found
		end
		local rowData = {}
		table.insert(rowData, '<tr class="trapsTableRow">')
		table.insert(rowData, '<th class="templatePrimary">[[File:Rescue Team DX - ' .. (trapArg or "") .. ' sprite.png]]</th>')
		table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "RescueTeamDX", args = {(trapArg or "")}} .. '</td>')
		table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Rescue Team DX Trap Data Cell|rescueTeamDXTrapDataCell|name=' .. (trapArg or "") .. '}}') .. '</td>')
		table.insert(rowData, '<td class="templateSecondary">' .. (floorsArg or "") .. '</td>')
		table.insert(rowData, '<td class="templateSecondary">' .. (frequencyArg or "") .. '</td>')
		table.insert(rowData, '</tr>')
		table.insert(output, table.concat(rowData))
	end
	table.insert(output, '</table>')
	return table.concat(output)
end

return p