Mercurial > wow > itemauditor
diff Core.lua @ 80:19609b3af2d7
Fixed Bug 22 - Exchanging player bags for bank bags changes invested
author | Asa Ayers <Asa.Ayers@Gmail.com> |
---|---|
date | Thu, 05 Aug 2010 19:39:00 -0700 |
parents | 71de6e86a1a4 |
children | 64166ba5209a |
line wrap: on
line diff
--- a/Core.lua Sun Aug 01 22:02:46 2010 -0700 +++ b/Core.lua Thu Aug 05 19:39:00 2010 -0700 @@ -160,23 +160,32 @@ getOptions().GetSelectedChatWindow():AddMessage( printPrefix .. tostring(message)) end +local function scanBag(bagID, i) + bagSize=GetContainerNumSlots(bagID) + for slotID = 0, bagSize do + local link= GetContainerItemLink(bagID, slotID); + link = link and ItemAuditor:GetSafeLink(link) + + if link ~= nil and i[link] == nil then + i[link] = GetItemCount(link, true); + end + end +end + function ItemAuditor:GetCurrentInventory() local i = {} local bagID local slotID for bagID = 0, NUM_BAG_SLOTS do - bagSize=GetContainerNumSlots(bagID) - for slotID = 0, bagSize do - local link= GetContainerItemLink(bagID, slotID); - link = link and self:GetSafeLink(link) - - if link ~= nil and i[link] == nil then - i[link] = GetItemCount(link); - end - end - + scanBag(bagID, i) end + + scanBag(BANK_CONTAINER, i) + for bagID = NUM_BAG_SLOTS+1, NUM_BANKBAGSLOTS do + scanBag(bagID, i) + end + return {items = i, money = GetMoney()} end