Toggle menu
505
2.3K
828
21.8K
Deadlock Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:AttributeData: Difference between revisions

From Deadlock Wiki
Sur (talk | contribs)
m comments
Sur (talk | contribs)
m use no icon if the icon file doesnt exist
Line 46: Line 46:
local hero_data = hero_data_module.get_json_item(hero_name)
local hero_data = hero_data_module.get_json_item(hero_name)
local stats --stats of the current category
local stats --stats of the current category
local image_file_name --name of the image_file to check
local image_file --mw returned image file
if (hero_data == nil) then return "Hero Not Found" end
if (hero_data == nil) then return "Hero Not Found" end
local category_data = {
local category_data = {
Line 89: Line 91:
else
else
postfix = call_lang(postfix)
postfix = call_lang(postfix)
end
image_file_name = 'File:AttributeIcon' .. stat_name .. '.png'
image_file = mw.title.new(image_file_name)
if image_file and image_file.exists then
    image_file_name = "[[" .. image_file_name .. "|15px]]"
else
    image_file_name = ''
end
end
-- Set cell value as "Icon StatvaluePostfix Statname,"
-- Set cell value as "Icon StatvaluePostfix Statname,"
-- If icon file already exists, set it to #REDIRECT to the duplicate file page
-- If icon file already exists, set it to #REDIRECT to the duplicate file page
cell_value = "[[File:AttributeIcon" .. stat_name .. ".png|15px]]" .. " " .. stat_value  .. postfix .. " " .. label .. ","
cell_value = image_file_name .. " " .. stat_value  .. postfix .. " " .. label .. ","
cell_values = cell_values .. cell_value --add value to values list
cell_values = cell_values .. cell_value --add value to values list