-
Notifications
You must be signed in to change notification settings - Fork 14
/
Options.lua
222 lines (198 loc) · 9.18 KB
/
Options.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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
assert(BigWigs, "BigWigs not found!")
------------------------------
-- Are you local? --
------------------------------
local L = AceLibrary("AceLocale-2.2"):new("BigWigsOptions")
local tablet = AceLibrary("Tablet-2.0")
----------------------------
-- Localization --
----------------------------
L:RegisterTranslations("enUS", function() return {
["|cff00ff00Module running|r"] = true,
["|cffeda55fClick|r to reset all running modules. |cffeda55fCtrl+Click|r to force reboot for everyone (Requires assistant or higher). |cffeda55fAlt+Click|r to disable them. |cffeda55fCtrl+Alt+Click|r to disable Big Wigs completely."] = true,
["|cffeda55fClick|r to enable."] = true,
["Big Wigs is currently disabled."] = true,
["Active boss modules"] = true,
["hidden"] = true,
["shown"] = true,
["minimap"] = true,
["Minimap"] = true,
["Toggle the minimap button."] = true,
["All running modules have been reset."] = true,
["All running modules have been rebooted for all raid members."] = true,
["All running modules have been disabled."] = true,
["%s reset."] = true,
["%s disabled."] = true,
["%s icon is now %s."] = true,
["Show it again with /bw plugin minimap."] = true,
["You need to be an assistant or raid leader to use this function."] = true,
} end)
L:RegisterTranslations("esES", function() return {
["|cff00ff00Module running|r"] = "|cff00ff00Módulo activado|r",
["|cffeda55fClick|r to reset all running modules. |cffeda55fCtrl+Click|r to force reboot for everyone (Requires assistant or higher). |cffeda55fAlt+Click|r to disable them. |cffeda55fCtrl+Alt+Click|r to disable Big Wigs completely."] = "|cffeda55fHaz Clic|r para reiniciar todos los módulos activos. |cffeda55fCtrl+Clic|r para reiniciar para todos (Requiere asistente o líder). |cffeda55fAlt+Clic|r para desactivarlos. |cffeda55fCtrl+Alt+Clic|r para desactivar Big Wigs.",
["|cffeda55fClick|r to enable."] = "|cffeda55fHaz Clic|r para activar.",
["Big Wigs is currently disabled."] = "Big Wigs está desactivo",
["Active boss modules"] = "Módulos de Jefe Activos",
--["hidden"] = "oculto",
--["shown"] = "mostrado",
--["minimap"] = "minimapa",
["Minimap"] = "Minimapa",
["Toggle the minimap button."] = "Alterna el botón del minimapa",
["All running modules have been reset."] = "Todos los módulos activos fueron reiniciados",
["All running modules have been rebooted for all raid members."] = "Todos los módulos activos fueros reiniciados para todos los miembros de la banda",
["All running modules have been disabled."] = "Todos los módulos activos fueron desactivados",
["%s reset."] = "%s Reiniciado",
["%s disabled."] = "%s Desactivado",
["%s icon is now %s."] = "el icono %s ahora es %s.",
["Show it again with /bw plugin minimap."] = "Mostrar con /bw plugin minimap",
["You need to be an assistant or raid leader to use this function."] = "Tienes que ser asistente o líder para usar la función",
} end)
L:RegisterTranslations("deDE", function() return {
["|cff00ff00Module running|r"] = "|cff00ff00Modul aktiviert|r",
["|cffeda55fClick|r to reset all running modules. |cffeda55fCtrl+Click|r to force reboot for everyone (Requires assistant or higher). |cffeda55fAlt+Click|r to disable them. |cffeda55fCtrl+Alt+Click|r to disable Big Wigs completely."] = "|cffeda55fKlicken|r, um alle laufenden Module zurückzusetzen. |cffeda55fStrg+Klick|r um Reset für jedermann zu erzwingen (Benötigt Assistent oder höher). |cffeda55fAlt+Klick|r um alle laufenden Module zu beenden. |cffeda55fStrg+Shift+Klick|r um BigWigs komplett zu beenden.",
["|cffeda55fClick|r to enable."] = "|cffeda55fKlicken|r um zu aktivieren.",
["Big Wigs is currently disabled."] = "Big Wigs ist momentan deaktiviert.",
["Active boss modules"] = "Aktive Boss Module",
["hidden"] = "versteckt",
["shown"] = "angezeigt",
-- ["minimap"] = true,
["Minimap"] = "Minimap",
["Toggle the minimap button."] = "Minimap Button anzeigen.",
["All running modules have been reset."] = "Alle laufenden Module wurden zurückgesetzt.",
["All running modules have been rebooted for all raid members."] = "Alle laufenden Module wurden für alle Schlachtzugsmitglieder neu gestartet.",
["All running modules have been disabled."] = "Alle laufenden Module wurden beendet.",
["%s reset."] = "%s zurückgesetzt.",
["%s disabled."] = "%s beendet.",
["%s icon is now %s."] = "%s Icon ist jetzt %s.",
["You need to be an assistant or raid leader to use this function."] = "Du musst Schlachtzugsleiter oder Assistent sein, um diese Funktion zu benutzen.",
} end)
----------------------------------
-- Module Declaration --
----------------------------------
local deuce = BigWigs:NewModule("Options Menu")
deuce.hasFuBar = IsAddOnLoaded("FuBar") and FuBar
deuce.consoleCmd = not deuce.hasFuBar and L["minimap"]
deuce.consoleOptions = not deuce.hasFuBar and {
type = "toggle",
name = L["Minimap"],
desc = L["Toggle the minimap button."],
get = function() return BigWigsOptions.minimapFrame and BigWigsOptions.minimapFrame:IsVisible() or false end,
set = function(v)
if v then
BigWigsOptions:Show()
else
BigWigsOptions:Hide()
BigWigs:Print(L["Show it again with /bw plugin minimap."])
end
end,
map = {[false] = L["hidden"], [true] = L["shown"]},
message = L["%s icon is now %s."],
hidden = function() return deuce.hasFuBar end,
}
----------------------------
-- FuBar Plugin --
----------------------------
BigWigsOptions = AceLibrary("AceAddon-2.0"):new("AceEvent-2.0", "AceConsole-2.0", "AceDB-2.0", "FuBarPlugin-2.0")
BigWigsOptions.name = "FuBar - BigWigs"
BigWigsOptions:RegisterDB("BigWigsFubarDB")
BigWigsOptions.hasNoColor = true
BigWigsOptions.hasIcon = "Interface\\AddOns\\BigWigs\\Icons\\core-enabled"
BigWigsOptions.defaultMinimapPosition = 180
BigWigsOptions.clickableTooltip = true
BigWigsOptions.hideWithoutStandby = true
--BigWigsOptions.hasNoText = true
-- XXX total hack
BigWigsOptions.OnMenuRequest = deuce.core.cmdtable
local args = AceLibrary("FuBarPlugin-2.0"):GetAceOptionsDataTable(BigWigsOptions)
for k,v in pairs(args) do
if BigWigsOptions.OnMenuRequest.args[k] == nil then
BigWigsOptions.OnMenuRequest.args[k] = v
end
end
-- XXX end hack
-----------------------------
-- Icon Handling --
-----------------------------
function BigWigsOptions:OnEnable()
self:RegisterEvent("BigWigs_CoreEnabled", "CoreState")
self:RegisterEvent("BigWigs_CoreDisabled", "CoreState")
self:CoreState()
end
function BigWigsOptions:CoreState()
if BigWigs:IsActive() then
self:SetIcon("Interface\\AddOns\\BigWigs\\Icons\\core-enabled")
else
self:SetIcon("Interface\\AddOns\\BigWigs\\Icons\\core-disabled")
end
self:UpdateTooltip()
end
-----------------------------
-- FuBar Methods --
-----------------------------
function BigWigsOptions:ModuleAction(module)
if IsAltKeyDown() then
deuce.core:ToggleModuleActive(module, false)
self:Print(string.format(L["%s disabled."], module:ToString()))
else
deuce.core:BigWigs_RebootModule(module:ToString())
self:Print(string.format(L["%s reset."], module:ToString()))
end
self:UpdateTooltip()
end
function BigWigsOptions:OnTooltipUpdate()
if BigWigs:IsActive() then
local cat = tablet:AddCategory("text", L["Active boss modules"])
for name, module in deuce.core:IterateModules() do
if module:IsBossModule() and deuce.core:IsModuleActive(module) then
cat:AddLine("text", name, "func", function(mod) BigWigsOptions:ModuleAction(mod) end, "arg1", module)
end
end
tablet:SetHint(L["|cffeda55fClick|r to reset all running modules. |cffeda55fCtrl+Click|r to force reboot for everyone (Requires assistant or higher). |cffeda55fAlt+Click|r to disable them. |cffeda55fCtrl+Alt+Click|r to disable Big Wigs completely."])
else
-- use a text line for this, since the hint is not shown when we are
-- detached.
local cat = tablet:AddCategory("colums", 1)
cat:AddLine("text", L["Big Wigs is currently disabled."], "func", function() BigWigsOptions:OnClick() end)
tablet:SetHint(L["|cffeda55fClick|r to enable."])
end
end
function BigWigsOptions:OnClick()
if BigWigs:IsActive() then
if IsAltKeyDown() then
if IsControlKeyDown() then
BigWigs:ToggleActive(false)
self:UpdateTooltip()
else
for name, module in deuce.core:IterateModules() do
if module:IsBossModule() and deuce.core:IsModuleActive(module) then
deuce.core:ToggleModuleActive(module, false)
end
end
self:Print(L["All running modules have been disabled."])
end
elseif IsControlKeyDown() then
for name, module in deuce.core:IterateModules() do
if module:IsBossModule() and deuce.core:IsModuleActive(module) then
if (IsRaidLeader() or IsRaidOfficer()) then
deuce.core:TriggerEvent("BigWigs_SendSync", "RebootModule "..tostring(module))
end
end
end
if (IsRaidLeader() or IsRaidOfficer()) then
self:Print(L["All running modules have been rebooted for all raid members."])
else
self:Print(L["You need to be an assistant or raid leader to use this function."])
end
else
for name, module in deuce.core:IterateModules() do
if module:IsBossModule() and deuce.core:IsModuleActive(module) then
deuce.core:BigWigs_RebootModule(name)
end
end
self:Print(L["All running modules have been reset."])
end
else
BigWigs:ToggleActive(true)
end
self:UpdateTooltip()
end