From eb059f6877b68a5e1be6b093ddf09ce4e7c1740d Mon Sep 17 00:00:00 2001 From: James Whitehead II Date: Sat, 5 Apr 2008 12:33:34 +0000 Subject: [PATCH] * Fixed an issue where waypoint would appear out of nowhere when zoning * Fixed the slash command handler so it properly accepts multi word zone names --- TomTom.lua | 21 ++++++++++++++++----- TomTom_CrazyArrow.lua | 2 ++ TomTom_Waypoints.lua | 4 +++- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/TomTom.lua b/TomTom.lua index e0ec078..d62803d 100755 --- a/TomTom.lua +++ b/TomTom.lua @@ -592,10 +592,11 @@ function TomTom:RemoveWaypoint(uid) end end end + -- Remove this entry from the waypoints table waypoints[uid] = nil - if waypoints[zone] then - waypoints[zone][uid] = nil + if data.zone and waypoints[data.zone] then + waypoints[data.zone][uid] = nil end end @@ -809,7 +810,7 @@ SlashCmdList["WAY"] = function(msg) elseif tokens[2] then -- Reset the named zone - local _,zone = unpack(tokens) + local zone = table.concat(tokens, " ", 2) -- Find a fuzzy match for the zone local matches = {} @@ -835,7 +836,6 @@ SlashCmdList["WAY"] = function(msg) return end - local c,z,name = unpack(matches[1]) local zone = TomTom:GetMapFile(c, z) if waypoints[zone] then @@ -847,8 +847,19 @@ SlashCmdList["WAY"] = function(msg) end end elseif tokens[1] and not tonumber(tokens[1]) then + -- Find the first numeric token + local zoneEnd = 1 + for idx,token in ipairs(tokens) do + if tonumber(token) then + zoneEnd = idx - 1 + break + end + end + -- This is a waypoint set, with a zone before the coords - local zone,x,y,desc = unpack(tokens) + local zone = table.concat(tokens, " ", 1, zoneEnd) + local x,y,desc = select(zoneEnd + 1, unpack(tokens)) + if desc then desc = table.concat(tokens, " ", 4) end -- Find a fuzzy match for the zone diff --git a/TomTom_CrazyArrow.lua b/TomTom_CrazyArrow.lua index e263768..e5953aa 100644 --- a/TomTom_CrazyArrow.lua +++ b/TomTom_CrazyArrow.lua @@ -108,6 +108,8 @@ function TomTom:SetCrazyArrow(uid, dist, title) arrive_distance = dist point_title = title + local c,z,x,y = Astrolabe:GetCurrentPlayerPosition() + wayframe.title:SetText(title or "Unknown waypoint") wayframe:Show() end diff --git a/TomTom_Waypoints.lua b/TomTom_Waypoints.lua index 5a42eaa..135dd68 100644 --- a/TomTom_Waypoints.lua +++ b/TomTom_Waypoints.lua @@ -358,7 +358,9 @@ do function Minimap_OnEvent(self, event, ...) if event == "PLAYER_ENTERING_WORLD" then local data = self.point - Astrolabe:PlaceIconOnMinimap(self, data.c, data.z, data.x, data.y) + if data and data.uid and resolveuid(data.uid) then + Astrolabe:PlaceIconOnMinimap(self, data.c, data.z, data.x, data.y) + end end end end -- 1.7.9.5