Модуль:Песочница/Pok: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 6: | Строка 6: | ||
local function buildCellEvent(name, image, id) | local function buildCellEvent(name, image, id) | ||
local cell = '<div style="text-align:center;">' | local cell = '<div style="text-align:center;">' | ||
cell = cell .. name .. "<br>" | cell = cell .. "" .. name .. "<br>" | ||
cell = cell .. "<span style='color:#adadad'>" .. id .. "</span><br>" | cell = cell .. "<span style='color:#adadad'>".. id .. "</span><br>" | ||
cell = cell .. '[[File:' .. image .. '|64px]]' | cell = cell .. '[[File:' .. image .. '|64px]]' | ||
cell = cell .. '</div>' | cell = cell .. '</div>' | ||
| Строка 14: | Строка 14: | ||
local function buildCharacteristicsList(frame, stationEvent) | local function buildCharacteristicsList(frame, stationEvent) | ||
local list = | local list = {} | ||
local characteristics = { | local characteristics = { | ||
{"Вес", "Вес события в системе случайных событий (чем выше, тем чаще случается)", stationEvent.weight}, | {"Вес", "Вес события в системе случайных событий (чем выше, тем чаще случается)", stationEvent.weight}, | ||
| Строка 21: | Строка 21: | ||
{"Длительность", "Длительность события в секундах", (stationEvent.duration and stationEvent.duration .. " сек.")} | {"Длительность", "Длительность события в секундах", (stationEvent.duration and stationEvent.duration .. " сек.")} | ||
} | } | ||
for _, char in ipairs(characteristics) do | for _, char in ipairs(characteristics) do | ||
local value = char[3] or "нет" | local value = char[3] or "нет" | ||
list | table.insert(list, "- " .. frame:expandTemplate{ | ||
title = "AltTooltip", | title = "AltTooltip", | ||
args = { char[1], char[2] } | args = { char[1], char[2] } | ||
} .. ": " .. value | } .. ": " .. value) | ||
end | end | ||
return list | |||
return table.concat(list, "<br>") | |||
end | end | ||
function p.eventStation(frame) | function p.eventStation(frame) | ||
local args = frame.args | local args = frame.args | ||
local searchId = args.id or "" | |||
local name = args.name or "" | local name = args.name or "" | ||
local image = args.image or "" | local image = args.image or "" | ||
| Строка 39: | Строка 41: | ||
local out = "" | local out = "" | ||
for _, event in ipairs(eventData) do | |||
if | if event.id == searchId then | ||
local cellEvent = buildCellEvent(name, image, searchId) | local cellEvent = buildCellEvent(name, image, searchId) | ||
local advert = (event.StationEvent and event.StationEvent.startAnnouncement) or "" | local advert = (event.StationEvent and event.StationEvent.startAnnouncement) or "" | ||
| Строка 63: | Строка 65: | ||
function p.eventCargo(frame) | function p.eventCargo(frame) | ||
local args = frame.args | local args = frame.args | ||
local searchId = args.id or "" | |||
local name = args.name or "" | local name = args.name or "" | ||
local image = args.image or "" | local image = args.image or "" | ||
local out = "" | local out = "" | ||
for _, event in ipairs(eventData) do | |||
if | if event.id == searchId then | ||
local cellEvent = buildCellEvent(name, image, searchId) | local cellEvent = buildCellEvent(name, image, searchId) | ||
local cargo = event.CargoGiftsRule or {} | local cargo = event.CargoGiftsRule or {} | ||