From 94108b8382debe6944610a20e63ef5efef0f710f Mon Sep 17 00:00:00 2001 From: torhal Date: Wed, 3 Jun 2009 22:40:00 +0000 Subject: [PATCH] In CreateReverseLookup(): Change self:Print() to addon:Print(). In addon:TooltipScanDatabase(): Fixed incorrect name. - Tooltip-scanning of the entire database now works. Upvalued some more Lua functions and Blizzard API. --- ARLDatamine.lua | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/ARLDatamine.lua b/ARLDatamine.lua index 14e4088..6aa438b 100644 --- a/ARLDatamine.lua +++ b/ARLDatamine.lua @@ -30,6 +30,24 @@ local addon = LibStub("AceAddon-3.0"):GetAddon(MODNAME) local L = LibStub("AceLocale-3.0"):GetLocale(MODNAME) + +------------------------------------------------------------------------------- +-- Upvalues globals +------------------------------------------------------------------------------- +local table, string = table, string + +local ipairs, pairs = ipairs, pairs +local tconcat = table.concat +local tsort = table.sort +local tinsert = table.insert +local strmatch = string.match +local strlower = string.lower +local gsub = string.gsub +local tonumber = tonumber + +------------------------------------------------------------------------------- +-- Upvalued Blizzard API +------------------------------------------------------------------------------- local UnitName = UnitName local UnitGUID = UnitGUID local UnitExists = UnitExists @@ -39,16 +57,12 @@ local GetNumTrainerServices = GetNumTrainerServices local GetTrainerServiceInfo = GetTrainerServiceInfo local IsTradeskillTrainer = IsTradeskillTrainer local SetTrainerServiceTypeFilter = SetTrainerServiceTypeFilter +local GetTrainerServiceTypeFilter = GetTrainerServiceTypeFilter local GetTrainerServiceSkillReq = GetTrainerServiceSkillReq local GetMerchantNumItems = GetMerchantNumItems local GetMerchantItemLink = GetMerchantItemLink local GetMerchantItemInfo = GetMerchantItemInfo -local pairs = pairs -local tconcat = table.concat -local tsort = table.sort -local tinsert = table.insert -local smatch = string.match -local gsub = string.gsub +local GetSpellInfo = GetSpellInfo local function LoadRecipe() @@ -106,7 +120,7 @@ local function CreateReverseLookup() local recipelist = LoadRecipe() if (not recipelist) then - self:Print(L["DATAMINER_NODB_ERROR"]) + addon:Print(L["DATAMINER_NODB_ERROR"]) return end @@ -452,7 +466,7 @@ function addon:TooltipScanDatabase() if link then ARLDatamineTT:SetHyperlink(link) - self:ScanToolTip(itemName,recipelist,reverselookup) + self:ScanToolTip(name,recipelist,reverselookup) else addon:Print("Missing RecipeLink for ID " .. i .. " - " .. name .. " (If these are DK abilities, don't worry, that's normal.") end @@ -585,7 +599,7 @@ function addon:ScanToolTip(name,recipelist,reverselookup) -- Check to see if it's a recipe otherwise break out of the for loop if (i == 1) then -- Get the header of the tooltip aka Pattern: - matchtext = smatch(text, "%a+: ") + matchtext = strmatch(text, "%a+: ") -- If the header is not a recipe if (not recipenames[matchtext]) then @@ -800,7 +814,7 @@ function addon:ScanToolTip(name,recipelist,reverselookup) end if (recipefound) then - +-- print("Recipe found: "..matchtext) -- Parse the recipe database until we get a match on the name local spellid local recipename = gsub(name,"%a+%: ","") -- 1.7.9.5