Skip to content

Commit 89ada7e

Browse files
author
LocalIdentity
committed
Fix skill stat set import
1 parent 360022b commit 89ada7e

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

spec/System/TestImportReimport_spec.lua

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,4 +225,27 @@ Skeletal Sniper 20/0 1
225225
assert.are.equal(3, srcInstance.skillMinionSkillStatSetIndexLookup[grantedEffectId][2])
226226
assert.are.equal(2, srcInstance.skillMinionSkillStatSetIndexLookupCalcs[grantedEffectId][2])
227227
end)
228+
229+
it("preserves active skill stat set when reimporting items and skills", function()
230+
build.skillsTab:PasteSocketGroup([[
231+
Fireball 20/0 1
232+
]])
233+
runCallback("OnFrame")
234+
235+
local socketGroup = build.skillsTab.socketGroupList[1]
236+
local activeEffect = socketGroup.displaySkillList[1].activeEffect
237+
local grantedEffectId = activeEffect.grantedEffect.id
238+
local srcInstance = activeEffect.srcInstance
239+
srcInstance.statSet = { [grantedEffectId] = 3 }
240+
srcInstance.statSetCalcs = { [grantedEffectId] = 2 }
241+
242+
reimportSingleGem("Linen Wraps", "Gloves", "Fireball")
243+
244+
socketGroup = build.skillsTab.socketGroupList[1]
245+
activeEffect = socketGroup.displaySkillList[1].activeEffect
246+
grantedEffectId = activeEffect.grantedEffect.id
247+
srcInstance = activeEffect.srcInstance
248+
assert.are.equal(3, srcInstance.statSet[grantedEffectId])
249+
assert.are.equal(2, srcInstance.statSetCalcs[grantedEffectId])
250+
end)
228251
end)

src/Classes/ImportTab.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,8 @@ local function snapshotSocketGroupReimportState(socketGroup, isMainGroup)
836836
gemStates[gemIndex] = {
837837
enabled = gem.enabled,
838838
count = gem.count,
839+
statSet = gem.statSet and copyTable(gem.statSet),
840+
statSetCalcs = gem.statSetCalcs and copyTable(gem.statSetCalcs),
839841
skillPart = gem.skillPart,
840842
skillPartCalcs = gem.skillPartCalcs,
841843
skillStageCount = gem.skillStageCount,
@@ -869,6 +871,8 @@ end
869871
local function applyGemReimportState(gem, state)
870872
gem.enabled = state.enabled
871873
gem.count = state.count
874+
gem.statSet = state.statSet and copyTable(state.statSet)
875+
gem.statSetCalcs = state.statSetCalcs and copyTable(state.statSetCalcs)
872876
gem.skillPart = state.skillPart
873877
gem.skillPartCalcs = state.skillPartCalcs
874878
gem.skillStageCount = state.skillStageCount

0 commit comments

Comments
 (0)