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

feat: add 3.17 skill tree (with support for new skillsPerOrbit values) #3972

Merged
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
96 changes: 34 additions & 62 deletions src/Classes/PassiveTree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,34 @@ local classArt = {
[6] = "centershadow"
}

local orbit4Angle = { [0] = 0, 10, 20, 30, 40, 45, 50, 60, 70, 80, 90, 100, 110, 120, 130, 135, 140, 150, 160, 170, 180, 190, 200, 210, 220, 225, 230, 240, 250, 260, 270, 280, 290, 300, 310, 315, 320, 330, 340, 350 }
for i, ang in ipairs(orbit4Angle) do
orbit4Angle[i] = m_rad(ang)
end
local orbitMult = { [0] = 0, m_pi / 3, m_pi / 6, m_pi / 6, m_pi / 6, m_pi / 36, m_pi / 36 }
local orbitDist = { [0] = 0, 82, 162, 335, 493, 662, 845 }
-- These values are from the 3.6 tree; older trees are missing values for these constants
local legacySkillsPerOrbit = { 1, 6, 12, 12, 40 }
local legacyOrbitRadii = { 0, 82, 162, 335, 493 }

local function calculateOrbitAngles(skillsPerOrbit)
local orbitAngles = {}
ConPrintf("== calculateOrbitAngles ==")
for orbit, skillsInOrbit in ipairs(skillsPerOrbit) do
if skillsInOrbit == 16 then
-- Every 30 and 45 degrees, per https://github.com/grindinggear/skilltree-export/blob/3.17.0/README.md
orbitAngles[orbit] = { 0, 30, 45, 60, 90, 120, 135, 150, 180, 210, 225, 240, 270, 300, 315, 330 }
elseif skillsInOrbit == 40 then
-- Every 10 and 45 degrees
orbitAngles[orbit] = { 0, 10, 20, 30, 40, 45, 50, 60, 70, 80, 90, 100, 110, 120, 130, 135, 140, 150, 160, 170, 180, 190, 200, 210, 220, 225, 230, 240, 250, 260, 270, 280, 290, 300, 310, 315, 320, 330, 340, 350 }
else
-- Uniformly spaced
orbitAngles[orbit] = {}
for i = 0, skillsInOrbit do
orbitAngles[orbit][i + 1] = 360 * i / skillsInOrbit
end
end

for i, degrees in ipairs(orbitAngles[orbit]) do
orbitAngles[orbit][i] = m_rad(degrees)
end
end
return orbitAngles
end

