@@ -469,7 +469,11 @@ Highest Weight - Displays the order retrieved from trade]]
469469 end
470470 end
471471 table.sort (activeSocketList )
472+ local activeUniqueJewelSocket
472473 for _ , nodeId in ipairs (activeSocketList ) do
474+ if not activeUniqueJewelSocket and not self .itemsTab .build .spec .nodes [nodeId ].containJewelSocket then
475+ activeUniqueJewelSocket = nodeId
476+ end
473477 t_insert (slotTables , { slotName = self .itemsTab .sockets [nodeId ].label , nodeId = nodeId })
474478 end
475479
@@ -525,23 +529,23 @@ Highest Weight - Displays the order retrieved from trade]]
525529 return hideRowFunc (self , # slotTables + 1 )
526530 end
527531 local row_count = # slotTables + 1
528- self .slotTables [row_count ] = { slotName = " Megalomaniac" , unique = true , alreadyCorrupted = true }
532+ self .slotTables [row_count ] = { slotName = " Megalomaniac" , unique = true , alreadyCorrupted = true , selectedJewelNodeId = activeUniqueJewelSocket }
529533 self :PriceItemRowDisplay (row_count , top_pane_alignment_ref , row_vertical_padding , row_height )
530534 self .controls [" name" .. row_count ].y = self .controls [" name" .. row_count ].y + (row_height + row_vertical_padding ) -- Megalomaniac needs to drop an extra row for "Other Trades"
531535 self .controls [" name" .. row_count ].shown = function ()
532536 return hideRowFunc (self , row_count )
533537 end
534538
535539 row_count = row_count + 1
536- self .slotTables [row_count ] = { slotName = " Heart of the Well" , unique = true , selectedJewelNodeId = activeSocketList [ 1 ] }
540+ self .slotTables [row_count ] = { slotName = " Heart of the Well" , unique = true , selectedJewelNodeId = activeUniqueJewelSocket }
537541 self :PriceItemRowDisplay (row_count , top_pane_alignment_ref , row_vertical_padding , row_height )
538542 self .controls [" name" .. row_count ].y = self .controls [" name" .. row_count ].y + (row_height + row_vertical_padding )
539543 self .controls [" name" .. row_count ].shown = function ()
540544 return hideRowFunc (self , row_count )
541545 end
542546
543547 row_count = row_count + 1
544- self .slotTables [row_count ] = { slotName = " Against the Darkness" , unique = true , selectedJewelNodeId = activeSocketList [ 1 ] }
548+ self .slotTables [row_count ] = { slotName = " Against the Darkness" , unique = true , selectedJewelNodeId = activeUniqueJewelSocket }
545549 self :PriceItemRowDisplay (row_count , top_pane_alignment_ref , row_vertical_padding , row_height )
546550 self .controls [" name" .. row_count ].y = self .controls [" name" .. row_count ].y + (row_height + row_vertical_padding )
547551 self .controls [" name" .. row_count ].shown = function ()
@@ -798,7 +802,7 @@ function TradeQueryClass:GetResultEvaluation(row_idx, result_index, calcFunc, ba
798802 local slotTbl = self .slotTables [row_idx ]
799803 local jewelNodeId = slotTbl .nodeId or slotTbl .selectedJewelNodeId
800804 local slotName = jewelNodeId and " Jewel " .. tostring (jewelNodeId ) or slotTbl .slotName
801- if slotName == " Megalomaniac" then
805+ if slotTbl . slotName == " Megalomaniac" then
802806 local addedNodes = {}
803807 for nodeName in (result .item_string .. " \r\n " ):gmatch (" Allocates (.-)\r ?\n " ) do
804808 local node = self .itemsTab .build .spec .tree .notableMap [nodeName :lower ()]
@@ -852,7 +856,15 @@ function TradeQueryClass:UpdateControlsWithItems(row_idx)
852856 end
853857
854858 self .sortedResultTbl [row_idx ] = sortedItems
855- local pb_index = self .sortedResultTbl [row_idx ][1 ].index
859+ if not sortedItems [1 ] then
860+ self .itemIndexTbl [row_idx ] = nil
861+ self .totalPrice [row_idx ] = nil
862+ self .controls .fullPrice .label = " Total Price: " .. self :GetTotalPriceString ()
863+ self :UpdateDropdownList (row_idx )
864+ self :SetNotice (self .controls .pbNotice , " ^4No compatible items found for this slot." )
865+ return
866+ end
867+ local pb_index = sortedItems [1 ].index
856868 self .itemIndexTbl [row_idx ] = pb_index
857869 self .controls [" priceButton" .. row_idx ].tooltipText = " Sorted by " .. self .itemSortSelectionList [self .pbItemSortSelectionIndex ]
858870 self .totalPrice [row_idx ] = {
@@ -974,6 +986,10 @@ function TradeQueryClass:PriceItemRowDisplay(row_idx, top_pane_alignment_ref, ro
974986 slotTbl .slotName and (self .itemsTab .slots [slotTbl .slotName ] or
975987 slotTbl .slotName == " Watcher's Eye" and self :findValidSlotForWatchersEye () or
976988 slotTbl .fullName and self .itemsTab .slots [slotTbl .fullName ]) -- fullName for Abyssal Sockets
989+ local function getSelectedSlot ()
990+ local selectedNodeId = slotTbl .nodeId or slotTbl .selectedJewelNodeId
991+ return selectedNodeId and self .itemsTab .sockets [selectedNodeId ] or activeSlot
992+ end
977993 local nameColor = slotTbl .unique and colorCodes .UNIQUE or " ^7"
978994 controls [" name" .. row_idx ] = new (" LabelControl" , top_pane_alignment_ref , {0 , row_idx * (row_height + row_vertical_padding ), 135 , row_height - 4 }, nameColor .. slotTbl .slotName )
979995 controls [" bestButton" .. row_idx ] = new (" ButtonControl" , { " LEFT" , controls [" name" .. row_idx ], " LEFT" }, {135 + 8 , 0 , 80 , row_height }, " Find best" , function ()
@@ -1002,7 +1018,8 @@ function TradeQueryClass:PriceItemRowDisplay(row_idx, top_pane_alignment_ref, ro
10021018 self :SetNotice (context .controls .pbNotice , " " )
10031019 end
10041020
1005- local itemsSafe = self :FilterToSafeItems (items , activeSlot and activeSlot .slotName )
1021+ local selectedSlot = getSelectedSlot ()
1022+ local itemsSafe = self :FilterToSafeItems (items , selectedSlot and selectedSlot .slotName )
10061023
10071024 if self .tradeQueryGenerator .lastAugmentBehaviour == " Copy Current" or self .tradeQueryGenerator .lastAnointBehaviour == " Copy Current" then
10081025 for i , _ in ipairs (itemsSafe ) do
@@ -1087,7 +1104,8 @@ you can add them, copy the link here, and press "Price Item" to evaluate the ite
10871104 else
10881105 self :SetNotice (controls .pbNotice , " " )
10891106 self .lastQueries [row_idx ] = query
1090- local itemsSafe = self :FilterToSafeItems (items , activeSlot and activeSlot .slotName )
1107+ local selectedSlot = getSelectedSlot ()
1108+ local itemsSafe = self :FilterToSafeItems (items , selectedSlot and selectedSlot .slotName )
10911109 self .resultTbl [row_idx ] = itemsSafe
10921110 self :UpdateControlsWithItems (row_idx )
10931111 end
@@ -1099,7 +1117,7 @@ you can add them, copy the link here, and press "Price Item" to evaluate the ite
10991117 local validURL = controls [" uri" .. row_idx ].validURL
11001118 local isSearching = controls [" priceButton" .. row_idx ].label == " Searching..."
11011119 local selectedJewelSlot = slotTbl .selectedJewelNodeId and self .itemsTab .sockets [slotTbl .selectedJewelNodeId ]
1102- local hasRequiredJewelSlot = not slotTbl .unique or slotTbl . slotName == " Megalomaniac " or selectedJewelSlot and not selectedJewelSlot .inactive
1120+ local hasRequiredJewelSlot = not slotTbl .unique or selectedJewelSlot and not selectedJewelSlot .inactive
11031121 return isAuthorized and validURL and not isSearching and hasRequiredJewelSlot
11041122 end
11051123 controls [" priceButton" .. row_idx ].tooltipFunc = function (tooltip )
@@ -1108,8 +1126,7 @@ you can add them, copy the link here, and press "Price Item" to evaluate the ite
11081126 tooltip :AddLine (16 , " You must log in to use the search feature" )
11091127 elseif not controls [" uri" .. row_idx ].validURL then
11101128 tooltip :AddLine (16 , " Enter a valid trade URL" )
1111- elseif slotTbl .unique and slotTbl .slotName ~= " Megalomaniac"
1112- and (not slotTbl .selectedJewelNodeId or not self .itemsTab .sockets [slotTbl .selectedJewelNodeId ] or self .itemsTab .sockets [slotTbl .selectedJewelNodeId ].inactive ) then
1129+ elseif slotTbl .unique and (not slotTbl .selectedJewelNodeId or not self .itemsTab .sockets [slotTbl .selectedJewelNodeId ] or self .itemsTab .sockets [slotTbl .selectedJewelNodeId ].inactive ) then
11131130 tooltip :AddLine (16 , " Requires an active Jewel Socket" )
11141131 end
11151132 end
0 commit comments