From 412a04779f5ebf7ada65aedc33132854041b7399 Mon Sep 17 00:00:00 2001 From: shawngmc Date: Wed, 22 Apr 2020 00:39:32 -0400 Subject: [PATCH] Adding IconOverlay Support --- widgets/ItemButton.lua | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/widgets/ItemButton.lua b/widgets/ItemButton.lua index 241240ab..6bf087d1 100644 --- a/widgets/ItemButton.lua +++ b/widgets/ItemButton.lua @@ -60,7 +60,7 @@ local ITEM_SIZE = addon.ITEM_SIZE local buttonClass, buttonProto = addon:NewClass("ItemButton", "ItemButton", "ContainerFrameItemButtonTemplate", "ABEvent-1.0") -local childrenNames = { "Cooldown", "IconTexture", "IconQuestTexture", "Count", "Stock", "NormalTexture", "NewItemTexture" } +local childrenNames = { "Cooldown", "IconTexture", "IconQuestTexture", "Count", "Stock", "NormalTexture", "NewItemTexture", "IconOverlay" } function buttonProto:OnCreate() local name = self:GetName() @@ -304,6 +304,7 @@ function buttonProto:Update() else self.Stock:Hide() end + self:UpdateOverlay() self:UpdateCount() self:UpdateBorder() self:UpdateCooldown() @@ -414,6 +415,27 @@ function buttonProto:UpdateBorder(isolatedEvent) end end +function buttonProto:UpdateOverlay(isolatedEvent) + if self.hasItem then + local overlay = self.IconOverlay + local textureName = nil + if C_AzeriteEmpoweredItem.IsAzeriteEmpoweredItemByID(self.itemLink or self.itemId) then + textureName = "AzeriteIconFrame" + elseif IsCorruptedItem(self.itemLink or self.itemId) then + textureName = "Nzoth-inventory-icon" + end + overlay:Hide(); + if textureName then + overlay:SetAtlas(textureName); + overlay:SetBlendMode("BLEND"); + overlay:Show(); + end + end + if isolatedEvent then + addon:SendMessage('AdiBags_UpdateOverlay', self) + end +end + -------------------------------------------------------------------------------- -- Item stack button --------------------------------------------------------------------------------