Persona logo 2 500.png

非正式攻略组招募
如果你热爱女神转生 or 异闻录系列 并且愿意为女神异闻录WIKI添砖添瓦
可以加群一起共同建设,招募详情页见攻略组招募公告

——Pser_hanser
本WIKI由Pser_hanser于2020年10月21日申请开通,编辑权限开放,本WIKI旨在女神异闻录相关攻略以及周边信息汇总,招募攻公告见攻略组招募公告

BWIKI收藏到桌面的方法说明

全站通知:

模块:Arcana

来自女神转生WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索

所有数据和关键字的修改请先在主站 w:模块:Arcana 中完成,再同步到此处。【存在部分本地化差异,请留意!(差异:简繁转换)】

关于此模块的编写和修订,请至女神转生中文维基编辑者群(832689630中进一步了解。可阅读 w:User:Greykid/参考手册 了解更多相关知识。

索引:


local getArgs = require('Module:Arguments').getArgs
local getGames = require('Module:Psk/Gamedata')

local p = {}

-- 實現 #invoke 函数式調用
local function makeInvokeFunction(funcName)
	return function (frame)
		local args = getArgs(frame, {parentOnly = true})
		return p[funcName](args)
	end
end

-- 實現 #invoke 函数式調用,保留frame
local function makeInvokeFunctionWithFrame(funcName)
	return function (frame)
		local args = getArgs(frame, {parentOnly = true})
		return p[funcName](frame, args)
	end
end

-- 添加分类
local function cate(catename)
	if mw.title.getCurrentTitle():inNamespace('') then
		return '[[Category:' .. catename .. ']]' -- 防止給列表頁加分類
	else
		return ''
	end
end

-- 添加注释
local function refer(frame, refernote)
	if mw.title.getCurrentTitle():inNamespace('') and refernote ~= nil and refernote ~= '' then
		return frame:extensionTag( 'ref', refernote, { group = '注', name = hash(frame, refernote) } )
	else
		return ''
	end
end

-- ruby格式
local function ruby(text1, text2, lang)
	if lang == nil then
		return '<ruby><rb>' .. text1 .. '</rb><rp> (</rp><rt style="font-size:.75em">' .. text2 .. '</rt><rp>) </rp></ruby>'
	else
		return '<ruby><rb>' .. text1 .. '</rb><rp> (</rp><rt style="font-size:.75em" lang="' .. lang .. '">' .. text2 .. '</rt><rp>) </rp></ruby>'
	end
end

-- 简繁转换设置【BWIKI本地化处理】
local function sinotrans(zh, zhsc)
	return '<abbr title="' .. zh .. '">' .. zhsc .. '</abbr>'
end

-- Hover效果,调用TextHover模板
local function hover(frame, text1, text2)
	return frame:expandTemplate{ title = 'TextHover', args = {text1, text2, 'before', 'center', tag = 'span'} }
end

-- Wiki文本解析,调用Eval模板
local function wikitext(frame, text1)
	return frame:expandTemplate{ title = 'Eval', args = {'wikitext', text1} }
end

-- 阿尔卡那渲染
local function getArcana(frame, ar,game,gamen, sort)
	local arcana, alias
	local data = require('Module:Arcana/data')
	if gamen == "p1" or gamen == "p2is" or gamen == "p2ep" then
		if ar == "8" or ar == "剛毅" or ar == "刚毅" or ar == "力量" or ar == "Strength" or ar == "VIII" then ar = "11s" end
		if ar == "11" or ar == "正义" or ar == "Justice" or ar == "XI" then ar = "8s" end
	end
	arcana = data.arcanas[ar]
	if not arcana then
		alias = data.aliases[ar]
		if alias then
			ar = alias
			arcana = data.arcanas[ar]
		else
			local result = ''
			if not ar or ar == '' or ar == '-' or ar == 'Unclassified' or ar == 'None' or ar == 'none' then result = '-'
			elseif ar == 'Coin' or ar == 'Coins' or ar == 'Pentacle' then result = '[[阿尔卡那#小阿爾卡那|星幣花色]]' .. cate('星幣阿爾卡那')
			elseif ar == 'Sword' or ar == 'Swords' then result = '[[阿尔卡那#小阿爾卡那|寶劍花色]]' .. cate('寶劍阿爾卡那')
			elseif ar == 'Cup' or ar == 'Cups' then result = '[[阿尔卡那#小阿爾卡那|聖盃花色]]' .. cate('聖盃阿爾卡那')
			elseif ar == 'Wand' or ar == 'Wands' or ar == 'Rod' then result = '[[阿尔卡那#小阿爾卡那|權杖花色]]' .. cate('權杖阿爾卡那')
			elseif ar == 'Rumor' then result = '[[仲魔/傳說|傳說]]' .. cate('仲魔/傳說')
			elseif ar == 'Taurus' or ar == 'Aquarius' or ar == 'Leo' or ar == 'Scorpio' or ar == 'Masquerade' then
				result = '[[Masked Circle|' .. ar .. ']]' .. cate('Masked Circle')
			elseif ar == 'Reich' then result = '[[Last Battalion|' .. ar .. ']]'
			elseif ar == 'Grave' or ar == 'Zonbie' or ar == 'Zombie' then result = '僵屍' .. cate('僵屍族')
			elseif ar == 'Human' then result = '人類' .. cate('人族')
			elseif ar == 'Machine' then result = '機械' .. cate('機械族')
			else result = ar end
			return result -- 找不到
		end
	end
 	local result = '[[阿尔卡那/' .. arcana.arczh .. '|' .. ruby(arcana.arczh, arcana.arc) .. ']]' 
	if ar == "0g" then result = hover(frame, '[[阿尔卡那/小丑|' .. ruby('小丑', 'The Jester') .. ']]', '[[阿尔卡那/慾望|' .. ruby('慾望', 'Hunger') .. ']]') end
	if sort == 'sort' then result = 'data-sort-value="' .. ar .. '"|' .. result end
	-- result = result .. cate(arcana.arczh .. '阿爾卡那')
	return result
end

-- 关键字消歧义
local function get_prop(args)
	local prop = {}
	for k, v in pairs(require('Module:Psk/Property_names')) do
		for _, name in ipairs(v) do
			if args[name] then
				prop[k] = args[name]
				break
			end
		end
		prop[k] = prop[k] or v.default
	end
	return prop
end



-- 阿尔卡那ruby格式渲染模块

p.arcana = makeInvokeFunctionWithFrame('_arcana')

function p._arcana(frame, args)
	local game = args[1] or args.game or args.Game or ''
	game = game:lower()
	if args.FES then game = 'p3f' end
	if args.P3P then game = 'p3p' end
	if args.P4G then game = 'p4g' end
	if args.P5R then game = 'p5r' end
	if args.P5S then game = 'p5s' end
	local gameg -- 遊戲的總樣式
	if getGames.games[game].fallback then
		gameg = getGames.games[game].fallback -- 遊戲對應序號作
		else gameg = game
	end
	local gamen = getGames.games[game].name -- 遊戲全名
	local gamegn = getGames.games[gameg].name -- 遊戲對應序號作全名
	local gamed
	if gameg then
		gamed = gameg:upper()
	end
	local arca = args[2] or args.arcana or args.Arcana or ''
	if args[3] == 'sort' then return getArcana(frame, arca,gameg,gamegn, 'sort') end
	return getArcana(frame, arca,gameg,gamegn)
end



return p