Mercurial > wow > itemauditor
diff Core.lua @ 81:64166ba5209a
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
author | Asa Ayers <Asa.Ayers@Gmail.com> |
---|---|
date | Thu, 05 Aug 2010 20:21:05 -0700 |
parents | 19609b3af2d7 |
children | e9f7bc9199ca |
line wrap: on
line diff
--- 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()}