模块:ItemInfo:修订间差异

跳转到导航 跳转到搜索
删除1,136字节 、​ 2024年6月8日 (星期六)
优化代码结构
(修正bug)
(优化代码结构)
第79行: 第79行:
end
end


-- 生成物品基本信息的方法,使用模板“物品信息”
local function generateArguments(item)
-- type:采集/合成
function p.at1ItemInfo(category, subcategory, index)
    local catName = category
    if subcategory == '合成' then
        catName = '合成材料'
    elseif subcategory == '采集' then
        catName = '材料物品'
    end
    local item = p.loadItemInfoByIndex('AT1', catName, index)
 
     local filteredRecrystalisation = recryFilter(item.recry)
     local filteredRecrystalisation = recryFilter(item.recry)


第107行: 第97行:
         ["笔记"] = item.desc
         ["笔记"] = item.desc
     }
     }
    if item.para ~= nil then
        makeArgumentOfParameter(arguments, item.para)
    end
     if item.base.synthesisable == '1' then
     if item.base.synthesisable == '1' then
         arguments["配方"] = ci.getRecipeCardNameById(item.base.rc_id)
         arguments["配方"] = ci.getRecipeCardNameById(item.base.rc_id)
第133行: 第126行:
         end
         end
     end
     end
    if item.powered_slots ~= nil then
        local slots = ''
        for i = 1, 4 do
            if item.powered_slots[i] == '1' then
                slots = slots .. i
            end
        end
        arguments["强化槽位"] = slots
    end
end
-- 生成物品基本信息的方法,使用模板“物品信息”
-- type:采集/合成
function p.at1ItemInfo(category, subcategory, index)
    local catName = category
    if category == '装备' then
        catName = subcategory
    else
        if subcategory == '合成' then
            catName = '合成材料'
        elseif subcategory == '采集' then
            catName = '材料物品'
        end
    end
    local item = p.loadItemInfoByIndex('AT1', catName, index)
    local arguments = generateArguments(item)


     return mw.getCurrentFrame():expandTemplate {
     return mw.getCurrentFrame():expandTemplate {
第195行: 第215行:
end
end


function p.at1EquipInfo(type, index)
-- AT1 物品信息卡(按ID)
    local item = p.loadItemInfoByIndex('AT1', type, index)
function p.makeAt1ItemInfo(id)
   
     local item = loadItemById('AT1', id)
     local filteredRecrystalisation = recryFilter(item.recry)
 
    local arguments = {
        ["物品名"] = item.name,
        ["图像"] = item.img,
        ["原文"] = item.ori,
        ["类别"] = '装备',
        ["子类别"] = type,
        ["卖价"] = item.base.sell_price,
        ["游戏"] = 'AT1',    
        ["重结晶S"] = filteredRecrystalisation.s_prod,
        ["重结晶A"] = filteredRecrystalisation.a_prod,
        ["重结晶B"] = filteredRecrystalisation.b_prod,
        ["重结晶C"] = filteredRecrystalisation.c_prod,
        ["其他来源"] = item.alt_src,
        ["笔记"] = item.desc
    }
 
    if item.base.synthesisable == '1' then
        arguments["配方"] = ci.getRecipeCardNameById(item.base.rc_id)
    end
    if item.src ~= nil then
        for i = 1, 5 do
            if not item.src[i] then
                arguments['来源' .. i .. '/类别'] = item.src[i].type
                arguments['来源' .. i .. '/详细'] = item.src[i].desc
            end
        end
    end
    if item.item_use_this ~= nil then
        for i = 1, 8 do
            arguments['合成用途' .. i] = item.item_use_this[i]
        end
    end
    if item.naming ~= nil then
        arguments["欧莉卡命名"] = item.naming.orica
        arguments["弥纱命名"] = item.naming.misya
        arguments["修蕾莉亚命名"] = item.naming.syureria
    end
    if item.material ~= nil then
        for i = 1, 4 do
            arguments['材料' .. i] = item.material[i]
        end
    end
 
    makeArgumentOfParameter(arguments, item.para)


     slots = ''
     local arguments = generateArguments(item)
    for i = 1, 4 do
        if item.powered_slots[i] == '1' then
            slots = slots .. i
        end
    end
    arguments["强化槽位"] = slots


     return mw.getCurrentFrame():expandTemplate {
     return mw.getCurrentFrame():expandTemplate {
第264行: 第232行:
     result = {}
     result = {}
     for i = 1, 29 do
     for i = 1, 29 do
         table.insert(result, p.at1EquipInfo('防具', i))
         table.insert(result, p.at1ItemInfo('装备', '防具', i))
     end
     end
     return table.concat(result, '\n')
     return table.concat(result, '\n')
第272行: 第240行:
     result = {}
     result = {}
     for i = 1, 35 do
     for i = 1, 35 do
         table.insert(result, p.at1EquipInfo('武器', i))
         table.insert(result, p.at1ItemInfo('装备', '武器', i))
     end
     end
     return table.concat(result, '\n')
     return table.concat(result, '\n')
第280行: 第248行:
     result = {}
     result = {}
     for i = 1, 20 do
     for i = 1, 20 do
         table.insert(result, p.at1EquipInfo('饰品', i))
         table.insert(result, p.at1ItemInfo('装备', '饰品', i))
     end
     end
     return table.concat(result, '\n')
     return table.concat(result, '\n')
1,075

个编辑

导航菜单