Module:Super MD Dungeon Items table

MDFW - The Mystery Dungeon Tree of Information.
Revision as of 09:26, 13 August 2024 by Adkuate (talk | contribs) (Adkuate moved page Module:Super MD Items table to Module:Super MD Dungeon Items table without leaving a redirect)
Jump to navigation Jump to search
Template-info.png Documentation

This template generates a list of items present in a dungeon for Pokémon Super Mystery Dungeon.

Usage

{{#invoke:Super MD Items Dungeon table|main
  | category    = 
  | item_1      = 
  | floors_1    = 
  ...
  | item_n      = 
  | floors_n    = 
}}

Example

{{#invoke:Super MD Dungeon Items table|main
  | category    = Berry
  | item_1      = Oran Berry
  | floors_1    = 1 - 3
}}
File:Super MD - Berry.png
Berry
EnglishJapaneseFloors
Oran BerryScript error: The function "superMysteryDungeonItemDataCell" does not exist.1 - 3

--------------------------------------------------------------------------------
--
--				Module:Super MD Items table
--
--------------------------------------------------------------------------------

local p = {}
local mw = require('mw')

function p.main(frame)
	local args = frame.args
	local categoryArg = args["category"]
	local output = {}
	-- Header row
	table.insert(output, '<table class="templateTheme" style="text-align: center; width: 100%;">')
	table.insert(output, '<tr>')
	if categoryArg then
		table.insert(output, '<th class="templatePrimary" colspan="3" style="height: 5rem;">[[File:Super MD - ' .. frame:preprocess('{{#switch:' .. categoryArg .. ' | Berries=Oran Berry | Health Drinks=Max Elixir | Seeds=Reviver Seed | Projectiles=Gravelerock | Food=Apple | Gummis=Rainbow Gummi | TMs=TM Icon | Wonder Orbs=Escape Orb | Equipment=Deluxe Ribbon | Wands=Switcher Wand | Miscellaneous Items=Evolution Crystal artwork | #default=' .. categoryArg .. ' }}') .. '.png|alt=' .. categoryArg .. '.|50x50px]]<br>' .. frame:expandTemplate{title = "RescueTeamDX", args = {categoryArg}} .. '</th>')
	else
		table.insert(output, '<th class="templatePrimary" colspan="3" style="height: 5rem;">' .. frame:expandTemplate{title = "Research"} .. '</th>')
	end
	table.insert(output, '</tr>')
	table.insert(output, '<tr>')
	if categoryArg == "Poké" then
		table.insert(output, '<th class="templatePrimary" style="width: 33%;">Lowest amount</th>')
		table.insert(output, '<th class="templatePrimary" style="width: 33%;">Highest ammount</th>')
	else
		table.insert(output, '<th class="templatePrimary" style="width: 33%;">English</th>')
		table.insert(output, '<th class="templatePrimary" style="width: 33%;">Japanese</th>')
	end
	table.insert(output, '<th class="templatePrimary" style="width: 34%;">Floors</th>')
	table.insert(output, '</tr>')
	-- Data rows
	for i = 1, 100 do
		local itemArg = args["item_" .. i]
		local lowAmountArg = args["low_amount_" .. i]
		local highAmountArg = args["high_amount_" .. i]
		local floorsArg = args["floors_" .. i]
		if not itemArg and not floorsArg and not lowAmountArg and not highAmountArg then
			break -- exit loop when no more rows are found
		end
		local rowData = {}
		table.insert(rowData, '<tr class="itemsTableRow">')
		if categoryArg == "Poké" then
			table.insert(rowData, '<td class="templateSecondary">' .. (lowAmountArg or frame:expandTemplate{title = "Research"}) .. '</td>')
			table.insert(rowData, '<td class="templateSecondary">' .. (highAmountArg or frame:expandTemplate{title = "Research"}) .. '</td>')
		else
			if itemArg then
				table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "RescueTeamDX", args = {itemArg}} .. '</td>')
				table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Super MD Item Data Cell|superMysteryDungeonItemDataCell|name=' .. itemArg .. '}}') .. '</td>')
			else
				table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Research"} .. '</td>')
				table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Research"} .. '</td>')
			end
		end
		table.insert(rowData, '<td class="templateSecondary">' .. (floorsArg or frame:expandTemplate{title = "Research"}) .. '</td>')
		table.insert(rowData, '</tr>')
		table.insert(output, table.concat(rowData))
	end
	table.insert(output, '</table>')
	return table.concat(output)
end

return p