Xiiph@0
|
1 local L = LibStub("AceLocale-3.0"):GetLocale("ICU")
|
Xiiph@0
|
2 if not L then return end
|
Xiiph@0
|
3
|
Xiiph@0
|
4 local icu = LibStub("AceAddon-3.0"):NewAddon("ICU", "AceEvent-3.0", "AceTimer-3.0");
|
Xiiph@0
|
5
|
Xiiph@2
|
6 -- UTF8
|
Xiiph@0
|
7 -- Accepted flasks
|
Xiiph@0
|
8 local flaskID = {
|
Xiiph@0
|
9 79469, -- Flask of Steelskin
|
Xiiph@0
|
10 79470, -- Flask of the Draconic Mind
|
Xiiph@0
|
11 79471, -- Flask of the Winds
|
Xiiph@0
|
12 79472, -- Flask of Titanic Strength
|
Xiiph@0
|
13 94160, -- Flask of Flowing Water
|
Xiiph@0
|
14 };
|
Xiiph@0
|
15
|
Xiiph@0
|
16 -- Accepted well-fed buffs
|
Xiiph@0
|
17 local foodID = {
|
Xiiph@0
|
18 87545, -- 90 Strength
|
Xiiph@0
|
19 87546, -- 90 Agility
|
Xiiph@0
|
20 87547, -- 90 Intellect
|
Xiiph@0
|
21 87548, -- 90 Spirit
|
Xiiph@0
|
22 87549, -- 90 Mastery
|
Xiiph@0
|
23 87550, -- 90 Hit
|
Xiiph@0
|
24 87551, -- 90 Crit
|
Xiiph@0
|
25 87552, -- 90 Haste
|
Xiiph@0
|
26 };
|
Xiiph@0
|
27
|
Xiiph@0
|
28
|
Xiiph@0
|
29 local minFlaskDuration = 10;
|
Xiiph@0
|
30 local noFlask, noFood, hasLowDuration = {},{},{};
|
Xiiph@0
|
31
|
Xiiph@0
|
32 local defaults = {
|
Xiiph@0
|
33 profile = {
|
Xiiph@0
|
34 checkFlask = true,
|
Xiiph@0
|
35 checkFood = true,
|
Xiiph@0
|
36 checkLowFlaskDuration = true,
|
Xiiph@0
|
37 remindRaider = true,
|
Xiiph@0
|
38 reportResults = true,
|
Xiiph@0
|
39 reportDestination = "OFFICER",
|
Xiiph@0
|
40 manualCheckOnly = false,
|
Xiiph@0
|
41 checkAfterFinish = true,
|
Xiiph@0
|
42 advertiseICU = true,
|
Xiiph@0
|
43 noFoodMessage = L["Well Fed reminder!"],
|
Xiiph@0
|
44 noFlaskMessage = L["Flask reminder!"],
|
Xiiph@0
|
45 lowFlaskDurationMessage = L["Your Flask runs out in less than 10 minutes!"],
|
Xiiph@1
|
46 disabledZones = {},
|
Xiiph@3
|
47 enableAllZones = true,
|
Xiiph@0
|
48 }
|
Xiiph@0
|
49 }
|
Xiiph@0
|
50
|
Xiiph@0
|
51 function icu:OnInitialize()
|
Xiiph@0
|
52 self.db = LibStub("AceDB-3.0"):New("icuDB", defaults, true)
|
Xiiph@0
|
53
|
Xiiph@0
|
54 self.db.RegisterCallback(self, "OnProfileChanged", "refreshConfig")
|
Xiiph@0
|
55 self.db.RegisterCallback(self, "OnProfileCopied", "refreshConfig")
|
Xiiph@0
|
56 self.db.RegisterCallback(self, "OnProfileReset", "refreshConfig")
|
Xiiph@0
|
57
|
Xiiph@0
|
58 self.options = self:getOptions()
|
Xiiph@0
|
59
|
Xiiph@0
|
60 local AceConfig = LibStub("AceConfig-3.0")
|
Xiiph@0
|
61 local AceConfigDialog = LibStub("AceConfigDialog-3.0")
|
Xiiph@0
|
62
|
Xiiph@0
|
63 AceConfig:RegisterOptionsTable("ICU", self.options, {"icu"})
|
Xiiph@0
|
64
|
Xiiph@0
|
65 AceConfigDialog:AddToBlizOptions("ICU", nil, nil, "general")
|
Xiiph@1
|
66 AceConfigDialog:AddToBlizOptions("ICU", "Whispers","ICU","messages")
|
Xiiph@1
|
67 AceConfigDialog:AddToBlizOptions("ICU", "Disabled Zones","ICU","zones")
|
Xiiph@3
|
68 AceConfigDialog:AddToBlizOptions("ICU", "Profiles","ICU","profile")
|
Xiiph@0
|
69 end
|
Xiiph@0
|
70
|
Xiiph@0
|
71 function icu:refreshConfig()
|
Xiiph@0
|
72 --print("ICU: Config refreshing ...");
|
Xiiph@0
|
73
|
Xiiph@0
|
74 if self.db.profile.manualCheckOnly then
|
Xiiph@0
|
75 icu:UnregisterEvent("READY_CHECK");
|
Xiiph@0
|
76 else
|
Xiiph@0
|
77 icu:RegisterEvent("READY_CHECK");
|
Xiiph@0
|
78 end
|
Xiiph@0
|
79
|
Xiiph@0
|
80 --print("ICU: Config refreshed!");
|
Xiiph@0
|
81 end
|
Xiiph@0
|
82
|
Xiiph@0
|
83 function icu:config()
|
Xiiph@0
|
84 InterfaceOptionsFrame_OpenToCategory("ICU")
|
Xiiph@0
|
85 end
|
Xiiph@0
|
86
|
Xiiph@0
|
87 function icu:getOptions()
|
Xiiph@0
|
88 local options = {
|
Xiiph@0
|
89 handler = icu,
|
Xiiph@0
|
90 type = 'group',
|
Xiiph@0
|
91 args = {
|
Xiiph@0
|
92 config = {
|
Xiiph@0
|
93 name = L["Options"],
|
Xiiph@0
|
94 desc = L["Shows the blizzard addon configuration window"],
|
Xiiph@0
|
95 type = 'execute',
|
Xiiph@0
|
96 func = "config",
|
Xiiph@0
|
97 hidden = true,
|
Xiiph@0
|
98 cmdHidden = false,
|
Xiiph@0
|
99 },
|
Xiiph@0
|
100 check = {
|
Xiiph@0
|
101 name = L["Raid Check"],
|
Xiiph@0
|
102 desc = L["Checks the raid for flask/food buffs"],
|
Xiiph@0
|
103 type = 'execute',
|
Xiiph@0
|
104 func = function() self:inspectRaid(false) end,
|
Xiiph@0
|
105 hidden = true,
|
Xiiph@0
|
106 cmdHidden = false,
|
Xiiph@0
|
107 },
|
Xiiph@0
|
108 quiet = {
|
Xiiph@0
|
109 name = L["Raid Check (Silent)"],
|
Xiiph@0
|
110 desc = L["Checks the raid for flask/food buffs, but does not remind raiders, regardless of other settings."],
|
Xiiph@0
|
111 type = 'execute',
|
Xiiph@0
|
112 func = function() self:inspectRaid(true) end,
|
Xiiph@0
|
113 hidden = true,
|
Xiiph@0
|
114 cmdHidden = false,
|
Xiiph@0
|
115 },
|
Xiiph@0
|
116 general = {
|
Xiiph@0
|
117 name = L["General Settings"],
|
Xiiph@0
|
118 type = 'group',
|
Xiiph@0
|
119 args = {
|
Xiiph@0
|
120 checkFlask = {
|
Xiiph@0
|
121 type = 'toggle',
|
Xiiph@0
|
122 name = L["Check for Flask"],
|
Xiiph@0
|
123 desc = L["Checks the raid for valid flasks and reports results"],
|
Xiiph@0
|
124 set = function(o,v,...) self.db.profile.checkFlask = v end,
|
Xiiph@0
|
125 get = function() return self.db.profile.checkFlask end,
|
Xiiph@0
|
126 },
|
Xiiph@0
|
127 checkLowFlaskDuration = {
|
Xiiph@0
|
128 type = 'toggle',
|
Xiiph@0
|
129 name = L["Flask expiration"],
|
Xiiph@0
|
130 desc = L["Check for soon to expire flask buffs"],
|
Xiiph@0
|
131 set = function(o,v,...) self.db.profile.checkLowFlaskDuration = v end,
|
Xiiph@0
|
132 get = function() return self.db.profile.checkLowFlaskDuration end,
|
Xiiph@0
|
133 },
|
Xiiph@0
|
134 checkFood = {
|
Xiiph@0
|
135 type = 'toggle',
|
Xiiph@0
|
136 name = L["Check for Food"],
|
Xiiph@0
|
137 desc = L["Checks the raid for valid food buffs and reports results"],
|
Xiiph@0
|
138 set = function(o,v,...) self.db.profile.checkFood = v end,
|
Xiiph@0
|
139 get = function() return self.db.profile.checkFood end,
|
Xiiph@0
|
140 },
|
Xiiph@0
|
141 advertiseICU = {
|
Xiiph@0
|
142 type = 'toggle',
|
Xiiph@0
|
143 name = L["Advertise ICU"],
|
Xiiph@0
|
144 desc = L["Let everyone know you are using ICU! Prefixes whispers and reports"],
|
Xiiph@0
|
145 set = function(o,v,...) self.db.profile.advertiseICU = v end,
|
Xiiph@0
|
146 get = function() return self.db.profile.advertiseICU end,
|
Xiiph@0
|
147 },
|
Xiiph@0
|
148 remindRaider = {
|
Xiiph@0
|
149 type = 'toggle',
|
Xiiph@0
|
150 name = L["Raid reminder"],
|
Xiiph@0
|
151 desc = L["Whisper the raider lacking (or soon to expire, if enabled) food/flask buff a reminder"],
|
Xiiph@0
|
152 set = function(o,v,...) self.db.profile.remindRaider = v end,
|
Xiiph@0
|
153 get = function() return self.db.profile.remindRaider end,
|
Xiiph@0
|
154 },
|
Xiiph@0
|
155 reportResults = {
|
Xiiph@0
|
156 type = 'toggle',
|
Xiiph@0
|
157 name = L["Report results"],
|
Xiiph@0
|
158 desc = L["Report the results after finishing"],
|
Xiiph@0
|
159 set = function(o,v,...) self.db.profile.reportResults = v end,
|
Xiiph@0
|
160 get = function() return self.db.profile.reportResults end,
|
Xiiph@0
|
161 },
|
Xiiph@0
|
162 reportDestination = {
|
Xiiph@0
|
163 type = 'select',
|
Xiiph@0
|
164 style = "dropdown",
|
Xiiph@0
|
165 name = L["Report Destination"],
|
Xiiph@0
|
166 desc = L["Report the results to the following channel"],
|
Xiiph@0
|
167 values = {
|
Xiiph@0
|
168 ["OFFICER"] = L["Officer"],
|
Xiiph@0
|
169 ["SAY"] = L["Say"],
|
Xiiph@0
|
170 ["RAID"] = L["Raid"],
|
Xiiph@0
|
171 ["GUILD"] = L["Guild"],
|
Xiiph@0
|
172 ["SELF"] = L["Self"],
|
Xiiph@0
|
173 },
|
Xiiph@0
|
174 set = function(o,v,...) self.db.profile.reportDestination = v end,
|
Xiiph@0
|
175 get = function() return self.db.profile.reportDestination end,
|
Xiiph@0
|
176 },
|
Xiiph@0
|
177 manualCheckOnly = {
|
Xiiph@0
|
178 type = 'toggle',
|
Xiiph@0
|
179 name = L["Manual checks only"],
|
Xiiph@0
|
180 desc = L["Only perform buff checks if initiated manually (via /icu check)"],
|
Xiiph@0
|
181 set = function(o,v,...) self.db.profile.manualCheckOnly = v; self:refreshConfig() end,
|
Xiiph@0
|
182 get = function() return self.db.profile.manualCheckOnly end,
|
Xiiph@0
|
183 },
|
Xiiph@0
|
184 checkAfterFinish = {
|
Xiiph@0
|
185 type = 'toggle',
|
Xiiph@0
|
186 name = L["Check after readycheck"],
|
Xiiph@0
|
187 desc = L["Don't check buffs until ready check has finished (or timed out)"],
|
Xiiph@0
|
188 set = function(o,v,...) self.db.profile.checkAfterFinish = v end,
|
Xiiph@0
|
189 get = function() return self.db.profile.checkAfterFinish end,
|
Xiiph@0
|
190 },
|
Xiiph@1
|
191 },
|
Xiiph@1
|
192 },
|
Xiiph@1
|
193 messages = {
|
Xiiph@1
|
194 name = L["Messages"],
|
Xiiph@1
|
195 type = 'group',
|
Xiiph@1
|
196 args = {
|
Xiiph@1
|
197 noFlaskMessage = {
|
Xiiph@1
|
198 type = 'input',
|
Xiiph@1
|
199 width = 'double',
|
Xiiph@1
|
200 name = L["Flask reminder"],
|
Xiiph@1
|
201 desc = L["Message whispered to raiders missing a cataclysm flask"],
|
Xiiph@1
|
202 set = function(o,v,...) self.db.profile.noFlaskMessage = v end,
|
Xiiph@1
|
203 get = function() return self.db.profile.noFlaskMessage end,
|
Xiiph@1
|
204 },
|
Xiiph@1
|
205 lowFlaskDurationMessage = {
|
Xiiph@1
|
206 type = 'input',
|
Xiiph@1
|
207 width = 'double',
|
Xiiph@1
|
208 name = L["Flask expiration"],
|
Xiiph@1
|
209 desc = L["Message whispered to raiders with less than 10 minutes left on their flask"],
|
Xiiph@1
|
210 set = function(o,v,...) self.db.profile.lowFlaskDurationMessage = v end,
|
Xiiph@1
|
211 get = function() return self.db.profile.lowFlaskDurationMessage end,
|
Xiiph@1
|
212 },
|
Xiiph@1
|
213 noFoodMessage = {
|
Xiiph@1
|
214 type = 'input',
|
Xiiph@1
|
215 width = 'double',
|
Xiiph@1
|
216 name = L["Food reminder"],
|
Xiiph@1
|
217 desc = L["Message whispered to raiders missing the well-fed buff"],
|
Xiiph@1
|
218 set = function(o,v,...) self.db.profile.noFoodMessage = v end,
|
Xiiph@1
|
219 get = function() return self.db.profile.noFoodMessage end,
|
Xiiph@1
|
220 },
|
Xiiph@1
|
221 },
|
Xiiph@1
|
222 },
|
Xiiph@1
|
223 zones = {
|
Xiiph@1
|
224 name = L["Disabled Zones"],
|
Xiiph@1
|
225 type = 'group',
|
Xiiph@3
|
226 set = function(i,v)
|
Xiiph@3
|
227 self.db.profile.disabledZones[i[#i]] = v;
|
Xiiph@3
|
228 end,
|
Xiiph@3
|
229 get = function(i)
|
Xiiph@3
|
230 return self.db.profile.disabledZones[i[#i]];
|
Xiiph@3
|
231 end,
|
Xiiph@1
|
232 args = {
|
Xiiph@1
|
233 help = {
|
Xiiph@1
|
234 type = 'description',
|
Xiiph@1
|
235 name = L['Toggle ICU automatic checking |cffcc0000off|r in the selected zones.'],
|
Xiiph@1
|
236 width = 'full',
|
Xiiph@1
|
237 order = 0,
|
Xiiph@0
|
238 },
|
Xiiph@3
|
239 breakOne = {
|
Xiiph@3
|
240 type = 'description',
|
Xiiph@3
|
241 name = '',
|
Xiiph@3
|
242 order = 1,
|
Xiiph@3
|
243 width = 'full',
|
Xiiph@3
|
244 },
|
Xiiph@3
|
245 enableAllZones = {
|
Xiiph@3
|
246 type = 'toggle',
|
Xiiph@3
|
247 name = L["Enable ICU in all zones"],
|
Xiiph@3
|
248 order = 2,
|
Xiiph@3
|
249 width = 'full',
|
Xiiph@3
|
250 set = function (i,v)
|
Xiiph@3
|
251 self.db.profile.enableAllZones = v;
|
Xiiph@3
|
252 self.options.args.zones.args.bwd.disabled = v;
|
Xiiph@3
|
253 self.options.args.zones.args.bot.disabled = v;
|
Xiiph@3
|
254 self.options.args.zones.args.tfw.disabled = v;
|
Xiiph@3
|
255 self.options.args.zones.args.bh.disabled = v;
|
Xiiph@3
|
256 end,
|
Xiiph@3
|
257 get = function (i) return self.db.profile.enableAllZones end,
|
Xiiph@3
|
258 },
|
Xiiph@3
|
259 breakTwo = {
|
Xiiph@3
|
260 type = 'description',
|
Xiiph@3
|
261 name = '',
|
Xiiph@3
|
262 order = 3,
|
Xiiph@3
|
263 width = 'full',
|
Xiiph@3
|
264 },
|
Xiiph@1
|
265 bwd = {
|
Xiiph@1
|
266 type = 'toggle',
|
Xiiph@1
|
267 name = L["Blackwing Descent"],
|
Xiiph@1
|
268 width = 'double',
|
Xiiph@3
|
269 disabled = self.db.profile.enableAllZones,
|
Xiiph@0
|
270 },
|
Xiiph@1
|
271 bot = {
|
Xiiph@1
|
272 type = 'toggle',
|
Xiiph@1
|
273 name = L["Bastion of Twilight"],
|
Xiiph@1
|
274 width = 'double',
|
Xiiph@3
|
275 disabled = self.db.profile.enableAllZones,
|
Xiiph@0
|
276 },
|
Xiiph@1
|
277 tfw = {
|
Xiiph@1
|
278 type = 'toggle',
|
Xiiph@1
|
279 name = L["Throne of the Four Winds"],
|
Xiiph@1
|
280 width = 'double',
|
Xiiph@3
|
281 disabled = self.db.profile.enableAllZones,
|
Xiiph@1
|
282 },
|
Xiiph@1
|
283 bh = {
|
Xiiph@1
|
284 type = 'toggle',
|
Xiiph@1
|
285 name = L["Baradin Hold"],
|
Xiiph@1
|
286 width = 'double',
|
Xiiph@3
|
287 disabled = self.db.profile.enableAllZones,
|
Xiiph@1
|
288 },
|
Xiiph@3
|
289
|
Xiiph@0
|
290 }
|
Xiiph@0
|
291 },
|
Xiiph@0
|
292 profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db),
|
Xiiph@0
|
293 },
|
Xiiph@0
|
294 }
|
Xiiph@0
|
295 return options
|
Xiiph@0
|
296 end
|
Xiiph@0
|
297
|
Xiiph@1
|
298 function icu:inspectRaid(silent,automatic)
|
Xiiph@1
|
299 -- Check if any zones have been disabled
|
Xiiph@3
|
300 if automatic and not self.db.profile.enableAllZones then
|
Xiiph@1
|
301 local currentZone = GetRealZoneText();
|
Xiiph@1
|
302
|
Xiiph@1
|
303 for i = 1, #self.db.profile.disabledZones do
|
Xiiph@3
|
304 if currentZone == self.db.profile.disabledZones[i] and self.db.profile.disabledZones[i] then
|
Xiiph@3
|
305 --@debug@
|
Xiiph@3
|
306 print(currentZone,self.db.profile.disabledZones[i],"Cancelling ICU inspection");
|
Xiiph@3
|
307 --@end-debug@
|
Xiiph@3
|
308 return true
|
Xiiph@3
|
309 end
|
Xiiph@1
|
310 end
|
Xiiph@1
|
311 end
|
Xiiph@1
|
312
|
Xiiph@0
|
313 local icuAd = "";
|
Xiiph@0
|
314
|
Xiiph@3
|
315 -- Not in a raid group
|
Xiiph@0
|
316 if GetNumRaidMembers() == 0 then
|
Xiiph@0
|
317 return true
|
Xiiph@0
|
318 end
|
Xiiph@0
|
319
|
Xiiph@0
|
320 if self.db.profile.advertiseICU then
|
Xiiph@0
|
321 icuAd = L["ICU"] .. ": ";
|
Xiiph@0
|
322 else
|
Xiiph@0
|
323 icuAd = "";
|
Xiiph@0
|
324 end
|
Xiiph@0
|
325
|
Xiiph@0
|
326 for i = 1, GetNumRaidMembers() do
|
Xiiph@0
|
327 local raider = GetRaidRosterInfo(i);
|
Xiiph@0
|
328 if raider then
|
Xiiph@0
|
329
|
Xiiph@0
|
330 local hasFood, hasFlask, hasLowDuration = icu:validateBuffs(i);
|
Xiiph@0
|
331
|
Xiiph@0
|
332 if not hasFood and self.db.profile.checkFood then
|
Xiiph@0
|
333 noFood[#noFood+1] = raider;
|
Xiiph@0
|
334 -- Tell player
|
Xiiph@0
|
335 if self.db.profile.remindRaider and not silent then
|
Xiiph@0
|
336 SendChatMessage(icuAd .. self.db.profile.noFoodMessage,"WHISPER",nil,raider);
|
Xiiph@0
|
337 end
|
Xiiph@0
|
338 end
|
Xiiph@0
|
339
|
Xiiph@0
|
340 if not hasFlask and self.db.profile.checkFlask then
|
Xiiph@0
|
341 noFlask[#noFlask+1] = raider;
|
Xiiph@0
|
342 -- Tell player
|
Xiiph@0
|
343 if self.db.profile.remindRaider and not silent then
|
Xiiph@0
|
344 SendChatMessage(icuAd .. self.db.profile.noFlaskMessage,"WHISPER",nil,raider);
|
Xiiph@0
|
345 end
|
Xiiph@0
|
346 elseif hasLowDuration and not silent then
|
Xiiph@0
|
347 if self.db.profile.remindRaider and self.db.profile.checkLowFlaskDuration then
|
Xiiph@0
|
348 SendChatMessage(icuAd .. self.db.profile.lowFlaskDurationMessage,"WHISPER",nil,raider);
|
Xiiph@0
|
349 end
|
Xiiph@0
|
350 end
|
Xiiph@0
|
351 end
|
Xiiph@0
|
352
|
Xiiph@0
|
353 end
|
Xiiph@0
|
354
|
Xiiph@0
|
355 if self.db.profile.reportResults and (#noFlask > 0 or #noFood > 0) and self.db.profile.advertiseICU and self.db.profile.reportDestination ~= "SELF" then
|
Xiiph@0
|
356 SendChatMessage("---- "..L["ICU"].." "..L["Report"].." ----",self.db.profile.reportDestination,nil,nil);
|
Xiiph@0
|
357 end
|
Xiiph@0
|
358
|
Xiiph@0
|
359 if self.db.profile.reportResults then
|
Xiiph@0
|
360 if #noFlask > 0 and self.db.profile.checkFlask then
|
Xiiph@0
|
361 local reportFlaskMessage = L["Missing Flask"]..": " .. table.concat(noFlask, ", ");
|
Xiiph@0
|
362
|
Xiiph@0
|
363 if self.db.profile.reportDestination == "SELF" then
|
Xiiph@0
|
364 DEFAULT_CHAT_FRAME:AddMessage(reportFlaskMessage);
|
Xiiph@0
|
365 else
|
Xiiph@0
|
366 SendChatMessage(reportFlaskMessage,self.db.profile.reportDestination,nil,nil);
|
Xiiph@0
|
367 end
|
Xiiph@0
|
368 end
|
Xiiph@0
|
369
|
Xiiph@0
|
370 if #noFood > 0 and self.db.profile.checkFood then
|
Xiiph@0
|
371 local reportFoodMessage = L["Missing Food"]..": " .. table.concat(noFood, ", ");
|
Xiiph@0
|
372
|
Xiiph@0
|
373 if self.db.profile.reportDestination == "SELF" then
|
Xiiph@0
|
374 DEFAULT_CHAT_FRAME:AddMessage(reportFoodMessage);
|
Xiiph@0
|
375 else
|
Xiiph@0
|
376 SendChatMessage(reportFoodMessage,self.db.profile.reportDestination,nil,nil);
|
Xiiph@0
|
377 end
|
Xiiph@0
|
378 end
|
Xiiph@0
|
379 end
|
Xiiph@0
|
380
|
Xiiph@0
|
381 noFlask, noFood, hasLowDuration = {},{},{};
|
Xiiph@0
|
382 end
|
Xiiph@0
|
383
|
Xiiph@0
|
384 function icu:validateBuffs(playerIndex)
|
Xiiph@0
|
385 local i = 1;
|
Xiiph@0
|
386 local hasFood, hasFlask, hasLowDuration = false, false, false;
|
Xiiph@0
|
387 local name, _, _, _, _, _, expirationTime, _, _, _, spellId = UnitBuff("raid"..playerIndex,i);
|
Xiiph@0
|
388
|
Xiiph@0
|
389 while name do
|
Xiiph@0
|
390 -- Check for food
|
Xiiph@0
|
391 if not hasFood then
|
Xiiph@0
|
392 for k,v in ipairs(foodID) do
|
Xiiph@0
|
393 if v == spellId then
|
Xiiph@0
|
394 hasFood = true;
|
Xiiph@0
|
395 end
|
Xiiph@0
|
396 end
|
Xiiph@0
|
397 end
|
Xiiph@0
|
398 -- Check for flask
|
Xiiph@0
|
399 if not hasFlask then
|
Xiiph@0
|
400 for k,v in ipairs(flaskID) do
|
Xiiph@0
|
401 if v == spellId then
|
Xiiph@0
|
402 hasFlask = true;
|
Xiiph@0
|
403 -- Check if low duration
|
Xiiph@0
|
404 if expirationTime and ((expirationTime-GetTime())/60) <= minFlaskDuration then
|
Xiiph@0
|
405 hasLowDuration = true;
|
Xiiph@0
|
406 end
|
Xiiph@0
|
407 end
|
Xiiph@0
|
408 end
|
Xiiph@0
|
409 end
|
Xiiph@0
|
410 i = i + 1;
|
Xiiph@0
|
411 name, _, _, _, _, _, expirationTime, _, _, _, spellId = UnitBuff("raid"..playerIndex,i);
|
Xiiph@0
|
412 end
|
Xiiph@0
|
413
|
Xiiph@0
|
414 return hasFood, hasFlask, hasLowDuration;
|
Xiiph@0
|
415 end
|
Xiiph@0
|
416
|
Xiiph@0
|
417 function icu:READY_CHECK()
|
Xiiph@0
|
418 --print("Ready check init!");
|
Xiiph@0
|
419 if self.db.profile.manualCheckOnly then
|
Xiiph@0
|
420 icu:UnregisterEvent("READY_CHECK");
|
Xiiph@0
|
421 return true;
|
Xiiph@0
|
422 end
|
Xiiph@0
|
423
|
Xiiph@0
|
424 if not self.db.profile.checkAfterFinish then
|
Xiiph@1
|
425 self:inspectRaid(nil,true);
|
Xiiph@0
|
426 else
|
Xiiph@0
|
427 self:ScheduleTimer("READY_CHECK_FINISHED", 30);
|
Xiiph@0
|
428 self:RegisterEvent("READY_CHECK_FINISHED");
|
Xiiph@0
|
429 end
|
Xiiph@0
|
430 end
|
Xiiph@0
|
431
|
Xiiph@0
|
432 function icu:READY_CHECK_FINISHED()
|
Xiiph@0
|
433 --print("Ready check finish!");
|
Xiiph@0
|
434 self:UnregisterEvent("READY_CHECK_FINISHED");
|
Xiiph@0
|
435 self:CancelAllTimers();
|
Xiiph@1
|
436 self:inspectRaid(nil,true);
|
Xiiph@0
|
437 end
|
Xiiph@0
|
438
|
Xiiph@1
|
439 function icu:getDB()
|
Xiiph@1
|
440 return self.db;
|
Xiiph@0
|
441 end
|
Xiiph@1
|
442
|
Xiiph@1
|
443 function filterChat(self, event, msg)
|
Xiiph@1
|
444 local db = icu:getDB();
|
Xiiph@1
|
445 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
|
Xiiph@1
|
446 end
|
Xiiph@1
|
447 ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER_ICU_INFORM", filterChat)
|
Xiiph@0
|
448
|
Xiiph@0
|
449 icu:RegisterEvent("READY_CHECK");
|
Xiiph@0
|
450
|
Xiiph@0
|
451 --@do-not-package@
|
Xiiph@0
|
452 function icu:test(cond)
|
Xiiph@0
|
453 if true and not cond then
|
Xiiph@0
|
454 print("First.")
|
Xiiph@0
|
455 else
|
Xiiph@0
|
456 print("Second.")
|
Xiiph@0
|
457 end
|
Xiiph@0
|
458 end
|
Xiiph@0
|
459
|
Xiiph@0
|
460 function icu:grabVar(var)
|
Xiiph@0
|
461 print(self.db.profile[var])
|
Xiiph@0
|
462 end
|
Xiiph@0
|
463
|
Xiiph@0
|
464 _G.icu = icu;
|
Xiiph@0
|
465 --@end-do-not-package@ |