模块:ItemInfo:修订间差异

跳转到导航 跳转到搜索
添加2,105字节 、​ 2024年6月8日 (星期六)
添加葛拉斯诺晶体列表函数
(完成材料部分模块)
(添加葛拉斯诺晶体列表函数)
第1行: 第1行:
local p = {}
local p = {}
local be = require 'BattleEffect'


function p.loadItemInfoByIndex(game, category, index)
function p.loadItemInfoByIndex(game, category, index)
第75行: 第77行:
         ["子类别"] = '采集',
         ["子类别"] = '采集',
         ["卖价"] = item.base.sell_price,
         ["卖价"] = item.base.sell_price,
         ["游戏"] = 'AT1',     
         ["游戏"] = AT1,     
         -- 重结晶S=filteredRecrystalisation.s_prod,
         -- 重结晶S=filteredRecrystalisation.s_prod,
         -- 重结晶A=filteredRecrystalisation.a_prod,
         -- 重结晶A=filteredRecrystalisation.a_prod,
第109行: 第111行:
     end
     end
     return table.concat(result, '\n')
     return table.concat(result, '\n')
end
p.gcType = {'#b70000', '#0d57cb', '#139a00', '#670057'}
local paramNames = {'hp', 'mp', 'atk', 'crit', 'def', 'agi', 'fdef', 'idef', 'tdef', 'wdef', 'fatk', 'iatk', 'tatk', 'watk', 'dmg_max', 'burst_spd', 'gd_resist', 'harmonics'}
local paramDisplay = {'HP', 'MP', '攻击力', '暴击率', '防御力', '敏捷', '炎抗性', '冰抗性', '雷抗性', '风抗性', '炎攻击', '冰攻击', '雷攻击', '风攻击', '附加伤害', '爆发速率', 'GD抗性', '和声增益'}
local function checkAndMakeParamList(item)
    result = {}
    for i, v in ipairs(paramNames) do
        if item[v] ~= '0' then
            table.insert(result, '* ' .. paramDisplay[i] .. item[v])
        end
    end
    return table.concat(result, '\n')
end
function p.generateGrathnodeCrystalList()
    local result = {}
    for i = 1, 339 do
        local item = loadItemInfoByIndex('AT1', '葛拉斯诺晶体', i)
        local type = tonumber(item.type)
        -- 之后要替换为图片,提供更好的视觉效果
        local icon = '<span style="background-color: ' .. p.gcType[type] .. '; padding: .1em; color: white">' .. item.level .. '</span>'
        local section = '==' .. icon .. item.name .. '==\n' .. item.desc
        local html = mw.html.create('table'):addClass('wikitable')
        html:tag('tr')
            :tag('th'):wikitext('品质'):done()
            :tag('th'):wikitext('GD'):done()
            :tag('th'):wikitext('价格'):done()
            :tag('th'):wikitext('稀有度'):done()
            :tag('th'):wikitext(be.getBattleEffectById(item.eff_key)):done()
       
        html:tag('tr')
            :tag('th'):wikitext(item.quality):done()
            :tag('th'):wikitext(item.gd):done()
            :tag('th'):wikitext(string.sub(item.price, 0, -2)):done()
            :tag('th'):wikitext(item.rarity):done()
            :tag('th'):wikitext(item.eff_val):done()
       
        local list = checkAndMakeParamList(item)
        table.insert(result, section .. tostring(html) .. list)
    end       
    return table.concat(result, '\n\n')
end
end


return p
return p
1,075

个编辑

导航菜单