Skip to content

Commit bf3081d

Browse files
committed
Backport class dropdown being based on current spec from PoB1
PathOfBuildingCommunity/PathOfBuilding#8494
1 parent d75642d commit bf3081d

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed

src/Classes/TreeTab.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ function TreeTabClass:SetActiveSpec(specId)
482482
self.build.spec = curSpec
483483
self.build.buildFlag = true
484484
self.build.spec:SetWindowTitleWithBuildClass()
485+
self.build:UpdateClassDropdowns(curSpec.treeVersion)
485486
for _, slot in pairs(self.build.itemsTab.slots) do
486487
if slot.nodeId then
487488
if prevSpec then

src/Modules/Build.lua

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -596,24 +596,7 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin
596596
--special rebuild to properly initialise boss placeholders
597597
self.configTab:BuildModList()
598598

599-
-- Initialise class dropdown
600-
for classId, class in pairs(self.latestTree.classes) do
601-
local ascendancies = {}
602-
-- Initialise ascendancy dropdown
603-
for i = 0, #class.classes do
604-
local ascendClass = class.classes[i]
605-
t_insert(ascendancies, {
606-
label = ascendClass.name,
607-
ascendClassId = i,
608-
})
609-
end
610-
t_insert(self.controls.classDrop.list, {
611-
label = class.name,
612-
classId = classId,
613-
ascendancies = ascendancies,
614-
})
615-
end
616-
table.sort(self.controls.classDrop.list, function(a, b) return a.label < b.label end)
599+
self:UpdateClassDropdowns()
617600

618601
-- so we ran into problems with converted trees, trying to check passive tree routes and also consider thread jewels
619602
-- but we can't check jewel info because items have not been loaded yet, and they come after passives in the xml.
@@ -1195,6 +1178,29 @@ function buildMode:OnFrame(inputEvents)
11951178
self:DrawControls(main.viewPort)
11961179
end
11971180

1181+
function buildMode:UpdateClassDropdowns(treeVersion)
1182+
local classes = main.tree[treeVersion or latestTreeVersion].classes
1183+
wipeTable(self.controls.classDrop.list)
1184+
-- Initialise class dropdown
1185+
for classId, class in pairs(classes) do
1186+
local ascendancies = {}
1187+
-- Initialise ascendancy dropdown
1188+
for i = 0, #class.classes do
1189+
local ascendClass = class.classes[i]
1190+
t_insert(ascendancies, {
1191+
label = ascendClass.name,
1192+
ascendClassId = i,
1193+
})
1194+
end
1195+
t_insert(self.controls.classDrop.list, {
1196+
label = class.name,
1197+
classId = classId,
1198+
ascendancies = ascendancies,
1199+
})
1200+
end
1201+
table.sort(self.controls.classDrop.list, function(a, b) return a.label < b.label end)
1202+
end
1203+
11981204
-- Opens the game version conversion popup
11991205
function buildMode:OpenConversionPopup()
12001206
local controls = { }

0 commit comments

Comments
 (0)