本wiki目前不支持自由编辑,如果有兴趣参与wiki内容编辑,请加入WIKI建设群904200987(游戏交流勿加会被踢)
使用wiki的数据、图片、音频资源,或者搬运页面内容时,请注明出处。具体参照CC BY-NC-SA 4.0协议
感谢Hyacinth对本wiki提供的数据支持
编辑帮助 • BWIKI反馈
模块:Character/Voices
此模块的文档可以在模块:Character/Voices/doc创建
local p = {}
local dbData = require('模块:同调者语音档案数据库').character_voices_data
local __paddingZero = require('Module:CommonTools').padding_zero
p['获取文本'] = function(frame)
local char_name = frame.args['name']
local title = frame.args['title']
if char_name == nil or char_name == '' or title == nil or title == '' then
return 'Vein数据库连接异常'
end
-- 过滤数据
local output_data = 'Vein数据库连接失败'
for i, v in ipairs(dbData) do
if (v.character_name == char_name and v.title == title) then
output_data = v['content']
break
end
end
return output_data
end
p['声纹归档'] = function(frame)
local char_name = frame.args['name']
local cv = frame.args['cv']
local cv_jp = frame.args['cv_jp']
if char_name == nil or char_name == '' then
return 'Vein数据库连接异常'
end
-- 过滤数据
local output_data = p.get_data_by_char_name(char_name)
local html = mw.html.create()
html = html:tag('table'):addClass('wikitable voice-table')
:tag('tr')
:tag('th'):cssText('width:15%;min-width:80px;'):wikitext('中文CV'):done()
:tag('td'):cssText('width:35%;'):wikitext(cv):done()
:tag('th'):cssText('width:15%;min-width:80px;'):wikitext('日文CV'):done()
:tag('td'):cssText('width:35%;'):wikitext(cv_jp):done()
:done()
:done()
-- 拼接表格
if #output_data == 0 then
html = html:node(frame:expandTemplate{title = '暂无数据'})
else
html = html:node(p.get_voices_output_html(frame, char_name, output_data))
end
return tostring(html)
end
function p.get_data_by_char_name(char_name)
local output_data = {}
for i, v in ipairs(dbData) do
if (v.character_name == char_name) then
local temp = {
['characterName'] = v['character_name'],
['orderID'] = __paddingZero(v['order_id'], 2),
['title'] = v['title'] or '未解锁',
['content'] = v['content'] or '',
['content_jp'] = v['content_jp'] or '',
['content_en'] = v['content_en'] or '',
['unlockMethod'] = v['unlock_method'] or ''
}
table.insert(output_data, temp)
end
end
return output_data
end
function p.get_voices_output_html(frame, name, dataList)
local html = mw.html.create()
-- 拼接表头
html = html:tag('table'):addClass('wikitable voice-table'):cssText('margin:2px 0;')
:tag('tr')
:tag('th'):cssText('width:32px;'):wikitext('#'):done()
:tag('th'):cssText('width:20%;'):wikitext('标题'):done()
:tag('th'):cssText('width:15%;'):wikitext('解锁条件'):done()
:tag('th'):wikitext('文本(')
:tag('div'):addClass('voice_lang')
:tag('div'):addClass('voice_lang_button vb_active'):attr('id', 'CHS'):wikitext('中'):done()
:tag('div'):addClass('voice_lang_button'):attr('id', 'JP'):wikitext('日'):done()
:tag('div'):addClass('voice_lang_button'):attr('id', 'EN'):wikitext('英'):done()
:done()
:wikitext(')'):done()
:tag('th'):cssText('width:40px;'):wikitext('中'):done()
:tag('th'):cssText('width:40px;'):wikitext('日'):done()
:done()
for _i, v in ipairs(dataList) do
--文本
local content = mw.html.create()
content = content:tag('div'):addClass('voice_text_chs vt_active'):wikitext(v['content']):done()
:tag('div'):addClass('voice_text_jp'):wikitext(v['content_jp']):done()
:tag('div'):addClass('voice_text_en'):wikitext(v['content_en']):done()
--文件
local file_title = v['characterName'] .. '_' .. v['title'] .. '.mp3'
local file_title_jp = v['characterName'] .. '_' .. v['title'] .. '_JP.mp3'
local file = ''
local file_jp = ''
if v['title'] ~= '' and v['content'] ~= '' then
file = frame:expandTemplate{ title = 'Audio', args = { file = file_title } }
file_jp = frame:expandTemplate{ title = 'Audio', args = { file = file_title_jp } }
end
html = html:tag('tr')
:tag('td'):cssText('text-align:center;'):wikitext(v['orderID']):done()
:tag('td'):wikitext(v['title']):done()
:tag('td'):wikitext(v['unlockMethod']):done()
:tag('td'):node(content):done()
:tag('td'):cssText('text-align:center;'):node(file):done()
:tag('td'):cssText('text-align:center;'):node(file_jp):done()
:done()
end
html = html:done()
return html
end
return p

沪公网安备 31011002002714 号