Quantcast

-Updated for new patch

Xruptor [06-30-11 - 01:08]
-Updated for new patch
-Fixed an issue with rarity colors not displaying correctly (@Tonyleila from wowinterface)
-Updated the way tooltips are parsed.  (@Aranarth from Wowinterface)
-Updated toc for patch 4.2
Filename
BagSync.lua
BagSync.toc
BagSync_Search.lua
diff --git a/BagSync.lua b/BagSync.lua
index 703b648..2334779 100644
--- a/BagSync.lua
+++ b/BagSync.lua
@@ -1136,44 +1136,50 @@ local function AddOwners(frame, link)
 	frame:Show()
 end

-local function HookTip(tooltip)
-	tooltip:HookScript('OnTooltipSetItem', function(self, ...)
-		local _, itemLink = self:GetItem()
-		if itemLink and GetItemInfo(itemLink) then
-			local itemName = GetItemInfo(itemLink)
-			if BagSyncOpt.enableThrottle then
-				if not self.BagSyncThrottle then self.BagSyncThrottle = GetTime() end
-				if not self.BagSyncPrevious then self.BagSyncPrevious = itemName end
-				if not self.BagSyncShowOnce and self:GetName() == "GameTooltip" then self.BagSyncShowOnce = true end
-
-				if itemName ~= self.BagSyncPrevious then
-					self.BagSyncPrevious = itemName
-					self.BagSyncThrottle = GetTime()
-				end
-				if self:GetName() == "GameTooltip" and (GetTime() - self.BagSyncThrottle) >= 0.05 then
-					self.BagSyncShowOnce = nil
-					AddOwners(self, itemLink)
-				elseif self:GetName() ~= "GameTooltip" then
-					self.BagSyncShowOnce = nil
-					AddOwners(self, itemLink)
-				end
-			else
-				AddOwners(self, itemLink)
+--Thanks to Aranarth from wowinterface.  Replaced HookScript with insecure hooks
+local orgTipSetItem = {}
+local orgTipOnUpdate = {}
+
+local function Tip_OnSetItem(self, ...)
+	orgTipSetItem[self](self, ...)
+	local _, itemLink = self:GetItem()
+	if itemLink and GetItemInfo(itemLink) then
+		local itemName = GetItemInfo(itemLink)
+		if BagSyncOpt.enableThrottle then
+			if not self.BagSyncThrottle then self.BagSyncThrottle = GetTime() end
+			if not self.BagSyncPrevious then self.BagSyncPrevious = itemName end
+			if not self.BagSyncShowOnce and self:GetName() == "GameTooltip" then self.BagSyncShowOnce = true end
+
+			if itemName ~= self.BagSyncPrevious then
+				self.BagSyncPrevious = itemName
+				self.BagSyncThrottle = GetTime()
 			end
-		end
-	end)
-
-	tooltip:HookScript('OnUpdate', function(self, ...)
-		if self:GetName() == "GameTooltip" and self.BagSyncShowOnce and self.BagSyncThrottle and (GetTime() - self.BagSyncThrottle) >= 0.05 then
-			local _, itemLink = self:GetItem()
-			self.BagSyncShowOnce = nil
-			if itemLink then
-				AddOwners(self, itemLink)
+
+			if self:GetName() ~= "GameTooltip" or (GetTime() - self.BagSyncThrottle) >= 0.05 then
+				self.BagSyncShowOnce = nil
+				return AddOwners(self, itemLink)
 			end
+		else
+			return AddOwners(self, itemLink)
+		end
+	end
+end
+
+local function Tip_OnUpdate(self, ...)
+	orgTipOnUpdate[self](self, ...)
+	if self:GetName() == "GameTooltip" and self.BagSyncShowOnce and self.BagSyncThrottle and (GetTime() - self.BagSyncThrottle) >= 0.05 then
+		local _, itemLink = self:GetItem()
+		self.BagSyncShowOnce = nil
+		if itemLink then
+			return AddOwners(self, itemLink)
 		end
-	end)
+	end
 end

-HookTip(GameTooltip)
-HookTip(ItemRefTooltip)
+for _, tip in next, { GameTooltip, ItemRefTooltip } do
+	orgTipSetItem[tip] = tip:GetScript"OnTooltipSetItem"
+	tip:SetScript("OnTooltipSetItem", Tip_OnSetItem)
+	orgTipOnUpdate[tip] = tip:GetScript"OnUpdate"
+	tip:SetScript("OnUpdate", Tip_OnUpdate)
+end

diff --git a/BagSync.toc b/BagSync.toc
index 3b8a716..0db0eee 100644
--- a/BagSync.toc
+++ b/BagSync.toc
@@ -1,8 +1,8 @@
-## Interface: 40100
+## Interface: 40200
 ## Title: BagSync
 ## Notes: BagSync tracks your characters items and displays it within tooltips.
 ## Author: Xruptor
-## Version: 6.3.1
+## Version: 6.3.2
 ## SavedVariables: BagSyncDB, BagSyncOpt, BagSyncGUILD_DB, BagSyncTOKEN_DB

 localization\localization.lua
@@ -17,4 +17,4 @@ BagSync_Minimap.lua
 BagSync_Search.lua
 BagSync_Tokens.lua
 BagSync_Profiles.lua
-BagSync.lua
\ No newline at end of file
+BagSync.lua
diff --git a/BagSync_Search.lua b/BagSync_Search.lua
index 8c9e3f3..e2de184 100644
--- a/BagSync_Search.lua
+++ b/BagSync_Search.lua
@@ -147,7 +147,8 @@ function bgSearch:LoadSlider()
 			if (i + offset) <= #searchTable then
 				if searchTable[i + offset] then
 					if searchTable[i + offset].rarity then
-						local hex = (select(4, GetItemQualityColor(searchTable[i + offset].rarity)))
+						--local hex = (select(4, GetItemQualityColor(searchTable[i + offset].rarity)))
+						local hex = ("|c" .. select(4, GetItemQualityColor(searchTable[i + offset].rarity))) --@Tonyleila Fix from Wowinterface
 						row.title:SetText(format('%s%s|r', hex, searchTable[i + offset].name) or searchTable[i + offset].name)
 					else
 						row.title:SetText(searchTable[i + offset].name)
@@ -263,4 +264,4 @@ function bgSearch:DoSearch()
 	bgSearch:LoadSlider()
 end

-bgSearch:Hide()
\ No newline at end of file
+bgSearch:Hide()