Toggle menu
505
2.3K
828
21.8K
Deadlock Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:AttributeData: Difference between revisions

From Deadlock Wiki
Sur (talk | contribs)
m cell_values arg added
Sur (talk | contribs)
mNo edit summary
Line 17: Line 17:
local template_args = {}
local template_args = {}
local template_call
local template_call
 
template_args["key"] = unlocalized
template_args["key"] = unlocalized
Line 27: Line 27:
p.create_stat_boxes = function(frame)
p.create_stat_boxes = function(frame)
local hero_name = frame.args[1]
local hero_name = frame.args[1]
if(hero_name == nil) then return "Hero Not Found" end
if(hero_name == nil) then return "Hero parameter missing" end
-- Use expandTemplate to evaluate the Infobox_hero template
-- Use expandTemplate to evaluate the Infobox_hero template
Line 36: Line 36:
local cell_values --current cell values
local cell_values --current cell values
local cell_value --current cell value
local cell_value --current cell value
local num --current stat's numerical value
local label --current stat's label
local postfix --current stat's postfix
local postfix --current stat's postfix
local alternate_name --current stat's alternate name, used to locate the stat in hero data
local num --current stat's numerical value in the hero data
local hero_datas = mw.loadJsonData("Data:HeroData.json")
local hero_data = hero_datas[hero_name]
if (hero_data == nil) then return "Hero Not Found" end
for category, stats in pairs(data) do
for category, stats in pairs(data) do
Line 48: Line 53:
for stat_name, stat_data in pairs(stats) do
for stat_name, stat_data in pairs(stats) do
-- get label and postfix
-- get label and postfix
label = stat_data["label"]
label = call_lang(stat_data["label"])
postfix = stat_data["postfix"]
postfix = stat_data["postfix"]
if (postfix == nil) then
postfix = ""
else
postfix = call_lang(postfix)
end
num = "5"
num = "5"
if (postfix == nil) then postfix = "" end
-- Set cell value as "Icon NumberPostfix localize(Statname),"
-- Set cell value as "Icon NumberPostfix localize(Statname),"
cell_value = "[[File:Bullet damage.png|15px]]]]" .. " " .. num  .. postfix .. " " .. call_lang(unlocalized) .. ","
cell_value = "[[File:Bullet damage.png|15px]]" .. " " .. num  .. postfix .. " " .. label .. ","
cell_values = cell_values .. cell_value --add value to values list
cell_values = cell_values .. cell_value --add value to values list