Module:HeroData/headcount: Difference between revisions

Sur (talk | contribs)
ported from HeroData module; now supports released and hero lab heroes separately
 
added exception for silver transformed
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
local p = {}
local p = {}
local heroes_data = mw.loadJsonData("Data:HeroData.json")


-- {{Heroes count}} access point
-- {{Heroes count}} access point
Line 8: Line 9:
for _, v in pairs(heroes_data) do
for _, v in pairs(heroes_data) do
if hero_type == 'Released' then
if hero_type == 'Released' then
if (v["InDevelopment"] == false and v["IsDisabled"] == false and v["Name"] ~= nil) then
if (v["InDevelopment"] == false and v["IsDisabled"] == false and v["Name"] ~= nil and v["Name"] ~= 'Silver (Transformed)') then
iter = iter + 1
iter = iter + 1
end
end
elseif hero_type == 'HeroLabs' then
elseif hero_type == 'HeroLabs' then
if ((v["InDevelopment"] == true or v["InHeroLabs"] == true) and v["Name"] ~= nil) then
if (v["InHeroLabs"] == true and v["Name"] ~= nil) then
iter = iter + 1
iter = iter + 1
end
end
else
else
return "get_headcount()'s hero_type parameter must be either 'Released' or 'HeroLabs"
return "get_headcount()'s hero_type parameter must be either 'Released' or 'HeroLabs'"
end
end
end
end