Skip to content

Commit 4888b13

Browse files
author
justjuangui
committed
Support for removing and adding Grants Skill while keep your support gems
1 parent 2b68627 commit 4888b13

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
@@ -1270,6 +1270,22 @@ function calcs.initEnv(build, mode, override, specEnv)
12701270
end
12711271
end
12721272
end
1273+
if not group then
1274+
for _, removeSocketGroup in pairs(build.skillsTab.removedSocketGroupList) do
1275+
if removeSocketGroup.source == grantedSkill.source and removeSocketGroup.slot == grantedSkill.slotName then
1276+
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
1277+
group = removeSocketGroup
1278+
break
1279+
end
1280+
end
1281+
end
1282+
1283+
if group then
1284+
build.skillsTab.removedSocketGroupList[group.source] = nil
1285+
t_insert(build.skillsTab.socketGroupList, group)
1286+
markList[group] = true
1287+
end
1288+
end
12731289
if not group then
12741290
-- Create a new group for this skill
12751291
group = { label = "", enabled = true, gemList = { }, source = grantedSkill.source, slot = grantedSkill.slotName }
@@ -1346,10 +1362,14 @@ function calcs.initEnv(build, mode, override, specEnv)
13461362
while build.skillsTab.socketGroupList[i] do
13471363
local socketGroup = build.skillsTab.socketGroupList[i]
13481364
if socketGroup.source and not markList[socketGroup] then
1349-
t_remove(build.skillsTab.socketGroupList, i)
1365+
build.skillsTab.socketGroupList[i].shown = false
1366+
local removed = t_remove(build.skillsTab.socketGroupList, i)
13501367
if build.skillsTab.displayGroup == socketGroup then
13511368
build.skillsTab.displayGroup = nil
13521369
end
1370+
1371+
-- add in the removed group to the list of groups to be removed
1372+
build.skillsTab.removedSocketGroupList[removed.source] = removed
13531373
else
13541374
i = i + 1
13551375
end

0 commit comments

Comments
 (0)