@@ -2478,26 +2478,8 @@ function CompareTabClass:ComparePowerBuilder(compareEntry, powerStat, categories
24782478 t_insert (baseSlots , 10 , " Ring 3" )
24792479 end
24802480
2481- -- abyssal sockets
2482- local socketSet = {}
2483- local function saveActiveAbyssSocket (k , v )
2484- if type (k ) == " string" and k :match (" Abyssal Socket" )
2485- and v .shown () then
2486- socketSet [k ] = (socketSet [k ] or 0 ) + 1
2487- end
2488- end
2489- for k , v in pairs (compareEntry .itemsTab .slots ) do
2490- saveActiveAbyssSocket (k , v )
2491- end
2492- for k , v in pairs (self .primaryBuild .itemsTab .slots ) do
2493- saveActiveAbyssSocket (k , v )
2494- end
2495- -- consider only if both have the socket allocated
2496- for k , count in pairs (socketSet ) do
2497- if count == 2 then
2498- t_insert (baseSlots , k )
2499- end
2500- end
2481+ -- we only use jewel slots if both sides have them available
2482+ self :AddAbyssSockets (compareEntry , baseSlots , true )
25012483
25022484 for _ , slotName in ipairs (baseSlots ) do
25032485 local cSlot = compareEntry .itemsTab and compareEntry .itemsTab .slots [slotName ]
@@ -2664,27 +2646,9 @@ function CompareTabClass:ComparePowerBuilder(compareEntry, powerStat, categories
26642646 t_insert (baseSlots , 10 , " Ring 3" )
26652647 end
26662648
2667- -- abyssal sockets
2668- local socketSet = {}
2669- local function saveActiveAbyssSocket (k , v )
2670- if type (k ) == " string" and k :match (" Abyssal Socket" )
2671- and v .shown () then
2672- socketSet [k ] = (socketSet [k ] or 0 ) + 1
2673- end
2674- end
2675- for k , v in pairs (compareEntry .itemsTab .slots ) do
2676- saveActiveAbyssSocket (k , v )
2677- end
2678- for k , v in pairs (self .primaryBuild .itemsTab .slots ) do
2679- saveActiveAbyssSocket (k , v )
2680- end
2681- -- consider only if both have the socket allocated
2682- for k , count in pairs (socketSet ) do
2683- if count == 2 then
2684- t_insert (baseSlots , k )
2685- end
2686- end
2687-
2649+ -- we only use jewel slots if both sides have them available
2650+ self :AddAbyssSockets (compareEntry , baseSlots , true )
2651+
26882652 for _ , slotName in ipairs (baseSlots ) do
26892653 local cSlot = compareEntry .itemsTab and compareEntry .itemsTab .slots [slotName ]
26902654 local cItem = cSlot and compareEntry .itemsTab .items [cSlot .selItemId ]
@@ -3589,30 +3553,32 @@ function CompareTabClass:ShouldShowRing3(compareEntry)
35893553 return primaryHas or compareHas
35903554end
35913555
3556+ --- @param comparison table
3557+ --- @param destTable string[]
3558+ --- @param requireBothSides boolean
3559+ function CompareTabClass :AddAbyssSockets (comparison , destTable , requireBothSides )
3560+ local equipmentSlots = {" Weapon 1" , " Weapon 2" , " Helmet" , " Body Armour" , " Gloves" , " Boots" , " Belt" }
3561+
3562+ for _ , slot in ipairs (equipmentSlots ) do
3563+ for number = 1 , 6 do
3564+ local abyssalSocketName = string.format (" %s Abyssal Socket %d" , slot , number )
3565+ local mainHas = self .primaryBuild .itemsTab .slots [abyssalSocketName ].shown ()
3566+ local comparisonHas = comparison .itemsTab .slots [abyssalSocketName ].shown ()
3567+ if (requireBothSides and mainHas and comparisonHas )
3568+ or ((not requireBothSides ) and (mainHas or comparisonHas )) then
3569+ table.insert (destTable , abyssalSocketName )
3570+ end
3571+ end
3572+ end
3573+ end
3574+
35923575function CompareTabClass :DrawItems (vp , compareEntry , inputEvents )
35933576 local baseSlots = { " Weapon 1" , " Weapon 2" , " Helmet" , " Body Armour" , " Gloves" , " Boots" , " Amulet" , " Ring 1" , " Ring 2" , " Belt" , " Flask 1" , " Flask 2" , " Flask 3" , " Flask 4" , " Flask 5" }
35943577 if self :ShouldShowRing3 (compareEntry ) then
35953578 t_insert (baseSlots , 10 , " Ring 3" )
35963579 end
35973580
3598- -- abyssal sockets
3599- local socketSet = {}
3600- local function saveActiveAbyssSocket (k , v )
3601- if type (k ) == " string" and k :match (" Abyssal Socket" )
3602- and v .shown () then
3603- socketSet [k ] = true
3604- end
3605- end
3606- for k , v in pairs (compareEntry .itemsTab .slots ) do
3607- saveActiveAbyssSocket (k , v )
3608- end
3609- for k , v in pairs (self .primaryBuild .itemsTab .slots ) do
3610- saveActiveAbyssSocket (k , v )
3611- end
3612- -- show if either has a socket allocated
3613- for k , _ in pairs (socketSet ) do
3614- t_insert (baseSlots , k )
3615- end
3581+ self :AddAbyssSockets (compareEntry , baseSlots , false )
36163582
36173583 local primaryEnv = self .primaryBuild .calcsTab and self .primaryBuild .calcsTab .mainEnv
36183584 local primaryHasRing3 = primaryEnv and primaryEnv .modDB :Flag (nil , " AdditionalRingSlot" )
0 commit comments