模块:物品用途:修订间差异
外观
建立模块化物品展示及用户提供的测试数据(不迁移旧掉落) |
按旧Wiki恢复完整来源表、合成样式和缺省文案;物品来源不显示概率 |
||
| 第12行: | 第12行: | ||
pieces[#pieces + 1] = "'''用于合成:'''" .. table.concat(links, '、') | pieces[#pieces + 1] = "'''用于合成:'''" .. table.concat(links, '、') | ||
cats[#cats + 1] = '能作为合成材料的物品' | cats[#cats + 1] = '能作为合成材料的物品' | ||
end | |||
local action = c.text('物品作用') | local action = c.text('物品作用') | ||
if action then pieces[#pieces + 1] = action; cats[#cats + 1] = '有一定用途的物品' end | if action then pieces[#pieces + 1] = action; cats[#cats + 1] = '有一定用途的物品' end | ||
if #pieces == 0 then pieces[1] = ' | if #pieces == 0 then | ||
return C.finish(c, 'uses', C.heading(c, '有什么用?') .. table.concat(pieces, ' | 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 | end | ||
return p | return p | ||
2026年10月24日 (六) 12:18的版本
此模块的文档可以在模块:物品用途/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