Skip to content

Commit e0afa65

Browse files
committed
qol for maintaining eldritch implicits across new gear
1 parent d31d44d commit e0afa65

2 files changed

Lines changed: 40 additions & 10 deletions

File tree

src/Classes/ItemsTab.lua

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,19 +1581,41 @@ function ItemsTabClass:DeleteItem(item, deferUndoState)
15811581
end
15821582
end
15831583

1584-
-- Attempt to create a new item from the given item raw text and sets it as the new display item
1585-
function ItemsTabClass:CreateDisplayItemFromRaw(itemRaw, normalise)
1586-
local newItem = new("Item", itemRaw)
1587-
if newItem.base then
1588-
local itemType = newItem.base.type
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
15891589
-- 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 = self.items[self.activeItemSet[itemType].selItemId].enchantModLines
1590+
if isAnointable(newItem) and #newItem.enchantModLines == 0 and self.activeItemSet[itemType].selItemId > 0 then
1591+
local currentAnoint = currentItem.enchantModLines
15921592
if currentAnoint and #currentAnoint == 1 then -- skip if amulet has more than one anoint e.g. Stranglegasp
15931593
newItem.enchantModLines = currentAnoint
1594-
newItem:BuildAndParseRaw()
15951594
end
15961595
end
1596+
1597+
local implicitBaseTypes = { "Helmet", "Body Armour", "Gloves", "Boots" }
1598+
local implicitRarities = { "NORMAL", "MAGIC", "RARE" }
1599+
-- if the new item is a Normal, Magic, or Rare Helmet, Body Armour, Gloves, or Boots and does not have any eldritch implicits
1600+
-- and your current respective item does, apply those implicits and influence to the new item
1601+
if main.migrateEldritchImplicits and isValueInTable(implicitBaseTypes, newItem.base.type) and isValueInTable(implicitRarities, newItem.rarity) and
1602+
not (newItem.tangle and newItem.cleansing) and (currentItem.cleansing or currentItem.tangle) then
1603+
local currentImplicits = currentItem.implicitModLines
1604+
if currentImplicits then
1605+
newItem.implicitModLines = currentImplicits
1606+
newItem.tangle = currentItem.tangle
1607+
newItem.cleansing = currentItem.cleansing
1608+
end
1609+
end
1610+
newItem:BuildAndParseRaw()
1611+
end
1612+
end
1613+
1614+
-- Attempt to create a new item from the given item raw text and sets it as the new display item
1615+
function ItemsTabClass:CreateDisplayItemFromRaw(itemRaw, normalise)
1616+
local newItem = new("Item", itemRaw)
1617+
if newItem.base then
1618+
copyAnointsAndEldritchImplicits(self, newItem)
15971619
if normalise then
15981620
newItem:NormaliseQuality()
15991621
newItem:BuildModList()

src/Modules/Main.lua

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

869869
local defaultLabelSpacingPx = -4
870-
local defaultLabelPlacementX = 240
870+
local defaultLabelPlacementX = popupWidth*0.45
871871

872872
drawSectionHeader("app", "Application options")
873873

@@ -1064,7 +1064,15 @@ function main:OpenOptionsPopup()
10641064
self.slotOnlyTooltips = state
10651065
end)
10661066
controls.slotOnlyTooltips.state = self.slotOnlyTooltips
1067-
1067+
1068+
1069+
nextRow()
1070+
controls.migrateEldritchImplicits = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 20 }, "^7Copy Eldritch Implicits onto Display Item:", function(state)
1071+
self.migrateEldritchImplicits = state
1072+
end)
1073+
controls.migrateEldritchImplicits.tooltipText = "Carry over Eldritch Implicits from current gear when comparing new gear, given the new item does not already have Eldritch Implicits"
1074+
controls.migrateEldritchImplicits.state = self.migrateEldritchImplicits
1075+
10681076
nextRow()
10691077
controls.notSupportedModTooltips = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 20 }, "^7Show tooltip for unsupported mods :", function(state)
10701078
self.notSupportedModTooltips = state

0 commit comments

Comments
 (0)