changeset 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 d1ce6df53d94
children 64166ba5209a
files CHANGELOG.txt Core.lua
diffstat 2 files changed, 23 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG.txt	Sun Aug 01 22:02:46 2010 -0700
+++ b/CHANGELOG.txt	Thu Aug 05 19:39:00 2010 -0700
@@ -1,3 +1,7 @@
+2010-08-05  Asa Ayers  <Asa.Ayers@Gmail.com>
+
+- Fixed Bug 22 - Exchanging player bags for bank bags changes invested
+
 2010-08-01  Asa Ayers  <Asa.Ayers@Gmail.com>
 
 - Fixed the tooltip so that it is green if the auction price exactly matches your threshold.
--- 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