Quantcast

Add support for custom entries being added to the map, testing it out with the alchemy recipe from ZG where you read the tablet.

ackis [08-31-09 - 22:18]
Add support for custom entries being added to the map, testing it out with the alchemy recipe from ZG where you read the tablet.
Filename
ARLFrame.lua
AckisRecipeList.lua
Locals/testenUS.lua
RecipeDB/ARL-Custom.lua
diff --git a/ARLFrame.lua b/ARLFrame.lua
index 42c026a..8aa13ae 100644
--- a/ARLFrame.lua
+++ b/ARLFrame.lua
@@ -455,22 +455,47 @@ do

 	end

-	local function CheckMapDisplay(v, filters)
+	local function CheckMapDisplay(v, flags)
+
 		local maptrainer = addon.db.profile.maptrainer
 		local mapquest = addon.db.profile.mapquest
 		local mapvendor = addon.db.profile.mapvendor
 		local mapmob = addon.db.profile.mapmob
 		local display = false

-		if ((v["Type"] == ACQUIRE_TRAINER) and (maptrainer)) then		-- If it's a trainer, we don't display them on the mini-map
-			display = ((trainerDB[v["ID"]]["Faction"] == BFAC[myFaction]) or (trainerDB[v["ID"]]["Faction"] == factionNeutral))
-		elseif ((v["Type"] == ACQUIRE_VENDOR) and (mapvendor)) then	-- If it's a vendor check to see if we're displaying it on the map
-			display = ((vendorDB[v["ID"]]["Faction"] == BFAC[myFaction]) or (vendorDB[v["ID"]]["Faction"] == factionNeutral))
-		elseif ((v["Type"] == ACQUIRE_MOB) and (mapmob)) then		-- If it's a mob, always return true
+		-- Trainers - Display if it's your faction or neutral.
+		if (maptrainer) then
+			-- Trainer acquire
+			if (v["Type"] == ACQUIRE_TRAINER) then
+				display = ((trainerDB[v["ID"]]["Faction"] == BFAC[myFaction]) or (trainerDB[v["ID"]]["Faction"] == factionNeutral))
+			-- Custom Acquire
+			elseif ((v["Type"] == ACQUIRE_CUSTOM) and (flags[3])) then
+				return true
+			end
+		-- Vendors - Display if it's your faction or neutral
+		elseif (mapvendor) then
+			-- Vendor Acquire
+			if (v["Type"] == ACQUIRE_VENDOR) then
+				display = ((vendorDB[v["ID"]]["Faction"] == BFAC[myFaction]) or (vendorDB[v["ID"]]["Faction"] == factionNeutral))
+			-- Custom Acquire
+			elseif ((v["Type"] == ACQUIRE_CUSTOM) and (flags[4])) then
+				return true
+			end
+		-- Always display mobs
+		elseif (((v["Type"] == ACQUIRE_MOB) and (mapmob)) or
+			((v["Type"] == ACQUIRE_CUSTOM) and (flags[5] or flags[6] or flags[10] or flags[11]))) then
 			return true
-		elseif ((v["Type"] == ACQUIRE_QUEST) and (mapquest)) then	-- If it's a quest check to see if we're displaying it on the map
-			display = ((questDB[v["ID"]]["Faction"] == BFAC[myFaction]) or (questDB[v["ID"]]["Faction"] == factionNeutral))
+		-- Quests
+		elseif (mapquest) then
+			-- Quest Acquire
+			if (v["Type"] == ACQUIRE_QUEST) then
+				display = ((questDB[v["ID"]]["Faction"] == BFAC[myFaction]) or (questDB[v["ID"]]["Faction"] == factionNeutral))
+			-- Custom Acquire
+			elseif ((v["Type"] == ACQUIRE_CUSTOM) and (flags[8])) then
+				return true
+			end
 		end
+
 		return display
 	end

@@ -691,6 +716,10 @@ do
 			["loc"] = c1[BZ["Howling Fjord"]],
 			["c"] = 4,
 		},
+		[BZ["Zul'Gurub"]] = {
+			["loc"] = c1[BZ["Stranglethorn Vale"]],
+			["c"] = 2,
+		},
 	}

 	local maplist = {}
@@ -720,7 +749,6 @@ do
 			end
 		end
 ]]--
-		local filters = addon.db.profile.filters
 		local autoscanmap = addon.db.profile.autoscanmap

 		twipe(maplist)
@@ -729,7 +757,7 @@ do
 		if (singlerecipe) then
 			-- loop through acquire methods, display each
 			for k, v in pairs(recipeDB[singlerecipe]["Acquire"]) do
