Module:Shiren 3 Wii Dungeon Monsters table: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 10: | Line 10: | ||
function p.main(frame) | function p.main(frame) | ||
local args = frame.args | local args = frame.args | ||
local output = {} | local output = {} | ||
-- Header row | -- Header row | ||
table.insert(output, '<table class="templateTheme" style="text-align: center; margin: auto; width: 50%;">') | |||
table.insert(output, '<tr>') | table.insert(output, '<tr>') | ||
table.insert(output, '<th class="templatePrimary" rowspan="2" style="border-radius: 1rem 0 0 0; width: 10%;">Model</th>') | table.insert(output, '<th class="templatePrimary" rowspan="2" style="border-radius: 1rem 0 0 0; width: 10%;">Model</th>') |
Revision as of 17:11, 24 June 2023
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 }}
Lua error: expandTemplate: template "Shiren3Model" does not exist.
--------------------------------------------------------------------------------
--
-- Module:Shiren 3 Wii Dungeon Monsters table
--
--------------------------------------------------------------------------------
local p = {}
local mw = require('mw')
function p.main(frame)
local args = frame.args
local output = {}
-- Header row
table.insert(output, '<table class="templateTheme" style="text-align: center; margin: auto; width: 50%;">')
table.insert(output, '<tr>')
table.insert(output, '<th class="templatePrimary" rowspan="2" style="border-radius: 1rem 0 0 0; width: 10%;">Model</th>')
table.insert(output, '<th class="templatePrimary" colspan="2">' .. frame:expandTemplate{title = "Shiren3Wii", args = {"Monsters"}} .. '</th>')
table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 10%;">' .. frame:expandTemplate{title = "Shiren3Wii", args = {"Attributes"}} .. '</th>')
table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 10%;">' .. frame:expandTemplate{title = "Shiren3Wii", args = {"Experience"}} .. '</th>')
table.insert(output, '<th class="templatePrimary" rowspan="2" style="border-radius: 0 1rem 0 0; width: 20%;">Floors</th>')
table.insert(output, '</tr>')
table.insert(output, '<tr>')
table.insert(output, '<th class="templatePrimary" style="width: 25%;">English</th>')
table.insert(output, '<th class="templatePrimary" style="width: 25%;">Japanese</th>')
table.insert(output, '</tr>')
-- Data rows
for i = 1, 100 do
local monsterArg = args["monster_" .. i]
local floorArg = args["floor_" .. i]
if not monsterArg and not floorArg then
break -- exit loop when no more rows are found
end
local rowData = {}
table.insert(rowData, '<tr class="monstersTableRow">')
table.insert(rowData, '<th class="templatePrimary">' .. frame:expandTemplate{title = "Shiren3Model", args = {(monsterArg or "")}} .. '</th>')
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Shiren3Wii", args = {(monsterArg or "")}} .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Shiren 3 Monster Data Cell|shiren3MonsterDataCell|name=' .. (monsterArg or "") .. '|getVar=ja}}') .. '</td>')
table.insert(rowData, '<td class="templateSecondary" style="' .. 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; }}') .. '">' .. frame:preprocess('{{#invoke:Shiren 3 Monster Data Cell|shiren3MonsterDataCell|name=' .. (monsterArg or "") .. '|getVar=type}}') .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Shiren 3 Monster Data Cell|shiren3MonsterDataCell|name=' .. (monsterArg or "") .. '|getVar=exp}}') .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. (floorArg or "") .. '</td>')
table.insert(rowData, '</tr>')
table.insert(output, table.concat(rowData))
end
table.insert(output, '</table>')
return table.concat(output)
end
return p