From 9b2929016fb438efc33cb50d4c0a85b34116b51f Mon Sep 17 00:00:00 2001 From: Sida Wang <42928828+sida-wang@users.noreply.github.com> Date: Mon, 22 Jan 2024 02:38:19 +1100 Subject: [PATCH] Fix Cluster Jewel imports not allocating correctly (#7270) * 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 --- src/Classes/PassiveSpec.lua | 35 +++----- src/Data/ClusterJewels.lua | 158 +++++++++++++++++++++++++++++++++ src/Export/Scripts/cluster.lua | 16 ++++ src/Export/spec.lua | 4 +- 4 files changed, 189 insertions(+), 24 deletions(-) diff --git a/src/Classes/PassiveSpec.lua b/src/Classes/PassiveSpec.lua index 1da4f12c0d..e109e15bc1 100644 --- a/src/Classes/PassiveSpec.lua +++ b/src/Classes/PassiveSpec.lua @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/src/Data/ClusterJewels.lua b/src/Data/ClusterJewels.lua index 2bb891bfc5..c3e07bc25a 100644 --- a/src/Data/ClusterJewels.lua +++ b/src/Data/ClusterJewels.lua @@ -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, + }, + }, } \ No newline at end of file diff --git a/src/Export/Scripts/cluster.lua b/src/Export/Scripts/cluster.lua index a56f703ee3..d761795e98 100644 --- a/src/Export/Scripts/cluster.lua +++ b/src/Export/Scripts/cluster.lua @@ -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() diff --git a/src/Export/spec.lua b/src/Export/spec.lua index 34baa0b363..b4b2ee0b80 100644 --- a/src/Export/spec.lua +++ b/src/Export/spec.lua @@ -8719,8 +8719,8 @@ return { width=210 }, [7]={ - list=false, - name="", + list=true, + name="StartIndices", refTo="", type="Int", width=150