Skip to content

Commit f3bbc4c

Browse files
committed
rebase from cord belt PR
1 parent f2b3ef5 commit f3bbc4c

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/Classes/ItemsTab.lua

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,12 +1582,13 @@ function ItemsTabClass:DeleteItem(item, deferUndoState)
15821582
end
15831583

15841584
local function copyAnointsAndEldritchImplicits(self, newItem)
1585-
if newItem.base and self.activeItemSet[newItem.base.type] then
1586-
local currentItem = self.activeItemSet[newItem.base.type].selItemId and self.items[self.activeItemSet[newItem.base.type].selItemId]
1585+
local newItemType = newItem.base.type
1586+
if self.activeItemSet[newItemType] then
1587+
local currentItem = self.activeItemSet[newItemType].selItemId and self.items[self.activeItemSet[newItemType].selItemId]
15871588
-- if you don't have an equipped item that matches the type of the newItem, no need to do anything
15881589
if currentItem then
1589-
-- 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
1590-
if newItem.base.type == "Amulet" and #newItem.enchantModLines == 0 then
1590+
-- 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
1591+
if isAnointable(newItem) and #newItem.enchantModLines == 0 and self.activeItemSet[newItemType].selItemId > 0 then
15911592
local currentAnoint = currentItem.enchantModLines
15921593
if currentAnoint and #currentAnoint == 1 then -- skip if amulet has more than one anoint e.g. Stranglegasp
15931594
newItem.enchantModLines = currentAnoint
@@ -1603,10 +1604,10 @@ local function copyAnointsAndEldritchImplicits(self, newItem)
16031604
end
16041605
end
16051606
if main.migrateEldritchImplicits and isValueInTable(eldritchBaseTypes, newItem.base.type) and isValueInTable(eldritchRarities, newItem.rarity)
1606-
and #newItem.implicitModLines == 0 and not newItem.corrupted and (currentItem.cleansing or currentItem.tangle) and currentItem.implicitModLines then
1607-
newItem.implicitModLines = currentItem.implicitModLines
1608-
newItem.tangle = currentItem.tangle
1609-
newItem.cleansing = currentItem.cleansing
1607+
and #newItem.implicitModLines == 0 and not newItem.corrupted and (currentItem.cleansing or currentItem.tangle) and currentItem.implicitModLines then
1608+
newItem.implicitModLines = currentItem.implicitModLines
1609+
newItem.tangle = currentItem.tangle
1610+
newItem.cleansing = currentItem.cleansing
16101611
end
16111612
newItem:BuildAndParseRaw()
16121613
end
@@ -1617,7 +1618,7 @@ end
16171618
function ItemsTabClass:CreateDisplayItemFromRaw(itemRaw, normalise)
16181619
local newItem = new("Item", itemRaw)
16191620
if newItem.base then
1620-
copyAnointsAndEldritchImplicits(newItem)
1621+
copyAnointsAndEldritchImplicits(self, newItem)
16211622
if normalise then
16221623
newItem:NormaliseQuality()
16231624
newItem:BuildModList()

0 commit comments

Comments
 (0)