Модуль:Prototypes/Хранилище/Предмет: различия между версиями

мНет описания правки
мНет описания правки
 
(не показано 5 промежуточных версий этого же участника)
Строка 53: Строка 53:


-- Имитирует "string.format('{{#invoke:Предмет|main|%s|%s<span>%s</span>|repository=1|wrapper=1}}', id, amount, prob)", но работает быстрее, поэтому так
-- Имитирует "string.format('{{#invoke:Предмет|main|%s|%s<span>%s</span>|repository=1|wrapper=1}}', id, amount, prob)", но работает быстрее, поэтому так
     return "{{LinkCard|name={{#invoke:Entity Lookup|getname|" .. id .. "}} {{#invoke:Prototypes/Хранилище/Предмет|main|framing|stack|" .. id .. "}} ".. amount .." <span>" .. prob .. "</span>|pin={{#invoke:Prototypes/Хранилище/Предмет|main|framing|contained|" .. id .. "}} {{#invoke:Prototypes/Хранилище/Предмет|main|framing|slot|" .. id .. "}} {{#invoke:Prototypes/Хранилище/Предмет|main|framing|stack|chem}}|image=" .. id .. ".png|pixel=32px|SideStyle=1}}"
     return "{{LinkCard|название={{#invoke:Entity Lookup|getname|" .. id .. "}} {{#invoke:Prototypes/Хранилище/Предмет|main|framing|stack|" .. id .. "}} ".. amount .." <span>" .. prob .. "</span>|пин={{#invoke:Prototypes/Хранилище/Предмет|main|framing|contained|" .. id .. "}} {{#invoke:Prototypes/Хранилище/Предмет|main|framing|slot|" .. id .. "}} {{#invoke:Prototypes/Хранилище/Предмет|main|framing|chem|" .. id .. "}}|изображение=[[Файл:" .. id .. ".png|32px]]|горизонт_стиль=1}}"
end
end


Строка 179: Строка 179:
     local wrapperStart, wrapperEnd = "", ""
     local wrapperStart, wrapperEnd = "", ""
     if groupSelector.weight and groupSelector.weight ~= "default" then
     if groupSelector.weight and groupSelector.weight ~= "default" then
         wrapperStart = string.format('{{LinkСard/Сollapsible|name=Группа предметов %s%%|content=', groupSelector.weight)
         wrapperStart = string.format('{{LinkCard/Сollapsible|название=Группа предметов %s%%|содержание=', groupSelector.weight)
         wrapperEnd = "}}"
         wrapperEnd = "}}"
     elseif groupSelector["!type"] == "GroupSelector" and not groupSelector.weight then
     elseif groupSelector["!type"] == "GroupSelector" and not groupSelector.weight then
         wrapperStart = '{{LinkСard/Сollapsible|name=Может выпасть лишь один из:|content='
         wrapperStart = '{{LinkCard/Сollapsible|название=Может выпасть лишь один из:|содержание='
         wrapperEnd = "}}"
         wrapperEnd = "}}"
     end
     end
Строка 190: Строка 190:
             result[#result + 1] = handleGroupSelector(child, visited)
             result[#result + 1] = handleGroupSelector(child, visited)
         elseif child["!type"] == "AllSelector" then
         elseif child["!type"] == "AllSelector" then
             result[#result + 1] = string.format('{{LinkСard/Сollapsible|name=Выпадают только вместе:|content=%s}}', handleAllSelector(child))
             result[#result + 1] = string.format('{{LinkCard/Сollapsible|название=Выпадают только вместе:|содержание=%s}}', handleAllSelector(child))
         elseif child.id then
         elseif child.id then
             result[#result + 1] = formatContent(child)
             result[#result + 1] = formatContent(child)
Строка 222: Строка 222:


     if wrapped and (classesRolls ~= "" or classesProb ~= "") then
     if wrapped and (classesRolls ~= "" or classesProb ~= "") then
         result[#result + 1] = string.format('{{LinkСard/Сollapsible|name=Группа предметов%s%s|content=', classesRolls, classesProb)
         result[#result + 1] = string.format('{{LinkCard/Сollapsible|название=Группа предметов%s%s|содержание=', classesRolls, classesProb)
     end
     end


Строка 255: Строка 255:
-- Формирование списка химии
-- Формирование списка химии
function getChemOutput(id)
function getChemOutput(id)
local chemTranslateData = mw.loadData("Модуль:IanComradeBot/chem prototypes.json/data")
     local function loadSolutionData(solutionType)
     local function loadSolutionData(solutionType)
         local modulePath = string.format("Модуль:IanComradeBot/prototypes/fills/chem/%s.json/data", solutionType)
         local modulePath = string.format("Модуль:IanComradeBot/prototypes/fills/chem/%s.json/data", solutionType)