|
|
| (не показаны 44 промежуточные версии этого же участника) |
| Строка 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
| |