-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathWaypoint.lua
More file actions
32 lines (27 loc) · 905 Bytes
/
Copy pathWaypoint.lua
File metadata and controls
32 lines (27 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
local addonName, wt = ...
local function getTomTom()
local tomtom = _G.TomTom
if tomtom and tomtom.AddWaypoint then return tomtom end
end
function wt.npcUiMapId(npcInfo)
if not npcInfo or not npcInfo.zone then return nil end
if npcInfo.x == nil or npcInfo.y == nil then return nil end
return wt.zoneUiMapIds and wt.zoneUiMapIds[npcInfo.zone]
end
function wt.canSetWaypoint(npcInfo)
return getTomTom() ~= nil and wt.npcUiMapId(npcInfo) ~= nil
end
function wt.setWaypoint(npcInfo)
local tomtom = getTomTom()
local uiMapId = wt.npcUiMapId(npcInfo)
if not tomtom or not uiMapId then return false end
tomtom:AddWaypoint(uiMapId, npcInfo.x / 100, npcInfo.y / 100, {
title = npcInfo.masterName or npcInfo.name,
from = addonName,
persistent = false,
minimap = true,
world = true,
crazy = true
})
return true
end