Module:DunPokemon

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

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

function p.sscript(arg) --SS but Instead of making that a module I only made --the parts needed from It Into a function here arg = string.lower(arg) cases = { ["plusle"] = Wdstt({"ID", "Plusle ID"}), ["minun"] = Wdstt({"ID", "Minun ID"}), ["sr"] = Wdstt({"SR", "Secret Room"}) }	return cases[arg] end

function p._main(args) local MS = require('Module:MS').main local ND2 = require('Module:PData').ND2 local PN = require('Module:PData').PN	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 form = 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 tt = args["tt"] or nil local vivillon = args["vivillon"] 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)", ["daydusk"] = "(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})

--To not reqiure both ND and ND2, --ND2 ( the one that Includes form names ) Is used if string.match(num, "-") then --So the hyphen and form Is remove split = mw.text.split(num, "-") num = split[1] end

pokemon = PN({pokemon}) --PN Is a template that displays a Pokemon's name --and Its form In parenthesis and superscript

--To not make the table cell too long, the form --Is split and then put below the name if string.match(pokemon, " ") then form = " "..string.gsub(pokemon, ".- ", " ") pokemon = string.gsub(pokemon, "(.-) .+", "%1") end

--Superscript stuff if ss ~= nil then ss = p.sscript(ss) floor = floor..ss	end

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

--Vivillon pattern if vivillon ~= nil then pokemon = pokemon .. Wdstt({"*", "Evolves into "..vivillon.." pattern Vivillon"}) end

--Passive Pokémon ( do people actually care about this? 	--a past editor started doing It and I just Integrated It	--Into the template ) for _, arg in pairs(args) do		if arg == "passive" then pokemon = pokemon .. Wdstt({"*", "Only attacks in self-defense"}) end end

--Custom wdstt if tt ~= nil then pokemon = pokemon .. Wdstt({"*", tt}) end

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

--Putting the form name ( If there Is one ) below everything if form then pokemon = pokemon..form 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