@@ -1517,19 +1517,37 @@ function SkillsTabClass:SetActiveSkillSet(skillSetId, deferSync)
15171517 end
15181518end
15191519
1520+ -- Count the number of gem groups that have at least one enabled non-provided gem
1521+ function SkillsTabClass :CountGemGroups ()
1522+ local gemGroupCount = 0
1523+ for _ , socketGroup in ipairs (self .socketGroupList ) do
1524+ if socketGroup .enabled then
1525+ local hasEnabledNonProvidedGem = false
1526+ for _ , gem in ipairs (socketGroup .gemList ) do
1527+ if gem .enabled then
1528+ local grantedEffect = gem and (gem .grantedEffect or gem .gemData and gem .gemData .grantedEffect )
1529+ local provided = ((gem and (gem .fromItem or gem .fromTree )
1530+ or (grantedEffect and (grantedEffect .fromItem or grantedEffect .fromTree ))))
1531+ if not provided then
1532+ hasEnabledNonProvidedGem = true
1533+ break
1534+ end
1535+ end
1536+ end
1537+ if hasEnabledNonProvidedGem then
1538+ gemGroupCount = gemGroupCount + 1
1539+ end
1540+ end
1541+ end
1542+ return gemGroupCount
1543+ end
1544+
15201545-- Loop over all socket groups and gem instances
15211546-- to updated global gem count assignments
15221547function SkillsTabClass :UpdateGlobalGemCountAssignments ()
15231548 wipeTable (GlobalGemAssignments )
1524- local countSocketGroups = 0
15251549 for _ , socketGroup in ipairs (self .socketGroupList ) do
1526- local countGroup = true
15271550 if socketGroup .enabled then
1528- local activeGem = socketGroup .gemList [1 ]
1529- local activeGrantedEffect = activeGem and (activeGem .grantedEffect or activeGem .gemData and activeGem .gemData .grantedEffect )
1530- if activeGem and (activeGem .fromItem or activeGem .fromTree or activeGrantedEffect and (activeGrantedEffect .fromItem or activeGrantedEffect .fromTree )) then
1531- countGroup = false
1532- end
15331551 for _ , gemInstance in ipairs (socketGroup .gemList ) do
15341552 if gemInstance .gemData and gemInstance .enabled then
15351553 if GlobalGemAssignments [gemInstance .gemData .name ] then
@@ -1551,10 +1569,7 @@ function SkillsTabClass:UpdateGlobalGemCountAssignments()
15511569 end
15521570 end
15531571 end
1554- if countGroup then
1555- countSocketGroups = countSocketGroups + 1
1556- end
15571572 end
1558- GlobalGemAssignments [" GemGroupCount" ] = countSocketGroups
1573+ GlobalGemAssignments [" GemGroupCount" ] = self : CountGemGroups ()
15591574end
15601575
0 commit comments