Skip to content
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
43 changes: 34 additions & 9 deletions src/Classes/PassiveTree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,22 @@ end
---@field points table<string, integer>
local PassiveTreeClass = newClass("PassiveTree")

---@param t table<string, any>
---@return table<number|string, any>
local function convertKeysToNumbers(t)
local keys = {}
for key, _ in pairs(t) do
table.insert(keys, key)
end
for _, key in ipairs(keys) do
local num = tonumber(key)
if num then
t[num] = t[key]
t[key] = nil
end
end
return t
end
function PassiveTreeClass:PassiveTree(treeVersion)
self.treeVersion = treeVersion
local versionNum = treeVersions[treeVersion].num
Expand All @@ -98,16 +114,25 @@ function PassiveTreeClass:PassiveTree(treeVersion)
ConPrintf("Downloading passive tree data...")
page = getFile("https://www.pathofexile.com/passive-skill-tree")
end
local treeData = page:match("var passiveSkillTreeData = (%b{})")
if treeData then
treeText = "local tree=" .. jsonToLua(page:match("var passiveSkillTreeData = (%b{})"))
treeText = treeText .. "return tree"
else
treeText = "return " .. jsonToLua(page)
local treeData = page:match("var passiveSkillTreeData = (%b{})") or page
-- strip ggg tooltip tags
local dkjson = require("dkjson")
local utils = require("Modules.Utils")
local json = dkjson.decode(treeData)
for _, node in pairs(json.nodes) do
if node.masteryEffects then
for _, fx in ipairs(node.masteryEffects) do
for i, stat in ipairs(fx.stats) do
fx.stats[i] = escapeGGGString(stat)
end
end
end
end
treeFile = io.open("TreeData/"..treeVersion.."/tree.lua", "w")
treeFile:write(treeText)
treeFile:close()
-- convert node and group keys to numbers
convertKeysToNumbers(json.nodes)
convertKeysToNumbers(json.groups)
local _, contents = utils.saveTableToFile("TreeData/" .. treeVersion .. "/tree.lua", json, nil, true)
treeText = contents
end
for k, v in pairs(assert(loadstring(treeText))()) do
self[k] = v
Expand Down
260 changes: 134 additions & 126 deletions src/Data/ModCache.lua

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion src/GameVersions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ liveTargetVersion = "3_0"
---@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", "3_17", "3_18", "3_19", "3_20", "3_21",
"3_22_ruthless", "3_22", "3_23_ruthless", "3_23", "3_24_ruthless", "3_24", "3_25_ruthless", "3_25_ruthless_alternate", "3_25_alternate", "3_25",
"3_26_ruthless", "3_26_ruthless_alternate", "3_26_alternate", "3_26", "3_27_ruthless", "3_27_ruthless_alternate", "3_27_alternate", "3_27", "3_28_ruthless", "3_28_ruthless_alternate", "3_28_alternate", "3_28", "3_29_ruthless", "3_29" }
"3_26_ruthless", "3_26_ruthless_alternate", "3_26_alternate", "3_26", "3_27_ruthless", "3_27_ruthless_alternate", "3_27_alternate", "3_27", "3_28_ruthless", "3_28_ruthless_alternate", "3_28_alternate", "3_28", "3_29_ruthless", "3_29", "3_30_ruthless", "3_30" }
--- 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 @@ -223,6 +223,16 @@ treeVersions = {
num = 3.29,
url = "https://www.pathofexile.com/passive-skill-tree/3.29.0/",
},
["3_30_ruthless"] = {
display = "3.30 (ruthless)",
num = 3.30,
url = "https://www.pathofexile.com/passive-skill-tree/ruthless/"
},
["3_30"] = {
display = "3.30",
num = 3.30,
url = "https://www.pathofexile.com/passive-skill-tree/3.30.0/",
},
}

