Модуль:Prototypes/Роль: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) Нет описания правки |
||
| (не показаны 4 промежуточные версии этого же участника) | |||
| Строка 15: | Строка 15: | ||
-- Форматирование времени | -- Форматирование времени | ||
local function formatTime( | local function formatTime(time) | ||
return "{{#invoke:Code/Формат/Время|main | return "{{#invoke:Code/Формат/Время|main|" .. time .. "}}" | ||
end | end | ||
| Строка 43: | Строка 43: | ||
if mode == "requirements" then | if mode == "requirements" then | ||
if job.requirements then | |||
for _, req in ipairs(job.requirements) do | |||
if req["!type"] == "DepartmentTimeRequirement" and req.department and req.time then | |||
result = result .. "<li>[[{{ucfirst:{{#invoke:Ftl|main|translation|department-" .. req.department .. "}}}}]]: " .. | |||
formatTime(req.time) .. "</li>" | |||
elseif req["!type"] == "RoleTimeRequirement" and req.role and req.time then | |||
result = result .. "<li>[[{{ucfirst:{{#invoke:Ftl|main|translation|" .. req.role .. "}}}}]]: " .. | |||
formatTime(req.time) .. "</li>" | |||
elseif req["!type"] == "OverallPlaytimeRequirement" and req.time then | |||
result = result .. "<li>Общее время: " .. formatTime(req.time) .. "</li>" | |||
end | |||
end | |||
end | |||
result = "<ul>" .. result .. "</ul>" | |||
elseif mode == "access" then | elseif mode == "access" then | ||
local accesses = {} | |||
if job.accessGroups then | |||
local groups = type(job.accessGroups[1]) == "table" and job.accessGroups or { job.accessGroups } | |||
for _, group in ipairs(groups) do | |||
for _, access in ipairs(group) do | |||
table.insert(accesses, wrapAccess(access)) | |||
end | |||
end | |||
elseif job.access then | |||
for _, access in ipairs(job.access) do | |||
table.insert(accesses, wrapAccess(access)) | |||
end | |||
end | |||
result = table.concat(accesses, ", ") | |||
elseif mode == "name" then | elseif mode == "name" then | ||
if job.name then | if job.name then | ||