diff --git a/src/Classes/Item.lua b/src/Classes/Item.lua index e9f7cbc75c..ae3c0acd93 100644 --- a/src/Classes/Item.lua +++ b/src/Classes/Item.lua @@ -756,7 +756,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality) self.prefixes.limit = (self.prefixes.limit or 0) + (tonumber(lineLower:match("%+(%d+) prefix modifiers? allowed")) or 0) - (tonumber(lineLower:match("%-(%d+) prefix modifiers? allowed")) or 0) elseif lineLower:match(" suffix modifiers? allowed") then self.suffixes.limit = (self.suffixes.limit or 0) + (tonumber(lineLower:match("%+(%d+) suffix modifiers? allowed")) or 0) - (tonumber(lineLower:match("%-(%d+) suffix modifiers? allowed")) or 0) - elseif lineLower == "this item can be anointed by cassia" then + elseif lineLower:find("can be anointed") then -- blight uniques and Cord Belt self.canBeAnointed = true elseif lineLower == "can have a second enchantment modifier" then self.canHaveTwoEnchants = true diff --git a/src/Classes/ItemsTab.lua b/src/Classes/ItemsTab.lua index 9a8162b911..bc0ecfbd6a 100644 --- a/src/Classes/ItemsTab.lua +++ b/src/Classes/ItemsTab.lua @@ -56,6 +56,9 @@ for _, entry in pairs(data.flavourText) do end end +local function isAnointable(item) + return (item.canBeAnointed or item.base.type == "Amulet") +end local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Control", function(self, build) self.UndoHandler() @@ -438,7 +441,7 @@ holding Shift will put it in the second.]]) self.controls.displayItemAddSocket.shown = function() return #self.displayItem.sockets < self.displayItem.selectableSocketCount + self.displayItem.abyssalSocketCount end - + -- Section: Enchant / Anoint / Corrupt self.controls.displayItemSectionEnchant = new("Control", {"TOPLEFT",self.controls.displayItemSectionSockets,"BOTTOMLEFT"}, {0, 0, 0, function() 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.]]) self:AnointDisplayItem(1) end) self.controls.displayItemAnoint.shown = function() - return self.displayItem and (self.displayItem.base.type == "Amulet" or self.displayItem.canBeAnointed) + return self.displayItem and isAnointable(self.displayItem) end self.controls.displayItemAnoint2 = new("ButtonControl", {"TOPLEFT",self.controls.displayItemAnoint,"TOPRIGHT",true}, {8, 0, 100, 20}, "Anoint 2...", function() self:AnointDisplayItem(2) end) self.controls.displayItemAnoint2.shown = function() return self.displayItem and - (self.displayItem.base.type == "Amulet" or self.displayItem.canBeAnointed) and + isAnointable(self.displayItem) and self.displayItem.canHaveTwoEnchants and #self.displayItem.enchantModLines > 0 end @@ -475,7 +478,7 @@ holding Shift will put it in the second.]]) end) self.controls.displayItemAnoint3.shown = function() return self.displayItem and - (self.displayItem.base.type == "Amulet" or self.displayItem.canBeAnointed) and + isAnointable(self.displayItem) and self.displayItem.canHaveThreeEnchants and #self.displayItem.enchantModLines > 1 end @@ -484,7 +487,7 @@ holding Shift will put it in the second.]]) end) self.controls.displayItemAnoint4.shown = function() return self.displayItem and - (self.displayItem.base.type == "Amulet" or self.displayItem.canBeAnointed) and + isAnointable(self.displayItem) and self.displayItem.canHaveFourEnchants and #self.displayItem.enchantModLines > 2 end @@ -1582,9 +1585,10 @@ end 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 + local itemType = newItem.base.type + -- 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 + if isAnointable(newItem) and #newItem.enchantModLines == 0 and self.activeItemSet[itemType].selItemId > 0 then + local currentAnoint = self.items[self.activeItemSet[itemType].selItemId].enchantModLines if currentAnoint and #currentAnoint == 1 then -- skip if amulet has more than one anoint e.g. Stranglegasp newItem.enchantModLines = currentAnoint newItem:BuildAndParseRaw()