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