Module:Abilities-test/card: Difference between revisions

m Merge with new ability card changes
mNo edit summary
 
(3 intermediate revisions by the same user not shown)
Line 4: Line 4:


local p = {}
local p = {}
local data = mw.loadJsonData("User:Saag/AbilityCards.json")
local data = mw.loadJsonData("Data:AbilityCards.json")


-- Maps attr type to an appropriate image and page link
-- Maps attr type to an appropriate image and page link
Line 73: Line 73:
-- Pulls data from Data:AbilityCards.json to populate Template:Ability card v2
-- Pulls data from Data:AbilityCards.json to populate Template:Ability card v2
function build_ability_card(hero_key, ability_num, add_link, notes, notes_source_page)
function build_ability_card(hero_key, ability_num, add_link, notes, notes_source_page)
local ability = utils.utils.get_ability_card_data(hero_key, ability_num)
local ability = utils.get_ability_card_data(hero_key, ability_num)
if(ability == nil) then  
if(ability == nil) then  
return 'Ability data not found for hero ' ..hero_key.. ' and num ' .. ability_num
return 'Ability data not found for hero ' ..hero_key.. ' and num ' .. ability_num
Line 429: Line 429:
local frame = mw.getCurrentFrame()
local frame = mw.getCurrentFrame()


local props = ability.Upgrades
local upgrades = ability.Upgrades
local upgrade_boxes = {}
local upgrade_boxes = {}
Line 466: Line 466:
title = "User:Saag/Sandbox/Ability_card_v2/Card/UpgradeBox",
title = "User:Saag/Sandbox/Ability_card_v2/Card/UpgradeBox",
args = {
args = {
  cost = UPGRADE_COST_MAP[k],
index = k,
  description = frame:preprocess(description),
cost = UPGRADE_COST_MAP[k],
  scale_value = upgrade.Scale and commonutils.round_to_sig_fig(upgrade.Scale.Value, 3),
description = frame:preprocess(description),
  scale_type =  upgrade.Scale and upgrade.Scale.Type,
scale_value = upgrade.Scale and commonutils.round_to_sig_fig(upgrade.Scale.Value, 3),
  fontsize = fontsize
scale_type =  upgrade.Scale and upgrade.Scale.Type,
fontsize = fontsize
}
}
}
}