Quantcast

Add /tway arrow to print arrow status.

Ludovicus [03-14-19 - 20:19]
Add /tway arrow to print arrow status.
Filename
TomTom.lua
TomTom_CrazyArrow.lua
diff --git a/TomTom.lua b/TomTom.lua
index 04be7f9..a34b29a 100755
--- a/TomTom.lua
+++ b/TomTom.lua
@@ -1226,6 +1226,9 @@ SlashCmdList["TOMTOM_WAY"] = function(msg)
     elseif ltoken == "list" then
         TomTom:DebugListAllWaypoints()
         return
+    elseif ltoken == "arrow" then
+        TomTom:DebugCrazyArrow()
+        return
     elseif ltoken == "reset" then
         local ltoken2 = tokens[2] and tokens[2]:lower()
         if ltoken2 == "all" then
diff --git a/TomTom_CrazyArrow.lua b/TomTom_CrazyArrow.lua
index 9f6ba56..40fb8f9 100755
--- a/TomTom_CrazyArrow.lua
+++ b/TomTom_CrazyArrow.lua
@@ -568,3 +568,25 @@ end
 function TomTom:CrazyArrowIsHijacked()
     return wayframe.hijacked
 end
+
+-- Logs Crazy Arrow status
+function TomTom:DebugCrazyArrow()
+    local msg
+    msg = string.format(L["|cffffff78TomTom:|r CrazyArrow %s hijacked"], (wayframe.hijacked and L["is"]) or L["not"])
+    ChatFrame1:AddMessage(msg)
+    msg = string.format(L["|cffffff78TomTom:|r CrazyArrow %s visible"], (wayframe:IsVisible() and L["is"]) or L["not"])
+    ChatFrame1:AddMessage(msg)
+    msg = string.format(L["|cffffff78TomTom:|r Waypoint %s valid"], (active_point and TomTom:IsValidWaypoint(active_point) and L["is"]) or L["not"])
+    ChatFrame1:AddMessage(msg)
+
+    local dist,x,y = TomTom:GetDistanceToWaypoint(active_point)
+    msg = string.format("|cffffff78TomTom:|r Waypoint distance=%s", tostring(dist))
+    ChatFrame1:AddMessage(msg)
+
+    if wayframe:IsVisible() then
+        local point, relativeTo, relativePoint, xOfs, yOfs = wayframe:GetPoint(1)
+        relativeTo = (relativeTo and relativeTo:GetName()) or "UIParent"
+        msg = string.format("|cffffff78TomTom:|r CrazyArrow point=%s frame=%s rpoint=%s xo=%.2f yo=%.2f",  point, relativeTo, relativePoint, xOfs, yOfs)
+        ChatFrame1:AddMessage(msg)
+    end
+end