From 8a84e7f8ee1f34026c283ae81cde62e389d1097f Mon Sep 17 00:00:00 2001 From: James Whitehead II Date: Tue, 1 Jul 2008 09:34:20 +0000 Subject: [PATCH] Added an option to reset the waypoint arrow location, and a toggle for waypoints announcements --- TomTom.lua | 19 +++++++++++++------ TomTom_Config.lua | 23 ++++++++++++++++++++++- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/TomTom.lua b/TomTom.lua index 90bbcc1..f3b9482 100755 --- a/TomTom.lua +++ b/TomTom.lua @@ -52,6 +52,7 @@ function TomTom:ADDON_LOADED(event, addon) profile = { general = { confirmremoveall = true, + announce = false, }, block = { enable = true, @@ -172,7 +173,7 @@ function TomTom:ReloadWaypoints() local coord,title = waypoint:match("^(%d+):(.*)$") if not title:match("%S") then title = nil end local x,y = self:GetXY(coord) - self:AddZWaypoint(c, z, x*100, y*100, title, false, minimap, world) + self:AddZWaypoint(c, z, x*100, y*100, title, false, minimap, world, nil, true) end end end @@ -651,7 +652,7 @@ function TomTom:RemoveWaypoint(uid) end -- TODO: Make this not suck -function TomTom:AddWaypoint(x, y, desc, persistent, minimap, world) +function TomTom:AddWaypoint(x, y, desc, persistent, minimap, world, silent) local c,z = self:GetCurrentCZ() if not c or not z or c < 1 then @@ -659,10 +660,10 @@ function TomTom:AddWaypoint(x, y, desc, persistent, minimap, world) return end - return self:AddZWaypoint(c, z, x, y, desc, persistent, minimap, world) + return self:AddZWaypoint(c, z, x, y, desc, persistent, minimap, world, silent) end -function TomTom:AddZWaypoint(c, z, x, y, desc, persistent, minimap, world, custom_callbacks) +function TomTom:AddZWaypoint(c, z, x, y, desc, persistent, minimap, world, custom_callbacks, silent) local callbacks if custom_callbacks then callbacks = custom_callbacks @@ -732,11 +733,17 @@ function TomTom:AddZWaypoint(c, z, x, y, desc, persistent, minimap, world, custo table.insert(self.waypointprofile[zone], data) end + if not silent and self.profile.general.announce then + local ctxt = RoundCoords(x/100, y/100, 2) + local msg = string.format("|cffffff78TomTom:|r Added a waypoint (%s) in %s", ctxt, zone) + ChatFrame1:AddMessage(msg) + end + return uid end -function TomTom:SetCustomWaypoint(c,z,x,y,callback,minimap,world) - return self:AddZWaypoint(c, z, x, y, desc, false, minimap, world, callback) +function TomTom:SetCustomWaypoint(c,z,x,y,callback,minimap,world, silent) + return self:AddZWaypoint(c, z, x, y, desc, false, minimap, world, callback, silent) end -- Code taken from HandyNotes, thanks Xinhuan diff --git a/TomTom_Config.lua b/TomTom_Config.lua index 6868cbe..66dbb47 100644 --- a/TomTom_Config.lua +++ b/TomTom_Config.lua @@ -199,6 +199,7 @@ local function createconfig() }, scale = { type = "range", + order = 2, name = L["Scale"], desc = L["This setting allows you to change the scale of the waypoint arrow, making it larger or smaller"], min = 0, max = 3, step = 0.05, @@ -206,6 +207,7 @@ local function createconfig() }, alpha = { type = "range", + order = 3, name = L["Alpha"], desc = L["This setting allows you to change the opacity of the waypoint arrow, making it transparent or opaque"], min = 0, max = 1.0, step = 0.05, @@ -213,6 +215,7 @@ local function createconfig() }, title_width = { type = "range", + order = 4, name = L["Title Width"], desc = L["This setting allows you to specify the maximum width of the title text. Any titles that are longer than this width (in game pixels) will be wrapped to the next line."], min = 0, max = 500, step = 1, @@ -220,12 +223,22 @@ local function createconfig() }, title_height = { type = "range", + order = 5, name = L["Title Height"], desc = L["This setting allows you to specify the maximum height of the title text. Any titles that are longer than this height (in game pixels) will be truncated."], min = 0, max = 300, step = 1, arg = "arrow.title_height", }, - + reset_position = { + order = 6, + type = "execute", + name = L["Reset Position"], + desc = L["Resets the position of the waypoint arrow if its been dragged off screen"], + func = function() + TomTomCrazyArrow:ClearAllPoints() + TomTomCrazyArrow:SetPoint("CENTER", UIParent, "CENTER", 0, 0) + end, + }, } }, color = { @@ -450,6 +463,14 @@ local function createconfig() arg = "comm.prompt", }, --]] + announce = { + type = "toggle", + order = 1, + name = L["Announce new waypoints when they are added"], + desc = L["TomTom can announce new waypoints to the default chat frame when they are added"], + width = "double", + arg = "general.announce", + }, confirmremove = { type = "toggle", order = 2, -- 1.7.9.5