Template:Sandbox: Difference between revisions

MDFW - The Mystery Dungeon Tree of Information.
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 1: Line 1:
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
--
-- Module:Rescue Team DX Moves table
-- Module:Rescue Team DX Pokémon Locations table
--
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Line 19: Line 19:
table.insert(output, '<th colspan="1" class="templatePrimary" style="width: 15%;">Method</th>')
table.insert(output, '<th colspan="1" class="templatePrimary" style="width: 15%;">Method</th>')
table.insert(output, '<th colspan="1" class="templatePrimary" style="width: 15%;">Spawn Rate</th>')
table.insert(output, '<th colspan="1" class="templatePrimary" style="width: 15%;">Spawn Rate</th>')
table.insert(output, '</tr>')
table.insert(output, '<tr>')
table.insert(output, '</tr>')
table.insert(output, '</tr>')
-- Data rows
-- Data rows
for i = 1, 100 do
for i = 1, 100 do
local moveArg = args["move_" .. i]
local locationArg = args["location_" .. i]
local levelArg = args["level_" .. i]
local floorsArg = args["floors_" .. i]
if not moveArg and not levelArg then
local levelsArg = args["levels_" .. i]
local methodArg = args["method_" .. i]
local spawnArg = args["spawnrate_" .. i]
if not locationArg and not floorsArg and not levelsArg and not methodArg and not spawnArg then
break -- exit loop when no more rows are found
break -- exit loop when no more rows are found
end
end
local moveType = frame:preprocess('{{#invoke:Rescue Team DX Move Data Cell|rescueTeamDXMoveDataCell|name=' .. (moveArg or "") .. '|getVar=type}}')
local rowData = {}
local rowData = {}
table.insert(rowData, '<tr class="itemsTableRow">')
table.insert(rowData, '<tr class="itemsTableRow">')
if moveArg then
if locationArg then
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "RescueTeamDX", args = {moveArg}} .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "RescueTeamDX", args = {moveArg}} .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Rescue Team DX Move Data Cell|rescueTeamDXMoveDataCell|name=' .. moveArg .. '|getVar=ja}}') .. '</td>')
table.insert(rowData, '<td class="templatePrimary">' .. frame:expandTemplate{title = "TypePKMN", args = {moveType}} .. '</td>')
else
else
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Research"} .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Research"} .. '</td>')
Line 43: Line 40:
end
end
table.insert(rowData, '<td class="templateSecondary">' .. (levelArg or frame:expandTemplate{title = "Research"}) .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. (levelArg or frame:expandTemplate{title = "Research"}) .. '</td>')
if moveArg then
table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Rescue Team DX Move Data Cell|rescueTeamDXMoveDataCell|name=' .. moveArg .. '|getVar=pp}}') .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. frame:preprocess('{{#invoke:Rescue Team DX Move Data Cell|rescueTeamDXMoveDataCell|name=' .. moveArg .. '|getVar=range}}') .. '</td>')
else
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Research"} .. '</td>')
table.insert(rowData, '<td class="templateSecondary">' .. frame:expandTemplate{title = "Research"} .. '</td>')
end
end
table.insert(rowData, '</tr>')
table.insert(rowData, '</tr>')

Revision as of 05:04, 23 October 2023


-- -- Module:Rescue Team DX Pokémon Locations table --


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

function p.main(frame) local args = frame.args local output = {} -- Header row

table.insert(output, '

') table.insert(output, '') table.insert(output, '') table.insert(output, '') table.insert(output, '') table.insert(output, '') table.insert(output, '') table.insert(output, '') -- Data rows for i = 1, 100 do local locationArg = args["location_" .. i] local floorsArg = args["floors_" .. i] local levelsArg = args["levels_" .. i] local methodArg = args["method_" .. i] local spawnArg = args["spawnrate_" .. i] if not locationArg and not floorsArg and not levelsArg and not methodArg and not spawnArg then break -- exit loop when no more rows are found end local rowData = {} table.insert(rowData, '') if locationArg then table.insert(rowData, '')

else

table.insert(rowData, '') table.insert(rowData, '') table.insert(rowData, '')

end

table.insert(rowData, '')

end

table.insert(rowData, '') table.insert(output, table.concat(rowData)) end table.insert(output, '
LocationFloors' .. frame:expandTemplate{title = "RescueTeamDX", args = {"Levels"}} .. 'MethodSpawn Rate
' .. frame:expandTemplate{title = "RescueTeamDX", args = {moveArg}} .. '' .. frame:expandTemplate{title = "Research"} .. '' .. frame:expandTemplate{title = "Research"} .. '' .. frame:expandTemplate{title = "Research"} .. '' .. (levelArg or frame:expandTemplate{title = "Research"}) .. '

')

return table.concat(output) end

return p