Skip to content

Commit c1a4ebd

Browse files
committed
Fix a couple of bugs with uniques and non-number ranges
1 parent 6cee8de commit c1a4ebd

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/Classes/Item.lua

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -838,8 +838,8 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
838838
end
839839
end
840840
-- Use rolling Delta/Range in case one range is 1-3 and another is 1-100 so we get the finest precision possible
841-
local bestPrecisionDelta = 0
842-
local bestPrecisionRange = 0
841+
local bestPrecisionDelta = -1
842+
local bestPrecisionRange = -1
843843
for value, range in line:gmatch("(%-?%d+%.?%d*)%((%-?%d+%.?%d*%-%-?%d+%.?%d*)%)") do
844844
-- Find advanced copy paste format: 45(40-50)
845845
local min, max = range:match("(%-?%d+%.?%d*)%-(%-?%d+%.?%d*)")
@@ -857,8 +857,12 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
857857
self.pendingAffixList = {}
858858
else
859859
-- Use rolling Delta/Range in case one range is 1-3 and another is 1-100 so we get the finest precision possible
860-
local bestPrecisionDelta = 0
861-
local bestPrecisionRange = 0
860+
local bestPrecisionDelta = -1
861+
local bestPrecisionRange = -1
862+
863+
-- Replace non-number ranges as unsupported
864+
line = line:gsub("(%a+)%([%a%s]+%-[%a%s]+%)", "%1")
865+
862866
for value, range in line:gmatch("(%-?%d+%.?%d*)%((%-?%d+%.?%d*%-%-?%d+%.?%d*)%)") do
863867
local min, max = range:match("(%-?%d+%.?%d*)%-(%-?%d+%.?%d*)")
864868
local delta = tonumber(max) - min
@@ -869,7 +873,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
869873
if bestPrecisionRange > 1 or bestPrecisionRange < 0 then
870874
line = line:gsub(value .. "%(" .. range:gsub("%-", "%%-") .. "%)", value)
871875
else
872-
line = line:gsub(value .. "%(" .. range:gsub("%-", "%%-") .. "%)", "(" .. range .. ")")
876+
line = line:gsub(value .. "%(" .. range:gsub("%-", "%%-") .. "%)", (tonumber(value) < 0 and "+" or "") .. "(" .. range .. ")")
873877
end
874878
end
875879
if bestPrecisionRange <= 1 and bestPrecisionRange >= 0 then

src/Classes/ItemsTab.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1911,7 +1911,6 @@ function ItemsTabClass:UpdateAffixControl(control, item, type, outputTable, outp
19111911
range = 1e-4
19121912
end
19131913
control.slider.val = (index - 1 + range) / control.slider.divCount
1914-
ConPrintf("Setting slider div count to "..control.slider.divCount.." with val "..control.slider.val .. " for mod ID ".. selAffix)
19151914
if control.slider.divCount == 1 then
19161915
control.slider.divCount = nil
19171916
end

0 commit comments

Comments
 (0)