Skip to content

Commit d776bb6

Browse files
committed
nil checks, update to check for newItem base implicits, wording on toggle tooltip
1 parent 41b6673 commit d776bb6

2 files changed

Lines changed: 32 additions & 29 deletions

File tree

src/Classes/ItemsTab.lua

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,34 +1539,37 @@ function ItemsTabClass:DeleteItem(item, deferUndoState)
15391539
end
15401540

15411541
local function copyAnointsAndEldritchImplicits(self, newItem)
1542-
local currentItem = self.items[self.activeItemSet[newItem.base.type].selItemId]
1543-
-- if you don't have an equipped item that matches the type of the newItem, no need to do anything
1544-
if currentItem then
1545-
-- 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
1546-
if newItem.base.type == "Amulet" and #newItem.enchantModLines == 0 then
1547-
local currentAnoint = currentItem.enchantModLines
1548-
if currentAnoint and #currentAnoint == 1 then -- skip if amulet has more than one anoint e.g. Stranglegasp
1549-
newItem.enchantModLines = currentAnoint
1550-
end
1551-
end
1552-
-- if the new item is a Normal, Magic, or Rare Helmet, Body Armour, Gloves, or Boots and does not have any influence
1553-
-- and your current respective item has Eater and/or Exarch, apply those implicits and influence to the new item
1554-
local implicitBaseTypes = { "Helmet", "Body Armour", "Gloves", "Boots" }
1555-
local implicitRarities = { "NORMAL", "MAGIC", "RARE" }
1556-
for _, influence in ipairs(itemLib.influenceInfo.default) do
1557-
if newItem[influence.key] then
1558-
return
1559-
end
1560-
end
1561-
if main.migrateEldritchImplicits and isValueInTable(implicitBaseTypes, newItem.base.type) and isValueInTable(implicitRarities, newItem.rarity) and (currentItem.cleansing or currentItem.tangle) then
1562-
local currentImplicits = currentItem.implicitModLines
1563-
if currentImplicits then
1564-
newItem.implicitModLines = currentImplicits
1565-
newItem.tangle = currentItem.tangle
1566-
newItem.cleansing = currentItem.cleansing
1567-
end
1568-
end
1569-
newItem:BuildAndParseRaw()
1542+
if newItem.base and self.activeItemSet[newItem.base.type] then
1543+
local currentItem = self.activeItemSet[newItem.base.type].selItemId and self.items[self.activeItemSet[newItem.base.type].selItemId]
1544+
-- if you don't have an equipped item that matches the type of the newItem, no need to do anything
1545+
if currentItem then
1546+
-- 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
1547+
if newItem.base.type == "Amulet" and #newItem.enchantModLines == 0 then
1548+
local currentAnoint = currentItem.enchantModLines
1549+
if currentAnoint and #currentAnoint == 1 then -- skip if amulet has more than one anoint e.g. Stranglegasp
1550+
newItem.enchantModLines = currentAnoint
1551+
end
1552+
end
1553+
-- if the new item is a Normal, Magic, or Rare Helmet, Body Armour, Gloves, or Boots and does not have any influence
1554+
-- and your current respective item has Eater and/or Exarch, apply those implicits and influence to the new item
1555+
local implicitBaseTypes = { "Helmet", "Body Armour", "Gloves", "Boots" }
1556+
local implicitRarities = { "NORMAL", "MAGIC", "RARE" }
1557+
for _, influence in ipairs(itemLib.influenceInfo.default) do
1558+
if newItem[influence.key] then
1559+
return
1560+
end
1561+
end
1562+
if main.migrateEldritchImplicits and isValueInTable(implicitBaseTypes, newItem.base.type) and isValueInTable(implicitRarities, newItem.rarity)
1563+
and #newItem.implicitModLines == 0 and (currentItem.cleansing or currentItem.tangle) then
1564+
local currentImplicits = currentItem.implicitModLines
1565+
if currentImplicits then
1566+
newItem.implicitModLines = currentImplicits
1567+
newItem.tangle = currentItem.tangle
1568+
newItem.cleansing = currentItem.cleansing
1569+
end
1570+
end
1571+
newItem:BuildAndParseRaw()
1572+
end
15701573
end
15711574
end
15721575

src/Modules/Main.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ function main:OpenOptionsPopup()
10401040
controls.migrateEldritchImplicits = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 20 }, "^7Copy Eldritch Implicits onto Display Item:", function(state)
10411041
self.migrateEldritchImplicits = state
10421042
end)
1043-
controls.migrateEldritchImplicits.tooltipText = "Carry over Eldritch Implicits from current gear when comparing new gear, given the new item does not already have Eldritch Implicits"
1043+
controls.migrateEldritchImplicits.tooltipText = "Apply Eldritch Implicits from current gear when comparing new gear, given the new item doesn't have any influence"
10441044
controls.migrateEldritchImplicits.state = self.migrateEldritchImplicits
10451045

10461046
nextRow()

0 commit comments

Comments
 (0)