Skip to content

Commit c6aeacd

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

File tree

3 files changed

+32
-46
lines changed

3 files changed

+32
-46
lines changed

src/Classes/SkillListControl.lua

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

src/Classes/SkillsTab.lua

Lines changed: 19 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -162,31 +162,20 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont
162162
self:AddUndoState()
163163
self.build.buildFlag = true
164164
end)
165-
self.controls.groupSlotLabel = new("LabelControl", { "TOPLEFT", self.anchorGroupDetail, "TOPLEFT" }, { 0, 30, 0, 16 }, "^7Socketed in:")
166-
self.controls.groupSlot = new("DropDownControl", { "TOPLEFT", self.anchorGroupDetail, "TOPLEFT" }, { 85, 28, 130, 20 }, groupSlotDropList, function(index, value)
167-
self.displayGroup.slot = value.slotName
165+
166+
self.controls.set1Enabled = new("CheckBoxControl", { "TOPLEFT", self.anchorGroupDetail, "TOPLEFT" }, { 42, 30, 20 }, "Set 1:", function(state)
167+
self.displayGroup.set1 = state
168168
self:AddUndoState()
169169
self.build.buildFlag = true
170170
end)
171-
self.controls.groupSlot.tooltipFunc = function(tooltip, mode, index, value)
172-
tooltip:Clear()
173-
if mode == "OUT" or index == 1 then
174-
tooltip:AddLine(16, "Select the item in which this skill is socketed.")
175-
tooltip:AddLine(16, "This will allow the skill to benefit from modifiers on the item that affect socketed gems.")
176-
else
177-
local slot = self.build.itemsTab.slots[value.slotName]
178-
local ttItem = self.build.itemsTab.items[slot.selItemId]
179-
if ttItem then
180-
self.build.itemsTab:AddItemTooltip(tooltip, ttItem, slot)
181-
else
182-
tooltip:AddLine(16, "No item is equipped in this slot.")
183-
end
184-
end
185-
end
186-
self.controls.groupSlot.enabled = function()
187-
return self.displayGroup.source == nil
188-
end
189-
self.controls.groupEnabled = new("CheckBoxControl", { "LEFT", self.controls.groupSlot, "RIGHT" }, { 70, 0, 20 }, "Enabled:", function(state)
171+
172+
self.controls.set2Enabled = new("CheckBoxControl", { "LEFT", self.controls.set1Enabled, "RIGHT" }, { 50, 0, 20 }, "Set 2:", function(state)
173+
self.displayGroup.set2 = state
174+
self:AddUndoState()
175+
self.build.buildFlag = true
176+
end)
177+
178+
self.controls.groupEnabled = new("CheckBoxControl", { "LEFT", self.controls.set2Enabled, "RIGHT" }, { 70, 0, 20 }, "Enabled:", function(state)
190179
self.displayGroup.enabled = state
191180
self:AddUndoState()
192181
self.build.buildFlag = true
@@ -208,7 +197,7 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont
208197
self.controls.groupCount.shown = function()
209198
return self.displayGroup.source ~= nil
210199
end
211-
self.controls.sourceNote = new("LabelControl", { "TOPLEFT", self.controls.groupSlotLabel, "TOPLEFT" }, { 0, 30, 0, 16 })
200+
self.controls.sourceNote = new("LabelControl", { "TOPLEFT", self.controls.set1Enabled, "TOPLEFT" }, { -42, 30, 0, 16 })
212201
self.controls.sourceNote.shown = function()
213202
return self.displayGroup.source ~= nil
214203
end
@@ -274,8 +263,9 @@ function SkillsTabClass:LoadSkill(node, skillSetId)
274263
socketGroup.includeInFullDPS = node.attrib.includeInFullDPS and node.attrib.includeInFullDPS == "true"
275264
socketGroup.groupCount = tonumber(node.attrib.groupCount)
276265
socketGroup.label = node.attrib.label
277-
socketGroup.slot = node.attrib.slot
278266
socketGroup.source = node.attrib.source
267+
socketGroup.set1 = node.attrib.set1 and node.attrib.set1 == "true"
268+
socketGroup.set2 = node.attrib.set2 and node.attrib.set2 == "true"
279269
socketGroup.mainActiveSkill = tonumber(node.attrib.mainActiveSkill) or 1
280270
socketGroup.mainActiveSkillCalcs = tonumber(node.attrib.mainActiveSkillCalcs) or 1
281271
socketGroup.gemList = { }
@@ -430,8 +420,9 @@ function SkillsTabClass:Save(xml)
430420
includeInFullDPS = tostring(socketGroup.includeInFullDPS),
431421
groupCount = socketGroup.groupCount ~= nil and tostring(socketGroup.groupCount),
432422
label = socketGroup.label,
433-
slot = socketGroup.slot,
434423
source = socketGroup.source,
424+
set1 = tostring(socketGroup.set1 or true),
425+
set2 = tostring(socketGroup.set2 or true),
435426
mainActiveSkill = tostring(socketGroup.mainActiveSkill),
436427
mainActiveSkillCalcs = tostring(socketGroup.mainActiveSkillCalcs),
437428
} }
@@ -571,9 +562,6 @@ function SkillsTabClass:CopySocketGroup(socketGroup)
571562
if socketGroup.label and socketGroup.label:match("%S") then
572563
skillText = skillText .. "Label: " .. socketGroup.label .. "\r\n"
573564
end
574-
if socketGroup.slot then
575-
skillText = skillText .. "Slot: " .. socketGroup.slot .. "\r\n"
576-
end
577565
for _, gemInstance in ipairs(socketGroup.gemList) do
578566
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)
579567
end
@@ -588,10 +576,6 @@ function SkillsTabClass:PasteSocketGroup(testInput)
588576
if label then
589577
newGroup.label = label
590578
end
591-
local slot = skillText:match("Slot: (%C+)")
592-
if slot then
593-
newGroup.slot = slot
594-
end
595579
for nameSpec, level, quality, state, count in skillText:gmatch("([ %a']+) (%d+)/(%d+) ?(%a*) (%d+)") do
596580
t_insert(newGroup.gemList, {
597581
nameSpec = nameSpec,
@@ -1097,9 +1081,10 @@ function SkillsTabClass:SetDisplayGroup(socketGroup)
10971081

10981082
-- Update the main controls
10991083
self.controls.groupLabel:SetText(socketGroup.label)
1100-
self.controls.groupSlot:SelByValue(socketGroup.slot, "slotName")
11011084
self.controls.groupEnabled.state = socketGroup.enabled
11021085
self.controls.includeInFullDPS.state = socketGroup.includeInFullDPS and socketGroup.enabled
1086+
self.controls.set1Enabled.state = socketGroup.set1 == nil and true or socketGroup.set1
1087+
self.controls.set2Enabled.state = socketGroup.set2 == nil and true or socketGroup.set2
11031088
self.controls.groupCount:SetText(socketGroup.groupCount or 1)
11041089

11051090
-- Update the gem slot controls
@@ -1123,9 +1108,6 @@ function SkillsTabClass:AddSocketGroupTooltip(tooltip, socketGroup)
11231108
end
11241109
return
11251110
end
1126-
if socketGroup.enabled and not socketGroup.slotEnabled then
1127-
tooltip:AddLine(16, "^7Note: this group is disabled because it is socketed in the inactive weapon set.")
1128-
end
11291111
local sourceSingle = socketGroup.sourceItem or socketGroup.sourceNode
11301112
if sourceSingle then
11311113
tooltip:AddLine(18, "^7Source: " .. colorCodes[sourceSingle.rarity or "NORMAL"] .. sourceSingle.name)
@@ -1180,7 +1162,7 @@ function SkillsTabClass:AddSocketGroupTooltip(tooltip, socketGroup)
11801162
reason = "(Unsupported)"
11811163
elseif not gemInstance.enabled then
11821164
reason = "(Disabled)"
1183-
elseif not socketGroup.enabled or not socketGroup.slotEnabled then
1165+
elseif not socketGroup.enabled then
11841166
elseif grantedEffect.support then
11851167
if displayEffect.superseded then
11861168
reason = "(Superseded)"

src/Modules/CalcSetup.lua

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

717-
-- add Conditional WeaponSet# base on weapon set from item
718-
modDB:NewMod("Condition:WeaponSet" .. (build.itemsTab.activeItemSet.useSecondWeaponSet and 2 or 1) , "FLAG", true, "Weapon Set")
719-
720717
-- Build and merge item modifiers, and create list of radius jewels
721718
if not accelerate.requirementsItems then
722719
local items = {}
@@ -1413,15 +1410,22 @@ function calcs.initEnv(build, mode, override, specEnv)
14131410
t_insert(env.crossLinkedSupportGroups[mod.mod.sourceSlot], mod.value.targetSlotName)
14141411
end
14151412

1413+
-- alway use WeaponSet 1 for condition unless set 1 false and set 2 true
1414+
local mainSkill = build.skillsTab.socketGroupList[env.mainSocketGroup]
1415+
local usingSkillSet = mainSkill and not mainSkill.set1 and mainSkill.set2 and 2 or 1
1416+
1417+
env.usingSkillSet = usingSkillSet
1418+
modDB:NewMod("Condition:WeaponSet" .. usingSkillSet , "FLAG", true, "Weapon Set")
1419+
14161420
local supportLists = { }
14171421
local groupCfgList = { }
14181422
local processedSockets = {}
14191423
-- Process support gems adding them to applicable support lists
14201424
for index, group in ipairs(build.skillsTab.socketGroupList) do
1421-
local slot = group.slot and build.itemsTab.slots[group.slot]
1422-
group.slotEnabled = not slot or not slot.weaponSet or slot.weaponSet == (build.itemsTab.activeItemSet.useSecondWeaponSet and 2 or 1)
1425+
group.usingSkillSet = not group.set1 and group.set2 and 2 or 1
1426+
14231427
-- if group is main skill or group is enabled
1424-
if index == env.mainSocketGroup or (group.enabled and group.slotEnabled) then
1428+
if index == env.mainSocketGroup or (group.enabled and group.usingSkillSet == env.usingSkillSet) then
14251429
local slotName = group.slot and group.slot:gsub(" Swap","")
14261430
groupCfgList[slotName or "noSlot"] = groupCfgList[slotName or "noSlot"] or {}
14271431
groupCfgList[slotName or "noSlot"][group] = groupCfgList[slotName or "noSlot"][group] or {
@@ -1527,7 +1531,7 @@ function calcs.initEnv(build, mode, override, specEnv)
15271531
-- Process active skills adding the applicable supports
15281532
local socketGroupSkillListList = { }
15291533
for index, group in ipairs(build.skillsTab.socketGroupList) do
1530-
if index == env.mainSocketGroup or (group.enabled and group.slotEnabled) then
1534+
if index == env.mainSocketGroup or (group.enabled and group.usingSkillSet == env.usingSkillSet) then
15311535
local slotName = group.slot and group.slot:gsub(" Swap","")
15321536
groupCfgList[slotName or "noSlot"][group] = groupCfgList[slotName or "noSlot"][group] or {
15331537
slotName = slotName,
@@ -1655,7 +1659,7 @@ function calcs.initEnv(build, mode, override, specEnv)
16551659
socketGroupSkillListList[slotName or "noSlot"] = socketGroupSkillListList[slotName or "noSlot"] or {}
16561660
socketGroupSkillListList[slotName or "noSlot"][group] = socketGroupSkillListList[slotName or "noSlot"][group] or {}
16571661
local socketGroupSkillList = socketGroupSkillListList[slotName or "noSlot"][group]
1658-
if index == env.mainSocketGroup or (group.enabled and group.slotEnabled) then
1662+
if index == env.mainSocketGroup or (group.enabled and group.usingSkillSet == env.usingSkillSet) then
16591663
groupCfgList[slotName or "noSlot"][group] = groupCfgList[slotName or "noSlot"][group] or {
16601664
slotName = slotName,
16611665
propertyModList = env.modDB:Tabulate("LIST", {slotName = slotName}, "GemProperty")

0 commit comments

Comments
 (0)