From 95fe4baec2a82238dade409bf621b74948178e5e Mon Sep 17 00:00:00 2001 From: Ludovicus Date: Wed, 20 Jun 2018 17:59:41 -0400 Subject: [PATCH] First BFA Port of TomTom_Waypoints.lua: Convert to new APIs. --- TomTom_Waypoints.lua | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/TomTom_Waypoints.lua b/TomTom_Waypoints.lua index ea95ce8..062e6b8 100755 --- a/TomTom_Waypoints.lua +++ b/TomTom_Waypoints.lua @@ -10,7 +10,7 @@ local addon_name, addon = ... local hbd = addon.hbd -local hbdp = LibStub("HereBeDragons-Pins-1.0") +local hbdp = LibStub("HereBeDragons-Pins-2.0") -- Create a tooltip to be used when mousing over waypoints local tooltip = CreateFrame("GameTooltip", "TomTomTooltip", UIParent, "GameTooltipTemplate") @@ -69,7 +69,7 @@ end local waypointMap = {} function TomTom:SetWaypoint(waypoint, callbacks, show_minimap, show_world) - local m, f, x, y = unpack(waypoint) + local m, x, y = unpack(waypoint) -- Try to acquire a waypoint from the frame pool local point = table.remove(pool) @@ -86,10 +86,14 @@ function TomTom:SetWaypoint(waypoint, callbacks, show_minimap, show_world) table.insert(all_points, minimap) minimap.icon = minimap:CreateTexture("BACKGROUND") - minimap.icon:SetTexture("Interface\\AddOns\\TomTom\\Images\\GoldGreenDot") + if waypoint.minimap_icon then + minimap.icon:SetTexture(waypoint.minimap_icon) + else + minimap.icon:SetTexture("Interface\\AddOns\\TomTom\\Images\\GoldGreenDot") + end minimap.icon:SetPoint("CENTER", 0, 0) - minimap.icon:SetHeight(12) - minimap.icon:SetWidth(12) + minimap.icon:SetHeight(16) + minimap.icon:SetWidth(16) minimap.arrow = minimap:CreateTexture("BACKGROUND") minimap.arrow:SetTexture("Interface\\AddOns\\TomTom\\Images\\MinimapArrow-Green") @@ -107,19 +111,24 @@ function TomTom:SetWaypoint(waypoint, callbacks, show_minimap, show_world) minimap:SetScript("OnEvent", Minimap_OnEvent) if not TomTomMapOverlay then - local overlay = CreateFrame("Frame", "TomTomMapOverlay", WorldMapButton) + local overlay = CreateFrame("Frame", "TomTomMapOverlay", WorldMapFrame) + overlay:SetFrameStrata("HIGH") + overlay:SetFrameLevel(10) overlay:SetAllPoints(true) end local worldmap = CreateFrame("Button", nil, TomTomMapOverlay) - worldmap:SetHeight(12) - worldmap:SetWidth(12) + worldmap:SetHeight(16) + worldmap:SetWidth(16) worldmap:RegisterForClicks("RightButtonUp") worldmap.icon = worldmap:CreateTexture("ARTWORK") worldmap.icon:SetAllPoints() - worldmap.icon:SetTexture("Interface\\AddOns\\TomTom\\Images\\GoldGreenDot") - - worldmap:RegisterEvent("WORLD_MAP_UPDATE") + if waypoint.worldmap_icon then + worldmap.icon:SetTexture(waypoint.worldmap_icon) + else + worldmap.icon:SetTexture("Interface\\AddOns\\TomTom\\Images\\GoldGreenDot") + end + worldmap:RegisterEvent("NEW_WMO_CHUNK") worldmap:SetScript("OnEnter", World_OnEnter) worldmap:SetScript("OnLeave", World_OnLeave) worldmap:SetScript("OnClick", World_OnClick) @@ -131,7 +140,6 @@ function TomTom:SetWaypoint(waypoint, callbacks, show_minimap, show_world) waypointMap[waypoint] = point point.m = m - point.f = f point.x = x point.y = y point.show_world = show_world @@ -161,10 +169,10 @@ function TomTom:SetWaypoint(waypoint, callbacks, show_minimap, show_world) point.uid = waypoint -- Place the waypoint - hbdp:AddMinimapIconMF(self, point.minimap, m, f, x, y, true) + hbdp:AddMinimapIconMap(self, point.minimap, m, x, y, true) if show_world then - hbdp:AddWorldMapIconMF(self, point.worldmap, m, f, x, y) + hbdp:AddWorldMapIconMap(self, point.worldmap, m, x, y) else point.worldmap.disabled = true end @@ -407,7 +415,7 @@ do if event == "PLAYER_ENTERING_WORLD" then local data = self.point if data and data.uid and waypointMap[data.uid] then - hbdp:AddMinimapIconMF(TomTom, self, data.m, data.f, data.x, data.y, true) + hbdp:AddMinimapIconMap(TomTom, self, data.m, data.x, data.y, true) end end end -- 1.7.9.5