393
edits
No edit summary |
No edit summary |
||
Line 26: | Line 26: | ||
end | end | ||
function p. | function p.getSkillTreeNodes(skillName) | ||
mw.log(GameData.skillData) | mw.log(GameData.skillData) | ||
Line 37: | Line 37: | ||
end | end | ||
return nodes | return nodes | ||
end | |||
function p.generateSkillTree(frame) | |||
local skillName = frame.args.skillName | |||
local skillNodes = p.getSkillTreeNodes(skillName) | |||
if not skillNodes then | |||
return "No skill tree found for: " .. skillName | |||
end | |||
local html = mw.html.create('div'):addClass('skill-tree') | |||
for _, node in ipairs(skillNodes) do | |||
local nodeDiv = html:tag('div') | |||
:addClass('skill-tree-node') | |||
:tag('h4'):wikitext(node.name):done() | |||
:tag('p'):wikitext('Points: ' .. node.costs.points):done() | |||
if node.modifiers then | |||
local modifierList = nodeDiv:tag('ul') | |||
for modifier, data in pairs(node.modifiers) do | |||
modifierList:tag('li') | |||
:wikitext(modifier .. ': Skill: ' .. data.skillID .. ', Value: ' .. data.value) | |||
:done() | |||
end | |||
modifierList:done() | |||
end | |||
html:done() | |||
end | |||
return tostring(html) | |||
end | end | ||
return p | return p |
edits