置顶公告:【置顶】关于临时开启评论区所有功能的公告(2022.10.22) | 【置顶】关于本站Widget恢复使用的公告
  • 你好~!欢迎来到萌娘百科镜像站!如需查看或编辑,请联系本站管理员注册账号。
  • 本镜像站和其他萌娘百科的镜像站无关,请注意分别。

Module:Pokemon Number

贴贴♀百科,万娘皆可贴的百科全书!转载请标注来源页面的网页链接,并声明引自贴贴百科。内容不可商用。
跳到导航 跳到搜索
Template-info.svg 模块文档  [创建] [刷新]
local module = {}
local data = require('Module:Pokemon Number/Data')
local getArgs = require('Module:Arguments').getArgs

function module.main(frame)
	local args = getArgs(frame)
	local name = args[1]
	local text = ''
	if data['kanto'][name] ~= nil then
		text = text .. string.format('\n* 关都:%03d %s', data['kanto'][name], '{{ArticleCategory|关都地区宝可梦}}')
	end
	if data['johto2'][name] ~= nil then
		if data['johto'][name] == data['johto2'][name] then
			text = text .. string.format('\n* 城都:%03d %s', data['johto'][name], '{{ArticleCategory|城都地区宝可梦}}')
		elseif data['johto'][name] == nil then
			text = text .. string.format('\n* 城都:%03d (HGSS) %s', data['johto2'][name], '{{ArticleCategory|城都地区宝可梦}}')
		else
			text = text .. string.format('\n* 城都:%03d (GSC)/%03d (HGSS) %s', data['johto'][name], data['johto2'][name], '{{ArticleCategory|城都地区宝可梦}}')
		end
	end
	if data['hoenn'][name] ~= nil then
		if data['hoenn'][name] == data['johto2'][name] then
			text = text .. string.format('\n* 丰缘:%03d %s', data['hoenn'][name], '{{ArticleCategory|丰缘地区宝可梦}}')
		elseif data['hoenn'][name] == nil then
			text = text .. string.format('\n* 丰缘:%03d (ORAS) %s', data['hoenn2'][name], '{{ArticleCategory|丰缘地区宝可梦}}')
		else
			text = text .. string.format('\n* 丰缘:%03d (RSE)/%03d (ORAS) %s', data['hoenn'][name], data['hoenn2'][name], '{{ArticleCategory|丰缘地区宝可梦}}')
		end
	end
	if data['sinnoh'][name] ~= nil then
		text = text .. string.format('\n* 神奥:%03d %s', data['sinnoh'][name], '{{ArticleCategory|神奥地区宝可梦}}')
	end
	if data['unova2'][name] ~= nil then
		if data['unova'][name] == data['unova2'][name] then
			text = text .. string.format('\n* 合众:%03d %s', data['unova'][name], '{{ArticleCategory|合众地区宝可梦}}')
		elseif data['unova'][name] == nil then
			text = text .. string.format('\n* 合众:%03d (B2W2) %s', data['unova2'][name], '{{ArticleCategory|合众地区宝可梦}}')
		else
			text = text .. string.format('\n* 合众:%03d (BW)/%03d (B2W2) %s', data['unova'][name], data['unova2'][name], '{{ArticleCategory|合众地区宝可梦}}')
		end
	end
	if data['kalos_central'][name] ~= nil then
		text = text .. string.format('\n* 卡洛斯:%03d (中央地区) %s', data['kalos_central'][name], '{{ArticleCategory|卡洛斯地区宝可梦}}')
	end
	if data['kalos_coastal'][name] ~= nil then
		text = text .. string.format('\n* 卡洛斯:%03d (海岸地区) %s', data['kalos_coastal'][name], '{{ArticleCategory|卡洛斯地区宝可梦}}')
	end
	if data['kalos_mountain'][name] ~= nil then
		text = text .. string.format('\n* 卡洛斯:%03d (山岳地区) %s', data['kalos_mountain'][name], '{{ArticleCategory|卡洛斯地区宝可梦}}')
	end
	if data['alola2'][name] ~= nil then
		if data['alola'][name] == data['alola2'][name] then
			text = text .. string.format('\n* 阿罗拉:%03d %s', data['alola'][name], '{{ArticleCategory|阿罗拉地区宝可梦}}')
		elseif data['alola'][name] == nil then
			text = text .. string.format('\n* 阿罗拉:%03d (USUM) %s', data['alola2'][name], '{{ArticleCategory|阿罗拉地区宝可梦}}')
		else
			text = text .. string.format('\n* 阿罗拉:%03d (SM)/%03d (USUM) %s', data['alola'][name], data['alola2'][name], '{{ArticleCategory|阿罗拉地区宝可梦}}')
		end
	end
	if data['alola2_melemele'][name] ~= nil then
		if data['alola_melemele'][name] == data['alola2_melemele'][name] then
			text = text .. string.format('\n** 美乐美乐岛:%03d', data['alola_melemele'][name])
		elseif data['alola_melemele'][name] == nil then
			text = text .. string.format('\n** 美乐美乐岛:%03d (USUM)', data['alola2_melemele'][name])
		else
			text = text .. string.format('\n** 美乐美乐岛:%03d (SM)/%03d (USUM)', data['alola_melemele'][name], data['alola2_melemele'][name])
		end
	end
	if data['alola2_akala'][name] ~= nil then
		if data['alola_akala'][name] == data['alola2_akala'][name] then
			text = text .. string.format('\n** 阿卡拉岛:%03d', data['alola_akala'][name])
		elseif data['alola_akala'][name] == nil then
			text = text .. string.format('\n** 阿卡拉岛:%03d (USUM)', data['alola2_akala'][name])
		else
			text = text .. string.format('\n** 阿卡拉岛:%03d (SM)/%03d (USUM)', data['alola_akala'][name], data['alola2_akala'][name])
		end
	end
	if data['alola2_ulaula'][name] ~= nil then
		if data['alola_ulaula'][name] == data['alola2_ulaula'][name] then
			text = text .. string.format('\n** 乌拉乌拉岛:%03d', data['alola_ulaula'][name])
		elseif data['alola_ulaula'][name] == nil then
			text = text .. string.format('\n** 乌拉乌拉岛:%03d (USUM)', data['alola2_ulaula'][name])
		else
			text = text .. string.format('\n** 乌拉乌拉岛:%03d (SM)/%03d (USUM)', data['alola_ulaula'][name], data['alola2_ulaula'][name])
		end
	end
	if data['alola2_poni'][name] ~= nil then
		if data['alola_poni'][name] == data['alola2_poni'][name] then
			text = text .. string.format('\n** 波尼岛:%03d', data['alola_poni'][name])
		elseif data['alola_poni'][name] == nil then
			text = text .. string.format('\n** 波尼岛:%03d (USUM)', data['alola2_poni'][name])
		else
			text = text .. string.format('\n** 波尼岛:%03d (SM)/%03d (USUM)', data['alola_poni'][name], data['alola2_poni'][name])
		end
	end
	if data['galar'][name] ~= nil then
		text = text .. string.format('\n* 伽勒尔:%03d %s', data['galar'][name], '{{ArticleCategory|伽勒尔地区宝可梦}}')
		if data['armor'][name] ~= nil then
			text = text .. string.format('\n** 铠岛:%03d', data['armor'][name])
		end
		if data['crown'][name] ~= nil then
			text = text .. string.format('\n** 王冠雪原:%03d', data['crown'][name])
		end
	elseif data['armor'][name] ~= nil then
		if data['crown'][name] ~= nil then
			text = text .. string.format('\n* 伽勒尔: %s', '{{ArticleCategory|伽勒尔地区宝可梦}}')
			text = text .. string.format('\n** 铠岛:%03d', data['armor'][name])
			text = text .. string.format('\n** 王冠雪原:%03d', data['crown'][name])
		else
			text = text .. string.format('\n* 伽勒尔-铠岛:%03d %s', data['armor'][name], '{{ArticleCategory|伽勒尔地区宝可梦}}')
		end
	elseif data['crown'][name] ~= nil then
		text = text .. string.format('\n* 伽勒尔-王冠雪原:%03d %s', data['crown'][name], '{{ArticleCategory|伽勒尔地区宝可梦}}')
	end
	if data['hisui'][name] ~= nil then
		text = text .. string.format('\n* 洗翠:%03d %s', data['hisui'][name], '{{ArticleCategory|洗翠地区宝可梦}}')
	end
	if data['paldea'][name] ~= nil then
		text = text .. string.format('\n* 帕底亚:%03d %s', data['paldea'][name], '{{ArticleCategory|帕底亚地区宝可梦}}')
	end
	if data['kitakami'][name] ~= nil then
		text = text .. string.format('\n* 北上:%03d %s', data['kitakami'][name], '{{ArticleCategory|北上乡宝可梦}}')
	end
	if data['blueberry'][name] ~= nil then
		text = text .. string.format('\n* 蓝莓:%03d %s', data['blueberry'][name], '{{ArticleCategory|蓝莓学园宝可梦}}')
	end
	if text == '' then
		text = '<center>不在地区图鉴中 {{ArticleCategory|不在地区图鉴中的宝可梦}}</center>'
	end
	return frame:preprocess(text)
end

return module