Module:Abilities/card: Difference between revisions

Vergir (talk | contribs)
m make fontsize shrink on upgradeboxes trigger later/less
Removed generic property (square) icons for attributes
Line 309: Line 309:
value = value,
value = value,
status_effect = prop.StatusEffect,
status_effect = prop.StatusEffect,
icon = icon.img,
icon = icon and icon.img,
icon_link = icon.link,
icon_link = icon and icon.link,
icon_color = icon.color,
icon_color = icon and icon.color,
icon_size = icon.size,
icon_size = icon and icon.size,
scale_value = prop.Scale and commonutils.round_to_sig_fig(prop.Scale.Value, 3),
scale_value = prop.Scale and commonutils.round_to_sig_fig(prop.Scale.Value, 3),
scale_type =  prop.Scale and prop.Scale.Type,
scale_type =  prop.Scale and prop.Scale.Type,
Line 326: Line 326:
key = prop.Key,
key = prop.Key,
value = value,
value = value,
icon = icon.img,
icon = icon and icon.img,
icon_link = icon.link,
icon_link = icon and icon.link,
icon_color = icon.color,
icon_color = icon and icon.color,
icon_size = icon.size,
icon_size = icon and icon.size,
scale_value = prop.Scale and commonutils.round_to_sig_fig(prop.Scale.Value, 3),
scale_value = prop.Scale and commonutils.round_to_sig_fig(prop.Scale.Value, 3),
scale_type =  prop.Scale and prop.Scale.Type,
scale_type =  prop.Scale and prop.Scale.Type,
Line 377: Line 377:
key = prop.Key,
key = prop.Key,
value = prop.Value,
value = prop.Value,
icon = icon.img,
icon = icon and icon.img,
icon_link = icon.link,
icon_link = icon and icon.link,
icon_color = icon.color,
icon_color = icon and icon.color,
icon_size = icon.size,
icon_size = icon and icon.size,
scale_value = prop.Scale and commonutils.round_to_sig_fig(prop.Scale.Value, 3),
scale_value = prop.Scale and commonutils.round_to_sig_fig(prop.Scale.Value, 3),
scale_type =  prop.Scale and prop.Scale.Type,
scale_type =  prop.Scale and prop.Scale.Type,
Line 492: Line 492:
local attr_type = frame.args[1]
local attr_type = frame.args[1]
local icon = get_icon(attr_type)
local icon = get_icon(attr_type)
if icon == nil then
return ''
end


return string.format('[[File:%s|%s|18px|link=%s]]', icon.img or '', icon.size or '', icon.link or '')
return string.format('[[File:%s|%s|18px|link=%s]]', icon.img or '', icon.size or '', icon.link or '')
Line 498: Line 501:
function get_icon(attr_type)
function get_icon(attr_type)
local mappedAttr = ATTR_TYPE_ICON_MAP[attr_type]
local mappedAttr = ATTR_TYPE_ICON_MAP[attr_type]
local img = 'GenericProperty.png'
 
local img = nil
local link = ''
local link = ''
local size = ''
local size = ''
local color = 'Grey'
local color = 'Grey'
if mappedAttr then
if mappedAttr then
img = mappedAttr.img
img = mappedAttr.img
Line 507: Line 512:
size = mappedAttr.size
size = mappedAttr.size
color = mappedAttr.color or color
color = mappedAttr.color or color
end
if img == nil then
return nil
end
end