Quantcast

Ok so the tooltip scanning stuff now should be copypasta.

ackis [06-22-09 - 18:11]
Ok so the tooltip scanning stuff now should be copypasta.
Filename
ARLConfig.lua
ARLDatamine.lua
diff --git a/ARLConfig.lua b/ARLConfig.lua
index 05150f5..ac70134 100644
--- a/ARLConfig.lua
+++ b/ARLConfig.lua
@@ -1326,7 +1326,7 @@ local function giveDatamine()
 					name = L["Scan Spell ID"],
 					desc = L["SCAN_SPELL_ID_DESC"],
 					get = false,
-					set = function(info, v) addon:TooltipScanRecipe(tonumber(v)) end,
+					set = function(info, v) addon:TooltipScanRecipe(tonumber(v),false,false) end,
 					order = 80,
 				},
 				scantrainers = {
diff --git a/ARLDatamine.lua b/ARLDatamine.lua
index 4188a28..26b1434 100644
--- a/ARLDatamine.lua
+++ b/ARLDatamine.lua
@@ -904,10 +904,13 @@ do
 			end
 		end

+		local t = {}
+
 		-- Parse the entire recipe database
 		for i in pairs(recipe_list) do
-			addon:TooltipScanRecipe(i)
+			tinsert(t,addon:TooltipScanRecipe(i,false,true))
 		end
+		self:DisplayTextDump(nil,nil,tconcat(t,"\n"))
 	end

 	--- Parses all recipes for a specified profession,scanning their tool tips.
@@ -965,6 +968,8 @@ function addon:ScanVendor()
 		local targetname = UnitName("target")		-- Get its name
 		local targetID = tonumber(string.sub(UnitGUID("target"),-12,-7),16)		-- Get the NPC ID

+		local t = {}
+
 		-- Parse all the items on the merchant
 		for i = 1,GetMerchantNumItems(),1 do

@@ -976,7 +981,7 @@ function addon:ScanVendor()
 			local spellid = reverse_lookup[recipename]
 			-- Do the scan if we have the spell ID
 			if (spellid) then
-				self:TooltipScanRecipe(spellid,true)
+				tinsert(t,addon:TooltipScanRecipe(i,false,true))
 				-- Ok now we know it's a vendor,lets check the database to see if the vendor is listed as an acquire method.
 				local acquire = recipe_list[spellid]["Acquire"]
 				local found = false
@@ -987,12 +992,13 @@ function addon:ScanVendor()
 					end
 				end
 				if (not found) then
-					self:Print("Vendor ID missing from " .. spellid)
+					tinsert(t,"Vendor ID missing from " .. spellid)
 				end
 			else
-				self:Print("Spell ID not found for: " .. name)
+				tinsert(t,"Spell ID not found for: " .. name)
 			end
 		end
+		self:DisplayTextDump(nil,nil,tconcat(t,"\n"))
 	else
 		self:Print(L["DATAMINER_VENDOR_NOTTARGETTED"])
 	end
@@ -1011,10 +1017,13 @@ function addon:TooltipScanDatabase()
 		return
 	end

+	local t = {}
+
 	-- Parse the entire recipe database
 	for i in pairs(recipe_list) do
-		self:TooltipScanRecipe(i)
+		tinsert(t,addon:TooltipScanRecipe(i,false,true))
 	end
+	self:DisplayTextDump(nil,nil,tconcat(t,"\n"))
 end

 local RECIPE_NAMES = {
@@ -1048,8 +1057,10 @@ local RECIPE_NAMES = {
 --- Parses a specific recipe in the database,and scanning its tooltip.
 -- @name AckisRecipeList:TooltipScanRecipe
 -- @param spellid The [[[http://www.wowwiki.com/SpellLink | Spell ID]]] of the recipe being added to the database.
+-- @param is_vendor Boolean to determine if we're viewing a vendor or not.
+-- @param is_largescan Boolena to determine if we're doing a large scan.
 -- @return Recipe has its tooltips scanned.
-function addon:TooltipScanRecipe(spellid,is_vendor)
+function addon:TooltipScanRecipe(spellid,is_vendor,is_largescan)
 	local recipe_list = LoadRecipe()	-- Get internal database

 	if (not recipe_list) then
@@ -1061,8 +1072,6 @@ function addon:TooltipScanRecipe(spellid,is_vendor)
 	ARLDatamineTT:SetOwner(WorldFrame,"ANCHOR_NONE")
 	GameTooltip_SetDefaultAnchor(ARLDatamineTT,UIParent)

-	local t = {}
-
 	if (recipe_list[spellid]) then
 		local recipe_name = recipe_list[spellid]["Name"]
 		local recipe_link = recipe_list[spellid]["RecipeLink"]
@@ -1090,7 +1099,11 @@ function addon:TooltipScanRecipe(spellid,is_vendor)
 						self:Print("Item ID: " .. itemid .. " not in cache.  If you have Querier use /iq " .. itemid)
 					end
 				end
-				self:Print(self:PrintScanResults())
+				if (is_largescan) then
+					return self:PrintScanResults()
+				else
+					self:Print(self:PrintScanResults())
+				end
 			end

 		-- Lets hide this output for runeforging.