vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 -- CountDoomSpellTimer stuff
2 -- Author: Scrum
3  
4  
5 CDTimerSpell_numSpells = 0;
6 CDTimerSpell_spellID = 0;
7  
8  
9 CDTimerSpells = {};
10 -- timerIndex = timerIndex;
11 -- warningHit = false;
12 -- spellAbbreviation = spellAbbreviation;
13 -- announceWarning = false;
14 -- warningSound = false;
15 -- announceEnd = false;
16 -- endSound = false;
17 -- targetName = nil;
18 -- targetLevel = nil;
19 -- type = nil;
20 -- ID = 0;
21  
22  
23 local function CDTimerSpell_Dump( spellIndex )
24 CountDoom.dpf( "Spell#: " .. spellIndex );
25 CountDoom.dpf( " timerIndex: " .. CountDoom.ToStr( CDTimerSpells[ spellIndex ].timerIndex ) );
26 CountDoom.dpf( " spellID: " .. CountDoom.ToStr( CDTimerSpells[ spellIndex ].spellID ) );
27 CountDoom.dpf( " warningHit: " .. CountDoom.ToStr( CDTimerSpells[ spellIndex ].warningHit ) );
28 CountDoom.dpf( " spellAbbreviation: " .. CDTimerSpells[ spellIndex ].spellAbbreviation );
29 CountDoom.dpf( " announceWarning: " .. CountDoom.ToStr( CDTimerSpells[ spellIndex ].announceWarning ) );
30 CountDoom.dpf( " warningSound: " .. CountDoom.ToStr( CDTimerSpells[ spellIndex ].warningSound ) );
31 CountDoom.dpf( " announceEnd: " .. CountDoom.ToStr( CDTimerSpells[ spellIndex ].announceEnd ) );
32 CountDoom.dpf( " endSound: " .. CountDoom.ToStr( CDTimerSpells[ spellIndex ].endSound ) );
33 end
34  
35  
36 local function CDTimerSpell_DumpAll()
37 if CountDoom.debugVerbose then
38 local spellIndex;
39 for spellIndex = 0, CDTimerSpell_numSpells - 1 do
40 CDTimerSpell_Dump( spellIndex );
41 end
42 end
43 end
44  
45  
46 local function CDTimerSpell_AnnounceMessage( msg )
47 if CountDoom.config.announceSpells == nil or CountDoom.config.announceSpells == "never" then
48 return;
49 end
50  
51 local announceRaid = CountDoom.config.announceSpells == "all" or CountDoom.config.announceSpells == "raid";
52 local announceParty = CountDoom.config.announceSpells == "all" or CountDoom.config.announceSpells == "party";
53  
54 local isRaid = GetNumRaidMembers() > 0;
55 local isParty = GetNumPartyMembers() > 0;
56  
57 if( CountDoom.debugVerbose ) then
58 isRaid = false;
59 isParty = false;
60 end
61  
62 if( announceRaid and isRaid ) then
63 SendChatMessage( msg, "RAID" )
64 elseif( announceParty and isParty ) then
65 SendChatMessage( msg, "PARTY" );
66 elseif ( CountDoom.config.announceSpells == "channel" )and
67 ( CountDoom.config.announceChannel ~= nil ) then
68  
69 local channelID = GetChannelName( CountDoom.config.announceChannel );
70 if channelID ~= nil then
71 SendChatMessage( msg, "CHANNEL", nil, channelID);
72 else
73 CountDoom.prt( msg, 1, 1, 1);
74 end
75 else
76 CountDoom.prt( msg, 1, 1, 1);
77 end
78 end
79  
80  
81 function CDTimerSpell_OnTimerWarning( timerIndex, timeUsed )
82 local spellIndex = CDTimer_GetUserHandle( timerIndex );
83  
84 if spellIndex == nil then
85 return;
86 elseif CDTimerSpells[ spellIndex ].warningHit ~= true then
87 if CountDoom.config.flashSpells ~= nil and
88 CountDoom.config.flashSpells == true then
89 CDTimer_EnableFlash( timerIndex, 2.0 );
90 end
91  
92 CDTimerSpells[ spellIndex ].warningHit = true;
93  
94 local spellAbbreviation = CDTimerSpells[ spellIndex ].spellAbbreviation;
95 local spellText = CountDoomSpell[ spellAbbreviation ].text;
96  
97 --
98 -- Announce a warning message
99 --
100 if CDTimerSpells[ spellIndex ].announceWarning then
101 local timeRemaining = CountDoomSpell[ spellAbbreviation ].warningTime;
102  
103 CDTimerSpell_AnnounceMessage( string.format( "%s has %d seconds remaining.", spellText, timeRemaining ) );
104 end
105  
106 --
107 -- Play a warning sound
108 --
109 if CDTimerSpells[ spellIndex ].warningSound and CountDoom.config.playSounds then
110 local soundFile = CountDoom.soundPath .. CDTimerSpells[ spellIndex ].warningSound .. ".wav";
111 CountDoom.dpf("Playing " .. soundFile);
112 PlaySoundFile(soundFile);
113 end
114 end
115 end
116  
117  
118 function CDTimerSpell_OnTimerEnd( timerIndex, arg1 )
119 local spellIndex = CDTimer_GetUserHandle( timerIndex );
120  
121 if spellIndex ~= nil then
122  
123 local spellAbbreviation = CDTimerSpells[ spellIndex ].spellAbbreviation;
124 local spellText = CountDoomSpell[ spellAbbreviation ].text;
125  
126 --
127 -- Announce a completion message
128 --
129 if CDTimerSpells[ spellIndex ].announceEnd then
130 CDTimerSpell_AnnounceMessage( string.format( "%s has finished.", spellText ) );
131 CDTimerSpells[ spellIndex ].announceEnd = false;
132 end
133  
134 --
135 -- Play a completion sound
136 --
137 if CDTimerSpells[ spellIndex ].endSound and CountDoom.config.playSounds then
138 local soundFile = CountDoom.soundPath .. CDTimerSpells[ spellIndex ].endSound .. ".wav";
139 CountDoom.dpf("Playing " .. soundFile);
140 PlaySoundFile(soundFile);
141 CDTimerSpells[ spellIndex ].endSound = false;
142 end
143  
144 local remainingTime = CDTimer_GetRemainingTime( timerIndex );
145 if (remainingTime + CountDoom.config.postExpireDelay) < 0 then
146 CDTimerSpell_DeleteIndex( spellIndex );
147 end
148 end
149 end
150  
151  
152 function CDTimerSpell_OnTimerMove( newTimerIndex, oldTimerIndex )
153 local spellIndex = CDTimer_GetUserHandle( newTimerIndex );
154 if spellIndex ~= nil then
155 if CDTimerSpells[ spellIndex ] ~= nil then
156 CDTimerSpells[ spellIndex ].timerIndex = newTimerIndex;
157 else
158 CountDoom.dpf( "Unexpected nil CDTimerSpells[ spellIndex ] in CDTimerSpell_OnTimerMove" );
159 end
160 else
161 CountDoom.dpf( "Unexpected nil spellIndex in CDTimerSpell_OnTimerMove" );
162 end
163 end
164  
165  
166 function CDTimerSpell_TargetUnit( spellIndex )
167 if spellIndex == nil then
168 return false
169 end
170  
171 local changedTarget = false;
172  
173 if CDTimerSpells[ spellIndex ].targetID == CountDoom.targetID then
174  
175 if (UnitName( "target" ) == nil and CDTimerSpells[ spellIndex ].targetName ~= nil) then
176 TargetByName( CDTimerSpells[ spellIndex ].targetName );
177 changedTarget = true;
178 end
179  
180 elseif UnitName( "target" ) == CDTimerSpells[ spellIndex ].targetName and
181  
182 UnitLevel( "target" ) == CDTimerSpells[ spellIndex ].targetLevel then
183 -- Nothing to do here as this matches our target
184  
185 elseif( CDTimerSpells[ spellIndex ].targetName ~= nil ) then
186  
187 ClearTarget();
188 TargetByName( CDTimerSpells[ spellIndex ].targetName );
189 changedTarget = true;
190  
191 end
192  
193 return changedTarget;
194 end
195  
196  
197 function CDTimerSpell_RecastSpell( spellIndex )
198 if spellIndex == nil or spellIndex == -1 then
199 return
200 end
201  
202 local spellAbbreviation = CDTimerSpells[ spellIndex ].spellAbbreviation;
203  
204 if spellAbbreviation ~= nil then
205 local spellName = CountDoomSpell[ spellAbbreviation ].text;
206  
207 -- recast spell
208 if spellName ~= nil and spellName ~= COUNTDOOMSPELL_SEDUCE then
209  
210 -- re-target this mob
211 local changedTarget = CDTimerSpell_TargetUnit( spellIndex );
212  
213 -- cast the spell
214 if CountDoom.spellTable and CountDoom.spellTable[spellName] then
215 local maxRank = CountDoom.spellTable[spellName].maxRank;
216  
217 if maxRank then
218 local tab = CountDoom.spellTable[spellName][maxRank].tab;
219 local spellID = CountDoom.spellTable[spellName][maxRank].spell;
220  
221 if spellID and tab then
222 CountDoom.dpf( "recasting " .. spellName .. " ID " .. spellID .. " tab " .. tab + 1 );
223 CastSpell( spellID, tab + 1 );
224 end
225 end
226 end
227  
228 -- revert to previous target
229 if changedTarget then
230 TargetLastTarget();
231 end
232 end
233 end
234 end
235  
236  
237 function CDTimerSpell_OnTimerClick( timerIndex, arg1 )
238 local spellIndex = CDTimer_GetUserHandle( timerIndex );
239  
240 CountDoom.dpf( "CDTimerSpell_OnTimerClick(spellIndex = " .. spellIndex .. " arg1 = " .. arg1 .. ")" );
241  
242 if arg1 == "LeftButton" then
243 if IsShiftKeyDown() then
244 if IsAltKeyDown() then
245 -- Do nothing. Too complex of a key combination
246 else
247 -- Delete this timer
248 CDTimerSpell_DeleteIndex( spellIndex );
249 end
250 elseif IsAltKeyDown() then
251 else
252 -- re-target this mob
253 CDTimerSpell_TargetUnit( spellIndex );
254 end
255 elseif arg1 == "RightButton" then
256 if IsShiftKeyDown() then
257 -- Cast secondary spell (conflagrate if immolated)
258 elseif IsAltKeyDown() then
259 else
260 -- recast the spell
261 CDTimerSpell_RecastSpell( spellIndex );
262 end
263 end
264 end
265  
266  
267 function CDTimerSpell_OnEnter( timerIndex )
268 local spellIndex = CDTimer_GetUserHandle( timerIndex );
269  
270 if spellIndex ~= nil then
271 local msg = "Target: ";
272 if( CDTimerSpells[ spellIndex ].targetName ~= nil ) then
273 msg = msg .. CDTimerSpells[ spellIndex ].targetName .. "(";
274 msg = msg .. CDTimerSpells[ spellIndex ].targetLevel .. ")";
275 end
276 GameTooltip:AddLine( msg, 1.00, 1.00, 1.00 );
277 end
278  
279 GameTooltip:AddLine("Left-click to target", 1.00, 1.00, 1.00);
280 --GameTooltip:AddLine("Right-click to re-cast", 1.00, 1.00, 1.00);
281 GameTooltip:AddLine("Shift+Left-click to delete", 1.00, 1.00, 1.00);
282 end
283  
284  
285 function CDTimerSpell_CreateTimerString(spellIndex)
286 local timerIndex = CDTimerSpells[ spellIndex ].timerIndex;
287 local targetName = CDTimerSpells[ spellIndex ].targetName;
288 local targetLevel = CDTimerSpells[ spellIndex ].targetLevel;
289 local spellAbbreviation = CDTimerSpells[ spellIndex ].spellAbbreviation;
290  
291 if targetName == nil then
292 targetName = "Unknown";
293 end;
294  
295 if targetLevel == nil then
296 targetLevel = "??";
297 end;
298  
299 local timerString = " - " .. string.upper(spellAbbreviation) .. " - ";
300 timerString = timerString .. CountDoom.ToStr(targetName) .. "(" .. CountDoom.ToStr(targetLevel) .. ")";
301  
302 return timerString;
303 end
304  
305  
306 function CDTimerSpell_CreateBySpellAbbreviation( spellAbbreviation, targetInfo, in_rank )
307 CountDoom.dpf( "CDTimerSpell_CreateBySpellAbbreviation( " .. CountDoom.ToStr( spellAbbreviation ) .. ")" );
308  
309 local spellIndex = -1;
310 local replacedASpell = false;
311  
312 if CountDoomSpell.IsEnabled( spellAbbreviation ) ~= true then
313 return -1, replacedASpell;
314 end
315  
316 --See if the spell is already on our target
317 local targetName = targetInfo.targetName;
318 local targetLevel = targetInfo.targetLevel;
319 local targetID = targetInfo.id;
320  
321 --If we're replacing a spell such as a curse, delete the old one
322 for spellIndex = 0, CDTimerSpell_numSpells - 1 do
323 if (CDTimerSpells[ spellIndex ].type == CountDoomSpell[ spellAbbreviation ].type ) and
324 CDTimerSpells[ spellIndex ].targetName == targetName and
325 CDTimerSpells[ spellIndex ].targetLevel == targetLevel then
326 if CountDoomSpell[ spellAbbreviation ].replacesSameType then
327 CDTimerSpell_DeleteIndex( spellIndex );
328 replacedASpell = true;
329 end
330 break;
331 end
332 end
333  
334 spellIndex = CDTimerSpell_numSpells;
335 CDTimerSpell_numSpells = CDTimerSpell_numSpells + 1;
336  
337 if CDTimerSpells[ spellIndex ] == nil then
338 CDTimerSpells[ spellIndex ] = {};
339 end
340  
341 --if rank was passed in as nil, use max rank
342 local rank = in_rank;
343 if rank == nil then
344 rank = 10;
345 end;
346  
347 --determine duration
348 local duration = nil;
349  
350 if CountDoomSpell[ spellAbbreviation ] ~= nil then
351 duration = CountDoomSpell[ spellAbbreviation ].rankDuration[ rank ];
352 end;
353  
354 while duration == nil and rank > 0 do
355 rank = rank - 1;
356 duration = CountDoomSpell[ spellAbbreviation ].rankDuration[ rank ];
357 end
358  
359 local warningTime = duration - CountDoomSpell[ spellAbbreviation ].warningTime;
360 local icon = CountDoomSpell[ spellAbbreviation ].icon;
361 local type = CountDoomSpell[ spellAbbreviation ].type;
362  
363 -- Give unique spellIDs to each spell.
364 local spellID = CDTimerSpell_spellID;
365 CDTimerSpell_spellID = CDTimerSpell_spellID + 1;
366 if CDTimerSpell_spellID > 1000 then
367 CDTimerSpell_spellID = 0;
368 end
369  
370 local timerIndex = CDTimer_Create( CDTIMERPRIORITY_MEDIUM, duration );
371 CDTimerSpells[ spellIndex ].timerIndex = timerIndex;
372 CDTimerSpells[ spellIndex ].warningHit = false;
373 CDTimerSpells[ spellIndex ].spellAbbreviation = spellAbbreviation;
374 CDTimerSpells[ spellIndex ].announceWarning = CountDoomSpell[ spellAbbreviation ].announceWarning;
375 CDTimerSpells[ spellIndex ].announceEnd = CountDoomSpell[ spellAbbreviation ].announceEnd;
376  
377 CDTimerSpells[ spellIndex ].warningSound = CountDoom.config.warningSound[ spellAbbreviation ];
378 CDTimerSpells[ spellIndex ].endSound = CountDoom.config.endSound[ spellAbbreviation ];
379  
380 CDTimerSpells[ spellIndex ].targetName = targetName;
381 CDTimerSpells[ spellIndex ].targetLevel = targetLevel;
382 CDTimerSpells[ spellIndex ].targetID = targetID;
383 CDTimerSpells[ spellIndex ].spellID = spellID;
384 CDTimerSpells[ spellIndex ].type = type;
385  
386 if CountDoom.config.layout == "textonly" then
387 local timerString = CDTimerSpell_CreateTimerString(spellIndex);
388 CDTimer_SetTimerSuffix( timerIndex, timerString );
389 end
390  
391 CDTimer_SetUserHandle( timerIndex, spellIndex );
392 CDTimer_SetWarningTime( timerIndex, warningTime );
393 CDTimer_SetCountDown( timerIndex, CountDoomSpell[ spellAbbreviation ].countDown );
394 CDTimer_SetFunctionHandler( timerIndex, CDTIMEREVENT_ONTIMERWARNING, CDTimerSpell_OnTimerWarning );
395 CDTimer_SetFunctionHandler( timerIndex, CDTIMEREVENT_ONTIMEREND, CDTimerSpell_OnTimerEnd );
396 CDTimer_SetFunctionHandler( timerIndex, CDTIMEREVENT_ONMOVETIMER, CDTimerSpell_OnTimerMove );
397 CDTimer_SetFunctionHandler( timerIndex, CDTIMEREVENT_ONCLICK, CDTimerSpell_OnTimerClick );
398 CDTimer_SetFunctionHandler( timerIndex, CDTIMEREVENT_ONENTER, CDTimerSpell_OnEnter );
399 CDTimer_SetIcon( timerIndex, icon );
400  
401 CDTimerSpell_DumpAll();
402  
403 return spellID, replacedASpell;
404 end
405  
406  
407 function CDTimerSpell_CreateBySpellName( spellName, targetInfo, rank )
408 CountDoom.dpf( "CDTimerSpell_CreateBySpellName(" .. CountDoom.ToStr( spellName ) .. ")" );
409  
410 -- Enslave Demon is detected differently than the rest of the Warlock spells.
411 -- It relies on a change on event in pet status
412 if spellName == COUNTDOOMSPELL_ENSLAVEDEMON then
413 return -1;
414 end
415  
416 local spellAbbreviation = CountDoomSpellMapping[ spellName ];
417 if spellAbbreviation ~= nil then
418 return CDTimerSpell_CreateBySpellAbbreviation( spellAbbreviation, targetInfo, rank );
419 end
420  
421 return -1, false;
422 end
423  
424  
425 function CDTimerSpell_DeleteIndex( spellIndex )
426 CountDoom.dpf( "CDTimerSpell_DeleteIndex(" .. CountDoom.ToStr( spellIndex ) .. ")" );
427  
428 if spellIndex >= CDTimerSpell_numSpells then
429 CountDoom.dpf( "Invalid param CDTimerSpell_DeleteIndex(" .. spellIndex .. ")" );
430 return;
431 end
432  
433 -- Destroy the timer associated with the spell
434 CDTimer_Destroy( CDTimerSpells[ spellIndex ].timerIndex );
435  
436 -- Collapse the array table by removing the deleted spell
437 local srcIndex;
438 for srcIndex = spellIndex + 1, CDTimerSpell_numSpells - 1do
439 local dstIndex = srcIndex - 1;
440 CDTimerSpells[ dstIndex ].timerIndex = CDTimerSpells[ srcIndex ].timerIndex;
441 CDTimerSpells[ dstIndex ].warningHit = CDTimerSpells[ srcIndex ].warningHit;
442 CDTimerSpells[ dstIndex ].spellAbbreviation = CDTimerSpells[ srcIndex ].spellAbbreviation;
443 CDTimerSpells[ dstIndex ].announceWarning = CDTimerSpells[ srcIndex ].announceWarning;
444 CDTimerSpells[ dstIndex ].warningSound = CDTimerSpells[ srcIndex ].warningSound;
445 CDTimerSpells[ dstIndex ].announceEnd = CDTimerSpells[ srcIndex ].announceEnd;
446 CDTimerSpells[ dstIndex ].endSound = CDTimerSpells[ srcIndex ].endSound;
447 CDTimerSpells[ dstIndex ].targetName = CDTimerSpells[ srcIndex ].targetName;
448 CDTimerSpells[ dstIndex ].targetLevel = CDTimerSpells[ srcIndex ].targetLevel;
449 CDTimerSpells[ dstIndex ].targetID = CDTimerSpells[ srcIndex ].targetID;
450 CDTimerSpells[ dstIndex ].spellID = CDTimerSpells[ srcIndex ].spellID;
451 CDTimerSpells[ dstIndex ].type = CDTimerSpells[ srcIndex ].type;
452  
453 CDTimer_SetUserHandle( CDTimerSpells[ dstIndex ].timerIndex, dstIndex );
454 end
455  
456 -- Update spell count
457 CDTimerSpell_numSpells = CDTimerSpell_numSpells - 1;
458  
459 -- Erase the last spell
460 CDTimerSpells[ CDTimerSpell_numSpells ] = nil;
461  
462 -- Dump all spells in debug mode
463 CDTimerSpell_DumpAll();
464 end
465  
466  
467 function CDTimerSpell_DeleteID( spellID )
468 CountDoom.dpf( "CDTimerSpell_DeleteID(" .. CountDoom.ToStr( spellID ) .. ")" );
469  
470 local matchingIndex = -1;
471 local spellIndex;
472 for spellIndex = 0, CDTimerSpell_numSpells - 1 do
473 if CDTimerSpells[ spellIndex ].spellID == spellID then
474 matchingIndex = spellIndex;
475 break;
476 end
477 end
478  
479 if matchingIndex ~= -1 then
480 CDTimerSpell_DeleteIndex( matchingIndex );
481 end
482 end
483  
484  
485 function CDTimerSpell_GetSpellIndex( spellID )
486 CountDoom.dpf( "CDTimerSpell_GetSpellIndex(" .. CountDoom.ToStr( spellID ) .. ")" );
487  
488 local matchingIndex = -1;
489 local spellIndex;
490 for spellIndex = 0, CDTimerSpell_numSpells - 1 do
491 if CDTimerSpells[ spellIndex ].spellID == spellID then
492 return spellIndex;
493 end
494 end
495  
496 return -1;
497 end
498  
499  
500 function CDTimerSpell_DeleteTarget( targetID )
501 CountDoom.dpf( "CDTimerSpell_DeleteID(" .. CountDoom.ToStr( targetID ) .. ")" );
502  
503 local matchingIndex = -1;
504 local spellIndex;
505 for spellIndex = 0, CDTimerSpell_numSpells - 1 do
506 if CDTimerSpells[ spellIndex ].targetID == targetID then
507 matchingIndex = spellIndex;
508 break;
509 end
510 end
511  
512 if matchingIndex ~= -1 then
513 CDTimerSpell_DeleteIndex( matchingIndex );
514 return true;
515 end
516 return false;
517 end
518  
519  
520 function CDTimerSpell_DestroyBySpellAbbreviation( spellAbbreviation )
521 local found = false;
522  
523 CountDoom.dpf( "CDTimerSpell_DestroyBySpellAbbreviation(" .. CountDoom.ToStr( spellAbbreviation ) .. " )" );
524  
525 -- Look for the spell in question
526 local foundIndex = 0;
527 local spellIndex;
528 for spellIndex = 0, CDTimerSpell_numSpells - 1 do
529 if CDTimerSpells[ spellIndex ].spellAbbreviation == spellAbbreviation then
530 CountDoom.dpf( "[spellIndex]: " .. CDTimerSpells[ spellIndex ].spellAbbreviation );
531 CountDoom.dpf( "spellAbbr: " .. spellAbbreviation );
532 found = true;
533 foundIndex = spellIndex;
534 break;
535 end
536 end
537  
538 if not found then
539 CountDoom.dpf( "Attempting to delete a spell not found: " .. spellAbbreviation );
540 return;
541 end
542  
543 CountDoom.dpf( CountDoom.ToStr( found ) .. " " .. CountDoom.ToStr( foundIndex ) .. ": " .. CountDoom.ToStr( CDTimerSpells[ foundIndex ].spellAbbreviation ) );
544  
545 -- Collapsed the spell table into a contiguous array
546 CDTimerSpell_DeleteIndex( foundIndex );
547 end
548  
549  
550 function CDTimerSpell_DestroyBySpellName( spellName )
551 CountDoom.dpf( "CDTimerSpell_DestroyBySpellName(" .. CountDoom.ToStr( spellName ) .. " )" );
552  
553 local spellAbbreviation = CountDoomSpellMapping[ spellName ];
554 if spellAbbreviation ~= nil then
555 CDTimerSpell_DestroyBySpellAbbreviation( spellAbbreviation );
556 end
557 end
558  
559  
560 function CDTimerSpell_GetSpellName( spellIndex )
561 if CDTimerSpells[ spellIndex ] ~= nil then
562 local spellAbbreviation = CDTimerSpells[ spellIndex ].spellAbbreviation;
563 if spellAbbreviation ~= nil and CountDoomSpell[ spellAbbreviation ] ~= nil then
564 return CountDoomSpell[ spellAbbreviation ].text;
565 else
566 CountDoom.dpf( "CDTimerSpell_GetSpellName failed: " .. spellAbbreviation );
567 end
568 end
569  
570 return nil;
571 end
572  
573  
574 function CDTimerSpell_RemoveCombatSpellTimers()
575 local spellIndex;
576  
577 for spellIndex = CDTimerSpell_numSpells - 1, 0, -1 do
578 local spellAbbreviation = CDTimerSpells[ spellIndex ].spellAbbreviation;
579 CountDoom.dpf( "Checking for combat removal: " .. spellAbbreviation );
580 if CountDoomSpell[ spellAbbreviation ].combatOnly then
581 CDTimerSpell_DeleteIndex( spellIndex );
582 end
583 end
584 end
585  
586  
587 function CDTimerSpell_UpdateSpellPrefixes()
588 local spellIndex;
589  
590 for spellIndex = 0, CDTimerSpell_numSpells - 1 do
591 local timerIndex = CDTimerSpells[ spellIndex ].timerIndex;
592 if CountDoom.config.layout == "textonly" then
593 local timerString = CDTimerSpell_CreateTimerString(spellIndex);
594 CDTimer_SetTimerSuffix( timerIndex, timerString );
595 else
596 CDTimer_SetTimerSuffix( timerIndex, nil );
597 end
598 end
599 end
600  
601  
602 function TargetHasMyDebuff(spellAbbreviation)
603 local spellIndex = 0;
604 local TimerSpell_numSpells = CDTimerSpell_numSpells - 1;
605 CountDoom.dpf(CDTimerSpell_numSpells.." Spells." );
606 for spellIndex = 0, TimerSpell_numSpells do
607 -- CountDoom.dpf(CDTimerSpells[ spellIndex ].targetName.."--"..UnitName("target"));
608 -- CountDoom.dpf(CDTimerSpells[ spellIndex ].spellAbbreviation.."--"..spellAbbreviation);
609 -- CountDoom.dpf(CDTimerSpells[ spellIndex ].targetLevel.."--"..UnitLevel("target"));
610 if CDTimerSpells[ spellIndex ].targetName == UnitName("target") and
611 CDTimerSpells[ spellIndex ].spellAbbreviation == spellAbbreviation and
612 CDTimerSpells[ spellIndex ].targetLevel == UnitLevel("target") then
613 return true;
614 end
615 end
616 return false;
617 end
618  
619 function CDTimerSpell_isDebuffCast(spellAbbreviation)
620 return TargetHasMyDebuff(spellAbbreviation);
621 end