2023年政策修订增补工作正在进行中,欢迎参与!
Module:Arcana
跳转到导航
跳转到搜索
《真·女神转生》大系数据编纂和样式设计统一模块。已封装为各种模板,请参见模板说明。
与 Megami Tensei Wiki 同步修改,但有较大本地化差异。
结构
|
|
数据库
基础基础数据字段套组
|
技能《真·女神转生》系列《女神异闻录》系列
|
维护
可参与的维护工作
请至《真·女神转生》大系编辑者群(832689630)中进一步了解。
可阅读 User:Greykid/参考手册 了解更多相关知识。
更新日志
往期更新日志 | ||
---|---|---|
|
- 2020/11/7-8:大幅拆分、调整模块结构,为《真·女神转生III》《真·女神转生V》数据编写做准备。
- 2020/12/8:增「连携技能表」「合体表」,调格式。
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:expandTemplate{ title = 'refn', args = {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
-- 简繁转换设置
local function sinotrans(zh, zhsc)
return '-{zh-hant:' .. zh .. '; zh-hans:' .. zhsc .. ';}-'
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