Module:Super MD Dungeon Pokémon table
Jump to navigation
Jump to search
This template generates a list of monsters present in a dungeon for Pokemon Super Mystery Dungeon.
Usage
{{#invoke:Super MD Dungeon Pokémon table|main | pokémon_1 = | exp_1 = | spawnRate_1 = | floor_1 = ... | pokémon_n = | exp_n = | spawnRate_n = | floor_n = }}
Example
{{#invoke:Super MD Dungeon Pokémon table|main | pokémon_1 = Ampharos | level_1 = 50 | exp_1 = 500 | spawnRate_1 = 10% | floor_1 = 1 - 6 }}
Sprite | Pokémon | Type | Level | Experience | Floors | Recruit Chance | |||
---|---|---|---|---|---|---|---|---|---|
English | Japanese | Base Chance | Story | ||||||
Ampharos's model. | Ampharos | デンリュウ | ![]() | 50 | 500 | [Research required] | Unrecruitable |
--------------------------------------------------------------------------------
--
-- Module:Super MD Dungeon Pokémon table
--
--------------------------------------------------------------------------------
local p = {}
local mw = require('mw')
function p.main(frame)
local data = require("Module:Super MD Pokémon Data Cell")
local metatable = {__index = function () return "" end}
setmetatable(data, metatable)
local args = frame.args
local output = mw.html.create()
local header = mw.html.create()
-- Header row
header
:tag('tr')
:tag('th'):attr("rowspan", "2"):cssText("width: 5%"):wikitext("Sprite"):done()
:tag('th'):attr("colspan", "2"):wikitext(frame:expandTemplate{title = "SuperMD", args = {"Pokémon"}}):done()
:tag('th'):attr("colspan", "2"):attr("rowspan", "2"):cssText("width: 10%"):wikitext(frame:expandTemplate{title = "SuperMD", args = {"Type"}}):done()
:tag('th'):attr("rowspan", "2"):cssText("width: 10%"):wikitext(frame:expandTemplate{title = "SuperMD", args = {"Level"}}):done()
:tag('th'):attr("rowspan", "2"):cssText("width: 10%"):wikitext(frame:expandTemplate{title = "SuperMD", args = {"Experience"}}):done()
:tag('th'):attr("rowspan", "2"):cssText("width: 10%"):wikitext("Floors"):done()
:tag('th'):attr("colspan", "2"):wikitext(frame:expandTemplate{title = "SuperMD", args = {"Recruiting", "Recruit Chance"}}):done()
:tag('tr')
:tag('th'):cssText("width: 15%"):wikitext("English"):done()
:tag('th'):cssText("width: 15%"):wikitext("Japanese"):done()
:tag('th'):cssText("width: 10%"):wikitext("Base Chance"):done()
:tag('th'):cssText("width: 10%"):wikitext("Story"):done()
-- Data rows
local rows = mw.html.create()
local i = 1
while true do
local row = mw.html.create()
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 = data[monsterArg]["type1"] or ""
local typeTwo = data[monsterArg]["type2"] or ""
row
:tag('tr'):done()
:tag('th'):wikitext(frame:expandTemplate{title = "SuperMDModel", args = {(monsterArg or ""), size = "32x32px"}}):done()
:tag('td'):wikitext(frame:expandTemplate{title = "SuperMD", args = {(monsterArg or "")}}):done()
:tag('td'):wikitext(data[monsterArg]["ja"]):done()
if typeTwo == nil or typeTwo == '' then
row
:tag('th'):attr("colspan", "2"):wikitext(frame:expandTemplate{title = "SuperMDType", args = {typeOne}}):done()
else
row
:tag('th'):wikitext(frame:expandTemplate{title = "SuperMDType", args = {typeOne}}):done()
:tag('th'):wikitext(frame:expandTemplate{title = "SuperMDType", args = {typeTwo}}):done()
end
row
:tag('td'):wikitext(levelArg or frame:expandTemplate{title = "Research"}):done()
:tag('td'):wikitext(expArg or frame:expandTemplate{title = "Research"}):done()
:tag('td'):wikitext(floorsArg or frame:expandTemplate{title = "Research"}):done()
if recruitableArg == nil or recruitableArg == '' or string.lower(recruitableArg) == "false" or string.lower(recruitableArg) == "no" then
row
:tag('td'):attr("colspan", "2"):wikitext("Unrecruitable"):done()
else
row
:tag('td'):wikitext(data[monsterArg]["recruit"]):done()
:tag('td'):wikitext(data[monsterArg]["story"]):done()
end
rows
:node(row)
:allDone()
i = i + 1
end
output
:tag('table'):addClass("wikitable"):cssText("text-align: center; margin: auto; width: 50%;")
:node(header)
:node(rows)
return tostring(output)
end
return p