From ffc9c49b8fe7d1bd52d662c0f43502f3f90f1f25 Mon Sep 17 00:00:00 2001 From: Antonio Lobato Date: Fri, 28 Oct 2022 10:47:21 -0700 Subject: [PATCH] Fix more Dragonflight bugs (#735) * Fixed a bug where opening bags when bank isn't managed by AdiBags would break bag interaction. * Fixed a bug where cooldown textures were not rendering in bags. * Fixed update cooldown for non-retail use. * Cooldown callback fix for GetBagID() bug. --- core/Hooks.lua | 2 +- widgets/ItemButton.lua | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/core/Hooks.lua b/core/Hooks.lua index 49957a11..b9957f8d 100644 --- a/core/Hooks.lua +++ b/core/Hooks.lua @@ -77,7 +77,7 @@ function addon:GetContainerFrame(id, spawn) if spawn then local size = GetContainerNumSlots(id) if size > 0 then - local frame = ContainerFrame_GetOpenFrame() + local frame = ContainerFrame_GetOpenFrame(id) ContainerFrame_GenerateFrame(frame, size, id) end end diff --git a/widgets/ItemButton.lua b/widgets/ItemButton.lua index 73f22745..d8f19daa 100644 --- a/widgets/ItemButton.lua +++ b/widgets/ItemButton.lua @@ -254,7 +254,7 @@ end -------------------------------------------------------------------------------- function buttonProto:OnShow() - self:RegisterEvent('BAG_UPDATE_COOLDOWN', 'UpdateCooldown') + self:RegisterEvent('BAG_UPDATE_COOLDOWN', 'UpdateCooldownCallback') self:RegisterEvent('ITEM_LOCK_CHANGED', 'UpdateLock') self:RegisterEvent('QUEST_ACCEPTED', 'UpdateBorder') self:RegisterEvent('BAG_NEW_ITEMS_UPDATED', 'UpdateNew') @@ -322,7 +322,7 @@ function buttonProto:Update() end self:UpdateCount() self:UpdateBorder() - self:UpdateCooldown() + self:UpdateCooldown(self.texture) self:UpdateLock() self:UpdateNew() if addon.isRetail then @@ -367,9 +367,16 @@ function buttonProto:UpdateSearch() end end -function buttonProto:UpdateCooldown() - -- TODO(lobato): Figure out where this function disappeared to? - --return ContainerFrame_UpdateCooldown(self.bag, self) +do + if not addon.isRetail then + function buttonProto:UpdateCooldown(texture) + return ContainerFrame_UpdateCooldown(self.bag, self) + end + end +end + +function buttonProto:UpdateCooldownCallback() + self:UpdateCooldown(self.texture) end function buttonProto:UpdateNew()