Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Against the Darkness applying to all Jewel sockets + fix reistances not updating in side bar #2

Merged
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
13 changes: 7 additions & 6 deletions src/Classes/ItemsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Contro
self.slots = { }
self.orderedSlots = { }
self.slotOrder = { }
self.initSockets = true
self.slotAnchor = new("Control", {"TOPLEFT",self,"TOPLEFT"}, {96, 76, 310, 0})
local prevSlot = self.slotAnchor
local function addSlot(slot)
Expand Down Expand Up @@ -1231,27 +1232,28 @@ end
-- Updates the status and position of the socket controls
function ItemsTabClass:UpdateSockets()
-- Build a list of active sockets
local activeSocketList = { }
self.activeSocketList = { }
for nodeId, slot in pairs(self.sockets) do
if self.build.spec.allocNodes[nodeId] then
t_insert(activeSocketList, nodeId)
t_insert(self.activeSocketList, nodeId)
slot.inactive = false
else
slot.inactive = true
end
end
table.sort(activeSocketList)
table.sort(self.activeSocketList)

-- Update the state of the active socket controls
self.lastSlot = self.slots[baseSlots[#baseSlots]]
for index, nodeId in ipairs(activeSocketList) do
for index, nodeId in ipairs(self.activeSocketList) do
self.sockets[nodeId].label = "Socket #"..index
self.lastSlot = self.sockets[nodeId]
end

if main.portraitMode then
self.controls.itemList:SetAnchor("TOPRIGHT",self.lastSlot,"BOTTOMRIGHT", 0, 40)
end
self.initSockets = false
end

-- Returns the slot control and equipped jewel for the given node ID
Expand Down Expand Up @@ -1726,8 +1728,7 @@ function ItemsTabClass:UpdateDisplayItemRangeLines()
wipeTable(self.controls.displayItemRangeLine.list)
for _, modLine in ipairs(self.displayItem.rangeLineList) do
-- primarily for Against the Darkness // a way to cut down on really long modLines, gsub could be updated for others
local rangeLine = modLine.line:gsub(" Passive Skills in Radius also grant", ":")
t_insert(self.controls.displayItemRangeLine.list, rangeLine)
t_insert(self.controls.displayItemRangeLine.list, (modLine.line:gsub(" Passive Skills in Radius also grant", ":")))
end
self.controls.displayItemRangeLine.selIndex = 1
self.controls.displayItemRangeSlider.val = self.displayItem.rangeLineList[1].range
Expand Down
27 changes: 22 additions & 5 deletions src/Modules/CalcSetup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ local function setRadiusJewelStats(radiusJewel, radiusJewelStats)
end
end

local function addStatsFromJewelToNode(jewel, node, spec)
local function addStats(jewel, node, spec)
-- reset node stats to base or override for attributes
if spec.hashOverrides and spec.hashOverrides[node.id] then
node.sd = copyTable(spec.hashOverrides[node.id].sd, true)
else
node.sd = copyTable(spec.tree.nodes[node.id].sd, true)
end

local radiusJewelStats = { }
setRadiusJewelStats(jewel, radiusJewelStats)
for _, stat in ipairs(radiusJewelStats) do
Expand All @@ -142,8 +142,23 @@ local function addStatsFromJewelToNode(jewel, node, spec)
end
end
spec.tree:ProcessStats(node)
return node.modList
end

local function addStatsFromJewelToNode(jewel, node, spec)
local itemsTab = spec.build.itemsTab
--
if itemsTab.activeSocketList then
for _, nodeId in pairs(itemsTab.activeSocketList) do
local _, socketedJewel = itemsTab:GetSocketAndJewelForNodeID(nodeId)
if socketedJewel and socketedJewel.title == "Against the Darkness" then
return addStats(jewel, node, spec)
end
end
elseif itemsTab.initSockets then
return addStats(jewel, node, spec)
end
end
function calcs.buildModListForNode(env, node, incSmallPassiveSkill)
local modList = new("ModList")
if node.type == "Keystone" then
Expand Down Expand Up @@ -175,7 +190,8 @@ function calcs.buildModListForNode(env, node, incSmallPassiveSkill)
if rad.item.title ~= "Against the Darkness" then
rad.func(node, modList, rad.data)
else
addStatsFromJewelToNode(rad, node, env.build.spec)
local nodeList = addStatsFromJewelToNode(rad, node, env.build.spec)
if nodeList then modList = nodeList end
end
end
end
Expand All @@ -198,11 +214,12 @@ function calcs.buildModListForNode(env, node, incSmallPassiveSkill)
if rad.item.title ~= "Against the Darkness" then
rad.func(node, modList, rad.data)
else
addStatsFromJewelToNode(rad, node, env.build.spec)
local nodeList = addStatsFromJewelToNode(rad, node, env.build.spec)
if nodeList then modList = nodeList end
end
end
end

if modList:Flag(nil, "PassiveSkillHasOtherEffect") then
for i, mod in ipairs(modList:List(skillCfg, "NodeModifier")) do
if i == 1 then wipeTable(modList) end
Expand Down
Loading