vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | |
2 | assert(BigWigs, "BigWigs not found!") |
||
3 | |||
4 | ------------------------------ |
||
5 | -- Are you local? -- |
||
6 | ------------------------------ |
||
7 | |||
8 | local L = AceLibrary("AceLocale-2.2"):new("BigWigsOptions") |
||
9 | local tablet = AceLibrary("Tablet-2.0") |
||
10 | |||
11 | ---------------------------- |
||
12 | -- Localization -- |
||
13 | ---------------------------- |
||
14 | |||
15 | L:RegisterTranslations("enUS", function() return { |
||
16 | ["|cff00ff00Module running|r"] = true, |
||
17 | ["|cffeda55fClick|r to reset all running modules. |cffeda55fAlt+Click|r to disable them. |cffeda55fCtrl+Alt+Click|r to disable Big Wigs completely."] = true, |
||
18 | ["|cffeda55fClick|r to enable."] = true, |
||
19 | ["Big Wigs is currently disabled."] = true, |
||
20 | ["Active boss modules"] = true, |
||
21 | ["hidden"] = true, |
||
22 | ["shown"] = true, |
||
23 | ["minimap"] = true, |
||
24 | ["Minimap"] = true, |
||
25 | ["Toggle the minimap button."] = true, |
||
26 | ["All running modules have been reset."] = true, |
||
27 | ["All running modules have been disabled."] = true, |
||
28 | ["%s reset."] = true, |
||
29 | ["%s disabled."] = true, |
||
30 | ["%s icon is now %s."] = true, |
||
31 | ["Show it again with /bw plugin minimap."] = true, |
||
32 | } end) |
||
33 | |||
34 | L:RegisterTranslations("frFR", function() return { |
||
35 | ["|cff00ff00Module running|r"] = "|cff00ff00Module d\195\169marr\195\169|r", |
||
36 | ["|cffeda55fClick|r to reset all running modules. |cffeda55fAlt+Click|r to disable them. |cffeda55fCtrl+Alt+Click|r to disable Big Wigs completely."] = "|cffeda55fClic|r pour red\195\169marrer les modules actifs. |cffeda55fAlt+Clic|r pour les d\195\169sactiver. |cffeda55fCtrl+Alt+Clic|r pour d\195\169sactiver Big Wigs compl\195\168tement.", |
||
37 | ["|cffeda55fClick|r to enable."] = "|cffeda55fClic|r pour activer.", |
||
38 | ["Big Wigs is currently disabled."] = "Big Wigs est actuellement d\195\169sactiv\195\169.", |
||
39 | ["Active boss modules"] = "Modules de boss actifs", |
||
40 | ["hidden"] = "cach\195\169e", |
||
41 | ["shown"] = "affich\195\169e", |
||
42 | -- ["minimap"] = true, |
||
43 | -- ["Minimap"] = true, |
||
44 | ["Toggle the minimap button."] = "Afficher ou masquer le bouton sur la minimap.", |
||
45 | ["All running modules have been reset."] = "Tous les modules actifs ont \195\169t\195\169 red\195\169marr\195\169s.", |
||
46 | ["All running modules have been disabled."] = "Tous les modules ont \195\169t\195\169 d\195\169sactiv\195\169s.", |
||
47 | ["%s reset."] = "%s red\195\169marr\195\169.", |
||
48 | ["%s disabled."] = "%s d\195\169sactiv\195\169.", |
||
49 | ["%s icon is now %s."] = "L'ic\195\180ne de %s est d\195\169sormais %s.", |
||
50 | ["Show it again with /bw plugin minimap."] = "Vous pouvez la r\195\169afficher avec /bw plugin minimap.", |
||
51 | } end) |
||
52 | |||
53 | L:RegisterTranslations("koKR", function() return { |
||
54 | ["|cff00ff00Module running|r"] = "|cff00ff00모듈 실행중|r", |
||
55 | ["|cffeda55fClick|r to reset all running modules. |cffeda55fAlt+Click|r to disable them. |cffeda55fCtrl+Alt+Click|r to disable Big Wigs completely."] = "|cffeda55f클릭|r : 모두 초기화 |cffeda55f알트+클릭|r 비활성화 |cffeda55f컨트롤+알트+클릭|r : BigWigs 비활성화.", |
||
56 | ["|cffeda55fClick|r to enable."] = "|cffeda55f클릭|r : 모듈 활성화.", |
||
57 | ["Big Wigs is currently disabled."] = "BigWigs가 비활성화 되어 있습니다.", |
||
58 | ["Active boss modules"] = "보스 모듈 활성화", |
||
59 | ["hidden"] = "숨김", |
||
60 | ["shown"] = "표시", |
||
61 | ["Minimap"] = "미니맵", |
||
62 | ["Toggle the minimap button."] = "미니맵 버튼 토글", |
||
63 | ["All running modules have been reset."] = "모든 실행중인 모듈을 초기화합니다.", |
||
64 | ["All running modules have been disabled."] = "모든 실행중인 모듈을 비활성화 합니다.", |
||
65 | ["%s reset."] = "%s 초기화되었습니다.", |
||
66 | ["%s disabled."] = "%s 비활성화 되었습니다.", |
||
67 | ["%s icon is now %s."] = "%s 아이콘은 현재 %s 입니다.", |
||
68 | ["Show it again with /bw plugin minimap."] = "/bw plugin minimap 명령으로 다시 나타납니다.", |
||
69 | } end) |
||
70 | |||
71 | L:RegisterTranslations("zhCN", function() return { |
||
72 | ["|cff00ff00Module running|r"] = "|cff00ff00模块运行中|r", |
||
73 | ["|cffeda55fClick|r to reset all running modules. |cffeda55fAlt+Click|r to disable them. |cffeda55fCtrl+Alt+Click|r to disable Big Wigs completely."] = "|cffeda55f点击|r图标重置所有运行中的模块。|cffeda55fAlt+点击|r图标关闭所有运行中的模块。|cffeda55fCtrl+Alt+点击|r图标关闭BigWigs。", |
||
74 | ["|cffeda55fClick|r to enable."] = "|cffeda55f点击|r图标开启BigWigs。", |
||
75 | ["Big Wigs is currently disabled."] = "Big Wigs目前关闭。", |
||
76 | ["Active boss modules"] = "激活首领模块", |
||
77 | ["hidden"] = "隐藏", |
||
78 | ["shown"] = "显示", |
||
79 | ["Minimap"] = "小地图", |
||
80 | ["Minimap"] = "小地图", |
||
81 | ["Toggle the minimap button."] = "切换是否显示小地图图标。", |
||
82 | ["All running modules have been reset."] = "所有运行中的模块都已重置。", |
||
83 | ["All running modules have been disabled."] = "所有运行中的模块都已关闭。", |
||
84 | ["%s reset."] = "%s重置。", |
||
85 | ["%s disabled."] = "%s关闭。", |
||
86 | } end) |
||
87 | |||
88 | |||
89 | L:RegisterTranslations("zhTW", function() return { |
||
90 | ["|cff00ff00Module running|r"] = "|cff00ff00模組運作中|r", |
||
91 | ["|cffeda55fClick|r to reset all running modules. |cffeda55fAlt+Click|r to disable them. |cffeda55fCtrl+Alt+Click|r to disable Big Wigs completely."] = "|cffeda55f點擊|r圖示重置所有運作中的模組。|cffeda55fAlt+點擊|r圖示關閉所有運作中的模組。|cffeda55fCtrl+Alt+點擊|r圖示關閉BigWigs。", |
||
92 | ["|cffeda55fClick|r to enable."] = "|cffeda55f點擊|r圖示開啟BigWigs。", |
||
93 | ["Big Wigs is currently disabled."] = "Big Wigs目前關閉。", |
||
94 | ["Active boss modules"] = "啟動首領模組", |
||
95 | ["hidden"] = "隱藏", |
||
96 | ["shown"] = "顯示", |
||
97 | ["Minimap"] = "小地圖", |
||
98 | ["Minimap"] = "小地圖", |
||
99 | ["Toggle the minimap button."] = "切換是否顯示小地圖圖標。", |
||
100 | ["All running modules have been reset."] = "所有運行中的模組都已重置。", |
||
101 | ["All running modules have been disabled."] = "所有運行中的模組都已關閉。", |
||
102 | ["%s reset."] = "%s重置。", |
||
103 | ["%s disabled."] = "%s關閉。", |
||
104 | } end) |
||
105 | |||
106 | L:RegisterTranslations("deDE", function() return { |
||
107 | ["|cff00ff00Module running|r"] = "|cff00ff00Modul aktiviert|r", |
||
108 | -- ["|cffeda55fClick|r to reset all running modules. |cffeda55fShift+Click|r to disable them. |cffeda55fCtrl+Shift+Click|r to disable Big Wigs completely."] = "|cffeda55fKlicken|r, um alle laufenden Module zur\195\188ckzusetzen. |cffeda55fShift+Klick|r um alle laufenden Module zu beenden. |cffeda55fStrg+Shift+Klick|r um BigWigs komplett zu beenden.", |
||
109 | ["|cffeda55fClick|r to enable."] = "|cffeda55fKlicken|r um zu aktivieren.", |
||
110 | ["Big Wigs is currently disabled."] = "Big Wigs ist gegenw\195\164rtig deaktiviert.", |
||
111 | ["Active boss modules"] = "Aktive Boss Module", |
||
112 | ["hidden"] = "versteckt", |
||
113 | ["shown"] = "angezeigt", |
||
114 | -- ["minimap"] = true, |
||
115 | ["Minimap"] = "Minimap", |
||
116 | ["Toggle the minimap button."] = "Minimap Button anzeigen.", |
||
117 | ["All running modules have been reset."] = "Alle laufenden Module wurden zur\195\188ckgesetzt.", |
||
118 | ["All running modules have been disabled."] = "Alle laufenden Module wurden beendet.", |
||
119 | ["%s reset."] = "%s zur\195\188ckgesetzt.", |
||
120 | ["%s disabled."] = "%s beendet.", |
||
121 | } end) |
||
122 | |||
123 | ---------------------------------- |
||
124 | -- Module Declaration -- |
||
125 | ---------------------------------- |
||
126 | |||
127 | local deuce = BigWigs:NewModule("Options Menu") |
||
128 | deuce.hasFuBar = IsAddOnLoaded("FuBar") and FuBar |
||
129 | deuce.consoleCmd = not deuce.hasFuBar and L["minimap"] |
||
130 | deuce.consoleOptions = not deuce.hasFuBar and { |
||
131 | type = "toggle", |
||
132 | name = L["Minimap"], |
||
133 | desc = L["Toggle the minimap button."], |
||
134 | get = function() return BigWigsOptions.minimapFrame and BigWigsOptions.minimapFrame:IsVisible() or false end, |
||
135 | set = function(v) |
||
136 | if v then |
||
137 | BigWigsOptions:Show() |
||
138 | else |
||
139 | BigWigsOptions:Hide() |
||
140 | BigWigs:Print(L["Show it again with /bw plugin minimap."]) |
||
141 | end |
||
142 | end, |
||
143 | map = {[false] = L["hidden"], [true] = L["shown"]}, |
||
144 | message = L["%s icon is now %s."], |
||
145 | hidden = function() return deuce.hasFuBar end, |
||
146 | } |
||
147 | |||
148 | ---------------------------- |
||
149 | -- FuBar Plugin -- |
||
150 | ---------------------------- |
||
151 | |||
152 | BigWigsOptions = AceLibrary("AceAddon-2.0"):new("AceEvent-2.0", "AceConsole-2.0", "AceDB-2.0", "FuBarPlugin-2.0") |
||
153 | BigWigsOptions.name = "FuBar - BigWigs" |
||
154 | BigWigsOptions:RegisterDB("BigWigsFubarDB") |
||
155 | |||
156 | BigWigsOptions.hasNoColor = true |
||
157 | BigWigsOptions.hasIcon = "Interface\\AddOns\\BigWigs\\Icons\\core-enabled" |
||
158 | BigWigsOptions.defaultMinimapPosition = 180 |
||
159 | BigWigsOptions.clickableTooltip = true |
||
160 | BigWigsOptions.hideWithoutStandby = true |
||
161 | --BigWigsOptions.hasNoText = true |
||
162 | |||
163 | -- XXX total hack |
||
164 | BigWigsOptions.OnMenuRequest = deuce.core.cmdtable |
||
165 | local args = AceLibrary("FuBarPlugin-2.0"):GetAceOptionsDataTable(BigWigsOptions) |
||
166 | for k,v in pairs(args) do |
||
167 | if BigWigsOptions.OnMenuRequest.args[k] == nil then |
||
168 | BigWigsOptions.OnMenuRequest.args[k] = v |
||
169 | end |
||
170 | end |
||
171 | -- XXX end hack |
||
172 | |||
173 | ----------------------------- |
||
174 | -- Icon Handling -- |
||
175 | ----------------------------- |
||
176 | |||
177 | function BigWigsOptions:OnEnable() |
||
178 | self:RegisterEvent("BigWigs_CoreEnabled", "CoreState") |
||
179 | self:RegisterEvent("BigWigs_CoreDisabled", "CoreState") |
||
180 | |||
181 | self:CoreState() |
||
182 | end |
||
183 | |||
184 | function BigWigsOptions:CoreState() |
||
185 | if BigWigs:IsActive() then |
||
186 | self:SetIcon("Interface\\AddOns\\BigWigs\\Icons\\core-enabled") |
||
187 | else |
||
188 | self:SetIcon("Interface\\AddOns\\BigWigs\\Icons\\core-disabled") |
||
189 | end |
||
190 | |||
191 | self:UpdateTooltip() |
||
192 | end |
||
193 | |||
194 | ----------------------------- |
||
195 | -- FuBar Methods -- |
||
196 | ----------------------------- |
||
197 | |||
198 | function BigWigsOptions:ModuleAction(module) |
||
199 | if IsAltKeyDown() then |
||
200 | deuce.core:ToggleModuleActive(module, false) |
||
201 | self:Print(string.format(L["%s disabled."], module:ToString())) |
||
202 | else |
||
203 | deuce.core:BigWigs_RebootModule(module) |
||
204 | self:Print(string.format(L["%s reset."], module:ToString())) |
||
205 | end |
||
206 | self:UpdateTooltip() |
||
207 | end |
||
208 | |||
209 | function BigWigsOptions:OnTooltipUpdate() |
||
210 | if BigWigs:IsActive() then |
||
211 | local cat = tablet:AddCategory("text", L["Active boss modules"]) |
||
212 | for name, module in deuce.core:IterateModules() do |
||
213 | if module:IsBossModule() and deuce.core:IsModuleActive(module) then |
||
214 | cat:AddLine("text", name, "func", function(mod) BigWigsOptions:ModuleAction(mod) end, "arg1", module) |
||
215 | end |
||
216 | end |
||
217 | tablet:SetHint(L["|cffeda55fClick|r to reset all running modules. |cffeda55fAlt+Click|r to disable them. |cffeda55fCtrl+Alt+Click|r to disable Big Wigs completely."]) |
||
218 | else |
||
219 | -- use a text line for this, since the hint is not shown when we are |
||
220 | -- detached. |
||
221 | local cat = tablet:AddCategory("colums", 1) |
||
222 | cat:AddLine("text", L["Big Wigs is currently disabled."], "func", function() BigWigsOptions:OnClick() end) |
||
223 | tablet:SetHint(L["|cffeda55fClick|r to enable."]) |
||
224 | end |
||
225 | end |
||
226 | |||
227 | function BigWigsOptions:OnClick() |
||
228 | if BigWigs:IsActive() then |
||
229 | if IsAltKeyDown() then |
||
230 | if IsControlKeyDown() then |
||
231 | BigWigs:ToggleActive(false) |
||
232 | self:UpdateTooltip() |
||
233 | else |
||
234 | for name, module in deuce.core:IterateModules() do |
||
235 | if module:IsBossModule() and deuce.core:IsModuleActive(module) then |
||
236 | deuce.core:ToggleModuleActive(module, false) |
||
237 | end |
||
238 | end |
||
239 | self:Print(L["All running modules have been disabled."]) |
||
240 | end |
||
241 | else |
||
242 | for name, module in deuce.core:IterateModules() do |
||
243 | if module:IsBossModule() and deuce.core:IsModuleActive(module) then |
||
244 | deuce.core:BigWigs_RebootModule(module) |
||
245 | end |
||
246 | end |
||
247 | self:Print(L["All running modules have been reset."]) |
||
248 | end |
||
249 | else |
||
250 | BigWigs:ToggleActive(true) |
||
251 | end |
||
252 | |||
253 | self:UpdateTooltip() |
||
254 | end |
||
255 |