options.lua 12 KB
Newer Older
1
local MER, E, L, V, P, G = unpack(select(2, ...))
Merathilis's avatar
Merathilis committed
2
local LP = MER:GetModule("LocPanel")
Merathilis's avatar
Merathilis committed
3 4

--Cache global variables
Merathilis's avatar
Merathilis committed
5
--Lua functions
Merathilis's avatar
Merathilis committed
6
local format = string.format
7
local tinsert = table.insert
Merathilis's avatar
Merathilis committed
8 9 10 11
local strsplit = strsplit
local match = string.match
local tconcat = table.concat
local tremove = table.remove
Merathilis's avatar
Merathilis committed
12
--WoW API / Variables
Merathilis's avatar
Merathilis committed
13
local CLASS, CUSTOM, DEFAULT = CLASS, CUSTOM, DEFAULT
Merathilis's avatar
Merathilis committed
14
-- GLOBALS: AceGUIWidgetLSMlists
15

Merathilis's avatar
Merathilis committed
16
local function LocPanelTable()
Merathilis's avatar
Merathilis committed
17
	E.Options.args.mui.args.modules.args.locPanel = {
18
		type = "group",
Merathilis's avatar
Merathilis committed
19
		name = L["Location Panel"],
20 21 22 23 24
		order = 16,
		get = function(info) return E.db.mui.locPanel[ info[#info] ] end,
		args = {
			name = {
				order = 1,
Merathilis's avatar
Merathilis committed
25
				type = "header",
Merathilis's avatar
Merathilis committed
26
				name = MER:cOption(L["Location Panel"]),
27 28 29
			},
			credits = {
				order = 2,
Merathilis's avatar
Merathilis committed
30 31
				type = "group",
				name = MER:cOption(L["Credits"]),
32 33 34 35
				guiInline = true,
				args = {
					tukui = {
						order = 1,
Merathilis's avatar
Merathilis committed
36 37
						type = "description",
						fontSize = "medium",
Repooc's avatar
Repooc committed
38
						name = format("|cff9482c9Shadow & Light - Darth & Repooc|r"),
39 40 41 42 43 44
					},
				},
			},
			panel = {
				order = 3,
				type = "group",
Merathilis's avatar
Merathilis committed
45
				name = MER:cOption(L["Location Panel"]),
46 47 48 49 50 51 52 53
				guiInline = true,
				args = {
					enable = {
						type = "toggle",
						name = L["Enable"],
						order = 1,
						set = function(info, value) E.db.mui.locPanel[ info[#info] ] = value; LP:Toggle() end,
					},
54
					linkcoords = {
55
						type = "toggle",
56 57 58
						name = L["Link Position"],
						desc = L["Allow pasting of your coordinates in chat editbox via holding shift and clicking on the location name."],
						order = 2,
59 60
						disabled = function() return not E.db.mui.locPanel.enable end,
						hidden = function() return not E.db.mui.locPanel.enable end,
61
						set = function(info, value) E.db.mui.locPanel[ info[#info] ] = value; end,
62 63
					},
					template = {
64
						order = 3,
65 66 67
						name = L["Template"],
						type = "select",
						disabled = function() return not E.db.mui.locPanel.enable end,
68
						hidden = function() return not E.db.mui.locPanel.enable end,
69 70 71 72
						set = function(info, value) E.db.mui.locPanel[ info[#info] ] = value; LP:Template() end,
						values = {
							["Default"] = DEFAULT,
							["Transparent"] = L["Transparent"],
73
							["NoBackdrop"] = L["NoBackdrop"],
74 75
						},
					},
76 77 78 79 80
					autowidth = {
						type = "toggle",
						name = L["Auto Width"],
						desc = L["Change width based on the zone name length."],
						order = 4,
81 82
						disabled = function() return not E.db.mui.locPanel.enable end,
						hidden = function() return not E.db.mui.locPanel.enable end,
Merathilis's avatar
Merathilis committed
83
						set = function(info, value) E.db.mui.locPanel[ info[#info] ] = value; LP:Resize() end,
84 85 86
					},
					width = {
						order = 5,
Merathilis's avatar
Merathilis committed
87
						type = "range",
88 89
						name = L["Width"],
						min = 100, max = E.screenwidth/2, step = 1,
90 91
						disabled = function() return not E.db.mui.locPanel.enable or E.db.mui.locPanel.autowidth end,
						hidden = function() return not E.db.mui.locPanel.enable end,
Merathilis's avatar
Merathilis committed
92
						set = function(info, value) E.db.mui.locPanel[ info[#info] ] = value; LP:Resize() end,
93 94
					},
					height = {
95
						order = 6,
Merathilis's avatar
Merathilis committed
96
						type = "range",
97 98
						name = L["Height"],
						min = 10, max = 50, step = 1,
Merathilis's avatar
Merathilis committed
99
						disabled = function() return not E.db.mui.locPanel.enable end,
100
						hidden = function() return not E.db.mui.locPanel.enable end,
Merathilis's avatar
Merathilis committed
101
						set = function(info, value) E.db.mui.locPanel[ info[#info] ] = value; LP:Resize() end,
102 103 104
					},
					throttle = {
						order = 7,
Merathilis's avatar
Merathilis committed
105
						type = "range",
106 107 108
						name = L["Update Throttle"],
						desc = L["The frequency of coordinates and zonetext updates. Check will be done more often with lower values."],
						min = 0.1, max = 2, step = 0.1,
Merathilis's avatar
Merathilis committed
109
						disabled = function() return not E.db.mui.locPanel.enable end,
110
						hidden = function() return not E.db.mui.locPanel.enable end,
111 112
						set = function(info, value) E.db.mui.locPanel[ info[#info] ] = value; end,
					},
113
					combathide = {
114
						order = 8,
115
						type = "toggle",
116 117 118
						name = L["Hide In Combat"],
						disabled = function() return not E.db.mui.locPanel.enable end,
						hidden = function() return not E.db.mui.locPanel.enable end,
Merathilis's avatar
Merathilis committed
119
						set = function(info, value) E.db.mui.locPanel[ info[#info] ] = value; end,
120
					},
121 122 123 124 125
					orderhallhide = {
						order = 9,
						type = "toggle",
						name = L["Hide In Class Hall"],
						set = function(info, value) E.db.mui.locPanel[ info[#info] ] = value; LP:Toggle() end,
126 127
						disabled = function() return not E.db.mui.locPanel.enable end,
						hidden = function() return not E.db.mui.locPanel.enable end,
128
					},
129 130 131 132
					location = {
						order = 20,
						type = "group",
						name = L["Location"],
133
						hidden = function() return not E.db.mui.locPanel.enable end,
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
						args = {
							zoneText = {
								type = "toggle",
								name = L["Full Location"],
								order = 1,
								disabled = function() return not  E.db.mui.locPanel.enable end,
								set = function(info, value) E.db.mui.locPanel[ info[#info] ] = value; end,
							},
							colorType = {
								order = 2,
								name = L["Color Type"],
								type = "select",
								disabled = function() return not E.db.mui.locPanel.enable end,
								set = function(info, value) E.db.mui.locPanel[ info[#info] ] = value; end,
								values = {
									["REACTION"] = L["Reaction"],
									["DEFAULT"] = DEFAULT,
									["CLASS"] = CLASS,
									["CUSTOM"] = CUSTOM,
								},
							},
							customColor = {
Merathilis's avatar
Merathilis committed
156
								type = "color",
157 158 159 160 161 162 163 164 165 166 167 168 169 170
								order = 3,
								name = L["Custom Color"],
								disabled = function() return not E.db.mui.locPanel.enable or not E.db.mui.locPanel.colorType == "CUSTOM" end,
								get = function(info)
									local t = E.db.mui.locPanel[ info[#info] ]
									local d = P.mui.locPanel[info[#info]]
									return t.r, t.g, t.b, d.r, d.g, d.b
								end,
								set = function(info, r, g, b)
									E.db.mui.locPanel[ info[#info] ] = {}
									local t = E.db.mui.locPanel[ info[#info] ]
									t.r, t.g, t.b = r, g, b
								end,
							},
171 172
						},
					},
173 174 175 176
					coordinates = {
						order = 21,
						type = "group",
						name = L["Coordinates"],
177
						hidden = function() return not E.db.mui.locPanel.enable end,
178 179 180 181 182
						args = {
							format = {
								order = 1,
								name = L["Format"],
								type = "select",
183
								disabled = function() return not E.db.mui.locPanel.enable or E.db.mui.locPanel.coordshide end,
184 185 186 187 188 189 190 191 192 193 194
								set = function(info, value) E.db.mui.locPanel[ info[#info] ] = value; end,
								values = {
									["%.0f"] = DEFAULT,
									["%.1f"] = "45.3",
									["%.2f"] = "45.34",
								},
							},
							colorType_Coords = {
								order = 2,
								name = L["Color Type"],
								type = "select",
195
								disabled = function() return not E.db.mui.locPanel.enable or E.db.mui.locPanel.coordshide end,
196 197 198 199 200 201 202 203 204
								set = function(info, value) E.db.mui.locPanel[ info[#info] ] = value; end,
								values = {
									["REACTION"] = L["Reaction"],
									["DEFAULT"] = DEFAULT,
									["CLASS"] = CLASS,
									["CUSTOM"] = CUSTOM,
								},
							},
							customColor_Coords = {
Merathilis's avatar
Merathilis committed
205
								type = "color",
206 207
								order = 3,
								name = L["Custom Color"],
208
								disabled = function() return not E.db.mui.locPanel.enable or not E.db.mui.locPanel.colorType_Coords == "CUSTOM" or E.db.mui.locPanel.coordshide end,
209 210 211 212 213 214
								get = function(info)
									local t = E.db.mui.locPanel[ info[#info] ]
									local d = P.mui.locPanel[info[#info]]
									return t.r, t.g, t.b, d.r, d.g, d.b
								end,
								set = function(info, r, g, b)
Merathilis's avatar
Merathilis committed
215
									E.db.mui.minimap.locPanel[ info[#info] ] = {}
216 217 218 219
									local t = E.db.mui.locPanel[ info[#info] ]
									t.r, t.g, t.b = r, g, b
								end,
							},
220 221 222 223 224 225 226 227
							coordshide = {
								type = "toggle",
								order = 4,
								name = L["Hide Coordinates"],
								get = function(info) return E.db.mui.locPanel[ info[#info] ] end,
								set = function(info, value) E.db.mui.locPanel[ info[#info] ] = value; end,
								disabled = function() return not E.db.mui.locPanel.enable or not E.db.mui.locPanel.template == "NoBackdrop" end,
							},
228
						},
229 230
					},
					portals = {
231
						order = 22,
232 233 234
						type = "group",
						name = L["Relocation Menu"],
						disabled = function() return not E.db.mui.locPanel.enable end,
235
						hidden = function() return not E.db.mui.locPanel.enable end,
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276
						get = function(info) return E.db.mui.locPanel.portals[ info[#info] ] end,
						set = function(info, value) E.db.mui.locPanel.portals[ info[#info] ] = value; end,
						args = {
							enable = {
								type = "toggle",
								name = L["Enable"],
								desc = L["Right click on the location panel will bring up a menu with available options for relocating your character (e.g. Hearthstones, Portals, etc)."],
								order = 1,
							},
							customWidth = {
								type = "toggle",
								name = L["Custom Width"],
								desc = L["By default menu's width will be equal to the location panel width. Checking this option will allow you to set own width."],
								order = 2,
							},
							customWidthValue = {
								order = 3,
								name = L["Width"],
								type = "range",
								min = 100, max = E.screenwidth, step = 1,
								disabled = function() return not E.db.mui.locPanel.portals.customWidth or not E.db.mui.locPanel.enable end,
							},
							justify = {
								order = 4,
								name = L["Justify Text"],
								type = "select",
								values = {
									["LEFT"] = L["Left"],
									["CENTER"] = L["Middle"],
									["RIGHT"] = L["Right"],
								},
							},
							cdFormat = {
								order = 5,
								name = L["CD format"],
								type = "select",
								values = {
									["DEFAULT"] = [[(10m |TInterface\FriendsFrame\StatusIcon-Away:16|t)]],
									["DEFAULT_ICONFIRST"] = [[( |TInterface\FriendsFrame\StatusIcon-Away:16|t10m)]],
								},
							},
277 278
							HSplace = {
								type = "toggle",
279
								order = 6,
280
								name = L["Hearthstone Location"],
Merathilis's avatar
Merathilis committed
281
								desc = L["Show the name on location your Hearthstone is bound to."],
282
							},
283 284 285 286 287 288
							showHearthstones = {
								type = "toggle",
								order = 7,
								name = L["Show hearthstones"],
								desc = L["Show hearthstone type items in the list."],
							},
Merathilis's avatar
Merathilis committed
289
							hsProprity = MER:CreateMovableButtons(22, L["Hearthstone Toys Order"], false, E.db.mui.locPanel.portals, "hsPrio"),
290 291
							showToys = {
								type = "toggle",
Merathilis's avatar
Merathilis committed
292
								order = 20,
293 294 295 296 297
								name = L["Show Toys"],
								desc = L["Show toys in the list. This option will affect all other display options as well."],
							},
							showSpells = {
								type = "toggle",
Merathilis's avatar
Merathilis committed
298
								order = 30,
299 300 301 302 303
								name = L["Show spells"],
								desc = L["Show relocation spells in the list."],
							},
							showEngineer = {
								type = "toggle",
Merathilis's avatar
Merathilis committed
304
								order = 40,
305 306 307 308 309
								name = L["Show engineer gadgets"],
								desc = L["Show items used only by engineers when the profession is learned."],
							},
							ignoreMissingInfo = {
								type = "toggle",
Merathilis's avatar
Merathilis committed
310
								order = 50,
311
								name = L["Ignore missing info"],
312
								desc = L["MER_LOCPANEL_IGNOREMISSINGINFO"],
313
							},
314 315 316
						},
					},
					fontGroup = {
317
						order = 23,
318 319 320
						type = "group",
						name = L["Fonts"],
						disabled = function() return not E.db.mui.locPanel.enable end,
321
						hidden = function() return not E.db.mui.locPanel.enable end,
322 323 324 325
						get = function(info) return E.db.mui.locPanel[ info[#info] ] end,
						set = function(info, value) E.db.mui.locPanel[ info[#info] ] = value; LP:Fonts() end,
						args = {
							font = {
Merathilis's avatar
Merathilis committed
326
								type = "select", dialogControl = "LSM30_Font",
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343
								order = 1,
								name = L["Font"],
								values = AceGUIWidgetLSMlists.font,
							},
							fontSize = {
								order = 2,
								name = L["Font Size"],
								type = "range",
								min = 6, max = 22, step = 1,
								set = function(info, value) E.db.mui.locPanel[ info[#info] ] = value; LP:Fonts(); LP:Resize() end,
							},
							fontOutline = {
								order = 3,
								name = L["Font Outline"],
								type = "select",
								values = {
									["NONE"] = L["None"],
Merathilis's avatar
Merathilis committed
344 345 346
									["OUTLINE"] = "OUTLINE",
									["MONOCHROMEOUTLINE"] = "MONOCROMEOUTLINE",
									["THICKOUTLINE"] = "THICKOUTLINE",
347 348 349 350 351 352 353 354 355
								},
							},
						},
					},
				},
			},
		},
	}
end
Merathilis's avatar
Merathilis committed
356
tinsert(MER.Config, LocPanelTable)