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