-- Retrieve the file at the given URL
local function getFile(URL)
Expand Down Expand Up @@ -122,6 +143,9 @@ local PassiveTreeClass = newClass("PassiveTree", function(self, treeVersion)
end
end

self.orbitAngles = calculateOrbitAngles(self.constants.skillsPerOrbit or legacySkillsPerOrbit)
self.orbitRadii = self.constants.orbitRadii or legacyOrbitRadii

ConPrintf("Loading passive tree assets...")
for name, data in pairs(self.assets) do
self:LoadImage(name..".png", cdnRoot..(data[0.3835] or data[1]), data, not name:match("[OL][ri][bn][ie][tC]") and "ASYNC" or nil)--, not name:match("[OL][ri][bn][ie][tC]") and "MIPMAP" or nil)
Expand Down Expand Up @@ -262,50 +286,6 @@ local PassiveTreeClass = newClass("PassiveTree", function(self, treeVersion)
self.sockets = { }
self.masteryEffects = { }
local nodeMap = { }
local orbitMult = { [0] = 0, m_pi / 3, m_pi / 6, m_pi / 6, m_pi / 6, m_pi / 36, m_pi / 36 }
local orbitMultFull = {
[0] = 0,
[1] = 10 * m_pi / 180,
[2] = 20 * m_pi / 180,
[3] = 30 * m_pi / 180,
[4] = 40 * m_pi / 180,
[5] = 45 * m_pi / 180,
[6] = 50 * m_pi / 180,
[7] = 60 * m_pi / 180,
[8] = 70 * m_pi / 180,
[9] = 80 * m_pi / 180,
[10] = 90 * m_pi / 180,
[11] = 100 * m_pi / 180,
[12] = 110 * m_pi / 180,
[13] = 120 * m_pi / 180,
[14] = 130 * m_pi / 180,
[15] = 135 * m_pi / 180,
[16] = 140 * m_pi / 180,
[17] = 150 * m_pi / 180,
[18] = 160 * m_pi / 180,
[19] = 170 * m_pi / 180,
[20] = 180 * m_pi / 180,
[21] = 190 * m_pi / 180,
[22] = 200 * m_pi / 180,
[23] = 210 * m_pi / 180,
[24] = 220 * m_pi / 180,
[25] = 225 * m_pi / 180,
[26] = 230 * m_pi / 180,
[27] = 240 * m_pi / 180,
[28] = 250 * m_pi / 180,
[29] = 260 * m_pi / 180,
[30] = 270 * m_pi / 180,
[31] = 280 * m_pi / 180,
[32] = 290 * m_pi / 180,
[33] = 300 * m_pi / 180,
[34] = 310 * m_pi / 180,
[35] = 315 * m_pi / 180,
[36] = 320 * m_pi / 180,
[37] = 330 * m_pi / 180,
[38] = 340 * m_pi / 180,
[39] = 350 * m_pi / 180
}
local orbitDist = { [0] = 0, 82, 162, 335, 493, 662, 845 }
for _, node in pairs(self.nodes) do
-- Migration...
if versionNum < 3.10 then
Expand Down Expand Up @@ -381,14 +361,6 @@ local PassiveTreeClass = newClass("PassiveTree", function(self, treeVersion)
if node.isAscendancyStart then
group.isAscendancyStart = true
end
if node.o ~= 4 then
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is safe to remove since self:ProcessNode gets called a few lines down anyway and will do the same calculation

node.angle = node.oidx * orbitMult[node.o]
else
node.angle = orbitMultFull[node.oidx]
end
local dist = orbitDist[node.o]
node.x = group.x + m_sin(node.angle) * dist
node.y = group.y - m_cos(node.angle) * dist
elseif node.type == "Notable" or node.type == "Keystone" then
self.clusterNodeMap[node.dn] = node
end
Expand Down Expand Up @@ -578,10 +550,10 @@ function PassiveTreeClass:ProcessNode(node)

-- Derive the true position of the node
if node.group then
node.angle = node.o == 4 and orbit4Angle[node.oidx] or node.oidx * orbitMult[node.o]
local dist = orbitDist[node.o]
node.x = node.group.x + m_sin(node.angle) * dist
node.y = node.group.y - m_cos(node.angle) * dist
node.angle = self.orbitAngles[node.o + 1][node.oidx + 1]
local orbitRadius = self.orbitRadii[node.o + 1]
node.x = node.group.x + m_sin(node.angle) * orbitRadius
node.y = node.group.y - m_cos(node.angle) * orbitRadius
end

self:ProcessStats(node)
Expand Down
7 changes: 6 additions & 1 deletion src/GameVersions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ liveTargetVersion = "3_0"
-- Skill tree versions
---Added for convenient indexing of skill tree versions.
---@type string[]
treeVersionList = { "2_6", "3_6", "3_7", "3_8", "3_9", "3_10", "3_11", "3_12", "3_13", "3_14", "3_15", "3_16" }
treeVersionList = { "2_6", "3_6", "3_7", "3_8", "3_9", "3_10", "3_11", "3_12", "3_13", "3_14", "3_15", "3_16", "3_17", }
--- Always points to the latest skill tree version.
latestTreeVersion = treeVersionList[#treeVersionList]
---Tree version where multiple skill trees per build were introduced to PoBC.
Expand Down Expand Up @@ -75,4 +75,9 @@ treeVersions = {
num = 3.16,
url = "https://www.pathofexile.com/passive-skill-tree/3.16.0/",
},
["3_17"] = {
display = "3.17",
num = 3.17,
url = "https://www.pathofexile.com/passive-skill-tree/3.17.0/",
},
}
Binary file added src/TreeData/3_17/mastery-active-effect-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/TreeData/3_17/mastery-active-selected-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/TreeData/3_17/mastery-connected-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/TreeData/3_17/mastery-disabled-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/TreeData/3_17/skills-3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/TreeData/3_17/skills-disabled-3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading