Skip to content

Commit

Permalink
Add support for The Untouched Soul empty socket calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
sida-wang committed Dec 3, 2023
1 parent 9fb58b7 commit 23b9a5b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/Modules/CalcSetup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,11 @@ local function calcSocketStats(env, build)
else
activeItemSlots = {"Weapon 1", "Weapon 2", "Helmet", "Gloves", "Boots", "Body Armour", "Amulet", "Ring 1", "Ring 2"}
end
local totalEmptySocketsCount = { R = 0, G = 0, B = 0, W = 0}
for _, slot in pairs(activeItemSlots) do
local slotSocketsCount = 0
local socketedGems = 0
local item = build.itemsTab.items[build.itemsTab.activeItemSet[slot].selItemId]
if item then
slotSocketsCount = #item.sockets
end
-- loop through socket groups to calculate number of socketed gems
for _, socketGroup in pairs(build.skillsTab.socketGroupList) do
if (socketGroup.enabled and socketGroup.slot and socketGroup.slot == slot and socketGroup.gemList) then
for _, gem in pairs(socketGroup.gemList) do
Expand All @@ -321,8 +319,24 @@ local function calcSocketStats(env, build)
end
end
end
local item = build.itemsTab.items[build.itemsTab.activeItemSet[slot].selItemId]
if item then
slotSocketsCount = #item.sockets
local emptySockets = slotSocketsCount - socketedGems
if emptySockets > 0 then
for i, socket in ipairs(item.sockets) do
if slotSocketsCount - i < emptySockets then
totalEmptySocketsCount[socket.color] = totalEmptySocketsCount[socket.color] + 1
end
end
end
end
env.modDB:NewMod("Multiplier:SocketedGemsIn"..slot, "BASE", math.min(slotSocketsCount, socketedGems))
end
env.modDB:NewMod("Multiplier:EmptyRedSocketsInAnySlot", "BASE", totalEmptySocketsCount.R)
env.modDB:NewMod("Multiplier:EmptyGreenSocketsInAnySlot", "BASE", totalEmptySocketsCount.G)
env.modDB:NewMod("Multiplier:EmptyBlueSocketsInAnySlot", "BASE", totalEmptySocketsCount.B)
env.modDB:NewMod("Multiplier:EmptyWhiteSocketsInAnySlot", "BASE", totalEmptySocketsCount.W)
end

-- Initialise environment:
Expand Down
4 changes: 4 additions & 0 deletions src/Modules/ModParser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,10 @@ local modTagList = {
["per green socket"] = { tag = { type = "Multiplier", var = "GreenSocketIn{SlotName}" } },
["per blue socket"] = { tag = { type = "Multiplier", var = "BlueSocketIn{SlotName}" } },
["per white socket"] = { tag = { type = "Multiplier", var = "WhiteSocketIn{SlotName}" } },
["for each empty red socket on any equipped item"] = { tag = { type = "Multiplier", var = "EmptyRedSocketsInAnySlot" } },
["for each empty green socket on any equipped item"] = { tag = { type = "Multiplier", var = "EmptyGreenSocketsInAnySlot" } },
["for each empty blue socket on any equipped item"] = { tag = { type = "Multiplier", var = "EmptyBlueSocketsInAnySlot" } },
["for each empty white socket on any equipped item"] = { tag = { type = "Multiplier", var = "EmptyWhiteSocketsInAnySlot" } },
["per socketed gem"] = { tag = { type = "Multiplier", var = "SocketedGemsIn{SlotName}"}},
["for each impale on enemy"] = { tag = { type = "Multiplier", var = "ImpaleStacks", actor = "enemy" } },
["per impale on enemy"] = { tag = { type = "Multiplier", var = "ImpaleStacks", actor = "enemy" } },
Expand Down

0 comments on commit 23b9a5b

Please sign in to comment.