Skip to content

Commit 37c2a13

Browse files
author
justjuangui
committed
Support for removing and adding Grants Skill while keep your support gems
1 parent aa3c0da commit 37c2a13

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/Classes/SkillsTab.lua

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont
8585
self.build = build
8686

8787
self.socketGroupList = { }
88+
self.removedSocketGroupList = { }
8889

8990
self.sortGemsByDPS = true
9091
self.sortGemsByDPSField = "CombinedDPS"

src/Modules/CalcSetup.lua

+21-1
Original file line numberDiff line numberDiff line change
@@ -1267,6 +1267,22 @@ function calcs.initEnv(build, mode, override, specEnv)
12671267
end
12681268
end
12691269
end
1270+
if not group then
1271+
for _, removeSocketGroup in pairs(build.skillsTab.removedSocketGroupList) do
1272+
if removeSocketGroup.source == grantedSkill.source and removeSocketGroup.slot == grantedSkill.slotName then
1273+
if removeSocketGroup.gemList[1] and removeSocketGroup.gemList[1].skillId == grantedSkill.skillId and (removeSocketGroup.gemList[1].level == grantedSkill.level or removeSocketGroup.gemList[1].level == getNormalizedSkillLevel(grantedSkill)) then
1274+
group = removeSocketGroup
1275+
break
1276+
end
1277+
end
1278+
end
1279+
1280+
if group then
1281+
build.skillsTab.removedSocketGroupList[group.source] = nil
1282+
t_insert(build.skillsTab.socketGroupList, group)
1283+
markList[group] = true
1284+
end
1285+
end
12701286
if not group then
12711287
-- Create a new group for this skill
12721288
group = { label = "", enabled = true, gemList = { }, source = grantedSkill.source, slot = grantedSkill.slotName }
@@ -1343,10 +1359,14 @@ function calcs.initEnv(build, mode, override, specEnv)
13431359
while build.skillsTab.socketGroupList[i] do
13441360
local socketGroup = build.skillsTab.socketGroupList[i]
13451361
if socketGroup.source and not markList[socketGroup] then
1346-
t_remove(build.skillsTab.socketGroupList, i)
1362+
build.skillsTab.socketGroupList[i].shown = false
1363+
local removed = t_remove(build.skillsTab.socketGroupList, i)
13471364
if build.skillsTab.displayGroup == socketGroup then
13481365
build.skillsTab.displayGroup = nil
13491366
end
1367+
1368+
-- add in the removed group to the list of groups to be removed
1369+
build.skillsTab.removedSocketGroupList[removed.source] = removed
13501370
else
13511371
i = i + 1
13521372
end

0 commit comments

Comments
 (0)