Module:Sandbox/SkillTree: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 29: Line 29:
mw.log(GameData.skillData)
mw.log(GameData.skillData)
    local skillData = GameData.skillData[skillName]
    if not skillData then return nil end
    local nodes = {}
    for _, node in ipairs(skillData.skillTrees[1].nodes) do
        table.insert(nodes, node)
    end
    return nodes
end
local p = {}
local GameData = require('Module:GameData')
function p.getSkillTreeNodesFromSkillName(skillName)
     local skillData = GameData.skillData[skillName]
     local skillData = GameData.skillData[skillName]
     if not skillData then return nil end
     if not skillData then return nil end
Line 96: Line 111:
     local baseY = 50  -- Start Y position (top of the screen)
     local baseY = 50  -- Start Y position (top of the screen)
     local verticalSpacing = 200  -- Distance between levels (Y-axis)
     local verticalSpacing = 200  -- Distance between levels (Y-axis)
     local horizontalSpacing = 200 -- Distance between nodes at the same level (X-axis)
     local horizontalSpacing = 300 -- Distance between nodes at the same level (X-axis)


     -- Count nodes per level for horizontal positioning
     -- Count nodes per level for horizontal positioning
Line 138: Line 153:
         local yPos = baseY + level * verticalSpacing
         local yPos = baseY + level * verticalSpacing


         -- Store node position for connections
         -- Debugging output to track node positions
         nodePositions[node.name] = { x = xPos, y = yPos }
         nodePositions[node.name] = { x = xPos, y = yPos }


Line 189: Line 204:
     return tostring(html)
     return tostring(html)
end
end


return p
return p
393

edits