Модуль:Песочница/Pok: различия между версиями
Pok (обсуждение | вклад) м Полностью удалено содержимое страницы Метки: очистка ручная отмена |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 1: | Строка 1: | ||
-- Загружаем данных | |||
local cargoData = mw.loadData("Модуль:IanComradeBot/prototypes/cargo/bounty.json/base") | |||
local p = {} | |||
function p.table(frame) | |||
local output = {} | |||
for _, item in pairs(cargoData) do | |||
local reward = item.reward or "" | |||
local description = item.description or "" | |||
if item.entries then | |||
for _, entry in ipairs(item.entries) do | |||
local product = entry.name or "" | |||
local amount = entry.amount or "" | |||
table.insert(output, '|data-sort-value=' .. reward .. '|') | |||
local cellTemplate = string.format( | |||
"{{Cut-Layout|1=[[File:%s.png|32px]] <b>%s</b> x%s|2={{ColorPalette|Other|price|%s}}$|3=%s}}", | |||
product, | |||
frame:preprocess('{{#invoke:Ftl|main|translation|' .. product .. '}}'), | |||
amount, | |||
reward, | |||
frame:preprocess('{{#invoke:Ftl|main|translation|' .. description .. '}}') | |||
) | |||
table.insert(output, cellTemplate) | |||
table.insert(output, '|-') | |||
end | |||
end | |||
end | |||
return frame:preprocess(table.concat(output, "\n")) | |||
end | |||
return p | |||