「于世界交点之处,逢似曾相识之人」

本wiki目前不支持自由编辑,如果有兴趣参与wiki内容编辑,请加入WIKI建设群904200987(游戏交流勿加会被踢)
使用wiki的数据、图片、音频资源,或者搬运页面内容时,请注明出处。具体参照CC BY-NC-SA 4.0协议
感谢Hyacinth对本wiki提供的数据支持
编辑帮助BWIKI反馈

bugfix1001.2
全站通知:

模块:Character/TeaHighFavorRecipes

来自白荆回廊Wiki
跳到导航 跳到搜索

此模块的文档可以在模块:Character/TeaHighFavorRecipes/doc创建

local p = {}
local favor_recipe_data = require('模块:茶憩高好感度配方数据库').character_high_favor_recipe
local __split = require('模块:Utils').split

p["高好感度配方"]=function(frame)
	if #frame.args["name"] == nil then
        return '错误:姓名不能为空'
	end

	local character_name=frame.args["name"]
	
	local output_data = p.get_data(favor_recipe_data,character_name)
	
	if #output_data == 0 then
		local html = mw.html.create()
        html = html:tag('div'):cssText('margin:10px auto;display:flex;justify-content:center;')
					:wikitext('[[文件:UI_ICON_暂无数据.png|link=]]')
				:done()
        return html
	end
	
	local html = p.get_output_html(output_data)
	
    return tostring(html)
end

function p.get_data(data,character_name)
	local output_data = {}
	if character_name == nil then
		return data
	end

	for i,v in pairs (data) do
		if v['character_name'] == character_name then
			table.insert(output_data,v)
		end
	end
	
	return output_data
end

function p.get_output_html(dataList)
    local html = mw.html.create()
    html = html:tag('table'):addClass('wikitable'):cssText('width:100%;margin:0;text-align:center;')
					:tag('tr')
						:tag('th'):attr('rowspan',2):cssText('width:14%;'):wikitext('默契值等级'):done()
						:tag('th'):attr('rowspan',2):cssText('width:14%;'):wikitext('配方类型'):done()
						:tag('th'):attr('rowspan',2):cssText('width:31%;'):wikitext('配方'):done()
						:tag('th'):cssText('width:41%;'):wikitext('参考默契值'):done()
					:done()
					:tag('tr')
						:tag('th'):wikitext('基础 / 满家具 / 满穹顶 / 满加成'):done()
					:done()
				:done()
	html = html:tag('table'):attr('id','CardSelectTr'):addClass('CardSelect wikitable'):cssText('width:100%;margin:0;text-align:center;')
	for _i,v in ipairs(dataList) do
		local is_lock_chat = '否'
		if tonumber(v['favor_value1']) >= 330 and v['character_name']~='老板' and v['character_name']~='龙晴' and v['character_name']~='唐路遥' then
			is_lock_chat = '是'
	    end

		local recipe = ''
		
		for _k,x in ipairs(__split(v['recipe'],';')) do
			if x ~= '' then
				recipe = recipe .. '<li>' .. x .. '</li>'
			end
		end
		
		local type = ''
		local is_best = '否'
		if is_lock_chat == '是' and v['is_best'] == '是' then
			type = '聊天配方/最高默契值'
			is_best = '是'
		elseif is_lock_chat == '是' then
			type = '聊天配方'
		elseif v['is_best'] == '是' then
			type = '最高默契值'
			is_best = '是'
		end
		
		
		html = html:tag('tr'):addClass('divsort'):attr('data-param1',is_lock_chat):attr('data-param2',is_best)
	        			:tag('td'):cssText('width:14%;'):wikitext(v['unlock_level']):done()
	        			:tag('td'):cssText('width:14%;'):wikitext(type):done()
	        			:tag('td'):addClass('tea-achieve--recipe'):cssText('width:31%;text-align:left;'):wikitext(recipe):done()
	        			:tag('td'):cssText('width:41%;'):wikitext(v['favor_value1']..' / '..v['favor_value2']..' / '..v['favor_value3']..' / '..v['favor_value4']):done()
	        		:done()
	end
    html = html:done():done()
    return html
end

return p