Module:HeroData: Difference between revisions

Sur (talk | contribs)
m statboxes in div style
Sur (talk | contribs)
m some attrs now brown instad of grey
Line 75: Line 75:
return element
return element
end
end


Line 203: Line 205:
-- Check if icon file exists, and if not, don't use any image
-- Check if icon file exists, and if not, don't use any image
image_file_name = 'File:AttributeIcon' .. stat_name .. '.png'
image_file_name = 'File:AttributeIcon' .. stat_name .. '.png'
-- 15px and link to stat name (page name might not match perfectly yet)
image_file = util_module.get_image_file(image_file_name, 15, stat_name)
image_file = util_module.get_image_file(image_file_name, 15, stat_name)
-- Create the template'd icon
-- Create the template'd icon
local icon_color
local icon_color = attribute_module.get_attr_icon_color(stat_name)
if (stat_name == "DPS") then
icon_color = "Brown"
else
icon_color = "Grey"
end
icon_template_title = mw.title.new("Template:Icon/" .. icon_color)
icon_template_title = mw.title.new("Template:Icon/" .. icon_color)
icon_template_args = {}
icon_template_args = {}
Line 218: Line 214:
icon_template_args[2] = stat_value .. postfix
icon_template_args[2] = stat_value .. postfix
icon_and_value_str = mw.getCurrentFrame():expandTemplate{ title = icon_template_title, args = icon_template_args }
icon_and_value_str = mw.getCurrentFrame():expandTemplate{ title = icon_template_title, args = icon_template_args }
label =  ',<span style="color: #999999; background-color: #2F2F2F; display: inline-flex; width: 100%; height: 100%; justify-content: center; align-items: center;">' .. label .. '</span>'
-- First add localized stat name for left column
-- First add localized stat name for left column
stat_values[category] = stat_values[category] .. ',<span style="color: #999999; background-color: #2F2F2F; display: inline-flex; width: 100%; height: 100%; justify-content: center; align-items: center;">' .. label .. '</span>'
stat_values[category] = stat_values[category] .. label
-- Then add icon and stat value for right column
-- Then add icon and stat value for right column
Line 305: Line 303:
-- Check if icon file exists, and if not, don't use any image
-- Check if icon file exists, and if not, don't use any image
image_file_name = 'File:AttributeIcon' .. stat_name .. '.png'
image_file_name = 'File:AttributeIcon' .. stat_name .. '.png'
-- 15px and link to stat name (page name might not match perfectly yet)
image_file = util_module.get_image_file(image_file_name, 15, stat_name)
image_file = util_module.get_image_file(image_file_name, 15, stat_name)
-- Create the template'd icon
local icon_color = attribute_module.get_attr_icon_color(stat_name)
if (icon_color == "Brown") then
image_file = '<span style="position: relative; bottom: 2px; filter: invert(42%) sepia(10%) saturate(2912%) hue-rotate(351deg) brightness(90%) contrast(87%);">' .. image_file .. '</span>'
else
image_file = '<span style="position: relative; bottom: 2px; filter: brightness(0) saturate(100%) invert(69%) sepia(4%) saturate(19%) hue-rotate(356deg) brightness(87%) contrast(95%);">' .. image_file .. '</span>'
end
-- Add an empty cell following some stats to align them correctly as seen in game
-- Add an empty cell following some stats to align them correctly as seen in game