Skip to content

Commit

Permalink
Fixed issues with bank search
Browse files Browse the repository at this point in the history
  • Loading branch information
Caerdon committed Nov 27, 2022
1 parent 2354669 commit f4e9489
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 39 deletions.
4 changes: 3 additions & 1 deletion CaerdonWardrobe.lua
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,9 @@ function CaerdonWardrobeMixin:OnContainerFrameUpdateSearchResults(frame)

if C_Container and C_Container.GetContainerItemInfo then
local itemInfo = C_Container.GetContainerItemInfo(id, itemButton:GetID())
isFiltered = itemInfo.isFiltered
if itemInfo then
isFiltered = itemInfo.isFiltered
end
else
_, _, _, _, _, _, _, isFiltered = GetContainerItemInfo(id, itemButton:GetID())
end
Expand Down
2 changes: 1 addition & 1 deletion CaerdonWardrobe.toc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
## Title: Caerdon Wardrobe
## Notes: Shows BOE / BOA, openable, and unlearned pets, toys, mounts and wardrobe indicator on bank / bag / auction / merchant / guild bank / loot frame / loot roll / encounter journal slots
## Author: Caerdon
## Version: v3.3.2
## Version: v3.3.3
## SavedVariables: CaerdonWardrobeConfig
## OptionalDeps: WagoAnalytics, WoWUnit, AdiBags, AngrierWorldQuests, ArkInventory, Bagnon, BaudBag, cargBags_Nivaya, Combuctor, ElvUI, Inventorian, KkthnxUI, Pawn, Sorted, VenturePlan, WorldQuestsList, WorldQuestTab, WorldQuestTracker, ZygorGuidesViewer

Expand Down
28 changes: 12 additions & 16 deletions features/Bags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,21 @@ function BagsMixin:Init()
hooksecurefunc(ContainerFrameCombinedBags, "UpdateItems", function(...) self:OnUpdateItems(...) end)
hooksecurefunc(ContainerFrameCombinedBags, "UpdateSearchResults", function(...) self:OnUpdateSearchResults(...) end)

EventRegistry:RegisterCallback("ContainerFrame.OpenBag", self.BagOpened, self)

if isDragonflight then
return { "UNIT_SPELLCAST_SUCCEEDED", "TOOLTIP_DATA_UPDATE" }
else
return { "UNIT_SPELLCAST_SUCCEEDED" }
end
end

function BagsMixin:BagOpened(frame, too)
for i, button in frame:EnumerateValidItems() do
CaerdonWardrobe:SetItemButtonMogStatusFilter(button, false)
end
end

function BagsMixin:UNIT_SPELLCAST_SUCCEEDED(unitTarget, castGUID, spellID)
if unitTarget == "player" then
-- Tracking unlock spells to know to refresh
Expand Down Expand Up @@ -74,26 +82,14 @@ function BagsMixin:OnUpdateSearchResults(frame)

if C_Container and C_Container.GetContainerItemInfo then
local itemInfo = C_Container.GetContainerItemInfo(button:GetBagID(), button:GetID())
isFiltered = itemInfo and itemInfo.isFiltered
if itemInfo then
isFiltered = itemInfo.isFiltered
end
else
_, _, _, _, _, _, _, isFiltered = GetContainerItemInfo(button:GetBagID(), button:GetID())
end

-- local slot, bag = button:GetSlotAndBagID()
-- local item = CaerdonItem:CreateFromBagAndSlot(bag, slot)
if button.caerdonButton then
if isFiltered then
button.caerdonButton.mogStatus:Hide()
if button.caerdonButton.bindsOnText then
button.caerdonButton.bindsOnText:Hide()
end
else
button.caerdonButton.mogStatus:Show()
if button.caerdonButton.bindsOnText then
button.caerdonButton.bindsOnText:Show()
end
end
end
CaerdonWardrobe:SetItemButtonMogStatusFilter(button, isFiltered)
end
end

Expand Down
24 changes: 3 additions & 21 deletions features/Bank.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
local BankMixin = {}
local isDragonflight = select(4, GetBuildInfo()) > 100000

function BankMixin:GetName()
return "Bank"
Expand All @@ -23,11 +22,7 @@ function BankMixin:Init()
hooksecurefunc(ContainerFrame13, "UpdateItems", function(...) self:OnUpdateItems(...) end)
hooksecurefunc(ContainerFrame13, "UpdateSearchResults", function(...) self:OnUpdateSearchResults(...) end)

if isDragonflight then
return { "TOOLTIP_DATA_UPDATE" }
else
return {}
end
return { "TOOLTIP_DATA_UPDATE" }
end

function BankMixin:TOOLTIP_DATA_UPDATE()
Expand Down Expand Up @@ -64,6 +59,7 @@ end
function BankMixin:OnUpdateSearchResults(frame)
for i, button in frame:EnumerateValidItems() do
local isFiltered

if C_Container and C_Container.GetContainerItemInfo then
local itemInfo = C_Container.GetContainerItemInfo(button:GetBagID(), button:GetID())
if itemInfo then
Expand All @@ -73,21 +69,7 @@ function BankMixin:OnUpdateSearchResults(frame)
_, _, _, _, _, _, _, isFiltered = GetContainerItemInfo(button:GetBagID(), button:GetID())
end

-- local slot, bag = button:GetSlotAndBagID()
-- local item = CaerdonItem:CreateFromBagAndSlot(bag, slot)
if button.caerdonButton then
if isFiltered then
button.caerdonButton.mogStatus:Hide()
if button.caerdonButton.bindsOnText then
button.caerdonButton.bindsOnText:Hide()
end
else
button.caerdonButton.mogStatus:Show()
if button.caerdonButton.bindsOnText then
button.caerdonButton.bindsOnText:Show()
end
end
end
CaerdonWardrobe:SetItemButtonMogStatusFilter(button, isFiltered)
end
end

Expand Down

0 comments on commit f4e9489

Please sign in to comment.