跳转到内容

模块:物品用途

来自Wymbot 共创站
NotBot​(留言 | 贡献)2026年10月24日 (六) 12:18的版本 (按旧Wiki恢复完整来源表、合成样式和缺省文案;物品来源不显示概率)

此模块的文档可以在模块:物品用途/doc创建

local C = require('模块:物品通用')
local D = require('模块:物品数据')
local p = {}
function p.main(frame)
    local c = C.context(frame)
    if not c.enabled then return '' end
    local result, cats, pieces = D.getUses(c.name), {}, {}
    if result.status == 'error' then pieces[#pieces + 1] = C.diagnostic(result); cats[#cats + 1] = '物品数据异常的页面'
    elseif result.status == 'known' then
        local links = {}
        for _, name in ipairs(result.products) do links[#links + 1] = C.link(name) end
        pieces[#pieces + 1] = "'''用于合成:'''" .. table.concat(links, '、')
        cats[#cats + 1] = '能作为合成材料的物品'
    end
    local action = c.text('物品作用')
    if action then pieces[#pieces + 1] = action; cats[#cats + 1] = '有一定用途的物品' end
    if #pieces == 0 then
        if c.kind == '种子' then pieces[1] = '他妈,种子就是拿来种的,你觉得还能有什么用?'
        elseif c.kind == '装备' then pieces[1] = '他妈,这装备能干啥???'
        else pieces[1] = '他妈,这东西屁用没有!' end
    end
    return C.finish(c, 'uses', C.heading(c, '有什么用?') .. table.concat(pieces, '<br>'), cats)
end
return p