-
Notifications
You must be signed in to change notification settings - Fork 2
/
Config.lua
183 lines (170 loc) · 5.3 KB
/
Config.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
--[[
Copyright (c) 2009-2018, Hendrik "Nevcairiel" Leppkes < [email protected] >
All rights reserved.
]]
local Mapster = LibStub("AceAddon-3.0"):GetAddon("Mapster")
local L = LibStub("AceLocale-3.0"):GetLocale("Mapster")
local optGetter, optSetter
do
function optGetter(info)
local key = info[#info]
return Mapster.db.profile[key]
end
function optSetter(info, value)
local key = info[#info]
Mapster.db.profile[key] = value
Mapster:Refresh()
end
end
local options, moduleOptions = nil, {}
local function getOptions()
if not options then
options = {
type = "group",
name = "Mapster",
args = {
general = {
order = 1,
type = "group",
name = "General Settings",
get = optGetter,
set = optSetter,
args = {
intro = {
order = 1,
type = "description",
name = L["Mapster allows you to control various aspects of your World Map. You can change the style of the map, control the plugins that extend the map with new functionality, and configure different profiles for every of your characters."],
},
alphadesc = {
order = 2,
type = "description",
name = L["You can change the transparency of the world map to allow you to continue seeing the world environment while your map is open for navigation."],
},
fade = {
order = 2.2,
type = "toggle",
name = MAP_FADE_TEXT,
desc = L["The map will fade out to the configured Fade Alpha level when you start moving."],
get = function() return GetCVarBool("mapFade") end,
set = function(_, v) v = v and 1 or 0; SetCVar("mapFade", v); Mapster:Refresh(); end,
width = "full",
},
alpha = {
order = 3,
name = L["Alpha"],
desc = L["The transparency of the big map."],
type = "range",
min = 0, max = 1, bigStep = 0.01,
isPercent = true,
},
fadealpha = {
order = 4.1,
type = "range",
name = L["Faded Alpha"],
desc = L["The transparency of the map while you are moving and the map is faded."],
min = 0, max = 1, bigStep = 0.01,
isPercent = true,
disabled = function() return not GetCVarBool("mapFade") end,
},
scaledesc = {
order = 5.1,
type = "description",
name = L["Change the scale of the world map if you do not want the whole screen filled while the map is open."],
},
scale = {
order = 6,
name = L["Scale"],
desc = L["Scale of the big map."],
type = "range",
min = 0.1, max = 2, bigStep = 0.01,
isPercent = true,
},
nl_scale = {
order = 6.1,
type = "description",
name = "",
},
arrowScale = {
order = 7,
name = L["PlayerArrow Scale"],
desc = L["Adjust the size of the Player Arrow on the Map for better visibility."],
type = "range",
min = 0.5, max = 2, bigStep = 0.01,
isPercent = true,
},
nl = {
order = 10,
type = "description",
name = "",
},
poiScale = {
order = 12,
type = "range",
name = L["Quest POI Scale"],
desc = L["Scale of the Quest POI Icons on the Map."],
min = 0.1, max = 2, bigStep = 0.01,
isPercent = true,
},
ejScale = {
order = 13,
type = "range",
name = L["EJ Icon Scale"],
desc = L["Scale of the Encounter Journal Icons on the Map."],
min = 0.1, max = 2, bigStep = 0.01,
isPercent = true,
},
nl2 = {
order = 20,
type = "description",
name = "",
},
hideMapButton = {
order = 21,
type = "toggle",
name = L["Hide Map Button"],
},
disableMouse = {
order = 22,
type = "toggle",
name = L["Disable Mouse"],
desc = L["Disable the mouse interactivity of the main map, eg. to change zones."],
},
},
},
},
}
for k,v in pairs(moduleOptions) do
options.args[k] = (type(v) == "function") and v() or v
end
end
return options
end
local function optFunc()
Settings.OpenToCategory("Mapster")
end
function Mapster:SetupOptions()
-- setup options table
LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable("Mapster", getOptions)
LibStub("AceConfigDialog-3.0"):AddToBlizOptions("Mapster", nil, nil, "general")
self:RegisterModuleOptions("Profiles", LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db), "Profiles")
LibStub("AceConsole-3.0"):RegisterChatCommand( "mapster", optFunc)
end
function Mapster:RegisterModuleOptions(name, optionTbl, displayName)
moduleOptions[name] = optionTbl
LibStub("AceConfigDialog-3.0"):AddToBlizOptions("Mapster", displayName, "Mapster", name)
end
function Mapster:SetupMapButton()
-- create button on the worldmap to toggle the options
self.optionsButton = CreateFrame("Button", "MapsterOptionsButton", WorldMapFrame.BorderFrame.TitleContainer or WorldMapFrame, "UIPanelButtonTemplate")
self.optionsButton:SetWidth(95)
self.optionsButton:SetHeight(18)
self.optionsButton:SetText("Mapster")
self.optionsButton:ClearAllPoints()
self.optionsButton:SetPoint("TOPRIGHT", WorldMapFrame.BorderFrame.TitleContainer, "TOPRIGHT", -48, -1)
if self.db.profile.hideMapButton then
self.optionsButton:Hide()
else
self.optionsButton:Show()
end
self.optionsButton:SetScript("OnClick", optFunc)
end