From 5997de0a3db732694a99c97d0af47efd5181067c Mon Sep 17 00:00:00 2001 From: ackis Date: Mon, 20 Apr 2009 21:45:09 +0000 Subject: [PATCH] Add some vendor support to scan vendor items and do some toooooollllltip scanning. ZOMG!! --- ARLDatamine.lua | 46 ++++++++++++++++++++++++++++++++++++++++++++++ Docs/Datamine.txt | 6 +++++- Locals/testenUS.lua | 1 + 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/ARLDatamine.lua b/ARLDatamine.lua index d6f66fa..8e260be 100644 --- a/ARLDatamine.lua +++ b/ARLDatamine.lua @@ -21,11 +21,19 @@ local addon = LibStub("AceAddon-3.0"):GetAddon(MODNAME) local L = LibStub("AceLocale-3.0"):GetLocale(MODNAME) +local UnitName = UnitName +local UnitGUID = UnitGUID +local UnitExists = UnitExists +local UnitIsPlayer = UnitIsPlayer +local UnitIsEnemy = UnitIsEnemy local GetNumTrainerServices = GetNumTrainerServices local GetTrainerServiceInfo = GetTrainerServiceInfo local IsTradeskillTrainer = IsTradeskillTrainer local SetTrainerServiceTypeFilter = SetTrainerServiceTypeFilter local GetTrainerServiceSkillReq = GetTrainerServiceSkillReq +local GetMerchantNumItems = GetMerchantNumItems +local GetMerchantItemLink = GetMerchantItemLink +local GetMerchantItemInfo = GetMerchantItemInfo local pairs = pairs local tconcat = table.concat @@ -181,3 +189,41 @@ function addon:GenerateLinks() end end + +local ARLDatamineTT = CreateFrame("GameTooltip","ARLDatamineTT",UIParent,"GameTooltipTemplate") + +-- Description: Scans the items on a vendor, determining which recipes are availible if any and compares it with the database entries. + +--- Scans the items on a vendor, determining which recipes are availible if any and compares it with the database entries. +-- @name AckisRecipeList:ScanVendor +-- @return Obtains all the vendor information on tradeskill recipes and attempts to compare the current vendor with the internal database. + +function addon:ScanVendor() + + -- Make sure the target exists and is a NPC + if (UnitExists("target") and (not UnitIsPlayer("target")) and (not UnitIsEnemy("player", "target"))) then + + -- Get its name + local targetname = UnitName("target") + -- Get the NPC ID + local targetID = tonumber(string.sub(UnitGUID("target"),-12,-7),16) + + GameTooltip_SetDefaultAnchor(ARLDatamineTT, UIParent) + + for i=1,GetMerchantNumItems(),1 do + local name, _, _, _, numAvailable = GetMerchantItemInfo(index) + local link = GetMerchantItemLink(i) + -- Will have to do tooltip scanning here. + -- Skill level, profession, limited supply + ARLDatamineTT:SetHyperlink(link) + for i = 1, ARLDatamineTT:NumLines(),1 do + local linetext = _G["GameTooltipTextLeft" .. i] + self:Print(linetext) + end + end + ARLDatamineTT:Hide() + else + self:Print(L["DATAMINER_VENDOR_NOTTARGETTED"]) + end + +end diff --git a/Docs/Datamine.txt b/Docs/Datamine.txt index 377cd23..afc2e2f 100644 --- a/Docs/Datamine.txt +++ b/Docs/Datamine.txt @@ -15,4 +15,8 @@ Does a comparison of the information in your internal ARL database, and those it ====Trainer Recipes==== Does a comparison of the information in your internal ARL database, and those items which are availible on the trainer. Compares the acquire information of the ARL database with what is availible on the trainer. - /script AckisRecipeList:ScanTrainerData() \ No newline at end of file + /script AckisRecipeList:ScanTrainerData() + +====Generate Complete Links==== +Generates a complete link for all tradeskills. This has all known recipes in it and can be used for comparison purposes. + /script AckisRecipeList:GenerateLinks() \ No newline at end of file diff --git a/Locals/testenUS.lua b/Locals/testenUS.lua index c3530e0..91fdc72 100644 --- a/Locals/testenUS.lua +++ b/Locals/testenUS.lua @@ -1716,6 +1716,7 @@ L["DATAMINER_SKILLELVEL"] = [[Recipe level different! Trainer Level: %s]] L["DATAMINER_SKILLLEVEL_ERROR"] = "This can only be used for a trade skill trainer. Please open up the trainer and try again." L["DATAMINER_TRAINER_NOTTARGETTED"] = "You must target the trainer when you run this command." +L["DATAMINER_VENDOR_NOTTARGETTED"] = "You must target the vendor when you run this command." L["DATAMINER_TRAINER_INFO"] = [[Trainer Name: %s Trainer ID: %s]] L["DATAMINER_TRAINER_TEACH"] = "Missing entry for %s" -- 1.7.9.5