Модуль:ArmorStats: различия между версиями

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


function p.templateCells(frame)
function p.templateCells(frame)
     local color = frame.args.color or ""  -- Цвет фона первой ячейки
     local args = frame.args
     local anchorName = frame.args.anchorName or "" -- Название якоря
    local class = args.class or "custom-class"  -- Класс для обертывающего <div>
     local image = frame.args.image or "" -- Путь к изображению предмета
 
     local itemId = frame.args.itemId or "" -- ID предмета
    -- Получаем все аргументы для формирования содержимого таблицы
   
    local color = args.color or ""
     local protBlunt = frame.args.protBlunt or "-" -- Ударный
     local anchorName = args.anchorName or ""
     local protSlash = frame.args.protSlash or "-" -- Режущий
     local image = args.image or ""
     local protPiercing = frame.args.protPiercing or "-" -- Колющий
     local itemId = args.itemId or ""
     local protHeat = frame.args.protHeat or "-" -- Высокотемпературный
     local protBlunt = args.protBlunt or "-"
     local protRadiation = frame.args.protRadiation or "-" -- Кислотный
     local protSlash = args.protSlash or "-"
     local protCaustic = frame.args.protCaustic or "-" -- Радиационный
     local protPiercing = args.protPiercing or "-"
     local protExplosion = frame.args.protExplosion or "-" -- Взрывной
     local protHeat = args.protHeat or "-"
   
     local protRadiation = args.protRadiation or "-"
     local description = frame.args.description or "" -- Описание
     local protCaustic = args.protCaustic or "-"
     local location = frame.args.location or "" -- Местонахождение
     local protExplosion = args.protExplosion or "-"
     local backgroundColor = frame.args.backgroundColor or "" -- Цвет фона для всех ячеек, кроме первой
     local description = args.description or ""
    local divClass = frame.args.divClass or "" -- Класс для элемента <div>
     local location = args.location or ""
     local backgroundColor = args.backgroundColor or ""


     -- Вызов функции из модуля Entity Lookup для создания image tooltip
     -- Вызов функции из модуля Entity Lookup для создания image tooltip
Строка 57: Строка 58:
     out = out .. '|style="background-color: ' .. backgroundColor .. '"|\n' .. location .. '\n|-'
     out = out .. '|style="background-color: ' .. backgroundColor .. '"|\n' .. location .. '\n|-'


     -- Обернуть весь выходной код в элемент <div> с заданным классом
     -- Обертываем результат в <div> с заданным классом
     return '<div class="' .. divClass .. '">' .. out .. '</div>'
     local wrappedOut = '<div class="' .. class .. '">' .. out .. '</div>'
 
    return wrappedOut
end
end


return p
return p