From 65b1e253a2ffa3e72d5c633f3652a6988e0246b0 Mon Sep 17 00:00:00 2001 From: justjuangui Date: Thu, 23 Jan 2025 21:37:13 -0500 Subject: [PATCH 1/9] Adding suport for get to choose a set, remove slot from skill --- src/Classes/SkillListControl.lua | 2 +- src/Classes/SkillsTab.lua | 56 +++++++++++--------------------- src/Modules/CalcSetup.lua | 20 +++++++----- 3 files changed, 32 insertions(+), 46 deletions(-) diff --git a/src/Classes/SkillListControl.lua b/src/Classes/SkillListControl.lua index 891f4374b4..bbe80eae71 100644 --- a/src/Classes/SkillListControl.lua +++ b/src/Classes/SkillListControl.lua @@ -72,7 +72,7 @@ function SkillListClass:GetRowValue(column, index, socketGroup) if column == 1 then local label = socketGroup.displayLabel or "?" local currentMainSkill = self.skillsTab.build.mainSocketGroup == index - local disabled = not socketGroup.enabled or not socketGroup.slotEnabled + local disabled = not socketGroup.enabled if disabled then local colour = currentMainSkill and "" or "^x7F7F7F" label = colour .. label .. " (Disabled)" diff --git a/src/Classes/SkillsTab.lua b/src/Classes/SkillsTab.lua index 61c75826db..80c0d8407d 100644 --- a/src/Classes/SkillsTab.lua +++ b/src/Classes/SkillsTab.lua @@ -162,31 +162,20 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont self:AddUndoState() self.build.buildFlag = true end) - self.controls.groupSlotLabel = new("LabelControl", { "TOPLEFT", self.anchorGroupDetail, "TOPLEFT" }, { 0, 30, 0, 16 }, "^7Socketed in:") - self.controls.groupSlot = new("DropDownControl", { "TOPLEFT", self.anchorGroupDetail, "TOPLEFT" }, { 85, 28, 130, 20 }, groupSlotDropList, function(index, value) - self.displayGroup.slot = value.slotName + + self.controls.set1Enabled = new("CheckBoxControl", { "TOPLEFT", self.anchorGroupDetail, "TOPLEFT" }, { 42, 30, 20 }, "Set 1:", function(state) + self.displayGroup.set1 = state self:AddUndoState() self.build.buildFlag = true end) - self.controls.groupSlot.tooltipFunc = function(tooltip, mode, index, value) - tooltip:Clear() - if mode == "OUT" or index == 1 then - tooltip:AddLine(16, "Select the item in which this skill is socketed.") - tooltip:AddLine(16, "This will allow the skill to benefit from modifiers on the item that affect socketed gems.") - else - local slot = self.build.itemsTab.slots[value.slotName] - local ttItem = self.build.itemsTab.items[slot.selItemId] - if ttItem then - self.build.itemsTab:AddItemTooltip(tooltip, ttItem, slot) - else - tooltip:AddLine(16, "No item is equipped in this slot.") - end - end - end - self.controls.groupSlot.enabled = function() - return self.displayGroup.source == nil - end - self.controls.groupEnabled = new("CheckBoxControl", { "LEFT", self.controls.groupSlot, "RIGHT" }, { 70, 0, 20 }, "Enabled:", function(state) + + self.controls.set2Enabled = new("CheckBoxControl", { "LEFT", self.controls.set1Enabled, "RIGHT" }, { 50, 0, 20 }, "Set 2:", function(state) + self.displayGroup.set2 = state + self:AddUndoState() + self.build.buildFlag = true + end) + + self.controls.groupEnabled = new("CheckBoxControl", { "LEFT", self.controls.set2Enabled, "RIGHT" }, { 70, 0, 20 }, "Enabled:", function(state) self.displayGroup.enabled = state self:AddUndoState() self.build.buildFlag = true @@ -208,7 +197,7 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont self.controls.groupCount.shown = function() return self.displayGroup.source ~= nil end - self.controls.sourceNote = new("LabelControl", { "TOPLEFT", self.controls.groupSlotLabel, "TOPLEFT" }, { 0, 30, 0, 16 }) + self.controls.sourceNote = new("LabelControl", { "TOPLEFT", self.controls.set1Enabled, "TOPLEFT" }, { -42, 30, 0, 16 }) self.controls.sourceNote.shown = function() return self.displayGroup.source ~= nil end @@ -274,8 +263,9 @@ function SkillsTabClass:LoadSkill(node, skillSetId) socketGroup.includeInFullDPS = node.attrib.includeInFullDPS and node.attrib.includeInFullDPS == "true" socketGroup.groupCount = tonumber(node.attrib.groupCount) socketGroup.label = node.attrib.label - socketGroup.slot = node.attrib.slot socketGroup.source = node.attrib.source + socketGroup.set1 = node.attrib.set1 and node.attrib.set1 == "true" + socketGroup.set2 = node.attrib.set2 and node.attrib.set2 == "true" socketGroup.mainActiveSkill = tonumber(node.attrib.mainActiveSkill) or 1 socketGroup.mainActiveSkillCalcs = tonumber(node.attrib.mainActiveSkillCalcs) or 1 socketGroup.gemList = { } @@ -430,8 +420,9 @@ function SkillsTabClass:Save(xml) includeInFullDPS = tostring(socketGroup.includeInFullDPS), groupCount = socketGroup.groupCount ~= nil and tostring(socketGroup.groupCount), label = socketGroup.label, - slot = socketGroup.slot, source = socketGroup.source, + set1 = tostring(socketGroup.set1 or true), + set2 = tostring(socketGroup.set2 or true), mainActiveSkill = tostring(socketGroup.mainActiveSkill), mainActiveSkillCalcs = tostring(socketGroup.mainActiveSkillCalcs), } } @@ -571,9 +562,6 @@ function SkillsTabClass:CopySocketGroup(socketGroup) if socketGroup.label and socketGroup.label:match("%S") then skillText = skillText .. "Label: " .. socketGroup.label .. "\r\n" end - if socketGroup.slot then - skillText = skillText .. "Slot: " .. socketGroup.slot .. "\r\n" - end for _, gemInstance in ipairs(socketGroup.gemList) do 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) end @@ -588,10 +576,6 @@ function SkillsTabClass:PasteSocketGroup(testInput) if label then newGroup.label = label end - local slot = skillText:match("Slot: (%C+)") - if slot then - newGroup.slot = slot - end for nameSpec, level, quality, state, count in skillText:gmatch("([ %a']+) (%d+)/(%d+) ?(%a*) (%d+)") do t_insert(newGroup.gemList, { nameSpec = nameSpec, @@ -1097,9 +1081,10 @@ function SkillsTabClass:SetDisplayGroup(socketGroup) -- Update the main controls self.controls.groupLabel:SetText(socketGroup.label) - self.controls.groupSlot:SelByValue(socketGroup.slot, "slotName") self.controls.groupEnabled.state = socketGroup.enabled self.controls.includeInFullDPS.state = socketGroup.includeInFullDPS and socketGroup.enabled + self.controls.set1Enabled.state = socketGroup.set1 == nil and true or socketGroup.set1 + self.controls.set2Enabled.state = socketGroup.set2 == nil and true or socketGroup.set2 self.controls.groupCount:SetText(socketGroup.groupCount or 1) -- Update the gem slot controls @@ -1123,9 +1108,6 @@ function SkillsTabClass:AddSocketGroupTooltip(tooltip, socketGroup) end return end - if socketGroup.enabled and not socketGroup.slotEnabled then - tooltip:AddLine(16, "^7Note: this group is disabled because it is socketed in the inactive weapon set.") - end local sourceSingle = socketGroup.sourceItem or socketGroup.sourceNode if sourceSingle then tooltip:AddLine(18, "^7Source: " .. colorCodes[sourceSingle.rarity or "NORMAL"] .. sourceSingle.name) @@ -1180,7 +1162,7 @@ function SkillsTabClass:AddSocketGroupTooltip(tooltip, socketGroup) reason = "(Unsupported)" elseif not gemInstance.enabled then reason = "(Disabled)" - elseif not socketGroup.enabled or not socketGroup.slotEnabled then + elseif not socketGroup.enabled then elseif grantedEffect.support then if displayEffect.superseded then reason = "(Superseded)" diff --git a/src/Modules/CalcSetup.lua b/src/Modules/CalcSetup.lua index 3693de1c95..232b3db62a 100644 --- a/src/Modules/CalcSetup.lua +++ b/src/Modules/CalcSetup.lua @@ -714,9 +714,6 @@ function calcs.initEnv(build, mode, override, specEnv) modDB:NewMod("Multiplier:AllocatedLifeMastery", "BASE", allocatedMasteryTypes["Life Mastery"]) end - -- add Conditional WeaponSet# base on weapon set from item - modDB:NewMod("Condition:WeaponSet" .. (build.itemsTab.activeItemSet.useSecondWeaponSet and 2 or 1) , "FLAG", true, "Weapon Set") - -- Build and merge item modifiers, and create list of radius jewels if not accelerate.requirementsItems then local items = {} @@ -1413,15 +1410,22 @@ function calcs.initEnv(build, mode, override, specEnv) t_insert(env.crossLinkedSupportGroups[mod.mod.sourceSlot], mod.value.targetSlotName) end + -- alway use WeaponSet 1 for condition unless set 1 false and set 2 true + local mainSkill = build.skillsTab.socketGroupList[env.mainSocketGroup] + local usingSkillSet = mainSkill and not mainSkill.set1 and mainSkill.set2 and 2 or 1 + + env.usingSkillSet = usingSkillSet + modDB:NewMod("Condition:WeaponSet" .. usingSkillSet , "FLAG", true, "Weapon Set") + local supportLists = { } local groupCfgList = { } local processedSockets = {} -- Process support gems adding them to applicable support lists for index, group in ipairs(build.skillsTab.socketGroupList) do - local slot = group.slot and build.itemsTab.slots[group.slot] - group.slotEnabled = not slot or not slot.weaponSet or slot.weaponSet == (build.itemsTab.activeItemSet.useSecondWeaponSet and 2 or 1) + group.usingSkillSet = not group.set1 and group.set2 and 2 or 1 + -- if group is main skill or group is enabled - if index == env.mainSocketGroup or (group.enabled and group.slotEnabled) then + if index == env.mainSocketGroup or (group.enabled and group.usingSkillSet == env.usingSkillSet) then local slotName = group.slot and group.slot:gsub(" Swap","") groupCfgList[slotName or "noSlot"] = groupCfgList[slotName or "noSlot"] or {} groupCfgList[slotName or "noSlot"][group] = groupCfgList[slotName or "noSlot"][group] or { @@ -1527,7 +1531,7 @@ function calcs.initEnv(build, mode, override, specEnv) -- Process active skills adding the applicable supports local socketGroupSkillListList = { } for index, group in ipairs(build.skillsTab.socketGroupList) do - if index == env.mainSocketGroup or (group.enabled and group.slotEnabled) then + if index == env.mainSocketGroup or (group.enabled and group.usingSkillSet == env.usingSkillSet) then local slotName = group.slot and group.slot:gsub(" Swap","") groupCfgList[slotName or "noSlot"][group] = groupCfgList[slotName or "noSlot"][group] or { slotName = slotName, @@ -1655,7 +1659,7 @@ function calcs.initEnv(build, mode, override, specEnv) socketGroupSkillListList[slotName or "noSlot"] = socketGroupSkillListList[slotName or "noSlot"] or {} socketGroupSkillListList[slotName or "noSlot"][group] = socketGroupSkillListList[slotName or "noSlot"][group] or {} local socketGroupSkillList = socketGroupSkillListList[slotName or "noSlot"][group] - if index == env.mainSocketGroup or (group.enabled and group.slotEnabled) then + if index == env.mainSocketGroup or (group.enabled and group.usingSkillSet == env.usingSkillSet) then groupCfgList[slotName or "noSlot"][group] = groupCfgList[slotName or "noSlot"][group] or { slotName = slotName, propertyModList = env.modDB:Tabulate("LIST", {slotName = slotName}, "GemProperty") From ce23424d96753d6920a05b25b82fb346be83194d Mon Sep 17 00:00:00 2001 From: justjuangui Date: Fri, 24 Jan 2025 00:50:09 -0500 Subject: [PATCH 2/9] GrantSkill from item and nodes now support supported gems --- src/Classes/SkillsTab.lua | 81 ++++++++++++++++++++------------------- src/Modules/CalcSetup.lua | 3 +- 2 files changed, 43 insertions(+), 41 deletions(-) diff --git a/src/Classes/SkillsTab.lua b/src/Classes/SkillsTab.lua index 80c0d8407d..78932c3f57 100644 --- a/src/Classes/SkillsTab.lua +++ b/src/Classes/SkillsTab.lua @@ -169,12 +169,20 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont self.build.buildFlag = true end) + self.controls.set1Enabled.enabled = function() + return self.displayGroup.source == nil + end + self.controls.set2Enabled = new("CheckBoxControl", { "LEFT", self.controls.set1Enabled, "RIGHT" }, { 50, 0, 20 }, "Set 2:", function(state) self.displayGroup.set2 = state self:AddUndoState() self.build.buildFlag = true end) + self.controls.set2Enabled.enabled = function() + return self.displayGroup.source == nil + end + self.controls.groupEnabled = new("CheckBoxControl", { "LEFT", self.controls.set2Enabled, "RIGHT" }, { 70, 0, 20 }, "Enabled:", function(state) self.displayGroup.enabled = state self:AddUndoState() @@ -197,41 +205,6 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont self.controls.groupCount.shown = function() return self.displayGroup.source ~= nil end - self.controls.sourceNote = new("LabelControl", { "TOPLEFT", self.controls.set1Enabled, "TOPLEFT" }, { -42, 30, 0, 16 }) - self.controls.sourceNote.shown = function() - return self.displayGroup.source ~= nil - end - self.controls.sourceNote.label = function() - local label - if self.displayGroup.explodeSources then - label = [[^7This is a special group created for the enemy explosion effect, -which comes from the following sources:]] - for _, source in ipairs(self.displayGroup.explodeSources) do - label = label .. "\n\t" .. colorCodes[source.rarity or "NORMAL"] .. (source.name or source.dn or "???") - end - label = label .. "^7\nYou cannot delete this group, but it will disappear if you lose the above sources." - else - local activeGem = self.displayGroup.gemList[1] - local sourceName - if self.displayGroup.sourceItem then - sourceName = "'" .. colorCodes[self.displayGroup.sourceItem.rarity] .. self.displayGroup.sourceItem.name - elseif self.displayGroup.sourceNode then - sourceName = "'" .. colorCodes["NORMAL"] .. self.displayGroup.sourceNode.name - else - sourceName = "'" .. colorCodes["NORMAL"] .. "?" - end - sourceName = sourceName .. "^7'" - label = [[^7This is a special group created for the ']] .. activeGem.color .. (activeGem.grantedEffect and activeGem.grantedEffect.name or activeGem.nameSpec) .. [[^7' skill, -which is being provided by ]] .. sourceName .. [[. -You cannot delete this group, but it will disappear if you ]] .. (self.displayGroup.sourceNode and [[un-allocate the node.]] or [[un-equip the item.]]) - if not self.displayGroup.noSupports then - label = label .. "\n\n" .. [[You cannot add support gems to this group, but support gems in -any other group socketed into ]] .. sourceName .. [[ -will automatically apply to the skill.]] - end - end - return label - end -- Scroll bar self.controls.scrollBarH = new("ScrollBarControl", nil, {0, 0, 0, 18}, 100, "HORIZONTAL", true) @@ -629,9 +602,12 @@ function SkillsTabClass:CreateGemSlot(index) end) end slot.delete.shown = function() - return index <= #self.displayGroup.gemList + 1 and self.displayGroup.source == nil + return index <= #self.displayGroup.gemList + 1 end slot.delete.enabled = function() + if index == 1 and self.displayGroup and (self.displayGroup.sourceItem or self.displayGroup.sourceNode) then + return false + end return index <= #self.displayGroup.gemList end slot.delete.tooltipText = "Remove this gem." @@ -684,6 +660,12 @@ function SkillsTabClass:CreateGemSlot(index) end self.build.buildFlag = true end, true) + slot.nameSpec.enabled = function() + if index == 1 and self.displayGroup and (self.displayGroup.sourceItem or self.displayGroup.sourceNode) then + return false + end + return true + end slot.nameSpec:AddToTabGroup(self.controls.groupLabel) self.controls["gemSlot"..index.."Name"] = slot.nameSpec @@ -705,6 +687,9 @@ function SkillsTabClass:CreateGemSlot(index) end) slot.level:AddToTabGroup(self.controls.groupLabel) slot.level.enabled = function() + if index == 1 and self.displayGroup and (self.displayGroup.sourceItem or self.displayGroup.sourceNode) then + return false + end return index <= #self.displayGroup.gemList end self.controls["gemSlot"..index.."Level"] = slot.level @@ -786,6 +771,9 @@ function SkillsTabClass:CreateGemSlot(index) end slot.quality:AddToTabGroup(self.controls.groupLabel) slot.quality.enabled = function() + if index == 1 and self.displayGroup and (self.displayGroup.sourceItem or self.displayGroup.sourceNode) then + return false + end return index <= #self.displayGroup.gemList end self.controls["gemSlot"..index.."Quality"] = slot.quality @@ -825,6 +813,9 @@ function SkillsTabClass:CreateGemSlot(index) end end slot.enabled.enabled = function() + if index == 1 and self.displayGroup and (self.displayGroup.sourceItem or self.displayGroup.sourceNode) then + return false + end return index <= #self.displayGroup.gemList end self.controls["gemSlot"..index.."Enable"] = slot.enabled @@ -866,6 +857,9 @@ function SkillsTabClass:CreateGemSlot(index) end end slot.count.enabled = function() + if index == 1 and self.displayGroup and (self.displayGroup.sourceItem or self.displayGroup.sourceNode) then + return false + end return index <= #self.displayGroup.gemList end self.controls["gemSlot"..index.."Count"] = slot.count @@ -1017,13 +1011,14 @@ function SkillsTabClass:ProcessSocketGroup(socketGroup) end elseif gemInstance.skillId then -- Specified by skill ID - -- Used for skills granted by items + -- Used for skills granted by items / nodes gemInstance.errMsg = nil - local gemId = data.gemForSkill[gemInstance.skillId] + local grantedEffect = data.skills[gemInstance.skillId] + local gemId = data.gemForSkill[grantedEffect] if gemId then gemInstance.gemData = data.gems[gemId] else - gemInstance.grantedEffect = data.skills[gemInstance.skillId] + gemInstance.grantedEffect = grantedEffect end if gemInstance.triggered and gemInstance.grantedEffect then if gemInstance.grantedEffect.levels[gemInstance.level] then @@ -1083,6 +1078,14 @@ function SkillsTabClass:SetDisplayGroup(socketGroup) self.controls.groupLabel:SetText(socketGroup.label) self.controls.groupEnabled.state = socketGroup.enabled self.controls.includeInFullDPS.state = socketGroup.includeInFullDPS and socketGroup.enabled + if socketGroup.sourceItem then + socketGroup.set1 = true + socketGroup.set2 = false + elseif socketGroup.sourceNode then + socketGroup.set1 = true + socketGroup.set2 = true + end + self.controls.set1Enabled.state = socketGroup.set1 == nil and true or socketGroup.set1 self.controls.set2Enabled.state = socketGroup.set2 == nil and true or socketGroup.set2 self.controls.groupCount:SetText(socketGroup.groupCount or 1) diff --git a/src/Modules/CalcSetup.lua b/src/Modules/CalcSetup.lua index 232b3db62a..f5057c58f8 100644 --- a/src/Modules/CalcSetup.lua +++ b/src/Modules/CalcSetup.lua @@ -1312,8 +1312,7 @@ function calcs.initEnv(build, mode, override, specEnv) group.noSupports = grantedSkill.noSupports activeGemInstance.triggered = grantedSkill.triggered activeGemInstance.triggerChance = grantedSkill.triggerChance - wipeTable(group.gemList) - t_insert(group.gemList, activeGemInstance) + group.gemList[1] = activeGemInstance build.skillsTab:ProcessSocketGroup(group) end From fbc953112f2c8da826babe3f8781233b3ec7a6c9 Mon Sep 17 00:00:00 2001 From: justjuangui Date: Fri, 24 Jan 2025 01:42:24 -0500 Subject: [PATCH 3/9] EditControl show value is not enabled --- src/Classes/EditControl.lua | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Classes/EditControl.lua b/src/Classes/EditControl.lua index 2964057adf..1169e719e8 100644 --- a/src/Classes/EditControl.lua +++ b/src/Classes/EditControl.lua @@ -67,9 +67,16 @@ local EditClass = newClass("EditControl", "ControlHost", "Control", "UndoHandler self.controls.buttonDown = new("ButtonControl", {"RIGHT",self,"RIGHT"}, {-2, 0, buttonSize, buttonSize}, "-", function() self:OnKeyUp("DOWN") end) + self.controls.buttonDown.enabled = function() + return self:IsEnabled() + end + self.controls.buttonUp = new("ButtonControl", {"RIGHT",self.controls.buttonDown,"LEFT"}, {-1, 0, buttonSize, buttonSize}, "+", function() self:OnKeyUp("UP") end) + self.controls.buttonUp.enabled = function() + return self:IsEnabled() + end elseif clearable then self.controls.buttonClear = new("ButtonControl", {"RIGHT",self,"RIGHT"}, {-2, 0, buttonSize, buttonSize}, "x", function() self:SetText("", true) @@ -277,10 +284,8 @@ function EditClass:Draw(viewPort, noTooltip) end textX = textX + DrawStringWidth(textHeight, self.font, self.prompt) + textHeight/2 end - if not enabled then - return - end - if mOver and not noTooltip then + + if enabled and mOver and not noTooltip then SetDrawLayer(nil, 100) self:DrawTooltip(x, y, width, height, viewPort) SetDrawLayer(nil, 0) @@ -290,7 +295,7 @@ function EditClass:Draw(viewPort, noTooltip) local marginR = self.controls.scrollBarV:IsShown() and 14 or 0 local marginB = self.controls.scrollBarH:IsShown() and 14 or 0 SetViewport(textX, textY, width - 4 - marginL - marginR, height - 4 - marginB) - if not self.hasFocus then + if not enabled or not self.hasFocus then if self.buf == '' and self.placeholder then SetDrawColor(self.disableCol) DrawString(-self.controls.scrollBarH.offset, -self.controls.scrollBarV.offset, "LEFT", textHeight, self.font, self.placeholder) From fadf381909ec7e6805d19a431299591974c99aec Mon Sep 17 00:00:00 2001 From: justjuangui Date: Fri, 24 Jan 2025 01:43:38 -0500 Subject: [PATCH 4/9] GemSelectControl now doesnt show shortcut when disabled --- src/Classes/GemSelectControl.lua | 37 ++++++++++++++++---------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/Classes/GemSelectControl.lua b/src/Classes/GemSelectControl.lua index 42595188e7..3495c76bb2 100644 --- a/src/Classes/GemSelectControl.lua +++ b/src/Classes/GemSelectControl.lua @@ -492,24 +492,25 @@ function GemSelectClass:Draw(viewPort, noTooltip) self.tooltip:AddLine(16, "Only show Active gems") end - -- support shortcut - sx = x + width - 16 - 2 - SetDrawColor(colorS,colorS,colorS) - DrawImage(nil, sx, y+2, 16, height-4) - SetDrawColor(0,0,0) - DrawImage(nil, sx+1, y+2, 16-2, height-4) - SetDrawColor(colorS,colorS,colorS) - DrawString(sx + 8, y, "CENTER_X", height - 2, "VAR", "S") - - -- active shortcut - sx = x + width - (16*2) - (2*2) - SetDrawColor(colorA,colorA,colorA) - DrawImage(nil, sx, y+2, 16, height-4) - SetDrawColor(0,0,0) - DrawImage(nil, sx+1, y+2, 16-2, height-4) - SetDrawColor(colorA,colorA,colorA) - DrawString(sx + 8, y, "CENTER_X", height - 2, "VAR", "A") - + if self:IsEnabled() then + -- support shortcut + sx = x + width - 16 - 2 + SetDrawColor(colorS,colorS,colorS) + DrawImage(nil, sx, y+2, 16, height-4) + SetDrawColor(0,0,0) + DrawImage(nil, sx+1, y+2, 16-2, height-4) + SetDrawColor(colorS,colorS,colorS) + DrawString(sx + 8, y, "CENTER_X", height - 2, "VAR", "S") + + -- active shortcut + sx = x + width - (16*2) - (2*2) + SetDrawColor(colorA,colorA,colorA) + DrawImage(nil, sx, y+2, 16, height-4) + SetDrawColor(0,0,0) + DrawImage(nil, sx+1, y+2, 16-2, height-4) + SetDrawColor(colorA,colorA,colorA) + DrawString(sx + 8, y, "CENTER_X", height - 2, "VAR", "A") + end SetDrawLayer(nil, 10) self.tooltip:Draw(x, y, width, height, viewPort) From 9b37534caae33b7578d5b17e332bff173065f861 Mon Sep 17 00:00:00 2001 From: justjuangui Date: Fri, 24 Jan 2025 10:31:43 -0500 Subject: [PATCH 5/9] Grant Skill from Passive tree now can have support gems --- src/Classes/SkillsTab.lua | 8 ++++++-- src/Modules/CalcSetup.lua | 2 +- src/Modules/ModParser.lua | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Classes/SkillsTab.lua b/src/Classes/SkillsTab.lua index 78932c3f57..4e326b67db 100644 --- a/src/Classes/SkillsTab.lua +++ b/src/Classes/SkillsTab.lua @@ -838,6 +838,9 @@ function SkillsTabClass:CreateGemSlot(index) self.build.buildFlag = true end) slot.count.shown = function() + if index == 1 and self.displayGroup and (self.displayGroup.sourceItem or self.displayGroup.sourceNode) then + return false + end local gemInstance = self.displayGroup and self.displayGroup.gemList[index] if gemInstance then local grantedEffectList = gemInstance.gemData and gemInstance.gemData.grantedEffectList or { gemInstance.grantedEffect } @@ -1079,8 +1082,9 @@ function SkillsTabClass:SetDisplayGroup(socketGroup) self.controls.groupEnabled.state = socketGroup.enabled self.controls.includeInFullDPS.state = socketGroup.includeInFullDPS and socketGroup.enabled if socketGroup.sourceItem then - socketGroup.set1 = true - socketGroup.set2 = false + local swap = not not socketGroup.slot:find("Swap") + socketGroup.set1 = not swap + socketGroup.set2 = swap elseif socketGroup.sourceNode then socketGroup.set1 = true socketGroup.set2 = true diff --git a/src/Modules/CalcSetup.lua b/src/Modules/CalcSetup.lua index f5057c58f8..b57ed1aec2 100644 --- a/src/Modules/CalcSetup.lua +++ b/src/Modules/CalcSetup.lua @@ -175,7 +175,7 @@ function calcs.buildModListForNode(env, node, incSmallPassiveSkill) t_insert(node.grantedSkills, { skillId = skill.skillId, level = skill.level, - noSupports = true, + noSupports = skill.noSupports ~= nil and skill.noSupports, source = "Tree:"..node.id }) end diff --git a/src/Modules/ModParser.lua b/src/Modules/ModParser.lua index 909f9e19c2..24bd6b336b 100644 --- a/src/Modules/ModParser.lua +++ b/src/Modules/ModParser.lua @@ -3137,8 +3137,8 @@ local specialModList = { mod("ScoldsBridleSelfDamage", "LIST", {dmgMult = dmgMult, damageType = dmgType}) }end, -- Extra skill/support - ["grants skill: (%D+)"] = function(_, skill) return grantedExtraSkill(skill, 1) end, - ["grants skill: level (%d+) (.+)"] = function(num, _, skill) return grantedExtraSkill(skill, num) end, + ["grants skill: (%D+)"] = function(_, skill) return grantedExtraSkill(skill, 1, false) end, + ["grants skill: level (%d+) (.+)"] = function(num, _, skill) return grantedExtraSkill(skill, num, false) end, ["[ct][ar][si][tg]g?e?r?s? level (%d+) (.+) when equipped"] = function(num, _, skill) return triggerExtraSkill(skill, num) end, ["[ct][ar][si][tg]g?e?r?s? level (%d+) (.+) on %a+"] = function(num, _, skill) return triggerExtraSkill(skill, num) end, ["use level (%d+) (.+) on %a+"] = function(num, _, skill) return triggerExtraSkill(skill, num) end, From c17894f0799bd535f8ba9ef0edf93f436416432a Mon Sep 17 00:00:00 2001 From: justjuangui Date: Mon, 27 Jan 2025 00:24:48 -0500 Subject: [PATCH 6/9] Fix nameSpec Allocation in gems --- src/Classes/SkillsTab.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Classes/SkillsTab.lua b/src/Classes/SkillsTab.lua index 4e326b67db..adf0d24478 100644 --- a/src/Classes/SkillsTab.lua +++ b/src/Classes/SkillsTab.lua @@ -1020,6 +1020,7 @@ function SkillsTabClass:ProcessSocketGroup(socketGroup) local gemId = data.gemForSkill[grantedEffect] if gemId then gemInstance.gemData = data.gems[gemId] + gemInstance.nameSpec = gemInstance.gemData.name else gemInstance.grantedEffect = grantedEffect end From c53629267f1b38d6e865a39c7d8b6952e112aca1 Mon Sep 17 00:00:00 2001 From: justjuangui Date: Tue, 4 Feb 2025 23:50:33 -0500 Subject: [PATCH 7/9] Support for removing and adding Grants Skill while keep your support gems --- src/Classes/SkillsTab.lua | 1 + src/Modules/CalcSetup.lua | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/Classes/SkillsTab.lua b/src/Classes/SkillsTab.lua index adf0d24478..950ef56284 100644 --- a/src/Classes/SkillsTab.lua +++ b/src/Classes/SkillsTab.lua @@ -85,6 +85,7 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont self.build = build self.socketGroupList = { } + self.removedSocketGroupList = { } self.sortGemsByDPS = true self.sortGemsByDPSField = "CombinedDPS" diff --git a/src/Modules/CalcSetup.lua b/src/Modules/CalcSetup.lua index b57ed1aec2..e12bf0edb7 100644 --- a/src/Modules/CalcSetup.lua +++ b/src/Modules/CalcSetup.lua @@ -1288,6 +1288,22 @@ function calcs.initEnv(build, mode, override, specEnv) end end end + if not group then + for _, removeSocketGroup in pairs(build.skillsTab.removedSocketGroupList) do + if removeSocketGroup.source == grantedSkill.source and removeSocketGroup.slot == grantedSkill.slotName then + if removeSocketGroup.gemList[1] and removeSocketGroup.gemList[1].skillId == grantedSkill.skillId and (removeSocketGroup.gemList[1].level == grantedSkill.level or removeSocketGroup.gemList[1].level == getNormalizedSkillLevel(grantedSkill)) then + group = removeSocketGroup + break + end + end + end + + if group then + build.skillsTab.removedSocketGroupList[group.source] = nil + t_insert(build.skillsTab.socketGroupList, group) + markList[group] = true + end + end if not group then -- Create a new group for this skill group = { label = "", enabled = true, gemList = { }, source = grantedSkill.source, slot = grantedSkill.slotName } @@ -1364,10 +1380,14 @@ function calcs.initEnv(build, mode, override, specEnv) while build.skillsTab.socketGroupList[i] do local socketGroup = build.skillsTab.socketGroupList[i] if socketGroup.source and not markList[socketGroup] then - t_remove(build.skillsTab.socketGroupList, i) + build.skillsTab.socketGroupList[i].shown = false + local removed = t_remove(build.skillsTab.socketGroupList, i) if build.skillsTab.displayGroup == socketGroup then build.skillsTab.displayGroup = nil end + + -- add in the removed group to the list of groups to be removed + build.skillsTab.removedSocketGroupList[removed.source] = removed else i = i + 1 end From 3d00af9bc0facf611307ef2ca070ca4c8c0537f0 Mon Sep 17 00:00:00 2001 From: justjuangui Date: Thu, 24 Apr 2025 20:33:37 -0500 Subject: [PATCH 8/9] Rollback Source Notes and fix duplicate nodes --- src/Classes/SkillsTab.lua | 20 +++++++++++++++++++- src/Modules/CalcSetup.lua | 14 ++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/Classes/SkillsTab.lua b/src/Classes/SkillsTab.lua index 950ef56284..af97862452 100644 --- a/src/Classes/SkillsTab.lua +++ b/src/Classes/SkillsTab.lua @@ -207,6 +207,24 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont return self.displayGroup.source ~= nil end + self.controls.sourceNote = new("LabelControl", { "TOPLEFT", self.controls.groupLabel, "TOPLEFT" }, { 0, 30 + 28, 0, 16 }) + self.controls.sourceNote.shown = function() + return self.displayGroup.explodeSources ~= nil + end + + self.controls.sourceNote.label = function() + local label + if self.displayGroup.explodeSources then + label = [[^7This is a special group created for the enemy explosion effect, +which comes from the following sources:]] + for _, source in ipairs(self.displayGroup.explodeSources) do + label = label .. "\n\t" .. colorCodes[source.rarity or "NORMAL"] .. (source.name or source.dn or "???") + end + label = label .. "^7\nYou cannot delete this group, but it will disappear if you lose the above sources." + end + return label + end + -- Scroll bar self.controls.scrollBarH = new("ScrollBarControl", nil, {0, 0, 0, 18}, 100, "HORIZONTAL", true) @@ -603,7 +621,7 @@ function SkillsTabClass:CreateGemSlot(index) end) end slot.delete.shown = function() - return index <= #self.displayGroup.gemList + 1 + return index <= #self.displayGroup.gemList + 1 and self.displayGroup.explodeSources == nil end slot.delete.enabled = function() if index == 1 and self.displayGroup and (self.displayGroup.sourceItem or self.displayGroup.sourceNode) then diff --git a/src/Modules/CalcSetup.lua b/src/Modules/CalcSetup.lua index e12bf0edb7..4b127bd93e 100644 --- a/src/Modules/CalcSetup.lua +++ b/src/Modules/CalcSetup.lua @@ -175,14 +175,24 @@ function calcs.buildModListForNode(env, node, incSmallPassiveSkill) t_insert(node.grantedSkills, { skillId = skill.skillId, level = skill.level, - noSupports = skill.noSupports ~= nil and skill.noSupports, + noSupports = skill.noSupports, source = "Tree:"..node.id }) end end if modList:Flag(nil, "CanExplode") then - t_insert(env.explodeSources, node) + -- we need to filter because buildModListForNodeList call twice this method + local found = false + for _, n in ipairs(env.explodeSources) do + if n.id == node.id then + found = true + break + end + end + if not found then + t_insert(env.explodeSources, node) + end end for i, mod in ipairs(modList) do From a8a19f185af9fc11c61b12e20646bc20534d20d2 Mon Sep 17 00:00:00 2001 From: justjuangui Date: Thu, 1 May 2025 14:25:26 -0500 Subject: [PATCH 9/9] fix --- src/Modules/CalcSetup.lua | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/Modules/CalcSetup.lua b/src/Modules/CalcSetup.lua index 4b127bd93e..e3fba3abc2 100644 --- a/src/Modules/CalcSetup.lua +++ b/src/Modules/CalcSetup.lua @@ -656,7 +656,21 @@ function calcs.initEnv(build, mode, override, specEnv) local allocatedMasteryTypeCount = env.spec.allocatedMasteryTypeCount local allocatedMasteryTypes = copyTable(env.spec.allocatedMasteryTypes) + -- Determine main skill group + if env.mode == "CALCS" then + env.calcsInput.skill_number = m_min(m_max(#build.skillsTab.socketGroupList, 1), env.calcsInput.skill_number or 1) + env.mainSocketGroup = env.calcsInput.skill_number + else + build.mainSocketGroup = m_min(m_max(#build.skillsTab.socketGroupList, 1), build.mainSocketGroup or 1) + env.mainSocketGroup = build.mainSocketGroup + end + -- alway use WeaponSet 1 for condition unless set 1 false and set 2 true + local mainSkill = build.skillsTab.socketGroupList[env.mainSocketGroup] + local usingSkillSet = mainSkill and not mainSkill.set1 and mainSkill.set2 and 2 or 1 + + env.usingSkillSet = usingSkillSet + modDB:NewMod("Condition:WeaponSet" .. usingSkillSet , "FLAG", true, "Weapon Set") if not accelerate.nodeAlloc then -- Build list of passive nodes @@ -1423,15 +1437,6 @@ function calcs.initEnv(build, mode, override, specEnv) env.player.weaponData2 = env.player.itemList["Weapon 2"].weaponData and env.player.itemList["Weapon 2"].weaponData[2] or { } end - -- Determine main skill group - if env.mode == "CALCS" then - env.calcsInput.skill_number = m_min(m_max(#build.skillsTab.socketGroupList, 1), env.calcsInput.skill_number or 1) - env.mainSocketGroup = env.calcsInput.skill_number - else - build.mainSocketGroup = m_min(m_max(#build.skillsTab.socketGroupList, 1), build.mainSocketGroup or 1) - env.mainSocketGroup = build.mainSocketGroup - end - -- Process supports and put them into the correct buckets env.crossLinkedSupportGroups = {} for _, mod in ipairs(env.modDB:Tabulate("LIST", nil, "LinkedSupport")) do @@ -1439,13 +1444,6 @@ function calcs.initEnv(build, mode, override, specEnv) t_insert(env.crossLinkedSupportGroups[mod.mod.sourceSlot], mod.value.targetSlotName) end - -- alway use WeaponSet 1 for condition unless set 1 false and set 2 true - local mainSkill = build.skillsTab.socketGroupList[env.mainSocketGroup] - local usingSkillSet = mainSkill and not mainSkill.set1 and mainSkill.set2 and 2 or 1 - - env.usingSkillSet = usingSkillSet - modDB:NewMod("Condition:WeaponSet" .. usingSkillSet , "FLAG", true, "Weapon Set") - local supportLists = { } local groupCfgList = { } local processedSockets = {}