Модуль:ArmorStats: различия между версиями
Pok (обсуждение | вклад) Нет описания правки |
Pok (обсуждение | вклад) Нет описания правки |
||
| Строка 12: | Строка 12: | ||
function p.templateCells(frame) | function p.templateCells(frame) | ||
local anchorName = frame.args.anchorName or "" -- Название якоря | local anchorName = frame.args.anchorName or "" -- Название якоря | ||
local itemId = frame.args.itemId or "" -- ID предмета | |||
local image = frame.args.image or "" -- Путь к изображению предмета | local image = frame.args.image or "" -- Путь к изображению предмета | ||
local | local color = frame.args.color or "" -- Цвет фона первой ячейки | ||
local backgroundColor = frame.args.backgroundColor or "" -- Цвет фона для всех ячеек, кроме первой | |||
local protBlunt = frame.args.protBlunt or "-" -- Ударный | local protBlunt = frame.args.protBlunt or "-" -- Ударный | ||
local protSlash = frame.args.protSlash or "-" -- Режущий | local protSlash = frame.args.protSlash or "-" -- Режущий | ||
local protPiercing = frame.args.protPiercing or "-" -- Колющий | local protPiercing = frame.args.protPiercing or "-" -- Колющий | ||
local protHeat = frame.args.protHeat or "-" -- Высокотемпературный | local protHeat = frame.args.protHeat or "-" -- Высокотемпературный | ||
local protRadiation = frame.args.protRadiation or "-" -- | local protRadiation = frame.args.protRadiation or "-" -- Кислотный | ||
local protCaustic = frame.args.protCaustic or "-" -- | local protCaustic = frame.args.protCaustic or "-" -- Радиационный | ||
local protExplosion = frame.args.protExplosion or "-" -- Взрывной | local protExplosion = frame.args.protExplosion or "-" -- Взрывной | ||
local description = frame.args.description or "" -- Описание | local description = frame.args.description or "" -- Описание | ||
local location = frame.args.location or "" -- Местонахождение | local location = frame.args.location or "" -- Местонахождение | ||
-- Вызов | -- Вызов модулей | ||
local imageTooltip = frame:preprocess('{{#invoke:Entity Lookup|createimagetooltip|File:' .. image .. '|' .. itemId .. '|Мета=64x64px}}') | local imageTooltip = frame:preprocess('{{#invoke:Entity Lookup|createimagetooltip|File:' .. image .. '|' .. itemId .. '|Мета=64x64px}}') | ||
local itemName = frame:preprocess('{{#invoke:Entity Lookup|getname|' .. itemId .. '}}') | local itemName = frame:preprocess('{{#invoke:Entity Lookup|getname|' .. itemId .. '}}') | ||
local anchor = frame:preprocess('{{Anchor|' .. anchorName .. '}}') | local anchor = frame:preprocess('{{Anchor|' .. anchorName .. '}}') | ||
local borderColor = darkenColor(color) | local borderColor = darkenColor(color) | ||
-- | -- Формирование строк для ячеек таблицы | ||
local | local out = "" | ||
out = out .. '!style="background-color: ' .. color .. ';border-top: 1px solid ' .. borderColor .. ';border-bottom: 1px solid ' .. borderColor .. ';border-left: 2px solid ' .. borderColor .. ';"|' .. anchor | |||
out = out .. imageTooltip | |||
out = out .. '<br>' .. itemName .. '\n' | |||
out = out | out = out .. '|style="font-weight:bold;color: crimson;background-color: ' .. backgroundColor .. '"|' .. protBlunt .. '\n' | ||
out = out .. '|style="font-weight:bold;color: indianred;background-color: ' .. backgroundColor .. '"|' .. protSlash .. '\n' | |||
out = out .. '|style="font-weight:bold;color: darksalmon;background-color: ' .. backgroundColor .. '"|' .. protPiercing .. '\n' | |||
out = out .. '|style="font-weight:bold;color: orange;background-color: ' .. backgroundColor .. '"|' .. protHeat .. '\n' | |||
out = out .. '|style="font-weight:bold;color: plum;background-color: ' .. backgroundColor .. '"|' .. protRadiation .. '\n' | |||
out = out .. '|style="font-weight:bold;color: limegreen;background-color: ' .. backgroundColor .. '"|' .. protCaustic .. '\n' | |||
out = out .. '|style="font-weight:bold;color: tan;background-color: ' .. backgroundColor .. '"|' .. protExplosion .. '\n' | |||
out = out .. '|style="background-color: ' .. backgroundColor .. '"|\n' .. description .. '\n' | |||
out = out .. '|style="background-color: ' .. backgroundColor .. '"|\n' .. location .. '\n|-' | |||
return | return out | ||
end | end | ||
return p | return p | ||