Skip to content

Commit

Permalink
Fix Cluster Jewel imports not allocating correctly (#7270)
Browse files Browse the repository at this point in the history
* fix: cluster jewel imports not working

- Tidy up in BuildClusterJewelGraphs() to prevent allocSubgraphNodes and allocExtendedNodes from having duplicate nodes
- Add in orbitOffsets into ClusterJewels.lua via export. Credit to Wires77 #4302 for figuring this out
- Update the logic that calculates the orbitIndex in BuildSubgraph to use orbitOffsets

* Revert launch.lua

---------

Co-authored-by: LocalIdentity <localidentity2@gmail.com>
  • Loading branch information
sida-wang and LocalIdentity authored Jan 21, 2024
1 parent 954580a commit 9b29290
Show file tree
Hide file tree
Showing 4 changed files with 189 additions and 24 deletions.
35 changes: 13 additions & 22 deletions src/Classes/PassiveSpec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,9 @@ function PassiveSpecClass:BuildClusterJewelGraphs()
node.alloc = true
if not self.allocNodes[nodeId] then
self.allocNodes[nodeId] = node
t_insert(self.allocExtendedNodes, nodeId)
if not isValueInArray(self.allocExtendedNodes, nodeId) then
t_insert(self.allocExtendedNodes, nodeId)
end
end
end
end
Expand Down Expand Up @@ -1427,6 +1429,10 @@ 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 @@ -1473,7 +1479,6 @@ 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 @@ -1488,21 +1493,6 @@ 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 @@ -1714,13 +1704,14 @@ function PassiveSpecClass:BuildSubgraph(jewel, parentSocket, id, upSize, importe
return m_floor(srcOidx * destNodesPerOrbit / srcNodesPerOrbit)
end
end
local proxyNodeSkillsPerOrbit = self.tree.skillsPerOrbit[proxyNode.o+1]


local skillsPerOrbit = self.tree.skillsPerOrbit[clusterJewel.sizeIndex+2]
local startOidx = data.clusterJewels.orbitOffsets[proxyNode.id][clusterJewel.sizeIndex]
-- Translate oidx positioning to TreeData-relative values
for _, node in pairs(indicies) do
local proxyNodeOidxRelativeToClusterIndicies = translateOidx(proxyNode.oidx, proxyNodeSkillsPerOrbit, clusterJewel.totalIndicies)
local correctedNodeOidxRelativeToClusterIndicies = (node.oidx + proxyNodeOidxRelativeToClusterIndicies) % clusterJewel.totalIndicies
local correctedNodeOidxRelativeToTreeSkillsPerOrbit = translateOidx(correctedNodeOidxRelativeToClusterIndicies, clusterJewel.totalIndicies, proxyNodeSkillsPerOrbit)
local startOidxRelativeToClusterIndicies = translateOidx(startOidx, skillsPerOrbit, clusterJewel.totalIndicies)
local correctedNodeOidxRelativeToClusterIndicies = (node.oidx + startOidx) % clusterJewel.totalIndicies
local correctedNodeOidxRelativeToTreeSkillsPerOrbit = translateOidx(correctedNodeOidxRelativeToClusterIndicies, clusterJewel.totalIndicies, skillsPerOrbit)
node.oidx = correctedNodeOidxRelativeToTreeSkillsPerOrbit
end

Expand Down
158 changes: 158 additions & 0 deletions src/Data/ClusterJewels.lua
Original file line number Diff line number Diff line change
Expand Up @@ -890,4 +890,162 @@ return {
"Hollow Palm Technique",
"Pitfighter",
},
orbitOffsets = {
[43989] = {
[0] = 3,
[1] = 5,
[2] = 5,
},
[25134] = {
[0] = 0,
[1] = 11,
[2] = 11,
},
[30275] = {
[0] = 2,
[1] = 3,
[2] = 3,
},
[28650] = {
[0] = 1,
[1] = 1,
[2] = 1,
},
[48132] = {
[0] = 5,
[1] = 9,
[2] = 9,
},
[18756] = {
[0] = 4,
[1] = 7,
[2] = 7,
},
[55706] = {
[0] = 2,
[1] = 3,
},
[26661] = {
[0] = 3,
[1] = 5,
},
[13201] = {
[0] = 3,
[1] = 7,
},
[40114] = {
[0] = 1,
},
[18361] = {
[0] = 2,
},
[7956] = {
[0] = 3,
},
[51233] = {
[0] = 5,
[1] = 9,
},
[57194] = {
[0] = 5,
[1] = 11,
},
[35853] = {
[0] = 0,
[1] = 1,
},
[35313] = {
[0] = 4,
},
[44470] = {
[0] = 5,
},
[37147] = {
[0] = 0,
},
[25441] = {
[0] = 1,
[1] = 1,
},
[28018] = {
[0] = 2,
[1] = 3,
},
[53203] = {
[0] = 3,
[1] = 5,
},
[3854] = {
[0] = 0,
},
[49951] = {
[0] = 1,
},
[22046] = {
[0] = 2,
},
[37898] = {
[0] = 5,
[1] = 11,
},
[64166] = {
[0] = 1,
[1] = 1,
},
[58355] = {
[0] = 2,
[1] = 3,
},
[48128] = {
[0] = 5,
},
[27475] = {
[0] = 0,
},
[35070] = {
[0] = 1,
},
[35926] = {
[0] = 4,
[1] = 7,
},
[33833] = {
[0] = 5,
[1] = 9,
},
[50179] = {
[0] = 5,
[1] = 11,
},
[36414] = {
[0] = 3,
},
[10643] = {
[0] = 4,
},
[56439] = {
[0] = 5,
},
[58194] = {
[0] = 3,
[1] = 5,
},
[34013] = {
[0] = 4,
[1] = 7,
},
[24452] = {
[0] = 5,
[1] = 9,
},
[63754] = {
[0] = 2,
},
[54600] = {
[0] = 3,
},
[27819] = {
[0] = 4,
},
},
}
16 changes: 16 additions & 0 deletions src/Export/Scripts/cluster.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ for skill in dat("PassiveTreeExpansionSpecialSkills"):Rows() do
end
end
out:write('\t},\n')
out:write('\torbitOffsets = {\n')
for jewelSlot in dat("PassiveJewelSlots"):Rows() do
if jewelSlot.ClusterSize then
out:write('\t\t[', jewelSlot.Proxy.PassiveSkillNodeId, '] = {\n')
out:write('\t\t\t[0] = ', jewelSlot.StartIndices[1], ',\n')
if jewelSlot.StartIndices[2] then
out:write('\t\t\t[1] = ', jewelSlot.StartIndices[2], ',\n')
end
if jewelSlot.StartIndices[3] then
out:write('\t\t\t[2] = ', jewelSlot.StartIndices[3], ',\n')
end
out:write('\t\t},\n')
end
end
out:write('\t},\n')


out:write('}')
out:close()
Expand Down
4 changes: 2 additions & 2 deletions src/Export/spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8719,8 +8719,8 @@ return {
width=210
},
[7]={
list=false,
name="",
list=true,
name="StartIndices",
refTo="",
type="Int",
width=150
Expand Down

0 comments on commit 9b29290

Please sign in to comment.