Module:Sandbox: Difference between revisions
Jump to navigation
Jump to search
Deleca7755 (talk | contribs) mNo edit summary |
Deleca7755 (talk | contribs) (Work) |
||
Line 27: | Line 27: | ||
:tag('th'):addClass("templatePrimary"):attr("rowspan", "2" ):cssText("width: 10%"):wikitext(frame:expandTemplate{title = "RescueTeamDX", args = {"Recruiting", "Recruit Chance"}}):done() | :tag('th'):addClass("templatePrimary"):attr("rowspan", "2" ):cssText("width: 10%"):wikitext(frame:expandTemplate{title = "RescueTeamDX", args = {"Recruiting", "Recruit Chance"}}):done() | ||
:tag('td'):wikitext(recruit) | :tag('td'):wikitext(recruit) | ||
:tag('tr') | :tag('tr') | ||
:tag('th'):addClass("templatePrimary"):cssText("width: 25%"):wikitext("English"):done() | :tag('th'):addClass("templatePrimary"):cssText("width: 25%"):wikitext("English"):done() | ||
:tag('th'):addClass("templatePrimary"):cssText("width: 25%"):wikitext("Japanese"):done() | :tag('th'):addClass("templatePrimary"):cssText("width: 25%"):wikitext("Japanese"):done() | ||
-- Data rows | -- Data rows | ||
Line 57: | Line 55: | ||
:tag('td'):addClass("templatePrimary"):attr("colspan", "2" ):wikitext(frame:expandTemplate{title = "RescueTeamDXType", args = {typeOne}}):done() | :tag('td'):addClass("templatePrimary"):attr("colspan", "2" ):wikitext(frame:expandTemplate{title = "RescueTeamDXType", args = {typeOne}}):done() | ||
else | else | ||
row | |||
:tag('td'):addClass("templatePrimary"):wikitext(frame:expandTemplate{title = "RescueTeamDXType", args = {typeOne}}):done() | |||
:tag('td'):addClass("templatePrimary"):wikitext(frame:expandTemplate{title = "RescueTeamDXType", args = {typeTwo}}):done() | |||
end | end | ||
row | row | ||
:tag("td"):addClass("templateSecondary"):wikitext(levelArg or frame:expandTemplate{title = "Research"}):done() | :tag("td"):addClass("templateSecondary"):wikitext(levelArg or frame:expandTemplate{title = "Research"}):done() | ||
:tag("td"):addClass("templateSecondary"):wikitext(expArg or frame:expandTemplate{title = "Research"}):done() | |||
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 | ||
row | row | ||
Line 72: | Line 69: | ||
else | else | ||
row | row | ||
:tag("td"):addClass("templateSecondary"):wikitext( | :tag("td"):addClass("templateSecondary"):wikitext(data[monsterArg]['recruit']):done() | ||
end | end | ||
row | |||
:tag("td"):addClass("templateSecondary"):wikitext(floorsarg or frame:expandTemplate{title = "Research"}):done() | |||
rows | rows |
Revision as of 09:58, 14 March 2024
--------------------------------------------------------------------------------
--
-- Module:Rescue Team DX Dungeon Fainted Pokémon table
--
--------------------------------------------------------------------------------
local p = {}
local mw = require('mw')
function p.main(frame)
local data = require("Module:Sandbox/test")
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'):addClass("templatePrimary"):attr("rowspan", "2" ):cssText("width: 10%"):wikitext("Sprite"):done()
:tag('th'):addClass("templatePrimary"):attr("colspan", "2" ):cssText("width: 10%"):wikitext(frame:expandTemplate{title = "RescueTeamDX", args = {"Pokémon"}}):done()
:tag('th'):addClass("templatePrimary"):attr("colspan", "2" ):attr("rowspan", "2" ):cssText("width: 20%"):wikitext(frame:expandTemplate{title = "RescueTeamDX", args = {"Types"}}):done()
:tag('th'):addClass("templatePrimary"):attr("rowspan", "2" ):cssText("width: 10%"):wikitext(frame:expandTemplate{title = "RescueTeamDX", args = {"Level"}}):done()
:tag('th'):addClass("templatePrimary"):attr("rowspan", "2" ):cssText("width: 10%"):wikitext("Floors"):done()
:tag('th'):addClass("templatePrimary"):attr("rowspan", "2" ):cssText("width: 10%"):wikitext(frame:expandTemplate{title = "RescueTeamDX", args = {"Experience"}}):done()
:tag('th'):addClass("templatePrimary"):attr("rowspan", "2" ):cssText("width: 10%"):wikitext(frame:expandTemplate{title = "RescueTeamDX", args = {"Recruiting", "Recruit Chance"}}):done()
:tag('td'):wikitext(recruit)
:tag('tr')
:tag('th'):addClass("templatePrimary"):cssText("width: 25%"):wikitext("English"):done()
:tag('th'):addClass("templatePrimary"):cssText("width: 25%"):wikitext("Japanese"):done()
-- Data rows
local rows = mw.html.create()
for i = 1, 150 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"):addClass("monstersTableRow"):done()
:tag("th"):addClass("templatePrimary"):wikitext(frame:expandTemplate{title = "RescueTeamDXSprite", args = {(monsterArg or ""), size = "50x50px"}}):done()
:tag("td"):addClass("templateSecondary"):wikitext(frame:expandTemplate{title = "RescueTeamDX", args = {(monsterArg or "")}})
:tag("td"):addClass("templateSecondary"):wikitext(data[monsterArg]["ja"])
if typeTwo == nil or typeTwo == '' then
row
:tag('td'):addClass("templatePrimary"):attr("colspan", "2" ):wikitext(frame:expandTemplate{title = "RescueTeamDXType", args = {typeOne}}):done()
else
row
:tag('td'):addClass("templatePrimary"):wikitext(frame:expandTemplate{title = "RescueTeamDXType", args = {typeOne}}):done()
:tag('td'):addClass("templatePrimary"):wikitext(frame:expandTemplate{title = "RescueTeamDXType", args = {typeTwo}}):done()
end
row
:tag("td"):addClass("templateSecondary"):wikitext(levelArg or frame:expandTemplate{title = "Research"}):done()
:tag("td"):addClass("templateSecondary"):wikitext(expArg or frame:expandTemplate{title = "Research"}):done()
if recruitableArg == nil or string.lower(recruitableArg) == "false" or string.lower(recruitableArg) == "no" then
row
:tag("td"):addClass("templateSecondary"):wikitext("Unrecruitable"):done()
else
row
:tag("td"):addClass("templateSecondary"):wikitext(data[monsterArg]['recruit']):done()
end
row
:tag("td"):addClass("templateSecondary"):wikitext(floorsarg or frame:expandTemplate{title = "Research"}):done()
rows
:node(row)
:allDone()
end
output
:tag('table'):addClass("templateTheme"):cssText("text-align: center; margin: auto; width: 50%")
:node(header)
:node(rows)
return tostring(output)
end
return p