-				if (CheckMapDisplay(v, filters)) then
+				if (CheckMapDisplay(v, recipeDB[singlerecipe]["Flags"])) then
 					maplist[v["ID"]] = v["Type"]
 				end
 			end
@@ -740,7 +768,7 @@ do
 				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
-						if (CheckMapDisplay(v, filters)) then
+						if (CheckMapDisplay(v, recipeDB[recipeIndex]["Flags"])) then
 							maplist[v["ID"]] = v["Type"]
 						end
 					end
@@ -778,6 +806,8 @@ do
 				loc = mobDB[k]
 			elseif (maplist[k] == 4) then
 				loc = questDB[k]
+			elseif (maplist[k] == 8) then
+				loc = customDB[k]
 			end

 			local name = loc["Name"]
diff --git a/AckisRecipeList.lua b/AckisRecipeList.lua
index a43245a..176534d 100644
--- a/AckisRecipeList.lua
+++ b/AckisRecipeList.lua
@@ -678,9 +678,7 @@ end	-- do block
 -- @return None, array is passed as a reference.
 function addon:addLookupList(DB, ID, Name, Loc, Coordx, Coordy, Faction)

-	--[[
-		For individual database structures, see Documentation.lua
-	]]--
+	--For individual database structures, see Documentation.lua

 	--@alpha@
 	if DB[ID] then
diff --git a/Locals/testenUS.lua b/Locals/testenUS.lua
index 1276386..00e9204 100644
--- a/Locals/testenUS.lua
+++ b/Locals/testenUS.lua
@@ -461,7 +461,7 @@ L["Custom4"] = "Discovered by Major Protection Potions using Burning Crusade or
 L["Custom5"] = "Randomly obtained by completing the cooking daily quest in Shattrath and selecting the meat crate."
 L["Custom6"] = "Randomly obtained by completing the cooking daily quest in Shattrath and selecting the fish barrel."
 L["Custom7"] = "Randomly obtained by completing the fishing daily quest in Shattrath."
-L["Custom8"] = "Learnt by default when learning the profession."
+L["Custom8"] = "Learned by default when learning the profession."
 L["Custom9"] = "Recipe is created by Engineers."
 L["Custom10"] = "Quest to obtain the recipe opens up after turning in the Head of Onyxia."
 L["Custom11"] = "Obtained by clicking on a tablet in Zul'Gurub in the Edge of Madness."
diff --git a/RecipeDB/ARL-Custom.lua b/RecipeDB/ARL-Custom.lua
index a726d65..c04514f 100644
--- a/RecipeDB/ARL-Custom.lua
+++ b/RecipeDB/ARL-Custom.lua
@@ -35,51 +35,52 @@ This source code is released under All Rights Reserved.
 local MODNAME		= "Ackis Recipe List"
 local addon		= LibStub("AceAddon-3.0"):GetAddon(MODNAME)
 local L			= LibStub("AceLocale-3.0"):GetLocale(MODNAME)
+local BZONE		= LibStub("LibBabble-Zone-3.0"):GetLookupTable()

 function addon:InitCustom(CustomDB)

