Skip to content

Commit d6803aa

Browse files
author
justjuangui
committed
Adding suport for get to choose a set, remove slot from skill
1 parent f98a983 commit d6803aa

File tree

3 files changed

+32
-62
lines changed

3 files changed

+32
-62
lines changed

src/Classes/SkillListControl.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function SkillListClass:GetRowValue(column, index, socketGroup)
7171
if column == 1 then
7272
local label = socketGroup.displayLabel or "?"
7373
local currentMainSkill = self.skillsTab.build.mainSocketGroup == index
74-
local disabled = not socketGroup.enabled or not socketGroup.slotEnabled
74+
local disabled = not socketGroup.enabled
7575
if disabled then
7676
local colour = currentMainSkill and "" or "^x7F7F7F"
7777
label = colour .. label .. " (Disabled)"

src/Classes/SkillsTab.lua

Lines changed: 19 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,6 @@ local t_remove = table.remove
1010
local m_min = math.min
1111
local m_max = math.max
1212

13-
local groupSlotDropList = {
14-
{ label = "None" },
15-
{ label = "Weapon 1", slotName = "Weapon 1" },
16-
{ label = "Weapon 2", slotName = "Weapon 2" },
17-
{ label = "Weapon 1 (Swap)", slotName = "Weapon 1 Swap" },
18-
{ label = "Weapon 2 (Swap)", slotName = "Weapon 2 Swap" },
19-
{ label = "Helmet", slotName = "Helmet" },
20-
{ label = "Body Armour", slotName = "Body Armour" },
21-
{ label = "Gloves", slotName = "Gloves" },
22-
{ label = "Boots", slotName = "Boots" },
23-
{ label = "Amulet", slotName = "Amulet" },
24-
{ label = "Ring 1", slotName = "Ring 1" },
25-
{ label = "Ring 2", slotName = "Ring 2" },
26-
{ label = "Belt", slotName = "Belt" },
27-
}
28-
2913
local defaultGemLevelList = {
3014
{
3115
label = "Normal Maximum",
@@ -161,31 +145,20 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont
161145
self:AddUndoState()
162146
self.build.buildFlag = true
163147
end)
164-
self.controls.groupSlotLabel = new("LabelControl", { "TOPLEFT", self.anchorGroupDetail, "TOPLEFT" }, { 0, 30, 0, 16 }, "^7Socketed in:")
165-
self.controls.groupSlot = new("DropDownControl", { "TOPLEFT", self.anchorGroupDetail, "TOPLEFT" }, { 85, 28, 130, 20 }, groupSlotDropList, function(index, value)
166-
self.displayGroup.slot = value.slotName
148+
149+
self.controls.set1Enabled = new("CheckBoxControl", { "TOPLEFT", self.anchorGroupDetail, "TOPLEFT" }, { 42, 30, 20 }, "Set 1:", function(state)
150+
self.displayGroup.set1 = state
167151
self:AddUndoState()
168152
self.build.buildFlag = true
169153
end)
170-
self.controls.groupSlot.tooltipFunc = function(tooltip, mode, index, value)
171-
tooltip:Clear()
172-
if mode == "OUT" or index == 1 then
173-
tooltip:AddLine(16, "Select the item in which this skill is socketed.")
174-
tooltip:AddLine(16, "This will allow the skill to benefit from modifiers on the item that affect socketed gems.")
175-
else
176-
local slot = self.build.itemsTab.slots[value.slotName]
177-
local ttItem = self.build.itemsTab.items[slot.selItemId]
178-
if ttItem then
179-
self.build.itemsTab:AddItemTooltip(tooltip, ttItem, slot)
180-
else
181-
tooltip:AddLine(16, "No item is equipped in this slot.")
182-
end
183-
end
184-
end
185-
self.controls.groupSlot.enabled = function()
186-
return self.displayGroup.source == nil
187-
end
188-
self.controls.groupEnabled = new("CheckBoxControl", { "LEFT", self.controls.groupSlot, "RIGHT" }, { 70, 0, 20 }, "Enabled:", function(state)
154+
155+
self.controls.set2Enabled = new("CheckBoxControl", { "LEFT", self.controls.set1Enabled, "RIGHT" }, { 50, 0, 20 }, "Set 2:", function(state)
156+
self.displayGroup.set2 = state
157+
self:AddUndoState()
158+
self.build.buildFlag = true
159+
end)
160+
161+
self.controls.groupEnabled = new("CheckBoxControl", { "LEFT", self.controls.set2Enabled, "RIGHT" }, { 70, 0, 20 }, "Enabled:", function(state)
189162
self.displayGroup.enabled = state
190163
self:AddUndoState()
191164
self.build.buildFlag = true
@@ -207,7 +180,7 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont
207180
self.controls.groupCount.shown = function()
208181
return self.displayGroup.source ~= nil
209182
end
210-
self.controls.sourceNote = new("LabelControl", { "TOPLEFT", self.controls.groupSlotLabel, "TOPLEFT" }, { 0, 30, 0, 16 })
183+
self.controls.sourceNote = new("LabelControl", { "TOPLEFT", self.controls.set1Enabled, "TOPLEFT" }, { -42, 30, 0, 16 })
211184
self.controls.sourceNote.shown = function()
212185
return self.displayGroup.source ~= nil
213186
end
@@ -273,8 +246,9 @@ function SkillsTabClass:LoadSkill(node, skillSetId)
273246
socketGroup.includeInFullDPS = node.attrib.includeInFullDPS and node.attrib.includeInFullDPS == "true"
274247
socketGroup.groupCount = tonumber(node.attrib.groupCount)
275248
socketGroup.label = node.attrib.label
276-
socketGroup.slot = node.attrib.slot
277249
socketGroup.source = node.attrib.source
250+
socketGroup.set1 = node.attrib.set1 and node.attrib.set1 == "true"
251+
socketGroup.set2 = node.attrib.set2 and node.attrib.set2 == "true"
278252
socketGroup.mainActiveSkill = tonumber(node.attrib.mainActiveSkill) or 1
279253
socketGroup.mainActiveSkillCalcs = tonumber(node.attrib.mainActiveSkillCalcs) or 1
280254
socketGroup.gemList = { }
@@ -429,8 +403,9 @@ function SkillsTabClass:Save(xml)
429403
includeInFullDPS = tostring(socketGroup.includeInFullDPS),
430404
groupCount = socketGroup.groupCount ~= nil and tostring(socketGroup.groupCount),
431405
label = socketGroup.label,
432-
slot = socketGroup.slot,
433406
source = socketGroup.source,
407+
set1 = tostring(socketGroup.set1 or true),
408+
set2 = tostring(socketGroup.set2 or true),
434409
mainActiveSkill = tostring(socketGroup.mainActiveSkill),
435410
mainActiveSkillCalcs = tostring(socketGroup.mainActiveSkillCalcs),
436411
} }
@@ -570,9 +545,6 @@ function SkillsTabClass:CopySocketGroup(socketGroup)
570545
if socketGroup.label and socketGroup.label:match("%S") then
571546
skillText = skillText .. "Label: " .. socketGroup.label .. "\r\n"
572547
end
573-
if socketGroup.slot then
574-
skillText = skillText .. "Slot: " .. socketGroup.slot .. "\r\n"
575-
end
576548
for _, gemInstance in ipairs(socketGroup.gemList) do
577549
skillText = skillText .. string.format("%s %d/%d %s %d\r\n", gemInstance.nameSpec, gemInstance.level, gemInstance.quality, gemInstance.enabled and "" or "DISABLED", gemInstance.count or 1)
578550
end
@@ -587,10 +559,6 @@ function SkillsTabClass:PasteSocketGroup(testInput)
587559
if label then
588560
newGroup.label = label
589561
end
590-
local slot = skillText:match("Slot: (%C+)")
591-
if slot then
592-
newGroup.slot = slot
593-
end
594562
for nameSpec, level, quality, state, count in skillText:gmatch("([ %a']+) (%d+)/(%d+) ?(%a*) (%d+)") do
595563
t_insert(newGroup.gemList, {
596564
nameSpec = nameSpec,
@@ -1096,9 +1064,10 @@ function SkillsTabClass:SetDisplayGroup(socketGroup)
10961064

10971065
-- Update the main controls
10981066
self.controls.groupLabel:SetText(socketGroup.label)
1099-
self.controls.groupSlot:SelByValue(socketGroup.slot, "slotName")
11001067
self.controls.groupEnabled.state = socketGroup.enabled
11011068
self.controls.includeInFullDPS.state = socketGroup.includeInFullDPS and socketGroup.enabled
1069+
self.controls.set1Enabled.state = socketGroup.set1 == nil and true or socketGroup.set1
1070+
self.controls.set2Enabled.state = socketGroup.set2 == nil and true or socketGroup.set2
11021071
self.controls.groupCount:SetText(socketGroup.groupCount or 1)
11031072

11041073
-- Update the gem slot controls
@@ -1122,9 +1091,6 @@ function SkillsTabClass:AddSocketGroupTooltip(tooltip, socketGroup)
11221091
end
11231092
return
11241093
end
1125-
if socketGroup.enabled and not socketGroup.slotEnabled then
1126-
tooltip:AddLine(16, "^7Note: this group is disabled because it is socketed in the inactive weapon set.")
1127-
end
11281094
local sourceSingle = socketGroup.sourceItem or socketGroup.sourceNode
11291095
if sourceSingle then
11301096
tooltip:AddLine(18, "^7Source: " .. colorCodes[sourceSingle.rarity or "NORMAL"] .. sourceSingle.name)
@@ -1179,7 +1145,7 @@ function SkillsTabClass:AddSocketGroupTooltip(tooltip, socketGroup)
11791145
reason = "(Unsupported)"
11801146
elseif not gemInstance.enabled then
11811147
reason = "(Disabled)"
1182-
elseif not socketGroup.enabled or not socketGroup.slotEnabled then
1148+
elseif not socketGroup.enabled then
11831149
elseif grantedEffect.support then
11841150
if displayEffect.superseded then
11851151
reason = "(Superseded)"

src/Modules/CalcSetup.lua

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -706,9 +706,6 @@ function calcs.initEnv(build, mode, override, specEnv)
706706
modDB:NewMod("Multiplier:AllocatedLifeMastery", "BASE", allocatedMasteryTypes["Life Mastery"])
707707
end
708708

709-
-- add Conditional WeaponSet# base on weapon set from item
710-
modDB:NewMod("Condition:WeaponSet" .. (build.itemsTab.activeItemSet.useSecondWeaponSet and 2 or 1) , "FLAG", true, "Weapon Set")
711-
712709
-- Build and merge item modifiers, and create list of radius jewels
713710
if not accelerate.requirementsItems then
714711
local items = {}
@@ -1380,15 +1377,22 @@ function calcs.initEnv(build, mode, override, specEnv)
13801377
t_insert(env.crossLinkedSupportGroups[mod.mod.sourceSlot], mod.value.targetSlotName)
13811378
end
13821379

1380+
-- alway use WeaponSet 1 for condition unless set 1 false and set 2 true
1381+
local mainSkill = build.skillsTab.socketGroupList[env.mainSocketGroup]
1382+
local usingSkillSet = mainSkill and not mainSkill.set1 and mainSkill.set2 and 2 or 1
1383+
1384+
env.usingSkillSet = usingSkillSet
1385+
modDB:NewMod("Condition:WeaponSet" .. usingSkillSet , "FLAG", true, "Weapon Set")
1386+
13831387
local supportLists = { }
13841388
local groupCfgList = { }
13851389
local processedSockets = {}
13861390
-- Process support gems adding them to applicable support lists
13871391
for index, group in ipairs(build.skillsTab.socketGroupList) do
1388-
local slot = group.slot and build.itemsTab.slots[group.slot]
1389-
group.slotEnabled = not slot or not slot.weaponSet or slot.weaponSet == (build.itemsTab.activeItemSet.useSecondWeaponSet and 2 or 1)
1392+
group.usingSkillSet = not group.set1 and group.set2 and 2 or 1
1393+
13901394
-- if group is main skill or group is enabled
1391-
if index == env.mainSocketGroup or (group.enabled and group.slotEnabled) then
1395+
if index == env.mainSocketGroup or (group.enabled and group.usingSkillSet == env.usingSkillSet) then
13921396
local slotName = group.slot and group.slot:gsub(" Swap","")
13931397
groupCfgList[slotName or "noSlot"] = groupCfgList[slotName or "noSlot"] or {}
13941398
groupCfgList[slotName or "noSlot"][group] = groupCfgList[slotName or "noSlot"][group] or {
@@ -1494,7 +1498,7 @@ function calcs.initEnv(build, mode, override, specEnv)
14941498
-- Process active skills adding the applicable supports
14951499
local socketGroupSkillListList = { }
14961500
for index, group in ipairs(build.skillsTab.socketGroupList) do
1497-
if index == env.mainSocketGroup or (group.enabled and group.slotEnabled) then
1501+
if index == env.mainSocketGroup or (group.enabled and group.usingSkillSet == env.usingSkillSet) then
14981502
local slotName = group.slot and group.slot:gsub(" Swap","")
14991503
groupCfgList[slotName or "noSlot"][group] = groupCfgList[slotName or "noSlot"][group] or {
15001504
slotName = slotName,
@@ -1622,7 +1626,7 @@ function calcs.initEnv(build, mode, override, specEnv)
16221626
socketGroupSkillListList[slotName or "noSlot"] = socketGroupSkillListList[slotName or "noSlot"] or {}
16231627
socketGroupSkillListList[slotName or "noSlot"][group] = socketGroupSkillListList[slotName or "noSlot"][group] or {}
16241628
local socketGroupSkillList = socketGroupSkillListList[slotName or "noSlot"][group]
1625-
if index == env.mainSocketGroup or (group.enabled and group.slotEnabled) then
1629+
if index == env.mainSocketGroup or (group.enabled and group.usingSkillSet == env.usingSkillSet) then
16261630
groupCfgList[slotName or "noSlot"][group] = groupCfgList[slotName or "noSlot"][group] or {
16271631
slotName = slotName,
16281632
propertyModList = env.modDB:Tabulate("LIST", {slotName = slotName}, "GemProperty")

0 commit comments

Comments
 (0)