@@ -267,7 +267,13 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
267267 if treeClick == " LEFT" then
268268 if hoverNode then
269269 -- User left-clicked on a node
270+ local isGlobalNode = hoverNode .type == " Keystone" or hoverNode .type == " Socket" or hoverNode .containJewelSocket
270271 if hoverNode .alloc then
272+ if isGlobalNode and hoverNode .allocMode == 0 and spec .allocMode > 0 then
273+ -- Block main-tree global node deallocation when weapon set is selected
274+ -- Note: if the global node was allocated on a weapon set (which is incorrect but can happen due to legacy/corrupted builds), we do allow deallocation.
275+ -- (As the calculation will correctly account for the weapon set allocation, so no point of blocking it)
276+ end
271277 if hoverNode .isAttribute then
272278 -- change to other attribute without needing to deallocate
273279 if hotkeyPressed then
@@ -284,10 +290,9 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
284290 spec :AddUndoState ()
285291 build .buildFlag = true
286292 elseif hoverNode .path then
287- -- Node is unallocated and can be allocated, so allocate it
288- -- Check if trying to allocate a keystone while a weapon set is selected (which is not allowed)
289- if hoverNode .type == " Keystone" and spec .allocMode > 0 then
290- -- Block keystone allocation when weapon set is selected
293+ -- Node is unallocated and can be *potentially* allocated
294+ if isGlobalNode and spec .allocMode > 0 then
295+ -- Block global node allocation when weapon set is selected
291296 return
292297 end
293298 -- attribute switching, unallocated to allocated
@@ -1143,6 +1148,9 @@ function PassiveTreeViewClass:AddNodeTooltip(tooltip, node, build, incSmallPassi
11431148 if socket ~= nil and socket :IsEnabled () then
11441149 tooltip :AddLine (14 , colorCodes .TIP .. " Tip: Right click this socket to go to the items page and choose the jewel for this socket." )
11451150 end
1151+
1152+ self :AddGlobalNodeWarningsToTooltip (tooltip , node , build )
1153+
11461154 tooltip :AddLine (14 , colorCodes .TIP .. " Tip: Hold Shift or Ctrl to hide this tooltip." )
11471155 return
11481156 end
@@ -1403,12 +1411,7 @@ function PassiveTreeViewClass:AddNodeTooltip(tooltip, node, build, incSmallPassi
14031411 tooltip :AddLine (14 , colorCodes .TIP )
14041412 end
14051413
1406- -- Warning for keystones when weapon set is selected
1407- if node .type == " Keystone" and not node .alloc and node .path and build .spec .allocMode > 0 then
1408- tooltip :AddSeparator (14 )
1409- tooltip :AddLine (14 , colorCodes .WARNING .. " Cannot allocate keystones while weapon set " .. build .spec .allocMode .. " is selected" )
1410- tooltip :AddLine (14 , colorCodes .TIP .. " Tip: Switch to main tree (Alt+scroll) to allocate keystones" )
1411- end
1414+ self :AddGlobalNodeWarningsToTooltip (tooltip , node , build )
14121415
14131416 if node .type == " Socket" then
14141417 tooltip :AddLine (14 , colorCodes .TIP .. " Tip: Hold Shift or Ctrl to hide this tooltip." )
@@ -1417,6 +1420,42 @@ function PassiveTreeViewClass:AddNodeTooltip(tooltip, node, build, incSmallPassi
14171420 end
14181421end
14191422
1423+ -- Helper function to add warnings in the tooltip for global nodes (keystones/jewel sockets)
1424+ function PassiveTreeViewClass :AddGlobalNodeWarningsToTooltip (tooltip , node , build )
1425+ local isGlobalNode = node .type == " Keystone" or node .type == " Socket" or node .containJewelSocket
1426+
1427+ if not isGlobalNode or build .spec .allocMode == 0 then
1428+ return -- No warning needed
1429+ end
1430+
1431+ local nodeTypeText = node .type == " Keystone" and " keystones" or " jewel sockets"
1432+ local singleNodeText = node .type == " Keystone" and " keystone" or " jewel socket"
1433+ local warningText = " "
1434+ local tipText = " "
1435+
1436+ if not node .alloc and node .path then
1437+ -- Warning for allocation of global nodes on wrong weapon set
1438+ warningText = " Cannot allocate " .. nodeTypeText .. " while weapon set " .. build .spec .allocMode .. " is selected"
1439+ tipText = " Tip: Switch to main tree (Alt+scroll) to allocate " .. nodeTypeText
1440+ elseif node .alloc and node .allocMode ~= build .spec .allocMode then
1441+ -- Warning for deallocation of global nodes on wrong weapon set
1442+ if node .allocMode == 0 then
1443+ -- Main-tree global nodes cannot be deallocated from weapon sets
1444+ warningText = " Cannot deallocate global " .. nodeTypeText .. " from weapon set " .. build .spec .allocMode
1445+ tipText = " Tip: Switch to main tree (Alt+scroll) to deallocate " .. nodeTypeText
1446+ else
1447+ -- Legacy global nodes can be deallocated from anywhere - no warning needed
1448+ return
1449+ end
1450+ end
1451+
1452+ if warningText ~= " " then
1453+ tooltip :AddSeparator (14 )
1454+ tooltip :AddLine (14 , colorCodes .WARNING .. warningText )
1455+ tooltip :AddLine (14 , colorCodes .TIP .. tipText )
1456+ end
1457+ end
1458+
14201459function PassiveTreeViewClass :DrawAllocMode (allocMode , viewPort )
14211460 local rgbColor
14221461 if allocMode == 0 then
0 commit comments