Module:HeroData: Difference between revisions

Jump to navigation Jump to search
Sur (talk | contribs)
m get_hero_var now supports passing hero key
Sur (talk | contribs)
m write_stat_infoboxes now uses hero key instead of hero name
Line 279: Line 279:




--{{#invoke:HeroData|write_stat_infoboxes|HERO_NAME}}
--{{#invoke:HeroData|write_stat_infoboxes|HERO_KEY}}
--Creates {{Infobox_stat}}'s' for the 3 categories Weapon, Vitality, Spirit
--Creates {{Infobox_stat}}'s' for the 3 categories Weapon, Vitality, Spirit
p.write_stat_infoboxes = function(frame)
p.write_stat_infoboxes = function(frame)
local hero_name = frame.args[1]
local hero_key = frame.args[1]
if(hero_name == nil) then return "Hero parameter missing" end
if(hero_key == nil) then return "Hero parameter missing" end
-- Use expandTemplate to evaluate the Infobox_hero template
-- Use expandTemplate to evaluate the Infobox_hero template
Line 295: Line 295:
local postfix --current stat's postfix
local postfix --current stat's postfix
local stat_value --current stat's numerical value in the hero data
local stat_value --current stat's numerical value in the hero data
local hero_data = p.get_json_item(hero_name)
local hero_data = heroes_data[hero_key]
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_name --name of the image_file to check
Line 301: Line 301:
local extra_blank_cell --add a blank cell after certain stats
local extra_blank_cell --add a blank cell after certain stats
local stats_to_add_blank_after = {BulletLifesteal = true, CritDamageReceivedScale = true}
local stats_to_add_blank_after = {BulletLifesteal = true, CritDamageReceivedScale = true}
if (hero_data == nil) then return "Hero Not Found in AttrData" end
if (hero_data == nil) then return "Hero Not Found" end
local category_data = attribute_module.get_category_data()
local category_data = attribute_module.get_category_data()
local should_display
local should_display