Skip to content

Commit 527723e

Browse files
committed
qol for maintaining eldritch implicits across new gear
1 parent 14a0aae commit 527723e

2 files changed

Lines changed: 39 additions & 9 deletions

File tree

src/Classes/ItemsTab.lua

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,18 +1538,40 @@ function ItemsTabClass:DeleteItem(item, deferUndoState)
15381538
end
15391539
end
15401540

1541-
-- Attempt to create a new item from the given item raw text and sets it as the new display item
1542-
function ItemsTabClass:CreateDisplayItemFromRaw(itemRaw, normalise)
1543-
local newItem = new("Item", itemRaw)
1544-
if newItem.base then
1541+
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
15451545
-- 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 and self.activeItemSet["Amulet"].selItemId > 0 then
1547-
local currentAnoint = self.items[self.activeItemSet["Amulet"].selItemId].enchantModLines
1546+
if newItem.base.type == "Amulet" and #newItem.enchantModLines == 0 then
1547+
local currentAnoint = currentItem.enchantModLines
15481548
if currentAnoint and #currentAnoint == 1 then -- skip if amulet has more than one anoint e.g. Stranglegasp
15491549
newItem.enchantModLines = currentAnoint
1550-
newItem:BuildAndParseRaw()
15511550
end
15521551
end
1552+
1553+
local implicitBaseTypes = { "Helmet", "Body Armour", "Gloves", "Boots" }
1554+
local implicitRarities = { "NORMAL", "MAGIC", "RARE" }
1555+
-- if the new item is a Normal, Magic, or Rare Helmet, Body Armour, Gloves, or Boots and does not have any eldritch implicits
1556+
-- and your current respective item does, apply those implicits and influence to the new item
1557+
if main.migrateEldritchImplicits and isValueInTable(implicitBaseTypes, newItem.base.type) and isValueInTable(implicitRarities, newItem.rarity) and
1558+
not (newItem.tangle and newItem.cleansing) and (currentItem.cleansing or currentItem.tangle) then
1559+
local currentImplicits = currentItem.implicitModLines
1560+
if currentImplicits then
1561+
newItem.implicitModLines = currentImplicits
1562+
newItem.tangle = currentItem.tangle
1563+
newItem.cleansing = currentItem.cleansing
1564+
end
1565+
end
1566+
newItem:BuildAndParseRaw()
1567+
end
1568+
end
1569+
1570+
-- Attempt to create a new item from the given item raw text and sets it as the new display item
1571+
function ItemsTabClass:CreateDisplayItemFromRaw(itemRaw, normalise)
1572+
local newItem = new("Item", itemRaw)
1573+
if newItem.base then
1574+
copyAnointsAndEldritchImplicits(self, newItem)
15531575
if normalise then
15541576
newItem:NormaliseQuality()
15551577
newItem:BuildModList()

src/Modules/Main.lua

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ function main:OpenOptionsPopup()
844844
end
845845

846846
local defaultLabelSpacingPx = -4
847-
local defaultLabelPlacementX = 240
847+
local defaultLabelPlacementX = popupWidth*0.45
848848

849849
drawSectionHeader("app", "Application options")
850850

@@ -1030,7 +1030,15 @@ function main:OpenOptionsPopup()
10301030
self.slotOnlyTooltips = state
10311031
end)
10321032
controls.slotOnlyTooltips.state = self.slotOnlyTooltips
1033-
1033+
1034+
1035+
nextRow()
1036+
controls.migrateEldritchImplicits = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 20 }, "^7Copy Eldritch Implicits onto Display Item:", function(state)
1037+
self.migrateEldritchImplicits = state
1038+
end)
1039+
controls.migrateEldritchImplicits.tooltipText = "Carry over Eldritch Implicits from current gear when comparing new gear, given the new item does not already have Eldritch Implicits"
1040+
controls.migrateEldritchImplicits.state = self.migrateEldritchImplicits
1041+
10341042
nextRow()
10351043
controls.notSupportedModTooltips = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 20 }, "^7Show tooltip for unsupported mods :", function(state)
10361044
self.notSupportedModTooltips = state

0 commit comments

Comments
 (0)