Skip to content

Commit f2b3ef5

Browse files
committed
update for corrupted newItem
1 parent bfb8acc commit f2b3ef5

1 file changed

Lines changed: 25 additions & 27 deletions

File tree

src/Classes/ItemsTab.lua

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,37 +1581,35 @@ function ItemsTabClass:DeleteItem(item, deferUndoState)
15811581
end
15821582
end
15831583

1584-
local function copyAnointsAndEldritchImplicits(newItem)
1585-
local itemType = newItem.base.type
1586-
local currentItem = self.items[self.activeItemSet[itemType].selItemId]
1587-
-- if you don't have an equipped item that matches the type of the newItem, no need to do anything
1588-
if currentItem then
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 = currentItem.enchantModLines
1592-
if currentAnoint and #currentAnoint == 1 then -- skip if amulet has more than one anoint e.g. Stranglegasp
1593-
newItem.enchantModLines = currentAnoint
1594-
end
1595-
end
1596-
-- if the new item is a Normal, Magic, or Rare Helmet, Body Armour, Gloves, or Boots and does not have any influence
1597-
-- and your current respective item has Eater and/or Exarch, apply those implicits and influence to the new item
1598-
local implicitBaseTypes = { "Helmet", "Body Armour", "Gloves", "Boots" }
1599-
local implicitRarities = { "NORMAL", "MAGIC", "RARE" }
1600-
for _, influence in ipairs(itemLib.influenceInfo.default) do
1601-
if newItem[influence.key] then
1602-
return
1603-
end
1604-
end
1605-
if main.migrateEldritchImplicits and isValueInTable(implicitBaseTypes, newItem.base.type) and isValueInTable(implicitRarities, newItem.rarity)
1606-
and #newItem.implicitModLines == 0 and (currentItem.cleansing or currentItem.tangle) then
1607-
local currentImplicits = currentItem.implicitModLines
1608-
if currentImplicits then
1609-
newItem.implicitModLines = currentImplicits
1584+
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]
1587+
-- if you don't have an equipped item that matches the type of the newItem, no need to do anything
1588+
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
1591+
local currentAnoint = currentItem.enchantModLines
1592+
if currentAnoint and #currentAnoint == 1 then -- skip if amulet has more than one anoint e.g. Stranglegasp
1593+
newItem.enchantModLines = currentAnoint
1594+
end
1595+
end
1596+
-- if the new item is a non-corrupted Normal, Magic, or Rare Helmet, Body Armour, Gloves, or Boots and does not have any influence
1597+
-- and your current respective item is Eater and/or Exarch, apply those implicits and influence to the new item
1598+
local eldritchBaseTypes = { "Helmet", "Body Armour", "Gloves", "Boots" }
1599+
local eldritchRarities = { "NORMAL", "MAGIC", "RARE" }
1600+
for _, influence in ipairs(itemLib.influenceInfo.default) do
1601+
if newItem[influence.key] then
1602+
return
1603+
end
1604+
end
1605+
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
16101608
newItem.tangle = currentItem.tangle
16111609
newItem.cleansing = currentItem.cleansing
16121610
end
1611+
newItem:BuildAndParseRaw()
16131612
end
1614-
newItem:BuildAndParseRaw()
16151613
end
16161614
end
16171615

0 commit comments

Comments
 (0)