@@ -131,8 +131,13 @@ local function buildURL(item, slotName, controls, modEntries, defenceEntries, is
131131 local filter = { id = entry .tradeId }
132132 if entry .options then
133133 filter .value = { option = entry .value }
134+ -- some entries don't want to search for ranges, but aren't
135+ -- implemented using options on the trade site (timeless jewels)
136+ elseif entry .needsExactValue then
137+ filter .value = { min = entry .value , max = entry .value }
134138 elseif entry .value then
135139 local minVal = tonumber (controls [prefix .. " Min" ].buf )
140+
136141 local maxVal = tonumber (controls [prefix .. " Max" ].buf )
137142 local value = {}
138143 if minVal then
@@ -213,25 +218,55 @@ function M.openPopup(item, slotName, primaryBuild)
213218 local formatted = itemLib .formatModLine (modLine )
214219 if formatted then
215220 -- Use range-resolved text for matching
216- local resolvedLine = (modLine .range and itemLib .applyRange (modLine .line , modLine .range , modLine .valueScalar )) or modLine .line
217-
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
221- value = tradeHelpers .modLineValue (resolvedLine )
221+ local resolvedLine = (modLine .range and itemLib .applyRange (modLine .line , modLine .range , modLine .valueScalar )) or
222+ modLine .line
223+
224+ local timelessPatterns = { " bathed in the blood of %d+ sacrificed in the name of (.+)" ,
225+ " carved to glorify %d+ new faithful converted by high templar (.+)" ,
226+ " commanded leadership over %d+ warriors under (.+)" ,
227+ " commissioned %d+ coins to commemorate (.+)" ,
228+ " denoted service of %d+ dekhara in the akhara of (.+)" ,
229+ " remembrancing %d+ songworthy deeds by the line of (.+)" }
230+ local conquerorTradeId = nil
231+ for _ , pat in ipairs (timelessPatterns ) do
232+ local conqueror = resolvedLine :lower ():match (pat )
233+ if conqueror then
234+ conquerorTradeId = " explicit.pseudo_timeless_jewel_" .. conqueror
235+ break
236+ end
222237 end
223238
224-
225- t_insert (modEntries , {
226- line = modLine .line ,
227- formatted = formatted ,
228- tradeId = identifier ,
229- value = value ,
230- options = options ,
231- modType = source .type ,
232- type = source .type ,
233- invert = tradeHelpers .shouldBeInverted (identifier , resolvedLine , source .type )
234- })
239+ -- timeless jewels have a special trade id format based
240+ -- on the conqueror name, which doesn't use a hash
241+ if item .jewelData and item .jewelData .conqueredBy and conquerorTradeId then
242+ t_insert (modEntries , {
243+ line = modLine .line ,
244+ formatted = formatted ,
245+ tradeId = conquerorTradeId ,
246+ value = item .jewelData .conqueredBy .id ,
247+ -- it doesn't actually use options, but
248+ -- searching for ranges is useless here
249+ options = nil ,
250+ needsExactValue = true ,
251+ type = source .type ,
252+ invert = false
253+ })
254+ else
255+ local tradeHash , options , value = tradeHelpers .findTradeHash (item , resolvedLine , source .type )
256+ local identifier = tradeHash and string.format (" %s.stat_%s" , source .type , tradeHash )
257+ if not options then
258+ value = tradeHelpers .modLineValue (resolvedLine )
259+ end
260+ t_insert (modEntries , {
261+ line = modLine .line ,
262+ formatted = formatted ,
263+ tradeId = identifier ,
264+ value = value ,
265+ options = options ,
266+ type = source .type ,
267+ invert = tradeHelpers .shouldBeInverted (identifier , resolvedLine , source .type )
268+ })
269+ end
235270 end
236271 end
237272 end
@@ -410,7 +445,7 @@ function M.openPopup(item, slotName, primaryBuild)
410445 displayText )
411446 -- when the trade site has a dropdown for the value, we opt to disable
412447 -- the inputs as they are numeric
413- if not entry .options and entry .value then
448+ if not ( entry .options or entry . needsExactValue ) and entry .value then
414449 controls [prefix .. " Min" ] = newPlainNumericEdit (nil , {minFieldX - popupWidth / 2 , ctrlY , fieldW , fieldH }, entry .value ~= 0 and tostring (m_floor (entry .value )) or " " , " Min" , 8 )
415450 controls [prefix .. " Max" ] = newPlainNumericEdit (nil , {maxFieldX - popupWidth / 2 , ctrlY , fieldW , fieldH }, " " , " Max" , 8 )
416451 if not canSearch then
0 commit comments