Skip to content

Commit 4a1eed9

Browse files
justjuanguijustjuanguiLocalIdentity
authored
Add support for Lich Jewel Socket (#1037)
* Lich Jewel Socket support was added * Comments + blank parsing --------- Co-authored-by: justjuangui <servicios@juacarvajal.com> Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent d1d8313 commit 4a1eed9

File tree

12 files changed

+149
-22
lines changed

12 files changed

+149
-22
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: 51 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,13 @@ 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" or (item.base and item.base.subType ~= nil) then
1820+
-- Lich socket can only accept basic non-unique jewels
1821+
-- Need to change this to use ModParser if GGG add different conditional ascendancy jewel sockets
1822+
return false
1823+
end
1824+
return true
18181825
elseif node.charmSocket or item.base.subType == "Charm" then
18191826
-- Charm sockets can only have charms, and charms can only be in charm sockets
18201827
if node.charmSocket and item.base.subType == "Charm" then
@@ -2760,11 +2767,53 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode)
27602767
item.requirements.str or 0, item.requirements.dex or 0, item.requirements.int or 0)
27612768

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3522,9 +3522,7 @@ c["Can Block damage from all Hits Cannot use Shield Skills"]={nil,"Can Block dam
35223522
c["Can Evade all Hits"]={nil,"Can Evade all Hits "}
35233523
c["Can Evade all Hits 75% less Evasion Rating"]={nil,"Can Evade all Hits 75% less Evasion Rating "}
35243524
c["Can Evade all Hits if you have not been Hit Recently"]={nil,"Can Evade all Hits if you have not been Hit Recently "}
3525-
c["Can Socket a non-Unique Basic Jewel into the Phylactery"]={nil,"Can Socket a non-Unique Basic Jewel into the Phylactery "}
3526-
c["Can Socket a non-Unique Basic Jewel into the Phylactery 100% increased Effect of the Socketed Jewel"]={nil,"Can Socket a non-Unique Basic Jewel into the Phylactery 100% increased Effect of the Socketed Jewel "}
3527-
c["Can Socket a non-Unique Basic Jewel into the Phylactery 100% increased Effect of the Socketed Jewel 50% more Mana Cost of Skills if you have no Energy Shield"]={nil,"Can Socket a non-Unique Basic Jewel into the Phylactery 100% increased Effect of the Socketed Jewel 50% more Mana Cost of Skills if you have no Energy Shield "}
3525+
c["Can Socket a non-Unique Basic Jewel into the Phylactery"]={{},nil}
35283526
c["Can be modified while Corrupted"]={nil,"Can be modified while Corrupted "}
35293527
c["Can be modified while Corrupted +150 to maximum Life"]={nil,"Can be modified while Corrupted +150 to maximum Life "}
35303528
c["Can instead consume 25% of maximum Mana to trigger Charms with insufficient charges"]={nil,"Can instead consume 25% of maximum Mana to trigger Charms with insufficient charges "}

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

src/Modules/ModParser.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2844,6 +2844,7 @@ local specialModList = {
28442844
["no inherent mana regeneration"] = { flag("Condition:NoInherentManaRegen") },
28452845
["%+1 ring slot"] = { flag("AdditionalRingSlot") },
28462846
["regenerate (%D+) equal to (%d+)%% of maximum (%D+) per second"] = function(_, resource1, num, resource2) return { mod( combineToUpper(resource1) .. "Regen", "BASE", 1, { type = "PercentStat", stat = combineToUpper(resource2), percent = num } )} end,
2847+
["can socket a non%-unique basic jewel into the phylactery"] = { },
28472848
-- Mercenary
28482849
-- +2 Weapon Set Passive Skill Points
28492850
["%+(%d) weapon set passive skill points"] = function(num) return { mod("WeaponSetPassivePoints", "BASE", num) } end,
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)