Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Classes/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/Classes/ItemsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down Expand Up @@ -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
Expand Down
62 changes: 59 additions & 3 deletions src/Classes/SkillsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/Data/Global.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ colorCodes = {
OFFENCE = "^xE07030",
DEFENCE = "^x8080E0",
SCION = "^xFFF0F0",
WHITE = "^xFFF0F0",
MARAUDER = "^xE05030",
RANGER = "^x70FF70",
WITCH = "^x7070FF",
Expand Down
Loading