From 28457ab8026e918e31d576d263d23eb8b74a5843 Mon Sep 17 00:00:00 2001 From: ackis Date: Mon, 16 Feb 2009 23:37:11 +0000 Subject: [PATCH] Fix a few bugs with the world map and mini-map stuff. Still need to add even processing to hide the icons when not needed. --- ARLFrame.lua | 151 +++++++++++++++++++++++++++++++--------------------------- 1 file changed, 80 insertions(+), 71 deletions(-) diff --git a/ARLFrame.lua b/ARLFrame.lua index 37b10f9..00368a0 100644 --- a/ARLFrame.lua +++ b/ARLFrame.lua @@ -315,82 +315,91 @@ do --/script AckisRecipeList:SetupMap() function addon:SetupMap() - --@debug@ - addon:Print("Setting up mini-map icons.") - --@end-debug@ - - local maplist = {} - - -- 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 - -- Vendor - if (v["Type"] == 2) then - maplist[v["ID"]] = true - end + if ((addon.db.profile.worldmap == true) and (addon.db.profile.minimap == true)) then + + --@debug@ + addon:Print("Setting up mini-map icons.") + --@end-debug@ + + local icontext = "Interface\\AddOns\\AckisRecipeList\\img\\enchant_up" + + for i,k in pairs(SortedProfessions) do + if (k["name"] == playerData.playerProfession) then + icontext = "Interface\\AddOns\\AckisRecipeList\\img\\" .. k["texture"] .. "_up" + break end end - end - local ARLWorldMap = CreateFrame("Button","ARLWorldMap",WorldMap) - ARLWorldMap:ClearAllPoints() - ARLWorldMap:SetWidth(8) - ARLWorldMap:SetHeight(8) - ARLWorldMap.icon = ARLWorldMap:CreateTexture("ARTWORK") - ARLWorldMap.icon:SetTexture("Interface\\AddOns\\AckisRecipeList\\img\\enchant_up") - ARLWorldMap.icon:SetAllPoints() - ARLWorldMap:Show() - ARLWorldMap.icon:Show() - - local ARLMiniMap = CreateFrame("Button","ARLMiniMap",MiniMap) - ARLMiniMap:ClearAllPoints() - ARLMiniMap:SetWidth(8) - ARLMiniMap:SetHeight(8) - ARLMiniMap.icon = ARLMiniMap:CreateTexture("ARTWORK") - ARLMiniMap.icon:SetTexture("Interface\\AddOns\\AckisRecipeList\\img\\enchant_up") - ARLMiniMap.icon:SetAllPoints() - ARLMiniMap:Show() - ARLMiniMap.icon:Show() - - for k, j in pairs(maplist) do - - local continent, zone - local vendorloc = vendorDB[k]["Location"] - - if (c1[vendorloc]) then - continent = 1 - zone = c1[vendorloc] - elseif (c2[vendorloc]) then - continent = 2 - zone = c2[vendorloc] - elseif (c3[vendorloc]) then - continent = 3 - zone = c3[vendorloc] - elseif (c4[vendorloc]) then - continent = 4 - zone = c4[vendorloc] - else - --@debug@ - addon:Print("DEBUG: No continent/zone map match for vendor " .. k .. ".") - --@end-debug@ - end + local maplist = {} - if ((zone) and (continent) and (addon.db.profile.worldmap == true)) then - --@debug@ - addon:Print("Adding vendor ID: " .. k .. " to the world map at coords " .. vendorDB[k]["Coordx"] .. "," .. vendorDB[k]["Coordy"].. " with continent ID: " .. continent .. " and zone ID: " .. zone .. ".") - --@end-debug@ - Astrolabe:PlaceIconOnWorldMap(WorldMapFrame,ARLWorldMap,continent,zone,vendorDB[k]["Coordx"]/100,vendorDB[k]["Coordy"]/100) + -- 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 + -- Vendor + if (v["Type"] == 2) then + maplist[v["ID"]] = true + end + end + end end - if ((zone) and (continent) and (addon.db.profile.minimap == true)) then - --@debug@ - addon:Print("Adding vendor ID: " .. k .. " to the mini-map at coords " .. vendorDB[k]["Coordx"] .. "," .. vendorDB[k]["Coordy"].. ".") - --@end-debug@ - Astrolabe:PlaceIconOnMinimap(ARLMiniMap,continent,zone,vendorDB[k]["Coordx"]/100, vendorDB[k]["Coordy"]/100) + 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 k, j in pairs(maplist) do + + local continent, zone + local vendorloc = vendorDB[k]["Location"] + + if (c1[vendorloc]) then + continent = 1 + zone = c1[vendorloc] + elseif (c2[vendorloc]) then + continent = 2 + zone = c2[vendorloc] + elseif (c3[vendorloc]) then + continent = 3 + zone = c3[vendorloc] + elseif (c4[vendorloc]) then + continent = 4 + zone = c4[vendorloc] + else + --@debug@ + addon:Print("DEBUG: No continent/zone map match for vendor " .. k .. ".") + --@end-debug@ + end + + if ((zone) and (continent) and (addon.db.profile.worldmap == true)) then + --@debug@ + addon:Print("Adding vendor ID: " .. k .. " to the world map at coords " .. vendorDB[k]["Coordx"] .. "," .. vendorDB[k]["Coordy"].. " with continent ID: " .. continent .. " and zone ID: " .. zone .. ".") + --@end-debug@ + Astrolabe:PlaceIconOnWorldMap(WorldMapDetailFrame,ARLWorldMap,continent,zone,vendorDB[k]["Coordx"]/100,vendorDB[k]["Coordy"]/100) + end + + if ((zone) and (continent) and (addon.db.profile.minimap == true)) then + --@debug@ + addon:Print("Adding vendor ID: " .. k .. " to the mini-map at coords " .. vendorDB[k]["Coordx"] .. "," .. vendorDB[k]["Coordy"].. ".") + --@end-debug@ + Astrolabe:PlaceIconOnMinimap(ARLMiniMap,continent,zone,vendorDB[k]["Coordx"]/100, vendorDB[k]["Coordy"]/100) + end + end end @@ -606,7 +615,7 @@ local function GenerateTooltipContent(owner, rIndex, playerFaction, exclude) elseif (acquiretooltiplocation == "Mouse") then arlTooltip:ClearAllPoints() local x,y = GetCursorPosition() - local uiscale = UIParent:GetEffectiveScale() + local uiscale = UIParent:GetEffectiveScale() x = x/uiscale y = y/uiscale arlTooltip:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", x, y) -- 1.7.9.5