@@ -56,6 +56,9 @@ for _, entry in pairs(data.flavourText) do
5656 end
5757end
5858
59+ local function isAnointable (item )
60+ return (item .canBeAnointed or item .base .type == " Amulet" )
61+ end
5962
6063local ItemsTabClass = newClass (" ItemsTab" , " UndoHandler" , " ControlHost" , " Control" , function (self , build )
6164 self .UndoHandler ()
@@ -438,7 +441,7 @@ holding Shift will put it in the second.]])
438441 self .controls .displayItemAddSocket .shown = function ()
439442 return # self .displayItem .sockets < self .displayItem .selectableSocketCount + self .displayItem .abyssalSocketCount
440443 end
441-
444+
442445 -- Section: Enchant / Anoint / Corrupt
443446 self .controls .displayItemSectionEnchant = new (" Control" , {" TOPLEFT" ,self .controls .displayItemSectionSockets ," BOTTOMLEFT" }, {0 , 0 , 0 , function ()
444447 return (self .controls .displayItemEnchant :IsShown () or self .controls .displayItemEnchant2 :IsShown () or self .controls .displayItemAnoint :IsShown () or self .controls .displayItemAnoint2 :IsShown () or self .controls .displayItemCorrupt :IsShown () ) and 28 or 0
@@ -459,14 +462,14 @@ holding Shift will put it in the second.]])
459462 self :AnointDisplayItem (1 )
460463 end )
461464 self .controls .displayItemAnoint .shown = function ()
462- return self .displayItem and (self .displayItem . base . type == " Amulet " or self . displayItem . canBeAnointed )
465+ return self .displayItem and isAnointable (self .displayItem )
463466 end
464467 self .controls .displayItemAnoint2 = new (" ButtonControl" , {" TOPLEFT" ,self .controls .displayItemAnoint ," TOPRIGHT" ,true }, {8 , 0 , 100 , 20 }, " Anoint 2..." , function ()
465468 self :AnointDisplayItem (2 )
466469 end )
467470 self .controls .displayItemAnoint2 .shown = function ()
468471 return self .displayItem and
469- (self .displayItem . base . type == " Amulet " or self . displayItem . canBeAnointed ) and
472+ isAnointable (self .displayItem ) and
470473 self .displayItem .canHaveTwoEnchants and
471474 # self .displayItem .enchantModLines > 0
472475 end
@@ -475,7 +478,7 @@ holding Shift will put it in the second.]])
475478 end )
476479 self .controls .displayItemAnoint3 .shown = function ()
477480 return self .displayItem and
478- (self .displayItem . base . type == " Amulet " or self . displayItem . canBeAnointed ) and
481+ isAnointable (self .displayItem ) and
479482 self .displayItem .canHaveThreeEnchants and
480483 # self .displayItem .enchantModLines > 1
481484 end
@@ -484,7 +487,7 @@ holding Shift will put it in the second.]])
484487 end )
485488 self .controls .displayItemAnoint4 .shown = function ()
486489 return self .displayItem and
487- (self .displayItem . base . type == " Amulet " or self . displayItem . canBeAnointed ) and
490+ isAnointable (self .displayItem ) and
488491 self .displayItem .canHaveFourEnchants and
489492 # self .displayItem .enchantModLines > 2
490493 end
@@ -1582,9 +1585,10 @@ end
15821585function ItemsTabClass :CreateDisplayItemFromRaw (itemRaw , normalise )
15831586 local newItem = new (" Item" , itemRaw )
15841587 if newItem .base then
1585- -- 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
1586- if newItem .base .type == " Amulet" and # newItem .enchantModLines == 0 and self .activeItemSet [" Amulet" ].selItemId > 0 then
1587- local currentAnoint = self .items [self .activeItemSet [" Amulet" ].selItemId ].enchantModLines
1588+ local itemType = newItem .base .type
1589+ -- 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
15881592 if currentAnoint and # currentAnoint == 1 then -- skip if amulet has more than one anoint e.g. Stranglegasp
15891593 newItem .enchantModLines = currentAnoint
15901594 newItem :BuildAndParseRaw ()
0 commit comments