---Mapping PoEPlanner.com version when importing trees from there (https://cdn.poeplanner.com/json/versions.json)
Expand Down
34 changes: 31 additions & 3 deletions src/Modules/ModParser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1576,6 +1576,7 @@ local modTagList = {
["w?h?i[lf]e? you have at least (%d+) maximum energy shield"] = function(num) return { tag = { type = "StatThreshold", stat = "EnergyShield", threshold = num } } end,
["against targets they pierce"] = { tag = { type = "StatThreshold", stat = "PierceCount", threshold = 1 } },
["against pierced targets"] = { tag = { type = "StatThreshold", stat = "PierceCount", threshold = 1 } },
["against enemies within ([%d%.]+) metres?"] = function(num) return { tag = { type = "DistanceRamp", ramp = { { num * 10, 1 }, { num * 10, 0 } } } } end,
["to targets they pierce"] = { tag = { type = "StatThreshold", stat = "PierceCount", threshold = 1 } },
["that fire a single projectile"] = { tag = { type = "StatThreshold", stat = "ProjectileCount", threshold = 1, upper = true } },
["w?h?i[lf]e? you have at least (%d+) devotion"] = function(num) return { tag = { type = "StatThreshold", stat = "Devotion", threshold = num } } end,
Expand Down Expand Up @@ -7006,6 +7007,25 @@ local function parseMod(line, order)
return modList, line:match("%S") and line
end

local function parseModOrdered(line)
local modList, extra = parseMod(line, 1)
if modList and extra then
modList, extra = parseMod(line, 2)
end
return modList, extra
end

local nearbyRewrites = {
{ "^enemy monsters within [%d%.]+ metres? have ", "nearby enemy monsters' " },
{ "while at least (%d+) enemies within [%d%.]+ metres?", "while at least %1 enemies are nearby" },
{ "while you have an ally within [%d%.]+ metres?", "while you have at least 1 nearby ally" },
{ "when you or allies within [%d%.]+ metres?", "when you or a nearby ally" },
-- spell-checker: disable
{ "(rare or unique enem%a+) within [%d%.]+ metres?", "%1 nearby" },
-- spell-checker: enable
{ "(applies .- to enemies) within [%d%.]+ metres?", "%1 near it" },
{ "(%a+) within [%d%.]+ metres?", "nearby %1" },
}
local cache = { }
local unsupported = { }
local count = 0
Expand All @@ -7014,9 +7034,17 @@ local count = 0
return {
parseMod = function(line, isComb)
if not cache[line] then
local modList, extra = parseMod(line, 1)
if modList and extra then
modList, extra = parseMod(line, 2)
local modList, extra = parseModOrdered(line)
local nearbyLine = (not modList or extra) and line:lower()
-- 3.30 replaced "nearby" with explicit distances. Lines that don't parse are retried with the old wording
if nearbyLine and nearbyLine:find("within [%d%.]+ metre") then
for _, rewrite in ipairs(nearbyRewrites) do
nearbyLine = nearbyLine:gsub(rewrite[1], rewrite[2])
end
local nearbyModList, nearbyExtra = parseModOrdered(nearbyLine)
if nearbyModList and not nearbyExtra then
modList, extra = nearbyModList, nil
end
end
cache[line] = { modList, extra }
if foo and not isComb and not cache[line][1] then
Expand Down
3 changes: 2 additions & 1 deletion src/Modules/Utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ end
---@param description? string A string which will be passed to string.format and which should describe what this file contains. Multi-line strings are supported.
---@param allowMultiLine? boolean Whether multi-line strings should be allowed. If not, they are converted to spaces.
---@return boolean success
---@return string contents
function M.saveTableToFile(fileName, table, description, allowMultiLine)
local f, openErr = io.open(fileName, "w")
if not f then
Expand Down Expand Up @@ -119,7 +120,7 @@ return %s
error(string.format("Failed to write to %s: %s", fileName, writeErr))
end

return f:close() or false
return f:close() or false, contents
end

return M
Binary file added src/TreeData/3_30/ascendancy-3.webp
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_30/background-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_30/bloodline-3.webp
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_30/frame-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_30/group-background-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_30/line-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_30/mastery-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_30/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_30/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_30/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_30/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_30/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_30/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
Loading