Module:HeroData/nav: Difference between revisionsGive feedback
m parameterize text size and card size |
m functions merged |
||
| Line 3: | Line 3: | ||
local lang_module = require('Module:Lang') | local lang_module = require('Module:Lang') | ||
-- for [[Template: | -- for [[Template:Deadlock_Wiki/Heroes]] on home page, i.e. [[Template:Hero card2]] | ||
function p.get_hero_nav_cards(frame) | function p.get_hero_nav_cards(frame) | ||
local | local in_herolabs = frame.args['in_herolabs'] --true or false | ||
local text_size = frame.args['text_size'] | |||
local card_size = frame.args['card_size'] | |||
local sticker_size = frame.args['sticker_size'] | |||
local | |||
local | |||
local | |||
if in_herolabs ~= 'true' and in_herolabs ~= 'false' then | if in_herolabs ~= 'true' and in_herolabs ~= 'false' then | ||
return 'in_herolabs must be either true or false as the first unnamed parameter' | return 'in_herolabs must be either true or false as the first unnamed parameter' | ||
end | end | ||
--Iterate heroes | --Iterate heroes | ||
| Line 53: | Line 20: | ||
-- if herolabs is requested, only needs to have herolabs=true | -- if herolabs is requested, only needs to have herolabs=true | ||
-- otherwise, needs to be not disabled, in development, nd herolabs is nil or false | -- otherwise, needs to be not disabled, in development, nd herolabs is nil or false | ||
if ((in_herolabs == 'true' and | this_in_herolabs = hero_data['InHeroLabs'] | ||
(in_herolabs == 'false' and not hero_data['IsDisabled'] and not hero_data['InDevelopment'] and | if this_in_herolabs == nil then this_in_herolabs = false end | ||
if ((in_herolabs == 'true' and this_in_herolabs) or | |||
(in_herolabs == 'false' and not hero_data['IsDisabled'] and not hero_data['InDevelopment'] and not this_in_herolabs)) then | |||
local is_recommended = hero_data[' | local is_recommended = hero_data['IsRecommended'] | ||
if is_recommended == nil then | if is_recommended == nil then | ||
is_recommended = false | is_recommended = false | ||
| Line 74: | Line 44: | ||
local ret = '' | local ret = '' | ||
for index, hero_name in ipairs(heroes) do | for index, hero_name in ipairs(heroes) do | ||
ret = ret .. '{{ | ret = ret .. '{{Hero card2|name=' .. hero_name | ||
ret = ret .. '|text_size=' .. text_size | ret = ret .. '|text_size=' .. text_size | ||
ret = ret .. '|herolabs=' .. in_herolabs | ret = ret .. '|herolabs=' .. in_herolabs | ||
ret = ret .. '|card_size=' .. card_size | ret = ret .. '|card_size=' .. card_size | ||
ret = ret .. '|sticker_size=' .. sticker_size | |||
ret = ret .. '}} ' | ret = ret .. '}} ' | ||
end | end | ||