WIKI公告栏
欢迎各位引航者访问卡拉彼丘WIKI,由于游客访问页面会有一定的页面旧版缓存,建议你登陆B站账号进行浏览,如果您觉得本WIKI有帮助到你,欢迎推荐给身边的引航者。
全站通知:

模块:弦能增幅网络

来自卡拉彼丘WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索

此模块的文档可以在模块:弦能增幅网络/doc创建

local p = {}

local Bombdata = mw.text.jsonDecode(mw.title.new('模块:弦能增幅网络/Bomb.json'):getContent() or '{}')
local Escortdata = mw.text.jsonDecode(mw.title.new('模块:弦能增幅网络/Escort.json'):getContent() or '{}')
local skilldata = mw.text.jsonDecode(mw.title.new('模块:弦能增幅网络/Skill.json'):getContent() or '{}')


function p.Escort(frame)
	local icon = frame.args['icon']
    local icontype = frame.args['type']
    local rolename = frame.args['name']
    local grouptype = frame.args['grouptype']

    local groupicons = {
        ["1"] = "[[文件:图标-超弦进化系统 " .. icon .. "改.png|link=]]",
        ["2"] = "[[文件:" .. icon .. "|link=]]",
        ["3"] = "[[文件:图标-超弦进化系统 8改.png|link=]]",
        ["4"] = "[[文件:图标-超弦进化系统_10改.png|link=]]",
        ["5"] = "[[文件:图标-超弦进化系统_11改.png|link=]]",
    }
    local icontype = groupicons[icontype]
    assert(icontype, "类型错误")

    local roleData = Escortdata[rolename]
    assert(roleData, "角色名称错误: " .. (rolename or "未知"))
    local partsData = roleData[grouptype]
    assert(partsData, "类型错误: " .. (grouptype or "未知"))
    local partsname = partsData['Name']
    local partstext1 = partsData['Desc'][1]
    local partstext2 = partsData['Desc'][2]
    local partstext3 = partsData['Desc'][3]
    local partstext4 = partsData['Desc'][4]
    local partscost1 = partsData['Need'][1]
    local partscost2 = partsData['Need'][2]
    local partscost3 = partsData['Need'][3]
    local partscost4 = partsData['Need'][4]
    
    local row = p.rowstyle(partstext1, partscost1)
    local row2 = ""
    local row3 = ""
    local row4 = ""
    if partstext2 and partstext2 ~= "" then
        row2 = p.rowstyle(partstext2, partscost2)
    end
    if partstext3 and partstext3 ~= "" then
        row3 = p.rowstyle(partstext3, partscost3)
    end
    if partstext4 and partstext4 ~= "" then
        row4 = p.rowstyle(partstext4, partscost4)
    end

    local value = frame.args['change'] == '' and (row .. row2 .. row3 .. row4) or frame.args['change']
    local Escort_html = p.groupstyle(frame.args['type'], icontype, partsname, value)
    return Escort_html
end


function p.Bomb(frame)
	local icon = frame.args['icon']
    local icontype = frame.args['type']
    local rolename = frame.args['name']
    local grouptype = frame.args['grouptype']
    
    local groupicons = {
        ["1"] = "[[文件:图标-超弦进化系统 " .. icon .. "改.png|link=]]",
        ["2"] = "[[文件:" .. icon .. "|link=]]",
        ["3"] = "[[文件:图标-超弦进化系统 8改.png|link=]]",
        ["4"] = "[[文件:图标-超弦进化系统_10改.png|link=]]",
    }
    local icontype = groupicons[icontype]
    assert(icontype, "类型错误")

    local roleData = Bombdata[rolename]
    assert(roleData, "角色名称错误: " .. (rolename or "未知"))
    local partsData = roleData[grouptype]
    assert(partsData, "类型错误: " .. (grouptype or "未知"))
    local partsname = partsData['Name']
    local partstext1 = partsData['Desc'][1]
    local partstext2 = partsData['Desc'][2]
    local partscost1 = partsData['Need'][1]
    local partscost2 = partsData['Need'][2]

    local args = frame.args
    local row = p.rowstyle(partstext1, partscost1)
    local row2 = ""
    if partstext2 and partstext2 ~= "" then
        row2 = p.rowstyle(partstext2, partscost2)
    end

    local value = frame.args['change'] == '' and (row .. row2) or frame.args['change']
    local Bomb_html = p.groupstyle(frame.args['type'], icontype, partsname, value)
    return Bomb_html