-	self:addLookupList(CustomDB,1,L["Custom1"],"N/A")
-	self:addLookupList(CustomDB,2,L["Custom2"],"N/A")
-	self:addLookupList(CustomDB,3,L["Custom3"],"N/A")
-	self:addLookupList(CustomDB,4,L["Custom4"],"N/A")
-	self:addLookupList(CustomDB,5,L["Custom5"],"N/A")
-	self:addLookupList(CustomDB,6,L["Custom6"],"N/A")
-	self:addLookupList(CustomDB,7,L["Custom7"],"N/A")
-	self:addLookupList(CustomDB,8,L["Custom8"],"N/A")
-	self:addLookupList(CustomDB,9,L["Custom9"],"N/A")
-	self:addLookupList(CustomDB,10,L["Custom10"],"N/A")
-	self:addLookupList(CustomDB,11,L["Custom11"],"N/A")
-	self:addLookupList(CustomDB,12,L["Custom12"],"N/A")
-	self:addLookupList(CustomDB,13,L["Custom13"],"N/A")
-	self:addLookupList(CustomDB,14,L["Custom14"],"N/A")
-	self:addLookupList(CustomDB,15,L["Custom15"],"N/A")
-	self:addLookupList(CustomDB,16,L["Custom16"],"N/A")
-	self:addLookupList(CustomDB,17,L["Custom17"],"N/A")
-	self:addLookupList(CustomDB,18,L["Custom18"],"N/A")
-	self:addLookupList(CustomDB,19,L["Custom19"],"N/A")
-	self:addLookupList(CustomDB,20,L["Custom20"],"N/A")
-	self:addLookupList(CustomDB,21,L["Custom21"],"N/A")
-	self:addLookupList(CustomDB,22,L["Custom22"],"N/A")
-	self:addLookupList(CustomDB,23,L["Custom23"],"N/A")
-	self:addLookupList(CustomDB,24,L["Custom24"],"N/A")
-	self:addLookupList(CustomDB,25,L["Custom25"],"N/A")
-	self:addLookupList(CustomDB,26,L["Custom26"],"N/A")
-	--self:addLookupList(CustomDB,27,L["Custom27"],"N/A")
-	self:addLookupList(CustomDB,28,L["Custom28"],"N/A")
-	self:addLookupList(CustomDB,29,L["Custom29"],"N/A")
-	self:addLookupList(CustomDB,30,L["Custom30"],"N/A")
-	self:addLookupList(CustomDB,31,L["Custom31"],"N/A")
-	self:addLookupList(CustomDB,32,L["Custom32"],"N/A")
-	self:addLookupList(CustomDB,33,L["Custom33"],"N/A")
-	self:addLookupList(CustomDB,34,L["Custom34"],"N/A")
-	self:addLookupList(CustomDB,35,L["Custom35"],"N/A")
-	self:addLookupList(CustomDB,36,L["Custom36"],"N/A")
-	self:addLookupList(CustomDB,37,L["Custom37"],"N/A")
-	self:addLookupList(CustomDB,38,L["Custom38"],"N/A")
-	self:addLookupList(CustomDB,39,L["Custom39"],"N/A")
-	self:addLookupList(CustomDB,40,L["Custom40"],"N/A")
-	self:addLookupList(CustomDB,41,L["Custom41"],"N/A")
-	self:addLookupList(CustomDB,42,L["Custom42"],"N/A")
+	self:addLookupList(CustomDB,1,L["Custom1"])
+	self:addLookupList(CustomDB,2,L["Custom2"])
+	self:addLookupList(CustomDB,3,L["Custom3"])
+	self:addLookupList(CustomDB,4,L["Custom4"])
+	self:addLookupList(CustomDB,5,L["Custom5"])
+	self:addLookupList(CustomDB,6,L["Custom6"])
+	self:addLookupList(CustomDB,7,L["Custom7"])
+	self:addLookupList(CustomDB,8,L["Custom8"])
+	self:addLookupList(CustomDB,9,L["Custom9"])
+	self:addLookupList(CustomDB,10,L["Custom10"])
+	self:addLookupList(CustomDB,11,L["Custom11"],BZONE["Zul'Gurub"],0,0)
+	self:addLookupList(CustomDB,12,L["Custom12"])
+	self:addLookupList(CustomDB,13,L["Custom13"])
+	self:addLookupList(CustomDB,14,L["Custom14"])
+	self:addLookupList(CustomDB,15,L["Custom15"])
+	self:addLookupList(CustomDB,16,L["Custom16"])
+	self:addLookupList(CustomDB,17,L["Custom17"])
+	self:addLookupList(CustomDB,18,L["Custom18"])
+	self:addLookupList(CustomDB,19,L["Custom19"])
+	self:addLookupList(CustomDB,20,L["Custom20"])
+	self:addLookupList(CustomDB,21,L["Custom21"])
+	self:addLookupList(CustomDB,22,L["Custom22"])
+	self:addLookupList(CustomDB,23,L["Custom23"])
+	self:addLookupList(CustomDB,24,L["Custom24"])
+	self:addLookupList(CustomDB,25,L["Custom25"])
+	self:addLookupList(CustomDB,26,L["Custom26"])
+	--self:addLookupList(CustomDB,27,L["Custom27"])
+	self:addLookupList(CustomDB,28,L["Custom28"])
+	self:addLookupList(CustomDB,29,L["Custom29"])
+	self:addLookupList(CustomDB,30,L["Custom30"])
+	self:addLookupList(CustomDB,31,L["Custom31"])
+	self:addLookupList(CustomDB,32,L["Custom32"])
+	self:addLookupList(CustomDB,33,L["Custom33"])
+	self:addLookupList(CustomDB,34,L["Custom34"])
+	self:addLookupList(CustomDB,35,L["Custom35"])
+	self:addLookupList(CustomDB,36,L["Custom36"])
+	self:addLookupList(CustomDB,37,L["Custom37"])
+	self:addLookupList(CustomDB,38,L["Custom38"])
+	self:addLookupList(CustomDB,39,L["Custom39"])
+	self:addLookupList(CustomDB,40,L["Custom40"])
+	self:addLookupList(CustomDB,41,L["Custom41"])
+	self:addLookupList(CustomDB,42,L["Custom42"])

 end