Skip to content

Commit

Permalink
Revert Cluster Jewel import
Browse files Browse the repository at this point in the history
  • Loading branch information
LocalIdentity authored and Wires77 committed Mar 23, 2024
1 parent e6ff29c commit 2394f1b
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions src/Classes/PassiveSpec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1337,9 +1337,7 @@ function PassiveSpecClass:BuildClusterJewelGraphs()
node.alloc = true
if not self.allocNodes[nodeId] then
self.allocNodes[nodeId] = node
if not isValueInArray(self.allocExtendedNodes, nodeId) then
t_insert(self.allocExtendedNodes, nodeId)
end
t_insert(self.allocExtendedNodes, nodeId)
end
end
end
Expand Down Expand Up @@ -1429,10 +1427,6 @@ function PassiveSpecClass:BuildSubgraph(jewel, parentSocket, id, upSize, importe
end

local function addToAllocatedSubgraphNodes(node)
-- Don't add to allocSubgraphNodes if node already exists
if isValueInArray(self.allocSubgraphNodes, node.id) then
return false
end
local proxyGroup = matchGroup(expansionJewel.proxy)
if proxyGroup then
for id, data in pairs(importedNodes) do
Expand Down Expand Up @@ -1479,6 +1473,7 @@ function PassiveSpecClass:BuildSubgraph(jewel, parentSocket, id, upSize, importe
self.nodes[node.id] = node
if addToAllocatedSubgraphNodes(node) then
t_insert(self.allocSubgraphNodes, node.id)
t_insert(self.allocExtendedNodes, node.id)
end
return
end
Expand All @@ -1493,6 +1488,21 @@ function PassiveSpecClass:BuildSubgraph(jewel, parentSocket, id, upSize, importe
end
end

-- Check if we need to downsize the group
local groupSize = expansionJewel.size
upSize = upSize or 0
while clusterJewel.sizeIndex < groupSize do
-- Look for the socket with index 1 first (middle socket of large groups), then index 0
local socket = findSocket(proxyGroup, 1) or findSocket(proxyGroup, 0)
assert(socket, "Downsizing socket not found")

-- Grab the proxy node/group from the socket
proxyNode = self.tree.nodes[tonumber(socket.expansionJewel.proxy)]
proxyGroup = proxyNode.group
groupSize = socket.expansionJewel.size
upSize = upSize + 1
end

-- Initialise orbit flags
local nodeOrbit = clusterJewel.sizeIndex + 1
subGraph.group.oo[nodeOrbit] = true
Expand Down Expand Up @@ -1704,14 +1714,13 @@ function PassiveSpecClass:BuildSubgraph(jewel, parentSocket, id, upSize, importe
return m_floor(srcOidx * destNodesPerOrbit / srcNodesPerOrbit)
end
end

local skillsPerOrbit = self.tree.skillsPerOrbit[clusterJewel.sizeIndex+2]
local startOidx = data.clusterJewels.orbitOffsets[proxyNode.id][clusterJewel.sizeIndex]
local proxyNodeSkillsPerOrbit = self.tree.skillsPerOrbit[proxyNode.o+1]

-- Translate oidx positioning to TreeData-relative values
for _, node in pairs(indicies) do
local startOidxRelativeToClusterIndicies = translateOidx(startOidx, skillsPerOrbit, clusterJewel.totalIndicies)
local correctedNodeOidxRelativeToClusterIndicies = (node.oidx + startOidx) % clusterJewel.totalIndicies
local correctedNodeOidxRelativeToTreeSkillsPerOrbit = translateOidx(correctedNodeOidxRelativeToClusterIndicies, clusterJewel.totalIndicies, skillsPerOrbit)
local proxyNodeOidxRelativeToClusterIndicies = translateOidx(proxyNode.oidx, proxyNodeSkillsPerOrbit, clusterJewel.totalIndicies)
local correctedNodeOidxRelativeToClusterIndicies = (node.oidx + proxyNodeOidxRelativeToClusterIndicies) % clusterJewel.totalIndicies
local correctedNodeOidxRelativeToTreeSkillsPerOrbit = translateOidx(correctedNodeOidxRelativeToClusterIndicies, clusterJewel.totalIndicies, proxyNodeSkillsPerOrbit)
node.oidx = correctedNodeOidxRelativeToTreeSkillsPerOrbit
end

Expand Down

0 comments on commit 2394f1b

Please sign in to comment.