changeset 45:a66f6fc57cfb

Fixed two nil related errors and an error with calculating how much an item is worth when it is being created or destroyed.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Tue, 20 Jul 2010 00:09:54 -0700
parents 9a6d4e2768fd
children 5e981c1df761 508110e7c8ee
files CHANGELOG.txt Core.lua
diffstat 2 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG.txt	Mon Jul 19 22:49:02 2010 -0700
+++ b/CHANGELOG.txt	Tue Jul 20 00:09:54 2010 -0700
@@ -3,6 +3,8 @@
 - Implemented COD mail (Ticket #1) and updated the way postage was counted so that if you mail multiple items at once, they will all have the postage counted. I also removed the 30c for postage from how QA thresholds are calculated now that they will be counted every time.
 - Added a dialog to allow the user to send COD mail without a tracking number.
 - Replaced my edit window with a static popup. This looks and behaves better this way.
+- Fixed a couple nil related bugs
+- Fixed the way prices were being calculated as items were being created/destroyed/converted/crafted
 
 2010-07-18  Asa Ayers  <Asa.Ayers@Gmail.com>
 
--- a/Core.lua	Mon Jul 19 22:49:02 2010 -0700
+++ b/Core.lua	Tue Jul 20 00:09:54 2010 -0700
@@ -220,10 +220,11 @@
 			local trackID
 			if outboundSubject ~= nil then
 				self:Debug(outboundSubject)
-				trackID = tonumber(select(3, outboundSubject:find('[[]IA: (%d*)[]]')))
+				trackID = select(3, outboundSubject:find('[[]IA: (%d*)[]]'))
 				
-				self:Debug('COD ID: %s', trackID)
 				if trackID ~= nil then
+					trackID = tonumber(trackID)
+					self:Debug('COD ID: %s', trackID)
 					local cod = self.db.factionrealm.outbound_cod[trackID]
 					if cod == nil then
 						skipMail[mailSignature] = true
@@ -308,6 +309,10 @@
 	
 	if self.items[link] ~= nil then
 		self.items[link].count =  Altoholic:GetItemCount(self:GetIDFromLink(link))
+		
+		if self.items[link].invested == nil then
+			self.items[link].invested = 0
+		end
 	end
 	
 	if viewOnly == true and self.items[link] == nil then
@@ -432,7 +437,7 @@
 			count = count - countModifier
 		end
 		if count > 0 then 
-			return ceil(item.invested), ceil(item.invested/item.count), count
+			return ceil(item.invested), ceil(item.invested/count), count
 		end
 		
 	end