Quantcast

Add a /way list command to list waypoints in zone

James Whitehead II [05-31-11 - 15:51]
Add a /way list command to list waypoints in zone

This is a simple debug command that may be useful, but is not expected
to be useful to the average user.
Filename
TomTom.lua
TomTom_CrazyArrow.lua
diff --git a/TomTom.lua b/TomTom.lua
index a27214c..73a2881 100755
--- a/TomTom.lua
+++ b/TomTom.lua
@@ -1004,12 +1004,31 @@ do
     end
 end

+function TomTom:DebugListWaypoints()
+    local m,f,x,y = self:GetCurrentPlayerPosition()
+    local ctxt = RoundCoords(x, y, 2)
+    local czone = lmd:MapLocalize(m)
+    self:Printf(L["You are at (%s) in '%s' (map: %d, floor: %d)"], ctxt, czone or "UNKNOWN", m, f)
+    if waypoints[m] then
+        for key, wp in pairs(waypoints[m]) do
+            local ctxt = RoundCoords(wp[3], wp[4], 2)
+            local desc = wp.title and wp.title or L["Unknown waypoint"]
+            local indent = "   "
+            self:Printf(L["%s%s - %s (map: %d, floor: %d)"], indent, desc, ctxt, wp[1], wp[2])
+        end
+    else
+        local indent = "   "
+        self:Printf(L["%sNo waypoints in this zone"], indent)
+    end
+end
+
 local function usage()
     ChatFrame1:AddMessage(L["|cffffff78TomTom |r/way |cffffff78Usage:|r"])
     ChatFrame1:AddMessage(L["|cffffff78/way <x> <y> [desc]|r - Adds a waypoint at x,y with descrtiption desc"])
     ChatFrame1:AddMessage(L["|cffffff78/way <zone> <x> <y> [desc]|r - Adds a waypoint at x,y in zone with description desc"])
     ChatFrame1:AddMessage(L["|cffffff78/way reset all|r - Resets all waypoints"])
     ChatFrame1:AddMessage(L["|cffffff78/way reset <zone>|r - Resets all waypoints in zone"])
+    ChatFrame1:AddMessage(L["|cffffff78/way list|r - Lists active waypoints in current zone"])
 end

 function TomTom:GetClosestWaypoint()
@@ -1079,7 +1098,10 @@ SlashCmdList["TOMTOM_WAY"] = function(msg)
     -- Lower the first token
     local ltoken = tokens[1] and tokens[1]:lower()

-    if ltoken == "reset" then
+    if ltoken == "list" then
+        TomTom:DebugListWaypoints()
+        return
+    elseif ltoken == "reset" then
         local ltoken2 = tokens[2] and tokens[2]:lower()
         if ltoken2 == "all" then
             if TomTom.db.profile.general.confirmremoveall then
diff --git a/TomTom_CrazyArrow.lua b/TomTom_CrazyArrow.lua
index 1b1457e..f8b9865 100644
--- a/TomTom_CrazyArrow.lua
+++ b/TomTom_CrazyArrow.lua
@@ -88,7 +88,7 @@ function TomTom:SetCrazyArrow(uid, dist, title)
 	point_title = title

 	if self.profile.arrow.enable then
-		wayframe.title:SetText(title or "Unknown waypoint")
+		wayframe.title:SetText(title or L["Unknown waypoint"])
 		wayframe:Show()
 	end
 end
@@ -445,7 +445,7 @@ local function wayframe_OnEvent(self, event, arg1, ...)

 				local key = column .. ":" .. row
 				feed_crazy.iconCoords = texcoords[key]
-				feed_crazy.text = point_title or "Unknown waypoint"
+				feed_crazy.text = point_title or L["Unknown waypoint"]
 			end)
 		end
 	end