changeset 158:7ebe0a85d539

Fixed the way ItemLinks are extracted so that ItemAuditor can handle negative UniqeIDs. I had two of the same item, but one had a negative unique id and was being tracked as if it were a different item.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Wed, 15 Dec 2010 23:15:17 -0800
parents 091bae7bfca0
children fbfd9dfa6d2b
files CHANGELOG.txt Core.lua
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG.txt	Wed Dec 15 22:49:28 2010 -0800
+++ b/CHANGELOG.txt	Wed Dec 15 23:15:17 2010 -0800
@@ -1,6 +1,7 @@
 2011-01-09  Asa Ayers  <Asa.Ayers@Gmail.com>
 
 - Fixed a bug in calculating purchase/sale where the item ID was being used instead of the number of items that changed.
+- Fixed the way ItemLinks are extracted so that ItemAuditor can handle negative UniqeIDs. I had two of the same item, but one had a negative unique id and was being tracked as if it were a different item.
 
 2010-12-10  Asa Ayers  <Asa.Ayers@Gmail.com>
 
--- a/Core.lua	Wed Dec 15 22:49:28 2010 -0800
+++ b/Core.lua	Wed Dec 15 23:15:17 2010 -0800
@@ -602,10 +602,10 @@
 function ItemAuditor: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")
+		newLink = link and string.match(link, "|H(.-):([-0-9]+):([-0-9]+)|h")
 	end
 	if newLink == nil then
 		local itemID = self:GetItemID(link)
@@ -614,7 +614,7 @@
 			return self:GetSafeLink(newLink)
 		end
 	end
-	   return newLink and string.gsub(newLink, ":0:0:0:0:0:0:[0-9]+", "")
+	   return newLink and string.gsub(newLink, ":0:0:0:0:0:0:[-0-9]+", "")
 end
 
 function ItemAuditor:GetIDFromLink(link)