Move marker animation tick to DLL-side OnWorldUpdate hook
- Hook OnWorldUpdate (0x482EA0) for per-frame tick while world is active - Remove Lua OnUpdate animation driver (ProcessMarkerAnimations) - Add DistanceToMark(index) Lua API returning player-to-marker distance - Track marker positions DLL-side for distance queries - Clean up positions on marker clear and world teardown
This commit is contained in:
@@ -14,78 +14,42 @@ frame:SetScript("OnEvent", function()
|
||||
end
|
||||
end)
|
||||
|
||||
-- Per-frame animation driver: queues Hold after Stand finishes on new
|
||||
-- markers and re-queues it periodically so it never falls back to Stand.
|
||||
local animFrame = CreateFrame("Frame")
|
||||
animFrame:SetScript("OnUpdate", function()
|
||||
ProcessMarkerAnimations()
|
||||
end)
|
||||
|
||||
SLASH_MARKERS1 = "/markers"
|
||||
SLASH_MARKERS2 = "/mark"
|
||||
SlashCmdList["MARKERS"] = function(msg)
|
||||
SLASH_WORLDMARKER1 = "/worldmarker"
|
||||
SLASH_WORLDMARKER2 = "/wm"
|
||||
SlashCmdList["WORLDMARKER"] = function(msg)
|
||||
msg = string.lower(msg or "")
|
||||
|
||||
if msg == "" or msg == "help" then
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cff00ff00Markers|r commands:")
|
||||
DEFAULT_CHAT_FRAME:AddMessage(" /mark <1-5> - Place marker at cursor")
|
||||
DEFAULT_CHAT_FRAME:AddMessage(" /mark <1-5> <unit> - Place marker at unit")
|
||||
DEFAULT_CHAT_FRAME:AddMessage(" /mark <1-5> <x> <y> <z> - Place marker at coords")
|
||||
DEFAULT_CHAT_FRAME:AddMessage(" /mark clear [1-5] - Clear one or all markers")
|
||||
DEFAULT_CHAT_FRAME:AddMessage(" /mark pos - Show player position")
|
||||
-- Parse arguments
|
||||
local parts = {}
|
||||
for word in string.gfind(msg, "%S+") do
|
||||
table.insert(parts, word)
|
||||
end
|
||||
|
||||
elseif msg == "clear" then
|
||||
ClearWorldMarker()
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cff00ff00Markers:|r all cleared")
|
||||
|
||||
elseif msg == "pos" or msg == "position" then
|
||||
local x, y, z = GetPlayerPosition()
|
||||
if x then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(string.format("Position: %.2f, %.2f, %.2f", x, y, z))
|
||||
else
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cffff0000No player position available|r")
|
||||
end
|
||||
local index = tonumber(parts[1])
|
||||
if not index then
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cff00ff00World Markers|r commands:")
|
||||
DEFAULT_CHAT_FRAME:AddMessage(" /wm 1-5 - Place marker at cursor")
|
||||
DEFAULT_CHAT_FRAME:AddMessage(" /wm 1-5 <unit> - Place marker at unit")
|
||||
DEFAULT_CHAT_FRAME:AddMessage(" /cwm [1-5] - Clear one or all markers")
|
||||
return
|
||||
end
|
||||
|
||||
if parts[2] then
|
||||
-- /wm 1 target
|
||||
WorldMarker(index, parts[2])
|
||||
else
|
||||
-- Parse arguments
|
||||
local parts = {}
|
||||
for word in string.gfind(msg, "%S+") do
|
||||
table.insert(parts, word)
|
||||
end
|
||||
-- /wm 1 (cursor position)
|
||||
WorldMarker(index)
|
||||
end
|
||||
end
|
||||
|
||||
-- /mark clear <index>
|
||||
if parts[1] == "clear" then
|
||||
local index = tonumber(parts[2])
|
||||
if index then
|
||||
ClearWorldMarker(index)
|
||||
else
|
||||
ClearWorldMarker()
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local index = tonumber(parts[1])
|
||||
if not index then
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cffff0000Usage:|r /mark <1-5> [unit | x y z] or /mark clear")
|
||||
return
|
||||
end
|
||||
|
||||
if tonumber(parts[2]) then
|
||||
-- /mark 1 x y z
|
||||
local x = tonumber(parts[2])
|
||||
local y = tonumber(parts[3])
|
||||
local z = tonumber(parts[4])
|
||||
if x and y and z then
|
||||
WorldMarker(index, x, y, z)
|
||||
else
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cffff0000Usage:|r /mark <1-5> <x> <y> <z>")
|
||||
end
|
||||
elseif parts[2] then
|
||||
-- /mark 1 target
|
||||
WorldMarker(index, parts[2])
|
||||
else
|
||||
-- /mark 1 (cursor position)
|
||||
WorldMarker(index)
|
||||
end
|
||||
SLASH_CLEARWORLDMARKER1 = "/clearworldmarker"
|
||||
SLASH_CLEARWORLDMARKER2 = "/cwm"
|
||||
SlashCmdList["CLEARWORLDMARKER"] = function(msg)
|
||||
local index = tonumber(msg or "")
|
||||
if index then
|
||||
ClearWorldMarker(index)
|
||||
else
|
||||
ClearWorldMarker()
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user