Skip to content

Commit d8a8092

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

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
@@ -1255,6 +1255,22 @@ function calcs.initEnv(build, mode, override, specEnv)
12551255
end
12561256
end
12571257
end
1258+
if not group then
1259+
for _, removeSocketGroup in pairs(build.skillsTab.removedSocketGroupList) do
1260+
if removeSocketGroup.source == grantedSkill.source and removeSocketGroup.slot == grantedSkill.slotName then
1261+
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
1262+
group = removeSocketGroup
1263+
break
1264+
end
1265+
end
1266+
end
1267+
1268+
if group then
1269+
build.skillsTab.removedSocketGroupList[group.source] = nil
1270+
t_insert(build.skillsTab.socketGroupList, group)
1271+
markList[group] = true
1272+
end
1273+
end
12581274
if not group then
12591275
-- Create a new group for this skill
12601276
group = { label = "", enabled = true, gemList = { }, source = grantedSkill.source, slot = grantedSkill.slotName }
@@ -1331,10 +1347,14 @@ function calcs.initEnv(build, mode, override, specEnv)
13311347
while build.skillsTab.socketGroupList[i] do
13321348
local socketGroup = build.skillsTab.socketGroupList[i]
13331349
if socketGroup.source and not markList[socketGroup] then
1334-
t_remove(build.skillsTab.socketGroupList, i)
1350+
build.skillsTab.socketGroupList[i].shown = false
1351+
local removed = t_remove(build.skillsTab.socketGroupList, i)
13351352
if build.skillsTab.displayGroup == socketGroup then
13361353
build.skillsTab.displayGroup = nil
13371354
end
1355+
1356+
-- add in the removed group to the list of groups to be removed
1357+
build.skillsTab.removedSocketGroupList[removed.source] = removed
13381358
else
13391359
i = i + 1
13401360
end

0 commit comments

Comments
 (0)