Skip to content

Commit 6acf69b

Browse files
author
justjuangui
committed
GrantSkill from item and nodes now support supported gems
1 parent d6803aa commit 6acf69b

File tree

2 files changed

+43
-41
lines changed

2 files changed

+43
-41
lines changed

src/Classes/SkillsTab.lua

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,20 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont
152152
self.build.buildFlag = true
153153
end)
154154

155+
self.controls.set1Enabled.enabled = function()
156+
return self.displayGroup.source == nil
157+
end
158+
155159
self.controls.set2Enabled = new("CheckBoxControl", { "LEFT", self.controls.set1Enabled, "RIGHT" }, { 50, 0, 20 }, "Set 2:", function(state)
156160
self.displayGroup.set2 = state
157161
self:AddUndoState()
158162
self.build.buildFlag = true
159163
end)
160164

165+
self.controls.set2Enabled.enabled = function()
166+
return self.displayGroup.source == nil
167+
end
168+
161169
self.controls.groupEnabled = new("CheckBoxControl", { "LEFT", self.controls.set2Enabled, "RIGHT" }, { 70, 0, 20 }, "Enabled:", function(state)
162170
self.displayGroup.enabled = state
163171
self:AddUndoState()
@@ -180,41 +188,6 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont
180188
self.controls.groupCount.shown = function()
181189
return self.displayGroup.source ~= nil
182190
end
183-
self.controls.sourceNote = new("LabelControl", { "TOPLEFT", self.controls.set1Enabled, "TOPLEFT" }, { -42, 30, 0, 16 })
184-
self.controls.sourceNote.shown = function()
185-
return self.displayGroup.source ~= nil
186-
end
187-
self.controls.sourceNote.label = function()
188-
local label
189-
if self.displayGroup.explodeSources then
190-
label = [[^7This is a special group created for the enemy explosion effect,
191-
which comes from the following sources:]]
192-
for _, source in ipairs(self.displayGroup.explodeSources) do
193-
label = label .. "\n\t" .. colorCodes[source.rarity or "NORMAL"] .. (source.name or source.dn or "???")
194-
end
195-
label = label .. "^7\nYou cannot delete this group, but it will disappear if you lose the above sources."
196-
else
197-
local activeGem = self.displayGroup.gemList[1]
198-
local sourceName
199-
if self.displayGroup.sourceItem then
200-
sourceName = "'" .. colorCodes[self.displayGroup.sourceItem.rarity] .. self.displayGroup.sourceItem.name
201-
elseif self.displayGroup.sourceNode then
202-
sourceName = "'" .. colorCodes["NORMAL"] .. self.displayGroup.sourceNode.name
203-
else
204-
sourceName = "'" .. colorCodes["NORMAL"] .. "?"
205-
end
206-
sourceName = sourceName .. "^7'"
207-
label = [[^7This is a special group created for the ']] .. activeGem.color .. (activeGem.grantedEffect and activeGem.grantedEffect.name or activeGem.nameSpec) .. [[^7' skill,
208-
which is being provided by ]] .. sourceName .. [[.
209-
You cannot delete this group, but it will disappear if you ]] .. (self.displayGroup.sourceNode and [[un-allocate the node.]] or [[un-equip the item.]])
210-
if not self.displayGroup.noSupports then
211-
label = label .. "\n\n" .. [[You cannot add support gems to this group, but support gems in
212-
any other group socketed into ]] .. sourceName .. [[
213-
will automatically apply to the skill.]]
214-
end
215-
end
216-
return label
217-
end
218191

219192
-- Scroll bar
220193
self.controls.scrollBarH = new("ScrollBarControl", nil, {0, 0, 0, 18}, 100, "HORIZONTAL", true)
@@ -612,9 +585,12 @@ function SkillsTabClass:CreateGemSlot(index)
612585
end)
613586
end
614587
slot.delete.shown = function()
615-
return index <= #self.displayGroup.gemList + 1 and self.displayGroup.source == nil
588+
return index <= #self.displayGroup.gemList + 1
616589
end
617590
slot.delete.enabled = function()
591+
if index == 1 and self.displayGroup and (self.displayGroup.sourceItem or self.displayGroup.sourceNode) then
592+
return false
593+
end
618594
return index <= #self.displayGroup.gemList
619595
end
620596
slot.delete.tooltipText = "Remove this gem."
@@ -667,6 +643,12 @@ function SkillsTabClass:CreateGemSlot(index)
667643
end
668644
self.build.buildFlag = true
669645
end, true)
646+
slot.nameSpec.enabled = function()
647+
if index == 1 and self.displayGroup and (self.displayGroup.sourceItem or self.displayGroup.sourceNode) then
648+
return false
649+
end
650+
return true
651+
end
670652
slot.nameSpec:AddToTabGroup(self.controls.groupLabel)
671653
self.controls["gemSlot"..index.."Name"] = slot.nameSpec
672654

