Skip to content

Commit 1537bfc

Browse files
authored
Fix rangeless mods not getting pasted properly (#2013)
1 parent 96d9876 commit 1537bfc

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/Classes/Item.lua

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
461461
if #self.pendingAffixList == 0 and #backupAffixList > 0 then
462462
self.pendingAffixList = backupAffixList
463463
end
464-
if #self.pendingAffixList == 0 and #backupAffixList == 0 then
464+
if #self.pendingAffixList == 0 then
465465
-- Could be a veiled, temple, or other custom mod, so just keep it around
466466
linePrefix = "{custom}"
467467
end
@@ -853,12 +853,17 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
853853
end
854854
if self.pendingAffixList and #self.pendingAffixList > 0 then
855855
if #self.pendingAffixList > 1 then
856-
-- Probably a conqueror mod since the mod name is the same for all of them
856+
-- Probably a conqueror or Essence mod since the mod name is the same for all of them
857857
-- Try to match the line against one of the mods there
858858
local valueStrippedLine = line:gsub("%-?%d+%.?%d*%(", "("):gsub("%-?%d+%.?%d*", "#")
859859
for _, pendingAffix in ipairs(self.pendingAffixList) do
860860
local modData = self.affixes[pendingAffix.modId]
861861
for _, modDataLine in ipairs(modData) do
862+
-- Prefer the exact match
863+
if line == modDataLine then
864+
self.pendingAffixList = { pendingAffix }
865+
break
866+
end
862867
if valueStrippedLine == modDataLine:gsub("%-?%d+%.?%d*", "#") then
863868
self.pendingAffixList = { pendingAffix }
864869
break
@@ -881,7 +886,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
881886
end
882887
t_insert(self.pendingAffixList[1].table, {
883888
modId = self.pendingAffixList[1].modId,
884-
range = tonumber(bestPrecisionRange),
889+
range = bestPrecisionRange >= 0 and bestPrecisionRange <= 1 and bestPrecisionRange or 0.5,
885890
})
886891
self.pendingAffixList = {}
887892
else
@@ -906,7 +911,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
906911
end
907912
end
908913
if bestPrecisionRange <= 1 and bestPrecisionRange >= 0 then
909-
modLine.range = tonumber(bestPrecisionRange)
914+
modLine.range = bestPrecisionRange
910915
end
911916
end
912917
local rangedLine = itemLib.applyRange(line, 1, catalystScalar, modLine.corruptedRange)

0 commit comments

Comments
 (0)