Skip to content

Commit 4fdb7dd

Browse files
RegisleLothrikLocalIdentity
authored
Timeless jewel search improvements (#4622)
* setup infrastructure for more advanced search filters * add broken generateWeights function, and temp remove weightPerPoint * scale weights to be reasonable * add search type * add minimum weights and improve generate function * add total stat for str/dex/devotion which also count small nodes * fix legionAddtions and GV weight generation * remove Filtertypes to isolate Generator and other minor changes * change weights to be percentage based * add generation of totalMods and fix GV divisor (as not normalised) * fix keystones etc being counted as small nodes * fix missing then * Various changes and UI rework * Remove draw color reset as it's no longer necessary * Fix total_dex => total_dexterity * search fallback and normal searchlist * remove unused case * Add minimum weight UI, process fallback node weights, fix total stat tooltips * Fix errors * Improve formatSearchValue pattern matching * Fix a few more errors, more consistent rounding * Save fallback weight mode idx in build XML * Make enter insert a newline instead of searching * fix small node weights * fix index * Skip minimumWeight == 0 * Fix random empty sortedNodeLists * Properly indent Militant Faith at 10K seed * Add tooltips to timeless jewel node weight sliders * fix second weight not correctly being scaled * Dynamically reposition node slider tooltips * Fix fallback weight generation for stat totals * Increase timeless jewel popup window width 200px * Improve various tooltips, disable secondary weight slider on single stat nodes * Switch to multi-line node slider tooltips * Automatically set disabled weights to 0, adjust colors * Add SliderControl scroll wheel support * Switch to custom scrollWheelSpeedTbl * Remove extraneous newLine from generated fallback node list * Adjust wording * Further wording adjustments * Faster scroll wheel speed for minimum node weight slider * Fix wrong shift scroll speed * Swap slider scroll wheel direction + add keyboard arrow support * Add left/right arrow key support * round(..., 3) weight output to edit box controls * Partial revert for consistency * Revert this line as well * Update TreeTab.lua * Anchor tooltips to slider position * Correctly calculate height offset for tooltip * Update TreeTab.lua * Round slider offset for tooltips instead of floor * Hide slider tooltip while dragging to improve visibility * Fix trailing newline in fallback weights not being culled * add option to toggle slider scroll direction * Add tooltip for scroll option and default to off Co-authored-by: Lothrik <maximius@gmail.com> Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent bddbffc commit 4fdb7dd

File tree

7 files changed

+700
-134
lines changed

7 files changed

+700
-134
lines changed

src/Classes/PassiveSpec.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ function PassiveSpecClass:BuildAllDependsAndPaths()
691691
end
692692

693693
local replaceHelperFunc = function(statToFix, statKey, statMod, value)
694-
if statMod.fmt == "g" then -- note the only one we actualy care about is "Ritual of Flesh" life regen
694+
if statMod.fmt == "g" then -- note the only one we actually care about is "Ritual of Flesh" life regen
695695
if statKey:find("per_minute") then
696696
value = round(value / 60, 1)
697697
elseif statKey:find("permyriad") then
@@ -702,7 +702,7 @@ function PassiveSpecClass:BuildAllDependsAndPaths()
702702
end
703703
--if statMod.fmt == "d" then -- only ever d or g, and we want both past here
704704
if statMod.min ~= statMod.max then
705-
return statToFix:gsub("%("..statMod.min.."%-"..statMod.max.."%)", value)
705+
return statToFix:gsub("%(" .. statMod.min .. "%-" .. statMod.max .. "%)", value)
706706
elseif statMod.min ~= value then -- only true for might/legacy of the vaal which can combine stats
707707
return statToFix:gsub(statMod.min, value)
708708
end

src/Classes/SliderControl.lua

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ local m_min = math.min
77
local m_max = math.max
88
local m_ceil = math.ceil
99

10-
local SliderClass = newClass("SliderControl", "Control", "TooltipHost", function(self, anchor, x, y, width, height, changeFunc)
10+
local SliderClass = newClass("SliderControl", "Control", "TooltipHost", function(self, anchor, x, y, width, height, changeFunc, scrollWheelSpeedTbl)
1111
self.Control(anchor, x, y, width, height)
1212
self.TooltipHost()
1313
self.knobSize = height - 2
1414
self.val = 0
1515
self.changeFunc = changeFunc
16+
self.scrollWheelSpeedTbl = scrollWheelSpeedTbl or { ["SHIFT"] = 0.25, ["CTRL"] = 0.01, ["DEFAULT"] = 0.05 }
1617
end)
1718

1819
function SliderClass:IsMouseOver()
@@ -160,5 +161,21 @@ function SliderClass:OnKeyUp(key)
160161
local cursorX, cursorY = GetCursorPos()
161162
self:SetValFromKnobX((cursorX - self.dragCX) + self.dragKnobX)
162163
end
164+
elseif (not main.invertSliderScrollDirection and key == "WHEELDOWN") or (main.invertSliderScrollDirection and key == "WHEELUP") or key == "DOWN" or key == "LEFT" then
165+
if IsKeyDown("SHIFT") then
166+
self:SetVal(self.val - self.scrollWheelSpeedTbl["SHIFT"])
167+
elseif IsKeyDown("CTRL") then
168+
self:SetVal(self.val - self.scrollWheelSpeedTbl["CTRL"])
169+
else
170+
self:SetVal(self.val - self.scrollWheelSpeedTbl["DEFAULT"])
171+
end
172+
elseif (not main.invertSliderScrollDirection and key == "WHEELUP") or (main.invertSliderScrollDirection and key == "WHEELDOWN") or key == "UP" or key == "RIGHT" then
173+
if IsKeyDown("SHIFT") then
174+
self:SetVal(self.val + self.scrollWheelSpeedTbl["SHIFT"])
175+
elseif IsKeyDown("CTRL") then
176+
self:SetVal(self.val + self.scrollWheelSpeedTbl["CTRL"])
177+
else
178+
self:SetVal(self.val + self.scrollWheelSpeedTbl["DEFAULT"])
179+
end
163180
end
164181
end

src/Classes/TimelessJewelListControl.lua

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,21 @@ function TimelessJewelListControlClass:AddValueTooltip(tooltip, index, data)
3737
local treeData = self.build.spec.tree
3838
local sortedNodeLists = { }
3939
for legionId, desiredNode in pairs(self.sharedList.desiredNodes) do
40-
if self.list[index][legionId] and self.list[index][legionId].targetNodeNames and #self.list[index][legionId].targetNodeNames > 0 then
41-
sortedNodeLists[desiredNode.desiredIdx] = "^7 " .. desiredNode.displayName .. ":\n^8 " .. t_concat(self.list[index][legionId].targetNodeNames, "\n ")
40+
if self.list[index][legionId] then
41+
if self.list[index][legionId].targetNodeNames and #self.list[index][legionId].targetNodeNames > 0 then
42+
sortedNodeLists[desiredNode.desiredIdx] = "^7 " .. desiredNode.displayName .. ":\n^8 " .. t_concat(self.list[index][legionId].targetNodeNames, "\n ")
43+
else
44+
sortedNodeLists[desiredNode.desiredIdx] = "^7 " .. desiredNode.displayName .. ":\n^8 None"
45+
end
4246
end
4347
end
44-
if sortedNodeLists then
45-
tooltip:AddLine(16, "Node List:")
48+
if next(sortedNodeLists) then
49+
tooltip:AddLine(16, "^7Node List:")
4650
for _, sortedNodeList in pairs(sortedNodeLists) do
4751
tooltip:AddLine(16, sortedNodeList)
4852
end
53+
end
54+
if data.total > 0 then
4955
tooltip:AddLine(16, "^7Combined Node Weight: " .. data.total)
5056
end
5157
end

src/Classes/TimelessJewelSocketControl.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ function TimelessJewelSocketClass:Draw(viewPort, noTooltip)
3939
SetDrawColor(1, 1, 1, 0.2)
4040
DrawImage(nil, 149, 0, 2, 300)
4141
DrawImage(nil, 0, 149, 300, 2)
42-
SetDrawColor(1, 1, 1, 1) -- bug fix, don't mind me
4342
SetViewport()
4443
SetDrawLayer(nil, 0)
4544
end

0 commit comments

Comments
 (0)