Модуль:Prototypes/Механика/Награда доставки

Материал из Space Station 14 Вики
Версия от 17:15, 22 марта 2025; Pok (обсуждение | вклад) (Новая страница: «local p = {} -- Загрузка данных local cargoData = mw.loadData("Модуль:IanComradeBot/prototypes/cargo/bounty.json/base") function p.main() local output = {} table.insert(output, '{| class="wikitable"') table.insert(output, '|-') table.insert(output, '! Продукт (количество)') table.insert(output, '! Денежное вознаграждение') for _, item in pairs(cargoData) do loca...»)
(разн.) ← Предыдущая версия | Текущая версия (разн.) | Следующая версия → (разн.)

Для документации этого модуля может быть создана страница Модуль:Prototypes/Механика/Награда доставки/doc

local p = {}

-- Загрузка данных
local cargoData = mw.loadData("Модуль:IanComradeBot/prototypes/cargo/bounty.json/base")

function p.main()
    local output = {}
    table.insert(output, '{| class="wikitable"')
    table.insert(output, '|-')
    table.insert(output, '! Продукт (количество)')
    table.insert(output, '! Денежное вознаграждение')
    
    for _, item in pairs(cargoData) do
        local reward = item.reward 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, '|-')
                table.insert(output, string.format("| %s x%s || {{ColorPalette|Other|price|%s}}$", product, amount, reward))
            end
        end
    end
    
    table.insert(output, "|}")
    return table.concat(output, "\n")
end

return p