vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 CT_RA_DebuffOptions = { };
2 CT_RADebuff_CureTable = { [1] = { } };
3 CT_RADebuff_ActionButtons = { };
4 CT_RADebuff_NamePriorities = { };
5 CT_RADebuff_CureSpells = {
6 [CT_RA_PRIEST] = { [CT_RA_MAGIC] = CT_RA_DISPELMAGIC, [CT_RA_DISEASE] = { CT_RA_CUREDISEASE, CT_RA_ABOLISHDISEASE } },
7 [CT_RA_SHAMAN] = { [CT_RA_DISEASE] = CT_RA_CUREDISEASE, [CT_RA_POISON] = CT_RA_CUREPOISON },
8 [CT_RA_DRUID] = { [CT_RA_CURSE] = CT_RA_REMOVECURSE, [CT_RA_POISON] = { CT_RA_CUREPOISON, CT_RA_ABOLISHPOISON } },
9 [CT_RA_MAGE] = { [CT_RA_CURSE] = CT_RA_REMOVELESSERCURSE },
10 [CT_RA_PALADIN] = { [CT_RA_MAGIC] = CT_RA_CLEANSE, [CT_RA_POISON] = { CT_RA_PURIFY, CT_RA_CLEANSE }, [CT_RA_DISEASE] = { CT_RA_PURIFY, CT_RA_CLEANSE } }
11 };
12 CT_RADebuff_IgnoreDebuffs = {
13 [CT_RA_DREAMLESSSLEEP] = 1,
14 [CT_RA_GREATERDREAMLESSSLEEP] = 1,
15 [CT_RA_MINDVISION] = 1
16 };
17 CT_RA_DebuffTemplates = {
18 [1] = {
19 ["debuffName"] = "Soul Burn",
20 ["name"] = "Soul Burn",
21 ["debuffDesc"] = ".*",
22 ["cureOrder"] = {
23 [1] = 1,
24 [2] = 8,
25 [3] = 15,
26 [4] = 16,
27 [5] = 17,
28 [6] = 10,
29 [7] = 11,
30 [8] = 12,
31 [9] = 14,
32 [10] = 9,
33 [11] = 13,
34 [12] = 5,
35 [13] = 6,
36 [14] = 7,
37 },
38 ["affectClasses"] = {
39 ["Warrior"] = 1,
40 ["Paladin"] = 1,
41 ["Shaman"] = 1,
42 ["Rogue"] = 1,
43 ["Mage"] = 1,
44 ["Pets"] = 1,
45 ["Druid"] = 1,
46 ["Priest"] = 1,
47 ["Hunter"] = 1,
48 ["Warlock"] = 1,
49 },
50 ["debuffType"] = ".*",
51 },
52 [2] = {
53 ["debuffName"] = "Mark of Kazzak",
54 ["name"] = "Mark of Kazzak",
55 ["debuffDesc"] = ".*",
56 ["cureOrder"] = {
57 [1] = 1,
58 [2] = 2,
59 [3] = 3,
60 [4] = 4,
61 [5] = 5,
62 [6] = 6,
63 [7] = 7,
64 },
65 ["affectClasses"] = {
66 ["Paladin"] = 1,
67 ["Shaman"] = 1,
68 ["Mage"] = 1,
69 ["Pets"] = 1,
70 ["Druid"] = 1,
71 ["Priest"] = 1,
72 ["Hunter"] = 1,
73 ["Warlock"] = 1,
74 },
75 ["debuffType"] = ".*",
76 },
77 [3] = {
78 ["debuffName"] = "Twisted Reflection",
79 ["name"] = "Twisted Reflection",
80 ["debuffDesc"] = ".*",
81 ["cureOrder"] = {
82 [1] = 1,
83 [2] = 2,
84 [3] = 3,
85 [4] = 4,
86 [5] = 5,
87 [6] = 6,
88 [7] = 7,
89 },
90 ["affectClasses"] = {
91 ["Warrior"] = 1,
92 ["Paladin"] = 1,
93 ["Shaman"] = 1,
94 ["Rogue"] = 1,
95 ["Mage"] = 1,
96 ["Pets"] = 1,
97 ["Druid"] = 1,
98 ["Priest"] = 1,
99 ["Hunter"] = 1,
100 ["Warlock"] = 1,
101 },
102 ["debuffType"] = ".*",
103 },
104 [4] = {
105 ["debuffName"] = "Dominate Mind",
106 ["name"] = "Dominate Mind",
107 ["debuffDesc"] = ".*",
108 ["cureOrder"] = {
109 [1] = 8,
110 [2] = 9,
111 [3] = 1,
112 [4] = 2,
113 [5] = 3,
114 [6] = 4,
115 [7] = 5,
116 [8] = 6,
117 [9] = 7,
118 },
119 ["affectClasses"] = {
120 ["Warrior"] = 1,
121 ["Paladin"] = 1,
122 ["Shaman"] = 1,
123 ["Rogue"] = 1,
124 ["Mage"] = 1,
125 ["Pets"] = 1,
126 ["Druid"] = 1,
127 ["Priest"] = 1,
128 ["Hunter"] = 1,
129 ["Warlock"] = 1,
130 },
131 ["debuffType"] = ".*",
132 },
133 [5] = {
134 ["debuffName"] = "Ignite Mana",
135 ["name"] = "Ignite Mana",
136 ["debuffDesc"] = ".*",
137 ["cureOrder"] = {
138 [1] = 1,
139 [2] = 2,
140 [3] = 3,
141 [4] = 4,
142 [5] = 5,
143 [6] = 7,
144 [7] = 6,
145 [8] = 8,
146 },
147 ["affectClasses"] = {
148 ["Paladin"] = 1,
149 ["Shaman"] = 1,
150 ["Mage"] = 1,
151 ["Pets"] = 1,
152 ["Druid"] = 1,
153 ["Priest"] = 1,
154 ["Hunter"] = 1,
155 ["Warlock"] = 1,
156 },
157 ["debuffType"] = ".*",
158 },
159 [6] = {
160 ["debuffName"] = "Mind Control",
161 ["name"] = "Mind Control",
162 ["debuffDesc"] = ".*",
163 ["cureOrder"] = {
164 [1] = 1,
165 [2] = 2,
166 [3] = 3,
167 [4] = 4,
168 [5] = 5,
169 [6] = 6,
170 [7] = 7,
171 },
172 ["affectClasses"] = {
173 ["Warrior"] = 1,
174 ["Paladin"] = 1,
175 ["Shaman"] = 1,
176 ["Rogue"] = 1,
177 ["Mage"] = 1,
178 ["Pets"] = 1,
179 ["Druid"] = 1,
180 ["Priest"] = 1,
181 ["Hunter"] = 1,
182 ["Warlock"] = 1,
183 },
184 ["debuffType"] = ".*",
185 },
186 [7] = {
187 ["debuffName"] = ".*",
188 ["name"] = "Silencing Spells",
189 ["debuffDesc"] = ".*Cannot cast spells.*",
190 ["cureOrder"] = {
191 [1] = 1,
192 [2] = 2,
193 [3] = 3,
194 [4] = 4,
195 [5] = 5,
196 [6] = 6,
197 [7] = 7,
198 },
199 ["affectClasses"] = {
200 ["Warrior"] = 1,
201 ["Paladin"] = 1,
202 ["Shaman"] = 1,
203 ["Mage"] = 1,
204 ["Pets"] = 1,
205 ["Druid"] = 1,
206 ["Priest"] = 1,
207 ["Hunter"] = 1,
208 ["Warlock"] = 1,
209 },
210 ["debuffType"] = ".*",
211 },
212 [8] = {
213 ["debuffName"] = ".*Polymorph.*",
214 ["name"] = "Polymorph",
215 ["debuffDesc"] = ".*",
216 ["cureOrder"] = {
217 [1] = 1,
218 [2] = 2,
219 [3] = 3,
220 [4] = 4,
221 [5] = 5,
222 [6] = 6,
223 [7] = 7,
224 },
225 ["affectClasses"] = {
226 ["Warrior"] = 1,
227 ["Paladin"] = 1,
228 ["Shaman"] = 1,
229 ["Rogue"] = 1,
230 ["Mage"] = 1,
231 ["Pets"] = 1,
232 ["Druid"] = 1,
233 ["Priest"] = 1,
234 ["Hunter"] = 1,
235 ["Warlock"] = 1,
236 },
237 ["debuffType"] = ".*",
238 },
239 [9] = {
240 ["debuffName"] = ".*",
241 ["name"] = "All Spells",
242 ["debuffDesc"] = ".*",
243 ["cureOrder"] = {
244 [1] = 1,
245 [2] = 2,
246 [3] = 3,
247 [4] = 8,
248 [5] = 4,
249 [6] = 5,
250 [7] = 6,
251 [8] = 7,
252 },
253 ["affectClasses"] = {
254 ["Warrior"] = 1,
255 ["Paladin"] = 1,
256 ["Shaman"] = 1,
257 ["Rogue"] = 1,
258 ["Mage"] = 1,
259 ["Pets"] = 1,
260 ["Druid"] = 1,
261 ["Priest"] = 1,
262 ["Hunter"] = 1,
263 ["Warlock"] = 1,
264 },
265 ["debuffType"] = ".*",
266 },
267 }
268 CT_RADebuff_ClassIndexes = {
269 [CT_RA_WARRIOR] = 1,
270 [CT_RA_DRUID] = 2,
271 [CT_RA_MAGE] = 3,
272 [CT_RA_WARLOCK] = 4,
273 [CT_RA_ROGUE] = 5,
274 [CT_RA_HUNTER] = 6,
275 [CT_RA_PRIEST] = 7,
276 [CT_RA_PALADIN] = 8,
277 [CT_RA_SHAMAN] = 9
278 };
279 -- Thanks to the author of Decursive for the blacklist idea
280 CT_RADebuff_Blacklist = { };
281 CT_RADebuff_BlacklistTime = 3;
282 CT_RADebuff_Debug = 1;
283  
284 ----------------------------------------------------------------
285 -- CT_RADebuff_DebugMsg(msg) --
286 -- Prints a message if the debug flag is enabled. --
287 ----------------------------------------------------------------
288  
289 function CT_RADebuff_DebugMsg(msg)
290 if ( CT_RADebuff_Debug ) then
291 CT_Print(msg);
292 end
293 end
294  
295 ----------------------------------------------------------------
296 -- CT_RADebuff_ProcessBlacklist(elapsed) --
297 -- Processes the blacklist, removing people when --
298 -- they have been in there for three seconds. --
299 ----------------------------------------------------------------
300  
301 function CT_RADebuff_ProcessBlacklist(elapsed)
302 for k, v in CT_RADebuff_Blacklist do
303 CT_RADebuff_Blacklist[k] = v - elapsed;
304 if ( CT_RADebuff_Blacklist[k] <= 0 ) then
305 CT_RADebuff_Blacklist[k] = nil;
306 end
307 end
308 if ( CT_RADebuff_ResetCombat ) then
309 CT_RADebuff_ResetCombat = CT_RADebuff_ResetCombat - elapsed;
310 if ( CT_RADebuff_ResetCombat <= 0 ) then
311 CT_RADebuff_ResetCombat = nil;
312 if ( not CT_RADebuff_InCombat ) then
313 AttackTarget();
314 end
315 end
316 end
317 end
318  
319 ----------------------------------------------------------------
320 -- CT_RADebuff_UpdateCureTable() --
321 -- Updates the table holding all the debuffs. --
322 ----------------------------------------------------------------
323  
324 function CT_RADebuff_UpdateCureTable()
325 CT_RADebuff_CureTable = { };
326 if ( UnitExists("target") and ( UnitCanAttack("player", "target") or ( not UnitInRaid("target") and not UnitInParty("target") ) ) ) then
327 local useBuffs = UnitDebuff;
328 if ( UnitCanAttack("player", "target") and ( not UnitIsCharmed("target") or not UnitIsFriend("player", "target") ) ) then
329 useBuffs = UnitBuff;
330 end
331 local iIndex = 1;
332 -- Loop through the debuffs
333 while ( useBuffs("target", iIndex) ) do
334 -- Clear and set the tooltip
335 CT_RATooltipTextLeft1:SetText("");
336 CT_RATooltipTextRight1:SetText("");
337 CT_RATooltip:SetOwner(WorldFrame, "ANCHOR_NONE");
338 if ( useBuffs == UnitBuff ) then
339 CT_RATooltip:SetUnitBuff("target", iIndex);
340 else
341 CT_RATooltip:SetUnitDebuff("target", iIndex);
342 end
343 -- Control to make sure we have a new debuff
344 if ( CT_RATooltipTextLeft1:GetText() ~= "" ) then
345  
346 -- Fetch the data
347 local sName, sType, sDesc, iTblIndex = CT_RATooltipTextLeft1:GetText() or "", CT_RATooltipTextRight1:GetText() or "", CT_RATooltipTextLeft2:GetText() or "", -1;
348 if ( sType ~= "" and CT_RADebuff_CanCure(sType) and not CT_RADebuff_IgnoreDebuffs[(sName or "")] ) then
349 -- See if we can find the CT_RA_DebuffTemplates index
350 for k, v in CT_RA_DebuffTemplates do
351  
352 -- See if we have a match
353 if ( string.find(strlower(sName), strlower(v["debuffName"])) and string.find(strlower(sType), strlower(v["debuffType"])) and string.find(strlower(sDesc), strlower(v["debuffDesc"])) ) then
354 iTblIndex = k;
355 break;
356 end
357 end
358  
359 if ( iTblIndex > 0 and ( not CT_RADebuff_CureTable[2] or CT_RADebuff_CureTable[2] > iTblIndex ) ) then
360 -- Clean the table
361 CT_RADebuff_CureTable = {
362 [1] = {
363 { sName, sType, sDesc, "target", CT_RADebuff_ClassIndexes[UnitClass("target")], UnitHealth("target") }
364 },
365 [2] = iTblIndex
366 };
367  
368 elseif ( iTblIndex > 0 and iTblIndex == CT_RADebuff_CureTable[2] ) then
369 -- Add the data to the table, as well as class, health percentage, if the player is in your party or if the player is you
370 tinsert(CT_RADebuff_CureTable[1], { sName, sType, sDesc, "target", CT_RADebuff_ClassIndexes[UnitClass("target")], UnitHealth("target") });
371  
372 end
373 end
374 end
375  
376 iIndex = iIndex + 1;
377  
378 end
379 end
380 if ( GetNumRaidMembers() == 0 ) then
381 local iIndex = 1;
382  
383 -- Loop through the debuffs
384 while ( UnitDebuff("player", iIndex) ) do
385 -- Clear and set the tooltip
386 CT_RATooltipTextLeft1:SetText("");
387 CT_RATooltipTextRight1:SetText("");
388 CT_RATooltip:SetUnitDebuff("player", iIndex);
389  
390 -- Control to make sure we have a new debuff
391 if ( CT_RATooltipTextLeft1:GetText() ~= "" ) then
392 -- Fetch the data
393 local sName, sType, sDesc, iTblIndex = CT_RATooltipTextLeft1:GetText() or "", CT_RATooltipTextRight1:GetText() or "", CT_RATooltipTextLeft2:GetText() or "", -1;
394 if ( sType ~= "" and ( UIParent.GetEffectiveScale or CT_RADebuff_CanCure(sType) ) and not CT_RADebuff_IgnoreDebuffs[(sName or "")] ) then
395 -- See if we can find the CT_RA_DebuffTemplates index
396 for k, v in CT_RA_DebuffTemplates do
397  
398 -- See if we have a match
399 if ( string.find(strlower(sName), strlower(v["debuffName"])) and string.find(strlower(sType), strlower(v["debuffType"])) and string.find(strlower(sDesc), strlower(v["debuffDesc"])) ) then
400 iTblIndex = k;
401 break;
402 end
403 end
404  
405 if ( iTblIndex > 0 and ( not CT_RADebuff_CureTable[2] or CT_RADebuff_CureTable[2] > iTblIndex ) ) then
406 -- Clean the table
407 CT_RADebuff_CureTable = {
408 [1] = {
409 { sName, sType, sDesc, "player", CT_RADebuff_ClassIndexes[UnitClass("player")], UnitHealth("player") }
410 },
411 [2] = iTblIndex
412 };
413  
414 elseif ( iTblIndex > 0 and iTblIndex == CT_RADebuff_CureTable[2] ) then
415 -- Add the data to the table, as well as class, health percentage, if the player is in your party or if the player is you
416 tinsert(CT_RADebuff_CureTable[1], { sName, sType, sDesc, "player", CT_RADebuff_ClassIndexes[UnitClass("player")], UnitHealth("player") });
417  
418 end
419 end
420 end
421  
422 iIndex = iIndex + 1;
423  
424 end
425 if ( UnitExists("pet") ) then
426 local iIndex = 1;
427  
428 -- Loop through the debuffs
429 while ( UnitDebuff("pet", iIndex, 1) ) do
430 -- Clear and set the tooltip
431 CT_RATooltipTextLeft1:SetText("");
432 CT_RATooltipTextRight1:SetText("");
433 CT_RATooltip:SetUnitDebuff("pet", iIndex);
434  
435 -- Control to make sure we have a new debuff
436 if ( CT_RATooltipTextLeft1:GetText() ~= "" ) then
437  
438 -- Fetch the data
439 local sName, sType, sDesc, iTblIndex = CT_RATooltipTextLeft1:GetText() or "", CT_RATooltipTextRight1:GetText() or "", CT_RATooltipTextLeft2:GetText() or "", -1;
440 if ( sType ~= "" and ( UIParent.GetEffectiveScale or CT_RADebuff_CanCure(sType) ) and not CT_RADebuff_IgnoreDebuffs[(sName or "")] ) then
441 -- See if we can find the CT_RA_DebuffTemplates index
442 for k, v in CT_RA_DebuffTemplates do
443  
444 -- See if we have a match
445 if ( string.find(strlower(sName), strlower(v["debuffName"])) and string.find(strlower(sType), strlower(v["debuffType"])) and string.find(strlower(sDesc), strlower(v["debuffDesc"])) ) then
446 iTblIndex = k;
447 break;
448 end
449 end
450  
451 if ( iTblIndex > 0 and ( not CT_RADebuff_CureTable[2] or CT_RADebuff_CureTable[2] > iTblIndex ) ) then
452 -- Clean the table
453 CT_RADebuff_CureTable = {
454 [1] = {
455 { sName, sType, sDesc, "pet", CT_RADebuff_ClassIndexes[UnitClass("pet")], UnitHealth("pet") }
456 },
457 [2] = iTblIndex
458 };
459  
460 elseif ( iTblIndex > 0 and iTblIndex == CT_RADebuff_CureTable[2] ) then
461 -- Add the data to the table, as well as class, health percentage, if the player is in your party or if the player is you
462 tinsert(CT_RADebuff_CureTable[1], { sName, sType, sDesc, "pet", CT_RADebuff_ClassIndexes[UnitClass("pet")], UnitHealth("pet") });
463  
464 end
465 end
466 end
467  
468 iIndex = iIndex + 1;
469  
470 end
471 end
472 end
473 local prefix, func = "raid", GetNumRaidMembers;
474 if ( GetNumRaidMembers() == 0 and GetNumPartyMembers() > 0 ) then
475 prefix, func = "party", GetNumPartyMembers;
476 end
477 -- Loop through the players in the raid
478 for i = 1, func(), 1 do
479 if ( not UnitCanAttack("player", prefix .. i) or ( UnitIsCharmed(prefix .. i) and UnitIsFriend("player", prefix .. i) ) ) then
480 local iIndex = 1;
481  
482 -- Loop through the debuffs
483 while ( UnitDebuff(prefix .. i, iIndex, 1) ) do
484 -- Clear and set the tooltip
485 CT_RATooltipTextLeft1:SetText("");
486 CT_RATooltipTextRight1:SetText("");
487 CT_RATooltip:SetUnitDebuff(prefix .. i, iIndex);
488  
489 -- Control to make sure we have a new debuff
490 if ( CT_RATooltipTextLeft1:GetText() ~= "" ) then
491  
492 -- Fetch the data
493 local sName, sType, sDesc, iTblIndex = CT_RATooltipTextLeft1:GetText() or "", CT_RATooltipTextRight1:GetText() or "", CT_RATooltipTextLeft2:GetText() or "", -1;
494 if ( sType ~= "" and ( UIParent.GetEffectiveScale or CT_RADebuff_CanCure(sType) ) and not CT_RADebuff_IgnoreDebuffs[(sName or "")] ) then
495 -- See if we can find the CT_RA_DebuffTemplates index
496 for k, v in CT_RA_DebuffTemplates do
497  
498 -- See if we have a match
499 if ( string.find(strlower(sName), strlower(v["debuffName"])) and string.find(strlower(sType), strlower(v["debuffType"])) and string.find(strlower(sDesc), strlower(v["debuffDesc"])) ) then
500 iTblIndex = k;
501 break;
502 end
503 end
504  
505 if ( iTblIndex > 0 and ( not CT_RADebuff_CureTable[2] or CT_RADebuff_CureTable[2] > iTblIndex ) ) then
506 -- Clean the table
507 CT_RADebuff_CureTable = {
508 [1] = {
509 { sName, sType, sDesc, prefix .. i, CT_RADebuff_ClassIndexes[UnitClass(prefix .. i)], UnitHealth(prefix .. i) }
510 },
511 [2] = iTblIndex
512 };
513  
514 elseif ( iTblIndex > 0 and iTblIndex == CT_RADebuff_CureTable[2] ) then
515 -- Add the data to the table, as well as class, health percentage, if the player is in your party or if the player is you
516 tinsert(CT_RADebuff_CureTable[1], { sName, sType, sDesc, prefix .. i, CT_RADebuff_ClassIndexes[UnitClass(prefix .. i)], UnitHealth(prefix .. i) });
517  
518 end
519 end
520 end
521  
522 iIndex = iIndex + 1;
523  
524 end
525 end
526 if ( UnitExists(prefix .. "pet" .. i) and ( not UnitCanAttack("player", prefix .. "pet" .. i) or ( UnitIsCharmed(prefix .. "pet" .. i) and UnitIsFriend("player", prefix .. "pet" .. i) ) ) ) then
527 local iIndex = 1;
528 -- Loop through the debuffs
529 while ( UnitDebuff(prefix .. "pet" .. i, iIndex, 1) ) do
530 -- Clear and set the tooltip
531 CT_RATooltipTextLeft1:SetText("");
532 CT_RATooltipTextRight1:SetText("");
533 CT_RATooltip:SetUnitDebuff(prefix .. "pet" .. i, iIndex);
534  
535 -- Control to make sure we have a new debuff
536 if ( CT_RATooltipTextLeft1:GetText() ~= "" ) then
537  
538 -- Fetch the data
539 local sName, sType, sDesc, iTblIndex = CT_RATooltipTextLeft1:GetText() or "", CT_RATooltipTextRight1:GetText() or "", CT_RATooltipTextLeft2:GetText() or "", -1;
540 if ( sType ~= "" and ( UIParent.GetEffectiveScale or CT_RADebuff_CanCure(sType) ) and not CT_RADebuff_IgnoreDebuffs[(sName or "")] ) then
541 -- See if we can find the CT_RA_DebuffTemplates index
542 for k, v in CT_RA_DebuffTemplates do
543  
544 -- See if we have a match
545 if ( string.find(strlower(sName), strlower(v["debuffName"])) and string.find(strlower(sType), strlower(v["debuffType"])) and string.find(strlower(sDesc), strlower(v["debuffDesc"])) ) then
546 iTblIndex = k;
547 break;
548 end
549 end
550  
551 if ( iTblIndex > 0 and ( not CT_RADebuff_CureTable[2] or CT_RADebuff_CureTable[2] > iTblIndex ) ) then
552 -- Clean the table
553 CT_RADebuff_CureTable = {
554 [1] = {
555 { sName, sType, sDesc, prefix .. "pet" .. i, CT_RADebuff_ClassIndexes[UnitClass(prefix .. "pet" .. i)], UnitHealth(prefix .. "pet" .. i) }
556 },
557 [2] = iTblIndex
558 };
559  
560 elseif ( iTblIndex > 0 and iTblIndex == CT_RADebuff_CureTable[2] ) then
561 -- Add the data to the table, as well as class, health percentage, if the player is in your party or if the player is you
562 tinsert(CT_RADebuff_CureTable[1], { sName, sType, sDesc, prefix .. "pet" .. i, CT_RADebuff_ClassIndexes[UnitClass(prefix .. "pet" .. i)], UnitHealth(prefix .. "pet" .. i) });
563  
564 end
565 end
566 end
567  
568 iIndex = iIndex + 1;
569  
570 end
571 end
572 end
573 end
574  
575 ----------------------------------------------------------------
576 -- CT_RADebuff_BeginRangeCheck() --
577 -- Finds the first cure ability available and uses it for --
578 -- range measurement. --
579 ----------------------------------------------------------------
580  
581 function CT_RADebuff_BeginRangeCheck()
582 -- Returns:
583 -- nil -> Failure
584 -- 0 -> Success
585 -- 1 -> Success & Change target back
586 local shallSwitch = false;
587 if ( UnitExists("target") ) then
588 if ( CT_RADebuff_InCombat ) then
589 resetCombat = 1;
590 end
591 shallSwitch = true;
592 ClearTarget();
593 end
594  
595 for k, v in CT_RADebuff_CureSpells[UnitClass("player")] do
596 if ( type(v) == "table" ) then
597 for key, val in v do
598 if ( CT_RA_ClassSpells[val] ) then
599 CastSpell(CT_RA_ClassSpells[val]["spell"], CT_RA_ClassSpells[val]["tab"]+1);
600 break;
601 end
602 end
603 else
604 if ( CT_RA_ClassSpells[v] ) then
605 CastSpell(CT_RA_ClassSpells[v]["spell"], CT_RA_ClassSpells[v]["tab"]+1);
606 break;
607 end
608 end
609 end
610 if ( SpellIsTargeting() ) then
611 return 1, ( shallSwitch and 1 ) or 0;
612 else
613 return nil, ( shallSwitch and 1 ) or 0;
614 end
615 end
616 ----------------------------------------------------------------
617 -- CT_RADebuff_Cure() --
618 -- Cures the next person in the list, using the chosen order. --
619 -- This is where most of the curing stuff is done. --
620 ----------------------------------------------------------------
621 function CT_RADebuff_Cure()
622 if ( not CT_RADebuff_CureSpells[UnitClass("player")] ) then
623 return;
624 end
625 local cannotCast, cooldownStart, cooldownDuration, oorTargets;
626 for k, v in CT_RADebuff_CureSpells[UnitClass("player")] do
627 if ( type(v) == "table" ) then
628 for key, val in v do
629 if ( CT_RA_ClassSpells[val] ) then
630 cooldownStart, cooldownDuration = GetSpellCooldown(CT_RA_ClassSpells[val]["spell"], SpellBookFrame.bookType);
631 if ( cooldownStart > 0 and cooldownDuration > 0 ) then
632 cannotCast = true;
633 break;
634 end
635 end
636 end
637 else
638 if ( CT_RA_ClassSpells[v] ) then
639 cooldownStart, cooldownDuration = GetSpellCooldown(CT_RA_ClassSpells[v]["spell"], SpellBookFrame.bookType);
640 if ( cooldownStart > 0 and cooldownDuration > 0 ) then
641 cannotCast = true;
642 break;
643 end
644 end
645 end
646 end
647 if ( cannotCast ) then
648 return;
649 end
650 CT_RADebuff_UpdateCureTable();
651 local success, retarget = CT_RADebuff_BeginRangeCheck();
652 if ( not success ) then
653 -- We couldn't cast the spell for some reason...
654 SpellStopTargeting();
655 if ( retarget == 1 ) then
656 TargetLastTarget();
657 end
658 return;
659 end
660 -- Make sure we have an index
661 if ( CT_RADebuff_CureTable[2] ) then
662  
663 -- Process if we have a target to cure
664 local blacklistTable, blacklistUId, uId, tblIndex;
665 while ( getn(CT_RADebuff_CureTable[1]) > 0 ) do
666 uId, tblIndex = CT_RADebuff_PriorityCure(CT_RA_DebuffTemplates[CT_RADebuff_CureTable[2]]["cureOrder"], CT_RADebuff_CureTable[1], CT_RA_DebuffTemplates[CT_RADebuff_CureTable[2]]["affectClasses"]);
667 if ( uId ) then
668 if ( uId == "target" ) then
669 SpellStopCasting();
670 TargetLastTarget();
671 if ( not blacklistUId and CT_RADebuff_Blacklist[UnitName(uId)] ) then
672 blacklistUId, blacklistTable = ( blacklistUId or uId), ( blacklistTable or CT_RADebuff_CureTable[1][tblIndex] );
673 else
674 local shallReturn = CT_RADebuff_CureTarget(CT_RADebuff_CureTable[1][tblIndex][2], CT_RADebuff_CureTable[1][tblIndex][1], uId);
675 if ( shallReturn == 1 ) then
676 SpellStopTargeting();
677 if ( retarget == 1 ) then
678 TargetLastTarget();
679 if ( resetCombat ) then
680 CT_RADebuff_ResetCombat = 1;
681 end
682 end
683 return;
684 elseif ( not oorTargets and shallReturn == -1 ) then
685 oorTargets = { UnitName(uId), CT_RADebuff_CureTable[1][tblIndex][1], CT_RADebuff_CureTable[1][tblIndex][2] };
686 end
687 end
688 -- Redo the check since we cleared target and spell
689 success, retarget = CT_RADebuff_BeginRangeCheck();
690 if ( not success ) then
691 -- We couldn't cast the spell for some reason...
692 SpellStopTargeting();
693 if ( retarget == 1 ) then
694 TargetLastTarget();
695 end
696 return;
697 end
698 else
699 if ( not blacklistUId and CT_RADebuff_Blacklist[UnitName(uId)] ) then
700 blacklistUId, blacklistTable = ( blacklistUId or uId), ( blacklistTable or CT_RADebuff_CureTable[1][tblIndex] );
701 else
702 if ( SpellCanTargetUnit(uId) ) then
703 -- Unit could be cast upon! Grab the opportunity
704 local shallReturn = CT_RADebuff_CureTarget(CT_RADebuff_CureTable[1][tblIndex][2], CT_RADebuff_CureTable[1][tblIndex][1], uId);
705 if ( shallReturn == 1 ) then
706 SpellStopTargeting();
707 if ( retarget == 1 ) then
708 TargetLastTarget();
709 if ( resetCombat ) then
710 CT_RADebuff_ResetCombat = 1;
711 end
712 end
713 return;
714 end
715 elseif ( not oorTargets and shallReturn == -1 ) then
716 oorTargets = { UnitName(uId), CT_RADebuff_CureTable[1][tblIndex][1], CT_RADebuff_CureTable[1][tblIndex][2] };
717 end
718 end
719 end
720 elseif ( blacklistUId ) then
721 uId, tblIndex, cureBlacklisted = blacklistUId, 1, 1;
722 tinsert(CT_RADebuff_CureTable[1], 1, blacklistTable);
723 blacklistUId, blacklistTable = nil;
724 end
725 if ( tblIndex ) then
726 -- Remove the previous one, and check again
727 table.remove(CT_RADebuff_CureTable[1], tblIndex);
728 else
729 break;
730 end
731 end
732 if ( oorTargets ) then
733 -- We could not cure due to targets being out of range
734 CT_RA_Print("<CTRaid> Could not cure |c00FFFFFF" .. oorTargets[1] .. "|r of |c00FFFFFF" .. oorTargets[2] .. "|r (|c00FFFFFF" .. oorTargets[3] .. "|r) (out of range?).", 1, 0.5, 0);
735 end
736 end
737 SpellStopTargeting();
738 if ( retarget == 1 ) then
739 TargetLastTarget();
740 if ( resetCombat ) then
741 CT_RADebuff_ResetCombat = 1;
742 end
743 end
744 end
745  
746 function CT_RADebuff_Cure_DEPRECATED()
747 if ( not CT_RADebuff_CureSpells[UnitClass("player")] ) then
748 return;
749 end
750 local cannotCast, cooldownStart, cooldownDuration, oorTargets;
751 for k, v in CT_RADebuff_CureSpells[UnitClass("player")] do
752 if ( type(v) == "table" ) then
753 for key, val in v do
754 if ( CT_RA_ClassSpells[val] ) then
755 cooldownStart, cooldownDuration = GetSpellCooldown(CT_RA_ClassSpells[val]["spell"], SpellBookFrame.bookType);
756 if ( cooldownStart > 0 and cooldownDuration > 0 ) then
757 cannotCast = true;
758 break;
759 end
760 end
761 end
762 else
763 if ( CT_RA_ClassSpells[v] ) then
764 cooldownStart, cooldownDuration = GetSpellCooldown(CT_RA_ClassSpells[v]["spell"], SpellBookFrame.bookType);
765 if ( cooldownStart > 0 and cooldownDuration > 0 ) then
766 cannotCast = true;
767 break;
768 end
769 end
770 end
771 end
772 if ( cannotCast ) then
773 return;
774 end
775 CT_RADebuff_UpdateCureTable();
776  
777 -- Make sure we have an index
778 if ( CT_RADebuff_CureTable[2] ) then
779  
780 -- Process if we have a target to cure
781 local uId, tblIndex = CT_RADebuff_PriorityCure(CT_RA_DebuffTemplates[CT_RADebuff_CureTable[2]]["cureOrder"], CT_RADebuff_CureTable[1], CT_RA_DebuffTemplates[CT_RADebuff_CureTable[2]]["affectClasses"]);
782 local firstBlacklistId, firstBlacklistIndex, firstBlacklistTable, cureBlacklisted;
783 while ( uId ) do
784 if ( UnitIsVisible(uId) ) then
785 if ( not cureBlacklisted and CT_RADebuff_Blacklist[UnitName(uId)] ) then
786 firstBlacklistId, firstBlacklistIndex, firstBlacklistTable = ( firstBlacklistId or uId ), ( firstBlacklistIndex or tblIndex ), CT_RADebuff_CureTable[1][tblIndex];
787 else
788 local switchTarget, resetCombat;
789 if ( not UnitIsUnit("target", uId) ) then
790 TargetUnit(uId);
791 switchTarget = 1;
792 if ( CT_RADebuff_InCombat ) then
793 resetCombat = 1;
794 end
795 end
796 -- Make sure the target and the unit we're trying to cure are the same
797 if ( UnitIsUnit(uId, "target") ) then
798 -- Shall we perform a range check?
799  
800 if ( CT_RADebuff_ActionButtons[CT_RADebuff_CureTable[1][tblIndex][2]] ) then
801 -- Make sure the spell is in range
802 if ( IsActionInRange(CT_RADebuff_ActionButtons[CT_RADebuff_CureTable[1][tblIndex][2]][2]) == 1 ) then
803 local shallReturn = CT_RADebuff_CureTarget(CT_RADebuff_CureTable[1][tblIndex][2], CT_RADebuff_CureTable[1][tblIndex][1], "target");
804 if ( switchTarget ) then
805 TargetLastTarget();
806 switchTarget = nil;
807 if ( resetCombat ) then
808 CT_RADebuff_ResetCombat = 1;
809 end
810 end
811 if ( shallReturn ) then
812 return;
813 end
814 elseif ( not oorTargets ) then
815 oorTargets = { UnitName(uId), CT_RADebuff_CureTable[1][tblIndex][1], CT_RADebuff_CureTable[1][tblIndex][2] };
816 end
817 else
818 -- If not, just try to target and cure
819 local shallReturn = CT_RADebuff_CureTarget(CT_RADebuff_CureTable[1][tblIndex][2], CT_RADebuff_CureTable[1][tblIndex][1], "target");
820 if ( switchTarget ) then
821 TargetLastTarget();
822 switchTarget = nil;
823 if ( resetCombat ) then
824 CT_RADebuff_ResetCombat = 1;
825 end
826 end
827 if ( shallReturn ) then
828 return;
829 end
830 end
831  
832 -- Target the previous target
833 if ( switchTarget ) then
834 TargetLastTarget();
835 if ( resetCombat ) then
836 CT_RADebuff_ResetCombat = 1;
837 end
838 end
839  
840 elseif ( switchTarget and UnitIsUnit("target", uId) ) then
841 TargetLastTarget();
842 if ( resetCombat ) then
843 CT_RADebuff_ResetCombat = 1;
844 end
845 end
846 end
847 end
848 -- Remove the previous one, and check again
849 table.remove(CT_RADebuff_CureTable[1], tblIndex);
850 uId, tblIndex = CT_RADebuff_PriorityCure(CT_RA_DebuffTemplates[CT_RADebuff_CureTable[2]]["cureOrder"], CT_RADebuff_CureTable[1], CT_RA_DebuffTemplates[CT_RADebuff_CureTable[2]]["affectClasses"]);
851 if ( not uId and firstBlacklistId ) then
852 uId, tblIndex, cureBlacklisted = firstBlacklistId, firstBlacklistIndex, 1;
853 tinsert(CT_RADebuff_CureTable[1], tblIndex, firstBlacklistTable);
854 firstBlacklistId, firstBlacklistIndex, firstBlacklistTable = nil, nil, nil;
855 end
856 end
857 if ( oorTargets ) then
858 -- We could not cure due to targets being out of range
859 CT_RA_Print("<CTRaid> Could not cure |c00FFFFFF" .. oorTargets[1] .. "|r of |c00FFFFFF" .. oorTargets[2] .. "|r (|c00FFFFFF" .. oorTargets[3] .. "|r), target is out of range.", 1, 0.5, 0);
860 end
861 end
862 end
863  
864 ------------------------------------------------------------------
865 -- CT_RADebuff_PriorityCure(order, tbl) --
866 -- Gets the person out of a table that contains the people that --
867 -- need it most based on the order given --
868 ------------------------------------------------------------------
869  
870 function CT_RADebuff_PriorityCure(order, tbl, classes)
871 local currLow, currIndex, currNamePriority, currLowHealth = 99, 99, 99, 99999;
872  
873 local classTbl = {
874 [9] = CT_RA_WARRIOR,
875 [10] = CT_RA_DRUID,
876 [11] = CT_RA_MAGE,
877 [12] = CT_RA_WARLOCK,
878 [13] = CT_RA_ROGUE,
879 [14] = CT_RA_HUNTER,
880 [15] = CT_RA_PRIEST,
881 [16] = CT_RA_PALADIN,
882 [17] = CT_RA_SHAMAN
883 };
884  
885 for k, v in tbl do
886 if ( CT_RADebuff_NamePriorities[v[1]] ) then
887 v[8] = CT_RADebuff_NamePriorities[v[1]];
888 end
889 for key, val in order do
890 if ( ( UnitPowerType(v[4]) ~= 2 and classes[UnitClass(v[4])] ) or ( ( UnitPowerType(v[4]) == 2 or UnitCreatureFamily(v[4]) == CT_RA_IMP or UnitCreatureFamily(v[4]) == CT_RA_VOIDWALKER or UnitCreatureFamily(v[4]) == CT_RA_SUCCUBUS or UnitCreatureFamily(v[4]) == CT_RA_FELHUNTER or UnitCreatureFamily(v[4]) == CT_RA_DOOMGUARD or UnitCreatureFamily(v[4]) == CT_RA_INFERNAL ) and classes[CT_RA_PETS] ) ) then
891 -- Target
892 if ( val == 1 and UnitIsUnit(v[4], "target") ) then
893 v[7] = key;
894 break;
895  
896 -- Self
897 elseif ( val == 2 and UnitIsUnit(v[4], "player") ) then
898 v[7] = key;
899 break;
900  
901 -- Party
902 elseif ( val == 3 and UnitInParty(v[4]) ) then
903 v[7] = key;
904 break;
905  
906 -- Pet
907 elseif ( val == 5 and UnitIsUnit(v[4], "pet") ) then
908 v[7] = key;
909 break;
910  
911 -- Party pets
912 elseif ( val == 6 and string.find(v[4], "^partypet%d+$") ) then
913 v[7] = key;
914 break;
915  
916 -- Raid pets
917 elseif ( val == 7 and string.find(v[4], "^raidpet%d+$") ) then
918 v[7] = key;
919 break;
920  
921 -- Main Tanks
922 elseif ( val == 8 and CT_RADebuff_MainTankExists(UnitName(v[4])) ) then
923 v[7] = key;
924 break;
925  
926 -- Classes
927 elseif ( val >= 9 and val <= 17 and classes[classTbl[val]] ) then
928 v[7] = key;
929 break;
930  
931 -- Raid
932 elseif ( val == 4 and UnitInRaid(v[4]) ) then
933 v[7] = key;
934 break;
935 end
936 end
937 end
938  
939 if (
940 (
941 ( v[7] and v[7] < currLow ) or
942 ( v[7] and currLow and v[6] and currLowHealth and v[7] <= currLow and v[6] < currLowHealth )
943 ) and
944 ( ( v[8] or 99 ) <= currNamePriority )
945 ) then
946 currLow = v[7];
947 currLowHealth = v[6];
948 currIndex = k;
949 currNamePriority = ( v[8] or 99 );
950 end
951 end
952  
953 if ( currLow < 99 ) then
954 return tbl[currIndex][4], currIndex;
955 end
956 end
957  
958 ------------------------------------------------------------------
959 -- CT_RADebuff_MainTankExists(name) --
960 -- Returns if the name is one of the main tanks in the raid. --
961 ------------------------------------------------------------------
962  
963 function CT_RADebuff_MainTankExists(name)
964 for k, v in CT_RA_MainTanks do
965 if ( v == name ) then
966 return 1;
967 end
968 end
969 return nil;
970 end
971  
972 ------------------------------------------------------------------
973 -- CT_RADebuff_GetActionButtonCures() --
974 -- Gets the action buttons that correspond to cure spells. --
975 ------------------------------------------------------------------
976  
977 function CT_RADebuff_GetActionButtonCures()
978 CT_RADebuff_ActionButtons = { };
979 local iIndex = 0;
980 local arr = {
981 [CT_RA_PRIEST] = { [CT_RA_DISPELMAGIC] = { CT_RA_MAGIC, 1 }, [CT_RA_CUREDISEASE] = { CT_RA_DISEASE, 2 }, [CT_RA_ABOLISHDISEASE] = { CT_RA_DISEASE, 1 } },
982 [CT_RA_SHAMAN] = { [CT_RA_CUREDISEASE] = { CT_RA_DISEASE, 1 }, [CT_RA_CUREPOISON] = { CT_RA_POISON, 1 } },
983 [CT_RA_DRUID] = { [CT_RA_REMOVECURSE] = { CT_RA_CURSE, 1 }, [CT_RA_CUREPOISON] = { CT_RA_POISON, 2 }, [CT_RA_ABOLISHPOISON] = { CT_RA_POISON, 1 } },
984 [CT_RA_MAGE] = { [CT_RA_REMOVELESSERCURSE] = { CT_RA_CURSE, 1 } },
985 [CT_RA_PALADIN] = { [CT_RA_CLEANSE] = { CT_RA_MAGIC, 1 }, [CT_RA_PURIFY] = { CT_RA_DISEASE, 2 }, [CT_RA_CLEANSE] = { CT_RA_DISEASE, 1 }, [CT_RA_PURIFY] = { CT_RA_POISON, 2 }, [CT_RA_CLEANSE] = { CT_RA_POISON, 1 } }
986 };
987 if ( not arr[UnitClass("player")] ) then
988 return;
989 end
990  
991 -- Loop through the action buttons
992 for i = 1, 120, 1 do
993 if ( HasAction(i) ) then
994 CT_RATooltipTextLeft1:SetText("");
995 CT_RATooltipTextRight1:SetText("");
996 CT_RATooltip:SetAction(i);
997 -- Make sure we have a new spell
998 local sName = CT_RATooltipTextLeft1:GetText();
999 if ( strlen(sName or "") > 0 and strlen(CT_RATooltipTextRight1:GetText() or "") > 0 ) then
1000 for key, val in arr[UnitClass("player")] do
1001 if ( key == sName and ( not CT_RADebuff_ActionButtons[val[1]] or CT_RADebuff_ActionButtons[val[1]][1] > val[2] ) ) then
1002 CT_RADebuff_ActionButtons[val[1]] = { val[2], i, key };
1003 end
1004 end
1005 end
1006 end
1007 end
1008 end
1009  
1010 ------------------------------------------------------------------
1011 -- CT_RADebuff_CureTarget(debuffType, debuffName, uId) --
1012 -- Cures the unit id of the debuff type. --
1013 ------------------------------------------------------------------
1014  
1015 function CT_RADebuff_CureTarget(debuffType, debuffName, uId)
1016 SpellStopTargeting();
1017 if ( CT_RADebuff_CureSpells[UnitClass("player")] and CT_RADebuff_CureSpells[UnitClass("player")][debuffType] ) then
1018 local tmp = CT_RADebuff_CureSpells[UnitClass("player")][debuffType];
1019 if ( type(tmp) == "table" ) then
1020 for i = getn(tmp), 1, -1 do
1021 local spell = CT_RA_ClassSpells[tmp[i]];
1022 if ( spell ) then
1023 if ( tmp[i] == CT_RA_ABOLISHDISEASE or tmp[i] == CT_RA_ABOLISHPOISON ) then
1024 if ( CT_RADebuff_HasBuff(uId, tmp[i]) ) then
1025 return 0; -- Skip
1026 end
1027 end
1028 CastSpell(spell["spell"], spell["tab"]+1);
1029 if ( not SpellCanTargetUnit(uId) ) then
1030 return -1; -- Flag as OOR
1031 end
1032 CT_RADebuff_CastingSpell = UnitName(uId);
1033 SpellTargetUnit(uId);
1034 if ( SpellIsTargeting() ) then
1035 return -1; -- Flag as OOR
1036 end
1037 CT_RA_Print("<CTRaid> Dispelling |c00FFFFFF" .. UnitName(uId) .. "|r of |c00FFFFFF" .. debuffType .. "|r (|c00FFFFFF" .. debuffName .. "|r).", 1, 0.5, 0);
1038 return 1;
1039 end
1040 end
1041 else
1042 local spell = CT_RA_ClassSpells[tmp];
1043 if ( spell ) then
1044 if ( tmp == CT_RA_ABOLISHDISEASE or tmp == CT_RA_ABOLISHPOISON ) then
1045 if ( CT_RADebuff_HasBuff(uId, tmp) ) then
1046 return 0; -- Skip
1047 end
1048 end
1049 CastSpell(spell["spell"], spell["tab"]+1);
1050 if ( not SpellCanTargetUnit(uId) ) then
1051 return -1; -- Flag as OOR
1052 end
1053 CT_RADebuff_CastingSpell = UnitName(uId);
1054 SpellTargetUnit(uId);
1055 if ( SpellIsTargeting() ) then
1056 return -1; -- Flag as OOR
1057 end
1058 CT_RA_Print("<CTRaid> Dispelling |c00FFFFFF" .. UnitName(uId) .. "|r of |c00FFFFFF" .. debuffType .. "|r (|c00FFFFFF" .. debuffName .. "|r).", 1, 0.5, 0);
1059 return 1;
1060 end
1061 end
1062 end
1063 return 0; -- Skip
1064 end
1065  
1066 ------------------------------------------------------------------
1067 -- CT_RADebuff_HasBuff(uId, buffName) --
1068 -- Returns true if the unit has a buff named buffName. --
1069 ------------------------------------------------------------------
1070 function CT_RADebuff_HasBuff(uId, buffName)
1071 if ( UnitExists(uId) and buffName ~= "" ) then
1072 local iIndex = 1;
1073  
1074 -- Loop through the debuffs
1075 while ( UnitBuff(uId, iIndex) ) do
1076 -- Clear and set the tooltip
1077 CT_RATooltipTextLeft1:SetText("");
1078 CT_RATooltip:SetUnitBuff(uId, iIndex);
1079  
1080 -- Control to see if we have the buff we're looking for
1081 if ( CT_RATooltipTextLeft1:GetText() == buffName ) then
1082 return 1;
1083 end
1084  
1085 iIndex = iIndex + 1;
1086  
1087 end
1088 end
1089 return nil;
1090 end
1091  
1092 ------------------------------------------------------------------
1093 -- CT_RADebuff_CanCure(debuffType) --
1094 -- Returns if the player can cure the debuff type. --
1095 ------------------------------------------------------------------
1096  
1097 function CT_RADebuff_CanCure(debuffType)
1098 local arr = {
1099 [CT_RA_PRIEST] = { [CT_RA_MAGIC] = CT_RA_DISPELMAGIC, [CT_RA_DISEASE] = { CT_RA_CUREDISEASE, CT_RA_ABOLISHDISEASE } },
1100 [CT_RA_SHAMAN] = { [CT_RA_DISEASE] = CT_RA_CUREDISEASE, [CT_RA_POISON] = CT_RA_CUREPOISON },
1101 [CT_RA_DRUID] = { [CT_RA_CURSE] = CT_RA_REMOVECURSE, [CT_RA_POISON] = { CT_RA_CUREPOISON, CT_RA_ABOLISHPOISON } },
1102 [CT_RA_MAGE] = { [CT_RA_CURSE] = CT_RA_REMOVELESSERCURSE },
1103 [CT_RA_PALADIN] = { [CT_RA_MAGIC] = CT_RA_CLEANSE, [CT_RA_POISON] = { CT_RA_PURIFY, CT_RA_CLEANSE }, [CT_RA_DISEASE] = { CT_RA_PURIFY, CT_RA_CLEANSE } }
1104 };
1105  
1106 if ( arr[UnitClass("player")] and arr[UnitClass("player")][debuffType] ) then
1107 if ( type(arr[UnitClass("player")][debuffType]) == "table" ) then
1108 for k, v in arr[UnitClass("player")][debuffType] do
1109 if ( CT_RA_ClassSpells[v] ) then
1110 return 1;
1111 end
1112 end
1113 elseif ( CT_RA_ClassSpells[arr[UnitClass("player")][debuffType]] ) then
1114 return 1;
1115 end
1116 end
1117 return nil;
1118 end
1119  
1120 -- Slash command to cure
1121 CT_RA_RegisterSlashCmd("/racure", "Cures a debuff using the debuff curing system. Must be used in a macro.", 15, "RACURE", CT_RADebuff_Cure, "/racure");
1122  
1123 -- Hook functions to call CT_RADebuff_GetActionButtonCures
1124 CT_RADebuff_oldPlaceAction = PlaceAction;
1125 function CT_RADebuff_newPlaceAction(id)
1126 CT_RADebuff_oldPlaceAction(id);
1127 CT_RADebuff_GetActionButtonCures();
1128 end
1129 PlaceAction = CT_RADebuff_newPlaceAction;
1130  
1131 CT_RADebuff_oldPickupAction = PickupAction;
1132 function CT_RADebuff_newPickupAction(id)
1133 CT_RADebuff_oldPickupAction(id);
1134 CT_RADebuff_GetActionButtonCures();
1135 end
1136 PickupAction = CT_RADebuff_newPickupAction;
1137  
1138 CT_RADebuff_oldUseAction = UseAction;
1139 function CT_RADebuff_newUseAction(id, check, self)
1140 local rebuild;
1141 if ( CursorHasSpell() and not IsShiftKeyDown() ) then
1142 rebuild = 1;
1143 end
1144 CT_RADebuff_oldUseAction(id, check, self);
1145 if ( rebuild ) then
1146 CT_RADebuff_GetActionButtonCures();
1147 end
1148 end
1149 UseAction = CT_RADebuff_newUseAction;