# HG changeset patch # User Asa Ayers # Date 1281064865 25200 # Node ID 64166ba5209a1a02d60ab545491d283c3daf277a # Parent 19609b3af2d7b34533e45393c633673f44dfde7c Correct fix for bug 22. The bank needs to be considered and scanned if it is open, but not if the user is not using the bank diff -r 19609b3af2d7 -r 64166ba5209a Core.lua --- a/Core.lua Thu Aug 05 19:39:00 2010 -0700 +++ b/Core.lua Thu Aug 05 20:21:05 2010 -0700 @@ -160,6 +160,13 @@ getOptions().GetSelectedChatWindow():AddMessage( printPrefix .. tostring(message)) end +local bankOpen = false + +function ItemAuditor:BankFrameChanged(event) + bankOpen = (event == 'BANKFRAME_OPENED') + ItemAuditor:UpdateCurrentInventory() +end + local function scanBag(bagID, i) bagSize=GetContainerNumSlots(bagID) for slotID = 0, bagSize do @@ -167,7 +174,7 @@ link = link and ItemAuditor:GetSafeLink(link) if link ~= nil and i[link] == nil then - i[link] = GetItemCount(link, true); + i[link] = GetItemCount(link, bankOpen); end end end @@ -181,9 +188,11 @@ scanBag(bagID, i) end - scanBag(BANK_CONTAINER, i) - for bagID = NUM_BAG_SLOTS+1, NUM_BANKBAGSLOTS do - scanBag(bagID, i) + if bankOpen then + scanBag(BANK_CONTAINER, i) + for bagID = NUM_BAG_SLOTS+1, NUM_BANKBAGSLOTS do + scanBag(bagID, i) + end end return {items = i, money = GetMoney()} diff -r 19609b3af2d7 -r 64166ba5209a Modules/Events.lua --- a/Modules/Events.lua Thu Aug 05 19:39:00 2010 -0700 +++ b/Modules/Events.lua Thu Aug 05 20:21:05 2010 -0700 @@ -4,6 +4,10 @@ function ItemAuditor:OnEnable() self:RegisterEvent("MAIL_SHOW") self:RegisterEvent("UNIT_SPELLCAST_START") + + self:RegisterEvent("BANKFRAME_OPENED", 'BankFrameChanged') + self:RegisterEvent("BANKFRAME_CLOSED", 'BankFrameChanged') + ItemAuditor:UpdateCurrentInventory() self:WatchBags()