Skip to content

Commit 7e83288

Browse files
MrHB212LocalIdentity
andauthored
Show "The Unseen Paths" nodes only when allocated (#1742)
* Update PassiveTreeView.lua * implemented new function * hiding images from tree * for connection now check both nodes there was at least one node connection that wasnt hidden properly. * comments * comment * display unseen path nodes in green when unallocated and hovered over * fix ascendancy connector coloring * Fix hovering over hidden nodes * Add missing centre bit --------- Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent 6694a55 commit 7e83288

1 file changed

Lines changed: 58 additions & 13 deletions

File tree

src/Classes/PassiveTreeView.lua

Lines changed: 58 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ local m_max = math.max
1313
local m_floor = math.floor
1414
local band = AND64 -- bit.band
1515
local b_rshift = bit.rshift
16+
--This variable is used to display the Unseen Path nodes in green when unallocated and hovered over
17+
--When true the checkUnlockConstraint function will return true for the check
18+
local unseenPathHover = false
1619

1720
local gemTooltip = LoadModule("Classes/GemTooltip")
1821
local JEWEL_RADIUS_TINT_NEUTRAL = { 1, 1, 1, 0.7 }
@@ -297,6 +300,7 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
297300
end
298301
end
299302

303+
unseenPathHover = hoverNode and hoverNode.id == 5571 and not hoverNode.alloc or false
300304
self.hoverNode = hoverNode
301305
-- If hovering over a node, find the path to it (if unallocated) or the list of dependent nodes (if allocated)
302306
local hoverPath, hoverDep
@@ -733,7 +737,13 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
733737
connector.c[5], connector.c[6] = treeToScreen(vert[5], vert[6])
734738
connector.c[7], connector.c[8] = treeToScreen(vert[7], vert[8])
735739

736-
if hoverDep and hoverDep[node1] and hoverDep[node2] then
740+
if hoverNode and hoverNode.id == 5571 and hoverDep and (hoverDep[node1] or hoverDep[node2]) and not hoverNode.alloc and not connector.ascendancyName then
741+
--Used to display Unseen Path nodes green when unallocated and hovered over
742+
setConnectorColor(0, 1, 0)
743+
elseif hoverDep and (hoverDep[node1] or hoverDep[node2]) and hoverNode.id == 5571 and not hoverNode.isAlloc and not connector.ascendancyName then
744+
--Used to display Unseen Path nodes red when allocated and hovered over node
745+
setConnectorColor(1, 0, 0)
746+
elseif hoverDep and hoverDep[node1] and hoverDep[node2] then
737747
-- Both nodes depend on the node currently being hovered over, so color the line red
738748
setConnectorColor(1, 0, 0)
739749
elseif connector.ascendancyName and connector.ascendancyName ~= spec.curAscendClassBaseName then
@@ -747,9 +757,17 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
747757

748758
-- Draw the connecting lines between nodes
749759
SetDrawLayer(nil, 20)
760+
750761
for _, connector in pairs(tree.connectors) do
751-
renderConnector(connector)
762+
local node1 = spec.nodes[connector.nodeId1]
763+
local node2 = spec.nodes[connector.nodeId2]
764+
if not node1.unlockConstraint and not node2.unlockConstraint then
765+
renderConnector(connector)
766+
elseif checkUnlockConstraints(build, node1) and checkUnlockConstraints(build, node2) then
767+
renderConnector(connector)
768+
end
752769
end
770+
753771
for _, subGraph in pairs(spec.subGraphs) do
754772
for _, connector in pairs(subGraph.connectors) do
755773
renderConnector(connector)
@@ -903,18 +921,30 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
903921
end
904922
elseif node.type == "OnlyImage" then
905923
-- This is the icon that appears in the center of many groups
906-
base = tree:GetAssetByName(node.activeEffectImage)
907-
924+
if not node.unlockConstraint then
925+
base = tree:GetAssetByName(node.activeEffectImage)
926+
elseif checkUnlockConstraints(build, node) then
927+
base = tree:GetAssetByName(node.activeEffectImage)
928+
end
908929
SetDrawLayer(nil, 15)
909930
else
910931
-- Normal node (includes keystones and notables)
932+
-- draws image below notables which light up when allocated
911933
if node.activeEffectImage then
912-
effect = tree:GetAssetByName(node.activeEffectImage)
934+
if not node.unlockConstraint then
935+
effect = tree:GetAssetByName(node.activeEffectImage)
936+
elseif checkUnlockConstraints(build, node) then
937+
effect = tree:GetAssetByName(node.activeEffectImage)
938+
end
939+
end
940+
--draws node image and border
941+
if not node.unlockConstraint then
942+
base = tree:GetAssetByName(node.icon)
943+
overlay = node.overlay[state]
944+
elseif checkUnlockConstraints(build, node) then
945+
base = tree:GetAssetByName(node.icon)
946+
overlay = node.overlay[state]
913947
end
914-
915-
base = tree:GetAssetByName(node.icon)
916-
917-
overlay = node.overlay[state]
918948
end
919949
end
920950

@@ -1046,7 +1076,9 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
10461076
if node.type ~= "ClassStart" and node.type ~= "AscendClassStart" then
10471077
if hoverNode and hoverNode ~= node then
10481078
-- Mouse is hovering over a different node
1049-
if hoverDep and hoverDep[node] then
1079+
if hoverDep and hoverDep[node] and hoverNode.id == 5571 and not hoverNode.alloc then
1080+
SetDrawColor(0, 1, 0)
1081+
elseif hoverDep and hoverDep[node] then
10501082
-- This node depends on the hover node, turn it red
10511083
SetDrawColor(1, 0, 0)
10521084
elseif hoverNode.type == "Socket" and hoverNode.nodesInRadius then
@@ -1125,7 +1157,7 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
11251157
end
11261158

11271159
end
1128-
if node == hoverNode and (node.type ~= "Socket" or not IsKeyDown("SHIFT")) and not IsKeyDown("CTRL") and not main.popups[1] then
1160+
if node == hoverNode and (not node.unlockConstraint or checkUnlockConstraints(build, node)) and (node.type ~= "Socket" or not IsKeyDown("SHIFT")) and not IsKeyDown("CTRL") and not main.popups[1] then
11291161
-- Draw tooltip
11301162
SetDrawLayer(nil, 100)
11311163
local size = m_floor(node.size * scale)
@@ -1185,8 +1217,6 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
11851217
self.skillTooltip:Draw(ttX + ttWidth + 5, ttY, nil, nil,
11861218
viewPort)
11871219
end
1188-
1189-
11901220
end
11911221
end
11921222

@@ -2046,4 +2076,19 @@ function PassiveTreeViewClass:LessLuminance()
20462076

20472077
local newA = a * alphaFactor;
20482078
SetDrawColor(newR, newG, newB, newA)
2079+
end
2080+
2081+
-- Checks if a node has unlockConstraint and if that node is allocated
2082+
function checkUnlockConstraints(build, node)
2083+
if unseenPathHover and node.unlockConstraint and node.unlockConstraint.nodes[1] == 5571 then
2084+
return true
2085+
end
2086+
if node.unlockConstraint then
2087+
for _, nodeId in ipairs(node.unlockConstraint.nodes) do
2088+
if nodeId and not build.spec.nodes[nodeId].alloc then
2089+
return false
2090+
end
2091+
end
2092+
end
2093+
return true
20492094
end

0 commit comments

Comments
 (0)