vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | |
2 | ---------------------------- |
||
3 | -- Localization -- |
||
4 | ---------------------------- |
||
5 | |||
6 | local L = AceLibrary("AceLocale-2.0"):new("BigWigsBossBlock") |
||
7 | |||
8 | L:RegisterTranslations("enUS", function() return { |
||
9 | ["BossBlock"] = true, |
||
10 | ["Suppress bossmod chat from other players."] = true, |
||
11 | |||
12 | ["Suppress Raid Chat"] = true, |
||
13 | ["Suppress messages in the raid channel."] = true, |
||
14 | |||
15 | ["Suppress RaidWarn Chat"] = true, |
||
16 | ["Suppress RaidWarn messages in the chat frames."] = true, |
||
17 | |||
18 | ["Suppress RaidWarn"] = true, |
||
19 | ["Suppress RaidWarn popup messages."] = true, |
||
20 | |||
21 | ["Suppress RaidSay"] = true, |
||
22 | ["Suppress CTRA RaidSay popup messages."] = true, |
||
23 | ["Suppress oRA RaidSay popup messages."] = true, |
||
24 | ["Suppress oRA2 RaidSay popup messages."] = true, |
||
25 | |||
26 | ["Suppress Tells"] = true, |
||
27 | ["Suppress Tell messages."] = true, |
||
28 | |||
29 | ["Debugging"] = true, |
||
30 | ["Show debug messages."] = true, |
||
31 | |||
32 | ["Suppressing Chatframe"] = true, |
||
33 | ["Suppressing RaidWarningFrame"] = true, |
||
34 | ["Suppressing CT_RAMessageFrame"] = true, |
||
35 | |||
36 | ["Suppressed"] = true, |
||
37 | ["Shown"] = true, |
||
38 | } end) |
||
39 | |||
40 | L:RegisterTranslations("koKR", function() return { |
||
41 | ["BossBlock"] = "보스차단", |
||
42 | ["Suppress bossmod chat from other players."] = "타인의 보스모드 대화 차단.", |
||
43 | |||
44 | ["Suppress Raid Chat"] = "공격대 대화 차단", |
||
45 | ["Suppress messages in the raid channel."] = "공격대 채널에 메세지 차단.", |
||
46 | |||
47 | ["Suppress RaidWarn Chat"] = "공격대경고 대화 차단", |
||
48 | ["Suppress RaidWarn messages in the chat frames."] = "대화창에 공격대경고 메세지 차단", |
||
49 | |||
50 | ["Suppress RaidWarn"] = "공격대경고 차단", |
||
51 | ["Suppress RaidWarn popup messages."] = "공격대경고 알림 메세지 차단", |
||
52 | |||
53 | ["Suppress RaidSay"] = "RaidSay 차단", |
||
54 | ["Suppress CTRA RaidSay popup messages."] = "CTRA RaidSay 알림 메세지 차단", |
||
55 | ["Suppress oRA RaidSay popup messages."] = "oRA RaidSay 알림 메세지 차단", |
||
56 | ["Suppress oRA2 RaidSay popup messages."] = "oRA2 RaidSay 알림 메세지 차단", |
||
57 | |||
58 | ["Suppress Tells"] = "일반대화 차단", |
||
59 | ["Suppress Tell messages."] = "일반대화 메세지 차단", |
||
60 | |||
61 | ["Debugging"] = "디버깅", |
||
62 | ["Show debug messages."] = "디버그 메세지 표시", |
||
63 | |||
64 | ["Suppressing Chatframe"] = "대화창 차단됨", |
||
65 | ["Suppressing RaidWarningFrame"] = "공격대경고창 차단됨", |
||
66 | ["Suppressing CT_RAMessageFrame"] = "CR_RA메세지창 차단됨", |
||
67 | |||
68 | ["Suppressed"] = "차단됨", |
||
69 | ["Shown"] = "표시함", |
||
70 | |||
71 | } end) |
||
72 | |||
73 | L:RegisterTranslations("zhCN", function() return { |
||
74 | ["BossBlock"] = "信息阻挡", |
||
75 | ["Suppress bossmod chat from other players."] = "阻挡其他玩家的首领插件发送的信息。", |
||
76 | |||
77 | ["Suppress Raid Chat"] = "阻挡团队频道", |
||
78 | ["Suppress messages in the raid channel."] = "阻挡团队频道中的信息", |
||
79 | |||
80 | ["Suppress RaidWarn Chat"] = "阻挡团队警告聊天", |
||
81 | ["Suppress RaidWarn messages in the chat frames."] = "阻挡聊天窗体中的团队警告信息", |
||
82 | |||
83 | ["Suppress RaidWarn"] = "阻挡团队警告", |
||
84 | ["Suppress RaidWarn popup messages."] = "阻挡团队警告中的信息", |
||
85 | |||
86 | ["Suppress RaidSay"] = "阻挡RS", |
||
87 | ["Suppress CTRA RaidSay popup messages."] = "阻挡团队助手(CTRA)的RS信息", |
||
88 | |||
89 | ["Suppress Tells"] = "阻挡密语", |
||
90 | ["Suppress Tell messages."] = "阻挡密语中的信息", |
||
91 | |||
92 | ["Debugging"] = "除错", |
||
93 | ["Show debug messages."] = "显示除错信息", |
||
94 | |||
95 | ["Suppressing Chatframe"] = "正在阻挡Chatframe", |
||
96 | ["Suppressing RaidWarningFrame"] = "正在阻挡RaidWarningFrame", |
||
97 | ["Suppressing CT_RAMessageFrame"] = "正在阻挡CT_RAMessageFrame", |
||
98 | |||
99 | ["Suppressed"] = "阻挡", |
||
100 | ["Shown"] = "显示", |
||
101 | } end) |
||
102 | |||
103 | |||
104 | L:RegisterTranslations("deDE", function() return { |
||
105 | ["BossBlock"] = "BossBlock", |
||
106 | ["Suppress bossmod chat from other players."] = "Unterdr\195\188cke Bossmod Chat von anderen Spielern.", |
||
107 | |||
108 | ["Suppress Raid Chat"] = "Unterdr\195\188cke Raid Chat", |
||
109 | ["Suppress messages in the raid channel."] = "Unterdr\195\188cke Nachrichten im Raid Channel", |
||
110 | |||
111 | ["Suppress RaidWarn Chat"] = "Unterdr\195\188cke RaidWarn Chat", |
||
112 | ["Suppress RaidWarn messages in the chat frames."] = "Unterdr\195\188cke RaidWarn Nachrichten im Chat Fenster.", |
||
113 | |||
114 | ["Suppress RaidWarn"] = "Unterdr\195\188cke RaidWarn", |
||
115 | ["Suppress RaidWarn popup messages."] = "Unterdr\195\188cke RaidWarn Popup Nachrichten.", |
||
116 | |||
117 | ["Suppress RaidSay"] = "Unterdr\195\188cke RaidSay", |
||
118 | ["Suppress CTRA RaidSay popup messages."] = "Unterdr\195\188cke CTRA RaidSay Popup Nachrichten.", |
||
119 | ["Suppress oRA RaidSay popup messages."] = "Unterdr\195\188cke oRA RaidSay Popup Nachrichten.", |
||
120 | |||
121 | ["Suppress Tells"] = "Unterdr\195\188cke Fl\195\188stern", |
||
122 | ["Suppress Tell messages."] = "Unterdr\195\188cke Fl\195\188stern Nachrichten.", |
||
123 | |||
124 | ["Debugging"] = "Debugging", |
||
125 | ["Show debug messages."] = "Zeige Debug Nachrichten.", |
||
126 | |||
127 | ["Suppressing Chatframe"] = "Unterdr\195\188cke Chatframe", |
||
128 | ["Suppressing RaidWarningFrame"] = "Unterdr\195\188cke RaidWarningFrame", |
||
129 | ["Suppressing CT_RAMessageFrame"] = "Unterdr\195\188cke CT_RAMessageFrame", |
||
130 | |||
131 | ["Suppressed"] = "Unterdr\195\188ckt", |
||
132 | ["Shown"] = "Angezeigt", |
||
133 | } end) |
||
134 | |||
135 | ------------------------------ |
||
136 | -- Are you local? -- |
||
137 | ------------------------------ |
||
138 | |||
139 | local raidchans = { |
||
140 | CHAT_MSG_WHISPER = "hidetells", |
||
141 | CHAT_MSG_RAID = "hideraidchat", |
||
142 | CHAT_MSG_RAID_WARNING = "hideraidwarnchat", |
||
143 | CHAT_MSG_RAID_LEADER = "hideraidchat", |
||
144 | } |
||
145 | local map = {[true] = "|cffff0000"..L["Suppressed"].."|r", [false] = "|cff00ff00"..L["Shown"].."|r"} |
||
146 | local blockregexs = { |
||
147 | "%*+ .+ %*+$", |
||
148 | } |
||
149 | local blockstrings = { |
||
150 | -- enUS |
||
151 | ["YOU HAVE THE PLAGUE!"] = true, |
||
152 | ["YOU ARE THE BOMB!"] = true, |
||
153 | ["YOU ARE BEING WATCHED!"] = true, |
||
154 | ["YOU ARE CURSED!"] = true, |
||
155 | ["YOU ARE BURNING!"] = true, |
||
156 | ["YOU ARE AFFLICTED BY VOLATILE INFECTION!"] = true, |
||
157 | ["YOU ARE MARKED!"] = true, |
||
158 | |||
159 | -- znCH |
||
160 | ["你中了瘟疫!离开人群!"] = true, |
||
161 | ["你是炸弹人!"] = true, |
||
162 | ["你被盯上了!"] = true, |
||
163 | ["你中了诅咒!"] = true, |
||
164 | ["你正在燃烧!"] = true, |
||
165 | ["你中了快速传染!"] = true, |
||
166 | ["你被标记了!"] = true, |
||
167 | |||
168 | -- deDE |
||
169 | ["DU HAST DIE SEUCHE!"] = true, |
||
170 | ["DU BIST DIE BOMBE!"] = true, |
||
171 | ["DU WIRST BEOBACHTET!"] = true, |
||
172 | ["DU BIST VERFLUCHT!"] = true, |
||
173 | ["DU BRENNST!"] = true, |
||
174 | -- ["YOU ARE AFFLICTED BY VOLATILE INFECTION!"] = true, |
||
175 | ["DU BIST MARKIERT!"] = true, |
||
176 | } |
||
177 | |||
178 | |||
179 | ---------------------------------- |
||
180 | -- Module Declaration -- |
||
181 | ---------------------------------- |
||
182 | |||
183 | BigWigsBossBlock = BigWigs:NewModule("BossBlock", "AceHook-2.0") |
||
184 | BigWigsBossBlock.defaultDB = { |
||
185 | hideraidwarnchat = true, |
||
186 | hideraidwarn = true, |
||
187 | hideraidsay = true, |
||
188 | hideraidchat = true, |
||
189 | hidetells = true, |
||
190 | } |
||
191 | BigWigsBossBlock.consoleCmd = "block" |
||
192 | BigWigsBossBlock.consoleOptions = { |
||
193 | type = "group", |
||
194 | name = L["BossBlock"], |
||
195 | desc = L["Suppress bossmod chat from other players."], |
||
196 | args = { |
||
197 | ["chat"] = { |
||
198 | type = "toggle", |
||
199 | order = 1, |
||
200 | name = L["Suppress Raid Chat"], |
||
201 | desc = L["Suppress messages in the raid channel."], |
||
202 | get = function() return BigWigsBossBlock.db.profile.hideraidchat end, |
||
203 | set = function(v) BigWigsBossBlock.db.profile.hideraidchat = v end, |
||
204 | map = map, |
||
205 | }, |
||
206 | ["rwchat"] = { |
||
207 | type = "toggle", |
||
208 | order = 1, |
||
209 | name = L["Suppress RaidWarn Chat"], |
||
210 | desc = L["Suppress RaidWarn messages in the chat frames."], |
||
211 | get = function() return BigWigsBossBlock.db.profile.hideraidwarnchat end, |
||
212 | set = function(v) BigWigsBossBlock.db.profile.hideraidwarnchat = v end, |
||
213 | map = map, |
||
214 | }, |
||
215 | ["rw"] = { |
||
216 | type = "toggle", |
||
217 | order = 1, |
||
218 | name = L["Suppress RaidWarn"], |
||
219 | desc = L["Suppress RaidWarn popup messages."], |
||
220 | get = function() return BigWigsBossBlock.db.profile.hideraidwarn end, |
||
221 | set = function(v) BigWigsBossBlock.db.profile.hideraidwarn = v end, |
||
222 | map = map, |
||
223 | }, |
||
224 | ["rs"] = { |
||
225 | type = "toggle", |
||
226 | order = 1, |
||
227 | name = L["Suppress RaidSay"], |
||
228 | desc = L["Suppress CTRA RaidSay popup messages."], |
||
229 | get = function() return BigWigsBossBlock.db.profile.hideraidsay end, |
||
230 | set = function(v) BigWigsBossBlock.db.profile.hideraidsay = v end, |
||
231 | map = map, |
||
232 | hidden = function() return not CT_RAMessageFrame end, |
||
233 | }, |
||
234 | ["ora_rs"] = { |
||
235 | type = "toggle", |
||
236 | order = 1, |
||
237 | name = L["Suppress RaidSay"], |
||
238 | desc = L["Suppress oRA RaidSay popup messages."], |
||
239 | get = function() return oRA_RaidSay:GetOpt("blockboss") end, |
||
240 | set = function(v) oRA_RaidSay:TogOpt("blockboss") end, |
||
241 | map = map, |
||
242 | hidden = function() return not oRA_RaidSay end, |
||
243 | }, |
||
244 | ["ora2_rs"] = { |
||
245 | type = "toggle", |
||
246 | order = 1, |
||
247 | name = L["Suppress RaidSay"], |
||
248 | desc = L["Suppress oRA2 RaidSay popup messages."], |
||
249 | get = function() return oRAPRaidWarn.db.profile.bossblock end, |
||
250 | set = function(v) oRAPRaidWarn.db.profile.bossblock = v end, |
||
251 | map = map, |
||
252 | hidden = function() return not oRAPRaidWarn end, |
||
253 | }, |
||
254 | ["tell"] = { |
||
255 | type = "toggle", |
||
256 | order = 1, |
||
257 | name = L["Suppress Tells"], |
||
258 | desc = L["Suppress Tell messages."], |
||
259 | get = function() return BigWigsBossBlock.db.profile.hidetells end, |
||
260 | set = function(v) BigWigsBossBlock.db.profile.hidetells = v end, |
||
261 | map = map, |
||
262 | }, |
||
263 | ["debugspacer"] = { |
||
264 | type = "header", |
||
265 | order = 99, |
||
266 | hidden = function() return not BigWigsBossBlock:IsDebugging() and not BigWigs:IsDebugging() end, |
||
267 | }, |
||
268 | ["debug"] = { |
||
269 | type = "toggle", |
||
270 | name = L["Debugging"], |
||
271 | desc = L["Show debug messages."], |
||
272 | order = 100, |
||
273 | get = function() return BigWigsBossBlock:IsDebugging() end, |
||
274 | set = function(v) BigWigsBossBlock:SetDebugging(v) end, |
||
275 | hidden = function() return not BigWigsBossBlock:IsDebugging() and not BigWigs:IsDebugging() end, |
||
276 | }, |
||
277 | }, |
||
278 | } |
||
279 | |||
280 | |||
281 | ------------------------------ |
||
282 | -- Event Handlers -- |
||
283 | ------------------------------ |
||
284 | |||
285 | function BigWigsBossBlock:OnEnable() |
||
286 | self:Hook("ChatFrame_OnEvent") |
||
287 | self:Hook("RaidWarningFrame_OnEvent") |
||
288 | if CT_RAMessageFrame then self:Hook(CT_RAMessageFrame, "AddMessage", "CTRA_AddMessage") end |
||
289 | end |
||
290 | |||
291 | |||
292 | function BigWigsBossBlock:ChatFrame_OnEvent(event) |
||
293 | if self:IsChannelSuppressed(event) and self:IsSpam(arg1) then |
||
294 | self:Debug(L["Suppressing Chatframe"], event, arg1) |
||
295 | return |
||
296 | end |
||
297 | self.hooks.ChatFrame_OnEvent.orig(event) |
||
298 | end |
||
299 | |||
300 | |||
301 | function BigWigsBossBlock:RaidWarningFrame_OnEvent(event, message) |
||
302 | if self.db.profile.hideraidwarn and self:IsSpam(message) then |
||
303 | self:Debug(L["Suppressing RaidWarningFrame"], message) |
||
304 | return |
||
305 | end |
||
306 | self.hooks.RaidWarningFrame_OnEvent.orig(event, message) |
||
307 | end |
||
308 | |||
309 | |||
310 | function BigWigsBossBlock:CTRA_AddMessage(obj, text, red, green, blue, alpha, holdTime) |
||
311 | if self.db.profile.hideraidsay and self:IsSpam(text) then |
||
312 | self:Debug(L["Suppressing CT_RAMessageFrame"], text) |
||
313 | return |
||
314 | end |
||
315 | self.hooks[obj].AddMessage.orig(obj, text, red, green, blue, alpha, holdTime) |
||
316 | end |
||
317 | |||
318 | |||
319 | function BigWigsBossBlock:IsSpam(text) |
||
320 | if not text then return end |
||
321 | if blockstrings[text] then return true end |
||
322 | for _,regex in pairs(blockregexs) do if string.find(text, regex) then return true end end |
||
323 | end |
||
324 | |||
325 | |||
326 | function BigWigsBossBlock:IsChannelSuppressed(chan) |
||
327 | if not raidchans[chan] then return end |
||
328 | return self.db.profile[raidchans[chan]] |
||
329 | end |
||
330 | |||
331 | |||
332 |