Module:Shiren 3 Wii Dungeon Monsters table: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
(13 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
-- | -- | ||
-- | -- Module:Shiren 3 Wii Dungeon Monsters table | ||
-- | -- | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
Line 9: | Line 9: | ||
function p.main(frame) | function p.main(frame) | ||
local data = require("Module:Shiren 3 Wii Monster Data Cell") | |||
local metatable = {__index = function () return "" end} | |||
setmetatable(data, metatable) | |||
local args = frame.args | local args = frame.args | ||
local | |||
local | 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("Model"):done() | |||
:tag('th'):attr("colspan", "2"):wikitext(frame:expandTemplate{title = "Shiren3Wii", args = {"Monster"}}):done() | |||
:tag('th'):attr("rowspan", "2"):cssText("width: 10%"):wikitext(frame:expandTemplate{title = "Shiren3Wii", args = {"Experience"}}):done() | |||
:tag('th'):attr("rowspan", "2"):cssText("width: 10%"):wikitext(frame:expandTemplate{title = "Shiren3Wii", args = {"Monster Element"}}):done() | |||
:tag('th'):attr("rowspan", "2"):cssText("width: 20%"):wikitext("Floors"):done() | |||
:tag('tr') | |||
:tag('th'):cssText("width: 25%"):wikitext("English"):done() | |||
:tag('th'):cssText("width: 25%"):wikitext("Japanese"):done() | |||
-- Data rows | -- Data 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 | local floorsArg = args["floors_" .. i] | ||
if not monsterArg and not | |||
if not monsterArg and not floorsArg then | |||
break -- exit loop when no more rows are found | break -- exit loop when no more rows are found | ||
end | end | ||
row | |||
:tag("tr") | |||
:tag("th"):wikitext(frame:expandTemplate{title = "Shiren3WiiModel", args = {(monsterArg or ""), size = "50x50px"}}):done() | |||
:tag("td"):wikitext(frame:expandTemplate{title = "Shiren3Wii", args = {(monsterArg or "")}}):done() | |||
:tag("td"):wikitext(data[monsterArg]["ja"]) | |||
:tag("td"):wikitext(data[monsterArg]["exp"]) | |||
:tag("td"):wikitext(data[monsterArg]["type"]):cssText("background-color: " .. frame:preprocess('{{#switch: {{lc: ' .. (data[monsterArg]["type"] or "") .. '}} | water=#0000FF!important; color: white | steel=#696969!important; color: black | nature=#228B22!important | fire=#FF0000!important | thunder=#FFFF00!important | shadow=#000000!important; color: white | earth=#8B4513!important | spirit=#FF69B4!important | illusion=#8A2BE2!important | special=#FF8C00!important }}') .. ";") | |||
:tag("td"):wikitext(floorsArg or frame:expandTemplate{title = "Research"}):done() | |||
rows | |||
:node(row) | |||
:allDone() | |||
i = i + 1 | |||
end | end | ||
return | output | ||
:tag('table'):addClass("wikitable"):cssText("text-align: center; margin: auto; width: 50%;") | |||
:node(header) | |||
:node(rows) | |||
return tostring(output) | |||
end | end | ||
return p | return p |
Latest revision as of 09:09, 26 January 2025
This template generates a list of monsters present in a dungeon for Shiren the Wanderer 3: The Sleeping Princess and the Karakuri Mansion.
Usage
{{#invoke:Shiren 3 Wii Dungeon Monsters table|main | type = | monster_1 = | floor_1 = ... | monster_n = | floor_n = }}
Example
{{#invoke:Shiren 3 Wii Dungeon Monsters table|main | type = past | monster_1 = Mamel | floor_1 = 1 - 3 | monster_2 = Balsam Bug | floor_2 = 1 - 3 | monster_3 = Mouse Minion | floor_3 = 1 - 3 }}
Model | Monster | Experience | Monster Element | Floors | |
---|---|---|---|---|---|
English | Japanese | ||||
![]() | Mamel | マムル | 2 | Water | [Research required] |
![]() | Balsam Bug | ホウセンムシ | 3 | Fire | [Research required] |
![]() | Mouse Minion | ねずみ子分 | 4 | Water | [Research required] |
--------------------------------------------------------------------------------
--
-- Module:Shiren 3 Wii Dungeon Monsters table
--
--------------------------------------------------------------------------------
local p = {}
local mw = require('mw')
function p.main(frame)
local data = require("Module:Shiren 3 Wii Monster 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: 10%"):wikitext("Model"):done()
:tag('th'):attr("colspan", "2"):wikitext(frame:expandTemplate{title = "Shiren3Wii", args = {"Monster"}}):done()
:tag('th'):attr("rowspan", "2"):cssText("width: 10%"):wikitext(frame:expandTemplate{title = "Shiren3Wii", args = {"Experience"}}):done()
:tag('th'):attr("rowspan", "2"):cssText("width: 10%"):wikitext(frame:expandTemplate{title = "Shiren3Wii", args = {"Monster Element"}}):done()
:tag('th'):attr("rowspan", "2"):cssText("width: 20%"):wikitext("Floors"):done()
:tag('tr')
:tag('th'):cssText("width: 25%"):wikitext("English"):done()
:tag('th'):cssText("width: 25%"):wikitext("Japanese"):done()
-- Data rows
local rows = mw.html.create()
local i = 1
while true do
local row = mw.html.create()
local monsterArg = args["monster_" .. i]
local floorsArg = args["floors_" .. i]
if not monsterArg and not floorsArg then
break -- exit loop when no more rows are found
end
row
:tag("tr")
:tag("th"):wikitext(frame:expandTemplate{title = "Shiren3WiiModel", args = {(monsterArg or ""), size = "50x50px"}}):done()
:tag("td"):wikitext(frame:expandTemplate{title = "Shiren3Wii", args = {(monsterArg or "")}}):done()
:tag("td"):wikitext(data[monsterArg]["ja"])
:tag("td"):wikitext(data[monsterArg]["exp"])
:tag("td"):wikitext(data[monsterArg]["type"]):cssText("background-color: " .. frame:preprocess('{{#switch: {{lc: ' .. (data[monsterArg]["type"] or "") .. '}} | water=#0000FF!important; color: white | steel=#696969!important; color: black | nature=#228B22!important | fire=#FF0000!important | thunder=#FFFF00!important | shadow=#000000!important; color: white | earth=#8B4513!important | spirit=#FF69B4!important | illusion=#8A2BE2!important | special=#FF8C00!important }}') .. ";")
:tag("td"):wikitext(floorsArg or frame:expandTemplate{title = "Research"}):done()
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