@@ -688,6 +670,9 @@ function SkillsTabClass:CreateGemSlot(index)
688670
end)
689671
slot.level:AddToTabGroup(self.controls.groupLabel)
690672
slot.level.enabled = function()
673+
if index == 1 and self.displayGroup and (self.displayGroup.sourceItem or self.displayGroup.sourceNode) then
674+
return false
675+
end
691676
return index <= #self.displayGroup.gemList
692677
end
693678
self.controls["gemSlot"..index.."Level"] = slot.level
@@ -769,6 +754,9 @@ function SkillsTabClass:CreateGemSlot(index)
769754
end
770755
slot.quality:AddToTabGroup(self.controls.groupLabel)
771756
slot.quality.enabled = function()
757+
if index == 1 and self.displayGroup and (self.displayGroup.sourceItem or self.displayGroup.sourceNode) then
758+
return false
759+
end
772760
return index <= #self.displayGroup.gemList
773761
end
774762
self.controls["gemSlot"..index.."Quality"] = slot.quality
@@ -808,6 +796,9 @@ function SkillsTabClass:CreateGemSlot(index)
808796
end
809797
end
810798
slot.enabled.enabled = function()
799+
if index == 1 and self.displayGroup and (self.displayGroup.sourceItem or self.displayGroup.sourceNode) then
800+
return false
801+
end
811802
return index <= #self.displayGroup.gemList
812803
end
813804
self.controls["gemSlot"..index.."Enable"] = slot.enabled
@@ -849,6 +840,9 @@ function SkillsTabClass:CreateGemSlot(index)
849840
end
850841
end
851842
slot.count.enabled = function()
843+
if index == 1 and self.displayGroup and (self.displayGroup.sourceItem or self.displayGroup.sourceNode) then
844+
return false
845+
end
852846
return index <= #self.displayGroup.gemList
853847
end
854848
self.controls["gemSlot"..index.."Count"] = slot.count
@@ -1000,13 +994,14 @@ function SkillsTabClass:ProcessSocketGroup(socketGroup)
1000994
end
1001995
elseif gemInstance.skillId then
1002996
-- Specified by skill ID
1003-
-- Used for skills granted by items
997+
-- Used for skills granted by items / nodes
1004998
gemInstance.errMsg = nil
1005-
local gemId = data.gemForSkill[gemInstance.skillId]
999+
local grantedEffect = data.skills[gemInstance.skillId]
1000+
local gemId = data.gemForSkill[grantedEffect]
10061001
if gemId then
10071002
gemInstance.gemData = data.gems[gemId]
10081003
else
1009-
gemInstance.grantedEffect = data.skills[gemInstance.skillId]
1004+
gemInstance.grantedEffect = grantedEffect
10101005
end
10111006
if gemInstance.triggered and gemInstance.grantedEffect then
10121007
if gemInstance.grantedEffect.levels[gemInstance.level] then
@@ -1066,6 +1061,14 @@ function SkillsTabClass:SetDisplayGroup(socketGroup)
10661061
self.controls.groupLabel:SetText(socketGroup.label)
10671062
self.controls.groupEnabled.state = socketGroup.enabled
10681063
self.controls.includeInFullDPS.state = socketGroup.includeInFullDPS and socketGroup.enabled
1064+
if socketGroup.sourceItem then
1065+
socketGroup.set1 = true
1066+
socketGroup.set2 = false
1067+
elseif socketGroup.sourceNode then
1068+
socketGroup.set1 = true
1069+
socketGroup.set2 = true
1070+
end
1071+
10691072
self.controls.set1Enabled.state = socketGroup.set1 == nil and true or socketGroup.set1
10701073
self.controls.set2Enabled.state = socketGroup.set2 == nil and true or socketGroup.set2
10711074
self.controls.groupCount:SetText(socketGroup.groupCount or 1)

src/Modules/CalcSetup.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,8 +1279,7 @@ function calcs.initEnv(build, mode, override, specEnv)
12791279
group.noSupports = grantedSkill.noSupports
12801280
activeGemInstance.triggered = grantedSkill.triggered
12811281
activeGemInstance.triggerChance = grantedSkill.triggerChance
1282-
wipeTable(group.gemList)
1283-
t_insert(group.gemList, activeGemInstance)
1282+
group.gemList[1] = activeGemInstance
12841283
build.skillsTab:ProcessSocketGroup(group)
12851284
end
12861285

0 commit comments

Comments
 (0)