Skip to content

Commit bb59e6f

Browse files
committed
Preserve disabled gems on reimport
1 parent 953d057 commit bb59e6f

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/Classes/ImportTab.lua

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,13 +746,18 @@ local function getSocketGroupReimportKey(socketGroup)
746746
end
747747

748748
local function snapshotSocketGroupReimportState(socketGroup, isMainGroup)
749+
local gemEnabledStates = { }
750+
for gemIndex, gem in ipairs(socketGroup.gemList) do
751+
gemEnabledStates[gemIndex] = gem.enabled
752+
end
749753
return {
750754
enabled = socketGroup.enabled,
751755
includeInFullDPS = socketGroup.includeInFullDPS,
752756
groupCount = socketGroup.groupCount,
753757
label = socketGroup.label,
754758
mainActiveSkill = socketGroup.mainActiveSkill,
755759
mainActiveSkillCalcs = socketGroup.mainActiveSkillCalcs,
760+
gemEnabledStates = gemEnabledStates,
756761
isMainGroup = isMainGroup,
757762
}
758763
end
@@ -764,6 +769,13 @@ local function applySocketGroupReimportState(socketGroup, state)
764769
socketGroup.label = state.label
765770
socketGroup.mainActiveSkill = state.mainActiveSkill
766771
socketGroup.mainActiveSkillCalcs = state.mainActiveSkillCalcs
772+
if state.gemEnabledStates then
773+
for gemIndex, enabled in ipairs(state.gemEnabledStates) do
774+
if socketGroup.gemList[gemIndex] then
775+
socketGroup.gemList[gemIndex].enabled = enabled
776+
end
777+
end
778+
end
767779
end
768780

769781
function ImportTabClass:ImportItemsAndSkills(json)
@@ -1291,4 +1303,4 @@ function ImportTabClass:SetPredefinedBuildName()
12911303
local charData = charSelect.list[charSelect.selIndex].char
12921304
local charName = charData.name
12931305
main.predefinedBuildName = accountName.." - "..charName
1294-
end
1306+
end

0 commit comments

Comments
 (0)