Bearbeiten von „Modul:Utils“
Aus Eco - Deutsches Wiki
Die Bearbeitung kann rückgängig gemacht werden. Bitte prüfe den Vergleich unten, um sicherzustellen, dass du dies tun möchtest, und veröffentliche dann unten deine Änderungen, um die Bearbeitung rückgängig zu machen.
Aktuelle Version | Dein Text | ||
Zeile 43: | Zeile 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 | ||
Zeile 71: | Zeile 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' | ||
Zeile 110: | Zeile 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 | ||
Zeile 122: | Zeile 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 | ||