end


--爆破模式角色属性表格
function p.RoleProperties(frame)
    local data = mw.loadData("Module:弦能增幅网络/Data")
    local rolename = frame.args[1]

    local role = data[rolename]
    assert(rolename, "角色名称错误")

    local tdstyle = 'width: 15%;font-weight: bold'

    local html = mw.html.create()
    local RoleProperties_html = html
        :tag('table'):addClass('klbqtable'):cssText('width:100%')
        :tag('tr')
        :tag('th'):cssText(tdstyle):wikitext('护甲值'):done()
        :tag('td'):wikitext(role["护甲值"]):done()
        :tag('th'):cssText(tdstyle):wikitext('倒地留存时间'):done()
        :tag('td'):wikitext(role["倒地留存时间"]):done()
        :tag('th'):cssText(tdstyle):wikitext('移动速度'):done()
        :tag('td'):wikitext(role["移动速度"]):done()
        :tag('th'):cssText(tdstyle):wikitext('弦化移速'):done()
        :tag('td'):wikitext(role["弦化移速"]):done()
        :done()
        :tag('tr')
        :tag('th'):cssText(tdstyle):wikitext('护甲回复值'):done()
        :tag('td'):wikitext(role["护甲回复值"]):done()
        :tag('th'):cssText(tdstyle):wikitext('倒地被救时间'):done()
        :tag('td'):wikitext(role["倒地被救时间"]):done()
        :tag('th'):cssText(tdstyle):wikitext('弦化减伤比例'):done()
        :tag('td'):wikitext(role["弦化减伤"]):done()
        :done()
        :done()
    return tostring(RoleProperties_html)
end


--爆破模式角色技能觉醒
function p.awakening(frame)
    local rolename = frame.args['name']
	
	local roleskillinfo = skilldata[rolename]
		assert(roleskillinfo, "角色名称错误: " .. (rolename or "未知"))
	local RoleSkill1 = roleskillinfo["技能觉醒"][1]
	local RoleSkill2 = roleskillinfo["技能觉醒"][2]
	local RoleSkill3 = roleskillinfo["技能觉醒"][3]
	
	local roleskillawakening = Bombdata[rolename]
		assert(roleskillawakening, "角色名称错误: " .. (rolename or "未知"))
	local RoleSkill1awakening = mw.text.split(roleskillawakening["技能觉醒"]["Active1Need"], ',')
	local RoleSkill2awakening = mw.text.split(roleskillawakening["技能觉醒"]["Active2Need"], ',')
	local RoleSkill3awakening = mw.text.split(roleskillawakening["技能觉醒"]["Active3Need"], ',')
		
    local icons_html1, icons_html2, icons_html3 = "", "", ""
    for _, icon in ipairs(RoleSkill1awakening) do
        icons_html1 = icons_html1 .. p.awakeningicons(icon) .. " "
    end
    for _, icon in ipairs(RoleSkill2awakening) do
        icons_html2 = icons_html2 .. p.awakeningicons(icon) .. " "
    end
    for _, icon in ipairs(RoleSkill3awakening) do
        icons_html3 = icons_html3 .. p.awakeningicons(icon) .. " "
    end

	local AwakeningSkill1 = p.AwakeningRow(icons_html1, RoleSkill1["Name"], RoleSkill1["Intro"])
	local AwakeningSkill2 = p.AwakeningRow(icons_html2, RoleSkill2["Name"], RoleSkill2["Intro"])
	local AwakeningSkill3 = p.AwakeningRow(icons_html3, RoleSkill3["Name"], RoleSkill3["Intro"])
	
    local html = mw.html.create()
    local awakening_html = html
        :tag('div'):cssText( "flex: 1 300px;padding: 5px" ):wikitext(AwakeningSkill1):done()
        :tag('div'):cssText( "flex: 1 300px;padding: 5px" ):wikitext(AwakeningSkill2):done()
        :tag('div'):cssText( "flex: 1 300px;padding: 5px" ):wikitext(AwakeningSkill3):done()
        :tag('div'):cssText( "flex: 1 300px;padding: 5px" ):done()
    return tostring(awakening_html)
