Module:HeroData: Difference between revisions

Jump to navigation Jump to search
Sur (talk | contribs)
initial test
 
Sur (talk | contribs)
m testing
Line 12: Line 12:
end
end


--{{#invoke:ItemData|get_cost|ITEM_NAME}}--
--{{#invoke:HeroData|get_hero_var|HERO_NAME}}--
p.get_cost = function(frame)
p.get_hero_var = function(frame)
local item_name = frame.args[1]
local hero_name = frame.args[1]
local item = get_json_item(item_name)
local hero = get_json_item(hero_name)
if(item == nil) then return "Item Not Found" end
if(hero == nil) then return "Hero Not Found" end
local cost = 0
local var_value = hero["BulletDamage"]
local cur_item = item
repeat
cost = cost + cur_item["Cost"]
if(cur_item["Components"] == nil) then
break
end
cur_item = data[cur_item["Components"][1]]
until cur_item == nil


return cost
return var_value
end
end