Редактирование: Модуль:Utils
Материал из Eco - Русская Wiki
Правка может быть отменена. Пожалуйста, просмотрите сравнение версий ниже, чтобы убедиться, что это нужная вам правка, и запишите страницу ниже, чтобы отменить правку.
Текущая версия | Ваш текст | ||
Строка 43: | Строка 43: | ||
---@param border string|nil | ---@param border string|nil | ||
---@param too_expensive boolean|nil | ---@param too_expensive boolean|nil | ||
function p.build_icon(name | function p.build_icon(name, size, bg, border, too_expensive) | ||
-- Size options are iconNormal or iconRecipe - 64px or 44px - defaults to iconNormal | -- Size options are iconNormal or iconRecipe - 64px or 44px - defaults to iconNormal | ||
Строка 71: | Строка 71: | ||
icon_bg = 'iconGold' | icon_bg = 'iconGold' | ||
-- Attempt to generate skill page | -- Attempt to generate skill page | ||
elseif in_array(L.t('Basic Research'), item['tagGroups']) then | elseif in_array(L.t('Basic Research'), item['tagGroups']) then | ||
image = string.sub(item['untranslated'], 1, -7):gsub('%s+', '') .. '_Icon.png' | image = string.sub(item['untranslated'], 1, -7):gsub('%s+', '') .. '_Icon.png' | ||
icon_bg = 'paperBasic' | icon_bg = 'paperBasic' | ||
elseif in_array(L.t('Advanced Research'), item['tagGroups']) then | elseif in_array(L.t('Advanced Research'), item['tagGroups']) then | ||
image = string.sub(item['untranslated'], 1, -10):gsub('%s+', '') .. '_Icon.png' | image = string.sub(item['untranslated'], 1, -10):gsub('%s+', '') .. '_Icon.png' | ||
icon_bg = 'paperAdvanced' | icon_bg = 'paperAdvanced' | ||
elseif in_array(L.t('Modern Research'), item['tagGroups']) then | elseif in_array(L.t('Modern Research'), item['tagGroups']) then | ||
image = string.sub(item['untranslated'], 1, -8):gsub('%s+', '') .. '_Icon.png' | image = string.sub(item['untranslated'], 1, -8):gsub('%s+', '') .. '_Icon.png' | ||
icon_bg = 'paperModern' | icon_bg = 'paperModern' | ||
Строка 110: | Строка 110: | ||
end | end | ||
local file = '[[File:' .. image .. '|frameless|class=' .. size .. ' ' .. icon_bg .. ']]' | |||
local file = '[[File:' .. image .. '|frameless|class=' .. size .. ' ' .. icon_bg | |||
return '<div class="' .. icon_container .. '"><div class="iconStack">' .. file .. '</div><div class="iconBorder ' .. icon_border .. '" style="position:absolute;"></div></div>' | return '<div class="' .. icon_container .. '"><div class="iconStack">' .. file .. '</div><div class="iconBorder ' .. icon_border .. '" style="position:absolute;"></div></div>' | ||
end | end | ||
Строка 122: | Строка 116: | ||
function p.Icon(frame) | function p.Icon(frame) | ||
args = p.normaliseArgs(frame) | args = p.normaliseArgs(frame) | ||
return p.build_icon(args.name | return p.build_icon(args.name, args.size, args.bg, args.border, args.too_expensive) | ||
end | end | ||