Module:Shiren 3 Wii Dungeon Monsters table: Difference between revisions
Jump to navigation
Jump to search
N. Harmonik (talk | contribs) mNo edit summary |
No edit summary |
||
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 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("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 = {"Attribute"}}):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:{{#invoke:Shiren 3 Monster Data Cell|shiren3MonsterDataCell|name=' .. (monsterArg or "") .. '|getVar=type}} | Water=background: #0000FF!important; color: white; | Nature=background: #228B22!important; | Fire=background: #FF0000!important; | Thunder=background: #FFFF00!important; | Shadow=background: #000000!important; color: white; | Earth=background: #8B4513!important; | Spirit=background: #FF69B4!important; | Illusion=background: #8A2BE2!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("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 11:53, 14 July 2024
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 | Attribute | 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 = {"Attribute"}}):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:{{#invoke:Shiren 3 Monster Data Cell|shiren3MonsterDataCell|name=' .. (monsterArg or "") .. '|getVar=type}} | Water=background: #0000FF!important; color: white; | Nature=background: #228B22!important; | Fire=background: #FF0000!important; | Thunder=background: #FFFF00!important; | Shadow=background: #000000!important; color: white; | Earth=background: #8B4513!important; | Spirit=background: #FF69B4!important; | Illusion=background: #8A2BE2!important; }}'))
:tag("td"):wikitext(floorsArg or frame:expandTemplate{title = "Research"}):done()
rows
:node(row)
: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