Module:AbilityData/hero: Difference between revisions

Jump to navigation Jump to search
Sur (talk | contribs)
m ability names in h3 instead of h2
Sur (talk | contribs)
m removing old funcs
Line 4: Line 4:
local util_module = require("Module:Utilities")
local util_module = require("Module:Utilities")
local heroes_data = mw.loadJsonData("Data:HeroData.json")
local heroes_data = mw.loadJsonData("Data:HeroData.json")
local abilities_data = mw.loadJsonData("Data:AbilityData.json")


local p = {}
local p = {}
function p.get_hero_key(ability_key)
if type(ability_key) == 'table' and ability_key.args then
local frame = ability_key
ability_key = frame.args[1]
end
local ability_data = abilities_data[ability_key]
local hero_binds = ability_data["HeroBinds"]
if hero_binds == nil then return 'Ability ' .. ability_key .. ' is not bound by any heroes' end
for _, hero_bind_data in ipairs(hero_binds) do
return hero_bind_data["HeroKey"]
end
end
function p.get_ability_num(ability_key)
if type(ability_key) == 'table' and ability_key.args then
local frame = ability_key
ability_key = frame.args[1]
end
local ability_data = abilities_data[ability_key]
local hero_binds = ability_data["HeroBinds"]
if hero_binds == nil then return 'Ability ' .. ability_key .. ' is not bound by any heroes' end
for _, hero_bind_data in ipairs(hero_binds) do
return hero_bind_data["Slot"]
end
end


-- Write each of the hero's ability cards in a tab of a tabber
-- Write each of the hero's ability cards in a tab of a tabber