Mercurial > wow > icu
comparison ICU.lua @ 3:43155c3c1700
Fixes to the zone check feature
author | Xiiph |
---|---|
date | Sun, 06 Feb 2011 14:07:20 +0100 |
parents | e883b490ff93 |
children | 8ec216b40ded |
comparison
equal
deleted
inserted
replaced
2:e883b490ff93 | 3:43155c3c1700 |
---|---|
42 advertiseICU = true, | 42 advertiseICU = true, |
43 noFoodMessage = L["Well Fed reminder!"], | 43 noFoodMessage = L["Well Fed reminder!"], |
44 noFlaskMessage = L["Flask reminder!"], | 44 noFlaskMessage = L["Flask reminder!"], |
45 lowFlaskDurationMessage = L["Your Flask runs out in less than 10 minutes!"], | 45 lowFlaskDurationMessage = L["Your Flask runs out in less than 10 minutes!"], |
46 disabledZones = {}, | 46 disabledZones = {}, |
47 enableAllZones = true, | |
47 } | 48 } |
48 } | 49 } |
49 | 50 |
50 function icu:OnInitialize() | 51 function icu:OnInitialize() |
51 self.db = LibStub("AceDB-3.0"):New("icuDB", defaults, true) | 52 self.db = LibStub("AceDB-3.0"):New("icuDB", defaults, true) |
60 local AceConfigDialog = LibStub("AceConfigDialog-3.0") | 61 local AceConfigDialog = LibStub("AceConfigDialog-3.0") |
61 | 62 |
62 AceConfig:RegisterOptionsTable("ICU", self.options, {"icu"}) | 63 AceConfig:RegisterOptionsTable("ICU", self.options, {"icu"}) |
63 | 64 |
64 AceConfigDialog:AddToBlizOptions("ICU", nil, nil, "general") | 65 AceConfigDialog:AddToBlizOptions("ICU", nil, nil, "general") |
65 AceConfigDialog:AddToBlizOptions("ICU", "Profiles","ICU","profile") | |
66 AceConfigDialog:AddToBlizOptions("ICU", "Whispers","ICU","messages") | 66 AceConfigDialog:AddToBlizOptions("ICU", "Whispers","ICU","messages") |
67 AceConfigDialog:AddToBlizOptions("ICU", "Disabled Zones","ICU","zones") | 67 AceConfigDialog:AddToBlizOptions("ICU", "Disabled Zones","ICU","zones") |
68 AceConfigDialog:AddToBlizOptions("ICU", "Profiles","ICU","profile") | |
68 end | 69 end |
69 | 70 |
70 function icu:refreshConfig() | 71 function icu:refreshConfig() |
71 --print("ICU: Config refreshing ..."); | 72 --print("ICU: Config refreshing ..."); |
72 | 73 |
220 }, | 221 }, |
221 }, | 222 }, |
222 zones = { | 223 zones = { |
223 name = L["Disabled Zones"], | 224 name = L["Disabled Zones"], |
224 type = 'group', | 225 type = 'group', |
225 set = function(i,v) self.db.profile.disabledZones[i[#i]] = v end, | 226 set = function(i,v) |
226 get = function(i) return self.db.profile.disabledZones[i[#i]] end, | 227 self.db.profile.disabledZones[i[#i]] = v; |
228 end, | |
229 get = function(i) | |
230 return self.db.profile.disabledZones[i[#i]]; | |
231 end, | |
227 args = { | 232 args = { |
228 help = { | 233 help = { |
229 type = 'description', | 234 type = 'description', |
230 name = L['Toggle ICU automatic checking |cffcc0000off|r in the selected zones.'], | 235 name = L['Toggle ICU automatic checking |cffcc0000off|r in the selected zones.'], |
231 width = 'full', | 236 width = 'full', |
232 order = 0, | 237 order = 0, |
233 }, | 238 }, |
239 breakOne = { | |
240 type = 'description', | |
241 name = '', | |
242 order = 1, | |
243 width = 'full', | |
244 }, | |
245 enableAllZones = { | |
246 type = 'toggle', | |
247 name = L["Enable ICU in all zones"], | |
248 order = 2, | |
249 width = 'full', | |
250 set = function (i,v) | |
251 self.db.profile.enableAllZones = v; | |
252 self.options.args.zones.args.bwd.disabled = v; | |
253 self.options.args.zones.args.bot.disabled = v; | |
254 self.options.args.zones.args.tfw.disabled = v; | |
255 self.options.args.zones.args.bh.disabled = v; | |
256 end, | |
257 get = function (i) return self.db.profile.enableAllZones end, | |
258 }, | |
259 breakTwo = { | |
260 type = 'description', | |
261 name = '', | |
262 order = 3, | |
263 width = 'full', | |
264 }, | |
234 bwd = { | 265 bwd = { |
235 type = 'toggle', | 266 type = 'toggle', |
236 name = L["Blackwing Descent"], | 267 name = L["Blackwing Descent"], |
237 width = 'double', | 268 width = 'double', |
269 disabled = self.db.profile.enableAllZones, | |
238 }, | 270 }, |
239 bot = { | 271 bot = { |
240 type = 'toggle', | 272 type = 'toggle', |
241 name = L["Bastion of Twilight"], | 273 name = L["Bastion of Twilight"], |
242 width = 'double', | 274 width = 'double', |
275 disabled = self.db.profile.enableAllZones, | |
243 }, | 276 }, |
244 tfw = { | 277 tfw = { |
245 type = 'toggle', | 278 type = 'toggle', |
246 name = L["Throne of the Four Winds"], | 279 name = L["Throne of the Four Winds"], |
247 width = 'double', | 280 width = 'double', |
281 disabled = self.db.profile.enableAllZones, | |
248 }, | 282 }, |
249 bh = { | 283 bh = { |
250 type = 'toggle', | 284 type = 'toggle', |
251 name = L["Baradin Hold"], | 285 name = L["Baradin Hold"], |
252 width = 'double', | 286 width = 'double', |
253 }, | 287 disabled = self.db.profile.enableAllZones, |
288 }, | |
289 | |
254 } | 290 } |
255 }, | 291 }, |
256 profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db), | 292 profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db), |
257 }, | 293 }, |
258 } | 294 } |
259 return options | 295 return options |
260 end | 296 end |
261 | 297 |
262 function icu:inspectRaid(silent,automatic) | 298 function icu:inspectRaid(silent,automatic) |
263 -- Check if any zones have been disabled | 299 -- Check if any zones have been disabled |
264 if #self.db.profile.disabledZones > 0 and automatic then | 300 if automatic and not self.db.profile.enableAllZones then |
265 local currentZone = GetRealZoneText(); | 301 local currentZone = GetRealZoneText(); |
266 | 302 |
267 for i = 1, #self.db.profile.disabledZones do | 303 for i = 1, #self.db.profile.disabledZones do |
268 if currentZone == self.db.profile.disabledZones[i] then return true end | 304 if currentZone == self.db.profile.disabledZones[i] and self.db.profile.disabledZones[i] then |
305 --@debug@ | |
306 print(currentZone,self.db.profile.disabledZones[i],"Cancelling ICU inspection"); | |
307 --@end-debug@ | |
308 return true | |
309 end | |
269 end | 310 end |
270 end | 311 end |
271 | 312 |
313 local icuAd = ""; | |
314 | |
272 -- Not in a raid group | 315 -- Not in a raid group |
273 local icuAd = ""; | |
274 | |
275 if GetNumRaidMembers() == 0 then | 316 if GetNumRaidMembers() == 0 then |
276 return true | 317 return true |
277 end | 318 end |
278 | 319 |
279 if self.db.profile.advertiseICU then | 320 if self.db.profile.advertiseICU then |