Skip to content

Commit 4059151

Browse files
moxajLocalIdentity
andauthored
Fix gem group counting logic (#2292)
* Fix gem group counting logic * Fix function invocation for unit test * Simplify fix --------- Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent aa090fa commit 4059151

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

spec/System/TestSkills_spec.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,8 @@ describe("TestSkills", function()
837837

838838
local skillsTab = {
839839
socketGroupList = {
840+
{ enabled = false, gemList = { fakeGem("Disabled Skill") } },
841+
{ enabled = true, gemList = { fakeGem("Disabled Gem", nil, { enabled = false }) } },
840842
{ enabled = true, gemList = { fakeGem("Item Skill", { fromItem = true }) } },
841843
{ enabled = true, gemList = { fakeGem("Tree Skill", { fromTree = true }) } },
842844
{ enabled = true, gemList = { fakeGem("Stored Item Skill", nil, { fromItem = true }) } },

src/Classes/SkillsTab.lua

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,14 +1571,15 @@ function SkillsTabClass:UpdateGlobalGemCountAssignments()
15711571
wipeTable(GlobalGemAssignments)
15721572
local countSocketGroups = 0
15731573
for _, socketGroup in ipairs(self.socketGroupList) do
1574-
local countGroup = true
1574+
local countGroup = false
15751575
if socketGroup.enabled then
1576-
local activeGem = socketGroup.gemList[1]
1577-
local activeGrantedEffect = activeGem and (activeGem.grantedEffect or activeGem.gemData and activeGem.gemData.grantedEffect)
1578-
if activeGem and (activeGem.fromItem or activeGem.fromTree or activeGrantedEffect and (activeGrantedEffect.fromItem or activeGrantedEffect.fromTree)) then
1579-
countGroup = false
1580-
end
15811576
for _, gemInstance in ipairs(socketGroup.gemList) do
1577+
if gemInstance.enabled and not countGroup then
1578+
local grantedEffect = gemInstance.grantedEffect or gemInstance.gemData and gemInstance.gemData.grantedEffect
1579+
local provided = gemInstance.fromItem or gemInstance.fromTree or
1580+
grantedEffect and (grantedEffect.fromItem or grantedEffect.fromTree)
1581+
countGroup = not provided
1582+
end
15821583
if gemInstance.gemData and gemInstance.enabled then
15831584
if GlobalGemAssignments[gemInstance.gemData.name] then
15841585
GlobalGemAssignments[gemInstance.gemData.name].count = GlobalGemAssignments[gemInstance.gemData.name].count + 1

0 commit comments

Comments
 (0)