@@ -12,6 +12,29 @@ if not loadStatFile then
1212end
1313loadStatFile (" passive_skill_stat_descriptions.csd" )
1414
15+ local function CalcOrbitAngles (nodesInOrbit )
16+ local orbitAngles = {}
17+
18+ if nodesInOrbit == 16 then
19+ -- Every 30 and 45 degrees, per https://github.com/grindinggear/skilltree-export/blob/3.17.0/README.md
20+ orbitAngles = { 0 , 30 , 45 , 60 , 90 , 120 , 135 , 150 , 180 , 210 , 225 , 240 , 270 , 300 , 315 , 330 }
21+ elseif nodesInOrbit == 40 then
22+ -- Every 10 and 45 degrees
23+ orbitAngles = { 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 }
24+ else
25+ -- Uniformly spaced
26+ for i = 0 , nodesInOrbit do
27+ orbitAngles [i + 1 ] = 360 * i / nodesInOrbit
28+ end
29+ end
30+
31+ for i , degrees in ipairs (orbitAngles ) do
32+ orbitAngles [i ] = math.rad (degrees )
33+ end
34+
35+ return orbitAngles
36+ end
37+
1538local function extractFromGgpk (listToExtract , useRegex )
1639 useRegex = useRegex or false
1740 local sweetSpotCharacter = 6000
@@ -542,36 +565,37 @@ end
542565local tree = {
543566 [" tree" ] = idPassiveTree ,
544567 [" min_x" ]= 0 ,
545- [" min_y" ]= 0 ,
546- [" max_x" ]= 0 ,
547- [" max_y" ]= 0 ,
568+ [" min_y" ]= 0 ,
569+ [" max_x" ]= 0 ,
570+ [" max_y" ]= 0 ,
548571 [" classes" ] = {},
549572 [" groups" ] = { },
550573 [" nodes" ]= { },
551574 [" assets" ]= {},
552575 [" ddsCoords" ] = {},
553576 [" jewelSlots" ] = {},
554577 [" constants" ]= { -- calculate this
555- [" classes" ]= {
556- [" StrDexIntClass" ]= 0 ,
557- [" StrClass" ]= 1 ,
558- [" DexClass" ]= 2 ,
559- [" IntClass" ]= 3 ,
560- [" StrDexClass" ]= 4 ,
561- [" StrIntClass" ]= 5 ,
562- [" DexIntClass" ]= 6
563- },
564- [" characterAttributes" ]= {
565- [" Strength" ]= 0 ,
566- [" Dexterity" ]= 1 ,
567- [" Intelligence" ]= 2
568- },
569- [" PSSCentreInnerRadius" ]= 130 ,
570- [" skillsPerOrbit" ]= {},
571- [" orbitRadii" ]= {
578+ [" classes" ]= {
579+ [" StrDexIntClass" ]= 0 ,
580+ [" StrClass" ]= 1 ,
581+ [" DexClass" ]= 2 ,
582+ [" IntClass" ]= 3 ,
583+ [" StrDexClass" ]= 4 ,
584+ [" StrIntClass" ]= 5 ,
585+ [" DexIntClass" ]= 6
586+ },
587+ [" characterAttributes" ]= {
588+ [" Strength" ]= 0 ,
589+ [" Dexterity" ]= 1 ,
590+ [" Intelligence" ]= 2
591+ },
592+ [" PSSCentreInnerRadius" ]= 130 ,
593+ [" skillsPerOrbit" ]= {},
594+ [" orbitAnglesByOrbit" ] = {},
595+ [" orbitRadii" ]= {
572596 0 , 82 , 162 , 335 , 493 , 662 , 846 , 251 , 1080 , 1322
573- }
574- },
597+ },
598+ },
575599}
576600
577601printf (" Generating classes..." )
@@ -605,6 +629,16 @@ for i, classId in ipairs(psg.passives) do
605629 [" base_dex" ] = character .BaseDexterity ,
606630 [" base_int" ] = character .BaseIntelligence ,
607631 [" ascendancies" ] = {},
632+ [" background" ] = {
633+ [" active" ] = { width = 2000 , height = 2000 },
634+ [" bg" ] = { width = 2000 , height = 2000 },
635+ image = " Classes" .. character .Name ,
636+ section = " AscendancyBackground" ,
637+ x = 0 ,
638+ y = 0 ,
639+ width = 1500 ,
640+ height = 1500
641+ }
608642 }
609643
610644 -- add assets
@@ -622,7 +656,15 @@ for i, classId in ipairs(psg.passives) do
622656 table.insert (classDef .ascendancies , {
623657 [" id" ] = ascendency .Name ,
624658 [" name" ] = ascendency .Name ,
625- [" internalId" ] = ascendency .Id
659+ [" internalId" ] = ascendency .Id ,
660+ [" background" ] = {
661+ image = " Classes" .. ascendency .Name ,
662+ section = " AscendancyBackground" ,
663+ x = 0 ,
664+ y = 0 ,
665+ width = 1500 ,
666+ height = 1500
667+ }
626668 })
627669
628670 -- add assets
@@ -985,6 +1027,11 @@ for i, orbit in ipairs(orbitsConstants) do
9851027 tree .constants .skillsPerOrbit [i ] = orbit
9861028end
9871029
1030+ -- calculate the orbit radius
1031+ for orbit , skillsInOrbit in ipairs (tree .constants .skillsPerOrbit ) do
1032+ tree .constants .orbitAnglesByOrbit [orbit ] = CalcOrbitAngles (skillsInOrbit )
1033+ end
1034+
9881035-- Update position of ascendancy base on min / max
9891036-- get the orbit radius + hard-coded value, calculate the angle of the class start
9901037-- translate the ascendancy to the new position in arc position
@@ -1025,12 +1072,25 @@ for i, classId in ipairs(psg.passives) do
10251072 local groupAscendancy = tree .groups [ascendancyNode .group ]
10261073
10271074 local angle = startAngle + (j - 1 ) * angleStep
1028- local newX = hardCoded * math.cos (angle )
1029- local newY = hardCoded * math.sin (angle )
1075+ local cX = hardCoded * math.cos (angle )
1076+ local cY = hardCoded * math.sin (angle )
1077+
1078+ ascendancy .background .x = cX
1079+ ascendancy .background .y = cY
1080+
1081+ local innerRadious = dat (" ascendancy" ):GetRow (" Id" , ascendancy .internalId ).distanceTree
1082+
1083+ local newInnerX = cX + math.cos (angleToCenter ) * innerRadious
1084+ local newInnerY = cY + math.sin (angleToCenter ) * innerRadious
1085+
1086+ local nodeAngle = tree .constants .orbitAnglesByOrbit [ascendancyNode .orbit + 1 ][ascendancyNode .orbitIndex + 1 ]
1087+ local orbitRadius = tree .constants .orbitRadii [ascendancyNode .orbit + 1 ]
1088+ local newX = newInnerX - math.sin (nodeAngle ) * orbitRadius
1089+ local newY = newInnerY + math.cos (nodeAngle ) * orbitRadius
10301090
10311091 local offsetX = newX - groupAscendancy .x
10321092 local offsetY = newY - groupAscendancy .y
1033-
1093+
10341094 -- now update the whole groups with the offset
10351095 for groupId , value in pairs (info ) do
10361096 if type (value ) == " boolean" then
0 commit comments