Module:Torneko 1 Dungeon Monsters table: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
-- | -- | ||
-- | -- Module:Torneko 1 Dungeon Monsters table | ||
-- | -- | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
Line 10: | Line 10: | ||
function p.main(frame) | function p.main(frame) | ||
local args = frame.args | local args = frame.args | ||
local output = | local output = mw.html.create() | ||
local header = mw.html.create() | |||
-- Header row | -- Header row | ||
header | |||
:tag('tr') | |||
:tag('th'):attr("rowspan", "2"):cssText("width: 10%"):wikitext("Sprite"):done() | |||
:tag('th'):attr("colspan", "2"):wikitext(frame:expandTemplate{title = "Torneko1", args = {"Monster"}}):done() | |||
:tag('th'):attr("rowspan", "2"):cssText("width: 20%"):wikitext(frame:expandTemplate{title = "Torneko1", args = {"Experience"}}):done() | |||
:tag('th'):attr("rowspan", "2"):cssText("width: 20%"):wikitext("Floors"):done() | |||
:tag('td'):wikitext(recruit) | |||
:tag('tr') | |||
:tag('th'):cssText("width: 25%"):wikitext("English"):done() | |||
:tag('th'):cssText("width: 25%"):wikitext("Japanese"):done() | |||
-- | -- Cell rows | ||
local rows = mw.html.create() | |||
local i = 1 | |||
while true do | |||
local row = mw.html.create() | |||
local monsterArg = args["monster_" .. i] | local monsterArg = args["monster_" .. i] | ||
local floorArg = args["floors_" .. i] | local floorArg = args["floors_" .. i] | ||
Line 32: | Line 38: | ||
end | end | ||
monsterArg = (monsterArg or "") | row | ||
:tag("tr") | |||
:tag("th"):wikitext(frame:expandTemplate{title = "Torneko1Sprite", args = {(monsterArg or ""), size = "50x50px"}}):done() | |||
:tag("td"):wikitext(frame:expandTemplate{title = "Torneko1", args = {(monsterArg or "")}}):done() | |||
:tag("td"):wikitext(data[monsterArg]["ja"]) | |||
:tag("td"):wikitext(data[monsterArg]["exp"]) | |||
:tag("td"):wikitext(floorsArg or frame:expandTemplate{title = "Research"}):done() | |||
rows | |||
:node(cellArg) | |||
:allDone() | |||
i = i + 1 | |||
end | end | ||
return | output | ||
:tag('table'):addClass("MDWiki"):cssText("text-align: center; margin: auto; width: 50%;") | |||
:node(header) | |||
:node(rows) | |||
return tostring(output) | |||
end | end | ||
return p | return p |
Revision as of 16:38, 13 April 2024
--------------------------------------------------------------------------------
--
-- Module:Torneko 1 Dungeon Monsters table
--
--------------------------------------------------------------------------------
local p = {}
local mw = require('mw')
function p.main(frame)
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: 10%"):wikitext("Sprite"):done()
:tag('th'):attr("colspan", "2"):wikitext(frame:expandTemplate{title = "Torneko1", args = {"Monster"}}):done()
:tag('th'):attr("rowspan", "2"):cssText("width: 20%"):wikitext(frame:expandTemplate{title = "Torneko1", args = {"Experience"}}):done()
:tag('th'):attr("rowspan", "2"):cssText("width: 20%"):wikitext("Floors"):done()
:tag('td'):wikitext(recruit)
:tag('tr')
:tag('th'):cssText("width: 25%"):wikitext("English"):done()
:tag('th'):cssText("width: 25%"):wikitext("Japanese"):done()
-- Cell rows
local rows = mw.html.create()
local i = 1
while true do
local row = mw.html.create()
local monsterArg = args["monster_" .. i]
local floorArg = args["floors_" .. i]
if not monsterArg and not floorArg then
break -- exit loop when no more rows are found
end
row
:tag("tr")
:tag("th"):wikitext(frame:expandTemplate{title = "Torneko1Sprite", args = {(monsterArg or ""), size = "50x50px"}}):done()
:tag("td"):wikitext(frame:expandTemplate{title = "Torneko1", args = {(monsterArg or "")}}):done()
:tag("td"):wikitext(data[monsterArg]["ja"])
:tag("td"):wikitext(data[monsterArg]["exp"])
:tag("td"):wikitext(floorsArg or frame:expandTemplate{title = "Research"}):done()
rows
:node(cellArg)
:allDone()
i = i + 1
end
output
:tag('table'):addClass("MDWiki"):cssText("text-align: center; margin: auto; width: 50%;")
:node(header)
:node(rows)
return tostring(output)
end
return p