Module:Rescue Team DX Camp Pokémon table: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 37: | Line 37: | ||
table.insert(rowData, '<th class="templatePrimary">' .. frame:expandTemplate{title = "RescueTeamDXSprite", args = {(monsterArg or ""), size = "100x100px"}} .. '</th>') | table.insert(rowData, '<th class="templatePrimary">' .. frame:expandTemplate{title = "RescueTeamDXSprite", args = {(monsterArg or ""), size = "100x100px"}} .. '</th>') | ||
table.insert(rowData, '<th class="templatePrimary">' .. frame:expandTemplate{title = "RescueTeamDXSprite", args = {(shinyArg or ""), size = "100x100px"}} .. '</th>') | table.insert(rowData, '<th class="templatePrimary">' .. frame:expandTemplate{title = "RescueTeamDXSprite", args = {(shinyArg or ""), size = "100x100px"}} .. '</th>') | ||
if shinyArg == nil or shinyArg == '' then | |||
table.insert(rowData, '<td class="templateSecondary">Unavailable</td>') | |||
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "RescueTeamDX", args = {(monsterArg or "")}} .. '</td>') | table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "RescueTeamDX", args = {(monsterArg or "")}} .. '</td>') | ||
table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Rescue Team DX Pokémon Data Cell|rescueTeamDXPokemonDataCell|name=' .. (monsterArg or "") .. '|getVar=ja}}') .. '</td>') | table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Rescue Team DX Pokémon Data Cell|rescueTeamDXPokemonDataCell|name=' .. (monsterArg or "") .. '|getVar=ja}}') .. '</td>') | ||
Line 53: | Line 55: | ||
return p | return p | ||
end |
Revision as of 22:57, 9 December 2023
This template generates a list of Pokémon present in a Rescue Team Camp for Pokémon Mystery Dungeon: Rescue Team DX.
Usage
{{#invoke:Rescue Team DX Camp Pokémon table|main | pokémon_1 = | shiny_1 = ... | pokémon_n = | shiny_n = }}
Example
{{#invoke:Rescue Team DX Camp Pokémon table|main | pokémon_1 = Celebi | shiny_1 = yes |- | pokémon_2 = Pikachu | shiny_2 = no }}
Script error: The module returned a nil value. It is supposed to return an export table.
--------------------------------------------------------------------------------
--
-- Module:Rescue Team DX Camp 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" colspan="2" rowspan="1" style="width: 33.4%;">Sprite</th>')
table.insert(output, '<th class="templatePrimary" colspan="2" style="width: 33.3%;">' .. frame:expandTemplate{title = "RescueTeamDX", args = {"Pokémon"}} .. '</th>')
table.insert(output, '<th class="templatePrimary" colspan="2" rowspan="2" style="width: 33.3%;">' .. frame:expandTemplate{title = "RescueTeamDX", args = {"Types"}} .. '</th>')
table.insert(output, '</tr>')
table.insert(output, '<tr>')
table.insert(output, '<th class="templatePrimary" style="width: 16.7%;">Normal</th>')
table.insert(output, '<th class="templatePrimary" style="width: 16.7%;">Shiny</th>')
table.insert(output, '<th class="templatePrimary" style="width: 16.65%;">English</th>')
table.insert(output, '<th class="templatePrimary" style="width: 16.65%;">Japanese</th>')
table.insert(output, '</tr>')
-- Data rows
for i = 1, 150 do
local monsterArg = args["pokémon_" .. i]
local shinyArg = args["shiny_" .. i]
if not monsterArg then
break -- exit loop when no more rows are found
end
local typeOne = frame:preprocess('{{#invoke:Rescue Team DX Pokémon Data Cell|rescueTeamDXPokemonDataCell|name=' .. (monsterArg or "") .. '|getVar=type1}}')
local typeTwo = frame:preprocess('{{#invoke:Rescue Team DX Pokémon Data Cell|rescueTeamDXPokemonDataCell|name=' .. (monsterArg or "") .. '|getVar=type2}}')
local rowData = {}
table.insert(rowData, '<tr class="monstersTableRow">')
table.insert(rowData, '<th class="templatePrimary">' .. frame:expandTemplate{title = "RescueTeamDXSprite", args = {(monsterArg or ""), size = "100x100px"}} .. '</th>')
table.insert(rowData, '<th class="templatePrimary">' .. frame:expandTemplate{title = "RescueTeamDXSprite", args = {(shinyArg or ""), size = "100x100px"}} .. '</th>')
if shinyArg == nil or shinyArg == '' then
table.insert(rowData, '<td class="templateSecondary">Unavailable</td>')
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "RescueTeamDX", args = {(monsterArg or "")}} .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Rescue Team DX Pokémon Data Cell|rescueTeamDXPokemonDataCell|name=' .. (monsterArg or "") .. '|getVar=ja}}') .. '</td>')
if typeTwo == nil or typeTwo == '' then
table.insert(rowData, '<td class="templatePrimary" colspan="2">' .. frame:expandTemplate{title = "TypePKMN", args = {typeOne}} .. '</td>')
else
table.insert(rowData, '<td class="templatePrimary">' .. frame:expandTemplate{title = "TypePKMN", args = {typeOne}} .. '</td>')
table.insert(rowData, '<td class="templatePrimary">' .. frame:expandTemplate{title = "TypePKMN", args = {typeTwo}} .. '</td>')
end
table.insert(rowData, '</tr>')
table.insert(output, table.concat(rowData))
end
table.insert(output, '</table>')
return table.concat(output)
end
return p
end