vanilla-wow-addons – Blame information for rev 1
?pathlinks?
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 | ["Dreamless Sleep"] = 1, |
||
14 | ["Greater Dreamless Sleep"] = 1, |
||
15 | --~ ["Mind Vision"] = 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 | if ( not CT_RADebuff_Blacklist[UnitName("target")] ) then |
||
332 | local iIndex = 1; |
||
333 | -- Loop through the debuffs |
||
334 | while ( useBuffs("target", iIndex) ) do |
||
335 | -- Clear and set the tooltip |
||
336 | CT_RATooltipTextLeft1:SetText(""); |
||
337 | CT_RATooltipTextRight1:SetText(""); |
||
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 | end |
||
381 | if ( GetNumRaidMembers() == 0 ) then |
||
382 | if ( not CT_RADebuff_Blacklist[UnitName("player")] ) then |
||
383 | local iIndex = 1; |
||
384 | |||
385 | -- Loop through the debuffs |
||
386 | while ( UnitDebuff("player", iIndex) ) do |
||
387 | -- Clear and set the tooltip |
||
388 | CT_RATooltipTextLeft1:SetText(""); |
||
389 | CT_RATooltipTextRight1:SetText(""); |
||
390 | CT_RATooltip:SetUnitDebuff("player", iIndex); |
||
391 | |||
392 | -- Control to make sure we have a new debuff |
||
393 | if ( CT_RATooltipTextLeft1:GetText() ~= "" ) then |
||
394 | -- Fetch the data |
||
395 | local sName, sType, sDesc, iTblIndex = CT_RATooltipTextLeft1:GetText() or "", CT_RATooltipTextRight1:GetText() or "", CT_RATooltipTextLeft2:GetText() or "", -1; |
||
396 | if ( sType ~= "" and CT_RADebuff_CanCure(sType) and not CT_RADebuff_IgnoreDebuffs[(sName or "")] ) then |
||
397 | -- See if we can find the CT_RA_DebuffTemplates index |
||
398 | for k, v in CT_RA_DebuffTemplates do |
||
399 | |||
400 | -- See if we have a match |
||
401 | 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 |
||
402 | iTblIndex = k; |
||
403 | break; |
||
404 | end |
||
405 | end |
||
406 | |||
407 | if ( iTblIndex > 0 and ( not CT_RADebuff_CureTable[2] or CT_RADebuff_CureTable[2] > iTblIndex ) ) then |
||
408 | -- Clean the table |
||
409 | CT_RADebuff_CureTable = { |
||
410 | [1] = { |
||
411 | { sName, sType, sDesc, "player", CT_RADebuff_ClassIndexes[UnitClass("player")], UnitHealth("player") } |
||
412 | }, |
||
413 | [2] = iTblIndex |
||
414 | }; |
||
415 | |||
416 | elseif ( iTblIndex > 0 and iTblIndex == CT_RADebuff_CureTable[2] ) then |
||
417 | -- 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 |
||
418 | tinsert(CT_RADebuff_CureTable[1], { sName, sType, sDesc, "player", CT_RADebuff_ClassIndexes[UnitClass("player")], UnitHealth("player") }); |
||
419 | |||
420 | end |
||
421 | end |
||
422 | end |
||
423 | |||
424 | iIndex = iIndex + 1; |
||
425 | |||
426 | end |
||
427 | end |
||
428 | if ( UnitExists("pet") and not CT_RADebuff_Blacklist[UnitName("pet")] ) then |
||
429 | local iIndex = 1; |
||
430 | |||
431 | -- Loop through the debuffs |
||
432 | while ( UnitDebuff("pet", iIndex) ) do |
||
433 | -- Clear and set the tooltip |
||
434 | CT_RATooltipTextLeft1:SetText(""); |
||
435 | CT_RATooltipTextRight1:SetText(""); |
||
436 | CT_RATooltip:SetUnitDebuff("pet", iIndex); |
||
437 | |||
438 | -- Control to make sure we have a new debuff |
||
439 | if ( CT_RATooltipTextLeft1:GetText() ~= "" ) then |
||
440 | |||
441 | -- Fetch the data |
||
442 | local sName, sType, sDesc, iTblIndex = CT_RATooltipTextLeft1:GetText() or "", CT_RATooltipTextRight1:GetText() or "", CT_RATooltipTextLeft2:GetText() or "", -1; |
||
443 | if ( sType ~= "" and CT_RADebuff_CanCure(sType) and not CT_RADebuff_IgnoreDebuffs[(sName or "")] ) then |
||
444 | -- See if we can find the CT_RA_DebuffTemplates index |
||
445 | for k, v in CT_RA_DebuffTemplates do |
||
446 | |||
447 | -- See if we have a match |
||
448 | 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 |
||
449 | iTblIndex = k; |
||
450 | break; |
||
451 | end |
||
452 | end |
||
453 | |||
454 | if ( iTblIndex > 0 and ( not CT_RADebuff_CureTable[2] or CT_RADebuff_CureTable[2] > iTblIndex ) ) then |
||
455 | -- Clean the table |
||
456 | CT_RADebuff_CureTable = { |
||
457 | [1] = { |
||
458 | { sName, sType, sDesc, "pet", CT_RADebuff_ClassIndexes[UnitClass("pet")], UnitHealth("pet") } |
||
459 | }, |
||
460 | [2] = iTblIndex |
||
461 | }; |
||
462 | |||
463 | elseif ( iTblIndex > 0 and iTblIndex == CT_RADebuff_CureTable[2] ) then |
||
464 | -- 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 |
||
465 | tinsert(CT_RADebuff_CureTable[1], { sName, sType, sDesc, "pet", CT_RADebuff_ClassIndexes[UnitClass("pet")], UnitHealth("pet") }); |
||
466 | |||
467 | end |
||
468 | end |
||
469 | end |
||
470 | |||
471 | iIndex = iIndex + 1; |
||
472 | |||
473 | end |
||
474 | end |
||
475 | end |
||
476 | local prefix, func = "raid", GetNumRaidMembers; |
||
477 | if ( GetNumRaidMembers() == 0 and GetNumPartyMembers() > 0 ) then |
||
478 | prefix, func = "party", GetNumPartyMembers; |
||
479 | end |
||
480 | -- Loop through the players in the raid |
||
481 | for i = 1, func(), 1 do |
||
482 | if ( not CT_RADebuff_Blacklist[UnitName(prefix .. i)] and ( not UnitCanAttack("player", prefix .. i) or ( UnitIsCharmed(prefix .. i) and UnitIsFriend("player", prefix .. i) ) ) ) then |
||
483 | local iIndex = 1; |
||
484 | |||
485 | -- Loop through the debuffs |
||
486 | while ( UnitDebuff(prefix .. i, iIndex) ) do |
||
487 | -- Clear and set the tooltip |
||
488 | CT_RATooltipTextLeft1:SetText(""); |
||
489 | CT_RATooltipTextRight1:SetText(""); |
||
490 | CT_RATooltip:SetUnitDebuff(prefix .. i, iIndex); |
||
491 | |||
492 | -- Control to make sure we have a new debuff |
||
493 | if ( CT_RATooltipTextLeft1:GetText() ~= "" ) then |
||
494 | |||
495 | -- Fetch the data |
||
496 | local sName, sType, sDesc, iTblIndex = CT_RATooltipTextLeft1:GetText() or "", CT_RATooltipTextRight1:GetText() or "", CT_RATooltipTextLeft2:GetText() or "", -1; |
||
497 | if ( sType ~= "" and CT_RADebuff_CanCure(sType) and not CT_RADebuff_IgnoreDebuffs[(sName or "")] ) then |
||
498 | -- See if we can find the CT_RA_DebuffTemplates index |
||
499 | for k, v in CT_RA_DebuffTemplates do |
||
500 | |||
501 | -- See if we have a match |
||
502 | 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 |
||
503 | iTblIndex = k; |
||
504 | break; |
||
505 | end |
||
506 | end |
||
507 | |||
508 | if ( iTblIndex > 0 and ( not CT_RADebuff_CureTable[2] or CT_RADebuff_CureTable[2] > iTblIndex ) ) then |
||
509 | -- Clean the table |
||
510 | CT_RADebuff_CureTable = { |
||
511 | [1] = { |
||
512 | { sName, sType, sDesc, prefix .. i, CT_RADebuff_ClassIndexes[UnitClass(prefix .. i)], UnitHealth(prefix .. i) } |
||
513 | }, |
||
514 | [2] = iTblIndex |
||
515 | }; |
||
516 | |||
517 | elseif ( iTblIndex > 0 and iTblIndex == CT_RADebuff_CureTable[2] ) then |
||
518 | -- 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 |
||
519 | tinsert(CT_RADebuff_CureTable[1], { sName, sType, sDesc, prefix .. i, CT_RADebuff_ClassIndexes[UnitClass(prefix .. i)], UnitHealth(prefix .. i) }); |
||
520 | |||
521 | end |
||
522 | end |
||
523 | end |
||
524 | |||
525 | iIndex = iIndex + 1; |
||
526 | |||
527 | end |
||
528 | end |
||
529 | if ( UnitExists(prefix .. "pet" .. i) and not CT_RADebuff_Blacklist[UnitName(prefix .. "pet" .. i)] and ( not UnitCanAttack("player", prefix .. "pet" .. i) or ( UnitIsCharmed(prefix .. "pet" .. i) and UnitIsFriend("player", prefix .. "pet" .. i) ) ) ) then |
||
530 | local iIndex = 1; |
||
531 | -- Loop through the debuffs |
||
532 | while ( UnitDebuff(prefix .. "pet" .. i, iIndex) ) do |
||
533 | -- Clear and set the tooltip |
||
534 | CT_RATooltipTextLeft1:SetText(""); |
||
535 | CT_RATooltipTextRight1:SetText(""); |
||
536 | CT_RATooltip:SetUnitDebuff(prefix .. "pet" .. i, iIndex); |
||
537 | |||
538 | -- Control to make sure we have a new debuff |
||
539 | if ( CT_RATooltipTextLeft1:GetText() ~= "" ) then |
||
540 | |||
541 | -- Fetch the data |
||
542 | local sName, sType, sDesc, iTblIndex = CT_RATooltipTextLeft1:GetText() or "", CT_RATooltipTextRight1:GetText() or "", CT_RATooltipTextLeft2:GetText() or "", -1; |
||
543 | if ( sType ~= "" and CT_RADebuff_CanCure(sType) and not CT_RADebuff_IgnoreDebuffs[(sName or "")] ) then |
||
544 | -- See if we can find the CT_RA_DebuffTemplates index |
||
545 | for k, v in CT_RA_DebuffTemplates do |
||
546 | |||
547 | -- See if we have a match |
||
548 | 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 |
||
549 | iTblIndex = k; |
||
550 | break; |
||
551 | end |
||
552 | end |
||
553 | |||
554 | if ( iTblIndex > 0 and ( not CT_RADebuff_CureTable[2] or CT_RADebuff_CureTable[2] > iTblIndex ) ) then |
||
555 | -- Clean the table |
||
556 | CT_RADebuff_CureTable = { |
||
557 | [1] = { |
||
558 | { sName, sType, sDesc, prefix .. "pet" .. i, CT_RADebuff_ClassIndexes[UnitClass(prefix .. "pet" .. i)], UnitHealth(prefix .. "pet" .. i) } |
||
559 | }, |
||
560 | [2] = iTblIndex |
||
561 | }; |
||
562 | |||
563 | elseif ( iTblIndex > 0 and iTblIndex == CT_RADebuff_CureTable[2] ) then |
||
564 | -- 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 |
||
565 | tinsert(CT_RADebuff_CureTable[1], { sName, sType, sDesc, prefix .. "pet" .. i, CT_RADebuff_ClassIndexes[UnitClass(prefix .. "pet" .. i)], UnitHealth(prefix .. "pet" .. i) }); |
||
566 | |||
567 | end |
||
568 | end |
||
569 | end |
||
570 | |||
571 | iIndex = iIndex + 1; |
||
572 | |||
573 | end |
||
574 | end |
||
575 | end |
||
576 | end |
||
577 | |||
578 | ---------------------------------------------------------------- |
||
579 | -- CT_RADebuff_Cure() -- |
||
580 | -- Cures the next person in the list, using the chosen order. -- |
||
581 | -- This is where most of the curing stuff is done. -- |
||
582 | ---------------------------------------------------------------- |
||
583 | |||
584 | function CT_RADebuff_Cure() |
||
585 | if ( not CT_RADebuff_CureSpells[UnitClass("player")] ) then |
||
586 | return; |
||
587 | end |
||
588 | local cannotCast, cooldownStart, cooldownDuration; |
||
589 | for k, v in CT_RADebuff_CureSpells[UnitClass("player")] do |
||
590 | if ( type(v) == "table" ) then |
||
591 | for key, val in v do |
||
592 | if ( CT_RA_ClassSpells[val] ) then |
||
593 | cooldownStart, cooldownDuration = GetSpellCooldown(CT_RA_ClassSpells[val]["spell"], SpellBookFrame.bookType); |
||
594 | if ( cooldownStart > 0 and cooldownDuration > 0 ) then |
||
595 | cannotCast = true; |
||
596 | break; |
||
597 | end |
||
598 | end |
||
599 | end |
||
600 | else |
||
601 | if ( CT_RA_ClassSpells[v] ) then |
||
602 | cooldownStart, cooldownDuration = GetSpellCooldown(CT_RA_ClassSpells[v]["spell"], SpellBookFrame.bookType); |
||
603 | if ( cooldownStart > 0 and cooldownDuration > 0 ) then |
||
604 | cannotCast = true; |
||
605 | break; |
||
606 | end |
||
607 | end |
||
608 | end |
||
609 | end |
||
610 | if ( cannotCast ) then |
||
611 | return; |
||
612 | end |
||
613 | CT_RADebuff_UpdateCureTable(); |
||
614 | |||
615 | -- Make sure we have an index |
||
616 | if ( CT_RADebuff_CureTable[2] ) then |
||
617 | |||
618 | -- Process if we have a target to cure |
||
619 | 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"]); |
||
620 | |||
621 | while ( uId ) do |
||
622 | if ( UnitIsVisible(uId) ) then |
||
623 | local switchTarget, resetCombat; |
||
624 | if ( not UnitIsUnit("target", uId) ) then |
||
625 | TargetUnit(uId); |
||
626 | switchTarget = 1; |
||
627 | if ( CT_RADebuff_InCombat ) then |
||
628 | resetCombat = 1; |
||
629 | end |
||
630 | end |
||
631 | -- Make sure the target and the unit we're trying to cure are the same |
||
632 | if ( UnitIsUnit(uId, "target") ) then |
||
633 | -- Shall we perform a range check? |
||
634 | |||
635 | if ( CT_RADebuff_ActionButtons[CT_RADebuff_CureTable[1][tblIndex][2]] ) then |
||
636 | -- Make sure the spell is in range |
||
637 | if ( IsActionInRange(CT_RADebuff_ActionButtons[CT_RADebuff_CureTable[1][tblIndex][2]][2]) == 1 ) then |
||
638 | local shallReturn = CT_RADebuff_CureTarget(CT_RADebuff_CureTable[1][tblIndex][2], CT_RADebuff_CureTable[1][tblIndex][1], "target"); |
||
639 | if ( switchTarget ) then |
||
640 | TargetLastTarget(); |
||
641 | switchTarget = nil; |
||
642 | if ( resetCombat ) then |
||
643 | CT_RADebuff_ResetCombat = 1; |
||
644 | end |
||
645 | end |
||
646 | if ( shallReturn ) then |
||
647 | return; |
||
648 | end |
||
649 | end |
||
650 | else |
||
651 | -- If not, just try to target and cure |
||
652 | local shallReturn = CT_RADebuff_CureTarget(CT_RADebuff_CureTable[1][tblIndex][2], CT_RADebuff_CureTable[1][tblIndex][1], "target"); |
||
653 | if ( switchTarget ) then |
||
654 | TargetLastTarget(); |
||
655 | switchTarget = nil; |
||
656 | if ( resetCombat ) then |
||
657 | CT_RADebuff_ResetCombat = 1; |
||
658 | end |
||
659 | end |
||
660 | if ( shallReturn ) then |
||
661 | return; |
||
662 | end |
||
663 | end |
||
664 | |||
665 | -- Target the previous target |
||
666 | if ( switchTarget ) then |
||
667 | TargetLastTarget(); |
||
668 | if ( resetCombat ) then |
||
669 | CT_RADebuff_ResetCombat = 1; |
||
670 | end |
||
671 | end |
||
672 | |||
673 | elseif ( switchTarget and UnitIsUnit("target", uId) ) then |
||
674 | TargetLastTarget(); |
||
675 | if ( resetCombat ) then |
||
676 | CT_RADebuff_ResetCombat = 1; |
||
677 | end |
||
678 | end |
||
679 | end |
||
680 | -- Remove the previous one, and check again |
||
681 | table.remove(CT_RADebuff_CureTable[1], tblIndex); |
||
682 | 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"]); |
||
683 | end |
||
684 | end |
||
685 | end |
||
686 | |||
687 | ------------------------------------------------------------------ |
||
688 | -- CT_RADebuff_PriorityCure(order, tbl) -- |
||
689 | -- Gets the person out of a table that contains the people that -- |
||
690 | -- need it most based on the order given -- |
||
691 | ------------------------------------------------------------------ |
||
692 | |||
693 | function CT_RADebuff_PriorityCure(order, tbl, classes) |
||
694 | local currLow, currIndex, currNamePriority, currLowHealth = 99, 99, 99, 99999; |
||
695 | |||
696 | local classTbl = { |
||
697 | [9] = CT_RA_WARRIOR, |
||
698 | [10] = CT_RA_DRUID, |
||
699 | [11] = CT_RA_MAGE, |
||
700 | [12] = CT_RA_WARLOCK, |
||
701 | [13] = CT_RA_ROGUE, |
||
702 | [14] = CT_RA_HUNTER, |
||
703 | [15] = CT_RA_PRIEST, |
||
704 | [16] = CT_RA_PALADIN, |
||
705 | [17] = CT_RA_SHAMAN |
||
706 | }; |
||
707 | |||
708 | for k, v in tbl do |
||
709 | if ( CT_RADebuff_NamePriorities[v[1]] ) then |
||
710 | v[8] = CT_RADebuff_NamePriorities[v[1]]; |
||
711 | end |
||
712 | for key, val in order do |
||
713 | 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 |
||
714 | -- Target |
||
715 | if ( val == 1 and UnitIsUnit(v[4], "target") ) then |
||
716 | v[7] = key; |
||
717 | break; |
||
718 | |||
719 | -- Self |
||
720 | elseif ( val == 2 and UnitIsUnit(v[4], "player") ) then |
||
721 | v[7] = key; |
||
722 | break; |
||
723 | |||
724 | -- Party |
||
725 | elseif ( val == 3 and UnitInParty(v[4]) ) then |
||
726 | v[7] = key; |
||
727 | break; |
||
728 | |||
729 | -- Pet |
||
730 | elseif ( val == 5 and UnitIsUnit(v[4], "pet") ) then |
||
731 | v[7] = key; |
||
732 | break; |
||
733 | |||
734 | -- Party pets |
||
735 | elseif ( val == 6 and string.find(v[4], "^party%d+pet%$") ) then |
||
736 | v[7] = key; |
||
737 | break; |
||
738 | |||
739 | -- Raid pets |
||
740 | elseif ( val == 7 and string.find(v[5], "^raid%d+pet$") ) then |
||
741 | v[7] = key; |
||
742 | break; |
||
743 | |||
744 | -- Main Tanks |
||
745 | elseif ( val == 8 and CT_RADebuff_MainTankExists(UnitName(v[4])) ) then |
||
746 | v[7] = key; |
||
747 | break; |
||
748 | |||
749 | -- Classes |
||
750 | elseif ( val >= 9 and val <= 17 and classes[classTbl[val]] ) then |
||
751 | v[7] = key; |
||
752 | break; |
||
753 | |||
754 | -- Raid |
||
755 | elseif ( val == 4 and UnitInRaid(v[4]) ) then |
||
756 | v[7] = key; |
||
757 | break; |
||
758 | end |
||
759 | end |
||
760 | end |
||
761 | |||
762 | if ( |
||
763 | ( |
||
764 | ( v[7] and v[7] < currLow ) or |
||
765 | ( v[7] and currLow and v[6] and currLowHealth and v[7] <= currLow and v[6] < currLowHealth ) |
||
766 | ) and |
||
767 | ( ( v[8] or 99 ) <= currNamePriority ) |
||
768 | ) then |
||
769 | currLow = v[7]; |
||
770 | currLowHealth = v[6]; |
||
771 | currIndex = k; |
||
772 | currNamePriority = ( v[8] or 99 ); |
||
773 | end |
||
774 | end |
||
775 | |||
776 | if ( currLow < 99 ) then |
||
777 | return tbl[currIndex][4], currIndex; |
||
778 | end |
||
779 | end |
||
780 | |||
781 | ------------------------------------------------------------------ |
||
782 | -- CT_RADebuff_MainTankExists(name) -- |
||
783 | -- Returns if the name is one of the main tanks in the raid. -- |
||
784 | ------------------------------------------------------------------ |
||
785 | |||
786 | function CT_RADebuff_MainTankExists(name) |
||
787 | for k, v in CT_RA_MainTanks do |
||
788 | if ( v == name ) then |
||
789 | return 1; |
||
790 | end |
||
791 | end |
||
792 | return nil; |
||
793 | end |
||
794 | |||
795 | ------------------------------------------------------------------ |
||
796 | -- CT_RADebuff_GetActionButtonCures() -- |
||
797 | -- Gets the action buttons that correspond to cure spells. -- |
||
798 | ------------------------------------------------------------------ |
||
799 | |||
800 | function CT_RADebuff_GetActionButtonCures() |
||
801 | CT_RADebuff_ActionButtons = { }; |
||
802 | local iIndex = 0; |
||
803 | local arr = { |
||
804 | [CT_RA_PRIEST] = { [CT_RA_DISPELMAGIC] = { CT_RA_MAGIC, 1 }, [CT_RA_CUREDISEASE] = { CT_RA_DISEASE, 2 }, [CT_RA_ABOLISHDISEASE] = { CT_RA_DISEASE, 1 } }, |
||
805 | [CT_RA_SHAMAN] = { [CT_RA_CUREDISEASE] = { CT_RA_DISEASE, 1 }, [CT_RA_CUREPOISON] = { CT_RA_POISON, 1 } }, |
||
806 | [CT_RA_DRUID] = { [CT_RA_REMOVECURSE] = { CT_RA_CURSE, 1 }, [CT_RA_CUREPOISON] = { CT_RA_POISON, 2 }, [CT_RA_ABOLISHPOISON] = { CT_RA_POISON, 1 } }, |
||
807 | [CT_RA_MAGE] = { [CT_RA_REMOVELESSERCURSE] = { CT_RA_CURSE, 1 } }, |
||
808 | [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 } } |
||
809 | }; |
||
810 | if ( not arr[UnitClass("player")] ) then |
||
811 | return; |
||
812 | end |
||
813 | |||
814 | -- Loop through the action buttons |
||
815 | for i = 1, 120, 1 do |
||
816 | if ( HasAction(i) ) then |
||
817 | CT_RATooltipTextLeft1:SetText(""); |
||
818 | CT_RATooltipTextRight1:SetText(""); |
||
819 | CT_RATooltip:SetAction(i); |
||
820 | -- Make sure we have a new spell |
||
821 | local sName = CT_RATooltipTextLeft1:GetText(); |
||
822 | if ( strlen(sName or "") > 0 and strlen(CT_RATooltipTextRight1:GetText() or "") > 0 ) then |
||
823 | for key, val in arr[UnitClass("player")] do |
||
824 | if ( key == sName and ( not CT_RADebuff_ActionButtons[val[1]] or CT_RADebuff_ActionButtons[val[1]][1] > val[2] ) ) then |
||
825 | CT_RADebuff_ActionButtons[val[1]] = { val[2], i, key }; |
||
826 | end |
||
827 | end |
||
828 | end |
||
829 | end |
||
830 | end |
||
831 | end |
||
832 | |||
833 | ------------------------------------------------------------------ |
||
834 | -- CT_RADebuff_CureTarget(debuffType, debuffName, uId) -- |
||
835 | -- Cures the unit id of the debuff type. -- |
||
836 | ------------------------------------------------------------------ |
||
837 | |||
838 | function CT_RADebuff_CureTarget(debuffType, debuffName, uId) |
||
839 | if ( CT_RADebuff_CureSpells[UnitClass("player")] and CT_RADebuff_CureSpells[UnitClass("player")][debuffType] ) then |
||
840 | local tmp = CT_RADebuff_CureSpells[UnitClass("player")][debuffType]; |
||
841 | if ( type(tmp) == "table" ) then |
||
842 | for i = getn(tmp), 1, -1 do |
||
843 | if ( CT_RA_ClassSpells[tmp[i]] ) then |
||
844 | if ( tmp[i] == CT_RA_ABOLISHDISEASE or tmp[i] == CT_RA_ABOLISHPOISON ) then |
||
845 | if ( CT_RADebuff_HasBuff(uId, tmp[i]) ) then |
||
846 | return nil; |
||
847 | end |
||
848 | end |
||
849 | CT_RADebuff_CastingSpell = UnitName(uId); |
||
850 | CastSpell(CT_RA_ClassSpells[tmp[i]]["spell"], CT_RA_ClassSpells[tmp[i]]["tab"]+1); |
||
851 | CT_RA_Print("<CTRaid> Dispelling |c00FFFFFF" .. UnitName(uId) .. "|r of |c00FFFFFF" .. debuffType .. "|r (|c00FFFFFF" .. debuffName .. "|r).", 1, 0.5, 0); |
||
852 | return 1; |
||
853 | end |
||
854 | end |
||
855 | else |
||
856 | if ( CT_RA_ClassSpells[tmp] ) then |
||
857 | if ( tmp == CT_RA_ABOLISHDISEASE or tmp == CT_RA_ABOLISHPOISON ) then |
||
858 | if ( CT_RADebuff_HasBuff(uId, tmp) ) then |
||
859 | return nil; |
||
860 | end |
||
861 | end |
||
862 | CT_RADebuff_CastingSpell = UnitName(uId); |
||
863 | CastSpell(CT_RA_ClassSpells[tmp]["spell"], CT_RA_ClassSpells[tmp]["tab"]+1); |
||
864 | CT_RA_Print("<CTRaid> Dispelling |c00FFFFFF" .. UnitName(uId) .. "|r of |c00FFFFFF" .. debuffType .. "|r (|c00FFFFFF" .. debuffName .. "|r).", 1, 0.5, 0); |
||
865 | return 1; |
||
866 | end |
||
867 | end |
||
868 | end |
||
869 | return nil; |
||
870 | end |
||
871 | |||
872 | ------------------------------------------------------------------ |
||
873 | -- CT_RADebuff_HasBuff(uId, buffName) -- |
||
874 | -- Returns true if the unit has a buff named buffName. -- |
||
875 | ------------------------------------------------------------------ |
||
876 | function CT_RADebuff_HasBuff(uId, buffName) |
||
877 | if ( UnitExists(uId) and buffName ~= "" ) then |
||
878 | local iIndex = 1; |
||
879 | |||
880 | -- Loop through the debuffs |
||
881 | while ( UnitBuff(uId, iIndex) ) do |
||
882 | -- Clear and set the tooltip |
||
883 | CT_RATooltipTextLeft1:SetText(""); |
||
884 | CT_RATooltip:SetUnitBuff(uId, iIndex); |
||
885 | |||
886 | -- Control to see if we have the buff we're looking for |
||
887 | if ( CT_RATooltipTextLeft1:GetText() == buffName ) then |
||
888 | return 1; |
||
889 | end |
||
890 | |||
891 | iIndex = iIndex + 1; |
||
892 | |||
893 | end |
||
894 | end |
||
895 | return nil; |
||
896 | end |
||
897 | |||
898 | ------------------------------------------------------------------ |
||
899 | -- CT_RADebuff_CanCure(debuffType) -- |
||
900 | -- Returns if the player can cure the debuff type. -- |
||
901 | ------------------------------------------------------------------ |
||
902 | |||
903 | function CT_RADebuff_CanCure(debuffType) |
||
904 | local arr = { |
||
905 | [CT_RA_PRIEST] = { [CT_RA_MAGIC] = CT_RA_DISPELMAGIC, [CT_RA_DISEASE] = { CT_RA_CUREDISEASE, CT_RA_ABOLISHDISEASE } }, |
||
906 | [CT_RA_SHAMAN] = { [CT_RA_DISEASE] = CT_RA_CUREDISEASE, [CT_RA_POISON] = CT_RA_CUREPOISON }, |
||
907 | [CT_RA_DRUID] = { [CT_RA_CURSE] = CT_RA_REMOVECURSE, [CT_RA_POISON] = { CT_RA_CUREPOISON, CT_RA_ABOLISHPOISON } }, |
||
908 | [CT_RA_MAGE] = { [CT_RA_CURSE] = CT_RA_REMOVELESSERCURSE }, |
||
909 | [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 } } |
||
910 | }; |
||
911 | |||
912 | if ( arr[UnitClass("player")] and arr[UnitClass("player")][debuffType] ) then |
||
913 | if ( type(arr[UnitClass("player")][debuffType]) == "table" ) then |
||
914 | for k, v in arr[UnitClass("player")][debuffType] do |
||
915 | if ( CT_RA_ClassSpells[v] ) then |
||
916 | return 1; |
||
917 | end |
||
918 | end |
||
919 | elseif ( CT_RA_ClassSpells[arr[UnitClass("player")][debuffType]] ) then |
||
920 | return 1; |
||
921 | end |
||
922 | end |
||
923 | return nil; |
||
924 | end |
||
925 | |||
926 | -- Slash command to cure |
||
927 | CT_RA_RegisterSlashCmd("/racure", "Cures a debuff using the debuff curing system. Must be used in a macro.", 15, "RACURE", CT_RADebuff_Cure, "/racure"); |
||
928 | |||
929 | -- Hook functions to call CT_RADebuff_GetActionButtonCures |
||
930 | CT_RADebuff_oldPlaceAction = PlaceAction; |
||
931 | function CT_RADebuff_newPlaceAction(id) |
||
932 | CT_RADebuff_oldPlaceAction(id); |
||
933 | CT_RADebuff_GetActionButtonCures(); |
||
934 | end |
||
935 | PlaceAction = CT_RADebuff_newPlaceAction; |
||
936 | |||
937 | CT_RADebuff_oldPickupAction = PickupAction; |
||
938 | function CT_RADebuff_newPickupAction(id) |
||
939 | CT_RADebuff_oldPickupAction(id); |
||
940 | CT_RADebuff_GetActionButtonCures(); |
||
941 | end |
||
942 | PickupAction = CT_RADebuff_newPickupAction; |
||
943 | |||
944 | CT_RADebuff_oldUseAction = UseAction; |
||
945 | function CT_RADebuff_newUseAction(id, check, self) |
||
946 | local rebuild; |
||
947 | if ( CursorHasSpell() and not IsShiftKeyDown() ) then |
||
948 | rebuild = 1; |
||
949 | end |
||
950 | CT_RADebuff_oldUseAction(id, check, self); |
||
951 | if ( rebuild ) then |
||
952 | CT_RADebuff_GetActionButtonCures(); |
||
953 | end |
||
954 | end |
||
955 | UseAction = CT_RADebuff_newUseAction; |