Fix bugs in SetWaypoint() and add _displayID support. CF#422.
Ludovicus [07-19-19 - 21:29]
Fix bugs in SetWaypoint() and add _displayID support. CF#422.
diff --git a/TomTom_Waypoints.lua b/TomTom_Waypoints.lua
index f535c99..b6fbc46 100755
--- a/TomTom_Waypoints.lua
+++ b/TomTom_Waypoints.lua
@@ -86,10 +86,7 @@ function TomTom:SetWaypoint(waypoint, callbacks, show_minimap, show_world)
table.insert(all_points, minimap)
minimap.icon = minimap:CreateTexture(nil,"OVERLAY")
- minimap.icon:SetTexture(waypoint.minimap_icon or "Interface\\AddOns\\TomTom\\Images\\GoldGreenDot")
minimap.icon:SetPoint("CENTER", 0, 0)
- minimap.icon:SetHeight(waypoint.minimap_icon_size or 16)
- minimap.icon:SetWidth(waypoint.minimap_icon_size or 16)
minimap.icon:SetBlendMode("ADD") -- ADD/BLEND
minimap.arrow = minimap:CreateTexture(nil,"OVERLAY")
@@ -115,13 +112,10 @@ function TomTom:SetWaypoint(waypoint, callbacks, show_minimap, show_world)
end
local worldmap = CreateFrame("Button", nil, TomTomMapOverlay)
- worldmap:SetHeight(waypoint.worldmap_icon_size or 16)
- worldmap:SetWidth(waypoint.worldmap_icon_size or 16)
worldmap:RegisterForClicks("RightButtonUp")
worldmap.icon = worldmap:CreateTexture(nil, "OVERLAY")
worldmap.icon:SetAllPoints()
worldmap.icon:SetBlendMode("BLEND")
- worldmap.icon:SetTexture(waypoint.worldmap_icon or "Interface\\AddOns\\TomTom\\Images\\GoldGreenDot")
worldmap:RegisterEvent("NEW_WMO_CHUNK")
worldmap:SetScript("OnEnter", World_OnEnter)
worldmap:SetScript("OnLeave", World_OnLeave)
@@ -142,6 +136,24 @@ function TomTom:SetWaypoint(waypoint, callbacks, show_minimap, show_world)
point.worldmap.callbacks = callbacks and callbacks.world
point.minimap.callbacks = callbacks and callbacks.minimap
+ -- Set up the minimap.icon
+ if waypoint.minimap_displayID then
+ SetPortraitTextureFromCreatureDisplayID(point.minimap.icon, waypoint.minimap_displayID)
+ else
+ point.minimap.icon:SetTexture(waypoint.minimap_icon or "Interface\\AddOns\\TomTom\\Images\\GoldGreenDot")
+ end
+ point.minimap.icon:SetHeight(waypoint.minimap_icon_size or 16)
+ point.minimap.icon:SetWidth(waypoint.minimap_icon_size or 16)
+
+ -- Set up the worldmap.icon
+ if waypoint.worldmap_displayID then
+ SetPortraitTextureFromCreatureDisplayID(point.worldmap.icon, waypoint.worldmap_displayID)
+ else
+ point.minimap.icon:SetTexture(waypoint.worldmap_icon or "Interface\\AddOns\\TomTom\\Images\\GoldGreenDot")
+ end
+ point.worldmap.icon:SetHeight(waypoint.worldmap_icon_size or 16)
+ point.worldmap.icon:SetWidth(waypoint.worldmap_icon_size or 16)
+
-- Process the callbacks table to put distances in a consumable format
if callbacks and callbacks.distance then
point.dlist = {}