Files
ClassicAPI/AddOns/!!!ClassicAPI/Util/UiMapPoint.lua
T
Brues 622882725f feat(map): C_Map user waypoint (Tier 3)
Add the eight user-waypoint calls and USER_WAYPOINT_UPDATED: set, get,
has, clear, per-map position, the two hyperlink converters, and the
can-set check.

The pin is one piece of session state (a uiMapID, a 0..1 position and an
optional z) that survives a UI reload. GetUserWaypointPositionForMap
re-projects it onto any other map through world coordinates, so a zone
pin resolves on its continent and back. The hyperlink is the standard
worldmap:uiMapID:x:y payload with both coordinates scaled by 10000, and
the parser accepts a whole link or the bare payload.

UiMapPoint's factories go in the addon, matching where retail ships them.
Extract the shared vector2 marshalling to map/Vector2.h so the waypoint
and coordinate modules don't each carry a copy.
2026-09-04 20:46:22 -05:00

19 lines
710 B
Lua

-- Backport of retail's Blizzard_ObjectAPI/UiMapPoint.lua. A UiMapPoint is the
-- plain struct the C_Map waypoint calls take and return:
-- { uiMapID = number, position = Vector2DMixin, z = number? }
local CreateVector2D = CreateVector2D
UiMapPoint = {};
function UiMapPoint.CreateFromCoordinates(uiMapID, x, y, z)
return { uiMapID = uiMapID, position = CreateVector2D(x, y), z = z };
end
function UiMapPoint.CreateFromVector2D(uiMapID, position, z)
return { uiMapID = uiMapID, position = CreateVector2D(position.x, position.y), z = z };
end
function UiMapPoint.CreateFromVector3D(uiMapID, position)
return { uiMapID = uiMapID, position = CreateVector2D(position.x, position.y), z = position.z };
end