@@ -129,7 +129,7 @@ local function buildURL(item, slotName, controls, modEntries, defenceEntries, is
129129 if entry .tradeId and controls [prefix .. " Check" ] and controls [prefix .. " Check" ].state then
130130
131131 local filter = { id = entry .tradeId }
132- if entry .valueIsOption then
132+ if entry .options then
133133 filter .value = { option = entry .value }
134134 elseif entry .value then
135135 local minVal = tonumber (controls [prefix .. " Min" ].buf )
@@ -215,26 +215,9 @@ function M.openPopup(item, slotName, primaryBuild)
215215 -- Use range-resolved text for matching
216216 local resolvedLine = (modLine .range and itemLib .applyRange (modLine .line , modLine .range , modLine .valueScalar )) or modLine .line
217217
218- -- special case: cluster enchantment
219- local identifier , value
220- -- whether to add a min and max, or an option field
221- local valueIsOption = false
222- local clusterMatch = resolvedLine :match (" Added Small Passive Skills grant: (.+)" )
223- if clusterMatch then
224- identifier = " enchant.stat_3948993189"
225- for _ , v in pairs (item .clusterJewel .skills ) do
226- for _ , stat in ipairs (v .stats ) do
227- if stat == clusterMatch then
228- value = v .id
229- valueIsOption = true
230- goto outer
231- end
232- end
233- end
234- :: outer::
235- else
236- local tradeHash = tradeHelpers .findTradeHash (item , resolvedLine , source .type )
237- identifier = tradeHash and string.format (" %s.stat_%s" , source .type , tradeHash )
218+ local tradeHash , options , value = tradeHelpers .findTradeHash (item , resolvedLine , source .type )
219+ local identifier = tradeHash and string.format (" %s.stat_%s" , source .type , tradeHash )
220+ if not options then
238221 value = tradeHelpers .modLineValue (resolvedLine )
239222 end
240223
@@ -244,7 +227,7 @@ function M.openPopup(item, slotName, primaryBuild)
244227 formatted = formatted ,
245228 tradeId = identifier ,
246229 value = value ,
247- valueIsOption = valueIsOption ,
230+ options = options ,
248231 modType = source .type ,
249232 type = source .type ,
250233 invert = tradeHelpers .shouldBeInverted (identifier , resolvedLine , source .type )
@@ -419,15 +402,15 @@ function M.openPopup(item, slotName, primaryBuild)
419402 -- strip color codes and replace with gray
420403 displayText = " ^8" .. displayText :gsub (" %^x%x%x%x%x%x%x" , " " ):gsub (" %^%x" , " " )
421404 end
422- if # displayText > (# colorCodeLength + 65 ) then
423- displayText = displayText :sub (1 , # colorCodeLength + 55 ) .. " ..."
405+ if # displayText > (# colorCodeLength + 60 ) then
406+ displayText = displayText :sub (1 , # colorCodeLength + 54 ) .. " ..."
424407 end
425408
426409 controls [prefix .. " Label" ] = new (" LabelControl" , { " LEFT" , controls [prefix .. " Check" ], " RIGHT" }, { 4 , 0 , 0 , 16 },
427410 displayText )
428411 -- when the trade site has a dropdown for the value, we opt to disable
429412 -- the inputs as they are numeric
430- if not entry .valueIsOption and entry .value then
413+ if not entry .options and entry .value then
431414 controls [prefix .. " Min" ] = newPlainNumericEdit (nil , {minFieldX - popupWidth / 2 , ctrlY , fieldW , fieldH }, entry .value ~= 0 and tostring (m_floor (entry .value )) or " " , " Min" , 8 )
432415 controls [prefix .. " Max" ] = newPlainNumericEdit (nil , {maxFieldX - popupWidth / 2 , ctrlY , fieldW , fieldH }, " " , " Max" , 8 )
433416 if not canSearch then
@@ -448,7 +431,6 @@ function M.openPopup(item, slotName, primaryBuild)
448431 controls .search .enabled = function ()
449432 return uri and uri ~= " "
450433 end
451- -- ctrlY = ctrlY + rowHeight + 4
452434
453435 controls .close = new (" ButtonControl" , nil , {popupWidth / 2 - 50 , ctrlY , 60 , 20 }, " Close" , function ()
454436 main :ClosePopup ()
0 commit comments