local E, _, _, P = unpack(ElvUI)
local L = E.Libs.ACL:GetLocale('ElvUI', E.global.general.locale)
local _G = _G
local GetCVar = _G.C_CVar and _G.C_CVar.GetCVar or _G.GetCVar

-- Eltruism map options
function ElvUI_EltreumUI:MapOptions()
	ElvUI_EltreumUI.Options.args.map = E.Libs.ACH:Group(E:TextGradient(L["Maps"], 0.50, 0.70, 1, 0.67, 0.95, 1), E.Retail and L["Add a time to arrive to waypoints, cardinal directions and more"] or L["Add cardinal directions, change map scale and more"], 85, 'tab')
	ElvUI_EltreumUI.Options.args.map.icon = 'Interface\\AddOns\\ElvUI_EltreumUI\\Media\\Icons\\map'
	ElvUI_EltreumUI.Options.args.map.args.general = E.Libs.ACH:Group(L["General"], nil, 1)
	ElvUI_EltreumUI.Options.args.map.args.general.args.description1 = E.Libs.ACH:Description(L["Flight Frame"], 1, nil, 'Interface\\AddOns\\ElvUI_EltreumUI\\Media\\Textures\\EltreumHeader', nil, 3240, 1, "full")
	ElvUI_EltreumUI.Options.args.map.args.general.args.taxiscale = E.Libs.ACH:Range(L["Flight Frame Scale"], nil, 2, { min = 0.1, max = 3, step = 0.01 }, 'double', function() return E.db.ElvUI_EltreumUI.otherstuff.taxiscale end,
		function(_, value)
			E.db.ElvUI_EltreumUI.otherstuff.taxiscale = value
			if _G["TaxiFrame"] then
				_G["TaxiFrame"]:SetScale(value)
			end
			if _G["FlightMapFrame"] then
				_G["FlightMapFrame"]:SetScale(value)
			end
		end)
	ElvUI_EltreumUI.Options.args.map.args.general.args.description2 = E.Libs.ACH:Description(L["WORLD_MAP"], 3, nil, 'Interface\\AddOns\\ElvUI_EltreumUI\\Media\\Textures\\EltreumHeader', nil, 3240, 1, "full")
	ElvUI_EltreumUI.Options.args.map.args.general.args.worldmapscaletoggle = E.Libs.ACH:Toggle(L["Enable World Map Scaling"], nil, 4, nil, false,'full',function() return E.db.ElvUI_EltreumUI.otherstuff.worldmapscale end,function(_, value) E.db.ElvUI_EltreumUI.otherstuff.worldmapscale = value end)
	ElvUI_EltreumUI.Options.args.map.args.general.args.worldmapscale = E.Libs.ACH:Range(L["World Map Scale"], nil, 5, { min = 0.1, max = 3, step = 0.01 }, 'double', function() return E.db.ElvUI_EltreumUI.otherstuff.worldmapscalevalue end,
		function(_, value) E.db.ElvUI_EltreumUI.otherstuff.worldmapscalevalue = value
			if _G["WorldMapFrame"] then
				_G["WorldMapFrame"]:SetScale(value)
			end
		end,function() return not E.db.ElvUI_EltreumUI.otherstuff.worldmapscale end)
	ElvUI_EltreumUI.Options.args.map.args.general.args.description3 = E.Libs.ACH:Description(_G.MINIMAP_LABEL or L["Minimap"], 6, nil, 'Interface\\AddOns\\ElvUI_EltreumUI\\Media\\Textures\\EltreumHeader', nil, 3240, 1, "full")
	ElvUI_EltreumUI.Options.args.map.args.general.args.circleMinimap = E.Libs.ACH:Toggle(L["Circle Minimap"], nil, 7, nil, false,nil,function() return E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.circle end,function(_, value) E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.circle = value E:StaticPopup_Show('CONFIG_RL') end)
	ElvUI_EltreumUI.Options.args.map.args.general.args.RotateMinimap = E.Libs.ACH:Toggle(_G.ROTATE_MINIMAP, nil, 8, nil, false,nil,function() return E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.rotate end,function(_, value) E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.rotate = value E:StaticPopup_Show('CONFIG_RL') end, function() return not E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.circle end)
	ElvUI_EltreumUI.Options.args.map.args.eta = E.Libs.ACH:Group(L["Time to Arrive"], nil, 2, "tab", nil, nil, nil, not E.Retail)
	ElvUI_EltreumUI.Options.args.map.args.eta.args.description1 = E.Libs.ACH:Description(L["Add a time to arrive below the waypoint"], 1, nil, 'Interface\\AddOns\\ElvUI_EltreumUI\\Media\\Textures\\EltreumHeader', nil, 3240, 1, "full")
	ElvUI_EltreumUI.Options.args.map.args.eta.args.description2 = E.Libs.ACH:Description(L["The time will be calculated based on player speed and distance"], 2, nil, nil, nil, nil, nil, "full")
	ElvUI_EltreumUI.Options.args.map.args.eta.args.description3 = E.Libs.ACH:Description(L["If the player is not moving then *** will show up since time cannot be calculated"], 3, nil, nil, nil, nil, nil, "full")
	ElvUI_EltreumUI.Options.args.map.args.eta.args.description4 = E.Libs.ACH:Description(L["If you move away from the waypoint the time will just increase"], 4, nil, nil, nil, nil, nil, "full")
	ElvUI_EltreumUI.Options.args.map.args.eta.args.enable = E.Libs.ACH:Toggle(L["Enable ETA"], L["Add an ETA to waypoints"], 5, nil, false,'full',function() return E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.enable end,function(_, value) E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.enable = value E:StaticPopup_Show('CONFIG_RL') end)
	ElvUI_EltreumUI.Options.args.map.args.eta.args.enableautopin = E.Libs.ACH:Toggle(L["Enable Autopin"], L["Automatically pin the Waypoint"], 6, nil, false,'full',function() return E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.autopin end,function(_, value) E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.autopin = value E:StaticPopup_Show('CONFIG_RL') end, function() return not E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.enable end)
	ElvUI_EltreumUI.Options.args.map.args.eta.args.etaclasscolor = E.Libs.ACH:Toggle(L["Use Class Colors"], nil,7, nil, false,nil, function() return E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.classcolortext end, function(_, value) E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.classcolortext = value E:StaticPopup_Show('CONFIG_RL') end, function() return not E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.enable or not E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.color.enable end)
	ElvUI_EltreumUI.Options.args.map.args.eta.args.etacolor = E.Libs.ACH:Color(L["Text Color"], nil, 8, false, nil, function() return E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.textcolorR, E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.textcolorG, E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.textcolorB, 1, P.ElvUI_EltreumUI.waypoints.waypointetasetting.textcolorR, P.ElvUI_EltreumUI.waypoints.waypointetasetting.textcolorG, P.ElvUI_EltreumUI.waypoints.waypointetasetting.textcolorB, 1 end, function(_, r, g, b) E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.textcolorR, E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.textcolorG, E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.textcolorB = r, g, b E:StaticPopup_Show('CONFIG_RL') end, function() return not E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.enable or E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.classcolortext end)
	ElvUI_EltreumUI.Options.args.map.args.eta.args.enablelimit = E.Libs.ACH:Toggle(L["Limit Max Distance"], L["Add an ETA to waypoints"], 9, nil, false,'full',function() return E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.limitmaxdistance end,function(_, value) E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.limitmaxdistance = value E:StaticPopup_Show('CONFIG_RL') end, function() return not E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.enable end)
	ElvUI_EltreumUI.Options.args.map.args.eta.args.limitmaxdistance = E.Libs.ACH:Range(L["Max Distance"], nil, 10, { min = 200, max = 10000, step = 10 }, 'double', function() return E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.distance end, function(_, value) E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.distance = value end, function() return not E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.limitmaxdistance or not E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.enable end)
	ElvUI_EltreumUI.Options.args.map.args.eta.args.description5 = E.Libs.ACH:Description(L["Change Texture Color"], 11, nil, 'Interface\\AddOns\\ElvUI_EltreumUI\\Media\\Textures\\EltreumHeader', nil, 3240, 1, "full")
	ElvUI_EltreumUI.Options.args.map.args.eta.args.color = E.Libs.ACH:Toggle(L["Enable"], nil, 12, nil, false,'full',function() return E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.color.enable end,function(_, value) E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.color.enable = value ElvUI_EltreumUI:UpdateSuperTrackedColor() end, function() return not E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.enable end)
	ElvUI_EltreumUI.Options.args.map.args.eta.args.classcolor = E.Libs.ACH:Toggle(L["Use Class Colors"], nil, 13, nil, false,nil,function() return E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.color.classcolor end,function(_, value) E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.color.classcolor = value ElvUI_EltreumUI:UpdateSuperTrackedColor() end, function() return not E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.enable or not E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.color.enable end)
	ElvUI_EltreumUI.Options.args.map.args.eta.args.customcolor = E.Libs.ACH:Color(L["Custom Color"], nil, 14, false, nil, function() return E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.color.r, E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.color.g, E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.color.b, 1 end, function(_, r, g, b) E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.color.r, E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.color.g, E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.color.b = r, g, b ElvUI_EltreumUI:UpdateSuperTrackedColor() end, function() return E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.color.classcolor or not E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.enable or not E.db.ElvUI_EltreumUI.waypoints.waypointetasetting.color.enable end)
	ElvUI_EltreumUI.Options.args.map.args.waytext = E.Libs.ACH:Group(L["Chat Command"], nil, 3, "tab", nil, nil, nil, not E.Retail)
	ElvUI_EltreumUI.Options.args.map.args.waytext.args.description1 = E.Libs.ACH:Description(L["Enable the /way and /waypoint commands"], 1, nil, 'Interface\\AddOns\\ElvUI_EltreumUI\\Media\\Textures\\EltreumHeader', nil, 3240, 1, "full")
	ElvUI_EltreumUI.Options.args.map.args.waytext.args.description2 = E.Libs.ACH:Description(L["You can type /way or /waypoint"], 2)
	ElvUI_EltreumUI.Options.args.map.args.waytext.args.description3 = E.Libs.ACH:Description(L["Use formats such as:"], 3)
	ElvUI_EltreumUI.Options.args.map.args.waytext.args.description4 = E.Libs.ACH:Description(L["XX YY, XX.XX YY.YY, XX,XX YY,YY and XXX YYY"], 4)
	ElvUI_EltreumUI.Options.args.map.args.waytext.args.description5 = E.Libs.ACH:Description(L["Other Formats can end up causing errors"], 5)
	ElvUI_EltreumUI.Options.args.map.args.waytext.args.enable = E.Libs.ACH:Toggle(L["Enable"], L["Enable the /way and /waypoint commands"], 6, nil, false,'full',function() return E.db.ElvUI_EltreumUI.waypoints.waytext.enable end,function(_, value) E.db.ElvUI_EltreumUI.waypoints.waytext.enable = value end)
	ElvUI_EltreumUI.Options.args.map.args.cardinal = E.Libs.ACH:Group(L["Cardinal Directions"], nil, 3)
	ElvUI_EltreumUI.Options.args.map.args.cardinal.args.description1 = E.Libs.ACH:Description(L["Minimap Cardinal Directions"], 1, nil, 'Interface\\AddOns\\ElvUI_EltreumUI\\Media\\Textures\\EltreumHeader', nil, 3240, 1, "full")
	ElvUI_EltreumUI.Options.args.map.args.cardinal.args.enable = E.Libs.ACH:Toggle(L["Enable Cardinal Directions"], L["Add North, East, South, West to Minimap"], 2, nil, false,'full',function() return E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.enable end,function(_, value) E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.enable = value ElvUI_EltreumUI:MinimapCardinalDirections() end)
	ElvUI_EltreumUI.Options.args.map.args.cardinal.args.cardinaloffset = E.Libs.ACH:Range(L["Cardinal Text Offset"], nil, 3, { min = -100, max = 100, step = 1 }, 'full', function() return E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.offset end, function(_, value) E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.offset = value ElvUI_EltreumUI:MinimapCardinalDirections() end, function() return not E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.enable end)
	ElvUI_EltreumUI.Options.args.map.args.cardinal.args.description2 = E.Libs.ACH:Description(" ", 4, nil, nil, nil, nil, nil, "full")
	ElvUI_EltreumUI.Options.args.map.args.cardinal.args.fontsize = E.Libs.ACH:Range(L["Font Size"], nil, 5, { min = 4, max = 64, step = 1 }, 'full', function() return E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.fontsize end, function(_, value) E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.fontsize = value ElvUI_EltreumUI:MinimapCardinalDirections() end, function() return GetCVar("rotateMinimap") == "1" or not E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.enable end)
	ElvUI_EltreumUI.Options.args.map.args.cardinal.args.description3 = E.Libs.ACH:Description(" ", 6, nil, nil, nil, nil, nil, "full")
	ElvUI_EltreumUI.Options.args.map.args.cardinal.args.classcolor = E.Libs.ACH:Toggle(L["Use Class Colors"], nil, 7, nil, false,nil,function() return E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.colors.classcolor end,function(_, value) E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.colors.classcolor = value ElvUI_EltreumUI:MinimapCardinalDirections() end, function() return not E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.enable end)
	ElvUI_EltreumUI.Options.args.map.args.cardinal.args.customcolor = E.Libs.ACH:Color(L["Custom Color"], nil, 8, false, nil, function() return E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.colors.r, E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.colors.g, E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.colors.b, 1 end, function(_, r, g, b) E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.colors.r, E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.colors.g, E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.colors.b = r, g, b ElvUI_EltreumUI:MinimapCardinalDirections() end, function() return not E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.enable or E.db.ElvUI_EltreumUI.otherstuff.minimapcardinaldirections.colors.classcolor end)
	ElvUI_EltreumUI.Options.args.map.args.combathide = E.Libs.ACH:Group(L["Combat Hide"], nil, 3)
	ElvUI_EltreumUI.Options.args.map.args.combathide.args.description1 = E.Libs.ACH:Description(L["Minimap"], 1, nil, 'Interface\\AddOns\\ElvUI_EltreumUI\\Media\\Textures\\EltreumHeader', nil, 3240, 1, "full")
	ElvUI_EltreumUI.Options.args.map.args.combathide.args.description2 = E.Libs.ACH:Description(L["Hide Minimap while in Combat"], 2, nil, nil, nil, nil, nil, "full")
	ElvUI_EltreumUI.Options.args.map.args.combathide.args.enable = E.Libs.ACH:Toggle(L["Enable"], L["Automatically hide the Minimap in combat"], 3, nil, false,'full',function() return E.db.ElvUI_EltreumUI.otherstuff.mapcombathide end,function(_, value) E.db.ElvUI_EltreumUI.otherstuff.mapcombathide = value E:StaticPopup_Show('CONFIG_RL') end)
	ElvUI_EltreumUI.Options.args.map.args.combathide.args.enableauras = E.Libs.ACH:Toggle(L["Adjust Auras Position"], L["Automatically move auras to the Top Right when minimap is hidden"], 4, nil, false,'full',function() return E.db.ElvUI_EltreumUI.otherstuff.mapcombathideadjustaura end,function(_, value) E.db.ElvUI_EltreumUI.otherstuff.mapcombathideadjustaura = value E:StaticPopup_Show('CONFIG_RL') end, function() return not E.db.ElvUI_EltreumUI.otherstuff.mapcombathide end)
end
