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

Нет описания правки
Нет описания правки
Строка 41: Строка 41:
     -- Вычисляем цвет рамки (чуть темнее заданного цвета)
     -- Вычисляем цвет рамки (чуть темнее заданного цвета)
     local borderColor = darkenColor(color)
     local borderColor = darkenColor(color)
    -- Создание HTML с помощью mw.html.create
    local div = mw.html.create('div')
    div:addClass(divClass)


     -- Формирование строк для ячеек таблицы
     -- Формирование строк для ячеек таблицы
     local out = ""
     local tableContent = ""
     out = out .. '!style="background-color: ' .. color .. ';border-top: 1px solid ' .. borderColor .. ';border-bottom: 1px solid ' .. borderColor .. ';border-left: 2px solid ' .. borderColor .. ';"|' .. anchor  
     tableContent = tableContent .. '!style="background-color: ' .. color .. ';border-top: 1px solid ' .. borderColor .. ';border-bottom: 1px solid ' .. borderColor .. ';border-left: 2px solid ' .. borderColor .. ';"|' .. anchor  
     out = out .. imageTooltip
     tableContent = tableContent .. imageTooltip
     out = out .. '<br>' .. itemName .. '\n'
     tableContent = tableContent .. '<br>' .. itemName .. '\n'
     out = out .. '|style="font-weight:bold;color: crimson;background-color: ' .. backgroundColor .. '"|' .. protBlunt .. '\n'
     tableContent = tableContent .. '|style="font-weight:bold;color: crimson;background-color: ' .. backgroundColor .. '"|' .. protBlunt .. '\n'
     out = out .. '|style="font-weight:bold;color: indianred;background-color: ' .. backgroundColor .. '"|' .. protSlash .. '\n'
     tableContent = tableContent .. '|style="font-weight:bold;color: indianred;background-color: ' .. backgroundColor .. '"|' .. protSlash .. '\n'
     out = out .. '|style="font-weight:bold;color: darksalmon;background-color: ' .. backgroundColor .. '"|' .. protPiercing .. '\n'
     tableContent = tableContent .. '|style="font-weight:bold;color: darksalmon;background-color: ' .. backgroundColor .. '"|' .. protPiercing .. '\n'
     out = out .. '|style="font-weight:bold;color: orange;background-color: ' .. backgroundColor .. '"|' .. protHeat .. '\n'
     tableContent = tableContent .. '|style="font-weight:bold;color: orange;background-color: ' .. backgroundColor .. '"|' .. protHeat .. '\n'
     out = out .. '|style="font-weight:bold;color: plum;background-color: ' .. backgroundColor .. '"|' .. protRadiation .. '\n'
     tableContent = tableContent .. '|style="font-weight:bold;color: plum;background-color: ' .. backgroundColor .. '"|' .. protRadiation .. '\n'
     out = out .. '|style="font-weight:bold;color: limegreen;background-color: ' .. backgroundColor .. '"|' .. protCaustic .. '\n'
     tableContent = tableContent .. '|style="font-weight:bold;color: limegreen;background-color: ' .. backgroundColor .. '"|' .. protCaustic .. '\n'
     out = out .. '|style="font-weight:bold;color: tan;background-color: ' .. backgroundColor .. '"|' .. protExplosion .. '\n'
     tableContent = tableContent .. '|style="font-weight:bold;color: tan;background-color: ' .. backgroundColor .. '"|' .. protExplosion .. '\n'
     out = out .. '|style="background-color: ' .. backgroundColor .. '"|\n' .. description .. '\n'
     tableContent = tableContent .. '|style="background-color: ' .. backgroundColor .. '"|\n' .. description .. '\n'
     out = out .. '|style="background-color: ' .. backgroundColor .. '"|\n' .. location .. '\n|-'
     tableContent = tableContent .. '|style="background-color: ' .. backgroundColor .. '"|\n' .. location .. '\n|-'


     -- Обертывание результата в div с заданным классом
     div:wikitext(tableContent)
    local result = '<div class="' .. class .. '">' .. out .. '</div>'


     return result
     return tostring(div)
end
end


return p
return p