Module:Rescue Team Dungeon Bosses table: Difference between revisions

MDFW - The Mystery Dungeon Tree of Information.
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 41: Line 41:
local moveEight = frame:preprocess('{{#invoke:Rescue Team Boss Data Cell|rescueTeamBossDataCell|name=' .. (bossArg or "") .. '|getVar=move8}}')
local moveEight = frame:preprocess('{{#invoke:Rescue Team Boss Data Cell|rescueTeamBossDataCell|name=' .. (bossArg or "") .. '|getVar=move8}}')
local moveNine = frame:preprocess('{{#invoke:Rescue Team Boss Data Cell|rescueTeamBossDataCell|name=' .. (bossArg or "") .. '|getVar=move9}}')
local moveNine = frame:preprocess('{{#invoke:Rescue Team Boss Data Cell|rescueTeamBossDataCell|name=' .. (bossArg or "") .. '|getVar=move9}}')
local typeOne = frame:preprocess('{{#invoke:Rescue Team Pokémon Data Cell|rescueTeamPokemonDataCell|name=' .. (bossArg or "") .. '|getVar=type1}}')
local typeOne = frame:preprocess('{{#invoke:Rescue Team Boss Data Cell|rescueTeamBossDataCell|name=' .. (bossArg or "") .. '|getVar=type1}}')
local typeTwo = frame:preprocess('{{#invoke:Rescue Team Pokémon Data Cell|rescueTeamPokemonDataCell|name=' .. (bossArg or "") .. '|getVar=type2}}')
local typeTwo = frame:preprocess('{{#invoke:Rescue Team Boss Data Cell|rescueTeamBossDataCell|name=' .. (bossArg or "") .. '|getVar=type2}}')
local rowData = {}
local rowData = {}
table.insert(rowData, '<tr class="bossesTableRow">')
table.insert(rowData, '<tr class="bossesTableRow">')
Line 51: Line 51:
table.insert(rowData, '<td class="templateSecondary" rowspan="9">' .. frame:expandTemplate{title = "RescueTeam", args = {(bossArg or "") .. ' (boss)', (bossArg or "")}} .. '</td>')
table.insert(rowData, '<td class="templateSecondary" rowspan="9">' .. frame:expandTemplate{title = "RescueTeam", args = {(bossArg or "") .. ' (boss)', (bossArg or "")}} .. '</td>')
end
end
table.insert(rowData, '<td class="templateSecondary" rowspan="9">' .. frame:preprocess('{{#invoke:Rescue Team Pokémon Data Cell|rescueTeamPokemonDataCell|name=' .. (bossArg or "") .. '|getVar=ja}}') .. '</td>')
table.insert(rowData, '<td class="templateSecondary" rowspan="9">' .. frame:preprocess('{{#invoke:Rescue Team Boss Data Cell|rescueTeamBossDataCell|name=' .. (bossArg or "") .. '|getVar=ja}}') .. '</td>')
if typeTwo == nil or typeTwo == '' then
if typeTwo == nil or typeTwo == '' then
table.insert(rowData, '<td class="templatePrimary" rowspan="9" colspan="2">' .. frame:expandTemplate{title = "TypePKMN", args = {typeOne}} .. '</td>')
table.insert(rowData, '<td class="templatePrimary" rowspan="9" colspan="2">' .. frame:expandTemplate{title = "TypePKMN", args = {typeOne}} .. '</td>')

Revision as of 19:43, 30 July 2023

Documentation for this module may be created at Module:Rescue Team Dungeon Bosses table/doc

