Skip to content

Commit 8d4d2f6

Browse files
author
justjuangui
committed
Lich Jewel Socket support was added
1 parent d1d8313 commit 8d4d2f6

File tree

10 files changed

+146
-19
lines changed

10 files changed

+146
-19
lines changed

src/Classes/CalcBreakdownControl.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,11 @@ function CalcBreakdownClass:AddModSection(sectionData, modList)
397397
if item then
398398
row.sourceName = colorCodes[item.rarity]..item.name
399399
row.sourceNameTooltip = function(tooltip)
400-
build.itemsTab:AddItemTooltip(tooltip, item, row.mod.sourceSlot)
400+
local args = row.mod.sourceSlot
401+
if row.mod.sourceSlot == "Jewel" and row.mod.sourceSlotNum ~= nil and build.spec.nodes[row.mod.sourceSlotNum] and build.spec.nodes[row.mod.sourceSlotNum].containJewelSocket then
402+
args = { nodeId = row.mod.sourceSlotNum }
403+
end
404+
build.itemsTab:AddItemTooltip(tooltip, item, args)
401405
end
402406
end
403407
elseif sourceType == "Tree" then

src/Classes/ItemsTab.lua

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Contro
146146
self.sockets = { }
147147
local socketOrder = { }
148148
for _, node in pairs(build.latestTree.nodes) do
149-
if node.type == "Socket" then
149+
if node.type == "Socket" or node.containJewelSocket then
150150
t_insert(socketOrder, node)
151151
end
152152
end
@@ -1815,6 +1815,12 @@ function ItemsTabClass:IsItemValidForSlot(item, slotName, itemSet)
18151815
local node = self.build.spec.tree.nodes[tonumber(slotId)] or self.build.spec.nodes[tonumber(slotId)]
18161816
if not node or item.type ~= "Jewel" then
18171817
return false
1818+
elseif node.containJewelSocket then
1819+
if item.rarity == "UNIQUE" then
1820+
-- Unique jewels can only be in unique jewel sockets
1821+
return false
1822+
end
1823+
return true
18181824
elseif node.charmSocket or item.base.subType == "Charm" then
18191825
-- Charm sockets can only have charms, and charms can only be in charm sockets
18201826
if node.charmSocket and item.base.subType == "Charm" then
@@ -2760,11 +2766,53 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode)
27602766
item.requirements.str or 0, item.requirements.dex or 0, item.requirements.int or 0)
27612767

27622768
-- Modifiers
2769+
-- Support for Lich Socket Jewel only for tooltip display
2770+
-- the real calculation is done in the CalcSetup
2771+
local scale = 1
2772+
local extraTooltip = ""
2773+
if slot and slot.nodeId then
2774+
local node = self.build.spec.nodes[slot.nodeId]
2775+
if node and node.containJewelSocket then
2776+
local jewelEffect = node.modList:Sum("INC", nil, "SocketedJewelEffect")
2777+
extraTooltip = "^x7F7F7FSocketed Jewel Effect: "
2778+
if jewelEffect > 0 then
2779+
extraTooltip = extraTooltip .. s_format(colorCodes.MAGIC.."+%d%%", jewelEffect)
2780+
tooltip:AddSeparator(10)
2781+
tooltip:AddLine(16, extraTooltip)
2782+
tooltip:AddSeparator(10)
2783+
end
2784+
2785+
scale = scale + (jewelEffect / 100)
2786+
end
2787+
end
2788+
27632789
for _, modList in ipairs{item.enchantModLines, item.runeModLines, item.implicitModLines, item.explicitModLines} do
27642790
if modList[1] then
27652791
for _, modLine in ipairs(modList) do
27662792
if item:CheckModLineVariant(modLine) then
2767-
tooltip:AddLine(16, itemLib.formatModLine(modLine, dbMode))
2793+
if scale ~= 1 then
2794+
local codyModLine = copyTable(modLine)
2795+
local modsList = copyTable(modLine.modList)
2796+
local scaledList = new("ModList")
2797+
-- some passive node mods are only Condition/Flag and have no value to scale by default, grab number from line
2798+
if modsList[1] and modsList[1].type == "FLAG" then
2799+
modsList[1].value = tonumber(codyModLine.line:match("%d+"))
2800+
end
2801+
scaledList:ScaleAddList(modsList, scale)
2802+
for j, mod in ipairs(scaledList) do
2803+
local newValue = 0
2804+
if type(mod.value) == "number" then
2805+
newValue = mod.value
2806+
elseif type(mod.value) == "table" then
2807+
newValue = mod.value.mod.value
2808+
end
2809+
codyModLine.line = codyModLine.line:gsub("%d*%.?%d+", math.abs(newValue))
2810+
end
2811+
tooltip:AddLine(16, itemLib.formatModLine(codyModLine, dbMode))
2812+
else
2813+
tooltip:AddLine(16, itemLib.formatModLine(modLine, dbMode))
2814+
end
2815+
27682816
-- Show mods from granted Notables
27692817
if modLine.modList[1] and modLine.modList[1].name == "GrantedPassive" then
27702818
local node = self.build.spec.tree.notableMap[modLine.modList[1].value]

