Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 56 additions & 14 deletions src/Classes/PassiveTreeView.lua
Original file line number Diff line number Diff line change
Expand Up @@ -625,9 +625,17 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)

-- Draw the connecting lines between nodes
SetDrawLayer(nil, 20)

for _, connector in pairs(tree.connectors) do
renderConnector(connector)
local node1 = spec.nodes[connector.nodeId1]
local node2 = spec.nodes[connector.nodeId2]
if not node1.unlockConstraint and not node2.unlockConstraint then
renderConnector(connector)
elseif checkUnlockConstraints(build, node1) and checkUnlockConstraints(build, node2) then
renderConnector(connector)
end
end

for _, subGraph in pairs(spec.subGraphs) do
for _, connector in pairs(subGraph.connectors) do
renderConnector(connector)
Expand Down Expand Up @@ -751,18 +759,30 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
end
elseif node.type == "OnlyImage" then
-- This is the icon that appears in the center of many groups
base = tree:GetAssetByName(node.activeEffectImage)

if not node.unlockConstraint then
base = tree:GetAssetByName(node.activeEffectImage)
elseif checkUnlockConstraints(build, node) then
base = tree:GetAssetByName(node.activeEffectImage)
end
SetDrawLayer(nil, 15)
else
-- Normal node (includes keystones and notables)
-- draws image below notables which light up when allocated
if node.activeEffectImage then
effect = tree:GetAssetByName(node.activeEffectImage)
if not node.unlockConstraint then
effect = tree:GetAssetByName(node.activeEffectImage)
elseif checkUnlockConstraints(build, node) then
effect = tree:GetAssetByName(node.activeEffectImage)
end
end
--draws node image and border
if not node.unlockConstraint then
base = tree:GetAssetByName(node.icon)
overlay = node.overlay[state]
elseif checkUnlockConstraints(build, node) then
base = tree:GetAssetByName(node.icon)
overlay = node.overlay[state]
end

base = tree:GetAssetByName(node.icon)

overlay = node.overlay[state]
end
end

Expand Down Expand Up @@ -970,13 +990,23 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
end
if node == hoverNode and (node.type ~= "Socket" or not IsKeyDown("SHIFT")) and not IsKeyDown("CTRL") and not main.popups[1] then
-- Draw tooltip
SetDrawLayer(nil, 100)
local size = m_floor(node.size * scale)
if self.tooltip:CheckForUpdate(node, self.showStatDifferences, self.tracePath, launch.devModeAlt, build.outputRevision, build.spec.allocMode) then
self:AddNodeTooltip(self.tooltip, node, build, incSmallPassiveSkillEffect)
if not node.unlockConstraint then
SetDrawLayer(nil, 100)
local size = m_floor(node.size * scale)
if self.tooltip:CheckForUpdate(node, self.showStatDifferences, self.tracePath, launch.devModeAlt, build.outputRevision, build.spec.allocMode) then
self:AddNodeTooltip(self.tooltip, node, build, incSmallPassiveSkillEffect)
end
self.tooltip.center = true
self.tooltip:Draw(m_floor(scrX - size), m_floor(scrY - size), size * 2, size * 2, viewPort)
elseif checkUnlockConstraints(build, node) then
SetDrawLayer(nil, 100)
local size = m_floor(node.size * scale)
if self.tooltip:CheckForUpdate(node, self.showStatDifferences, self.tracePath, launch.devModeAlt, build.outputRevision, build.spec.allocMode) then
self:AddNodeTooltip(self.tooltip, node, build, incSmallPassiveSkillEffect)
end
self.tooltip.center = true
self.tooltip:Draw(m_floor(scrX - size), m_floor(scrY - size), size * 2, size * 2, viewPort)
end
self.tooltip.center = true
self.tooltip:Draw(m_floor(scrX - size), m_floor(scrY - size), size * 2, size * 2, viewPort)
end
end

Expand Down Expand Up @@ -1785,4 +1815,16 @@ function PassiveTreeViewClass:LessLuminance()

local newA = a * alphaFactor;
SetDrawColor(newR, newG, newB, newA)
end

-- Checks if a node has unlockConstraint and if that node is allocated
function checkUnlockConstraints(build, node)
if node.unlockConstraint then
for _, nodeId in ipairs(node.unlockConstraint.nodes) do
if nodeId and not build.spec.nodes[nodeId].alloc then
return false
end
end
end
return true
end