@@ -1581,19 +1581,41 @@ function ItemsTabClass:DeleteItem(item, deferUndoState)
15811581 end
15821582end
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 ()
0 commit comments