模块:物品用途:修订间差异
外观
建立模块化物品展示及用户提供的测试数据(不迁移旧掉落) |
钓鱼来源与分解用途:补充以小钓大及对应饽物品;不改原五张数据表 |
||
| (未显示同一用户的1个中间版本) | |||
| 第12行: | 第12行: | ||
pieces[#pieces + 1] = "'''用于合成:'''" .. table.concat(links, '、') | pieces[#pieces + 1] = "'''用于合成:'''" .. table.concat(links, '、') | ||
cats[#cats + 1] = '能作为合成材料的物品' | cats[#cats + 1] = '能作为合成材料的物品' | ||
end | |||
local disassembly = D.getDisassembly(c.name) | |||
local extra = require('模块:钓鱼展示').disassemblyText(disassembly) | |||
local warning | |||
if disassembly.status == 'known' and extra ~= '' then pieces[#pieces + 1] = extra | |||
elseif disassembly.status == 'error' then warning = extra 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 | |||
-- A new data error must not suppress existing uses, editor text, or fallback wording. | |||
if warning and warning ~= '' then pieces[#pieces + 1] = warning end | |||
return C.finish(c, 'uses', C.heading(c, '有什么用?') .. table.concat(pieces, '<br>'), cats) | |||
end | end | ||
return p | return p | ||
2026年11月17日 (二) 12:35的最新版本
此模块的文档可以在模块:物品用途/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 disassembly = D.getDisassembly(c.name)
local extra = require('模块:钓鱼展示').disassemblyText(disassembly)
local warning
if disassembly.status == 'known' and extra ~= '' then pieces[#pieces + 1] = extra
elseif disassembly.status == 'error' then warning = extra 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
-- A new data error must not suppress existing uses, editor text, or fallback wording.
if warning and warning ~= '' then pieces[#pieces + 1] = warning end
return C.finish(c, 'uses', C.heading(c, '有什么用?') .. table.concat(pieces, '<br>'), cats)
end
return p