Модуль:Песочница/Pok: различия между версиями

мНет описания правки
мНет описания правки
Строка 2: Строка 2:


local eventData = mw.loadData("Модуль:IanComradeBot/prototypes/StationEvent.json/data")
local eventData = mw.loadData("Модуль:IanComradeBot/prototypes/StationEvent.json/data")
local cargoData = mw.loadData("Модуль:IanComradeBot/IanComradeBot/prototypes/cargo.json/data")


function p.eventStation(frame)
function p.eventStation(frame)
Строка 84: Строка 85:
                 if cargo.gifts then
                 if cargo.gifts then
                     for giftId, giftValue in pairs(cargo.gifts) do
                     for giftId, giftValue in pairs(cargo.gifts) do
                         giftsCell = giftsCell .. "- {{#invoke:Entity Lookup|getname|" .. giftId .. "}}: x" .. giftValue .. "</li>"
                         local productFound = nil
                        for _, cargoItem in ipairs(cargoData) do
                            if cargoItem.id == giftId then
                                productFound = cargoItem.product
                                break
                            end
                        end
                        if productFound then
                            giftsCell = giftsCell .. "- " .. productFound .. ": x" .. giftValue .. "<br>"
                        else
                            giftsCell = giftsCell .. "- {{#invoke:Entity Lookup|getname|" .. giftId .. "}}: x" .. giftValue .. "<br>"
                        end
                     end
                     end
                 else
                 else
                     giftsCell = "Нет подарков"
                     giftsCell = "Нет подарков"
                 end
                 end
                 local characteristicsList = ""
                 local characteristicsList = ""
                 local stationEvent = event.StationEvent or {}
                 local stationEvent = event.StationEvent or {}