Skip to content

Commit 4a8a919

Browse files
justjuanguijustjuanguiLocalIdentity
authored
Add support for Abyssal Lich Ascendancy (#1238)
* Fix hardcoded ascendancy jewel socket in export script * Fix ascedancy background position when a new ascendancy appear * Fix ascendency filtering logic to use 'Replace' property * Add Ascendancy replacement feature * feat enable Abyss Lich in passive tree * Remove bullet points from nodes --------- Co-authored-by: justjuangui <servicios@juacarvajal.com> Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent 64d7b0d commit 4a8a919

15 files changed

Lines changed: 1347 additions & 983 deletions

src/Classes/PassiveSpec.lua

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -972,8 +972,12 @@ function PassiveSpecClass:BuildAllDependsAndPaths()
972972
-- ignore cluster jewel nodes that don't have an id in the tree
973973
if self.tree.nodes[id] then
974974
local nodeToReplace = self.tree.nodes[id]
975-
if self.tree.nodes[id].isSwitchable and self.tree.nodes[id].options[self.curClassName] then
976-
nodeToReplace = self.tree.nodes[id].options[self.curClassName]
975+
if self.tree.nodes[id].isSwitchable then
976+
if self.tree.nodes[id].options[self.curClassName] then
977+
nodeToReplace = self.tree.nodes[id].options[self.curClassName]
978+
elseif self.tree.nodes[id].options[self.curAscendClassName] then
979+
nodeToReplace = self.tree.nodes[id].options[self.curAscendClassName]
980+
end
977981
self.switchableNodes[nodeToReplace.id] = node
978982
end
979983
self:ReplaceNode(node, nodeToReplace)
@@ -1415,6 +1419,8 @@ function PassiveSpecClass:BuildAllDependsAndPaths()
14151419
end
14161420

14171421
function PassiveSpecClass:ReplaceNode(old, newNode)
1422+
old.overlay = newNode.overlay
1423+
old.icon = newNode.icon
14181424
-- Edited nodes can share a name
14191425
if old.sd == newNode.sd then
14201426
return 1
@@ -1426,8 +1432,6 @@ function PassiveSpecClass:ReplaceNode(old, newNode)
14261432
old.modList = new("ModList")
14271433
old.modList:AddList(newNode.modList)
14281434
old.keystoneMod = newNode.keystoneMod
1429-
old.icon = newNode.icon
1430-
old.spriteId = newNode.spriteId
14311435
old.activeEffectImage = newNode.activeEffectImage
14321436
old.reminderText = newNode.reminderText or { }
14331437
end

src/Classes/PassiveTree.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,12 @@ local PassiveTreeClass = newClass("PassiveTree", function(self, treeVersion)
230230
node.type = "AscendClassStart"
231231
local ascendClass = self.ascendNameMap[node.ascendancyName].ascendClass
232232
ascendClass.startNodeId = node.id
233+
if node.isSwitchable then
234+
for ascName, _ in pairs(node.options) do
235+
local option = self.ascendNameMap[ascName].ascendClass
236+
option.startNodeId = node.id
237+
end
238+
end
233239
elseif node.isOnlyImage then
234240
node.type = "OnlyImage"
235241
elseif node.isJewelSocket then
@@ -550,6 +556,16 @@ function PassiveTreeClass:ProcessNode(node)
550556
switchNode.dn = switchNode.name
551557
switchNode.sd = switchNode.stats
552558

559+
if switchNode.jewelOverlay then
560+
ConPrintf("SwitchNode with jewelOverlay found: "..switchNode.name)
561+
switchNode.overlay = switchNode.jewelOverlay
562+
if switchNode.overlay then
563+
local size = node.targetSize["overlay"] and node.targetSize["overlay"].width or node.targetSize.width
564+
switchNode.rsq = size * size
565+
switchNode.size = size
566+
end
567+
end
568+
553569
self:ProcessStats(switchNode)
554570
end
555571
end

src/Classes/PassiveTreeView.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,14 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
421421
-- draw ascendancies
422422
for name, data in pairs(tree.ascendNameMap) do
423423
local ascendancy = data.ascendClass
424-
if ascendancy.background then
424+
local drawn = true
425+
if ascendancy.replaceBy and ascendancy.replaceBy == spec.curAscendClassBaseName then
426+
drawn = false
427+
elseif ascendancy.replace and name ~= spec.curAscendClassBaseName then
428+
drawn = false
429+
end
430+
431+
if ascendancy.background and drawn then
425432
local bg = tree:GetAssetByName(ascendancy.background.image)
426433
local scrX, scrY = treeToScreen(ascendancy.background.x * tree.scaleImage, ascendancy.background.y * tree.scaleImage)
427434
bg.width = ascendancy.background.width

src/Data/ModCache.lua

Lines changed: 44 additions & 30 deletions
Large diffs are not rendered by default.

src/Export/Scripts/passivetree.lua

Lines changed: 105 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ local tree = {
615615
}
616616

617617
printf("Generating classes...")
618+
local ascedancyReplacements = {}
618619
for i, classId in ipairs(psg.passives) do
619620
local passiveRow = dat("passiveskills"):GetRow("PassiveSkillNodeId", classId)
620621
if passiveRow == nil then
@@ -665,14 +666,18 @@ for i, classId in ipairs(psg.passives) do
665666

666667
local ascendancies = dat("ascendancy"):GetRowList("Class", character)
667668
for k, ascendency in ipairs(ascendancies) do
668-
if ascendency.Name:find(ignoreFilter) ~= nil or ascendency.isDisabled or ascendency.Id == "Witch3b" then
669+
if ascendency.Name:find(ignoreFilter) ~= nil or ascendency.isDisabled then
669670
printf("Ignoring ascendency " .. ascendency.Name .. " for class " .. character.Name)
670671
goto continue3
671672
end
673+
if ascendency.Replace then
674+
ascedancyReplacements[ascendency.Replace.Name] = ascendency.Name
675+
end
672676
table.insert(classDef.ascendancies, {
673677
["id"] = ascendency.Name,
674678
["name"] = ascendency.Name,
675679
["internalId"] = ascendency.Id,
680+
["replace"] = ascendency.Replace and ascendency.Replace.Name or nil,
676681
["background"] = {
677682
image = "Classes" .. ascendency.Name,
678683
section = "AscendancyBackground",
@@ -815,8 +820,7 @@ for i, group in ipairs(psg.groups) do
815820
if passiveRow.JewelSocket then
816821
node["containJewelSocket"] = true
817822

818-
local uioverride = dat("passiveskilltreenodeframeart"):GetRow("Id", "LichAscendancyJewel")
819-
823+
local uioverride = passiveRow.Ascendancy.UIArt.JewelFrame
820824
if uioverride then
821825
local uiSocketNormal = uiImages[string.lower(uioverride.Normal)]
822826
addToSheet(getSheet("group-background"), uiSocketNormal.path, "frame", commonMetadata(nil))
@@ -986,6 +990,63 @@ for i, group in ipairs(psg.groups) do
986990
}
987991
end
988992

993+
if passiveRow.Ascendancy and ascedancyReplacements[passiveRow.Ascendancy.Name] then
994+
node["isSwitchable"] = true
995+
local ascendancyRow = dat("ascendancy"):GetRow("Name", ascedancyReplacements[passiveRow.Ascendancy.Name])
996+
997+
local nodeInfo = {
998+
["ascendancyName"] = ascedancyReplacements[passiveRow.Ascendancy.Name]
999+
}
1000+
1001+
local switchNode = dat("ascendancypassiveskilloverrides"):GetRow("OriginalNode", passiveRow)
1002+
if switchNode then
1003+
nodeInfo.id = switchNode.SwitchedNode.PassiveSkillNodeId
1004+
nodeInfo.name = switchNode.SwitchedNode.Name
1005+
nodeInfo.icon = switchNode.SwitchedNode.Icon
1006+
nodeInfo.stats = {}
1007+
1008+
-- add to assets
1009+
addToSheet(getSheet("skills"), switchNode.SwitchedNode.Icon, "normalActive", commonMetadata(nil))
1010+
addToSheet(getSheet("skills-disabled"), switchNode.SwitchedNode.Icon, "normalInactive", commonMetadata(nil))
1011+
1012+
-- Stats
1013+
if switchNode.SwitchedNode.Stats ~= nil then
1014+
local parseStats = {}
1015+
for k, stat in ipairs(switchNode.SwitchedNode.Stats) do
1016+
parseStats[stat.Id] = { min = switchNode.SwitchedNode["Stat" .. k], max = switchNode.SwitchedNode["Stat" .. k] }
1017+
end
1018+
local out, orders = describeStats(parseStats)
1019+
for k, line in ipairs(out) do
1020+
table.insert(nodeInfo["stats"], line)
1021+
end
1022+
end
1023+
end
1024+
1025+
if passiveRow.JewelSocket and ascendancyRow.UIArt.JewelFrame then
1026+
-- override the jewel socket assets if any
1027+
local uioverride = ascendancyRow.UIArt.JewelFrame
1028+
1029+
local uiSocketNormal = uiImages[string.lower(uioverride.Normal)]
1030+
addToSheet(getSheet("group-background"), uiSocketNormal.path, "frame", commonMetadata(nil))
1031+
1032+
local uiSocketActive = uiImages[string.lower(uioverride.Active)]
1033+
addToSheet(getSheet("group-background"), uiSocketActive.path, "frame", commonMetadata(nil))
1034+
1035+
local uiSocketCanAllocate = uiImages[string.lower(uioverride.CanAllocate)]
1036+
addToSheet(getSheet("group-background"), uiSocketCanAllocate.path, "frame", commonMetadata(nil))
1037+
1038+
nodeInfo.jewelOverlay = {
1039+
alloc = uiSocketActive.path,
1040+
path = uiSocketCanAllocate.path,
1041+
unalloc = uiSocketNormal.path,
1042+
}
1043+
end
1044+
1045+
node["options"] = {
1046+
[ascedancyReplacements[passiveRow.Ascendancy.Name]] = nodeInfo
1047+
}
1048+
end
1049+
9891050
-- classStartName
9901051
if #passiveRow.ClassStart > 0 then
9911052
node["classesStart"] = {}
@@ -1109,6 +1170,11 @@ for i, classId in ipairs(psg.passives) do
11091170
for _, class in ipairs(classes) do
11101171
for _, ascendancy in ipairs(class.ascendancies) do
11111172
printf("Positioning ascendancy " .. ascendancy.name .. " for class " .. class.name)
1173+
1174+
local angle = startAngle + (j - 1) * angleStep
1175+
local cX = hardCoded * math.cos(angle)
1176+
local cY = hardCoded * math.sin(angle)
1177+
11121178
local info = ascendancyGroups[ascendancy.id]
11131179
if info == nil then
11141180
printf("Ascendancy group " .. ascendancy.id .. " not found")
@@ -1119,15 +1185,12 @@ for i, classId in ipairs(psg.passives) do
11191185
printf("Ascendancy node " .. ascendancy.id .. " not found")
11201186
goto continuepositioning
11211187
end
1122-
local groupAscendancy = tree.groups[ascendancyNode.group]
1123-
1124-
local angle = startAngle + (j - 1) * angleStep
1125-
local cX = hardCoded * math.cos(angle)
1126-
local cY = hardCoded * math.sin(angle)
11271188

11281189
ascendancy.background.x = cX
11291190
ascendancy.background.y = cY
11301191

1192+
local groupAscendancy = tree.groups[ascendancyNode.group]
1193+
11311194
local innerRadious = dat("ascendancy"):GetRow("Id", ascendancy.internalId).distanceTree
11321195

11331196
local newInnerX = cX + math.cos(angleToCenter) * innerRadious
@@ -1155,12 +1218,46 @@ for i, classId in ipairs(psg.passives) do
11551218
tree.max_y = math.max(tree.max_y, group.y + hardCoded / 2)
11561219
end
11571220
end
1221+
11581222
j = j + 1
11591223
:: continuepositioning ::
11601224
end
11611225
end
11621226
end
11631227

1228+
printf("Fixing replace ascendancies position...")
1229+
for from, to in pairs(ascedancyReplacements) do
1230+
local fromAscendancy
1231+
local toAscendancy
1232+
for _, class in ipairs(tree.classes) do
1233+
for _, ascendancy in ipairs(class.ascendancies) do
1234+
if ascendancy.name == from then
1235+
fromAscendancy = ascendancy
1236+
end
1237+
if ascendancy.name == to then
1238+
toAscendancy = ascendancy
1239+
end
1240+
end
1241+
end
1242+
1243+
if fromAscendancy == nil then
1244+
printf("From ascendancy " .. from .. " not found")
1245+
goto continuereplace
1246+
end
1247+
if toAscendancy == nil then
1248+
printf("To ascendancy " .. to .. " not found")
1249+
goto continuereplace
1250+
end
1251+
1252+
fromAscendancy.replaceBy = to
1253+
1254+
toAscendancy.background.x = fromAscendancy.background.x
1255+
toAscendancy.background.y = fromAscendancy.background.y
1256+
1257+
:: continuereplace ::
1258+
end
1259+
1260+
11641261
printf("Generating sprite info...")
11651262
for i, sheet in ipairs(sheets) do
11661263
printf("Calculating sprite dimensions for " .. sheet.name)
1.22 MB
Binary file not shown.
38.1 KB
Binary file not shown.
42 Bytes
Binary file not shown.
177 KB
Binary file not shown.
29.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)