Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions spec/System/TestImportReimport_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -253,4 +253,26 @@ Blight 20/0 1
table.insert(build.itemsTab.itemSetOrderList, itemSet.id)
assertReimportPreservesSkillSubstate("Weapon 1", "Driftwood Wand", "Weapon", "Animate Weapon", "skillMinionItemSet", itemSet.id)
end)

it("keeps one socket group per unlinked socket holding the same gem when reimporting without deleting skills", function()
-- One matching group, as left by an import that merged the unlinked sockets
build.skillsTab:PasteSocketGroup([[
Slot: Weapon 1
Raise Spectre 20/0 1
]])
runCallback("OnFrame")

local wand = makeImportItem("Driftwood Wand", "Weapon", {
makeSocketedGemEntry(0, false, "Raise Spectre", 20),
makeSocketedGemEntry(1, false, "Raise Spectre", 20),
makeSocketedGemEntry(2, false, "Raise Spectre", 20),
})
for index, socket in ipairs(wand.sockets) do
socket.group = index - 1
end
build.importTab:ImportItemsAndSkills(buildImportPayload({ wand }), false, false, true)
runCallback("OnFrame")

assert.are.equal(3, #build.skillsTab.socketGroupList)
end)
end)
5 changes: 4 additions & 1 deletion src/Classes/ImportTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1865,11 +1865,13 @@ function ImportTabClass:ImportSocketedItems(item, socketedItems, slotName)
end

-- Import the socket groups
-- A socket group matched or added for this item is not matched again, so unlinked sockets holding the same gems stay separate groups
local claimedGroups = { }
for _, itemSocketGroup in pairs(itemSocketGroupList) do
-- Check if this socket group matches an existing one
local repGroup
for index, socketGroup in pairs(self.build.skillsTab.socketGroupList) do
if #socketGroup.gemList == #itemSocketGroup.gemList and (not socketGroup.slot or socketGroup.slot == slotName) then
if not claimedGroups[socketGroup] and #socketGroup.gemList == #itemSocketGroup.gemList and (not socketGroup.slot or socketGroup.slot == slotName) then
local match = true
for gemIndex, gem in pairs(socketGroup.gemList) do
if gem.nameSpec:lower() ~= itemSocketGroup.gemList[gemIndex].nameSpec:lower() then
Expand All @@ -1893,6 +1895,7 @@ function ImportTabClass:ImportSocketedItems(item, socketedItems, slotName)
else
t_insert(self.build.skillsTab.socketGroupList, itemSocketGroup)
end
claimedGroups[repGroup or itemSocketGroup] = true
self.build.skillsTab:ProcessSocketGroup(itemSocketGroup)
end
end
Expand Down
Loading