FANDOM


local p = {}
 
local base  = require("Module:Base")
local icon  = require("Module:Icon")
 
local hero_data             = mw.loadData('Module:hero.data')
local hero_promote_data     = mw.loadData('Module:hero_promote.data')
local hero_passive_data     = mw.loadData('Module:hero_passive.data')
local hero_passive_r3_data  = mw.loadData('Module:hero_passive_r3.data')
local soulbound_weapon_data = mw.loadData('Module:Soulbound_weapon.data')
local skill_data            = mw.loadData('Module:Skill.data')
local spskill_data          = mw.loadData('Module:Spskill.data')
 
 
function p.test()
    mw.log(star(4))
end
 
-- 外调用
function p.is_hero(name)
    if hero_data[name] then
        return true
    else
        return false
    end
end
 
-- 用于图鉴中图片旁边的星星
function star(count)
    text = ''
    for i = 1, count do
        text = text..'[[File:char_star.png|link=]]'
    end
 
    return text 
end
 
-- 进化处的小图标生成
function hero_icon(name, rank, r)
    text = {}
    text[#text+1] = '<div class="hero_icon'
    if r == rank then
        text[#text+1] = ' current'
    end
    text[#text+1] = '">[[File:'..name..'_icon.png|link='..name..']]<div class="star">'..rank..'</div></div>' 
 
    return table.concat(text)
end
 
-- 返回技能描述
function get_skill_effect(name)
    if skill_data[name] then
        return skill_data[name]['e']
    else
        return ''
    end
end
 
-- 返回SP技能最高级的描述
function get_spskill_effect(name)
    if spskill_data[name] then
        if spskill_data[name]['lv4'] == '' then
            return spskill_data[name]['lv3']
        else
            return spskill_data[name]['lv5'] 
        end
    else
        return ''
    end
end
 
-- 勇士图鉴
function p.info(frame)
    local name = frame.args[1]
    local output_text = {}
    local comment_name = '' --角色评价存储的位置
    local comment = ''  --角色评价
 
    local data_id = tostring(hero_data[name]['id'])
    local r = hero_data[name]['r']
    local promote_data = nil
    local passive_data = nil
    local passive_r3 = false
    local weapon_data = nil
 
    -- 如果是有数据的勇士则先行处理下数据
    if data_id ~= '0' then
        promote_data = hero_promote_data[data_id]
        comment_name, comment = base.load_comment(promote_data[6])
        passive_data = hero_passive_data[data_id]
 
        if soulbound_weapon_data[data_id] then
            weapon_data = soulbound_weapon_data[data_id]
        end
    end
 
    -- 部分3星活动勇士有被动的
    if hero_passive_r3_data[name] then
       passive_data = hero_passive_r3_data[name]
       passive_r3 = true
    end
 
    output_text[#output_text+1] = '__NOTOC__<div class="hero_frame">'
    -- 左半部分
    output_text[#output_text+1] = '<div class="hero_left">'
    -- 图片
    output_text[#output_text+1] = '<div class="hero_image" style="text-align:center"><div class="pic">[[File:'..name..'.png]]</div>'
    output_text[#output_text+1] = '<div class="name"><span class="nodisplay">★'..hero_data[name]['r']..' </span>'..name..'</div>'
    output_text[#output_text+1] = '<div class="star hidden">'..star(hero_data[name]['r'])..'</div></div>'
    -- 背景故事
    if hero_data[name]['story'] ~= '' then
        output_text[#output_text+1] = '<div class="hero_story"><h2 class="nodisplay">角色背景故事</h2><div class="title hidden">角色背景故事</div><div class="story">'..hero_data[name]['story']..'</div></div>'
    end
    -- 勇士评价
    if comment ~= '' then
        if comment['勇士评价'] ~='' then
            output_text[#output_text+1] = '<div class="hero_comment"><h2 class="nodisplay">角色评论</h2><div class="title hidden">角色评论</div><div class="comment">'..comment['勇士评价']..'</div></div>'
        end
    end
    -- 进化信息(目前只支持4~6星)
    if promote_data ~= nil then
        output_text[#output_text+1] = '<div class="hero_promote frame hidden"><div class="title">进化信息</div><div class="info">'
    	if promote_data[1] ~= '' then
    		output_text[#output_text+1] = hero_icon(promote_data[1], 1, r)
    		output_text[#output_text+1] = '<div class="arrow"></div>'
    		output_text[#output_text+1] = hero_icon(promote_data[2], 2, r)
    		output_text[#output_text+1] = '<div class="arrow"></div>'
    		output_text[#output_text+1] = hero_icon(promote_data[3], 3, r)
    	end
        output_text[#output_text+1] = hero_icon(promote_data[4], 4, r)
        output_text[#output_text+1] = '<div class="arrow"></div>'
        output_text[#output_text+1] = hero_icon(promote_data[5], 5, r)
        output_text[#output_text+1] = '<div class="arrow"></div>'
        output_text[#output_text+1] = hero_icon(promote_data[6], 6, r)
        output_text[#output_text+1] = '</div></div>'
 
        -- 输出手机版用
        output_text[#output_text+1] = '<div class="nodisplay"><h2>进化信息</h2><ul>'
        if promote_data[1] ~= '' then
            output_text[#output_text+1] = '<li>★1 [['..promote_data[1]..']]</li>'
            if r == 1 then output_text[#output_text+1] = '(当前形态)' end
            output_text[#output_text+1] = '<li>★2 [['..promote_data[2]..']]</li>'
            if r == 2 then output_text[#output_text+1] = '(当前形态)' end
            output_text[#output_text+1] = '<li>★3 [['..promote_data[3]..']]</li>'
            if r == 3 then output_text[#output_text+1] = '(当前形态)' end
        end
        output_text[#output_text+1] = '<li>★4 [['..promote_data[4]..']]</li>'
        if r == 4 then output_text[#output_text+1] = '(当前形态)' end
        output_text[#output_text+1] = '<li>★5 [['..promote_data[5]..']]</li>'
        if r == 5 then output_text[#output_text+1] = '(当前形态)' end
        output_text[#output_text+1] = '<li>★6 [['..promote_data[6]..']]</li>'
        if r == 6 then output_text[#output_text+1] = '(当前形态)' end
        output_text[#output_text+1] = '</ul></div>'
	end
 
	-- 获得方法
	if hero_data[name]['acquire'] then
        local acquire = hero_data[name]['acquire'] 
	    output_text[#output_text+1] = '<div class="hero_acquire frame hidden"><div class="title hidden">获得方法</div>'
	    output_text[#output_text+1] = '<div class="info">'
	    if acquire['g'] then
	        if acquire['g'] == '1' then
	            output_text[#output_text+1] = '<div class="acquire">[[File:Acquire_gotcha.png|link=]]<div class="desc">通过契约<br>有几率获得!</div><div class="a_title">契约书</div></div>'
	        elseif acquire['g'] == '2' then
	            output_text[#output_text+1] = '<div class="acquire">[[File:Acquire_gotcha_gold.png|link=]]<div class="desc">仅通过契约<br>有几率获得!</div><div class="a_title">契约书</div></div>'
	        end
        end
        if acquire['p'] then
	        if acquire['p'] == '1' then
	            output_text[#output_text+1] = '<div class="acquire">[[File:Acquire_promote.png|link=]]<div class="desc">通过进化<br>获得!</div><div class="a_title">进化勇士</div></div>'
	        end
	    end
	    if acquire['s'] then
	        if acquire['s'] ~= '' then
	            local stage = string.gsub(acquire['s'], ' ', '<br>')
	            output_text[#output_text+1] = '<div class="acquire">[[File:Acquire_stage.png|link=]]<div class="desc">在'..stage..'登场</div><div class="a_title">关卡</div></div>'
	        end
        end
        if acquire['d'] then
	        if acquire['d'] ~= '' then
	            output_text[#output_text+1] = '<div class="acquire">[[File:Acquire_dungeon.png|link=]]<div class="desc">[['..acquire['d']..']]<br>通关奖励!</div><div class="a_title">古代地牢</div></div>'
	        end
	    end
	    if acquire['e'] then
	        if acquire['e'] == '活动' then
	            output_text[#output_text+1] = '<div class="acquire">[[File:Acquire_event.png|link=]]<div class="desc">通过活动获得</div><div class="a_title">活动</div></div>'
            elseif acquire['e'] == '史诗任务' then
                output_text[#output_text+1] = '<div class="acquire">[[File:Acquire_quest.png|link=]]<div class="desc">任务奖励!</div><div class="a_title">史诗任务</div></div>'
            elseif acquire['e'] ~= '' then
                output_text[#output_text+1] = '<div class="acquire">[[File:Acquire_event.png|link=]]<div class="desc">'..acquire['e']..'</div><div class="a_title">其他</div></div>'
            end
	    end
	    output_text[#output_text+1] = '</div>'
	    output_text[#output_text+1] = '</div>'
 
	    --输出手机版
	    output_text[#output_text+1] = '<div class="nodisplay"><h2>获得方法</h2><ul>'
        if acquire['g'] then
	        if acquire['g'] == '1' then
	            output_text[#output_text+1] = '<li>通过契约有几率获得</li>'
	        elseif acquire['g'] == '2' then
	            output_text[#output_text+1] = '<li>仅通过契约有几率获得(契约限定)(高级契约书除外)</li>'
	        end
        end
        if acquire['p'] then
	        if acquire['p'] == '1' then
	            output_text[#output_text+1] = '<li>通过进化勇士有几率获得</li>'
	        end
	    end
	    if acquire['s'] then
	        if acquire['s'] ~= '' then
	            local stage = string.gsub(acquire['s'], ' ', '<br>')
	            output_text[#output_text+1] = '<li>在关卡 '..acquire['s']..' 中登场,完成关卡有几率获得'
	        end
        end
        if acquire['d'] then
	        if acquire['d'] ~= '' then
	            output_text[#output_text+1] = '<li>在古代地牢 [['..acquire['d']..']] 中登场,完成关卡有几率获得</li>'
	        end
	    end
	    if acquire['e'] then
	        if acquire['e'] == '活动' then
	            output_text[#output_text+1] = '<li>通过官方活动获得</li>'
            elseif acquire['e'] == '史诗任务' then
                output_text[#output_text+1] = '<li>通过史诗任务获得</li>'
            elseif acquire['e'] ~= '' then
                output_text[#output_text+1] = '<li>'..acquire['e']..'</li>'
            end
	    end
        output_text[#output_text+1] = '</ul></div>'
	end
	-- 左侧结束
	output_text[#output_text+1] = '</div>'
 
	-- 右侧开始
	output_text[#output_text+1] = '<div class="hero_right">'
	-- 角色属性
	output_text[#output_text+1] = '<div class="hero_stat"><h2 class="nodisplay">角色属性</h2><table>'
	output_text[#output_text+1] = '<tr><td>等级</td><td class="data rightmost" style="text-align: right;">'..(r*10)..'</td><td>职业</td><td class="data rightmost" style="text-align: right;">'..icon.class({args={hero_data[name]['c'], 'm', true}})..'</td></tr>'
-- 	output_text[#output_text+1] = '<tr><td>获得方法</td><td class="data rightmost" style="text-align: right;" colspan="3">'..hero_data[name]['acquire']..'</td></tr>'
	if comment ~= '' then
	    if comment['昵称'] ~= '' then
	        output_text[#output_text+1] = '<tr><td>俗称</td><td class="data rightmost" style="text-align: right;" colspan="3">'..comment['昵称']..'</td></tr>'
	    end
	end
	output_text[#output_text+1] = '<tr><td>属性</td><td class="data">Lv'..(r*10)..'</td><td class="data"></td><td class="data rightmost">+Max</td></tr>'
	output_text[#output_text+1] = '<tr><td>攻击力</td><td class="data">'..hero_data[name]['atk']..'</td><td class="data rightmost" colspan="2">'..math.floor(hero_data[name]['atk']*(1+0.1*(r-1)))..'</td></tr>'
	output_text[#output_text+1] = '<tr><td>体力</td><td class="data">'..hero_data[name]['hp']..'</td><td class="data rightmost" colspan="2">'..math.floor(hero_data[name]['hp']*(1+0.1*(r-1)))..'</td></tr>'
	output_text[#output_text+1] = '<tr><td>暴击率</td><td class="data">'..hero_data[name]['cr']..'%</td><td class="data rightmost" colspan="2">'..hero_data[name]['cr']..'%</td></tr>'
	output_text[#output_text+1] = '<tr><td>物理防御</td><td class="data">'..hero_data[name]['ar']..'</td><td class="data rightmost" colspan="2">'..math.floor(hero_data[name]['ar']*(1+0.1*(r-1)))..'</td></tr>'
	output_text[#output_text+1] = '<tr><td>魔法防御</td><td class="data">'..hero_data[name]['rs']..'</td><td class="data rightmost" colspan="2">'..math.floor(hero_data[name]['rs']*(1+0.1*(r-1)))..'</td></tr>'
    output_text[#output_text+1] = '</table></div>'
 
    -- 方块技能
    output_text[#output_text+1] = '<div class="hero_skill frame"><h2 class="nodisplay">方块技能</h2><div class="background"><div class="title hidden">方块技能</div>'
    output_text[#output_text+1] = '[[File:'..hero_data[name]['sk']..'.png|51px|link='..hero_data[name]['sk']..']]'
    output_text[#output_text+1] = '<div class="name'
    -- 如果有被动
    if passive_data ~= nil then
        output_text[#output_text+1] = ' havepassive">'
        if passive_data['t'] == '主力型' then
            output_text[#output_text+1] = '<span class="main">【主力型】</span>'
        elseif passive_data['t'] == '辅助型' then
            output_text[#output_text+1] = '<span class="support">【辅助型】</span>'
        else
            output_text[#output_text+1] = '<span>【未知型】</span>'
        end
        output_text[#output_text+1] = '<br class="hidden">'
    else
        output_text[#output_text+1] = '">'
    end
    output_text[#output_text+1] = '[['..hero_data[name]['sk']..']]</div>'
    -- 技能描述
    output_text[#output_text+1] = '<div class="description">'..get_skill_effect(hero_data[name]['sk'])..'</div>'
    -- 被动描述
    if passive_data ~= nil then
        if passive_r3 then
            output_text[#output_text+1] = '<div class="passive">被动(★3)('..passive_data['t']..'):'..passive_data[1]..'</div>'
        else
            output_text[#output_text+1] = '<div class="passive'
            if (r == 1 or r == 2 or r == 3 or r == 6) then
                output_text[#output_text+1] = ' off'
            end
            output_text[#output_text+1] = '">被动Lv1(★4/★5)('..passive_data['t']..'):'..passive_data[1]..'</div>'
            output_text[#output_text+1] = '<div class="passive'
            if r ~= 6 then
                output_text[#output_text+1] = ' off'
            end
            output_text[#output_text+1] = '">被动Lv2(★6)('..passive_data['t']..'):'..passive_data[2]..'</div>'
 
            output_text[#output_text+1] = '<div class="comment">被动评价:'..base.get_comment(comment, '被动评价', true, comment_name)..'</div>'
        end
    end
    output_text[#output_text+1] = '</div></div>'
 
    -- SP技能推荐
    if comment ~= '' then
        if comment['推荐SP技能1'] ~= '' then
            output_text[#output_text+1] = '<div class="hero_sp_skill frame"><h2 class="nodisplay">特殊技能推荐</h2><div class="background"><div class="title hidden">特殊技能推荐</div>'
 
            output_text[#output_text+1] = '<div class="sp_skill">'
            output_text[#output_text+1] = '[[File:'..comment['推荐SP技能1']..'.png|51px|link='..comment['推荐SP技能1']..']]'
            output_text[#output_text+1] = '<span class="name">[['..comment['推荐SP技能1']..']]</span>'
            output_text[#output_text+1] = '<div class="description">'..get_spskill_effect(comment['推荐SP技能1'])..'</div>'
            output_text[#output_text+1] = '<div class="comment">推荐理由:'..base.get_comment(comment, '推荐SP技能理由1', true, comment_name)..'</div>'
            output_text[#output_text+1] = '</div>'
 
            if comment['推荐SP技能2'] ~= '' then
                output_text[#output_text+1] = '<div class="sp_skill">'
                output_text[#output_text+1] = '[[File:'..comment['推荐SP技能2']..'.png|51px|link='..comment['推荐SP技能2']..']]'
                output_text[#output_text+1] = '<span class="name">[['..comment['推荐SP技能2']..']]</span>'
                output_text[#output_text+1] = '<div class="description">'..get_spskill_effect(comment['推荐SP技能2'])..'</div>'
                output_text[#output_text+1] = '<div class="comment">推荐理由:'..base.get_comment(comment, '推荐SP技能理由2', true, comment_name)..'</div>'
                output_text[#output_text+1] = '</div>'
            end
 
            if comment['推荐SP技能3'] ~= '' then
                output_text[#output_text+1] = '<div class="sp_skill">'
                output_text[#output_text+1] = '[[File:'..comment['推荐SP技能3']..'.png|51px|link='..comment['推荐SP技能3']..']]'
                output_text[#output_text+1] = '<span class="name">[['..comment['推荐SP技能3']..']]</span>'
                output_text[#output_text+1] = '<div class="description">'..get_spskill_effect(comment['推荐SP技能3'])..'</div>'
                output_text[#output_text+1] = '<div class="comment">推荐理由:'..base.get_comment(comment, '推荐SP技能理由3', true, comment_name)..'</div>'
                output_text[#output_text+1] = '</div>'
            end
 
            output_text[#output_text+1] = '</div></div>'
        end
    end
 
    -- 专属武器
    if weapon_data ~= nil then
        output_text[#output_text+1] = '<div class="hero_sbweapon frame"><div class="background"><div class="title">专属精粹武器</div>'
        output_text[#output_text+1] = '<div style="margin-bottom:10px">'
        -- 4级专武
        output_text[#output_text+1] = '<table class="sbw_table">'
        output_text[#output_text+1] = '<tr><td rowspan="2" class="sbw_img">[[File:'..weapon_data['r4']..'.png|45px]]</td><td class="sbw_name">'..weapon_data['r4']..'</td><td class="sbw_stat_top"><div class="sbw_stat one_line"><span class="stat">攻击力<span class="num">'..weapon_data['r4a']..'</span></span></div></td></tr>'
        output_text[#output_text+1] = '<tr><td class="sbw_star bottom">'..star(4)..'</td><td class="sbw_stat_bot"><div class="sbw_stat"><span class="stat">攻击速度<span class="num">'..weapon_data['r4s']..'</span></span></div></td></tr>'
        output_text[#output_text+1] = '</table>'
        -- 5级专武
        output_text[#output_text+1] = '<table class="sbw_table">'
        output_text[#output_text+1] = '<tr><td rowspan="3" class="sbw_img">[[File:'..weapon_data['r5']..'.png|45px]]</td><td class="sbw_name">'..weapon_data['r5']..'</td><td class="sbw_stat_top"><div class="sbw_stat one_line"><span class="stat">攻击力<span class="num">'..weapon_data['r5a']..'</span></span></div></td></tr>'
        output_text[#output_text+1] = '<tr><td class="sbw_star">'..star(5)..'</td><td class="sbw_stat_mid"><div class="sbw_stat"><span class="stat">攻击速度<span class="num">'..weapon_data['r5s']..'</span></span></div></td></tr>'
        output_text[#output_text+1] = '<tr><td class="sbw_sp sp">专用属性Lv1</td><td class="sbw_stat_bot"><div class="sbw_stat sp"><span class="stat">'..weapon_data['e5']..'</span></div></td></tr>'
        output_text[#output_text+1] = '</table>'
        -- 6级专武
        output_text[#output_text+1] = '<table class="sbw_table">'
        output_text[#output_text+1] = '<tr><td rowspan="3" class="sbw_img">[[File:'..weapon_data['r6']..'.png|45px]]</td><td class="sbw_name">'..weapon_data['r6']..'</td><td class="sbw_stat_top"><div class="sbw_stat one_line"><span class="stat">攻击力<span class="num">'..weapon_data['r6a']..'</span></span></div></td></tr>'
        output_text[#output_text+1] = '<tr><td class="sbw_star">'..star(6)..'</td><td class="sbw_stat_mid"><div class="sbw_stat"><span class="stat">攻击速度<span class="num">'..weapon_data['r6s']..'</span></span></div></td></tr>'
        output_text[#output_text+1] = '<tr><td class="sbw_sp sp">专用属性Lv2</td><td class="sbw_stat_bot"><div class="sbw_stat sp"><span class="stat">'..weapon_data['e6']..'</span></div></td></tr>'
        output_text[#output_text+1] = '</table>'
 
        -- 评价
        output_text[#output_text+1] = '<table class="sbw_table">'
        local sbw_rank = tonumber(base.get_comment(comment, '专武评级'))
        if sbw_rank ~= nil and sbw_rank >= 1 and sbw_rank <=6 then
            sbw_rank=star(sbw_rank)
        else
            sbw_rank='暂无专武评级'
        end
        output_text[#output_text+1] = '<tr><td class="sbw_name comment">综合评级</td><td class="sbw_stat_top"><div class="sbw_stat">'..sbw_rank..'</div></td></tr>'
        output_text[#output_text+1] = '<tr><td class="sbw_star comment">推荐改造槽</td><td class="sbw_stat_mid"><div class="sbw_stat"><span class="stat">'..base.get_comment(comment, '专武推荐改造槽', true, comment_name)..'</span></div></td></tr>'
        output_text[#output_text+1] = '<tr><td class="sbw_sp comment">评价</td><td class="sbw_stat_bot"><div class="sbw_stat"><span class="stat">'..base.get_comment(comment, '专武评价', true, comment_name)..'</span></div></td></tr>'
        output_text[#output_text+1] = '</table>'
 
        -- 结束
        output_text[#output_text+1] = '</div>'
        output_text[#output_text+1] = '</div></div>'
 
        -- 旧版备份
        -- output_text[#output_text+1] = '<div class="hero_weapon frame"><h2 class="nodisplay">专属精粹武器</h2><div class="background"><div class="title hidden">专属精粹武器</div>'
        -- output_text[#output_text+1] = '<div class="weapon_promote">'
        -- output_text[#output_text+1] = '<div class="weapon_icon">[[File:'..weapon_data['r4']..'.png|120px]]<div class="star hidden">4</div><div class="name">★4 '..weapon_data['r4']..'</div><div class="attack_damage">攻击力<span class="data">'..weapon_data['r4a']..'</span></div><div class="attack_speed">攻击速度<span class="data">'..weapon_data['r4s']..'</span></div></div>'
        -- output_text[#output_text+1] = '<div class="arrow"></div>'
        -- output_text[#output_text+1] = '<div class="weapon_icon">[[File:'..weapon_data['r5']..'.png|120px]]<div class="star hidden">5</div><div class="name">★5 '..weapon_data['r5']..'</div><div class="attack_damage">攻击力<span class="data">'..weapon_data['r5a']..'</span></div><div class="attack_speed">攻击速度<span class="data">'..weapon_data['r5s']..'</span></div></div>'
        -- output_text[#output_text+1] = '<div class="arrow"></div>'
        -- output_text[#output_text+1] = '<div class="weapon_icon">[[File:'..weapon_data['r6']..'.png|120px]]<div class="star hidden">6</div><div class="name">★6 '..weapon_data['r6']..'</div><div class="attack_damage">攻击力<span class="data">'..weapon_data['r6a']..'</span></div><div class="attack_speed">攻击速度<span class="data">'..weapon_data['r6s']..'</span></div></div>'
        -- output_text[#output_text+1] = '</div>'
 
        -- output_text[#output_text+1] = '<div class="passive">专用属性Lv1(★5):'..weapon_data['e5']..'</div>'
        -- output_text[#output_text+1] = '<div class="passive">专用属性Lv2(★6):'..weapon_data['e6']..'</div>'
        -- output_text[#output_text+1] = '<div class="comment">专武评价:'..base.get_comment(comment, '专武评价', true, comment_name)..'</div>'
        -- output_text[#output_text+1] = '<div class="comment">推荐改造槽:'..base.get_comment(comment, '专武推荐改造槽', true, comment_name)..'</div>'
        -- output_text[#output_text+1] = '</div></div>'
    end
 
    -- 改造槽推荐,只有拥有高级星级的勇士才有这个项目
    if promote_data ~= nil then
        output_text[#output_text+1] = '<div class="hero_weapon_upgrade frame"><h2 class="nodisplay">武器改造推荐</h2><div class="background"><div class="title hidden">武器改造推荐</div>'
        output_text[#output_text+1] = '<div class="name atk">攻击改造</div><div class="comment">'..base.get_comment(comment, '攻击改造推荐', true, comment_name)..'</div>'
        output_text[#output_text+1] = '<div class="name def">防御改造</div><div class="comment">'..base.get_comment(comment, '防御改造推荐', true, comment_name)..'</div>'
        output_text[#output_text+1] = '<div class="name func">能力改造</div><div class="comment">'..base.get_comment(comment, '功能改造推荐', true, comment_name)..'</div>'
        output_text[#output_text+1] = '</div></div>'       
    end
 
    -- 右侧结束
    output_text[#output_text+1] = '</div>'
 
    -- 添加分类
    output_text[#output_text+1] = base.cate('勇士', hero_data[name]['c'])
    output_text[#output_text+1] = base.cate('★'..r..'勇士', hero_data[name]['c'])
    output_text[#output_text+1] = base.cate(hero_data[name]['c'], r)
    output_text[#output_text+1] = base.cate('拥有技能:'..hero_data[name]['sk'])
 
    return table.concat(output_text)
end
 
function p.icon(frame)
    local heroname = frame.args[1]
    local size = frame.args[2] or 'm'
    local full = frame.args[3] or ''
 
    output_text = {}
 
    size_list = {s='20',m='30',l='72'}
 
    -- 图片链接
    img_text = '[[File:'..heroname..'_icon.png|'..size_list[size]..'px|link='..heroname..'|★'..hero_data[heroname]['r']..' '..heroname..']]'
    -- 移动端下的名字文本和链接,web端当第三个参数为name时也会显示
    name_text = '[['..heroname..'|★'..hero_data[heroname]['r']..' '..heroname..']]'
 
    if size ~= 'l' then
        output_text[#output_text+1] = base.hidden{args={img_text}}
        if full ~= 'name' then
            output_text[#output_text+1] = base.nodisplay{args={name_text}}
        else
            output_text[#output_text+1] = ' '..name_text
        end
    else
        output_text[#output_text+1] = '<div class="hero_icon hidden">'..img_text
        output_text[#output_text+1] = '<div class="star">'..hero_data[heroname]['r']..'</div></div>'
        output_text[#output_text+1] = base.nodisplay{args={name_text}}
    end
 
    return table.concat(output_text)
end
 
function p.herobox(frame)
    local heroname = frame.args[1]
 
    output_text = {}
 
    output_text[#output_text+1] = '<div class="hero_box hidden">'
    output_text[#output_text+1] = '<div class="pic">[[File:'..heroname..'.png|link='..heroname..'|★'..hero_data[heroname]['r']..' '..heroname..']]</div>'
    output_text[#output_text+1] = '<div class="name">[['..heroname..']]</div>'
    output_text[#output_text+1] = '<div class="star">'..star(hero_data[heroname]['r'])..'</div>'
    output_text[#output_text+1] = '</div>'
    output_text[#output_text+1] = base.nodisplay{args={'[['..heroname..'|★'..hero_data[heroname]['r']..' '..heroname..']]'}}
 
    return table.concat(output_text)
end
 
return p

您使用了广告屏蔽软件!


Wikia通过广告运营为用户提供免费的服务。我们对用户通过嵌入广告屏蔽软件访问网站进行了使用调整。

如果您使用了广告屏蔽软件,将无法使用我们的服务。请您移除广告屏蔽软件,以确保页面正常加载。

查看其他FANDOM

随机维基