addon:SetupMap() is now addon:AddWaypoint() and now allows for specifying a location and/or acquire type - this allows for specifying the source for a recipe that can be obtained from (for example) both a reputation vendor AND a mob drop.
James D. Callahan III [07-02-10 - 03:53]
addon:SetupMap() is now addon:AddWaypoint() and now allows for specifying a location and/or acquire type - this allows for specifying the source for a recipe that can be obtained from (for example) both a reputation vendor AND a mob drop.
diff --git a/ARL.lua b/ARL.lua
index 6171dd8..5bdb410 100644
--- a/ARL.lua
+++ b/ARL.lua
@@ -435,7 +435,7 @@ function addon:OnInitialize()
elseif not IsShiftKeyDown() and not IsAltKeyDown() and not IsControlKeyDown() then
-- If we have a different profession open we do a scan
addon:Scan(false)
- addon:SetupMap()
+ addon:AddWaypoint()
end
else
if IsShiftKeyDown() and not IsAltKeyDown() and not IsControlKeyDown() then
@@ -447,7 +447,7 @@ function addon:OnInitialize()
elseif not IsShiftKeyDown() and not IsAltKeyDown() and not IsControlKeyDown() then
-- No modification
addon:Scan(false)
- addon:SetupMap()
+ addon:AddWaypoint()
end
end
end)
diff --git a/Frame.lua b/Frame.lua
index 10885c8..76bcf6a 100644
--- a/Frame.lua
+++ b/Frame.lua
@@ -2247,7 +2247,7 @@ do
-- First, check if this is a "modified" click, and react appropriately
if clicked_line.recipe_id and _G.IsModifierKeyDown() then
if _G.IsControlKeyDown() and _G.IsShiftKeyDown() then
- addon:SetupMap(clicked_line.recipe_id)
+ addon:AddWaypoint(clicked_line.recipe_id, clicked_line.acquire_id, clicked_line.location_id)
elseif _G.IsShiftKeyDown() then
local itemID = private.recipe_list[clicked_line.recipe_id].item_id
diff --git a/Waypoint.lua b/Waypoint.lua
index 7d08a35..ca72315 100644
--- a/Waypoint.lua
+++ b/Waypoint.lua
@@ -373,7 +373,7 @@ local maplist = {}
-- Expected result: Icons are added to the world map and mini-map.
-- Input: An optional recipe ID
-- Output: Points are added to the maps
-function addon:SetupMap(single_recipe)
+function addon:AddWaypoint(recipe_id, acquire_id, location_id)
if not TomTom then
return
end
@@ -397,26 +397,28 @@ function addon:SetupMap(single_recipe)
local recipe_list = private.recipe_list
-- We're only getting a single recipe, not a bunch
- if single_recipe then
- local recipe = recipe_list[single_recipe]
+ if recipe_id then
+ local recipe = recipe_list[recipe_id]
for acquire_type, acquire_info in pairs(recipe.acquire_data) do
for id_num, id_info in pairs(acquire_info) do
- if acquire_type == A.REPUTATION then
- for rep_level, level_info in pairs(id_info) do
- for vendor_id in pairs(level_info) do
- local waypoint = GetWaypoint(acquire_type, vendor_id, recipe)
-
- if waypoint then
- maplist[waypoint] = single_recipe
+ if not acquire_id or acquire_type == acquire_id then
+ if acquire_type == A.REPUTATION then
+ for rep_level, level_info in pairs(id_info) do
+ for vendor_id in pairs(level_info) do
+ local waypoint = GetWaypoint(acquire_type, vendor_id, recipe)
+
+ if waypoint and (not location_id or waypoint.location == location_id) then
+ maplist[waypoint] = recipe_id
+ end
end
end
- end
- else
- local waypoint = GetWaypoint(acquire_type, id_num, recipe)
+ else
+ local waypoint = GetWaypoint(acquire_type, id_num, recipe)
- if waypoint then
- maplist[waypoint] = single_recipe
+ if waypoint and (not location_id or waypoint.location == location_id) then
+ maplist[waypoint] = recipe_id
+ end
end
end
end
@@ -425,6 +427,7 @@ function addon:SetupMap(single_recipe)
local sorted_recipes = addon.sorted_recipes
local SF = private.recipe_state_flags
local editbox_text = addon.Frame.search_editbox:GetText()
+
-- Scan through all recipes to display, and add the vendors to a list to get their acquire info
for i = 1, #sorted_recipes do
local recipe = recipe_list[sorted_recipes[i]]