changeset 24:554b30908b33 v0.1

- Fixed a bug with the mail where items get recorded by the mail scanner and the bag scanner. - Fixed some minor issues not visible to the user.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Sun, 11 Jul 2010 09:24:33 -0700
parents 819bfdc5d73c
children a7300f1ac65c 75d917ccd942
files CHANGELOG.txt Core.lua Modules/Debug.lua Modules/Events.lua Modules/QuickAuctions.lua Modules/Utils.lua
diffstat 6 files changed, 24 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG.txt	Thu Jul 08 23:55:05 2010 -0700
+++ b/CHANGELOG.txt	Sun Jul 11 09:24:33 2010 -0700
@@ -1,3 +1,8 @@
+2010-07-11  Asa Ayers  <Asa.Ayers@Gmail.com>
+
+- Fixed a bug with the mail where items get recorded by the mail scanner and the bag scanner.
+- Fixed some minor issues not visible to the user.
+
 2010-07-08  Asa Ayers  <Asa.Ayers@Gmail.com>
 
 - Added a (hopefully) more readable changelog.
--- a/Core.lua	Thu Jul 08 23:55:05 2010 -0700
+++ b/Core.lua	Sun Jul 11 09:24:33 2010 -0700
@@ -69,9 +69,10 @@
 	self:RefreshQAGroups()
 end
 
-function addon:Print(message)
-	local prefix = "|cFFA3CEFF"..tostring( self ).."|r: "
-	DEFAULT_CHAT_FRAME:AddMessage( prefix .. tostring(message))
+local printPrefix = "|cFFA3CEFFItemAuditor|r: "
+function addon:Print(message, ...)
+	message = format(message, ...)
+	DEFAULT_CHAT_FRAME:AddMessage( printPrefix .. tostring(message))
 	self:Log(message)
 end
 
@@ -177,8 +178,8 @@
 		elseif mailType == "AHExpired" or mailType == "AHCancelled" or mailType == "AHOutbid" then
 			-- These should be handled when you pay the deposit at the AH
 		else
-			self:Debug("Unhandled mail type: " .. mailType)
-			self:Debug(msgSubject)
+			-- self:Debug("Unhandled mail type: " .. mailType)
+			-- self:Debug(msgSubject)
 		end
 
 	end
@@ -200,7 +201,6 @@
 	local itemName = nil
 	if self:GetSafeLink(link) == nil then
 		itemName = link
-		link = self:GetSafeLink(link)
 	else
 		link = self:GetSafeLink(link)
 		itemName = GetItemInfo(link)
@@ -216,8 +216,7 @@
 	end
 	
 	if viewOnly == false and self.items[link] == nil then
-		local itemName = GetItemInfo(link)
-	
+		
 		self.items[link] = {
 			count =  Altoholic:GetItemCount(self:GetIDFromLink(link)),
 			invested = abs(self.db.factionrealm.item_account[itemName] or 0),
@@ -242,6 +241,8 @@
 	link = self:GetSafeLink(link)
 	if link ~= nil then
 		self.items[link] = nil
+	else
+		self:Debug('Failed to convert link' .. tostring(link))
 	end
 end
 
@@ -305,7 +306,9 @@
 function addon:GetSafeLink(link)
 	local newLink = nil
 
-	if link and link ~= string.match(link, '.-:[-0-9]+[:0-9]*') then
+	if link and link == string.match(link, '.-:[-0-9]+[:0-9]*') then
+		newLink = link
+	elseif link then
 		newLink = link and string.match(link, "|H(.-):([-0-9]+):([0-9]+)|h")
 	end
 	if newLink == nil then
--- a/Modules/Debug.lua	Thu Jul 08 23:55:05 2010 -0700
+++ b/Modules/Debug.lua	Sun Jul 11 09:24:33 2010 -0700
@@ -4,7 +4,8 @@
 local utils = addonTable.utils
 
 
-function addon:Debug(msg)
+function addon:Debug(msg, ...)
+	msg = format(msg, ...)
 	self:Log(msg, " |cffffff00DEBUG")
 end
 
--- a/Modules/Events.lua	Thu Jul 08 23:55:05 2010 -0700
+++ b/Modules/Events.lua	Sun Jul 11 09:24:33 2010 -0700
@@ -6,6 +6,7 @@
 function addon:PLAYER_ENTERING_WORLD()
 	self:RegisterEvent("MAIL_SHOW")
 	self:RegisterEvent("UNIT_SPELLCAST_START")
+	addon:UpdateCurrentInventory()
 	self:WatchBags()
 	
 	-- addon:ConvertItems()
@@ -13,6 +14,7 @@
  
  function addon:MAIL_SHOW()
 	self:Debug("MAIL_SHOW")
+	addon:UpdateCurrentInventory()
 	self.lastMailScan = self:ScanMail()
 	
 	self:UnregisterEvent("MAIL_SHOW")
--- a/Modules/QuickAuctions.lua	Thu Jul 08 23:55:05 2010 -0700
+++ b/Modules/QuickAuctions.lua	Sun Jul 11 09:24:33 2010 -0700
@@ -94,7 +94,7 @@
 	
 	
 	if addon.IsQAEnabled() then
-		self:Debug(format("Auction Threshold: %d%%", self:GetAuctionThreshold()*100 ))
+		self:Debug("Auction Threshold: %d%%", self:GetAuctionThreshold()*100 )
 	end
 	self:Debug(format("Crafting Threshold: %s", self:FormatMoney(self:GetCraftingThreshold())))
 	local profitableItems = {}
--- a/Modules/Utils.lua	Thu Jul 08 23:55:05 2010 -0700
+++ b/Modules/Utils.lua	Sun Jul 11 09:24:33 2010 -0700
@@ -92,7 +92,7 @@
 	item_db[itemName] = tonumber(id)
 end
 
-local SubjectPatterns = {
+addon.SubjectPatterns = {
 	AHCancelled = gsub(AUCTION_REMOVED_MAIL_SUBJECT, "%%s", ".*"),
 	AHExpired = gsub(AUCTION_EXPIRED_MAIL_SUBJECT, "%%s", ".*"),
 	AHOutbid = gsub(AUCTION_OUTBID_MAIL_SUBJECT, "%%s", ".*"),
@@ -103,7 +103,7 @@
 
 function addon:GetMailType(msgSubject)
 	if msgSubject then
-		for k, v in pairs(SubjectPatterns) do
+		for k, v in pairs(self.SubjectPatterns) do
 			if msgSubject:find(v) then return k end
 		end
 	end