local getArgs = require('Module:Arguments').getArgs
local p = {}
-- 歌曲信息
local function genFeat(featArg, tipsArg)
local feat = {
'<div style="width: 100%; outline: solid 1px #bdbdcc; border: solid 2px #f2f2f8; font-size: 80%; margin-top: .5em; padding: .25em;">【-{zh-hant:LIVE;zh-hans:演唱会的}-特征】',
featArg,
'<hr style="border-top: 1.5px dotted #AAA; background-color: transparent;" />【攻略提示】',
tipsArg,
'</div>'
}
return table.concat(feat)
end
function p.feat(frame)
local args = getArgs(frame)
local out = {}
if args['特征'] then
table.insert(out, genFeat(args['特征'], args['提示']))
else
local i = 1
while args['特征' .. i] do
table.insert(out, genFeat(args['特征' .. i], args['提示' .. i]))
i = i + 1
end
end
return table.concat(out)
end
-- 机关音符信息,暂无法保持传入顺序
local titleIcons = {
['特技发'] = 'AS 1002.png', ['特技發'] = 'AS 1002.png', ['提升特'] = 'AS 1002.png',
['体力回'] = 'AS 1003.png', ['體力回'] = 'AS 1003.png', ['体力恢'] = 'AS 1003.png', ['體力恢'] = 'AS 1003.png',
['获得防'] = 'AS 1004.png', ['獲得防'] = 'AS 1004.png', ['获得护'] = 'AS 1004.png', ['獲得護'] = 'AS 1004.png',
['积蓄s'] = 'AS 1005.png', ['積蓄s'] = 'AS 1005.png',
['sp特'] = 'AS 1011.png',
['表现力'] = 'AS 1007.png', ['表現力'] = 'AS 1007.png', ['表现增'] = 'AS 1007.png', ['表現增'] = 'AS 1007.png',
['表现减'] = 'AS 1007.png', ['表現減'] = 'AS 1007.png', ['表现提'] = 'AS 1007.png', ['表現提'] = 'AS 1007.png',
['表现下'] = 'AS 1007.png', ['表現下'] = 'AS 1007.png', ['提升表'] = 'AS 1007.png',
['暴击值'] = 'AS 1008.png', ['暴擊值'] = 'AS 1008.png',
['暴击率'] = 'AS 1009.png', ['暴擊率'] = 'AS 1009.png',
['解除所'] = 'AS 2001.png',
['体力消'] = 'AS 2003.png', ['體力消'] = 'AS 2003.png', ['体力伤'] = 'AS 2003.png', ['體力伤'] = 'AS 2003.png',
}
local sheildPeneTitleIcons = {
['穿防护效果)'] = 'AS 1023.png', ['穿防護效果)'] = 'AS 1023.png', ['穿防护效果)'] = 'AS 1023.png', ['穿防護效果)'] = 'AS 1023.png',
['穿护盾效果)'] = 'AS 1023.png', ['穿護盾效果)'] = 'AS 1023.png', ['穿护盾效果)'] = 'AS 1023.png', ['穿護盾效果)'] = 'AS 1023.png',
['(贯穿护盾)'] = 'AS 1023.png', ['(貫穿護盾)'] = 'AS 1023.png', ['(贯穿护盾)'] = 'AS 1023.png', ['(貫穿護盾)'] = 'AS 1023.png',
}
local critialTitleIcons = {
['critical效'] = 'AS 1008.png',
['critical率'] = 'AS 1009.png',
}
local comboSkillTitleIcons = {
['组合技量表增加【'] = 'AS 1005.png', ['組合技量表增加【'] = 'AS 1005.png', ['组合技量表减少【'] = 'AS 1005.png', ['組合技量表減少【'] = 'AS 1005.png',
['组合技张力累积量'] = 'AS 1011.png', ['組合技張力累積量'] = 'AS 1011.png',
['组合技量表增加量'] = 'AS 1014.png', ['組合技量表增加量'] = 'AS 1014.png',
}
local spIncreaseTitleIcons = {
['提升sp特'] = 'AS 1011.png',
['提升sp槽'] = 'AS 1014.png',
}
local spSlotTitleIcons = {
['sp槽增'] = 'AS 1005.png', ['sp槽减'] = 'AS 1005.png', ['sp槽減'] = 'AS 1005.png',
['sp槽获'] = 'AS 1014.png',
}
local function switch(base, ...)
for i = 1, select('#', ...) do
if base == select(i, ...) then return true end
end
return false
end
function p.note(frame)
local args = getArgs(frame)
local out = {}
for k, v in pairs(args) do
if mw.ustring.match(k, '^note.+$') then
local title = mw.text.trim(mw.ustring.match(k, '^note(.+)$'))
local titleBegin = mw.ustring.sub(title, 1, 3):lower()
local icon = ''
table.insert(out, '<div style="width: 250px; outline: solid 1px #bdbdcc; border: solid 2px #f2f2f8; font-size: 80%; margin-top: .5em; padding: .25em;">')
if switch(titleBegin, '体力消', '體力消', '体力伤', '體力傷') then
local titleEnd = mw.ustring.sub(title, -6):lower()
icon = sheildPeneTitleIcons[titleEnd] or titleIcons[titleBegin] or ''
elseif titleBegin == 'cri' then
local titleFurthBegin = mw.ustring.sub(title, 1, 9):lower()
icon = critialTitleIcons[titleFurthBegin] or ''
elseif switch(titleBegin, '组合技', '組合技') then
local titleFurthBegin = mw.ustring.sub(title, 1, 8):lower()
icon = comboSkillTitleIcons[titleFurthBegin] or ''
elseif titleBegin == '提升s' then
local titleFurthBegin = mw.ustring.sub(title, 1, 5):lower()
icon = spIncreaseTitleIcons[titleFurthBegin] or ''
elseif titleBegin == 'sp槽' then
local titleFurthBegin = mw.ustring.sub(title, 1, 4):lower()
icon = spSlotTitleIcons[titleFurthBegin] or ''
else
icon = titleIcons[titleBegin] or ''
end
local file = icon ~= '' and '[[File:' .. icon .. '|16px|link=]]' or ''
table.insert(out, file)
table.insert(out, title)
table.insert(out, '<hr style="border-top: 1.5px dotted #AAA; background-color: transparent;" />')
table.insert(out, v)
table.insert(out, '</div>')
end
end
return table.concat(out)
end
-- 表现机会信息,暂无法保持传入顺序
function p.ac(frame)
local args = getArgs(frame)
local out = {}
for k, v in pairs(args) do
if mw.ustring.match(k, '^ac.+$') then
local ac = mw.text.trim(mw.ustring.match(k, '^ac(.+)$'))
table.insert(out, '<div style="width: 250px; outline: solid 1px #bdbdcc; border: solid 2px #f2f2f8; font-size: 80%; margin-top: .5em; padding: .25em;">')
table.insert(out, ac)
table.insert(out, '<hr style="border-top: 1.5px dotted #AAA; background-color: transparent;" />【特殊效果】')
table.insert(out, v)
table.insert(out, '</div>')
end
end
return table.concat(out)
end
return p