Skip to content

Commit 9cab334

Browse files
PeecheyLocalIdentity
andauthored
Add support for anointing Cord Belts (#9494)
* add support for anointing Cord Belts, slight refactor of persistent anoint logic for ammy and new belt * reuse canBeAnointed for Cord Belts and refactor isAnointed function for checks and persistence logic * Dummy parse cord belt mod --------- Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent a99d31f commit 9cab334

3 files changed

Lines changed: 14 additions & 9 deletions

File tree

src/Classes/Item.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
756756
self.prefixes.limit = (self.prefixes.limit or 0) + (tonumber(lineLower:match("%+(%d+) prefix modifiers? allowed")) or 0) - (tonumber(lineLower:match("%-(%d+) prefix modifiers? allowed")) or 0)
757757
elseif lineLower:match(" suffix modifiers? allowed") then
758758
self.suffixes.limit = (self.suffixes.limit or 0) + (tonumber(lineLower:match("%+(%d+) suffix modifiers? allowed")) or 0) - (tonumber(lineLower:match("%-(%d+) suffix modifiers? allowed")) or 0)
759-
elseif lineLower == "this item can be anointed by cassia" then
759+
elseif lineLower:find("can be anointed") then -- blight uniques and Cord Belt
760760
self.canBeAnointed = true
761761
elseif lineLower == "can have a second enchantment modifier" then
762762
self.canHaveTwoEnchants = true

src/Classes/ItemsTab.lua

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ for _, entry in pairs(data.flavourText) do
5656
end
5757
end
5858

59+
local function isAnointable(item)
60+
return (item.canBeAnointed or item.base.type == "Amulet")
61+
end
5962

6063
local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Control", function(self, build)
6164
self.UndoHandler()
@@ -438,7 +441,7 @@ holding Shift will put it in the second.]])
438441
self.controls.displayItemAddSocket.shown = function()
439442
return #self.displayItem.sockets < self.displayItem.selectableSocketCount + self.displayItem.abyssalSocketCount
440443
end
441-
444+
442445
-- Section: Enchant / Anoint / Corrupt
443446
self.controls.displayItemSectionEnchant = new("Control", {"TOPLEFT",self.controls.displayItemSectionSockets,"BOTTOMLEFT"}, {0, 0, 0, function()
444447
return (self.controls.displayItemEnchant:IsShown() or self.controls.displayItemEnchant2:IsShown() or self.controls.displayItemAnoint:IsShown() or self.controls.displayItemAnoint2:IsShown() or self.controls.displayItemCorrupt:IsShown() ) and 28 or 0
@@ -459,14 +462,14 @@ holding Shift will put it in the second.]])
459462
self:AnointDisplayItem(1)
460463
end)
461464
self.controls.displayItemAnoint.shown = function()
462-
return self.displayItem and (self.displayItem.base.type == "Amulet" or self.displayItem.canBeAnointed)
465+
return self.displayItem and isAnointable(self.displayItem)
463466
end
464467
self.controls.displayItemAnoint2 = new("ButtonControl", {"TOPLEFT",self.controls.displayItemAnoint,"TOPRIGHT",true}, {8, 0, 100, 20}, "Anoint 2...", function()
465468
self:AnointDisplayItem(2)
466469
end)
467470
self.controls.displayItemAnoint2.shown = function()
468471
return self.displayItem and
469-
(self.displayItem.base.type == "Amulet" or self.displayItem.canBeAnointed) and
472+
isAnointable(self.displayItem) and
470473
self.displayItem.canHaveTwoEnchants and
471474
#self.displayItem.enchantModLines > 0
472475
end
@@ -475,7 +478,7 @@ holding Shift will put it in the second.]])
475478
end)
476479
self.controls.displayItemAnoint3.shown = function()
477480
return self.displayItem and
478-
(self.displayItem.base.type == "Amulet" or self.displayItem.canBeAnointed) and
481+
isAnointable(self.displayItem) and
479482
self.displayItem.canHaveThreeEnchants and
480483
#self.displayItem.enchantModLines > 1
481484
end
@@ -484,7 +487,7 @@ holding Shift will put it in the second.]])
484487
end)
485488
self.controls.displayItemAnoint4.shown = function()
486489
return self.displayItem and
487-
(self.displayItem.base.type == "Amulet" or self.displayItem.canBeAnointed) and
490+
isAnointable(self.displayItem) and
488491
self.displayItem.canHaveFourEnchants and
489492
#self.displayItem.enchantModLines > 2
490493
end
@@ -1582,9 +1585,10 @@ end
15821585
function ItemsTabClass:CreateDisplayItemFromRaw(itemRaw, normalise)
15831586
local newItem = new("Item", itemRaw)
15841587
if newItem.base then
1585-
-- if the new item is an amulet and does not have an anoint and your current amulet does, apply that anoint to the new item
1586-
if newItem.base.type == "Amulet" and #newItem.enchantModLines == 0 and self.activeItemSet["Amulet"].selItemId > 0 then
1587-
local currentAnoint = self.items[self.activeItemSet["Amulet"].selItemId].enchantModLines
1588+
local itemType = newItem.base.type
1589+
-- if the new item is anointable and does not have an anoint and your current respective item does, apply that anoint to the new item
1590+
if isAnointable(newItem) and #newItem.enchantModLines == 0 and self.activeItemSet[itemType].selItemId > 0 then
1591+
local currentAnoint = self.items[self.activeItemSet[itemType].selItemId].enchantModLines
15881592
if currentAnoint and #currentAnoint == 1 then -- skip if amulet has more than one anoint e.g. Stranglegasp
15891593
newItem.enchantModLines = currentAnoint
15901594
newItem:BuildAndParseRaw()

src/Modules/ModParser.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5538,6 +5538,7 @@ local specialModList = {
55385538
["can have a second enchantment modifier"] = { },
55395539
["can have (%d+) additional enchantment modifiers"] = { },
55405540
["this item can be anointed by cassia"] = { },
5541+
["can be anointed"] = { },
55415542
["implicit modifiers cannot be changed"] = { },
55425543
["has a crucible passive skill tree"] = { },
55435544
["has elder, shaper and all conqueror influences"] = { },

0 commit comments

Comments
 (0)