@@ -471,26 +471,35 @@ end
471
471
function PassiveSpecClass :BuildAllDependsAndPaths ()
472
472
-- This table will keep track of which nodes have been visited during each path-finding attempt
473
473
local visited = { }
474
-
474
+ local attributes = { " Dexterity " , " Intelligence " , " Strength " }
475
475
-- Check all nodes for other nodes which depend on them (i.e. are only connected to the tree through that node)
476
476
for id , node in pairs (self .nodes ) do
477
477
node .depends = wipeTable (node .depends )
478
478
node .dependsOnIntuitiveLeapLike = false
479
+ node .conqueredBy = nil
480
+
481
+ -- ignore cluster jewel nodes that don't have an id in the tree
482
+ if self .tree .nodes [id ] then
483
+ self :ReplaceNode (node ,self .tree .nodes [id ])
484
+ end
485
+
479
486
if node .type ~= " ClassStart" and node .type ~= " Socket" then
480
487
for nodeId , itemId in pairs (self .jewels ) do
481
488
if self .build .itemsTab .items [itemId ] and self .build .itemsTab .items [itemId ].jewelRadiusIndex then
482
489
local radiusIndex = self .build .itemsTab .items [itemId ].jewelRadiusIndex
483
490
if self .allocNodes [nodeId ] and self .nodes [nodeId ].nodesInRadius and self .nodes [nodeId ].nodesInRadius [radiusIndex ][node .id ] then
484
- if itemId ~= 0
485
- and self .build .itemsTab .items [itemId ].jewelData
486
- and self .build .itemsTab .items [itemId ].jewelData .intuitiveLeapLike then
487
- -- This node depends on Intuitive Leap-like behaviour
488
- -- This flag:
489
- -- 1. Prevents generation of paths from this node
490
- -- 2. Prevents this node from being deallocated via dependency
491
- -- 3. Prevents allocation of path nodes when this node is being allocated
492
- node .dependsOnIntuitiveLeapLike = true
493
- break
491
+ if itemId ~= 0 and self .build .itemsTab .items [itemId ].jewelData then
492
+ if self .build .itemsTab .items [itemId ].jewelData .intuitiveLeapLike then
493
+ -- This node depends on Intuitive Leap-like behaviour
494
+ -- This flag:
495
+ -- 1. Prevents generation of paths from this node
496
+ -- 2. Prevents this node from being deallocted via dependancy
497
+ -- 3. Prevents allocation of path nodes when this node is being allocated
498
+ node .dependsOnIntuitiveLeapLike = true
499
+ end
500
+ if self .build .itemsTab .items [itemId ].jewelData .conqueredBy then
501
+ node .conqueredBy = self .build .itemsTab .items [itemId ].jewelData .conqueredBy
502
+ end
494
503
end
495
504
end
496
505
end
@@ -500,6 +509,64 @@ function PassiveSpecClass:BuildAllDependsAndPaths()
500
509
node .depends [1 ] = node -- All nodes depend on themselves
501
510
end
502
511
end
512
+
513
+ for id , node in pairs (self .nodes ) do
514
+ -- If node is conquered, replace it or add mods
515
+ if node .conqueredBy and node .type ~= " Socket" then
516
+ local conqueredBy = node .conqueredBy
517
+ local legionNodes = self .tree .legion .nodes
518
+
519
+ -- Replace with edited node if applicable
520
+ if self .tree .legion .editedNodes and self .tree .legion .editedNodes [conqueredBy .id ] and self .tree .legion .editedNodes [conqueredBy .id ][node .id ] then
521
+ local editedNode = self .tree .legion .editedNodes [conqueredBy .id ][node .id ]
522
+ node .dn = editedNode .dn
523
+ node .sd = editedNode .sd
524
+ node .sprites = editedNode .sprites
525
+ node .mods = editedNode .mods
526
+ node .modList = editedNode .modList
527
+ node .modKey = editedNode .modKey
528
+ else
529
+ if node .type == " Keystone" then
530
+ local legionNode = legionNodes [conqueredBy .conqueror .type .. " _keystone_" .. conqueredBy .conqueror .id ]
531
+ self :ReplaceNode (node , legionNode )
532
+ elseif conqueredBy .conqueror .type == " eternal" and node .type == " Normal" then
533
+ local legionNode = legionNodes [" eternal_small_blank" ]
534
+ self :ReplaceNode (node ,legionNode )
535
+ elseif conqueredBy .conqueror .type == " templar" then
536
+ if isValueInArray (attributes , node .dn ) then
537
+ local legionNode = legionNodes [" templar_devotion_node" ]
538
+ self :ReplaceNode (node ,legionNode )
539
+ else
540
+ self :NodeAdditionOrReplacementFromString (node ," +5 to Devotion" )
541
+ end
542
+ elseif conqueredBy .conqueror .type == " maraketh" and node .type == " Normal" then
543
+ local dex = isValueInArray (attributes , node .dn ) and " 2" or " 4"
544
+ self :NodeAdditionOrReplacementFromString (node ," +" .. dex .. " to Dexterity" )
545
+ elseif conqueredBy .conqueror .type == " karui" and node .type == " Normal" then
546
+ local str = isValueInArray (attributes , node .dn ) and " 2" or " 4"
547
+ self :NodeAdditionOrReplacementFromString (node ," +" .. str .. " to Strength" )
548
+ elseif conqueredBy .conqueror .type == " vaal" and node .type == " Normal" then
549
+ local legionNode = legionNodes [" vaal_small_fire_resistance" ]
550
+ node .dn = " Vaal small node"
551
+ node .sd = {" Right click to set mod" }
552
+ node .sprites = legionNode .sprites
553
+ node .mods = {" " }
554
+ node .modList = new (" ModList" )
555
+ node .modKey = " "
556
+ elseif conqueredBy .conqueror .type == " vaal" and node .type == " Notable" then
557
+ local legionNode = legionNodes [" vaal_notable_curse_1" ]
558
+ node .dn = " Vaal notable node"
559
+ node .sd = {" Right click to set mod" }
560
+ node .sprites = legionNode .sprites
561
+ node .mods = {" " }
562
+ node .modList = new (" ModList" )
563
+ node .modKey = " "
564
+ end
565
+ end
566
+ end
567
+ end
568
+
569
+
503
570
for id , node in pairs (self .allocNodes ) do
504
571
node .visited = true
505
572
@@ -580,6 +647,18 @@ function PassiveSpecClass:BuildAllDependsAndPaths()
580
647
end
581
648
end
582
649
650
+ function PassiveSpecClass :ReplaceNode (old , new )
651
+ -- Edited nodes can share a name
652
+ if old .sd == new .sd then return 1 end
653
+ old .dn = new .dn
654
+ old .sd = new .sd
655
+ old .mods = new .mods
656
+ old .modKey = new .modKey
657
+ old .modList = new .modList
658
+ old .sprites = new .sprites
659
+ old .keystoneMod = new .keystoneMod
660
+ end
661
+
583
662
function PassiveSpecClass :BuildClusterJewelGraphs ()
584
663
-- Remove old subgraphs
585
664
for id , subGraph in pairs (self .subGraphs ) do
@@ -845,7 +924,7 @@ function PassiveSpecClass:BuildSubgraph(jewel, parentSocket, id, upSize)
845
924
-- Silently fail to handle cases of jewels with more notables than should be allowed
846
925
break
847
926
end
848
-
927
+
849
928
-- Construct the new node
850
929
local node = {
851
930
type = " Notable" ,
@@ -916,7 +995,7 @@ function PassiveSpecClass:BuildSubgraph(jewel, parentSocket, id, upSize)
916
995
917
996
assert (indicies [0 ], " No entrance to subgraph" )
918
997
subGraph .entranceNode = indicies [0 ]
919
-
998
+
920
999
-- Correct position to account for index of proxy node
921
1000
for _ , node in pairs (indicies ) do
922
1001
node .oidx = (node .oidx + proxyNode .oidx ) % clusterJewel .totalIndicies
@@ -987,3 +1066,93 @@ end
987
1066
function PassiveSpecClass :SetWindowTitleWithBuildClass ()
988
1067
main :SetWindowTitleSubtext (string.format (" %s (%s)" , self .build .buildName , self .curAscendClassId == 0 and self .curClassName or self .curAscendClassName ))
989
1068
end
1069
+
1070
+ --- Adds a line to or replaces a node given a line to add/replace with
1071
+ --- @param node table The node to replace /add to
1072
+ --- @param sd string The line being parsed and added
1073
+ --- @param replacement boolean true to replace the node with the new mod , false to simply add it
1074
+ function PassiveSpecClass :NodeAdditionOrReplacementFromString (node ,sd ,replacement )
1075
+ local addition = {}
1076
+ addition .sd = {sd }
1077
+ addition .mods = { }
1078
+ addition .modList = new (" ModList" )
1079
+ addition .modKey = " "
1080
+ local i = 1
1081
+ while addition .sd [i ] do
1082
+ if addition .sd [i ]:match (" \n " ) then
1083
+ local line = addition .sd [i ]
1084
+ local lineIdx = i
1085
+ t_remove (addition .sd , i )
1086
+ for line in line :gmatch (" [^\n ]+" ) do
1087
+ t_insert (addition .sd , lineIdx , line )
1088
+ lineIdx = lineIdx + 1
1089
+ end
1090
+ end
1091
+ local line = addition .sd [i ]
1092
+ local parsedMod , unrecognizedMod = modLib .parseMod [self .build .targetVersion ](line )
1093
+ if not parsedMod or unrecognizedMod then
1094
+ -- Try to combine it with one or more of the lines that follow this one
1095
+ local endI = i + 1
1096
+ while addition .sd [endI ] do
1097
+ local comb = line
1098
+ for ci = i + 1 , endI do
1099
+ comb = comb .. " " .. addition .sd [ci ]
1100
+ end
1101
+ parsedMod , unrecognizedMod = modLib .parseMod [self .build .targetVersion ](comb , true )
1102
+ if parsedMod and not unrecognizedMod then
1103
+ -- Success, add dummy mod lists to the other lines that were combined with this one
1104
+ for ci = i + 1 , endI do
1105
+ addition .mods [ci ] = { list = { } }
1106
+ end
1107
+ break
1108
+ end
1109
+ endI = endI + 1
1110
+ end
1111
+ end
1112
+ if not parsedMod then
1113
+ -- Parser had no idea how to read this modifier
1114
+ addition .unknown = true
1115
+ elseif unrecognizedMod then
1116
+ -- Parser recognised this as a modifier but couldn't understand all of it
1117
+ addition .extra = true
1118
+ else
1119
+ for _ , mod in ipairs (parsedMod ) do
1120
+ addition .modKey = addition .modKey .. " [" .. modLib .formatMod (mod ).. " ]"
1121
+ end
1122
+ end
1123
+ addition .mods [i ] = { list = parsedMod , extra = unrecognizedMod }
1124
+ i = i + 1
1125
+ while addition .mods [i ] do
1126
+ -- Skip any lines with dummy lists added by the line combining code
1127
+ i = i + 1
1128
+ end
1129
+ end
1130
+
1131
+ -- Build unified list of modifiers from all recognised modifier lines
1132
+ for _ , mod in pairs (addition .mods ) do
1133
+ if mod .list and not mod .extra then
1134
+ for i , mod in ipairs (mod .list ) do
1135
+ mod .source = " Tree:" .. node .id
1136
+ if type (mod .value ) == " table" and mod .value .mod then
1137
+ mod .value .mod .source = mod .source
1138
+ end
1139
+ addition .modList :AddMod (mod )
1140
+ end
1141
+ end
1142
+ end
1143
+ if replacement then
1144
+ node .sd = addition .sd
1145
+ node .mods = addition .mods
1146
+ node .modKey = addition .modKey
1147
+ else
1148
+ node .sd = tableConcat (node .sd , addition .sd )
1149
+ node .mods = tableConcat (node .mods , addition .mods )
1150
+ node .modKey = node .modKey .. addition .modKey
1151
+ end
1152
+ local modList = new (" ModList" )
1153
+ modList :AddList (addition .modList )
1154
+ if not replacement then
1155
+ modList :AddList (node .modList )
1156
+ end
1157
+ node .modList = modList
1158
+ end
0 commit comments