Quick lookup of cluster notables

This commit is contained in:
David Clamage
2020-06-16 21:38:43 -07:00
parent e2a91beaba
commit baeebe6f38

View File

@@ -273,6 +273,44 @@ for _, targetVersion in ipairs(targetVersionList) do
-- Cluster jewel data
if targetVersion ~= "2_6" then
verData.clusterJewels = dataModule("ClusterJewels")
-- Create a quick lookup cache from cluster jewel skill to the notables which use that skill
---@type table<string, table<string>>
local clusterSkillToNotables = { }
for notableKey, notableInfo in pairs(verData.itemMods.JewelCluster) do
-- Translate the notable key to its name
local notableName = notableInfo[1] and notableInfo[1]:match("1 Added Passive Skill is (.*)")
if notableName then
for weightIndex, clusterSkill in pairs(notableInfo.weightKey) do
if notableInfo.weightVal[weightIndex] > 0 then
if not clusterSkillToNotables[clusterSkill] then
clusterSkillToNotables[clusterSkill] = { }
end
table.insert(clusterSkillToNotables[clusterSkill], notableName)
end
end
end
end
-- Create easy lookup from cluster node name -> cluster jewel size and types
verData.clusterJewelInfoForNotable = { }
for size, jewel in pairs(verData.clusterJewels.jewels) do
for skill, skillInfo in pairs(jewel.skills) do
local notables = clusterSkillToNotables[skill]
if notables then
for _, notableKey in ipairs(notables) do
if not verData.clusterJewelInfoForNotable[notableKey] then
verData.clusterJewelInfoForNotable[notableKey] = { }
verData.clusterJewelInfoForNotable[notableKey].jewelTypes = { }
verData.clusterJewelInfoForNotable[notableKey].size = { }
end
local curJewelInfo = verData.clusterJewelInfoForNotable[notableKey]
curJewelInfo.size[size] = true
table.insert(curJewelInfo.jewelTypes, skill)
end
end
end
end
end
-- Load skills