src/Classes/PassiveTree.lua

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ local PassiveTreeClass = newClass("PassiveTree", function(self, treeVersion)
251251
self.notableMap[node.dn:lower()] = node
252252
end
253253
else
254+
if node.containJewelSocket then
255+
self.sockets[node.id] = node
256+
end
254257
self.ascendancyMap[node.dn:lower()] = node
255258
if not self.classNotables[self.ascendNameMap[node.ascendancyName].class.name] then
256259
self.classNotables[self.ascendNameMap[node.ascendancyName].class.name] = { }
@@ -334,7 +337,7 @@ local PassiveTreeClass = newClass("PassiveTree", function(self, treeVersion)
334337
for nodeId, socket in pairs(self.sockets) do
335338
if socket.name == "Charm Socket" then
336339
socket.charmSocket = true
337-
else
340+
elseif not socket.containJewelSocket then
338341
socket.nodesInRadius = { }
339342
socket.attributesInRadius = { }
340343
for radiusIndex, _ in ipairs(data.jewelRadius) do
@@ -508,9 +511,8 @@ end
508511

509512
-- Common processing code for nodes (used for both real tree nodes and subgraph nodes)
510513
function PassiveTreeClass:ProcessNode(node)
511-
512514
node.targetSize = self:GetNodeTargetSize(node)
513-
node.overlay = self.nodeOverlay[node.type]
515+
node.overlay = node.containJewelSocket and node.jewelOverlay or self.nodeOverlay[node.type]
514516
if node.overlay then
515517
local size = node.targetSize["overlay"] and node.targetSize["overlay"].width or node.targetSize.width
516518
node.rsq = size * size
@@ -761,6 +763,11 @@ function PassiveTreeClass:GetNodeTargetSize(node)
761763
['overlay'] = { width = math.floor(80 * self.scaleImage), height = math.floor(80 * self.scaleImage) },
762764
width = math.floor(37 * self.scaleImage), height = math.floor( 37 * self.scaleImage)
763765
}
766+
elseif node.containJewelSocket then
767+
return {
768+
['overlay'] = { width = math.floor(80 * self.scaleImage), height = math.floor(80 * self.scaleImage) },
769+
width = math.floor(80 * self.scaleImage), height = math.floor(80 * self.scaleImage)
770+
}
764771
elseif node.ascendancyName then
765772
return {
766773
['overlay'] = { width = math.floor(100 * self.scaleImage), height = math.floor(100 * self.scaleImage) },

src/Classes/PassiveTreeView.lua

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
302302
end
303303
elseif treeClick == "RIGHT" then
304304
if hoverNode then
305-
if hoverNode.alloc and hoverNode.type == "Socket" then
305+
if hoverNode.alloc and (hoverNode.type == "Socket" or hoverNode.containJewelSocket) then
306306
local slot = build.itemsTab.sockets[hoverNode.id]
307307
if slot:IsEnabled() then
308308
-- User right-clicked a jewel socket, jump to the item page and focus the corresponding item slot control
@@ -354,7 +354,7 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
354354
local class = tree.classes[spec.curClassId]
355355
if class and class.background then
356356
local bgAssetName = class.background.image
357-
if spec.curAscendClassId ~= 0 then
357+
if spec.curAscendClassId ~= 0 and class.classes[spec.curAscendClassId] then
358358
bgAssetName = class.classes[spec.curAscendClassId].background.image
359359
end
360360
local bg = tree:GetAssetByName(bgAssetName)
@@ -599,7 +599,7 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
599599
else
600600
state = "unalloc"
601601
end
602-
if node.type == "Socket" then
602+
if node.type == "Socket" or node.containJewelSocket then
603603
-- Node is a jewel socket, retrieve the socketed jewel (if present) so we can display the correct art
604604
base = tree:GetAssetByName(node.overlay[state])
605605

@@ -845,7 +845,7 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
845845
SetDrawLayer(nil, 25)
846846
for nodeId in pairs(tree.sockets) do
847847
local node = spec.nodes[nodeId]
848-
if node and node.name ~= "Charm Socket" and (not node.expansionJewel or node.expansionJewel.size == 2) then
848+
if node and node.name ~= "Charm Socket" and node.containJewelSocket ~= true and (not node.expansionJewel or node.expansionJewel.size == 2) then
849849
local scrX, scrY = treeToScreen(node.x, node.y)
850850
local socket, jewel = build.itemsTab:GetSocketAndJewelForNodeID(nodeId)
851851
if node == hoverNode then
@@ -1268,7 +1268,7 @@ function PassiveTreeViewClass:AddNodeTooltip(tooltip, node, build, incSmallPassi
12681268
local isInRadius = false
12691269
for id, socket in pairs(build.itemsTab.sockets) do
12701270
if build.itemsTab.activeSocketList and socket.inactive == false or socket.inactive == nil then
1271-
isInRadius = isInRadius or build.spec.nodes[id].nodesInRadius[3][node.id] ~= nil
1271+
isInRadius = isInRadius or (build.spec.nodes[id] and build.spec.nodes[id].nodesInRadius and build.spec.nodes[id].nodesInRadius[3][node.id] ~= nil)
12721272
if isInRadius then break end
12731273
end
12741274
end
@@ -1291,6 +1291,20 @@ function PassiveTreeViewClass:AddNodeTooltip(tooltip, node, build, incSmallPassi
12911291
end
12921292
end
12931293

1294+
if node.containJewelSocket then
1295+
tooltip:AddSeparator(14)
1296+
-- Jewel socket with a jewel in it, show the jewel tooltip instead of the node tooltip
1297+
local socket, jewel = build.itemsTab:GetSocketAndJewelForNodeID(node.id)
1298+
if jewel then
1299+
build.itemsTab:AddItemTooltip(tooltip, jewel, { nodeId = node.id })
1300+
tooltip:AddSeparator(14)
1301+
end
1302+
1303+
if socket ~= nil and socket:IsEnabled() then
1304+
tooltip:AddLine(14, colorCodes.TIP.."Tip: Right click this socket to go to the items page and choose the jewel for this socket.")
1305+
end
1306+
end
1307+
12941308
-- Reminder text
12951309
if node.reminderText then
12961310
tooltip:AddSeparator(14)

src/Export/Scripts/passivetree.lua

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,33 @@ for i, group in ipairs(psg.groups) do
794794
node["ascendancyName"] = passiveRow.Ascendancy.Name
795795
node["isAscendancyStart"] = passiveRow.AscendancyStart or nil
796796

797+
-- support for jewel sockets in ascendancy
798+
if passiveRow.JewelSocket then
799+
node["containJewelSocket"] = true
800+
801+
local uioverride = dat("passivenodeuiartoverride"):GetRow("Id", passiveRow.Id)
802+
803+
if uioverride then
804+
local uiSocketNormal = uiImages[string.lower(uioverride.SocketNormal)]
805+
addToSheet(getSheet("group-background"), uiSocketNormal.path, "frame", commonMetadata(nil))
806+
807+
local uiSocketActive = uiImages[string.lower(uioverride.SocketActive)]
808+
addToSheet(getSheet("group-background"), uiSocketActive.path, "frame", commonMetadata(nil))
809+
810+
local uiSocketCanAllocate = uiImages[string.lower(uioverride.SocketCanAllocate)]
811+
addToSheet(getSheet("group-background"), uiSocketCanAllocate.path, "frame", commonMetadata(nil))
812+
813+
node.jewelOverlay = {
814+
alloc = uiSocketActive.path,
815+
path = uiSocketCanAllocate.path,
816+
unalloc = uiSocketNormal.path,
817+
}
818+
819+
else
820+
printf("Jewel socket not found for ascendancy " .. passiveRow.Ascendancy.Name)
821+
end
822+
end
823+
797824
ascendancyGroups = ascendancyGroups or {}
798825
ascendancyGroups[passiveRow.Ascendancy.Name] = ascendancyGroups[passiveRow.Ascendancy.Name] or { }
799826
ascendancyGroups[passiveRow.Ascendancy.Name].startId = passiveRow.AscendancyStart and passive.id or ascendancyGroups[passiveRow.Ascendancy.Name].startId

src/Modules/CalcSetup.lua

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,17 @@ function calcs.initEnv(build, mode, override, specEnv)
933933
scale = scale + node.distanceToClassStart * (item.jewelData.jewelIncEffectFromClassStart / 100)
934934
end
935935
end
936+
937+
local addSourceSlotNum = false
938+
if slot.nodeId and item and item.type == "Jewel" then
939+
local node = env.spec.nodes[slot.nodeId]
940+
if node and node.containJewelSocket then
941+
addSourceSlotNum = true
942+
local inc = node.modList:Sum("INC", nil, "SocketedJewelEffect")
943+
scale = scale + (inc / 100)
944+
end
945+
end
946+
936947
if item then
937948
env.player.itemList[slotName] = item
938949
-- Merge mods for this item
@@ -948,6 +959,13 @@ function calcs.initEnv(build, mode, override, specEnv)
948959
end
949960
end
950961
end
962+
963+
if addSourceSlotNum then
964+
srcList = copyTable(srcList, false)
965+
for _, mod in ipairs(srcList) do
966+
mod.sourceSlotNum = slot.slotNum
967+
end
968+
end
951969

952970
if item.requirements and not accelerate.requirementsItems then
953971
t_insert(env.requirementsTableItems, {
@@ -1112,7 +1130,7 @@ function calcs.initEnv(build, mode, override, specEnv)
11121130
env.itemModDB:ScaleAddMod(mod, scale)
11131131
end
11141132
end
1115-
elseif env.modDB.multipliers["CorruptedMagicJewelEffect"] and item.type == "Jewel" and item.rarity == "MAGIC" and item.corrupted and slot.nodeId and item.base.subType ~= "Charm" then
1133+
elseif env.modDB.multipliers["CorruptedMagicJewelEffect"] and item.type == "Jewel" and item.rarity == "MAGIC" and item.corrupted and slot.nodeId and item.base.subType ~= "Charm" and not env.spec.nodes[slot.nodeId].containJewelSocket then
11161134
scale = scale + env.modDB.multipliers["CorruptedMagicJewelEffect"]
11171135
local combinedList = new("ModList")
11181136
for _, mod in ipairs(srcList) do
35.8 KB
Binary file not shown.
3.26 KB
Binary file not shown.

src/TreeData/0_2/tree.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/TreeData/0_2/tree.lua

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,12 +1117,15 @@ return {
11171117
PSSkillFrameHighlighted=1
11181118
},
11191119
["group-background_152_156_BC7.dds.zst"]={
1120-
JewelFrameAllocated=2,
1121-
JewelFrameCanAllocate=5,
1122-
JewelFrameUnallocated=3,
1123-
NotableFrameAllocated=1,
1124-
NotableFrameCanAllocate=6,
1125-
NotableFrameUnallocated=4
1120+
JewelFrameAllocated=5,
1121+
JewelFrameCanAllocate=8,
1122+
JewelFrameUnallocated=6,
1123+
NotableFrameAllocated=3,
1124+
NotableFrameCanAllocate=9,
1125+
NotableFrameUnallocated=7,
1126+
["art/textures/interface/2d/2dart/uiimages/ingame/lichpassiveskillscreenjewelsocketactive.dds"]=2,
1127+
["art/textures/interface/2d/2dart/uiimages/ingame/lichpassiveskillscreenjewelsocketcanallocate.dds"]=1,
1128+
["art/textures/interface/2d/2dart/uiimages/ingame/lichpassiveskillscreenjewelsocketnormal.dds"]=4
11261129
},
11271130
["group-background_160_164_BC7.dds.zst"]={
11281131
AscendancyFrameSmallAllocated=2,
@@ -37114,9 +37117,15 @@ return {
3711437117
ascendancyName="Lich",
3711537118
connections={
3711637119
},
37120+
containJewelSocket=true,
3711737121
group=881,
3711837122
icon="Art/2DArt/SkillIcons/passives/MasteryBlank.dds",
3711937123
isNotable=true,
37124+
jewelOverlay={
37125+
alloc="art/textures/interface/2d/2dart/uiimages/ingame/lichpassiveskillscreenjewelsocketactive.dds",
37126+
path="art/textures/interface/2d/2dart/uiimages/ingame/lichpassiveskillscreenjewelsocketcanallocate.dds",
37127+
unalloc="art/textures/interface/2d/2dart/uiimages/ingame/lichpassiveskillscreenjewelsocketnormal.dds"
37128+
},
3712037129
name="Crystalline Phylactery",
3712137130
orbit=6,
3712237131
orbitIndex=0,

0 commit comments

Comments
 (0)