Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions spec/System/TestFoulborn_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions src/Classes/CompareBuySimilar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/Classes/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading