Module:Gates to Infinity Dungeon Pokémon table: Difference between revisions

MDFW - The Mystery Dungeon Tree of Information.
Jump to navigation Jump to search
mNo edit summary
m (Undo revision 383174 by Adkuate (talk))
Line 45: Line 45:
table.insert(rowData, '<td class="templateSecondary">' .. (floorArg or "") .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. (floorArg or "") .. '</td>')
if frame:preprocess('{{#invoke:Gates to Infinity Pokémon Data Cell|gatesToInfinityPokemonDataCell|name=' .. (pokemonArg or "") .. '|getVar=type2}}') ~= "" then
if frame:preprocess('{{#invoke:Gates to Infinity Pokémon Data Cell|gatesToInfinityPokemonDataCell|name=' .. (pokemonArg or "") .. '|getVar=type2}}') ~= "" then
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "TypePKMN", args = {frame:preprocess('{{#invoke:Gates to Infinity Pokémon Data Cell|gatesToInfinityPokemonDataCell|name=' .. (pokemonArg or "") .. '|getVar=type1}}')} .. '</td>'})
table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{TypePKMN|{{#invoke:Gates to Infinity Pokémon Data Cell|gatesToInfinityPokemonDataCell|name=' .. (pokemonArg or "") .. '|getVar=type1}}}}') .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "TypePKMN", args = {frame:preprocess('{{#invoke:Gates to Infinity Pokémon Data Cell|gatesToInfinityPokemonDataCell|name=' .. (pokemonArg or "") .. '|getVar=type2}}')} .. '</td>'})
table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{TypePKMN|{{#invoke:Gates to Infinity Pokémon Data Cell|gatesToInfinityPokemonDataCell|name=' .. (pokemonArg or "") .. '|getVar=type2}}}}') .. '</td>')
else
else
table.insert(rowData, '<td class="templateSecondary" colspan="2">' .. frame:expandTemplate{title = "TypePKMN", args = {frame:preprocess('{{#invoke:Gates to Infinity Pokémon Data Cell|gatesToInfinityPokemonDataCell|name=' .. (pokemonArg or "") .. '|getVar=type1}}')} .. '</td>'})
table.insert(rowData, '<td class="templateSecondary" colspan="2">' .. frame:preprocess('{{TypePKMN|{{#invoke:Gates to Infinity Pokémon Data Cell|gatesToInfinityPokemonDataCell|name=' .. (pokemonArg or "") .. '|getVar=type1}}}}') .. '</td>')
end
end
table.insert(rowData, '<td class="templateSecondary">' .. (expArg or "") .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. (expArg or "") .. '</td>')

Revision as of 20:07, 6 April 2023

Template-info.png Documentation

This template generates a list of monsters present in a dungeon for Gates to Infinity.

Usage

{{#invoke:Gates to Infinity Dungeon Pokémon table|main
  | pokémon_1   = 
  | exp_1       = 
  | recruit_1   = 
  | spawnRate_1 = 
  | floor_1     = 
  ...
  | pokémon_n   = 
  | exp_n       = 
  | recruit_n   = 
  | spawnRate_n = 
  | floor_n     = 
}}

Example

{{#invoke:Gates to Infinity Dungeon Pokémon table|main
  | pokémon_1   = Pikachu
  | level_1     = 2
  | exp_1       = 50
  | recruit_1   = 50%
  | spawnRate_1 = 20%
  | floor_1     = 1 - 5
}}
ModelPokémonFloorsTypesExperienceLevelRecruitment rateSpawn rate
EnglishJapanese
Pikachu's model.PikachuScript error: The function "gatesToInfinityPokemonDataCell" does not exist.1 - 5[[File:Rescue Team DX - Script error: The function "gatesToInfinityPokemonDataCell" does not exist.-type Icon small.png|link=Module:Script error: The function "gatesToInfinityPokemonDataCell" does not exist.-type|alt=Script error: The function "gatesToInfinityPokemonDataCell" does not exist.-type]][[File:Rescue Team DX - Script error: The function "gatesToInfinityPokemonDataCell" does not exist.-type Icon small.png|link=Module:Script error: The function "gatesToInfinityPokemonDataCell" does not exist.-type|alt=Script error: The function "gatesToInfinityPokemonDataCell" does not exist.-type]]50250%20%

--------------------------------------------------------------------------------
--
--			Module:Gates to Infinity Dungeon Pokémon 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 = "GatesToInfinity", args = {"Pokémon"}} .. '</th>')
	table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 10%;">Floors</th>')
	table.insert(output, '<th class="templatePrimary" colspan="2" rowspan="2" style="width: 20%;">' .. frame:expandTemplate{title = "GatesToInfinity", args = {"Types"}} .. '</th>')
	table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 10%;">' .. frame:expandTemplate{title = "GatesToInfinity", args = {"Experience"}} .. '</th>')
	table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 10%;">' .. frame:expandTemplate{title = "GatesToInfinity", args = {"Level"}} .. '</th>')
	table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 10%;">' .. frame:expandTemplate{title = "GatesToInfinity", args = {"Recruitment rate"}} .. '</th>')
	table.insert(output, '<th class="templatePrimary" rowspan="2" style="border-radius: 0 1rem 0 0; width: 10%;">Spawn rate</th>')
	table.insert(output, '</tr>')
	table.insert(output, '<tr>')
	table.insert(output, '<th class="templatePrimary" style="width: 10%;">English</th>')
	table.insert(output, '<th class="templatePrimary" style="width: 10%;">Japanese</th>')
	table.insert(output, '</tr>')
	-- Data rows
	for i = 1, 100 do
		local pokemonArg = args["pokémon_" .. i]
		local levelArg = args["level_" .. i]
		local expArg = args["exp_" .. i]
		local recruitArg = args["recruit_" .. i]
		local spawnRateArg = args["spawnRate_" .. i]
		local floorArg = args["floor_" .. i]
		if not pokemonArg and not expArg and not recruitArg and not spawnRateArg and not floorArg 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 = "GatesToInfinityModel", args = {(pokemonArg or "")}} .. '</th>')
		table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "GatesToInfinity", args = {(pokemonArg or "")}} .. '</td>')
		table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Gates to Infinity Pokémon Data Cell|gatesToInfinityPokemonDataCell|name=' .. (pokemonArg or "") .. '|getVar=ja}}') .. '</td>')
		table.insert(rowData, '<td class="templateSecondary">' .. (floorArg or "") .. '</td>')
		if frame:preprocess('{{#invoke:Gates to Infinity Pokémon Data Cell|gatesToInfinityPokemonDataCell|name=' .. (pokemonArg or "") .. '|getVar=type2}}') ~= "" then
			table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{TypePKMN|{{#invoke:Gates to Infinity Pokémon Data Cell|gatesToInfinityPokemonDataCell|name=' .. (pokemonArg or "") .. '|getVar=type1}}}}') .. '</td>')
			table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{TypePKMN|{{#invoke:Gates to Infinity Pokémon Data Cell|gatesToInfinityPokemonDataCell|name=' .. (pokemonArg or "") .. '|getVar=type2}}}}') .. '</td>')
		else
			table.insert(rowData, '<td class="templateSecondary" colspan="2">' .. frame:preprocess('{{TypePKMN|{{#invoke:Gates to Infinity Pokémon Data Cell|gatesToInfinityPokemonDataCell|name=' .. (pokemonArg or "") .. '|getVar=type1}}}}') .. '</td>')
		end
		table.insert(rowData, '<td class="templateSecondary">' .. (expArg or "") .. '</td>')
		table.insert(rowData, '<td class="templateSecondary">' .. (levelArg or "") .. '</td>')
		table.insert(rowData, '<td class="templateSecondary">' .. (recruitArg or "") .. '</td>')
		table.insert(rowData, '<td class="templateSecondary">' .. (spawnRateArg or "") .. '</td>')
		table.insert(rowData, '</tr>')
		table.insert(output, table.concat(rowData))
	end
	table.insert(output, '</table>')
	return table.concat(output)
end

return p