Quantcast

Added an option to change the world-map click modifier

James Whitehead II [06-01-08 - 21:57]
Added an option to change the world-map click modifier
Filename
TomTom.lua
TomTom_Config.lua
diff --git a/TomTom.lua b/TomTom.lua
index 1e1666f..b69e55f 100755
--- a/TomTom.lua
+++ b/TomTom.lua
@@ -96,6 +96,7 @@ function TomTom:ADDON_LOADED(event, addon)
 					otherzone = true,
 					clickcreate = true,
 					menu = true,
+					create_modifier = "C",
 				},
 				comm = {
 					enable = true,
@@ -272,14 +273,28 @@ end

 -- Hook the WorldMap OnClick
 local Orig_WorldMapButton_OnClick = WorldMapButton_OnClick
+local world_click_verify = {
+	["A"] = function() return IsAltKeyDown() end,
+	["C"] = function() return IsControlKeyDown() end,
+	["S"] = function() return IsShiftKeyDown() end,
+}
+
 function WorldMapButton_OnClick(...)
 	local mouseButton, button = ...
-	if IsControlKeyDown() and mouseButton == "RightButton" then
+	if mouseButton == "RightButton" then
+		-- Check for all the modifiers that are currently set
+		for mod in TomTom.db.profile.worldmap.create_modifier:gmatch("[ACS]") do
+			if not world_click_verify[mod] or not world_click_verify[mod]() then
+				return Orig_WorldMapButton_OnClick(...)
+			end
+		end
+
+		-- Actually try to add a note
 		local c,z = GetCurrentMapContinent(), GetCurrentMapZone()
 		local x,y = GetCurrentCursorPosition()

 		if z == 0 then
-			return
+			return Orig_WorldMapButton_OnClick(...)
 		end

 		local uid = TomTom:AddZWaypoint(c,z,x*100,y*100)
diff --git a/TomTom_Config.lua b/TomTom_Config.lua
index eebe6a9..6868cbe 100644
--- a/TomTom_Config.lua
+++ b/TomTom_Config.lua
@@ -361,8 +361,24 @@ local function createconfig()
 				width = "double",
 				arg = "worldmap.menu",
 			},
-			player = {
+			modifier = {
+				type = "select",
 				order = 7,
+				name = L["Create note modifier"],
+				desc = L["This setting changes the modifier used by TomTom when right-clicking on the world map to create a waypoint"],
+				values = {
+					["A"] = "Alt",
+					["C"] = "Ctrl",
+					["S"] = "Shift",
+					["AC"] = "Alt-Ctrl",
+					["AS"] = "Alt-Shift",
+					["CS"] = "Ctrl-Shift",
+					["ACS"] = "Alt-Ctrl-Shift",
+				},
+				arg = "worldmap.create_modifier",
+			},
+			player = {
+				order = 8,
 				type = "group",
 				inline = true,
 				name = L["Player Coordinates"],
@@ -385,7 +401,7 @@ local function createconfig()
 				},
 			},
 			cursor = {
-				order = 8,
+				order = 9,
 				type = "group",
 				inline = true,
 				name = L["Cursor Coordinates"],