local p = {}
local getArgs = require('Module:Arguments').getArgs
local website = {
{ 'mul', '多语言' },
{ 'zh', '中文' },
{ 'zh-hans', '简体中文' },
{ 'zh-hant', '繁体中文' },
{ 'ja', '日文' },
{ 'en', '英文' },
{ 'en-us', '英文(北美)' },
{ 'en-gb', '英文(欧洲)' },
{ 'ko', '韩文' },
}
local eshop = {
{ 'hk', '港服', 'https://ec.nintendo.com/HK/zh/titles/', '', '{{zh-hant}}' },
{ 'jp', '日服', 'https://store-jp.nintendo.com/item/software/', '', '{{ja}}' },
{ 'us', '美服', 'https://www.nintendo.com/us/store/products/', '/', '{{en}}' },
{ 'gb', '欧服', 'https://www.nintendo.com/en-gb/-/-', '.html', '{{en}}' },
}
local eshop_platform = {
{ '', '' },
{ '3ds', '3DS' },
{ 'wii-u', 'Wii U' },
{ 'switch', 'Switch' },
{ 'switch-2', 'Switch 2' },
}
local playstation = {
{ 'hk', '港服', 'https://store.playstation.com/zh-hant-hk/product/', '/', '{{zh-hant}}' },
{ 'jp', '日服', 'https://store.playstation.com/ja-jp/product/', '/', '{{ja}}' },
{ 'us', '美服', 'https://store.playstation.com/en-us/product/', '/', '{{en}}' },
{ 'gb', '欧服', 'https://store.playstation.com/en-gb/product/', '/', '{{en}}' },
}
local playstation_platform = {
{ '', '' },
{ 'ps3', 'PS3' },
{ 'ps4', 'PS4' },
{ 'ps5', 'PS5' },
{ 'vita', 'PS Vita' },
}
local xbox = {
{ 'xbox', 'Xbox主机' },
{ 'windows', 'Windows' },
}
function p._main(frame, args)
local output = {}
-- 官网
if args['website'] then
table.insert(output, '[' .. args['website'] .. ' 官方网站]')
end
local website_multi = ''
for _, v in ipairs(website) do
if args['website-' .. v[1]] then
if website_multi == '' then
website_multi = '官方网站:'
else
website_multi = website_multi .. '、'
end
website_multi = website_multi .. '[' .. args['website-' .. v[1]] .. ' ' .. v[2] .. ']'
end
end
if website_multi ~= '' then
table.insert(output, website_multi)
end
-- Steam
if args['steam'] then
table.insert(output, '[https://store.steampowered.com/app/' .. args['steam'] .. '/ Steam页面]{{Languageicon|mul|多语言}}')
end
-- eShop
for _, platform in ipairs(eshop_platform) do
local eshop_multi = ''
local key = 'eshop'
if platform[1] ~= '' then
key = key .. '-' .. platform[1]
end
for _, region in ipairs(eshop) do
local key_region = key .. '-' .. region[1]
if args[key_region] then
if eshop_multi == '' then
if platform[2] ~= '' then
eshop_multi = 'eShop页面(' .. platform[2] .. '):'
else
eshop_multi = 'eShop页面:'
end
else
eshop_multi = eshop_multi .. '、'
end
eshop_multi = eshop_multi .. '[' .. region[3] .. args[key_region] .. region[4] .. ' ' .. region[2] .. ']' .. region[5]
end
end
if eshop_multi ~= '' then
table.insert(output, eshop_multi)
end
end
-- PlayStation Store
for _, platform in ipairs(playstation_platform) do
local playstation_multi = ''
local key = 'playstation'
if platform[1] ~= '' then
key = key .. '-' .. platform[1]
end
for _, region in ipairs(playstation) do
local key_region = key .. '-' .. region[1]
if args[key_region] then
if playstation_multi == '' then
if platform[2] ~= '' then
playstation_multi = 'PlayStation Store页面(' .. platform[2] .. '):'
else
playstation_multi = 'PlayStation Store页面:'
end
else
playstation_multi = playstation_multi .. '、'
end
playstation_multi = playstation_multi .. '[' .. region[3] .. args[key_region] .. region[4] .. ' ' .. region[2] .. ']' .. region[5]
end
end
if playstation_multi ~= '' then
table.insert(output, playstation_multi)
end
end
-- Xbox
if args['xbox'] then
table.insert(output, '[https://xbox.com/games/store/-/' .. args['xbox'] .. ' Xbox商店页面]{{Languageicon|mul|多语言}}')
end
local xbox_multi = ''
for _, v in ipairs(xbox) do
if args['xbox-' .. v[1]] then
if xbox_multi == '' then
xbox_multi = 'Xbox商店页面:'
else
xbox_multi = xbox_multi .. '、'
end
xbox_multi = xbox_multi .. '[https://xbox.com/games/store/-/' .. args['xbox-' .. v[1]] .. ' ' .. v[2] .. ']'
end
end
if xbox_multi ~= '' then
table.insert(output, xbox_multi .. '{{Languageicon|mul|多语言}}')
end
-- Vndb
if args['vndb'] then
table.insert(output, '[https://vndb.org/' .. args['vndb'] .. ' VNDB页面]{{en}}')
end
-- Bangumi
if args['bangumi'] then
table.insert(output, '[https://bgm.tv/subject/' .. args['bangumi'] .. ' Bangumi页面]{{zh-hans}}')
end
-- Wikidata
if args['wikidata'] then
table.insert(output, '[https://www.wikidata.org/wiki/' .. args['wikidata'] .. ' Wikidata页面]{{Languageicon|mul|多语言}}')
end
if #output == 0 then
return ''
end
return frame:preprocess('* ' .. table.concat(output, '\n* '))
end
function p.main(frame)
return p._main(frame, getArgs(frame))
end
return p