模块:ItemInfo:修订间差异

跳转到导航 跳转到搜索
添加86字节 、​ 2024年6月8日 (星期六)
修复问题
(修正错误)
(修复问题)
第54行: 第54行:
end
end


-- 根据物品ID获取物品类别
local function queryCategoryById(game, id)
local function queryCategoryById(game, id)
     id = tonumber(id)
     id = tonumber(id)
第90行: 第91行:
end
end


-- 根据ID获取物品名
local function getNameById(game, id)
local function getNameById(game, id)
     local item, err = p.loadItemById(game, id)
     local item, err = p.loadItemById(game, id)
第96行: 第98行:
end
end


-- 过滤重结晶项
local function recryFilter(recry)
local function recryFilter(recry)
     local game = 'AT1'
     local game = 'AT1'
第113行: 第116行:
     end
     end
     return ret
     return ret
end
p.gcType = {'#b70000', '#0d57cb', '#139a00', '#9f0087'}
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 = p.loadItemInfoByIndex('AT1', '葛拉斯诺晶体', i)
        local type = tonumber(item.type)
        -- 之后要替换为图片及标题的::before元素,提供更好的视觉效果
        local icon = '<span style="background-color: ' .. p.gcType[type + 1] .. '; padding: 0 .25em; color: white">' .. item.level .. '</span>'
        local section = '==' .. item.name .. '==\n' .. item.desc
        local html = mw.html.create('table'):addClass('wikitable')
        html:tag('tr')
            :tag('th'):wikitext('类型'):done()
            :tag('th'):wikitext('品质'):done()
            :tag('th'):wikitext('GD'):done()
            :tag('th'):wikitext('价格'):done()
            :tag('th'):wikitext('稀有度'):done()
            :tag('th'):wikitext(be.getBattleEffectById('AT1', item.eff_key)):done()
       
        html:tag('tr')
            :tag('th'):wikitext(icon):done()
            :tag('td'):wikitext(item.quality):done()
            :tag('td'):wikitext(item.gd):done()
            :tag('td'):wikitext(string.sub(item.price, 0, -2)):done()
            :tag('td'):wikitext(item.rarity):done()
            :tag('td'):wikitext(item.eff_val):done()
       
        local list = checkAndMakeParamList(item)
        table.insert(result, section .. tostring(html) .. '\n' .. list)
    end       
    return table.concat(result, '\n')
end
local function makeArgumentOfParameter(args, para)
    for i, v in ipairs(paramNames) do
        args[paramDisplay[i]] = para[v]
    end
end
end


第196行: 第255行:
         args = arguments
         args = arguments
     }
     }
end
p.gcType = {'#b70000', '#0d57cb', '#139a00', '#9f0087'}
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 = p.loadItemInfoByIndex('AT1', '葛拉斯诺晶体', i)
        local type = tonumber(item.type)
        -- 之后要替换为图片及标题的::before元素,提供更好的视觉效果
        local icon = '<span style="background-color: ' .. p.gcType[type + 1] .. '; padding: 0 .25em; color: white">' .. item.level .. '</span>'
        local section = '==' .. item.name .. '==\n' .. item.desc
        local html = mw.html.create('table'):addClass('wikitable')
        html:tag('tr')
            :tag('th'):wikitext('类型'):done()
            :tag('th'):wikitext('品质'):done()
            :tag('th'):wikitext('GD'):done()
            :tag('th'):wikitext('价格'):done()
            :tag('th'):wikitext('稀有度'):done()
            :tag('th'):wikitext(be.getBattleEffectById('AT1', item.eff_key)):done()
       
        html:tag('tr')
            :tag('th'):wikitext(icon):done()
            :tag('td'):wikitext(item.quality):done()
            :tag('td'):wikitext(item.gd):done()
            :tag('td'):wikitext(string.sub(item.price, 0, -2)):done()
            :tag('td'):wikitext(item.rarity):done()
            :tag('td'):wikitext(item.eff_val):done()
       
        local list = checkAndMakeParamList(item)
        table.insert(result, section .. tostring(html) .. '\n' .. list)
    end       
    return table.concat(result, '\n')
end
local function makeArgumentOfParameter(args, para)
    for i, v in ipairs(paramNames) do
        args[paramDisplay[i]] = para[v]
    end
end
end


1,075

个编辑

导航菜单