Module:HeroData: Difference between revisions

Jump to navigation Jump to search
add hero count
Sur (talk | contribs)
m write_default_items initial
Line 90: Line 90:
end
end


p.write_default_items = function(frame)
local hero_name = frame.args[1] --english
if (hero_name == nil) then return "No hero name provided" end
local str = ""
local hero = heroes_data[p.get_hero_key(hero_name)]
if (hero == nil) then return "Hero not found, must be in english" end
local template_title = 'PageRef'
for i, item_key in ipairs(hero["RecommendedItems"]) do
template_args = {}
template_args[1] = lang_module._get_string(item_key)
local expanded_template = mw.getCurrentFrame():expandTemplate{ title = template_title, args = template_args }
str = str .. "* " .. expanded_template .. "\n"
end
return str
end


--If the hero scales with the stat, it returns {{Ss|value}} or {{Ls|value}}, else blank string
--If the hero scales with the stat, it returns {{Ss|value}} or {{Ls|value}}, else blank string