Quantcast

Add an auto-populate option for the map/minimap integration, fixed the error with scanning, and fixed the error with adding a single waypoint to the map.

ackis [03-01-09 - 07:33]
Add an auto-populate option for the map/minimap integration, fixed the error with scanning, and fixed the error with adding a single waypoint to the map.
Filename
ARLConfig.lua
ARLFrame.lua
AckisRecipeList.lua
Locals/ARLLocals-enUS.lua
diff --git a/ARLConfig.lua b/ARLConfig.lua
index 0daaf37..d9930ac 100644
--- a/ARLConfig.lua
+++ b/ARLConfig.lua
@@ -1206,6 +1206,15 @@ local function fullOptions()
 						worldmap = {
 							order	= 63,
 							type	= "toggle",
+							name	= L["Auto Scan Map"],
+							desc	= L["AUTOSCANMAP_DESC"],
+							disabled = tomtomsupport,
+							get		= function() return addon.db.profile.autoscanmap end,
+							set		= function() addon.db.profile.autoscanmap = not addon.db.profile.autoscanmap end,
+						},
+						worldmap = {
+							order	= 65,
+							type	= "toggle",
 							name	= L["World Map"],
 							desc	= L["WORLDMAP_DESC"],
 							disabled = tomtomsupport,
@@ -1213,7 +1222,7 @@ local function fullOptions()
 							set		= function() addon.db.profile.worldmap = not addon.db.profile.worldmap end,
 						},
 						minimap = {
-							order	= 64,
+							order	= 66,
 							type	= "toggle",
 							name	= L["Mini Map"],
 							desc	= L["MINIMAP_DESC"],
@@ -1222,7 +1231,7 @@ local function fullOptions()
 							set		= function() addon.db.profile.minimap = not addon.db.profile.minimap end,
 						},
 						clearmap = {
-							order	= 65,
+							order	= 67,
 							type	= "execute",
 							name	= L["Clear Waypoints"],
 							disabled = tomtomsupport,
diff --git a/ARLFrame.lua b/ARLFrame.lua
index e5b342a..5096885 100644
--- a/ARLFrame.lua
+++ b/ARLFrame.lua
@@ -344,7 +344,7 @@ do

 	end

-	function addon:CheckMapDisplay(v, filters)
+	local function CheckMapDisplay(v, filters)

 		local display = false

@@ -378,8 +378,9 @@ do
 		local worldmap = addon.db.profile.worldmap
 		local minimap = addon.db.profile.minimap
 		local filters = addon.db.profile.filters
+		local autoscanmap = addon.db.profile.autoscanmap

-		if ((worldmap == true) and (minimap == true)) then
+		if ((worldmap == true) or (minimap == true)) then

 			local icontext = "Interface\\AddOns\\AckisRecipeList\\img\\enchant_up"

@@ -397,16 +398,20 @@ do
 			if (singlerecipe) then
 				-- loop through acquire methods, display each
 				for k, v in pairs(recipeDB[singlerecipe]["Acquire"]) do
-					maplist[v["ID"]] = CheckMapDisplay(v,filters)
+					if (CheckMapDisplay(v,filters)) then
+						maplist[v["ID"]] = v["Type"]
+					end
 				end
-			else
+			elseif (autoscanmap == true) then
 				-- Scan through all recipes to display, and add the vendors to a list to get their acquire info
 				for i = 1, #sortedRecipeIndex do
 					local recipeIndex = sortedRecipeIndex[i]
 					if ((recipeDB[recipeIndex]["Display"] == true) and (recipeDB[recipeIndex]["Search"] == true)) then
 						-- loop through acquire methods, display each
 						for k, v in pairs(recipeDB[recipeIndex]["Acquire"]) do
-							maplist[v["ID"]] = CheckMapDisplay(v,filters)
+							if (CheckMapDisplay(v,filters)) then
+								maplist[v["ID"]] = v["Type"]
+							end
 						end
 					end
 				end
@@ -433,20 +438,28 @@ do
 			for k, j in pairs(maplist) do

 				local continent, zone
-				local vendorloc = vendorDB[k]["Location"]
+				local loc = nil
+
+				if (maplist[k] == 2) then
+					loc = vendorDB[k]
+				elseif (maplist[k] == 3) then
+					loc = mobDB[k]
+				elseif (maplist[k] == 4) then
+					loc = questDB[k]
+				end

-				if (c1[vendorloc]) then
+				if (c1[loc["Location"]]) then
 					continent = 1
-					zone = c1[vendorloc]
-				elseif (c2[vendorloc]) then
+					zone = c1[loc["Location"]]
+				elseif (c2[loc["Location"]]) then
 					continent = 2
-					zone = c2[vendorloc]
-				elseif (c3[vendorloc]) then
+					zone = c2[loc["Location"]]
+				elseif (c3[loc["Location"]]) then
 					continent = 3
-					zone = c3[vendorloc]
-				elseif (c4[vendorloc]) then
+					zone = c3[loc["Location"]]
+				elseif (c4[loc["Location"]]) then
 					continent = 4
-					zone = c4[vendorloc]
+					zone = c4[loc["Location"]]
 				else
 					--@debug@
 					addon:Print("DEBUG: No continent/zone map match for vendor " .. k .. ".")
@@ -454,7 +467,7 @@ do
 				end

 				if ((zone) and (continent)) then
-					local iconuid = TomTom:AddZWaypoint(continent, zone, vendorDB[k]["Coordx"], vendorDB[k]["Coordy"], vendorDB[k]["Name"], false, minimap, worldmap)
+					local iconuid = TomTom:AddZWaypoint(continent, zone, loc["Coordx"], loc["Coordy"], loc["Name"], false, minimap, worldmap)
 					tinsert(iconlist,iconuid)
 				end

@@ -1204,7 +1217,7 @@ local function SetProgressBar(playerData)
 	ARL_ProgressBar:SetMinMaxValues(0, pbMax)
 	ARL_ProgressBar:SetValue(pbCur)

-	if math.floor(pbCur / pbMax * 100) <101 then
+	if math.floor(pbCur / pbMax * 100) < 101 then
 		ARL_ProgressBarText:SetText(pbCur .. " / " .. pbMax .. " - " .. math.floor(pbCur / pbMax * 100) .. "%")
 	else
 		ARL_ProgressBarText:SetText(pbCur .. " / " .. pbMax .. " - " .. L["NOT_YET_SCANNED"])
diff --git a/AckisRecipeList.lua b/AckisRecipeList.lua
index 3c5eb6e..0c22195 100644
--- a/AckisRecipeList.lua
+++ b/AckisRecipeList.lua
@@ -158,6 +158,7 @@ function addon:OnInitialize()
 			hidepopup = false,
 			minimap = true,
 			worldmap = true,
+			autoscanmap = false,

 			-- Recipe Exclusion
 			exclusionlist = {},
diff --git a/Locals/ARLLocals-enUS.lua b/Locals/ARLLocals-enUS.lua
index c57c1e6..c33b5d8 100644
--- a/Locals/ARLLocals-enUS.lua
+++ b/Locals/ARLLocals-enUS.lua
@@ -130,6 +130,8 @@ L["Clear Waypoints"]		= true
 L["CLEAR_WAYPOINTS_DESC"]	= "Remove all ARL waypoints from TomTom."
 L["Hide Pop-Up"]			= true
 L["HIDEPOPUP_DESC"]			= "Prevents pop-ups notifying you why the scan window is empty from showing.  Pop-ups will always show for the first time after a new version has been added."
+L["Auto Scan Map"]			= true
+L["AUTOSCANMAP_DESC"]		= "Auto show all waypoints when doing a recipe scan."

 -- Filter Config Options
 L["Filtering Options"]		= true
@@ -306,7 +308,7 @@ L["ARMOR_ALL_DESC"]			= "Recipes that make ANY armor item should be included in
 L["ARMOR_NONE_DESC"]		= "Do NOT include any recipes that make armor items in the scan."
 L["WEAPON_ALL_DESC"]		= "Recipes that make ANY weapon item should be included in the scan."
 L["WEAPON_NONE_DESC"]		= "Do NOT include any recipes that make weapon items in the scan."
-L["NOT_YET_SCANNED"]		= "not yet scanned!"
+L["NOT_YET_SCANNED"]		= "Not yet scanned!"

 -- Common Tool tip Strings (where different from above)
 L["CTRL_CLICK"]			= "Ctrl-Click to add this recipe's link to your chat."