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

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

bugfix1001.2
全站通知:

模块:任务一览

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

此模块的文档可以在模块:任务一览/doc创建

local createItemLink = require('Module:Item/Link')
local data = require('模块:任务数据库').tasks_data

local p = {}

p["任务一览"]=function(frame)
	
	local outputData = {}
	for _i,v in ipairs(data) do
		table.insert(outputData,v)
	end
	
	local html = p.get_output_html(outputData,frame)

	
    return tostring(html)
end

function p.get_output_html(dataList,frame)
	local tbody = p.get_tbody(dataList,frame)
    local html = mw.html.create()
    html = html:tag('div'):attr('id','CardSelectTr')
	                :node(tbody)
                :done()
    return html
end

function p.get_tbody(list,frame)
    local html = mw.html.create()
    for _i,v in ipairs(list) do
    	local reward_types = ""
		local rewards_list = mw.html.create()
    	if #v['reward_list'] > 0 then
    		for _j,w in ipairs(v['reward_list']) do
    			rewards_list=rewards_list:node(createItemLink.create_link_medium(w['name'],w['count'],w['class']))
    			if #reward_types > 0 then
    				reward_types = reward_types .. ','
    			end
    			if w['class'] == '物品' then
    				if w['name'] == 'X晶粒' or w['name'] == '海隅点数' or w['name'] == '执行官经验' then
    					reward_types = reward_types .. w['name']
    				elseif w['name'] == '同调线索' or w['name'] == '一刹闪回' or w['name'] == '同游券' then
    					reward_types = reward_types .. '抽卡道具'
    				elseif w['name'] == '日常活跃度' or w['name'] == '周常活跃度' then
    					reward_types = reward_types .. '活跃度'
    				else
    					reward_types = reward_types .. w['class']
    				end
    			else
    				reward_types = reward_types .. w['class']
    			end
    		end
    	end
    	local class = v['class1']
    	if v['class2'] ~= '' and v['class1'] ~= v['class2'] then
    		class = class .. '·' .. v['class2']
    	end
        html = html:tag('div'):addClass('divsort'):cssText('margin-bottom:10px;'):attr('data-param1',v['class1']):attr('data-param2',v['class2']):attr('data-param3',reward_types)
        				:tag('div'):cssText('box-sizing:content-box;background:#FFF;border:1px solid #b1b9c2;display:flex;justify-content:space-between;align-items:center;min-height:60px;width:100%;border-radius:5px;')
        					:tag('div'):cssText('display:flex;height:100%;max-width:65%;flex-direction:column;justify-content:center;padding-left:10px;border-left: 3px solid #b1b9c2;gap:2px;')
        						:tag('div')
        							 :tag('span'):cssText('padding:1px 8px;background:#b1b9c2;color:#FFF;border-radius:5px;font-size: 0.8em;'):wikitext(class):done()
        						:done()
        						:tag('div'):cssText('white-space:wrap;overflow:hidden;text-overflow:ellipsis;color:#333;'):wikitext(frame:preprocess(v['condition'])):done()
        					:done()
        					:tag('div'):cssText('display:flex;max-width:max(35%, 100px);flex-wrap:wrap;justify-content:end;gap:5px;position:relative;margin-right:5px;'):node(rewards_list):done()
        				:done()
        			:done()
    end

    return html
end

return p