Модуль:Песочница/Pok: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 1: | Строка 1: | ||
-- Загрузка данных | -- Загрузка данных | ||
local itemData | local itemData = mw.loadData("Модуль:IanComradeBot/prototypes/fills/Item.json/data") | ||
local itemSlotsData = mw.loadData("Модуль:IanComradeBot/prototypes/ItemSlots.json/data") | local itemSlotsData = mw.loadData("Модуль:IanComradeBot/prototypes/ItemSlots.json/data") | ||
local chemData | local chemData = mw.loadData("Модуль:IanComradeBot/prototypes/fills/chem.json/data") | ||
local chemTranslateData = mw.loadData("Модуль:IanComradeBot/chem prototypes.json/data") | |||
local p = {} | local p = {} | ||
| Строка 289: | Строка 290: | ||
return '' | return '' | ||
end | end | ||
local function processSolution(solution) | local function processSolution(solution) | ||
| Строка 296: | Строка 295: | ||
if solution and solution.reagents then | if solution and solution.reagents then | ||
for _, reagent in ipairs(solution.reagents) do | for _, reagent in ipairs(solution.reagents) do | ||
local chemInfo = chemTranslateData[reagent.ReagentId] | |||
local displayName = chemInfo and chemInfo.name or reagent.ReagentId | |||
output = output .. string.format( | output = output .. string.format( | ||
'<li>[[Химия#chem_%s|%s]] (%d ед.)</li>', | '<li>[[Химия#chem_%s|%s]] (%d ед.)</li>', | ||
reagent.ReagentId, | reagent.ReagentId, displayName, reagent.Quantity | ||
) | ) | ||
end | end | ||
| Строка 305: | Строка 306: | ||
end | end | ||
local result = "" | |||
result = result .. processSolution(item.SolutionContainerManager.solutions["food"]) | result = result .. processSolution(item.SolutionContainerManager.solutions["food"]) | ||
result = result .. processSolution(item.SolutionContainerManager.solutions["beaker"]) | result = result .. processSolution(item.SolutionContainerManager.solutions["beaker"]) | ||