Skip to content

Commit 78263d0

Browse files
committed
Fix timeless jewel and rebuildurl on league and realm selectors
1 parent 10ee05f commit 78263d0

2 files changed

Lines changed: 21 additions & 5 deletions

File tree

src/Classes/CompareBuySimilar.lua

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,35 +366,37 @@ function M.openPopup(item, slotName, primaryBuild)
366366
end)
367367
end
368368

369+
local function rebuildUrl()
370+
local result = buildURL(item, slotName, controls, modEntries, defenceEntries, isUnique)
371+
uri = result
372+
end
369373
-- Realm dropdown
370374
controls.realmLabel = new("LabelControl", {"TOPLEFT", nil, "TOPLEFT"}, {leftMargin, ctrlY, 0, 16}, "^7Realm:")
371375
controls.realmDrop = new("DropDownControl", {"LEFT", controls.realmLabel, "RIGHT"}, {4, 0, 80, 20}, {"PC", "PS4", "Xbox"}, function(index, value)
372376
local realmApiId = REALM_API_IDS[value] or "pc"
373377
fetchLeaguesForRealm(realmApiId)
378+
rebuildUrl()
374379
end)
375380

376381
-- League dropdown
377382
controls.leagueLabel = new("LabelControl", {"LEFT", controls.realmDrop, "RIGHT"}, {12, 0, 0, 16}, "^7League:")
378383
controls.leagueDrop = new("DropDownControl", {"LEFT", controls.leagueLabel, "RIGHT"}, {4, 0, 160, 20}, {"Loading..."}, function(index, value)
379384
-- League selection stored in the dropdown itself
385+
rebuildUrl()
380386
end)
381387
controls.leagueDrop.enabled = function() return #controls.leagueDrop.list > 0 and controls.leagueDrop.list[1] ~= "Loading..." end
382388

383389
-- Listed status dropdown
384390
controls.listedDrop = new("DropDownControl", {"TOPRIGHT", nil, "TOPRIGHT"}, {-leftMargin, ctrlY, 242, 20}, LISTED_STATUS_LABELS, function(index, value)
385391
-- Listed status selection stored in the dropdown itself
392+
rebuildUrl()
386393
end)
387394
controls.listedLabel = new("LabelControl", {"RIGHT", controls.listedDrop, "LEFT"}, {-4, 0, 0, 16}, "^7Listed:")
388395

389396
-- Fetch initial leagues for default realm
390397
fetchLeaguesForRealm("pc")
391398
ctrlY = ctrlY + rowHeight + 4
392399

393-
local function rebuildUrl()
394-
local result = buildURL(item, slotName, controls, modEntries, defenceEntries, isUnique)
395-
uri = result
396-
end
397-
398400

399401
if isUnique then
400402
-- Unique item name label

src/Classes/TradeHelpers.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,20 @@ end
144144
function M.findTradeIdOption(modLine, modType)
145145
-- match stringify() behaviour and ignore casing
146146
modLine = modLine:gsub("\n", " "):lower()
147+
-- exception: timeless jewels
148+
-- these have special pseudo trade ids and are not options in poe1
149+
local timelessPatterns = { "bathed in the blood of (%d+) sacrificed in the name of (.+)",
150+
"carved to glorify (%d+) new faithful converted by high templar (.+)",
151+
"commanded leadership over (%d+) warriors under (.+)",
152+
"commissioned (%d+) coins to commemorate (.+)",
153+
"denoted service of (%d+) dekhara in the akhara of (.+)",
154+
"remembrancing (%d+) songworthy deeds by the line of (.+)" }
155+
for _, pat in ipairs(timelessPatterns) do
156+
local value, conqueror = modLine:match(pat)
157+
if conqueror then
158+
return "explicit.pseudo_timeless_jewel_" .. conqueror, tonumber(value)
159+
end
160+
end
147161
local tradeStats = M.getTradeStats()
148162
local optionTradeStatMap = getOptionTradeStatMap(tradeStats)
149163
if not tradeStats or not optionTradeStatMap then return end

0 commit comments

Comments
 (0)