Module:Sandbox: Difference between revisions

MDFW - The Mystery Dungeon Tree of Information.
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 39: Line 39:
local expArg = args["exp_" .. i]
local expArg = args["exp_" .. i]
local recruitableArg = args["recruitable_" .. i]
local recruitableArg = args["recruitable_" .. i]
if not monsterArg and not floorsArg and not recruitableArg and not expArg and not levelArg then
if not monsterArg and not floorsArg and not recruitableArg and not expArg and not levelArg then
break -- exit loop when no more rows are found
break -- exit loop when no more rows are found
end
end
local typeOne = data[monsterArg]["type1"] or ""
local typeOne = data[monsterArg]["type1"] or ""
local typeTwo = data[monsterArg]["type2"] or ""
local typeTwo = data[monsterArg]["type2"] or ""
row
row
:tag("tr"):addClass("monstersTableRow"):done()
:tag("tr"):addClass("monstersTableRow"):done()
:tag("th"):addClass("templatePrimary"):wikitext(frame:expandTemplate{title = "RescueTeamDXSprite", args = {(monsterArg or ""), size = "50x50px"}}):done()
:tag("th"):addClass("templatePrimary"):wikitext(frame:expandTemplate{title = "RescueTeamDXSprite", args = {(monsterArg or ""), size = "50x50px"}}):done()
:tag("td"):addClass("templateSecondary"):wikitext(frame:expandTemplate{title = "RescueTeamDX", args = {(monsterArg or "")}}):done()
:tag("td"):addClass("templateSecondary"):wikitext(frame:expandTemplate{title = "RescueTeamDX", args = {(monsterArg or "")}}):done()
:tag("td"):addClass("templateSecondary"):wikitext(data[monsterArg]["ja"]):done()
:tag("td"):addClass("templateSecondary"):wikitext(data[monsterArg]["ja"]):done()
if typeTwo == nil or typeTwo == '' then
if typeTwo == nil or typeTwo == '' then
Line 57: Line 59:
:tag('td'):addClass("templatePrimary"):wikitext(frame:expandTemplate{title = "RescueTeamDXType", args = {typeOne}}):done()
:tag('td'):addClass("templatePrimary"):wikitext(frame:expandTemplate{title = "RescueTeamDXType", args = {typeOne}}):done()
:tag('td'):addClass("templatePrimary"):wikitext(frame:expandTemplate{title = "RescueTeamDXType", args = {typeTwo}}):done()
:tag('td'):addClass("templatePrimary"):wikitext(frame:expandTemplate{title = "RescueTeamDXType", args = {typeTwo}}):done()
end


end
row
row
:tag("td"):addClass("templateSecondary"):wikitext(levelArg or frame:expandTemplate{title = "Research"}):done()
:tag("td"):addClass("templateSecondary"):wikitext(levelArg or frame:expandTemplate{title = "Research"}):done()

Revision as of 18:14, 25 July 2024



--------------------------------------------------------------------------------
--
--				Module:Rescue Team DX Dungeon Fainted Pokémon table
--
--------------------------------------------------------------------------------

local p = {}
local mw = require('mw')

function p.main(frame)
	local data = require("Module:Sandbox/test")
	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'):addClass("templatePrimary"):attr("rowspan", "2" ):cssText("width: 10%"):wikitext("Sprite"):done()
			:tag('th'):addClass("templatePrimary"):attr("colspan", "2" ):cssText("width: 10%"):wikitext(frame:expandTemplate{title = "RescueTeamDX", args = {"Pokémon"}}):done()
			:tag('th'):addClass("templatePrimary"):attr("colspan", "2" ):attr("rowspan", "2" ):cssText("width: 20%"):wikitext(frame:expandTemplate{title = "RescueTeamDX", args = {"Types"}}):done()
			:tag('th'):addClass("templatePrimary"):attr("rowspan", "2" ):cssText("width: 10%"):wikitext(frame:expandTemplate{title = "RescueTeamDX", args = {"Level"}}):done()
			:tag('th'):addClass("templatePrimary"):attr("rowspan", "2" ):cssText("width: 10%"):wikitext(frame:expandTemplate{title = "RescueTeamDX", args = {"Experience"}}):done()
			:tag('th'):addClass("templatePrimary"):attr("rowspan", "2" ):cssText("width: 10%"):wikitext("Floors"):done()
			:tag('th'):addClass("templatePrimary"):attr("rowspan", "2" ):cssText("width: 10%"):wikitext(frame:expandTemplate{title = "RescueTeamDX", args = {"Recruiting", "Recruit Chance"}}):done()
		:tag('tr')
			:tag('th'):addClass("templatePrimary"):cssText("width: 25%"):wikitext("English"):done()
			:tag('th'):addClass("templatePrimary"):cssText("width: 25%"):wikitext("Japanese"):done()

	-- Data rows
	local rows = mw.html.create()
	for i = 1, 150 do
		local row = mw.html.create()
		local monsterArg = args["pokémon_" .. i]
		local floorsArg = args["floors_" .. i]
		local levelArg = args["level_" .. i]
		local expArg = args["exp_" .. i]
		local recruitableArg = args["recruitable_" .. i]

		if not monsterArg and not floorsArg and not recruitableArg and not expArg and not levelArg then
			break -- exit loop when no more rows are found
		end

		local typeOne = data[monsterArg]["type1"] or ""
		local typeTwo = data[monsterArg]["type2"] or ""
		row
			:tag("tr"):addClass("monstersTableRow"):done()
				:tag("th"):addClass("templatePrimary"):wikitext(frame:expandTemplate{title = "RescueTeamDXSprite", args = {(monsterArg or ""), size = "50x50px"}}):done()
				:tag("td"):addClass("templateSecondary"):wikitext(frame:expandTemplate{title = "RescueTeamDX", args = {(monsterArg or "")}}):done()
				:tag("td"):addClass("templateSecondary"):wikitext(data[monsterArg]["ja"]):done()
			
		if typeTwo == nil or typeTwo == '' then
			row
				:tag('td'):addClass("templatePrimary"):attr("colspan", "2" ):wikitext(frame:expandTemplate{title = "RescueTeamDXType", args = {typeOne}}):done()
		else
			row
				:tag('td'):addClass("templatePrimary"):wikitext(frame:expandTemplate{title = "RescueTeamDXType", args = {typeOne}}):done()
				:tag('td'):addClass("templatePrimary"):wikitext(frame:expandTemplate{title = "RescueTeamDXType", args = {typeTwo}}):done()
		end

		row
			:tag("td"):addClass("templateSecondary"):wikitext(levelArg or frame:expandTemplate{title = "Research"}):done()
			:tag("td"):addClass("templateSecondary"):wikitext(expArg or frame:expandTemplate{title = "Research"}):done()
			:tag("td"):addClass("templateSecondary"):wikitext(floorsArg or frame:expandTemplate{title = "Research"}):done()

		if recruitableArg == nil or string.lower(recruitableArg) == "false" or string.lower(recruitableArg) == "no" then
			row
				:tag("td"):addClass("templateSecondary"):wikitext("Unrecruitable"):done()
		else
			row
				:tag("td"):addClass("templateSecondary"):wikitext(data[monsterArg]['recruit']):done()
		end
		
		rows
			:node(row)
			:allDone()
			
	end
		
		output
			:tag('table'):addClass("templateTheme"):cssText("text-align: center; margin: auto; width: 50%")
				:node(header)
				:node(rows)
		return  tostring(output)

end

return p