Skip to content

Commit d18b835

Browse files
author
LocalIdentity
committed
Fix imbued gem overwrite on import
Importing a skill gem that has an imbued support for a different gear slot would override the existing gems in the build
1 parent 79c5abb commit d18b835

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/Classes/SkillsTab.lua

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,19 +219,24 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont
219219
self.imbuedSupportBySlot = { }
220220
self.controls.imbuedSupportLabel = new("LabelControl", { "LEFT", self.controls.groupSlotLabel, "LEFT" }, { 86, 28, 0, 16 }, colorCodes.CRAFTED.."Imbued Support:")
221221
self.controls.imbuedSupport = new("GemSelectControl", { "LEFT", self.controls.imbuedSupportLabel, "RIGHT" }, { 8, 0, 250, 20 }, self, 1, function(gemData, _, _, slotName) -- slotName used on Import
222-
if not (self.displayGroup or slotName) then
222+
local targetSlot = slotName or (self.displayGroup and self.displayGroup.slot)
223+
if not targetSlot then
223224
return
224225
end
226+
local updateDisplayGroup = self.displayGroup and targetSlot == self.displayGroup.slot
225227
if gemData and (type(gemData) == "string" or gemData.id) then
226228
local gem = data.gems[gemData.id or gemData]
227-
self.imbuedSupportBySlot[slotName or self.displayGroup.slot] = gem.grantedEffect
228-
if self.displayGroup then
229+
self.imbuedSupportBySlot[targetSlot] = gem.grantedEffect
230+
if updateDisplayGroup then
229231
self.displayGroup.imbuedSupport = gem.name
230232
end
231233
self.controls.imbuedSupport.inactiveCol = data.skillColorMap[gem.grantedEffect.color]
232234
self.build.buildFlag = true
233235
else
234-
self.imbuedSupportBySlot[slotName or self.displayGroup.slot] = nil
236+
self.imbuedSupportBySlot[targetSlot] = nil
237+
if updateDisplayGroup then
238+
self.displayGroup.imbuedSupport = nil
239+
end
235240
end
236241
end, true, true)
237242
local function isImbuedEnabled() -- socketedIn must be set and the displayGroup must have an imbued, otherwise disable the imbued dropdown

0 commit comments

Comments
 (0)