--------------------------------------------------------------------------------
--
--			Module:Rescue Team Dungeon Bosses 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%;">Sprite</th>')
	table.insert(output, '<th class="templatePrimary" colspan="2">' .. frame:expandTemplate{title = "RescueTeam", args = {"Bosses"}} .. '</th>')
	table.insert(output, '<th class="templatePrimary" colspan="2" rowspan="2" style="width: 10%;">' .. frame:expandTemplate{title = "RescueTeam", args = {"Types"}} .. '</th>')
	table.insert(output, '<th class="templatePrimary" rowspan="2" style="width: 10%;">' .. frame:expandTemplate{title = "RescueTeam", args = {"Level"}} .. '</th>')
	table.insert(output, '<th class="templatePrimary" colspan="2" rowspan="2" style="border-radius: 0 1rem 0 0; width: 30%;">' .. frame:expandTemplate{title = "RescueTeam", args = {"Moves"}} .. '</th>')
	table.insert(output, '</tr>')
	table.insert(output, '<tr>')
	table.insert(output, '<th class="templatePrimary" style="width: 20%;">English</th>')
	table.insert(output, '<th class="templatePrimary" style="width: 20%;">Japanese</th>')
	table.insert(output, '</tr>')
	-- Data rows
	for i = 1, 100 do
		local bossArg = args["boss_" .. i]
		local caseArg = args["case_" .. i]
		local levelArg = args["level_" .. i]
		if not bossArg and not caseArg and not levelArg then
			break -- exit loop when no more rows are found
		end
		local moveOne = frame:preprocess('{{#invoke:Rescue Team Boss Data Cell|rescueTeamBossDataCell|name=' .. (bossArg or "") .. '|getVar=move1}}')
		local moveTwo = frame:preprocess('{{#invoke:Rescue Team Boss Data Cell|rescueTeamBossDataCell|name=' .. (bossArg or "") .. '|getVar=move2}}')
		local moveThree = frame:preprocess('{{#invoke:Rescue Team Boss Data Cell|rescueTeamBossDataCell|name=' .. (bossArg or "") .. '|getVar=move3}}')
		local moveFour = frame:preprocess('{{#invoke:Rescue Team Boss Data Cell|rescueTeamBossDataCell|name=' .. (bossArg or "") .. '|getVar=move4}}')
		local moveFive = frame:preprocess('{{#invoke:Rescue Team Boss Data Cell|rescueTeamBossDataCell|name=' .. (bossArg or "") .. '|getVar=move5}}')
		local moveSix = frame:preprocess('{{#invoke:Rescue Team Boss Data Cell|rescueTeamBossDataCell|name=' .. (bossArg or "") .. '|getVar=move6}}')
		local moveSeven = frame:preprocess('{{#invoke:Rescue Team Boss Data Cell|rescueTeamBossDataCell|name=' .. (bossArg or "") .. '|getVar=move7}}')
		local moveEight = frame:preprocess('{{#invoke:Rescue Team Boss Data Cell|rescueTeamBossDataCell|name=' .. (bossArg or "") .. '|getVar=move8}}')
		local moveNine = frame:preprocess('{{#invoke:Rescue Team Boss Data Cell|rescueTeamBossDataCell|name=' .. (bossArg or "") .. '|getVar=move9}}')
		local typeOne = frame:preprocess('{{#invoke:Rescue Team Boss Data Cell|rescueTeamBossDataCell|name=' .. (bossArg or "") .. '|getVar=type1}}')
		local typeTwo = frame:preprocess('{{#invoke:Rescue Team Boss Data Cell|rescueTeamBossDataCell|name=' .. (bossArg or "") .. '|getVar=type2}}')
		local rowData = {}
		table.insert(rowData, '<tr class="bossesTableRow">')
		table.insert(rowData, '<th class="templatePrimary" rowspan="9">' .. frame:expandTemplate{title = "RescueTeamSprite", args = {(bossArg or "")}} ..'</th>')
		if caseArg then
			table.insert(rowData, '<td class="templateSecondary" rowspan="9">' .. frame:expandTemplate{title = "RescueTeam", args = {(bossArg or "") .. ' (boss - ' .. (caseArg or "") .. ')', (bossArg or "")}} .. '<br>(' .. caseArg .. ')</td>')
		else
			table.insert(rowData, '<td class="templateSecondary" rowspan="9">' .. frame:expandTemplate{title = "RescueTeam", args = {(bossArg or "") .. ' (boss)', (bossArg or "")}} .. '</td>')
		end
		table.insert(rowData, '<td class="templateSecondary" rowspan="9">' .. frame:preprocess('{{#invoke:Rescue Team Boss Data Cell|rescueTeamBossDataCell|name=' .. (bossArg or "") .. '|getVar=ja}}') .. '</td>')
		if typeTwo == nil or typeTwo == '' then
			table.insert(rowData, '<td class="templatePrimary" rowspan="9" colspan="2">' .. frame:expandTemplate{title = "TypePKMN", args = {typeOne}} .. '</td>')
		else
			table.insert(rowData, '<td class="templatePrimary" rowspan="9">' .. frame:expandTemplate{title = "TypePKMN", args = {typeOne}} .. '</td>')
			table.insert(rowData, '<td class="templatePrimary" rowspan="9">' .. frame:expandTemplate{title = "TypePKMN", args = {typeTwo}} .. '</td>')
		end
		table.insert(rowData, '<td class="templateSecondary" rowspan="9">' .. (levelArg or "") .. '</td>')
		table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "RescueTeam", args = {moveOne}} .. '</td>')
		table.insert(rowData, '</tr>')
		if not (moveTwo == '') and not (moveTwo == nil) then
			table.insert(rowData, '<tr class="bossesTableRow">')
			table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "RescueTeam", args = {moveTwo}} .. '</td>')
			table.insert(rowData, '</tr>')
		end
		if not (moveThree == '') and not (moveThree == nil) then
			table.insert(rowData, '<tr class="bossesTableRow">')
			table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "RescueTeam", args = {moveThree}} .. '</td>')
			table.insert(rowData, '</tr>')
		end
		if not (moveFour == '') and not (moveFour == nil) then
			table.insert(rowData, '<tr class="bossesTableRow">')
			table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "RescueTeam", args = {moveFour}} .. '</td>')
			table.insert(rowData, '</tr>')
		end
		if not (moveFive == '') and not (moveFive == nil) then
			table.insert(rowData, '<tr class="bossesTableRow">')
			table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "RescueTeam", args = {moveFive}} .. '</td>')
			table.insert(rowData, '</tr>')
		end
		if not (moveSix == '') and not (moveSix == nil) then
			table.insert(rowData, '<tr class="bossesTableRow">')
			table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "RescueTeam", args = {moveSix}} .. '</td>')
			table.insert(rowData, '</tr>')
		end
		if not (moveSeven == '') and not (moveSeven == nil) then
			table.insert(rowData, '<tr class="bossesTableRow">')
			table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "RescueTeam", args = {moveSeven}} .. '</td>')
			table.insert(rowData, '</tr>')
		end
		if not (moveEight == '') and not (moveEight == nil) then
			table.insert(rowData, '<tr class="bossesTableRow">')
			table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "RescueTeam", args = {moveEight}} .. '</td>')
			table.insert(rowData, '</tr>')
		end
		if not (moveNine == '') and not (moveNine == nil) then
			table.insert(rowData, '<tr class="bossesTableRow">')
			table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "RescueTeam", args = {moveNine}} .. '</td>')
			table.insert(rowData, '</tr>')
		end
		table.insert(output, table.concat(rowData))
	end
	table.insert(output, '</table>')
	return table.concat(output)
end

return p