Module:HeroData: Difference between revisions

Jump to navigation Jump to search
Sur (talk | contribs)
m get_hero_stat > get_hero_var
Sur (talk | contribs)
m _attribute_order attribute_order
Line 216: Line 216:




--{{#invoke:HeroData|write_stat_boxes|HERO_NAME}}
--{{#invoke:HeroData|write_stat_infoboxes|HERO_NAME}}
--Creates {{StatBox}}'s' for the 3 categories Weapon, Vitality, Spirit
--Creates {{Infobox_stat}}'s' for the 3 categories Weapon, Vitality, Spirit
p.write_stat_boxes = function(frame)
p.write_stat_infoboxes = function(frame)
local hero_name = frame.args[1]
local hero_name = frame.args[1]
if(hero_name == nil) then return "Hero parameter missing" end
if(hero_name == nil) then return "Hero parameter missing" end
-- Use expandTemplate to evaluate the Infobox_hero template
-- Use expandTemplate to evaluate the Infobox_hero template
     local template_title = mw.title.new("Template:StatBox") --name of the template
     local template_title = mw.title.new("Template:Infobox_stat") --name of the template
     local template_calls = "" --all template calls concatenated
     local template_calls = "" --all template calls concatenated
     local template_call --current template call
     local template_call --current template call
Line 242: Line 242:
local should_display
local should_display
for _, category in ipairs(attribute_orders["_category_order"]) do
for _, category in ipairs(attribute_orders["category_order"]) do
stats = attributes_data[category]
stats = attributes_data[category]
local category_values = category_data[category]
local category_values = category_data[category]
Line 251: Line 251:
-- Determine cell values
-- Determine cell values
for _, stat_name in ipairs(attribute_orders[category]["_attribute_order"]) do
for _, stat_name in ipairs(attribute_orders[category]["attribute_order"]) do
stat_data = stats[stat_name]
stat_data = stats[stat_name]
-- Confirm its meant to be displayed in hero statbox
-- Confirm its meant to be displayed in hero stat infobox
should_display = stat_data['display_regions']['hero_statbox']
should_display = stat_data['display_regions']['hero_statbox']
if (should_display ~= nil) then
if (should_display ~= nil) then