Skip to content

Commit b6bd06c

Browse files
committed
[ISSUE-9451] Loadout Management
* Updated GetLoadoutByName to work with oneSet scenarios again * Updated the loadoutsList to seed from the filteredSpecs given the specList and the treeList were getting desynced when linkIdentifier builds were in the mix.
1 parent ad59318 commit b6bd06c

1 file changed

Lines changed: 17 additions & 13 deletions

File tree

src/Modules/Build.lua

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,11 @@ function buildMode:SyncLoadouts()
670670
-- used when clicking on the dropdown to set the correct setId for each SetActiveSet()
671671
self.treeListSpecialLinks, self.itemListSpecialLinks, self.skillListSpecialLinks, self.configListSpecialLinks = {}, {}, {}, {}
672672

673+
674+
local oneSkill = self.skillsTab and #self.skillsTab.skillSetOrderList == 1
675+
local oneItem = self.itemsTab and #self.itemsTab.itemSetOrderList == 1
676+
local oneConfig = self.configTab and #self.configTab.configSetOrderList == 1
677+
673678
if self.treeTab ~= nil and self.itemsTab ~= nil and self.skillsTab ~= nil and self.configTab ~= nil then
674679
local transferTable = {}
675680
local sortedTreeListSpecialLinks = {}
@@ -729,22 +734,17 @@ function buildMode:SyncLoadouts()
729734
identifyLinks(self.skillsTab.skillSetOrderList, self.skillsTab.skillSets, skillList, self.skillListSpecialLinks, self.treeListSpecialLinks)
730735
identifyLinks(self.configTab.configSetOrderList, self.configTab.configSets, configList, self.configListSpecialLinks, self.treeListSpecialLinks)
731736

732-
local oneSkill = self.skillsTab and #self.skillsTab.skillSetOrderList == 1
733-
local oneItem = self.itemsTab and #self.itemsTab.itemSetOrderList == 1
734-
local oneConfig = self.configTab and #self.configTab.configSetOrderList == 1
735-
736-
for _, spec in ipairs(filteredSpecs) do
737+
for id, spec in ipairs(filteredSpecs) do
737738
local specTitle = spec.title or "Default"
738739
t_insert(treeList, (spec.treeVersion ~= latestTreeVersion and ("["..treeVersions[spec.treeVersion].display.."] ") or "")..specTitle)
739-
end
740-
741-
-- loop over all for exact match loadouts
742-
for id, tree in ipairs(treeList) do
740+
local tree = treeList[#treeList]
741+
-- only exact match loadouts
743742
if (oneItem or itemList[tree]) and (oneSkill or skillList[tree]) and (oneConfig or configList[tree]) then
744743
t_insert(filteredList, tree)
745-
t_insert(self.loadoutsList, self.treeTab.specList[id])
744+
t_insert(self.loadoutsList, filteredSpecs[id])
746745
end
747746
end
747+
748748
-- loop over the identifiers found within braces and set the loadout name to the TreeSet
749749
for _, tree in ipairs(sortedTreeListSpecialLinks) do
750750
local treeLinkId = tree.linkId
@@ -944,12 +944,16 @@ function buildMode:GetLoadoutByName(loadoutName)
944944
return nil
945945
end
946946

947+
local oneSkill = self.skillsTab and #self.skillsTab.skillSetOrderList == 1
948+
local oneItem = self.itemsTab and #self.itemsTab.itemSetOrderList == 1
949+
local oneConfig = self.configTab and #self.configTab.configSetOrderList == 1
950+
947951
local specId = findNamedSetId(self.treeTab:GetSpecList(), loadoutName, self.treeListSpecialLinks)
948-
local itemId = findSetId(self.itemsTab.itemSetOrderList, loadoutName, self.itemsTab.itemSets,
952+
local itemId = oneItem and self.itemsTab.itemSetOrderList[1] or findSetId(self.itemsTab.itemSetOrderList, loadoutName, self.itemsTab.itemSets,
949953
self.itemListSpecialLinks)
950-
local skillId = findSetId(self.skillsTab.skillSetOrderList, loadoutName, self.skillsTab.skillSets,
954+
local skillId = oneSkill and self.skillsTab.skillSetOrderList[1] or findSetId(self.skillsTab.skillSetOrderList, loadoutName, self.skillsTab.skillSets,
951955
self.skillListSpecialLinks)
952-
local configId = findSetId(self.configTab.configSetOrderList, loadoutName, self.configTab.configSets,
956+
local configId = oneConfig and self.configTab.configSetOrderList[1] or findSetId(self.configTab.configSetOrderList, loadoutName, self.configTab.configSets,
953957
self.configListSpecialLinks)
954958

955959
if not specId and not itemId and not skillId and not configId then

0 commit comments

Comments
 (0)