Skip to content

Commit e99ddec

Browse files
author
justjuangui
committed
Support for removing and adding Grants Skill while keep your support gems
1 parent 8e1202b commit e99ddec

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/Classes/SkillsTab.lua

Lines changed: 1 addition & 0 deletions
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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1288,6 +1288,22 @@ function calcs.initEnv(build, mode, override, specEnv)
12881288
end
12891289
end
12901290
end
1291+
if not group then
1292+
for _, removeSocketGroup in pairs(build.skillsTab.removedSocketGroupList) do
1293+
if removeSocketGroup.source == grantedSkill.source and removeSocketGroup.slot == grantedSkill.slotName then
1294+
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
1295+
group = removeSocketGroup
1296+
break
1297+
end
1298+
end
1299+
end
1300+
1301+
if group then
1302+
build.skillsTab.removedSocketGroupList[group.source] = nil
1303+
t_insert(build.skillsTab.socketGroupList, group)
1304+
markList[group] = true
1305+
end
1306+
end
12911307
if not group then
12921308
-- Create a new group for this skill
12931309
group = { label = "", enabled = true, gemList = { }, source = grantedSkill.source, slot = grantedSkill.slotName }
@@ -1364,10 +1380,14 @@ function calcs.initEnv(build, mode, override, specEnv)
13641380
while build.skillsTab.socketGroupList[i] do
13651381
local socketGroup = build.skillsTab.socketGroupList[i]
13661382
if socketGroup.source and not markList[socketGroup] then
1367-
t_remove(build.skillsTab.socketGroupList, i)
1383+
build.skillsTab.socketGroupList[i].shown = false
1384+
local removed = t_remove(build.skillsTab.socketGroupList, i)
13681385
if build.skillsTab.displayGroup == socketGroup then
13691386
build.skillsTab.displayGroup = nil
13701387
end
1388+
1389+
-- add in the removed group to the list of groups to be removed
1390+
build.skillsTab.removedSocketGroupList[removed.source] = removed
13711391
else
13721392
i = i + 1
13731393
end

0 commit comments

Comments
 (0)