Skip to content

Commit 03006b0

Browse files
author
justjuangui
committed
GrantSkill from item and nodes now support supported gems
1 parent 4f69530 commit 03006b0

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
@@ -169,12 +169,20 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont
169169
self.build.buildFlag = true
170170
end)
171171

172+
self.controls.set1Enabled.enabled = function()
173+
return self.displayGroup.source == nil
174+
end
175+
172176
self.controls.set2Enabled = new("CheckBoxControl", { "LEFT", self.controls.set1Enabled, "RIGHT" }, { 50, 0, 20 }, "Set 2:", function(state)
173177
self.displayGroup.set2 = state
174178
self:AddUndoState()
175179
self.build.buildFlag = true
176180
end)
177181

182+
self.controls.set2Enabled.enabled = function()
183+
return self.displayGroup.source == nil
184+
end
185+
178186
self.controls.groupEnabled = new("CheckBoxControl", { "LEFT", self.controls.set2Enabled, "RIGHT" }, { 70, 0, 20 }, "Enabled:", function(state)
179187
self.displayGroup.enabled = state
180188
self:AddUndoState()
@@ -197,41 +205,6 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont
197205
self.controls.groupCount.shown = function()
198206
return self.displayGroup.source ~= nil
199207
end
200-
self.controls.sourceNote = new("LabelControl", { "TOPLEFT", self.controls.set1Enabled, "TOPLEFT" }, { -42, 30, 0, 16 })
201-
self.controls.sourceNote.shown = function()
202-
return self.displayGroup.source ~= nil
203-
end
204-
self.controls.sourceNote.label = function()
205-
local label
206-
if self.displayGroup.explodeSources then
207-
label = [[^7This is a special group created for the enemy explosion effect,
208-
which comes from the following sources:]]
209-
for _, source in ipairs(self.displayGroup.explodeSources) do
210-
label = label .. "\n\t" .. colorCodes[source.rarity or "NORMAL"] .. (source.name or source.dn or "???")
211-
end
212-
label = label .. "^7\nYou cannot delete this group, but it will disappear if you lose the above sources."
213-
else
214-
local activeGem = self.displayGroup.gemList[1]
215-
local sourceName
216-
if self.displayGroup.sourceItem then
217-
sourceName = "'" .. colorCodes[self.displayGroup.sourceItem.rarity] .. self.displayGroup.sourceItem.name
218-
elseif self.displayGroup.sourceNode then
219-
sourceName = "'" .. colorCodes["NORMAL"] .. self.displayGroup.sourceNode.name
220-
else
221-
sourceName = "'" .. colorCodes["NORMAL"] .. "?"
222-
end
223-
sourceName = sourceName .. "^7'"
224-
label = [[^7This is a special group created for the ']] .. activeGem.color .. (activeGem.grantedEffect and activeGem.grantedEffect.name or activeGem.nameSpec) .. [[^7' skill,
225-
which is being provided by ]] .. sourceName .. [[.
226-
You cannot delete this group, but it will disappear if you ]] .. (self.displayGroup.sourceNode and [[un-allocate the node.]] or [[un-equip the item.]])
227-
if not self.displayGroup.noSupports then
228-
label = label .. "\n\n" .. [[You cannot add support gems to this group, but support gems in
229-
any other group socketed into ]] .. sourceName .. [[
230-
will automatically apply to the skill.]]
231-
end
232-
end
233-
return label
234-
end
235208

236209
-- Scroll bar
237210
self.controls.scrollBarH = new("ScrollBarControl", nil, {0, 0, 0, 18}, 100, "HORIZONTAL", true)
@@ -629,9 +602,12 @@ function SkillsTabClass:CreateGemSlot(index)
629602
end)
630603
end
631604
slot.delete.shown = function()
632-
return index <= #self.displayGroup.gemList + 1 and self.displayGroup.source == nil
605+
return index <= #self.displayGroup.gemList + 1
633606
end
634607
slot.delete.enabled = function()
608+
if index == 1 and self.displayGroup and (self.displayGroup.sourceItem or self.displayGroup.sourceNode) then
609+
return false
610+
end
635611
return index <= #self.displayGroup.gemList
636612
end
637613
slot.delete.tooltipText = "Remove this gem."
@@ -684,6 +660,12 @@ function SkillsTabClass:CreateGemSlot(index)
684660
end
685661
self.build.buildFlag = true
686662
end, true)
663+
slot.nameSpec.enabled = function()
664+
if index == 1 and self.displayGroup and (self.displayGroup.sourceItem or self.displayGroup.sourceNode) then
665+
return false
666+
end
667+
return true
668+
end
687669
slot.nameSpec:AddToTabGroup(self.controls.groupLabel)
688670
self.controls["gemSlot"..index.."Name"] = slot.nameSpec
689671

