From 670c55e5d9792c7ad0e8285bdc2b965f2239ca95 Mon Sep 17 00:00:00 2001 From: vaisest <4550061+vaisest@users.noreply.github.com> Date: Sun, 26 Jul 2026 17:47:36 +0300 Subject: [PATCH 1/2] Fix some unique name handling issues --- src/Classes/CompareBuySimilar.lua | 4 ++++ src/Classes/Item.lua | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Classes/CompareBuySimilar.lua b/src/Classes/CompareBuySimilar.lua index 13950fd46b..ede83e401f 100644 --- a/src/Classes/CompareBuySimilar.lua +++ b/src/Classes/CompareBuySimilar.lua @@ -74,6 +74,10 @@ local function buildURL(item, slotName, controls, modEntries, defenceEntries, is -- Search by unique name -- Strip "Foulborn" prefix from unique name for trade search local tradeName = (item.title or item.name):gsub("^Foulborn%s+", "") + -- only take the first letters and white space to avoid e.g. including + -- timeless jewel ids or other numbers the user might have on the item + local nameMatch = tradeName:match("(%a[%a%s]+).*") + tradeName = (nameMatch and nameMatch:gsub("%s+$", "")) or tradeName queryTable.query.name = tradeName queryTable.query.type = item.baseName -- If item is Foulborn, add the foulborn_item filter diff --git a/src/Classes/Item.lua b/src/Classes/Item.lua index 67476cf1f8..975b6daaa3 100644 --- a/src/Classes/Item.lua +++ b/src/Classes/Item.lua @@ -1104,9 +1104,6 @@ function ItemClass:ParseRaw(raw, rarity, highQuality) ::continue:: l = l + 1 end - if self.baseName and self.title then - self.name = self.title .. ", " .. self.baseName:gsub(" %(.+%)","") - end if self.base and not self.requirements.level then if importedLevelReq and #self.sockets == 0 then -- Requirements on imported items can only be trusted for items with no sockets @@ -1308,6 +1305,9 @@ function ItemClass:ParseRaw(raw, rarity, highQuality) elseif not self.foulborn and hasFoulbornPrefix then self.title = self.title:gsub("[Ff]oulborn ", "") end + if self.baseName and self.title then + self.name = self.title .. ", " .. self.baseName:gsub(" %(.+%)", "") + end if not self.quality then self:NormaliseQuality() if highQuality then From bbdaea5f981fec14932e3c44a286c52acd011be3 Mon Sep 17 00:00:00 2001 From: vaisest <4550061+vaisest@users.noreply.github.com> Date: Sun, 26 Jul 2026 17:49:54 +0300 Subject: [PATCH 2/2] Add test --- spec/System/TestFoulborn_spec.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/System/TestFoulborn_spec.lua b/spec/System/TestFoulborn_spec.lua index 9eb68c9e39..a722ed1a17 100644 --- a/spec/System/TestFoulborn_spec.lua +++ b/spec/System/TestFoulborn_spec.lua @@ -83,20 +83,22 @@ describe("TestFoulborn", function() assert.are.equals(powerBaseId, mutated.newModId) end) - it("flags the item as foulborn and prefixes the title once a mod is mutated", function() + it("flags the item as foulborn and prefixes the title and name once a mod is mutated", function() local item = vollsDevotion() -- an unmodified item is a plain unique assert.is_falsy(item.foulborn) assert.are.equals("Voll's Devotion", item.title) + assert.are.equals("Voll's Devotion, Agate Amulet", item.name) toggle(item, findByLine(item, powerBase)) assert.is_true(item.foulborn) assert.are.equals("Foulborn Voll's Devotion", item.title) - + assert.are.equals("Foulborn Voll's Devotion, Agate Amulet", item.name) -- reverting the last mutated mod drops the flag and the prefix again toggle(item, findByLine(item, powerFoulborn)) assert.is_falsy(item.foulborn) assert.are.equals("Voll's Devotion", item.title) + assert.are.equals("Voll's Devotion, Agate Amulet", item.name) end) it("keeps the mutated state through BuildRaw", function()