Skip to content

Commit f49832d

Browse files
authored
fix rangeLine updating for shortened name (#183)
fix values of ATD stats on nodes when changing the slider
1 parent 021bce9 commit f49832d

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

src/Classes/Item.lua

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,11 +1538,7 @@ function ItemClass:BuildModList()
15381538
local list, extra = modLib.parseMod(line)
15391539
if list and not extra then
15401540
modLine.modList = list
1541-
-- Against the Darkness specific // a way to cut down on really long modLines in the range dropdown
1542-
-- copy the modLine so we don't actually change the mod, only the display
1543-
local rangeLine = copyTable(modLine)
1544-
rangeLine.line = rangeLine.line:gsub(" Passive Skills in Radius also grant", ":")
1545-
t_insert(self.rangeLineList, rangeLine)
1541+
t_insert(self.rangeLineList, modLine)
15461542
end
15471543
end
15481544
end

src/Classes/ItemsTab.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1725,7 +1725,8 @@ function ItemsTabClass:UpdateDisplayItemRangeLines()
17251725
if self.displayItem and self.displayItem.rangeLineList[1] then
17261726
wipeTable(self.controls.displayItemRangeLine.list)
17271727
for _, modLine in ipairs(self.displayItem.rangeLineList) do
1728-
t_insert(self.controls.displayItemRangeLine.list, modLine.line)
1728+
-- primarily for Against the Darkness // a way to cut down on really long modLines, gsub could be updated for others
1729+
t_insert(self.controls.displayItemRangeLine.list, modLine.line:gsub(" Passive Skills in Radius also grant", ":"))
17291730
end
17301731
self.controls.displayItemRangeLine.selIndex = 1
17311732
self.controls.displayItemRangeSlider.val = self.displayItem.rangeLineList[1].range

src/Modules/CalcSetup.lua

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,28 +96,31 @@ local function setRadiusJewelStats(radiusJewel, radiusJewelStats)
9696
local jewel = radiusJewel.item
9797
if jewel.title == "Against the Darkness" then
9898
radiusJewelStats.source = radiusJewel.data.modSource
99-
local range = jewel.explicitModLines[jewel.variant].range
99+
100+
local variant = jewel.variant or 1
101+
local range = jewel.explicitModLines[variant].range
100102
local value = 0
101-
jewel.explicitModLines[jewel.variant].line:gsub("%((%d+)%-(%d+)%)",
103+
jewel.explicitModLines[variant].line:gsub("%((%d+)%-(%d+)%)",
102104
function(num1, num2)
103-
value = round((num1+num2)*range)
105+
value = round(num1 + (num2-num1) * range)
104106
end
105107
)
106108
radiusJewelStats[1] = {
107-
isNotable = (jewel.explicitModLines[jewel.variant].line:match("^(%S+)") == "Notable"),
108-
sd = jewel.explicitModLines[jewel.variant].line:gsub(".*grant ", ""):gsub("%(.-%)", value)
109+
isNotable = (jewel.explicitModLines[variant].line:match("^(%S+)") == "Notable"),
110+
sd = jewel.explicitModLines[variant].line:gsub(".*grant ", ""):gsub("%(.-%)", value)
109111
}
110-
111-
local rangeAlt = jewel.explicitModLines[jewel.variant].range
112+
113+
local variantAlt = jewel.variantAlt or 2
114+
local rangeAlt = jewel.explicitModLines[variantAlt].range
112115
local valueAlt = 0
113-
jewel.explicitModLines[jewel.variantAlt].line:gsub("%((%d+)%-(%d+)%)",
116+
jewel.explicitModLines[variantAlt].line:gsub("%((%d+)%-(%d+)%)",
114117
function(num1, num2)
115-
valueAlt = round((num1+num2)*rangeAlt)
118+
valueAlt = round(num1 + (num2-num1) * rangeAlt)
116119
end
117120
)
118121
radiusJewelStats[2] = {
119-
isNotable = (jewel.explicitModLines[jewel.variantAlt].line:match("^(%S+)") == "Notable"),
120-
sd = jewel.explicitModLines[jewel.variantAlt].line:gsub(".*grant ", ""):gsub("%(.-%)", valueAlt)
122+
isNotable = (jewel.explicitModLines[variantAlt].line:match("^(%S+)") == "Notable"),
123+
sd = jewel.explicitModLines[variantAlt].line:gsub(".*grant ", ""):gsub("%(.-%)", valueAlt)
121124
}
122125
end
123126
end

0 commit comments

Comments
 (0)