Module:Rescue Team DX Dungeon Pokémon table: Difference between revisions
Jump to navigation
Jump to search
No edit summary Tag: Reverted |
No edit summary Tag: Manual revert |
||
Line 17: | Line 17: | ||
table.insert(output, '<th class="templatePrimary" colspan="2">' .. frame:expandTemplate{title = "RescueTeamDX", args = {"Pokémon"}} .. '</th>') | table.insert(output, '<th class="templatePrimary" colspan="2">' .. frame:expandTemplate{title = "RescueTeamDX", args = {"Pokémon"}} .. '</th>') | ||
table.insert(output, '<th class="templatePrimary" colspan="2" rowspan="2" style="width: 10%;">' .. frame:expandTemplate{title = "RescueTeamDX", args = {"Types"}} .. '</th>') | table.insert(output, '<th class="templatePrimary" colspan="2" rowspan="2" style="width: 10%;">' .. frame:expandTemplate{title = "RescueTeamDX", args = {"Types"}} .. '</th>') | ||
table.insert(output, '<th class="templatePrimary" | table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 10%;">' .. frame:expandTemplate{title = "RescueTeamDX", args = {"Level"}} .. '</th>') | ||
table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 10%;">' .. frame:expandTemplate{title = "RescueTeamDX", args = {"Experience"}} .. '</th>') | table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 10%;">' .. frame:expandTemplate{title = "RescueTeamDX", args = {"Experience"}} .. '</th>') | ||
table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 10%;">' .. frame:expandTemplate{title = "RescueTeamDX", args = {"Recruiting", "Recruit Chance"}} .. '</th>') | table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 10%;">' .. frame:expandTemplate{title = "RescueTeamDX", args = {"Recruiting", "Recruit Chance"}} .. '</th>') | ||
table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 10%;">Floors</th>') | table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 10%;">Floors</th>') | ||
table.insert(output, '</tr>') | table.insert(output, '</tr>') | ||
table.insert(output, '<tr>') | table.insert(output, '<tr>') | ||
table.insert(output, '<th class="templatePrimary" style="width: | table.insert(output, '<th class="templatePrimary" style="width: 20%;">English</th>') | ||
table.insert(output, '<th class="templatePrimary" style="width: | table.insert(output, '<th class="templatePrimary" style="width: 20%;">Japanese</th>') | ||
table.insert(output, '</tr>') | table.insert(output, '</tr>') | ||
-- Data rows | -- Data rows | ||
for i = 1, 150 do | for i = 1, 150 do | ||
local monsterArg = args["pokémon_" .. i] | local monsterArg = args["pokémon_" .. i] | ||
local | local floorsArg = args["floors_" .. i] | ||
local | local levelArg = args["level_" .. i] | ||
local expArg = args["exp_" .. i] | local expArg = args["exp_" .. i] | ||
local recruitableArg = args["recruitable_" .. i] | local recruitableArg = args["recruitable_" .. i] | ||
if not monsterArg and not floorsArg and not recruitableArg and not expArg and not levelArg then | |||
if not monsterArg and not | |||
break -- exit loop when no more rows are found | break -- exit loop when no more rows are found | ||
end | end | ||
Line 54: | Line 49: | ||
table.insert(rowData, '<td class="templatePrimary">' .. frame:expandTemplate{title = "TypePKMN", args = {typeTwo}} .. '</td>') | table.insert(rowData, '<td class="templatePrimary">' .. frame:expandTemplate{title = "TypePKMN", args = {typeTwo}} .. '</td>') | ||
end | end | ||
table.insert(rowData, '<td class="templateSecondary">' .. ( | table.insert(rowData, '<td class="templateSecondary">' .. (levelArg or frame:expandTemplate{title = "Research"}) .. '</td>') | ||
table.insert(rowData, '<td class="templateSecondary">' .. (expArg or frame:expandTemplate{title = "Research"}) .. '</td>') | table.insert(rowData, '<td class="templateSecondary">' .. (expArg or frame:expandTemplate{title = "Research"}) .. '</td>') | ||
if recruitableArg == nil or string.lower(recruitableArg) == "false" or string.lower(recruitableArg) == "no" then | if recruitableArg == nil or string.lower(recruitableArg) == "false" or string.lower(recruitableArg) == "no" then | ||
Line 63: | Line 57: | ||
end | end | ||
table.insert(rowData, '<td class="templateSecondary">' .. (floorsArg or frame:expandTemplate{title = "Research"}) .. '</td>') | table.insert(rowData, '<td class="templateSecondary">' .. (floorsArg or frame:expandTemplate{title = "Research"}) .. '</td>') | ||
table.insert(rowData, '</tr>') | table.insert(rowData, '</tr>') | ||
table.insert(output, table.concat(rowData)) | table.insert(output, table.concat(rowData)) |
Revision as of 05:45, 8 November 2023
This template generates a list of pokemons present in a dungeon for Pokémon Mystery Dungeon: Rescue Team DX.
Usage
{{#invoke:Rescue Team DX Dungeon Pokémon table|main | pokémon_1 = | floors_1 = | level_1 = | exp_1 = ... | pokémon_n = | floors_n = | level_n = | exp_n = }}
Example
{{#invoke:Rescue Team DX Dungeon Pokémon table|main | pokémon_1 = | floors_1 = }}
Sprite | Pokémon | Types | Level | Experience | Recruit Chance | Floors | ||
---|---|---|---|---|---|---|---|---|
English | Japanese | |||||||
![]() | Pikachu | Script error: The function "rescueTeamDXPokemonDataCell" does not exist. | [[File:Rescue Team DX - Script error: The function "rescueTeamDXPokemonDataCell" does not exist.-type Icon small.png|link=Module:Script error: The function "rescueTeamDXPokemonDataCell" does not exist.-type|alt=Script error: The function "rescueTeamDXPokemonDataCell" does not exist.-type]] | [[File:Rescue Team DX - Script error: The function "rescueTeamDXPokemonDataCell" does not exist.-type Icon small.png|link=Module:Script error: The function "rescueTeamDXPokemonDataCell" does not exist.-type|alt=Script error: The function "rescueTeamDXPokemonDataCell" does not exist.-type]] | 1 | 1 | Unrecruitable | 1 - 3 |
--------------------------------------------------------------------------------
--
-- Module:Rescue Team DX 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="width: 10%;">Sprite</th>')
table.insert(output, '<th class="templatePrimary" colspan="2">' .. frame:expandTemplate{title = "RescueTeamDX", args = {"Pokémon"}} .. '</th>')
table.insert(output, '<th class="templatePrimary" colspan="2" rowspan="2" style="width: 10%;">' .. frame:expandTemplate{title = "RescueTeamDX", args = {"Types"}} .. '</th>')
table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 10%;">' .. frame:expandTemplate{title = "RescueTeamDX", args = {"Level"}} .. '</th>')
table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 10%;">' .. frame:expandTemplate{title = "RescueTeamDX", args = {"Experience"}} .. '</th>')
table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 10%;">' .. frame:expandTemplate{title = "RescueTeamDX", args = {"Recruiting", "Recruit Chance"}} .. '</th>')
table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 10%;">Floors</th>')
table.insert(output, '</tr>')
table.insert(output, '<tr>')
table.insert(output, '<th class="templatePrimary" style="width: 20%;">English</th>')
table.insert(output, '<th class="templatePrimary" style="width: 20%;">Japanese</th>')
table.insert(output, '</tr>')
-- Data rows
for i = 1, 150 do
local monsterArg = args["pokémon_" .. i]
local floorsArg = args["floors_" .. i]
local levelArg = args["level_" .. i]
local expArg = args["exp_" .. i]
local recruitableArg = args["recruitable_" .. i]
if not monsterArg and not floorsArg and not recruitableArg and not expArg and not levelArg 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 = "50x50px"}} .. '</th>')
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, '<td class="templateSecondary">' .. (levelArg or frame:expandTemplate{title = "Research"}) .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. (expArg or frame:expandTemplate{title = "Research"}) .. '</td>')
if recruitableArg == nil or string.lower(recruitableArg) == "false" or string.lower(recruitableArg) == "no" then
table.insert(rowData, '<td class="templateSecondary">Unrecruitable</td>')
else
table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Rescue Team DX Pokémon Data Cell|rescueTeamDXPokemonDataCell|name=' .. monsterArg .. '|getVar=recruit}}') .. '</td>')
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