Skip to content

Commit 8e7743f

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

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
@@ -68,6 +68,7 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont
6868
self.build = build
6969

7070
self.socketGroupList = { }
71+
self.removedSocketGroupList = { }
7172

7273
self.sortGemsByDPS = true
7374
self.sortGemsByDPSField = "CombinedDPS"

src/Modules/CalcSetup.lua

+21-1
Original file line numberDiff line numberDiff line change
@@ -1254,6 +1254,22 @@ function calcs.initEnv(build, mode, override, specEnv)
12541254
end
12551255
end
12561256
end
1257+
if not group then
1258+
for _, removeSocketGroup in pairs(build.skillsTab.removedSocketGroupList) do
1259+
if removeSocketGroup.source == grantedSkill.source and removeSocketGroup.slot == grantedSkill.slotName then
1260+
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
1261+
group = removeSocketGroup
1262+
break
1263+
end
1264+
end
1265+
end
1266+
1267+
if group then
1268+
build.skillsTab.removedSocketGroupList[group.source] = nil
1269+
t_insert(build.skillsTab.socketGroupList, group)
1270+
markList[group] = true
1271+
end
1272+
end
12571273
if not group then
12581274
-- Create a new group for this skill
12591275
group = { label = "", enabled = true, gemList = { }, source = grantedSkill.source, slot = grantedSkill.slotName }
@@ -1330,10 +1346,14 @@ function calcs.initEnv(build, mode, override, specEnv)
13301346
while build.skillsTab.socketGroupList[i] do
13311347
local socketGroup = build.skillsTab.socketGroupList[i]
13321348
if socketGroup.source and not markList[socketGroup] then
1333-
t_remove(build.skillsTab.socketGroupList, i)
1349+
build.skillsTab.socketGroupList[i].shown = false
1350+
local removed = t_remove(build.skillsTab.socketGroupList, i)
13341351
if build.skillsTab.displayGroup == socketGroup then
13351352
build.skillsTab.displayGroup = nil
13361353
end
1354+
1355+
-- add in the removed group to the list of groups to be removed
1356+
build.skillsTab.removedSocketGroupList[removed.source] = removed
13371357
else
13381358
i = i + 1
13391359
end

0 commit comments

Comments
 (0)