维护提醒
BWIKI 全站将于 9 月 3 日(全天)进行维护,期间无法编辑任何页面或发布新的评论。
全站通知:
模块:Artisan
刷
历
编
跳到导航
跳到搜索
local Helper = require("Module:Helper")
local ObjectData = Helper.LazyLoad('Module:Object/data')
local Name = require("Module:Name")
local Object = require("Module:Object")
local p = {}
function p.filterByCategory(data, category)
local filtered = {}
for id, item in pairs(data) do
if item['Category'] == category then
filtered[id] = item
end
end
return filtered
end
function p.getFruits(frame)
local fruits = p.filterByCategory(ObjectData, -79)
local htmlTable = '<table class="wikitable mw-collapsible mw-collapsed">\n'
htmlTable = htmlTable .. '<tr><th>可用于制作果酱的物品</th></tr>\n' -- <th>Name</th><th>Type</th><th>Price</th><th>ContextTags</th>
local sortedIds = {}
for id in pairs(fruits) do
table.insert(sortedIds, id)
end
table.sort(sortedIds)
for _, id in ipairs(sortedIds) do
local fruit = fruits[id]
local contextTags = fruit['ContextTags'] or "nil"
if type(contextTags) == "table" then
contextTags = table.concat(contextTags, ", ")
end
htmlTable = htmlTable .. '<tr>\n'
local color = Object.getColorById{args = {id}} .. " Jelly" or "Jelly"
local en = fruit['Name']
local cn = Name.name {args = { en }}
this = '[[File:' .. color .. '.png|24px|link=]] [[File:' .. en .. '.png|24px|link=]] [[' .. cn .. ']]果酱'
htmlTable = htmlTable .. ' <td>' .. this .. '</td>\n'
htmlTable = htmlTable .. '</tr>\n'
end
htmlTable = htmlTable .. '</table>'
return htmlTable
end
function p.getVegetables(frame)
local fruits = p.filterByCategory(ObjectData, -75)
local htmlTable = '<table class="wikitable mw-collapsible mw-collapsed">\n'
htmlTable = htmlTable .. '<tr><th>可用于制作腌菜的物品</th></tr>\n' -- <th>Name</th><th>Type</th><th>Price</th><th>ContextTags</th>
local sortedIds = {}
for id in pairs(fruits) do
table.insert(sortedIds, id)
end
table.sort(sortedIds)
for _, id in ipairs(sortedIds) do
local fruit = fruits[id]
local contextTags = fruit['ContextTags'] or "nil"
if type(contextTags) == "table" then
contextTags = table.concat(contextTags, ", ")
end
htmlTable = htmlTable .. '<tr>\n'
local color = Object.getColorById{args = {id}} .. " Pickles" or "Pickles"
local en = fruit['Name']
local cn = Name.name {args = { en }}
this = '[[File:' .. color .. '.png|24px|link=]] [[File:' .. en .. '.png|24px|link=]] 腌制[[' .. cn .. ']]'
htmlTable = htmlTable .. ' <td>' .. this .. '</td>\n'
htmlTable = htmlTable .. '</tr>\n'
end
htmlTable = htmlTable .. '</table>'
return htmlTable
end
function p.getFruits2(frame)
local fruits = p.filterByCategory(ObjectData, -79)
local htmlTable = '<table class="wikitable mw-collapsible mw-collapsed">\n'
htmlTable = htmlTable .. '<tr><th>可用于制作果酒的物品</th></tr>\n' -- <th>Name</th><th>Type</th><th>Price</th><th>ContextTags</th>
local sortedIds = {}
for id in pairs(fruits) do
table.insert(sortedIds, id)
end
table.sort(sortedIds)
for _, id in ipairs(sortedIds) do
local fruit = fruits[id]
local contextTags = fruit['ContextTags'] or "nil"
if type(contextTags) == "table" then
contextTags = table.concat(contextTags, ", ")
end
htmlTable = htmlTable .. '<tr>\n'
local color = Object.getColorById{args = {id}} .. " Wine" or "Wine"
local en = fruit['Name']
local cn = Name.name {args = { en }}
this = '[[File:' .. color .. '.png|24px|link=]] [[File:' .. en .. '.png|24px|link=]] [[' .. cn .. ']]果酒'
htmlTable = htmlTable .. ' <td>' .. this .. '</td>\n'
htmlTable = htmlTable .. '</tr>\n'
end
htmlTable = htmlTable .. '</table>'
return htmlTable
end
function p.getVegetables2(frame)
local fruits = p.filterByCategory(ObjectData, -75)
local htmlTable = '<table class="wikitable mw-collapsible mw-collapsed">\n'
htmlTable = htmlTable .. '<tr><th>可用于制作果汁(蔬菜汁)的物品</th></tr>\n' -- <th>Name</th><th>Type</th><th>Price</th><th>ContextTags</th>
local sortedIds = {}
for id in pairs(fruits) do
local test = tonumber(id)
if test ~= 304 and test ~= 815 and test ~= 262 and test ~= 433 then -- 啤酒花、茶叶、小麦、咖啡豆
table.insert(sortedIds, id)
end
end
table.sort(sortedIds)
for _, id in ipairs(sortedIds) do
local fruit = fruits[id]
local contextTags = fruit['ContextTags'] or "nil"
if type(contextTags) == "table" then
contextTags = table.concat(contextTags, ", ")
end
htmlTable = htmlTable .. '<tr>\n'
local color = Object.getColorById{args = {id}} .. " Juice" or "Juice"
local en = fruit['Name']
local cn = Name.name {args = { en }}
this = '[[File:' .. color .. '.png|24px|link=]] [[File:' .. en .. '.png|24px|link=]] [[' .. cn .. ']]果汁'
htmlTable = htmlTable .. ' <td>' .. this .. '</td>\n'
htmlTable = htmlTable .. '</tr>\n'
end
htmlTable = htmlTable .. '</table>'
return htmlTable
end
function p.getFruits3(frame)
local fruits = p.filterByCategory(ObjectData, -79)
local htmlTable = '<table class="wikitable mw-collapsible mw-collapsed">\n'
htmlTable = htmlTable .. '<tr><th>可用于制作果干的物品</th></tr>\n' -- <th>Name</th><th>Type</th><th>Price</th><th>ContextTags</th>
local sortedIds = {}
for id in pairs(fruits) do
local test = tonumber(id)
if test ~= 398 then -- 葡萄
table.insert(sortedIds, id)
end
end
table.sort(sortedIds)
for _, id in ipairs(sortedIds) do
local fruit = fruits[id]
local contextTags = fruit['ContextTags'] or "nil"
if type(contextTags) == "table" then
contextTags = table.concat(contextTags, ", ")
end
htmlTable = htmlTable .. '<tr>\n'
local color = Object.getColorById{args = {id}} .. " Dried Fruit" or "Dried Fruit"
local en = fruit['Name']
local cn = Name.name {args = { en }}
this = '[[File:' .. color .. '.png|24px|link=]] [[File:' .. en .. '.png|24px|link=]] [[' .. cn .. ']]干'
htmlTable = htmlTable .. ' <td>' .. this .. '</td>\n'
htmlTable = htmlTable .. '</tr>\n'
end
htmlTable = htmlTable .. '</table>'
return htmlTable
end
return p