Quantcast

Add automatic trainer scanning (default off)

ackis [04-20-09 - 20:57]
Add automatic trainer scanning (default off)
Filename
ARLConfig.lua
AckisRecipeList.lua
Locals/testenUS.lua
diff --git a/ARLConfig.lua b/ARLConfig.lua
index 71060e9..cccb237 100644
--- a/ARLConfig.lua
+++ b/ARLConfig.lua
@@ -1324,6 +1324,36 @@ local function fullOptions()
 							desc	= L["CLEAR_WAYPOINTS_DESC"],
 							func	= function() addon:ClearMap() end,
 						},
+						spacer5 = {
+							order	= 70,
+							type	= "description",
+							name	= "\n",
+						},
+						header6 = {
+							order	= 71,
+							type	= "header",
+							name	= L["Datamine Settings"],
+						},
+						map_desc =	{
+							order	= 72,
+							type	= "description",
+							name	= L["DATAMINE_SETTINGS_DESC"] .. "\n",
+						},
+						scantrainers = {
+							order	= 73,
+							type	= "toggle",
+							name	= L["Auto Scan Trainers"],
+							desc	= L["AUTOSCAN_TRAINERS_DESC"],
+							get		= function() return addon.db.profile.scantrainers end,
+							set		= function()
+											if (addon.db.profile.scantrainers) then
+												self:RegisterEvent("TRAINER_SHOW")
+											else
+												self:UnregisterEvent("TRAINER_SHOW")
+											end
+											addon.db.profile.scantrainers = not addon.db.profile.scantrainers
+										end,
+						},
 					},
 				},
 			},
diff --git a/AckisRecipeList.lua b/AckisRecipeList.lua
index c7b15cd..5a7bfa0 100644
--- a/AckisRecipeList.lua
+++ b/AckisRecipeList.lua
@@ -163,6 +163,7 @@ function addon:OnInitialize()
 			minimap = true,
 			worldmap = true,
 			autoscanmap = false,
+			scantrainers = false,

 			-- Recipe Exclusion
 			exclusionlist = {},
@@ -312,6 +313,10 @@ function addon:OnEnable()
 	-- Addon responds to tradeskill windows being closed.
 	self:RegisterEvent("TRADE_SKILL_CLOSE")

+	if (addon.db.profile.scantrainers) then
+		self:RegisterEvent("TRAINER_SHOW")
+	end
+
 	-- Add an option so that ARL will work with Manufac
 	if (Manufac) then
 		--@debug@
@@ -372,6 +377,13 @@ end

 ]]--

+function addon:TRADE_SKILL_SHOW()
+
+	self:ScanSkillLevelData()
+	self:ScanTrainerData()
+
+end
+
 do

 	local GetTradeSkillListLink = GetTradeSkillListLink
diff --git a/Locals/testenUS.lua b/Locals/testenUS.lua
index e084e36..c3530e0 100644
--- a/Locals/testenUS.lua
+++ b/Locals/testenUS.lua
@@ -1720,3 +1720,7 @@ L["DATAMINER_TRAINER_INFO"] = [[Trainer Name: %s
 Trainer ID: %s]]
 L["DATAMINER_TRAINER_TEACH"] = "Missing entry for %s"
 L["DATAMINER_TRAINER_NOTTEACH"] = "Extra entry for %s"
+
+L["Datamine Settings"] = true
+L["DATAMINE_SETTINGS_DESC"] = "Allows you to customize in-game ARL datamining."
+L["AUTOSCAN_TRAINERS_DESC"] = "Turns on scanning at trainers to compare skill levels, and recipe acquire methods."