跳转到内容

模块:物品产出

来自Wymbot 共创站
NotBot​(留言 | 贡献)2026年10月24日 (六) 12:01的版本 (建立模块化物品展示及用户提供的测试数据(不迁移旧掉落))
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

此模块的文档可以在模块:物品产出/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 = D.getOutputs(c.name)
    if result.status == 'pending' or result.status == 'none' then return '' end
    if result.status == 'error' then
        return C.finish(c, 'outputs', C.heading(c, '会掉什么?') .. C.diagnostic(result), { '物品数据异常的页面' })
    end
    local rows = {}
    for _, entry in ipairs(result.entries) do
        rows[#rows + 1] = '|-\n| ' .. C.link(entry.item) .. ' || ' .. C.probability(entry)
    end
    return C.finish(c, 'outputs', C.heading(c, '会掉什么?') ..
        '{| class="wikitable wum-item-table"\n! 物品 !! 掉落概率\n' .. table.concat(rows, '\n') .. '\n|}')
end
return p