@@ -705,6 +687,9 @@ function SkillsTabClass:CreateGemSlot(index)
705687
end)
706688
slot.level:AddToTabGroup(self.controls.groupLabel)
707689
slot.level.enabled = function()
690+
if index == 1 and self.displayGroup and (self.displayGroup.sourceItem or self.displayGroup.sourceNode) then
691+
return false
692+
end
708693
return index <= #self.displayGroup.gemList
709694
end
710695
self.controls["gemSlot"..index.."Level"] = slot.level
@@ -786,6 +771,9 @@ function SkillsTabClass:CreateGemSlot(index)
786771
end
787772
slot.quality:AddToTabGroup(self.controls.groupLabel)
788773
slot.quality.enabled = function()
774+
if index == 1 and self.displayGroup and (self.displayGroup.sourceItem or self.displayGroup.sourceNode) then
775+
return false
776+
end
789777
return index <= #self.displayGroup.gemList
790778
end
791779
self.controls["gemSlot"..index.."Quality"] = slot.quality
@@ -825,6 +813,9 @@ function SkillsTabClass:CreateGemSlot(index)
825813
end
826814
end
827815
slot.enabled.enabled = function()
816+
if index == 1 and self.displayGroup and (self.displayGroup.sourceItem or self.displayGroup.sourceNode) then
817+
return false
818+
end
828819
return index <= #self.displayGroup.gemList
829820
end
830821
self.controls["gemSlot"..index.."Enable"] = slot.enabled
@@ -866,6 +857,9 @@ function SkillsTabClass:CreateGemSlot(index)
866857
end
867858
end
868859
slot.count.enabled = function()
860+
if index == 1 and self.displayGroup and (self.displayGroup.sourceItem or self.displayGroup.sourceNode) then
861+
return false
862+
end
869863
return index <= #self.displayGroup.gemList
870864
end
871865
self.controls["gemSlot"..index.."Count"] = slot.count
@@ -1017,13 +1011,14 @@ function SkillsTabClass:ProcessSocketGroup(socketGroup)
10171011
end
10181012
elseif gemInstance.skillId then
10191013
-- Specified by skill ID
1020-
-- Used for skills granted by items
1014+
-- Used for skills granted by items / nodes
10211015
gemInstance.errMsg = nil
1022-
local gemId = data.gemForSkill[gemInstance.skillId]
1016+
local grantedEffect = data.skills[gemInstance.skillId]
1017+
local gemId = data.gemForSkill[grantedEffect]
10231018
if gemId then
10241019
gemInstance.gemData = data.gems[gemId]
10251020
else
1026-
gemInstance.grantedEffect = data.skills[gemInstance.skillId]
1021+
gemInstance.grantedEffect = grantedEffect
10271022
end
10281023
if gemInstance.triggered and gemInstance.grantedEffect then
10291024
if gemInstance.grantedEffect.levels[gemInstance.level] then
@@ -1083,6 +1078,14 @@ function SkillsTabClass:SetDisplayGroup(socketGroup)
10831078
self.controls.groupLabel:SetText(socketGroup.label)
10841079
self.controls.groupEnabled.state = socketGroup.enabled
10851080
self.controls.includeInFullDPS.state = socketGroup.includeInFullDPS and socketGroup.enabled
1081+
if socketGroup.sourceItem then
1082+
socketGroup.set1 = true
1083+
socketGroup.set2 = false
1084+
elseif socketGroup.sourceNode then
1085+
socketGroup.set1 = true
1086+
socketGroup.set2 = true
1087+
end
1088+
10861089
self.controls.set1Enabled.state = socketGroup.set1 == nil and true or socketGroup.set1
10871090
self.controls.set2Enabled.state = socketGroup.set2 == nil and true or socketGroup.set2
10881091
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
@@ -1294,8 +1294,7 @@ function calcs.initEnv(build, mode, override, specEnv)
12941294
group.noSupports = grantedSkill.noSupports
12951295
activeGemInstance.triggered = grantedSkill.triggered
12961296
activeGemInstance.triggerChance = grantedSkill.triggerChance
1297-
wipeTable(group.gemList)
1298-
t_insert(group.gemList, activeGemInstance)
1297+
group.gemList[1] = activeGemInstance
12991298
build.skillsTab:ProcessSocketGroup(group)
13001299
end
13011300

0 commit comments

Comments
 (0)