Quantcast

-possible fix for an issue where some items were not being stored.

Xruptor [12-04-11 - 13:48]
-possible fix for an issue where some items were not being stored.
Filename
BagSync.lua
BagSync.toc
diff --git a/BagSync.lua b/BagSync.lua
index e66b91e..0def469 100644
--- a/BagSync.lua
+++ b/BagSync.lua
@@ -497,11 +497,24 @@ end

 --special thanks to tuller :)
 local function ToShortLink(link)
+	--honestly I did it this half-ass way because of tired of having to update this everytime blizzard decides to alter their itemid format.
+	--at least this way it will always pull the first number after itemid: and before the second :
+	--it's not the best way to do this, but it's better then having to freaking modify a regex every so often.  Their latest change is due to Transmorgify.
 	if link and type(link) == "string" then
+		--first attempt
+		local _, first = string.find(link, "item:")
+		local second = string.find(link, ":", first+1) --first occurance of : after item:
+		local finally = string.sub(link, first+1, second-1) --after item:  and before second :
+		if tonumber(finally) then
+			print(finally)
+			return finally
+		end
+		--second attempt
 		local a,b,c,d,e,f,g,h = link:match('(%-?%d+):(%-?%d+):(%-?%d+):(%-?%d+):(%-?%d+):(%-?%d+):(%-?%d+):(%-?%d+)')
 		if(b == '0' and b == c and c == d and d == e and e == f and f == g) then
 			return a
 		end
+		--final attempt
 		return format('item:%s:%s:%s:%s:%s:%s:%s:%s', a, b, c, d, e, f, g, h)
 	end
 	return nil
diff --git a/BagSync.toc b/BagSync.toc
index e1abb3b..5154f72 100644
--- a/BagSync.toc
+++ b/BagSync.toc
@@ -2,7 +2,7 @@
 ## Title: BagSync
 ## Notes: BagSync tracks your characters items and displays it within tooltips.
 ## Author: Xruptor
-## Version: 6.6
+## Version: 6.6.1
 ## SavedVariables: BagSyncDB, BagSyncOpt, BagSyncGUILD_DB, BagSyncTOKEN_DB

 localization\localization.lua