diff --git a/src/Classes/ItemsTab.lua b/src/Classes/ItemsTab.lua index d1b08541f8..af448a7cda 100644 --- a/src/Classes/ItemsTab.lua +++ b/src/Classes/ItemsTab.lua @@ -1538,18 +1538,43 @@ function ItemsTabClass:DeleteItem(item, deferUndoState) end end +local function copyAnointsAndEldritchImplicits(self, newItem) + if newItem.base and self.activeItemSet[newItem.base.type] then + local currentItem = self.activeItemSet[newItem.base.type].selItemId and self.items[self.activeItemSet[newItem.base.type].selItemId] + -- if you don't have an equipped item that matches the type of the newItem, no need to do anything + if currentItem then + -- 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 + if newItem.base.type == "Amulet" and #newItem.enchantModLines == 0 then + local currentAnoint = currentItem.enchantModLines + if currentAnoint and #currentAnoint == 1 then -- skip if amulet has more than one anoint e.g. Stranglegasp + newItem.enchantModLines = currentAnoint + end + end + -- if the new item is a non-corrupted Normal, Magic, or Rare Helmet, Body Armour, Gloves, or Boots and does not have any influence + -- and your current respective item is Eater and/or Exarch, apply those implicits and influence to the new item + local eldritchBaseTypes = { "Helmet", "Body Armour", "Gloves", "Boots" } + local eldritchRarities = { "NORMAL", "MAGIC", "RARE" } + for _, influence in ipairs(itemLib.influenceInfo.default) do + if newItem[influence.key] then + return + end + end + if main.migrateEldritchImplicits and isValueInTable(eldritchBaseTypes, newItem.base.type) and isValueInTable(eldritchRarities, newItem.rarity) + and #newItem.implicitModLines == 0 and not newItem.corrupted and (currentItem.cleansing or currentItem.tangle) and currentItem.implicitModLines then + newItem.implicitModLines = currentItem.implicitModLines + newItem.tangle = currentItem.tangle + newItem.cleansing = currentItem.cleansing + end + newItem:BuildAndParseRaw() + end + end +end + -- Attempt to create a new item from the given item raw text and sets it as the new display item function ItemsTabClass:CreateDisplayItemFromRaw(itemRaw, normalise) local newItem = new("Item", itemRaw) if newItem.base then - -- 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 - if newItem.base.type == "Amulet" and #newItem.enchantModLines == 0 and self.activeItemSet["Amulet"].selItemId > 0 then - local currentAnoint = self.items[self.activeItemSet["Amulet"].selItemId].enchantModLines - if currentAnoint and #currentAnoint == 1 then -- skip if amulet has more than one anoint e.g. Stranglegasp - newItem.enchantModLines = currentAnoint - newItem:BuildAndParseRaw() - end - end + copyAnointsAndEldritchImplicits(self, newItem) if normalise then newItem:NormaliseQuality() newItem:BuildModList() diff --git a/src/Modules/Main.lua b/src/Modules/Main.lua index ac823cb248..b632a0abe3 100644 --- a/src/Modules/Main.lua +++ b/src/Modules/Main.lua @@ -107,6 +107,7 @@ function main:Init() self.dpiScaleOverridePercent = GetDPIScaleOverridePercent and GetDPIScaleOverridePercent() or 0 self.showWarnings = true self.slotOnlyTooltips = true + self.migrateEldritchImplicits = true self.notSupportedModTooltips = true self.notSupportedTooltipText = " ^8(Not supported in PoB yet)" self.POESESSID = "" @@ -627,6 +628,9 @@ function main:LoadSettings(ignoreBuild) if node.attrib.slotOnlyTooltips then self.slotOnlyTooltips = node.attrib.slotOnlyTooltips == "true" end + if node.attrib.migrateEldritchImplicits then + self.migrateEldritchImplicits = node.attrib.migrateEldritchImplicits == "true" + end if node.attrib.notSupportedModTooltips then self.notSupportedModTooltips = node.attrib.notSupportedModTooltips == "true" end @@ -761,6 +765,7 @@ function main:SaveSettings() lastExportedWebsite = self.lastExportedWebsite, showWarnings = tostring(self.showWarnings), slotOnlyTooltips = tostring(self.slotOnlyTooltips), + migrateEldritchImplicits = tostring(self.migrateEldritchImplicits), notSupportedModTooltips = tostring(self.notSupportedModTooltips), POESESSID = self.POESESSID, invertSliderScrollDirection = tostring(self.invertSliderScrollDirection), @@ -844,7 +849,7 @@ function main:OpenOptionsPopup() end local defaultLabelSpacingPx = -4 - local defaultLabelPlacementX = 240 + local defaultLabelPlacementX = popupWidth*0.45 drawSectionHeader("app", "Application options") @@ -1030,7 +1035,14 @@ function main:OpenOptionsPopup() self.slotOnlyTooltips = state end) controls.slotOnlyTooltips.state = self.slotOnlyTooltips - + + nextRow() + controls.migrateEldritchImplicits = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 20 }, "^7Copy Eldritch Implicits onto Display Item:", function(state) + self.migrateEldritchImplicits = state + end) + controls.migrateEldritchImplicits.tooltipText = "Apply Eldritch Implicits from current gear when comparing new gear, given the new item doesn't have any influence" + controls.migrateEldritchImplicits.state = self.migrateEldritchImplicits + nextRow() controls.notSupportedModTooltips = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 20 }, "^7Show tooltip for unsupported mods :", function(state) self.notSupportedModTooltips = state @@ -1074,6 +1086,7 @@ function main:OpenOptionsPopup() local initialDefaultItemAffixQuality = self.defaultItemAffixQuality or 0.5 local initialShowWarnings = self.showWarnings local initialSlotOnlyTooltips = self.slotOnlyTooltips + local initialMigrateEldritchImplicits = self.migrateEldritchImplicits local initialNotSupportedModTooltips = self.notSupportedModTooltips local initialInvertSliderScrollDirection = self.invertSliderScrollDirection local initialDisableDevAutoSave = self.disableDevAutoSave @@ -1128,6 +1141,7 @@ function main:OpenOptionsPopup() self.defaultItemAffixQuality = initialDefaultItemAffixQuality self.showWarnings = initialShowWarnings self.slotOnlyTooltips = initialSlotOnlyTooltips + self.migrateEldritchImplicits = initialMigrateEldritchImplicits self.notSupportedModTooltips = initialNotSupportedModTooltips self.invertSliderScrollDirection = initialInvertSliderScrollDirection self.disableDevAutoSave = initialDisableDevAutoSave