diff --git a/src/Classes/Item.lua b/src/Classes/Item.lua index 1618e93e018..0c2698ec977 100644 --- a/src/Classes/Item.lua +++ b/src/Classes/Item.lua @@ -1053,8 +1053,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality) self.requirements.str = self.base.req.str or 0 self.requirements.dex = self.base.req.dex or 0 self.requirements.int = self.base.req.int or 0 - local maxReq = m_max(self.requirements.str, self.requirements.dex, self.requirements.int) - self.defaultSocketColor = (maxReq == self.requirements.dex and "G") or (maxReq == self.requirements.int and "B") or "R" + self.defaultSocketColor = "W" if self.base.flask and self.base.flask.buff and not flaskBuffLines then flaskBuffLines = { } for _, line in ipairs(self.base.flask.buff) do diff --git a/src/Classes/ItemsTab.lua b/src/Classes/ItemsTab.lua index 0b3852aba58..24db55ea688 100644 --- a/src/Classes/ItemsTab.lua +++ b/src/Classes/ItemsTab.lua @@ -31,7 +31,7 @@ local socketDropList = { { label = colorCodes.STRENGTH.."R", color = "R" }, { label = colorCodes.DEXTERITY.."G", color = "G" }, { label = colorCodes.INTELLIGENCE.."B", color = "B" }, - { label = colorCodes.SCION.."W", color = "W" } + { label = colorCodes.WHITE.."W", color = "W" } } local baseSlots = { "Weapon 1", "Weapon 2", "Helmet", "Body Armour", "Gloves", "Boots", "Amulet", "Ring 1", "Ring 2", "Ring 3", "Belt", "Graft 1", "Graft 2", "Flask 1", "Flask 2", "Flask 3", "Flask 4", "Flask 5" } @@ -4203,7 +4203,7 @@ function ItemsTabClass:GetSocketDescriptionLine(item) elseif socket.color == "B" then code = colorCodes.INTELLIGENCE elseif socket.color == "W" then - code = colorCodes.SCION + code = colorCodes.WHITE elseif socket.color == "A" then code = "^xB0B0B0" end diff --git a/src/Classes/SkillsTab.lua b/src/Classes/SkillsTab.lua index f1326ddc980..f70103adcee 100644 --- a/src/Classes/SkillsTab.lua +++ b/src/Classes/SkillsTab.lua @@ -10,6 +10,13 @@ local t_remove = table.remove local m_min = math.min local m_max = math.max +local socketDropList = { + { label = colorCodes.STRENGTH.."R", color = "R" }, + { label = colorCodes.DEXTERITY.."G", color = "G" }, + { label = colorCodes.INTELLIGENCE.."B", color = "B" }, + { label = colorCodes.WHITE.."W", color = "W" }, +} + local groupSlotDropList = { { label = "None" }, { label = "Weapon 1", slotName = "Weapon 1" }, @@ -234,8 +241,6 @@ function SkillsTabClass:SkillsTab(build) local socketLine = "" if item and item.base and not item.base.socketLimit then socketLine = "This item cannot have sockets" - elseif item then - socketLine = self.build.itemsTab:GetSocketDescriptionLine(item) end return "^7Item sockets: " .. socketLine end) @@ -253,7 +258,7 @@ function SkillsTabClass:SkillsTab(build) local maxSockets = (item.base.socketLimit or 0) - abyssalSocketCount return maxSockets, abyssalSocketCount end - self.controls.optimiseSockets = new("ButtonControl"):ButtonControl({ "LEFT", self.controls.socketsLabel, "RIGHT" }, { 4, 0, 120, 18 }, "Optimise Sockets", function() + self.controls.optimiseSockets = new("ButtonControl"):ButtonControl({ "LEFT", self.controls.socketsLabel, "RIGHT" }, { 4, 0, 180, 18 }, "Optimise Socket Colours", function() local item, groupSlot = getSelectedItem() if not item or not groupSlot or not item.base then return @@ -312,6 +317,48 @@ function SkillsTabClass:SkillsTab(build) return false end self.controls.optimiseSockets.tooltipText = "Rebuild the item's sockets to match the groups assigned to it." + self.controls.socketColours = new("Control"):Control({ "LEFT", self.controls.socketsLabel, "RIGHT" }, { 4, 0, function() + local item = getSelectedItem() + local width = 0 + if item then + for i = 1, 6 do + if item.selectableSocketCount >= i and item.sockets[i] and item.sockets[i].color ~= "A" then + width = (i - 1) * 44 + 36 + end + end + end + return width + end, 20 }) + self.controls.abyssalSockets = new("LabelControl"):LabelControl({ "LEFT", self.controls.socketColours, "RIGHT" }, { 0, 0, 0, 16 }, function() + local item = getSelectedItem() + if not item then + return "" + end + local _, abyssalSocketCount = getSocketCounts(item) + return "^xB0B0B0" .. string.rep(" A", abyssalSocketCount) + end) + self.controls.optimiseSockets:SetAnchor("LEFT", self.controls.abyssalSockets, "RIGHT", 8, 0) + for i = 1, 6 do + local drop = new("DropDownControl"):DropDownControl({ "TOPLEFT", self.controls.socketColours, "TOPLEFT" }, { (i - 1) * 44, 0, 36, 20 }, socketDropList, function(index, value) + local item = getSelectedItem() + if not item or not item.sockets[i] or item.sockets[i].color == "A" then + return + end + -- Item undo states share nested tables, so preserve the previous sockets. + item.sockets = copyTable(item.sockets) + item.sockets[i].color = value.color + item:BuildAndParseRaw() + self.build.itemsTab:AddUndoState() + self:UpdateSocketGroups() + self.build.buildFlag = true + end) + drop.shown = function() + local item = getSelectedItem() + return item and item.selectableSocketCount >= i and item.sockets[i] and item.sockets[i].color ~= "A" + end + drop.tooltipText = "Change the item's socket colour. Gems in matching coloured sockets gain +10% quality." + self.controls["itemSocket"..i] = drop + end -- self.imbuedSupportBySlot is used by CalcSetup to add an ExtraSupport mod of the selected gem -- Each displayGroup has its own "imbuedSupport" and is saved to the xml to load when changing sockets or loading a build -- "slotName" is used on import, which uses builtInSupport to get the gemData and pass in here @@ -1082,6 +1129,15 @@ function SkillsTabClass:UpdateGemSlots() if not self.displayGroup then return end + local itemSlot = self.build.itemsTab.slots[self.displayGroup.slot] + local item = itemSlot and self.build.itemsTab.items[itemSlot.selItemId] + if item then + for i = 1, 6 do + if item.sockets[i] then + self.controls["itemSocket"..i]:SelByValue(item.sockets[i].color, "color") + end + end + end for slotIndex = 1, #self.displayGroup.gemList + 1 do if not self.gemSlots[slotIndex] then self:CreateGemSlot(slotIndex) diff --git a/src/Data/Global.lua b/src/Data/Global.lua index c675233afcd..b837c581cd9 100644 --- a/src/Data/Global.lua +++ b/src/Data/Global.lua @@ -30,6 +30,7 @@ colorCodes = { OFFENCE = "^xE07030", DEFENCE = "^x8080E0", SCION = "^xFFF0F0", + WHITE = "^xFFF0F0", MARAUDER = "^xE05030", RANGER = "^x70FF70", WITCH = "^x7070FF",