Mercurial > wow > icu
comparison ICU.lua @ 1:6af2d0a0c537
Added support for disabling certain instances (based on Zone, need testing).
Cleaned up options.
author | Xiiph |
---|---|
date | Sat, 05 Feb 2011 20:27:14 +0100 |
parents | 98c6f55e6619 |
children | e883b490ff93 |
comparison
equal
deleted
inserted
replaced
0:98c6f55e6619 | 1:6af2d0a0c537 |
---|---|
40 checkAfterFinish = true, | 40 checkAfterFinish = true, |
41 advertiseICU = true, | 41 advertiseICU = true, |
42 noFoodMessage = L["Well Fed reminder!"], | 42 noFoodMessage = L["Well Fed reminder!"], |
43 noFlaskMessage = L["Flask reminder!"], | 43 noFlaskMessage = L["Flask reminder!"], |
44 lowFlaskDurationMessage = L["Your Flask runs out in less than 10 minutes!"], | 44 lowFlaskDurationMessage = L["Your Flask runs out in less than 10 minutes!"], |
45 disabledZones = {}, | |
45 } | 46 } |
46 } | 47 } |
47 | 48 |
48 function icu:OnInitialize() | 49 function icu:OnInitialize() |
49 self.db = LibStub("AceDB-3.0"):New("icuDB", defaults, true) | 50 self.db = LibStub("AceDB-3.0"):New("icuDB", defaults, true) |
59 | 60 |
60 AceConfig:RegisterOptionsTable("ICU", self.options, {"icu"}) | 61 AceConfig:RegisterOptionsTable("ICU", self.options, {"icu"}) |
61 | 62 |
62 AceConfigDialog:AddToBlizOptions("ICU", nil, nil, "general") | 63 AceConfigDialog:AddToBlizOptions("ICU", nil, nil, "general") |
63 AceConfigDialog:AddToBlizOptions("ICU", "Profiles","ICU","profile") | 64 AceConfigDialog:AddToBlizOptions("ICU", "Profiles","ICU","profile") |
65 AceConfigDialog:AddToBlizOptions("ICU", "Whispers","ICU","messages") | |
66 AceConfigDialog:AddToBlizOptions("ICU", "Disabled Zones","ICU","zones") | |
64 end | 67 end |
65 | 68 |
66 function icu:refreshConfig() | 69 function icu:refreshConfig() |
67 --print("ICU: Config refreshing ..."); | 70 --print("ICU: Config refreshing ..."); |
68 | 71 |
181 name = L["Check after readycheck"], | 184 name = L["Check after readycheck"], |
182 desc = L["Don't check buffs until ready check has finished (or timed out)"], | 185 desc = L["Don't check buffs until ready check has finished (or timed out)"], |
183 set = function(o,v,...) self.db.profile.checkAfterFinish = v end, | 186 set = function(o,v,...) self.db.profile.checkAfterFinish = v end, |
184 get = function() return self.db.profile.checkAfterFinish end, | 187 get = function() return self.db.profile.checkAfterFinish end, |
185 }, | 188 }, |
186 noFlaskMessage = { | 189 }, |
187 type = 'input', | 190 }, |
188 name = L["Flask reminder"], | 191 messages = { |
189 desc = L["Message whispered to raiders missing a cataclysm flask"], | 192 name = L["Messages"], |
190 set = function(o,v,...) self.db.profile.noFlaskMessage = v end, | 193 type = 'group', |
191 get = function() return self.db.profile.noFlaskMessage end, | 194 args = { |
192 }, | 195 noFlaskMessage = { |
193 lowFlaskDurationMessage = { | 196 type = 'input', |
194 type = 'input', | 197 width = 'double', |
195 name = L["Flask expiration"], | 198 name = L["Flask reminder"], |
196 desc = L["Message whispered to raiders with less than 10 minutes left on their flask"], | 199 desc = L["Message whispered to raiders missing a cataclysm flask"], |
197 set = function(o,v,...) self.db.profile.lowFlaskDurationMessage = v end, | 200 set = function(o,v,...) self.db.profile.noFlaskMessage = v end, |
198 get = function() return self.db.profile.lowFlaskDurationMessage end, | 201 get = function() return self.db.profile.noFlaskMessage end, |
199 }, | 202 }, |
200 noFoodMessage = { | 203 lowFlaskDurationMessage = { |
201 type = 'input', | 204 type = 'input', |
202 name = L["Food reminder"], | 205 width = 'double', |
203 desc = L["Message whispered to raiders missing the well-fed buff"], | 206 name = L["Flask expiration"], |
204 set = function(o,v,...) self.db.profile.noFoodMessage = v end, | 207 desc = L["Message whispered to raiders with less than 10 minutes left on their flask"], |
205 get = function() return self.db.profile.noFoodMessage end, | 208 set = function(o,v,...) self.db.profile.lowFlaskDurationMessage = v end, |
206 }, | 209 get = function() return self.db.profile.lowFlaskDurationMessage end, |
207 | 210 }, |
211 noFoodMessage = { | |
212 type = 'input', | |
213 width = 'double', | |
214 name = L["Food reminder"], | |
215 desc = L["Message whispered to raiders missing the well-fed buff"], | |
216 set = function(o,v,...) self.db.profile.noFoodMessage = v end, | |
217 get = function() return self.db.profile.noFoodMessage end, | |
218 }, | |
219 }, | |
220 }, | |
221 zones = { | |
222 name = L["Disabled Zones"], | |
223 type = 'group', | |
224 set = function(i,v) self.db.profile.disabledZones[i[#i]] = v end, | |
225 get = function(i) return self.db.profile.disabledZones[i[#i]] end, | |
226 args = { | |
227 help = { | |
228 type = 'description', | |
229 name = L['Toggle ICU automatic checking |cffcc0000off|r in the selected zones.'], | |
230 width = 'full', | |
231 order = 0, | |
232 }, | |
233 bwd = { | |
234 type = 'toggle', | |
235 name = L["Blackwing Descent"], | |
236 width = 'double', | |
237 }, | |
238 bot = { | |
239 type = 'toggle', | |
240 name = L["Bastion of Twilight"], | |
241 width = 'double', | |
242 }, | |
243 tfw = { | |
244 type = 'toggle', | |
245 name = L["Throne of the Four Winds"], | |
246 width = 'double', | |
247 }, | |
248 bh = { | |
249 type = 'toggle', | |
250 name = L["Baradin Hold"], | |
251 width = 'double', | |
252 }, | |
208 } | 253 } |
209 }, | 254 }, |
210 profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db), | 255 profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db), |
211 }, | 256 }, |
212 } | 257 } |
213 return options | 258 return options |
214 end | 259 end |
215 | 260 |
216 function icu:inspectRaid(silent) | 261 function icu:inspectRaid(silent,automatic) |
262 -- Check if any zones have been disabled | |
263 if #self.db.profile.disabledZones > 0 and automatic then | |
264 local currentZone = GetRealZoneText(); | |
265 | |
266 for i = 1, #self.db.profile.disabledZones do | |
267 if currentZone == self.db.profile.disabledZones[i] then return true end | |
268 end | |
269 end | |
270 | |
217 -- Not in a raid group | 271 -- Not in a raid group |
218 local icuAd = ""; | 272 local icuAd = ""; |
219 | 273 |
220 if GetNumRaidMembers() == 0 then | 274 if GetNumRaidMembers() == 0 then |
221 return true | 275 return true |
324 icu:UnregisterEvent("READY_CHECK"); | 378 icu:UnregisterEvent("READY_CHECK"); |
325 return true; | 379 return true; |
326 end | 380 end |
327 | 381 |
328 if not self.db.profile.checkAfterFinish then | 382 if not self.db.profile.checkAfterFinish then |
329 self:inspectRaid(); | 383 self:inspectRaid(nil,true); |
330 else | 384 else |
331 self:ScheduleTimer("READY_CHECK_FINISHED", 30); | 385 self:ScheduleTimer("READY_CHECK_FINISHED", 30); |
332 self:RegisterEvent("READY_CHECK_FINISHED"); | 386 self:RegisterEvent("READY_CHECK_FINISHED"); |
333 end | 387 end |
334 end | 388 end |
335 | 389 |
336 function icu:READY_CHECK_FINISHED() | 390 function icu:READY_CHECK_FINISHED() |
337 --print("Ready check finish!"); | 391 --print("Ready check finish!"); |
338 self:UnregisterEvent("READY_CHECK_FINISHED"); | 392 self:UnregisterEvent("READY_CHECK_FINISHED"); |
339 self:CancelAllTimers(); | 393 self:CancelAllTimers(); |
340 self:inspectRaid(); | 394 self:inspectRaid(nil,true); |
341 end | 395 end |
342 | 396 |
343 function icu:filterChat(self, event, msg) | 397 function icu:getDB() |
344 if msg == self.db.profile.noFoodMessage or msg == self.db.profile.noFlaskMessage or msg == self.db.profile.lowFlaskDurationMessage or msg == L["ICU"]..": "..self.db.profile.noFoodMessage or msg == L["ICU"]..": "..self.db.profile.noFlaskMessage or msg == L["ICU"]..": "..self.db.profile.lowFlaskDurationMessage then return true end | 398 return self.db; |
345 end | 399 end |
346 ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER_ICU_INFORM", icu:filterChat) | 400 |
401 function filterChat(self, event, msg) | |
402 local db = icu:getDB(); | |
403 if msg == db.profile.noFoodMessage or msg == db.profile.noFlaskMessage or msg == db.profile.lowFlaskDurationMessage or msg == L["ICU"]..": "..db.profile.noFoodMessage or msg == L["ICU"]..": "..db.profile.noFlaskMessage or msg == L["ICU"]..": "..db.profile.lowFlaskDurationMessage then return true end | |
404 end | |
405 ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER_ICU_INFORM", filterChat) | |
347 | 406 |
348 icu:RegisterEvent("READY_CHECK"); | 407 icu:RegisterEvent("READY_CHECK"); |
349 | 408 |
350 --@do-not-package@ | 409 --@do-not-package@ |
351 function icu:test(cond) | 410 function icu:test(cond) |