end


--极限推进模式角色技能觉醒
function p.awakening_Escort(frame)
    local rolename = frame.args[1]
    local RoleSkillType = frame.args[2]

    local roleskill = skilldata[rolename]
    assert(roleskill, "角色名称错误: " .. (rolename or "未知"))

    local RoleSkillTypeData = roleskill[RoleSkillType]
    assert(RoleSkillTypeData, "技能类型错误: " .. (RoleSkillType or "未知"))

    local awakening_skillinfo1 = RoleSkillTypeData[1]
    assert(awakening_skillinfo1, RoleSkillType .. " 中没有第一个技能")
    local awakening_skillinfo2 = RoleSkillTypeData[2]
    assert(awakening_skillinfo2, RoleSkillType .. " 中没有第二个技能")
    local awakening_skillinfo3 = RoleSkillTypeData[3]
    assert(awakening_skillinfo3, RoleSkillType .. " 中没有第三个技能")

    local html_start = '<div class="col-sm-4" style="flex: 1 300px;padding: 10px">'
    local awakening_Escort_html = html_start .. "觉醒-'''" .. awakening_skillinfo1['Name'] .. ":'''" .. awakening_skillinfo1['Intro'] .. '</div>\n'
        .. html_start .. "觉醒-'''" .. awakening_skillinfo2['Name'] .. ":'''" .. awakening_skillinfo2['Intro'] .. '</div>\n'
        .. html_start .. "觉醒-'''" .. awakening_skillinfo3['Name'] .. ":'''" .. awakening_skillinfo3['Intro'] .. '</div>\n'
    
    return awakening_Escort_html
end


--爆破模式角色技能觉醒行样式
function p.AwakeningRow(icons_html, Name, Intro)
    local html = mw.html.create()
    local awakening_html = html
        :tag('div'):addClass('awakening-container')
        :tag('div'):addClass('awakening-icons'):wikitext(icons_html):done()
        :tag('div'):addClass('awakening-name'):wikitext("'''觉醒" .. ":" .. Name .. "'''"):done()
        :tag('div'):addClass('awakening-text'):wikitext(Intro):done()
        :done()
    return tostring(awakening_html)
end


--爆破模式觉醒图形
function p.awakeningicons(icons)
    local awakeningicons = {
        ["方"] = "[[文件:图标-超弦进化-方形.png]]",
        ["圆"] = "[[文件:图标-超弦进化-圆形.png]]",
        ["角"] = "[[文件:图标-超弦进化-三角.png]]",
    }
    local icons = awakeningicons[icons]
    assert(icons, "形状名称错误")
    return icons
end


--组样式
function p.groupstyle(type,icontype,partsname,value)
    local html = mw.html.create()
    local group_html = html
        :tag('div'):addClass('upgrade-group')
        :tag('div'):addClass('upgrade-top')
        :tag('span'):addClass('upgrade-icon upgrade-icon' .. type)
        :tag('span'):addClass('upgrade-icon-inner'):wikitext(icontype):done()
        :done()
        :tag('span'):addClass('upgrade-name'):wikitext(partsname):done()
        :tag('span'):addClass('upgrade-triangle'):done()
        :done()
        :tag('div'):addClass('upgrade-options'):wikitext(value):done()
        :done()
    return tostring(group_html)	
end


--行样式
function p.rowstyle(text, cost)
    local html = mw.html.create()
    local row_html = html
        :tag('div'):addClass('upgrade-row')
        :tag('div'):addClass('left-shade'):done()
        :tag('div'):addClass('upgrade-text'):wikitext(text):done()
        :tag('div'):addClass('upgrade-cost'):wikitext(cost .. '[[文件:图标-能量点.png|20px|link=]]'):done()
        :done()
    return tostring(row_html)
end

return p