Quantcast

#478: 'Send waypoint to' on arrow.

Ludovicus [10-19-19 - 17:38]
#478: 'Send waypoint to' on arrow.
Filename
TomTom_CrazyArrow.lua
diff --git a/TomTom_CrazyArrow.lua b/TomTom_CrazyArrow.lua
index 769435c..b8d520b 100755
--- a/TomTom_CrazyArrow.lua
+++ b/TomTom_CrazyArrow.lua
@@ -192,6 +192,19 @@ local function OnUpdate(self, elapsed)
 		local angle = TomTom:GetDirectionToWaypoint(active_point)
 		local player = GetPlayerFacing()

+		if not player then
+			if not TomTom:IsValidWaypoint(active_point) then
+				active_point = nil
+				-- Change the crazy arrow to point at the closest waypoint
+				if TomTom.profile.arrow.setclosest then
+					TomTom:SetClosestWaypoint()
+					return
+				end
+			end
+			self:Hide()
+			return
+        end
+
 		angle = angle - player

 		local perc = math.abs((math.pi - math.abs(angle)) / math.pi)
@@ -325,6 +338,12 @@ local dropdown_info = {
 			isTitle = 1,
 		},
 		{
+			-- Send waypoint
+			text = L["Send waypoint to"],
+			hasArrow = true,
+			value = "send",
+		},
+		{
 			-- Clear waypoint from crazy arrow
 			text = L["Clear waypoint from crazy arrow"],
 			func = function()
@@ -373,7 +392,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(self, level)
@@ -406,6 +462,7 @@ end
 local function WayFrame_OnClick(self, button)
 	if active_point then
 		if TomTom.db.profile.arrow.menu then
+			TomTom.dropdown.uid = active_point
 			UIDropDownMenu_Initialize(TomTom.dropdown, init_dropdown)
 			ToggleDropDownMenu(1, nil, TomTom.dropdown, "cursor", 0, 0)
 		end