Module:Shiren 3 Wii Dungeon Monsters table

MDFW - The Mystery Dungeon Tree of Information.
Jump to navigation Jump to search
Template-info.png Documentation

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
}}
ModelMonsterExperienceMonster ElementFloors
EnglishJapanese
Mamel's model.Mamelマムル2Water[Research required]
Balsam Bug's model.Balsam Bugホウセンムシ3Fire[Research required]
Mouse Minion's model.Mouse Minionねずみ子分4Water[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