James D. Callahan III [03-17-10 - 05:31]
diff --git a/AckisRecipeList.toc b/AckisRecipeList.toc
index e9974e1..275607e 100644
--- a/AckisRecipeList.toc
+++ b/AckisRecipeList.toc
@@ -66,6 +66,7 @@ Constants.lua
ARL.lua
Config.lua
Colour.lua
+Waypoint.lua
Frame.lua
Datamine.lua
Player.lua
diff --git a/Frame.lua b/Frame.lua
index 841e9b5..7f52dd4 100644
--- a/Frame.lua
+++ b/Frame.lua
@@ -2744,493 +2744,6 @@ MainPanel.close_button:SetScript("OnClick",
MainPanel:Hide()
end)
--------------------------------------------------------------------------------
--- Map waypoint code.
--------------------------------------------------------------------------------
-do
- local BZ = LibStub("LibBabble-Zone-3.0"):GetLookupTable()
-
- local function LoadZones(c, y, ...)
- -- Fill up the list for normal lookup
- for i = 1, select('#', ...), 1 do
- c[i] = select(i, ...)
-
--- if c[i] == BZ["The Storm Peaks"] then
--- addon:Print("We have a match.")
--- end
- end
-
- -- Reverse lookup to make work easier later on
- for i in pairs(c) do
- y[c[i]] = i
- end
- end
-
- local C1 = {}
- local C2 = {}
- local C3 = {}
- local C4 = {}
-
- local c1 = {}
- local c2 = {}
- local c3 = {}
- local c4 = {}
-
--- addon:Print("Loading zones for continent 1")
- LoadZones(C1, c1, GetMapZones(1))
--- addon:Print("Loading zones for continent 2")
- LoadZones(C2, c2, GetMapZones(2))
--- addon:Print("Loading zones for continent 3")
- LoadZones(C3, c3, GetMapZones(3))
--- addon:Print("Loading zones for continent 4")
- LoadZones(C4, c4, GetMapZones(4))
-
- local iconlist = {}
-
- -- Clears all the icons from the world map and the mini-map
- function addon:ClearMap()
- if TomTom then
- for i in pairs(iconlist) do
- TomTom:RemoveWaypoint(iconlist[i])
- end
- iconlist = twipe(iconlist)
- end
-
- end
-
- -- Used for maplist
- local map_data = {}
-
- local function GetMapDisplay(acquire_type, acquire_info, 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 player_faction = Player.faction
- local acquire_id = acquire_entry.ID
-
- map_data[acquire_id] = map_data[acquire_id] or {}
-
- local map_entry = map_data[acquire_id]
- map_entry.type = -1
-
- if acquire_type == A.TRAINER and maptrainer then
- local trainer = private.trainer_list[acquire_id]
-
- display = (trainer.faction == BFAC[player_faction] or trainer.faction == FACTION_NEUTRAL)
- elseif acquire_type == A.VENDOR and mapvendor then
- local vendor = private.vendor_list[acquire_id]
-
- display = (vendor.faction == BFAC[player_faction] or vendor.faction == FACTION_NEUTRAL)
- elseif acquire_type == A.REPUTATION and mapvendor then
- local vendor = private.vendor_list[acquire_entry.rep_vendor]
-
- display = (vendor.faction == BFAC[player_faction] or vendor.faction == FACTION_NEUTRAL)
- elseif acquire_type == A.MOB and mapmob then
- return true
- elseif acquire_type == A.QUEST and mapquest then
- local quest = private.quest_list[acquire_id]
-
- display = (quest.faction == BFAC[player_faction] or quest.faction == FACTION_NEUTRAL)
- elseif acquire_type == A.CUSTOM then
- if flags[F.TRAINER] and maptrainer then
- return true
- elseif flags[F.VENDOR] and mapvendor then
- return true
- elseif flags[F.QUEST] and mapquest then
- return true
- elseif flags[F.INSTANCE] or flags[F.RAID] or flags[F.WORLD_DROP] or flags[F.MOB_DROP] then
- return true
- end
- end
- return ((map_data.type > -1) and (map_data.ID > -1))
- end
-
- local INSTANCE_LOCATIONS = {
- [BZ["Ahn'kahet: The Old Kingdom"]] = {
- ["loc"] = c4[BZ["Dragonblight"]],
- ["c"] = 4,
- ["x"] = 28.49,
- ["y"] = 51.73,
- },
- [BZ["Auchenai Crypts"]] = {
- ["loc"] = c1[BZ["Terokkar Forest"]],
- ["c"] = 3,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["Azjol-Nerub"]] = {
- ["loc"] = c4[BZ["Dragonblight"]],
- ["c"] = 4,
- ["x"] = 26.01,
- ["y"] = 50.83,
- },
- [BZ["Blackrock Depths"]] = {
- ["loc"] = c1[BZ["Searing Gorge"]],
- ["c"] = 2,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["Blackrock Spire"]] = {
- ["loc"] = c1[BZ["Searing Gorge"]],
- ["c"] = 2,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["Blackwing Lair"]] = {
- ["loc"] = c1[BZ["Searing Gorge"]],
- ["c"] = 2,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["Dire Maul"]] = {
- ["loc"] = c1[BZ["Feralas"]],
- ["c"] = 1,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["Drak'Tharon Keep"]] = {
- ["loc"] = c1[BZ["Zul'Drak"]],
- ["c"] = 4,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["Gnomeregan"]] = {
- ["loc"] = c1[BZ["Dun Morogh"]],
- ["c"] = 2,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["Halls of Lightning"]] = {
- ["loc"] = c4[BZ["The Storm Peaks"]],
- ["c"] = 4,
- ["x"] = 45.40,
- ["y"] = 21.37,
- },
- [BZ["Halls of Stone"]] = {
- ["loc"] = c4[BZ["The Storm Peaks"]],
- ["c"] = 4,
- ["x"] = 39.49,
- ["y"] = 26.92,
- },
- [BZ["Karazhan"]] = {
- ["loc"] = c1[BZ["Deadwind Pass"]],
- ["c"] = 2,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["Magisters' Terrace"]] = {
- ["loc"] = c2[BZ["Isle of Quel'Danas"]],
- ["c"] = 2,
- ["x"] = 61.20,
- ["y"] = 30.89,
- },
- [BZ["Mana-Tombs"]] = {
- ["loc"] = c1[BZ["Terokkar Forest"]],
- ["c"] = 3,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["The Oculus"]] = {
- ["loc"] = c4[BZ["Borean Tundra"]],
- ["c"] = 4,
- ["x"] = 27.52,
- ["y"] = 26.71,
- },
- [BZ["Old Hillsbrad Foothills"]] = {
- ["loc"] = c1[BZ["Tanaris"]],
- ["c"] = 1,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["Onyxia's Lair"]] = {
- ["loc"] = c1[BZ["Dustwallow Marsh"]],
- ["c"] = 1,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["Ruins of Ahn'Qiraj"]] = {
- ["loc"] = c1[BZ["Tanaris"]],
- ["c"] = 1,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["Scholomance"]] = {
- ["loc"] = c1[BZ["Western Plaguelands"]],
- ["c"] = 2,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["Sethekk Halls"]] = {
- ["loc"] = c1[BZ["Terokkar Forest"]],
- ["c"] = 3,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["Shadow Labyrinth"]] = {
- ["loc"] = c1[BZ["Terokkar Forest"]],
- ["c"] = 3,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["Stratholme"]] = {
- ["loc"] = c1[BZ["Eastern Plaguelands"]],
- ["c"] = 2,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["Temple of Ahn'Qiraj"]] = {
- ["loc"] = c1[BZ["Tanaris"]],
- ["c"] = 1,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["The Arcatraz"]] = {
- ["loc"] = c1[BZ["Netherstorm"]],
- ["c"] = 3,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["The Black Morass"]] = {
- ["loc"] = c1[BZ["Tanaris"]],
- ["c"] = 1,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["The Botanica"]] = {
- ["loc"] = c1[BZ["Netherstorm"]],
- ["c"] = 3,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["The Deadmines"]] = {
- ["loc"] = c1[BZ["Westfall"]],
- ["c"] = 2,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["The Mechanar"]] = {
- ["loc"] = c1[BZ["Netherstorm"]],
- ["c"] = 3,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["The Nexus"]] = {
- ["loc"] = c4[BZ["Borean Tundra"]],
- ["c"] = 4,
- ["x"] = 27.50,
- ["y"] = 25.97,
- },
- [BZ["The Shattered Halls"]] = {
- ["loc"] = c1[BZ["Hellfire Peninsula"]],
- ["c"] = 3,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["The Slave Pens"]] = {
- ["loc"] = c1[BZ["Zangarmarsh"]],
- ["c"] = 3,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["The Steamvault"]] = {
- ["loc"] = c1[BZ["Zangarmarsh"]],
- ["c"] = 3,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["The Temple of Atal'Hakkar"]] = {
- ["loc"] = c1[BZ["Swamp of Sorrows"]],
- ["c"] = 2,
- ["x"] = 0,
- ["y"] = 0,
- },
- [BZ["The Violet Hold"]] = {
- ["loc"] = c4[BZ["Dalaran"]],
- ["c"] = 4,
- ["x"] = 66.78,
- ["y"] = 68.19,
- },
- [BZ["Utgarde Keep"]] = {
- ["loc"] = c4[BZ["Howling Fjord"]],
- ["c"] = 4,
- ["x"] = 57.28,
- ["y"] = 46.73,
- },
- [BZ["Utgarde Pinnacle"]] = {
- ["loc"] = c4[BZ["Howling Fjord"]],
- ["c"] = 4,
- ["x"] = 57.26,
- ["y"] = 46.67,
- },
- [BZ["Zul'Gurub"]] = {
- ["loc"] = c1[BZ["Stranglethorn Vale"]],
- ["c"] = 2,
- ["x"] = 0,
- ["y"] = 0,
- },
- }
- local maplist = {}
-
- -- Adds mini-map and world map icons with tomtom.
- -- 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)
- -- Need to re-write this for the new acquire format. -Torhal
- if TomTom or not TomTom then
- return
- end
- local worldmap = addon.db.profile.worldmap
- local minimap = addon.db.profile.minimap
-
- if not (worldmap or minimap) then
- return
- end
- local icontext = "Interface\\AddOns\\AckisRecipeList\\img\\enchant_up"
-
- -- Get the proper icon to put on the mini-map
- -- for i, k in pairs(SORTED_PROFESSIONS) do
- -- if (k["name"] == Player.current_prof) then
- -- icontext = "Interface\\AddOns\\AckisRecipeList\\img\\" .. k["texture"] .. "_up"
- -- break
- -- end
- -- end
- twipe(maplist)
-
- 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]
-
- for acquire_type, acquire_info in pairs(recipe.acquire_data) do
- if GetMapDisplay(acquire_type, acquire_info, recipe["Flags"]) then
- maplist[acquire] = true
- end
- end
- elseif addon.db.profile.autoscanmap then
- local sorted_recipes = addon.sorted_recipes
-
- -- 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_entry = recipe_list[sorted_recipes[i]]
-
- if recipe_entry.is_visible and recipe_entry.is_relevant then
- -- loop through acquire methods, display each
- for acquire_type, acquire_info in pairs(recipe_entry.acquire_data) do
- if GetMapDisplay(acquire, recipe_entry["Flags"]) then
- maplist[acquire] = true
- end
- end
- end
- end
- end
-
- -- local ARLWorldMap = CreateFrame("Button","ARLWorldMap",WorldMapDetailFrame)
- -- ARLWorldMap:ClearAllPoints()
- -- ARLWorldMap:SetWidth(8)
- -- ARLWorldMap:SetHeight(8)
- -- ARLWorldMap.icon = ARLWorldMap:CreateTexture("ARTWORK")
- -- ARLWorldMap.icon:SetTexture(icontext)
- -- ARLWorldMap.icon:SetAllPoints()
-
- -- local ARLMiniMap = CreateFrame("Button","ARLMiniMap",MiniMap)
- -- ARLMiniMap:ClearAllPoints()
- -- ARLMiniMap:SetWidth(8)
- -- ARLMiniMap:SetHeight(8)
- -- ARLMiniMap.icon = ARLMiniMap:CreateTexture("ARTWORK")
- -- ARLMiniMap.icon:SetTexture(icontext)
- -- ARLMiniMap.icon:SetAllPoints()
-
- for entry in pairs(maplist) do
- local loc
- local custom = false
- local id_num = entry.ID
- local acquire_type = entry.type
-
- -- Get the location of the entry.
- if acquire_type == A.TRAINER then
- loc = private.trainer_list[id_num]
- elseif acquire_type == A.VENDOR then
- loc = private.vendor_list[id_num]
- elseif acquire_type == A.REPUTATION then
- loc = private.vendor_list[entry.rep_vendor]
- elseif acquire_type == A.MOB then
- loc = private.mob_list[id_num]
- elseif acquire_type == A.QUEST then
- loc = private.quest_list[id_num]
- elseif acquire_type == A.CUSTOM then
- loc = private.custom_list[id_num]
- custom = true
- end
-
- local name = loc.name
- local x = loc.coord_x
- local y = loc.coord_y
- local location = loc.location
- local continent, zone
-
- if not loc then
- --@alpha@
- addon:Printf("DEBUG: No continent/zone map match for ID %d - loc is nil.", id_num)
- --@end-alpha@
- elseif c1[location] then
- continent = 1
- zone = c1[location]
- elseif c2[location] then
- continent = 2
- zone = c2[location]
- elseif c3[location] then
- continent = 3
- zone = c3[location]
- elseif c4[location] then
- continent = 4
- zone = c4[location]
- elseif INSTANCE_LOCATIONS[location] then
- local info = INSTANCE_LOCATIONS[location]
-
- continent = info.c
- x = info.x
- y = info.y
- zone = info.loc
- name = name .. " (" .. location .. ")"
- else
- --@alpha@
- addon:Printf("DEBUG: No continent/zone map match for ID %d. Location: %s.", idnum, location)
- --@end-alpha@
- end
-
- --@alpha@
- if (x < -100) or (x > 100) or (y < -100) or (y > 100) then
- addon:Printf("DEBUG: Invalid location coordinates for ID %d. Location: %s.", idnum, location)
- end
- --@end-alpha@
-
- if zone and continent then
- --@alpha@
- if x == 0 and y == 0 then
- addon:Printf("DEBUG: Location is \"0, 0\" for ID %d. Location: %s.", idnum, location)
- end
- --@end-alpha@
- local iconuid = TomTom:AddZWaypoint(continent, zone, x, y, name, false, minimap, worldmap)
-
- tinsert(iconlist, iconuid)
- else
- --@alpha@
- if not zone then
- self:Printf("No zone for ID %d. Location: %s.", id_num, location)
- end
-
- if not continent then
- self:Printf("No continent for ID %d. Location: %s.", id_num, location)
- end
- --@end-alpha@
- end
- end
- end
-end -- do block
-
-- Description: Converting from hex to rgb (Thanks Maldivia)
local function toRGB(hex)
local r, g, b = hex:match("(..)(..)(..)")
diff --git a/Waypoint.lua b/Waypoint.lua
new file mode 100644
index 0000000..a626c40
--- /dev/null
+++ b/Waypoint.lua
@@ -0,0 +1,533 @@
+-------------------------------------------------------------------------------
+-- Waypoint.lua
+-------------------------------------------------------------------------------
+-- File date: @file-date-iso@
+-- File revision: @file-revision@
+-- Project revision: @project-revision@
+-- Project version: @project-version@
+-------------------------------------------------------------------------------
+-- Please see http://www.wowace.com/addons/arl/ for more information.
+-------------------------------------------------------------------------------
+-- This source code is released under All Rights Reserved.
+-------------------------------------------------------------------------------
+-- **AckisRecipeList** provides an interface for scanning professions for missing recipes.
+-- There are a set of functions which allow you make use of the ARL database outside of ARL.
+-- ARL supports all professions currently in World of Warcraft 3.3.2
+-- @class file
+-- @name Waypoint.lua
+-------------------------------------------------------------------------------
+
+-------------------------------------------------------------------------------
+-- Localized Lua globals.
+-------------------------------------------------------------------------------
+local _G = getfenv(0)
+
+local table = _G.table
+
+local string = _G.string
+
+-------------------------------------------------------------------------------
+-- AddOn namespace.
+-------------------------------------------------------------------------------
+local LibStub = LibStub
+
+local MODNAME = "Ackis Recipe List"
+local addon = LibStub("AceAddon-3.0"):GetAddon(MODNAME)
+
+local BFAC = LibStub("LibBabble-Faction-3.0"):GetLookupTable()
+local BZ = LibStub("LibBabble-Zone-3.0"):GetLookupTable()
+local L = LibStub("AceLocale-3.0"):GetLocale(MODNAME)
+
+-- Set up the private intra-file namespace.
+local private = select(2, ...)
+
+local Player = private.Player
+
+local A = private.acquire_types
+local F = private.filter_flags
+
+-------------------------------------------------------------------------------
+-- Constants.
+-------------------------------------------------------------------------------
+local C1 = {}
+local C2 = {}
+local C3 = {}
+local C4 = {}
+
+local c1 = {}
+local c2 = {}
+local c3 = {}
+local c4 = {}
+
+local function LoadZones(c, y, ...)
+ -- Fill up the list for normal lookup
+ for i = 1, select('#', ...), 1 do
+ c[i] = select(i, ...)
+ end
+
+ -- Reverse lookup to make work easier later on
+ for i in pairs(c) do
+ y[c[i]] = i
+ end
+end
+
+-- addon:Print("Loading zones for continent 1")
+LoadZones(C1, c1, GetMapZones(1))
+-- addon:Print("Loading zones for continent 2")
+LoadZones(C2, c2, GetMapZones(2))
+-- addon:Print("Loading zones for continent 3")
+LoadZones(C3, c3, GetMapZones(3))
+-- addon:Print("Loading zones for continent 4")
+LoadZones(C4, c4, GetMapZones(4))
+
+local INSTANCE_LOCATIONS = {
+ [BZ["Ahn'kahet: The Old Kingdom"]] = {
+ ["loc"] = c4[BZ["Dragonblight"]],
+ ["c"] = 4,
+ ["x"] = 28.49,
+ ["y"] = 51.73,
+ },
+ [BZ["Auchenai Crypts"]] = {
+ ["loc"] = c1[BZ["Terokkar Forest"]],
+ ["c"] = 3,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["Azjol-Nerub"]] = {
+ ["loc"] = c4[BZ["Dragonblight"]],
+ ["c"] = 4,
+ ["x"] = 26.01,
+ ["y"] = 50.83,
+ },
+ [BZ["Blackrock Depths"]] = {
+ ["loc"] = c1[BZ["Searing Gorge"]],
+ ["c"] = 2,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["Blackrock Spire"]] = {
+ ["loc"] = c1[BZ["Searing Gorge"]],
+ ["c"] = 2,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["Blackwing Lair"]] = {
+ ["loc"] = c1[BZ["Searing Gorge"]],
+ ["c"] = 2,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["Dire Maul"]] = {
+ ["loc"] = c1[BZ["Feralas"]],
+ ["c"] = 1,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["Drak'Tharon Keep"]] = {
+ ["loc"] = c1[BZ["Zul'Drak"]],
+ ["c"] = 4,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["Gnomeregan"]] = {
+ ["loc"] = c1[BZ["Dun Morogh"]],
+ ["c"] = 2,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["Halls of Lightning"]] = {
+ ["loc"] = c4[BZ["The Storm Peaks"]],
+ ["c"] = 4,
+ ["x"] = 45.40,
+ ["y"] = 21.37,
+ },
+ [BZ["Halls of Stone"]] = {
+ ["loc"] = c4[BZ["The Storm Peaks"]],
+ ["c"] = 4,
+ ["x"] = 39.49,
+ ["y"] = 26.92,
+ },
+ [BZ["Karazhan"]] = {
+ ["loc"] = c1[BZ["Deadwind Pass"]],
+ ["c"] = 2,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["Magisters' Terrace"]] = {
+ ["loc"] = c2[BZ["Isle of Quel'Danas"]],
+ ["c"] = 2,
+ ["x"] = 61.20,
+ ["y"] = 30.89,
+ },
+ [BZ["Mana-Tombs"]] = {
+ ["loc"] = c1[BZ["Terokkar Forest"]],
+ ["c"] = 3,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["The Oculus"]] = {
+ ["loc"] = c4[BZ["Borean Tundra"]],
+ ["c"] = 4,
+ ["x"] = 27.52,
+ ["y"] = 26.71,
+ },
+ [BZ["Old Hillsbrad Foothills"]] = {
+ ["loc"] = c1[BZ["Tanaris"]],
+ ["c"] = 1,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["Onyxia's Lair"]] = {
+ ["loc"] = c1[BZ["Dustwallow Marsh"]],
+ ["c"] = 1,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["Ruins of Ahn'Qiraj"]] = {
+ ["loc"] = c1[BZ["Tanaris"]],
+ ["c"] = 1,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["Scholomance"]] = {
+ ["loc"] = c1[BZ["Western Plaguelands"]],
+ ["c"] = 2,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["Sethekk Halls"]] = {
+ ["loc"] = c1[BZ["Terokkar Forest"]],
+ ["c"] = 3,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["Shadow Labyrinth"]] = {
+ ["loc"] = c1[BZ["Terokkar Forest"]],
+ ["c"] = 3,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["Stratholme"]] = {
+ ["loc"] = c1[BZ["Eastern Plaguelands"]],
+ ["c"] = 2,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["Temple of Ahn'Qiraj"]] = {
+ ["loc"] = c1[BZ["Tanaris"]],
+ ["c"] = 1,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["The Arcatraz"]] = {
+ ["loc"] = c1[BZ["Netherstorm"]],
+ ["c"] = 3,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["The Black Morass"]] = {
+ ["loc"] = c1[BZ["Tanaris"]],
+ ["c"] = 1,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["The Botanica"]] = {
+ ["loc"] = c1[BZ["Netherstorm"]],
+ ["c"] = 3,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["The Deadmines"]] = {
+ ["loc"] = c1[BZ["Westfall"]],
+ ["c"] = 2,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["The Mechanar"]] = {
+ ["loc"] = c1[BZ["Netherstorm"]],
+ ["c"] = 3,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["The Nexus"]] = {
+ ["loc"] = c4[BZ["Borean Tundra"]],
+ ["c"] = 4,
+ ["x"] = 27.50,
+ ["y"] = 25.97,
+ },
+ [BZ["The Shattered Halls"]] = {
+ ["loc"] = c1[BZ["Hellfire Peninsula"]],
+ ["c"] = 3,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["The Slave Pens"]] = {
+ ["loc"] = c1[BZ["Zangarmarsh"]],
+ ["c"] = 3,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["The Steamvault"]] = {
+ ["loc"] = c1[BZ["Zangarmarsh"]],
+ ["c"] = 3,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["The Temple of Atal'Hakkar"]] = {
+ ["loc"] = c1[BZ["Swamp of Sorrows"]],
+ ["c"] = 2,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+ [BZ["The Violet Hold"]] = {
+ ["loc"] = c4[BZ["Dalaran"]],
+ ["c"] = 4,
+ ["x"] = 66.78,
+ ["y"] = 68.19,
+ },
+ [BZ["Utgarde Keep"]] = {
+ ["loc"] = c4[BZ["Howling Fjord"]],
+ ["c"] = 4,
+ ["x"] = 57.28,
+ ["y"] = 46.73,
+ },
+ [BZ["Utgarde Pinnacle"]] = {
+ ["loc"] = c4[BZ["Howling Fjord"]],
+ ["c"] = 4,
+ ["x"] = 57.26,
+ ["y"] = 46.67,
+ },
+ [BZ["Zul'Gurub"]] = {
+ ["loc"] = c1[BZ["Stranglethorn Vale"]],
+ ["c"] = 2,
+ ["x"] = 0,
+ ["y"] = 0,
+ },
+}
+
+local iconlist = {}
+
+-- Clears all the icons from the world map and the mini-map
+function addon:ClearMap()
+ if TomTom then
+ for i in pairs(iconlist) do
+ TomTom:RemoveWaypoint(iconlist[i])
+ end
+ iconlist = table.wipe(iconlist)
+ end
+end
+
+local function GetWaypoint(acquire_type, id_num, 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 player_faction = Player.faction
+ local waypoint
+
+ if acquire_type == A.TRAINER and maptrainer then
+ local trainer = private.trainer_list[id_num]
+
+ if trainer.faction == BFAC[player_faction] or trainer.faction == FACTION_NEUTRAL then
+ waypoint = trainer
+ end
+ elseif acquire_type == A.VENDOR and mapvendor then
+ local vendor = private.vendor_list[id_num]
+
+ if vendor.faction == BFAC[player_faction] or vendor.faction == FACTION_NEUTRAL then
+ waypoint = vendor
+ end
+ elseif acquire_type == A.REPUTATION and mapvendor then
+ local vendor = private.vendor_list[id_num]
+
+ if vendor.faction == BFAC[player_faction] or vendor.faction == FACTION_NEUTRAL then
+ waypoint = vendor
+ end
+ elseif acquire_type == A.MOB and mapmob then
+ waypoint = private.mob_list[id_num]
+ elseif acquire_type == A.QUEST and mapquest then
+ local quest = private.quest_list[id_num]
+
+ if quest.faction == BFAC[player_faction] or quest.faction == FACTION_NEUTRAL then
+ waypoint = quest
+ end
+ elseif acquire_type == A.CUSTOM then
+ if flags[F.TRAINER] and maptrainer then
+ waypoint = private.custom_list[id_num]
+ elseif flags[F.VENDOR] and mapvendor then
+
+ waypoint = private.custom_list[id_num]
+ elseif flags[F.QUEST] and mapquest then
+ waypoint = private.custom_list[id_num]
+ elseif flags[F.INSTANCE] or flags[F.RAID] or flags[F.WORLD_DROP] or flags[F.MOB_DROP] then
+ waypoint = private.custom_list[id_num]
+ end
+ end
+ return waypoint
+end
+
+local maplist = {}
+
+-- Adds mini-map and world map icons with tomtom.
+-- 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)
+ if not TomTom then
+ return
+ end
+ local worldmap = addon.db.profile.worldmap
+ local minimap = addon.db.profile.minimap
+
+ if not (worldmap or minimap) then
+ return
+ end
+ local icontext = "Interface\\AddOns\\AckisRecipeList\\img\\enchant_up"
+
+ -- Get the proper icon to put on the mini-map
+ -- for i, k in pairs(SORTED_PROFESSIONS) do
+ -- if (k["name"] == Player.current_prof) then
+ -- icontext = "Interface\\AddOns\\AckisRecipeList\\img\\" .. k["texture"] .. "_up"
+ -- break
+ -- end
+ -- end
+ table.wipe(maplist)
+
+ 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]
+
+ 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["Flags"])
+
+ if waypoint then
+ maplist[waypoint] = single_recipe
+ end
+ end
+ end
+ else
+ local waypoint = GetWaypoint(acquire_type, id_num, recipe["Flags"])
+
+ if waypoint then
+ maplist[waypoint] = single_recipe
+ end
+ end
+ end
+ end
+ elseif addon.db.profile.autoscanmap then
+ local sorted_recipes = addon.sorted_recipes
+
+ -- 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]]
+
+ if recipe.is_visible and recipe.is_relevant then
+ 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["Flags"])
+
+ if waypoint then
+ maplist[waypoint] = sorted_recipes[i]
+ end
+ end
+ end
+ else
+ local waypoint = GetWaypoint(acquire_type, id_num, recipe["Flags"])
+
+ if waypoint then
+ maplist[waypoint] = sorted_recipes[i]
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+
+ -- local ARLWorldMap = CreateFrame("Button","ARLWorldMap",WorldMapDetailFrame)
+ -- ARLWorldMap:ClearAllPoints()
+ -- ARLWorldMap:SetWidth(8)
+ -- ARLWorldMap:SetHeight(8)
+ -- ARLWorldMap.icon = ARLWorldMap:CreateTexture("ARTWORK")
+ -- ARLWorldMap.icon:SetTexture(icontext)
+ -- ARLWorldMap.icon:SetAllPoints()
+
+ -- local ARLMiniMap = CreateFrame("Button","ARLMiniMap",MiniMap)
+ -- ARLMiniMap:ClearAllPoints()
+ -- ARLMiniMap:SetWidth(8)
+ -- ARLMiniMap:SetHeight(8)
+ -- ARLMiniMap.icon = ARLMiniMap:CreateTexture("ARTWORK")
+ -- ARLMiniMap.icon:SetTexture(icontext)
+ -- ARLMiniMap.icon:SetAllPoints()
+
+ for entry, spell_id in pairs(maplist) do
+ local name = string.format("%s (%s)", entry.name, recipe_list[spell_id].name)
+ local x = entry.coord_x
+ local y = entry.coord_y
+ local location = entry.location
+ local continent, zone
+
+ if c1[location] then
+ continent = 1
+ zone = c1[location]
+ elseif c2[location] then
+ continent = 2
+ zone = c2[location]
+ elseif c3[location] then
+ continent = 3
+ zone = c3[location]
+ elseif c4[location] then
+ continent = 4
+ zone = c4[location]
+ elseif INSTANCE_LOCATIONS[location] then
+ local info = INSTANCE_LOCATIONS[location]
+
+ continent = info.c
+ x = info.x
+ y = info.y
+ zone = info.loc
+ name = name .. " (" .. location .. ")"
+ else
+ --@alpha@
+ addon:Printf("DEBUG: No continent/zone map match for ID %d. Location: %s.", spell_id, location)
+ --@end-alpha@
+ end
+
+ --@alpha@
+ if (x < -100) or (x > 100) or (y < -100) or (y > 100) then
+ addon:Printf("DEBUG: Invalid location coordinates for ID %d. Location: %s.", spell_id, location)
+ end
+ --@end-alpha@
+
+ if zone and continent then
+ --@alpha@
+ if x == 0 and y == 0 then
+ addon:Printf("DEBUG: Location is \"0, 0\" for ID %d. Location: %s.", spell_id, location)
+ end
+ --@end-alpha@
+ local iconuid = TomTom:AddZWaypoint(continent, zone, x, y, name, false, minimap, worldmap)
+
+ tinsert(iconlist, iconuid)
+ else
+ --@alpha@
+ if not zone then
+ self:Printf("No zone for ID %d. Location: %s.", spell_id, location)
+ end
+
+ if not continent then
+ self:Printf("No continent for ID %d. Location: %s.", spell_id, location)
+ end
+ --@end-alpha@
+ end
+ end
+end