@@ -169,10 +169,11 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont
169169 self .controls .groupSlot = new (" DropDownControl" , { " TOPLEFT" , self .anchorGroupDetail , " TOPLEFT" }, { 85 , 28 , 130 , 20 }, groupSlotDropList , function (index , value )
170170 -- maintain imbued support to new slot
171171 if self .imbuedSupportBySlot [self .displayGroup .slot ] and self .displayGroup .imbuedSupport then
172- if value .label ~= " None" then
172+ if value .label ~= " None" and not self . imbuedSupportBySlot [ value . label ] then
173173 self .imbuedSupportBySlot [value .label ] = copyTable (self .imbuedSupportBySlot [self .displayGroup .slot ], true )
174174 else
175- self .controls .imbuedSupport .selIndex = 1 -- reset dropdown to None if socketedIn switched to None
175+ self .controls .imbuedSupport .gemId = nil
176+ self .controls .imbuedSupport :SetText (" " )
176177 self .displayGroup .imbuedSupport = nil -- reset saved support to None
177178 end
178179 self .imbuedSupportBySlot [self .displayGroup .slot ] = nil
@@ -211,54 +212,38 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont
211212 self .build .buildFlag = true
212213 end )
213214
214- local imbuedSupportList = { }
215- local gemColor = " ^7"
216- for _ , gem in pairs (data .gems ) do
217- if gem .tagString :match (" Support" ) and not gem .tagString :match (" Exceptional" ) and not gem .name :match (" Awakened" ) then
218- -- wanted to add color but with sorting by name, it scrambled the gems AND we use value in the code later in CalcSetup and breaks Dropdown:SelByValue so we'd have to scrub it anyways
219- -- if gem.grantedEffect then
220- -- if gem.grantedEffect.color == 1 then
221- -- gemColor = colorCodes.STRENGTH
222- -- elseif gem.grantedEffect.color == 2 then
223- -- gemColor = colorCodes.DEXTERITY
224- -- elseif gem.grantedEffect.color == 3 then
225- -- gemColor = colorCodes.INTELLIGENCE
226- -- end
227- -- end
228- t_insert (imbuedSupportList , gem .name )
229- end
230- end
231- t_sort (imbuedSupportList )
232- t_insert (imbuedSupportList , 1 , " None" )
233-
234215 self .imbuedSupportBySlot = { }
235216 self .controls .imbuedSupportLabel = new (" LabelControl" , { " LEFT" , self .controls .includeInFullDPS , " RIGHT" }, { 12 , 0 , 0 , 16 }, colorCodes .POSITIVE .. " Imbued Support:" )
236- self .controls .imbuedSupport = new (" DropDownControl" , { " LEFT" , self .controls .imbuedSupportLabel , " RIGHT" }, { 8 , 0 , 250 , 20 }, imbuedSupportList , function (_ , value , slotName ) -- slotName used on Import
237- local gemName = value :gsub (" %^7" , " " )
238- if value == " None" then
239- self .imbuedSupportBySlot [slotName or self .displayGroup .slot ] = nil
217+ self .controls .imbuedSupport = new (" GemSelectControl" , { " LEFT" , self .controls .imbuedSupportLabel , " RIGHT" }, { 8 , 0 , 250 , 20 }, self , 1 , function (gemData , _ , _ , slotName ) -- slotName used on Import
218+ if gemData and (type (gemData ) == " string" or gemData .id ) then
219+ self .imbuedSupportBySlot [slotName or self .displayGroup .slot ] = data .gems [gemData .id or gemData ].grantedEffect
220+ if self .displayGroup then
221+ self .displayGroup .imbuedSupport = data .gems [gemData .id or gemData ].name
222+ end
223+ self .build .buildFlag = true
240224 else
241- self .imbuedSupportBySlot [slotName or self .displayGroup .slot ] = data .gems [data .gemForBaseName [gemName :lower ().. " support" ]].grantedEffect
242- end
243-
244- if self .displayGroup then
245- self .displayGroup .imbuedSupport = gemName
225+ self .imbuedSupportBySlot [slotName or self .displayGroup .slot ] = nil
246226 end
247- self .build .buildFlag = true
248- end )
227+ end , nil , true )
249228 self .controls .imbuedSupport .enabled = function ()
250229 -- socketedIn must be set and the displayGroup must have an imbued, otherwise disable the imbued dropdown
251- if self .displayGroup .slot and ((self .imbuedSupportBySlot [self .displayGroup .slot ] and (self .displayGroup .imbuedSupport and self .displayGroup .imbuedSupport ~= " None" ) or not self .imbuedSupportBySlot [self .displayGroup .slot ])) then
252- self .controls .imbuedSupport .tooltipText = nil
230+ if self .displayGroup .slot and ((self .imbuedSupportBySlot [self .displayGroup .slot ] and self .displayGroup .imbuedSupport ) or not self .imbuedSupportBySlot [self .displayGroup .slot ]) then
253231 return true
254232 else
255- self .controls .imbuedSupport .tooltipText = " Imbued supports must be socketed in an item."
256233 return false
257234 end
258235 end
259236 self .controls .imbuedSupportLabel .shown = function () -- don't show imbued for skills from items
260237 return not self .displayGroup .source
261238 end
239+ self .controls .imbuedSupportClear = new (" ButtonControl" , { " LEFT" , self .controls .imbuedSupportLabel , " RIGHT" }, { 264 , 0 , 80 , 20 }, " Clear" , function ()
240+ self .controls .imbuedSupport .gemId = nil
241+ self .controls .imbuedSupport :SetText (" " )
242+ self .displayGroup .imbuedSupport = nil
243+ self .imbuedSupportBySlot [self .displayGroup .slot ] = nil
244+
245+ self .build .buildFlag = true
246+ end )
262247
263248 self .controls .groupCountLabel = new (" LabelControl" , { " LEFT" , self .controls .includeInFullDPS , " RIGHT" }, { 16 , 0 , 0 , 16 }, " Count:" )
264249 self .controls .groupCountLabel .shown = function ()
@@ -346,7 +331,7 @@ function SkillsTabClass:LoadSkill(node, skillSetId)
346331 socketGroup .gemList = { }
347332 if node .attrib .imbuedSupport and node .attrib .slot then
348333 socketGroup .imbuedSupport = node .attrib .imbuedSupport
349- self .controls .imbuedSupport .selFunc ( nil , socketGroup .imbuedSupport , socketGroup .slot )
334+ self .controls .imbuedSupport .gemChangeFunc ( data . gems [ data . gemForBaseName [ socketGroup .imbuedSupport : lower () .. " support " ]], nil , nil , socketGroup .slot )
350335 end
351336
352337 for _ , child in ipairs (node ) do
@@ -630,6 +615,12 @@ function SkillsTabClass:PasteSocketGroup(testInput)
630615 end
631616end
632617
618+ local function updateImbuedSupportIndex (control , gemListCount )
619+ if gemListCount > 0 then
620+ control .index = gemListCount + 1
621+ end
622+ end
623+
633624-- Create the controls for editing the gem at a given index
634625function SkillsTabClass :CreateGemSlot (index )
635626 local slot = { }
@@ -649,6 +640,7 @@ function SkillsTabClass:CreateGemSlot(index)
649640 self .gemSlots [index2 ].enableGlobal2 .state = gemInstance .enableGlobal2
650641 self .gemSlots [index2 ].count :SetText (gemInstance .count or 1 )
651642 end
643+ updateImbuedSupportIndex (self .controls .imbuedSupport , # self .displayGroup .gemList )
652644 self :AddUndoState ()
653645 self .build .buildFlag = true
654646 end )
@@ -952,10 +944,12 @@ function SkillsTabClass:FindSkillGem(nameSpec)
952944 return " Unrecognised gem name '" .. nameSpec .. " '"
953945end
954946
955- function SkillsTabClass :ProcessGemLevel (gemData )
947+ function SkillsTabClass :ProcessGemLevel (gemData , imbued )
956948 local grantedEffect = gemData .grantedEffect
957949 local naturalMaxLevel = gemData .naturalMaxLevel
958- if self .defaultGemLevel == " awakenedMaximum" then
950+ if imbued or self .defaultGemLevel == " levelOne" then
951+ return 1
952+ elseif self .defaultGemLevel == " awakenedMaximum" then
959953 return naturalMaxLevel + 1
960954 elseif self .defaultGemLevel == " corruptedMaximum" then
961955 if grantedEffect .plusVersionOf then
@@ -965,8 +959,6 @@ function SkillsTabClass:ProcessGemLevel(gemData)
965959 end
966960 elseif self .defaultGemLevel == " normalMaximum" then
967961 return naturalMaxLevel
968- elseif self .defaultGemLevel == " levelOne" then
969- return 1
970962 else -- self.defaultGemLevel == "characterLevel"
971963 local maxGemLevel = naturalMaxLevel
972964 if not grantedEffect .levels [maxGemLevel ] then
@@ -1056,6 +1048,7 @@ function SkillsTabClass:ProcessSocketGroup(socketGroup)
10561048 end
10571049 end
10581050 end
1051+ updateImbuedSupportIndex (self .controls .imbuedSupport , # socketGroup .gemList )
10591052end
10601053
10611054-- Set the skill to be displayed/edited
@@ -1070,7 +1063,13 @@ function SkillsTabClass:SetDisplayGroup(socketGroup)
10701063 self .controls .groupEnabled .state = socketGroup .enabled
10711064 self .controls .includeInFullDPS .state = socketGroup .includeInFullDPS and socketGroup .enabled
10721065 self .controls .groupCount :SetText (socketGroup .groupCount or 1 )
1073- self .controls .imbuedSupport :SelByValue (socketGroup .imbuedSupport or " None" )
1066+ if socketGroup .imbuedSupport then
1067+ self .controls .imbuedSupport .gemId = data .gems [data .gemForBaseName [socketGroup .imbuedSupport :lower ().. " support" ]]
1068+ self .controls .imbuedSupport :SetText (socketGroup .imbuedSupport )
1069+ else
1070+ self .controls .imbuedSupport .gemId = nil
1071+ self .controls .imbuedSupport :SetText (" " )
1072+ end
10741073
10751074 -- Update the gem slot controls
10761075 self :UpdateGemSlots ()
0 commit comments