Module:DunPokemon

local getArgs = require('Module:Arguments').getArgs local p = {}

function p.main(frame) local args = getArgs(frame) return p._main(args) end

function p._main(args) local MS = require('Module:MS').main local ND2 = require('Module:PData').ND2 local PN = require('Module:PData').PN	local Wdstt = require('Module:Wdstt').main local TableColor = require('Module:TableColor').main local port = args[1] or nil local num = args[1] or nil local pokemon = args[1] or nil local floor = args[2] or '??-??' local recruit = args[3] or nil local ss = args["ss"] or nil local time = args["time"] or nil local unrec = args["unrec"] or nil local color = args["color"] or nil local row = mw.html.create local cells = mw.html.create

local times = { ["dawn"] = "(Dawn)", ["day"] = "(Day)", ["dusk"] = "(Dusk)", ["night"] = "(Night)", --(Dawn/Day) ["dawnday"] = "(Dawn/Day)", ["daydawn"] = "(Dawn/Day)", --(Dawn/Dusk) ["dawndusk"] = "(Dawn/Dusk)", ["duskdawn"] = "(Dawn/Dusk)", --(Dawn/Night) ["dawnnight"] = "(Dawn/Night)", ["nightdawn"] = "(Dawn/Night)", --(Day/Dusk) ["duskday"] = "(Day/Dusk)", ["duskday"] = "(Day/Dusk)", --(Day/Night) ["daynight"] = "(Day/Night)", ["nightday"] = "(Day/Night)", --(Dusk/Night) ["dusknight"] = "(Dusk/Night)", ["nightdusk"] = "(Dusk/Night)", --(Dawn/Day/Dusk) ["daydawndusk"] = "(Dawn/Day/Dusk)", ["dayduskdawn"] = "(Dawn/Day/Dusk)", ["dawndaydusk"] = "(Dawn/Day/Dusk)", ["duskdaydawn"] = "(Dawn/Day/Dusk)", ["duskdawnday"] = "(Dawn/Day/Dusk)", ["dawnduskday"] = "(Dawn/Day/Dusk)", --(Dawn/Day/Night) ["nightdaydawn"] = "(Dawn/Day/Night)", ["nightdawnday"] = "(Dawn/Day/Night)", ["daynightdawn"] = "(Dawn/Day/Night)", ["dawnnightday"] = "(Dawn/Day/Night)", ["dawndaynight"] = "(Dawn/Day/Night)", ["daydawnnight"] = "(Dawn/Day/Night)", --(Day/Dusk/Night) ["nightduskday"] = "(Day/Dusk/Night)", ["nightdaydusk"] = "(Day/Dusk/Night)", ["daynightdusk"] = "(Day/Dusk/Night)", ["dusknightday"] = "(Day/Dusk/Night)", ["daydusknight"] = "(Day/Dusk/Night)", ["duskdaynight"] = "(Day/Dusk/Night)", --(Dawn/Dusk/Night) ["nightduskdawn"] = "(Dawn/Dusk/Night)", ["nightdawndusk"] = "(Dawn/Dusk/Night)", ["dusknightdawn"] = "(Dawn/Dusk/Night)", ["dawnnightdusk"] = "(Dawn/Dusk/Night)", ["dawndusknight"] = "(Dawn/Dusk/Night)", ["duskdawnnight"] = "(Dawn/Dusk/Night)" }

port = MS({pokemon}) num = ND2({num}) split = mw.text.split(num, "-") num = split[1] pokemon = PN({pokemon})

--if ss ~= nil then --	floor = floor..mw.getCurrentFrame:expandTemplate({title='ss', args={ ss } }) --end

if recruit ~= nil then pokemon = ""..pokemon.."" recruit = recruit.."%" if unrec ~= nil then recruit = Wdstt({"*", "Unrecruitable after floor "..unrec}) end else recruit = "Unrecruitable" end

if args[4] == "passive" then pokemon = Wdstt({"*", "Only attacks in self-defense"}) end

if time ~= nil then if string.match(time, "/") then time = string.gsub(time, "/", "") end floor = floor.." "..times[time] end

cells :tag('td'):wikitext(port) :done :tag('td'):wikitext(num) :done :tag('td'):wikitext(pokemon) :done :tag('td'):wikitext(floor) :done :tag('td'):wikitext(recruit) :done

if color then row :tag('tr'):css( 'background-color', "#"..TableColor({"row", color}) ) :node(cells) else row :tag('tr'):css( 'background-color', "#"..TableColor({"row"}) ) :node(cells) end

return tostring(row) end

return p

-- print(p.main)