diff --git a/TomTom.lua b/TomTom.lua index 259caf2..e0ec078 100755 --- a/TomTom.lua +++ b/TomTom.lua @@ -4,7 +4,10 @@ -- Simple localization table for messages local L = TomTomLocals -local Astrolabe = DongleStub("Astrolabe-0.4") +local Astrolabe = DongleStub("Astrolabe-0.4-NC") + +-- Speed up minimap updates +Astrolabe.MinimapUpdateTime = 0.1 -- Create the addon object TomTom = { @@ -327,6 +330,12 @@ local dropdown_info = { TomTom:SetCrazyArrow(uid, TomTom.profile.arrow.arrival, data.title or "TomTom waypoint") end, }, + { + -- Send waypoint + text = L["Send waypoint to"], + hasArrow = true, + value = "send", + }, { -- Remove waypoint text = L["Remove waypoint"], func = function() @@ -386,7 +395,44 @@ local dropdown_info = { end end, }, - } + }, + [2] = { + send = { + { + -- Title + text = L["Waypoint communication"], + isTitle = true, + }, + { + -- Party + text = L["Send to party"], + func = function() + TomTom:SendWaypoint(TomTom.dropdown.uid, "PARTY") + end + }, + { + -- Raid + text = L["Send to raid"], + func = function() + TomTom:SendWaypoint(TomTom.dropdown.uid, "RAID") + end + }, + { + -- Battleground + text = L["Send to battleground"], + func = function() + TomTom:SendWaypoint(TomTom.dropdown.uid, "BATTLEGROUND") + end + }, + { + -- Guild + text = L["Send to guild"], + func = function() + TomTom:SendWaypoint(TomTom.dropdown.uid, "GUILD") + end + }, + }, + }, } local function init_dropdown(level) @@ -433,6 +479,26 @@ function TomTom:UIDIsSaved(uid) return false end +function TomTom:SendWaypoint(uid, channel) + local data = waypoints[uid] + local msg = string.format("%s:%d:%s", data.zone, data.coord, data.title or "") + SendAddonMessage("TOMTOM2", msg, channel) +end + +function TomTom:CHAT_MSG_ADDON(event, prefix, data, channel, sender) + if prefix ~= "TOMTOM2" then return end + --if sender == UnitName("player") then return end + + local zone,coord,title = string.split(":", data) + if not title:match("%S") then + title = "Waypoint from " .. sender + end + + local c,z = self:GetCZ(zone) + local x,y = self:GetXY(tonumber(coord)) + self:AddZWaypoint(c, z, x*100, y*100, title) + ChatFrame1:AddMessage("|cffffff78TomTom|r: Added '" .. title .. "' (sent from " .. sender .. ") to zone " .. zone) +end --[[------------------------------------------------------------------- -- Define callback functions diff --git a/TomTom_CrazyArrow.lua b/TomTom_CrazyArrow.lua index eb7cb83..e263768 100644 --- a/TomTom_CrazyArrow.lua +++ b/TomTom_CrazyArrow.lua @@ -6,7 +6,7 @@ -- with the artwork.) ----------------------------------------------------------------------------]] -local Astrolabe = DongleStub("Astrolabe-0.4") +local Astrolabe = DongleStub("Astrolabe-0.4-NC") local sformat = string.format local L = TomTomLocals @@ -27,7 +27,13 @@ function GetPlayerBearing() if not obj then return; end -- If we've found what we were looking for, rewrite function to skip the search next time. - GetPlayerBearing = function() return (obj:GetFacing()); end + GetPlayerBearing = function() + if GetCVar("rotateMinimap") ~= "0" then + return (MiniMapCompassRing:GetFacing() * -1) + else + return obj:GetFacing(); + end + end return GetPlayerBearing(); end @@ -242,17 +248,38 @@ wayframe:SetScript("OnUpdate", OnUpdate) local dropdown_info = { -- Define level one elements here [1] = { - { -- Title + { + -- Title text = L["TomTom Waypoint Arrow"], isTitle = 1, }, - { -- Remove waypoint + { + -- Remove a waypoint text = L["Remove waypoint"], func = function() local uid = active_point TomTom:RemoveWaypoint(uid) end, }, + { + -- Remove all waypoints from this zone + text = L["Remove all waypoints from this zone"], + func = function() + local uid = active_point + local waypoints = TomTom.waypoints + local data = waypoints[uid] + for uid in pairs(waypoints[data.zone]) do + TomTom:RemoveWaypoint(uid) + end + end, + }, + { + -- Remove all waypoints + text = L["Remove all waypoints"], + func = function() + StaticPopup_Show("TOMTOM_REMOVE_ALL_CONFIRM") + end, + }, } } diff --git a/TomTom_Waypoints.lua b/TomTom_Waypoints.lua index abc85f7..5a42eaa 100644 --- a/TomTom_Waypoints.lua +++ b/TomTom_Waypoints.lua @@ -3,7 +3,7 @@ ----------------------------------------------------------------------------]] -- Import Astrolabe for locations -local Astrolabe = DongleStub("Astrolabe-0.4") +local Astrolabe = DongleStub("Astrolabe-0.4-NC") -- Create a tooltip to be used when mousing over waypoints local tooltip = CreateFrame("GameTooltip", "TomTomTooltip", UIParent, "GameTooltipTemplate")