vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 CCWatchEffectSelection = "";
2 local STATUS_COLOR = "|c000066FF";
3 local bModify = false;
4 local AR_DiagOpen = false;
5  
6 local DisplayTable = {}
7  
8 CCWatchConfig_SwatchFunc_SetColor =
9 {
10 ["Urge"] = function(x) CCWatch_SetColorCallback("Urge") end,
11 ["Low"] = function(x) CCWatch_SetColorCallback("Low") end,
12 ["Normal"] = function(x) CCWatch_SetColorCallback("Normal") end,
13 ["Effect"] = function(x) CCWatch_SetColorCallback("Effect") end,
14 }
15  
16 CCWatchConfig_SwatchFunc_CancelColor =
17 {
18 ["Urge"] = function(x) CCWatch_CancelColorCallback("Urge", x) end,
19 ["Low"] = function(x) CCWatch_CancelColorCallback("Low", x) end,
20 ["Normal"] = function(x) CCWatch_CancelColorCallback("Normal", x) end,
21 ["Effect"] = function(x) CCWatch_CancelColorCallback("Effect", x) end,
22 }
23  
24  
25 --[[
26 function POBJI(k, v)
27 local str = k.." : ";
28 if type(v) ~= "table" and type(v) ~= "userdata" and type(v) ~= "function" and type(v) ~= "nil" then
29 CCWatch_AddMessage(str..v);
30 else
31 str = str.."type = "..type(v);
32 if type(v) == "table" then
33 CCWatch_AddMessage(str.." -> ");
34 POBJ(v);
35 else
36 CCWatch_AddMessage(str);
37 end
38 end
39 end
40  
41 function POBJ(obj)
42 table.foreach(obj, POBJI);
43 end
44 --]]
45  
46 local function SetButtonPickerColor(button, color)
47 getglobal(button.."_SwatchTexture"):SetVertexColor(color.r, color.g, color.b);
48 getglobal(button.."_BorderTexture"):SetVertexColor(color.r, color.g, color.b);
49 getglobal(button).r = color.r;
50 getglobal(button).g = color.g;
51 getglobal(button).b = color.b;
52 end
53  
54 function CCWatch_DisableDropDown(dropDown)
55 getglobal(dropDown:GetName().."Text"):SetVertexColor(GRAY_FONT_COLOR.r, GRAY_FONT_COLOR.g, GRAY_FONT_COLOR.b);
56 getglobal(dropDown:GetName().."Button"):Disable();
57 end
58  
59 function CCWatch_EnableDropDown(dropDown)
60 getglobal(dropDown:GetName().."Text"):SetVertexColor(HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b);
61 getglobal(dropDown:GetName().."Button"):Enable();
62 end
63  
64  
65 function UpdateSortTable()
66 DisplayTable = {}
67 table.foreach(CCWATCH.CCS, function (k, v) table.insert(DisplayTable, k) end);
68 table.sort(DisplayTable);
69 end
70  
71 function CCWatchOptions_Toggle()
72 if(CCWatchOptionsFrame:IsVisible()) then
73 CCWatchOptionsFrame:Hide();
74 else
75 CCWatchOptionsFrame:Show();
76 end
77 end
78  
79  
80 --------------------------------------------------------------------------------
81 -- Main Frame
82 --------------------------------------------------------------------------------
83  
84 function CCWatchOptionsBarsTab_OnClick()
85 CCWatchOptionsBarsFrame:Show();
86 CCWatchOptionsEffectsFrame:Hide();
87 CCWatchOptionsLearnFrame:Hide();
88  
89 PlaySound("igMainMenuOptionCheckBoxOn");
90 end
91  
92 function CCWatchOptionsEffectsTab_OnClick()
93 CCWatchOptionsBarsFrame:Hide();
94 CCWatchOptionsEffectsFrame:Show();
95 CCWatchOptionsLearnFrame:Hide();
96  
97 PlaySound("igMainMenuOptionCheckBoxOn");
98 end
99  
100 function CCWatchOptionsLearnTab_OnClick()
101 CCWatchOptionsBarsFrame:Hide();
102 CCWatchOptionsEffectsFrame:Hide();
103 CCWatchOptionsLearnFrame:Show();
104  
105 PlaySound("igMainMenuOptionCheckBoxOn");
106 end
107  
108 function CCWatchOptionsBarsFrame_OnShow()
109 CCWatchOptionsBarsTabTexture:Show();
110 CCWatchOptionsBarsTab:SetBackdropBorderColor(1, 1, 1, 1);
111 end
112  
113 function CCWatchOptionsEffectsFrame_OnShow()
114 CCWatchOptionsEffectsTabTexture:Show();
115 CCWatchOptionsEffectsTab:SetBackdropBorderColor(1, 1, 1, 1);
116 end
117  
118 function CCWatchOptionsLearnFrame_OnShow()
119 CCWatchOptionsLearnTabTexture:Show();
120 CCWatchOptionsLearnTab:SetBackdropBorderColor(1, 1, 1, 1);
121 end
122  
123 function CCWatchOptionsBarsFrame_OnHide()
124 CCWatchOptionsBarsTabTexture:Hide();
125 CCWatchOptionsBarsTab:SetBackdropBorderColor(0.25, 0.25, 0.25, 1.0);
126 end
127  
128 function CCWatchOptionsEffectsFrame_OnHide()
129 CCWatchOptionsEffectsTabTexture:Hide();
130 CCWatchOptionsEffectsTab:SetBackdropBorderColor(0.25, 0.25, 0.25, 1.0);
131 end
132  
133 function CCWatchOptionsLearnFrame_OnHide()
134 CCWatchOptionsLearnTabTexture:Hide();
135 CCWatchOptionsLearnTab:SetBackdropBorderColor(0.25, 0.25, 0.25, 1.0);
136 end
137  
138 --------------------------------------------------------------------------------
139 -- Bars Frame
140 --------------------------------------------------------------------------------
141  
142 function CCWatchOptions_UnlockToggle()
143 if CCWATCH.STATUS == 2 then
144 CCWatch_BarLock();
145 CCWatch_AddMessage(CCWATCH_LOCKED);
146 else
147 CCWatch_BarUnlock();
148 CCWatch_AddMessage(CCWATCH_UNLOCKED);
149 end
150 end
151  
152 function CCWatchOptions_InvertToggle()
153 CCWATCH.INVERT = not CCWATCH.INVERT;
154 CCWatch_Save[CCWATCH.PROFILE].invert = CCWATCH.INVERT;
155 if CCWATCH.INVERT then
156 CCWatch_AddMessage(CCWATCH_INVERSION_ON);
157 else
158 CCWatch_AddMessage(CCWATCH_INVERSION_OFF);
159 end
160 end
161  
162 function CCWatchOptions_LeadingToggle()
163 CCWATCH.LEADINGTIMER = not CCWATCH.LEADINGTIMER;
164 CCWatch_Save[CCWATCH.PROFILE].LeadingTimer = CCWATCH.LEADINGTIMER;
165 if CCWATCH.LEADINGTIMER then
166 CCWatch_SetLeadingTimer(true);
167 CCWatch_AddMessage(CCWATCH_LEADINGTIMER_ON);
168 else
169 CCWatch_SetLeadingTimer(false);
170 CCWatch_AddMessage(CCWATCH_LEADINGTIMER_OFF);
171 end
172 end
173  
174 function CCWatchOptions_ColorOverTimeToggle()
175 CCWATCH.COLOROVERTIME = not CCWATCH.COLOROVERTIME;
176 CCWatch_Save[CCWATCH.PROFILE].ColorOverTime = CCWATCH.COLOROVERTIME;
177 if CCWATCH.COLOROVERTIME then
178 CCWatch_AddMessage(CCWATCH_COLOROVERTIME_ON);
179 else
180 CCWatch_AddMessage(CCWATCH_COLOROVERTIME_OFF);
181 end
182 end
183  
184 function CCWatchOptions_SetBarColorUrge()
185 CCWatch_Save[CCWATCH.PROFILE].CoTUrgeValue = CCWatchOptionsBarColorUrgeEdit:GetNumber();
186 CCWATCH.COTURGEVALUE = CCWatch_Save[CCWATCH.PROFILE].CoTUrgeValue;
187 end
188  
189 function CCWatchOptions_SetBarColorLow()
190 CCWatch_Save[CCWATCH.PROFILE].CoTLowValue = CCWatchOptionsBarColorLowEdit:GetNumber();
191 CCWATCH.COTLOWVALUE = CCWatch_Save[CCWATCH.PROFILE].CoTLowValue;
192 end
193  
194 function CCWatchGrowthDropDown_OnInit()
195 UIDROPDOWNMENU_INIT_MENU = "CCWatch_OptionsMenuGrowthDropDown";
196 local info = { };
197  
198 info.text = CCWATCH_OPTION_GROWTH_OFF;
199 info.value = "off";
200 info.owner = this;
201 info.func = CCWatchGrowthDropDown_OnClick;
202 UIDropDownMenu_AddButton(info);
203  
204 info.text = CCWATCH_OPTION_GROWTH_UP;
205 info.value = "up";
206 info.owner = this;
207 info.func = CCWatchGrowthDropDown_OnClick;
208 UIDropDownMenu_AddButton(info);
209  
210 info.text = CCWATCH_OPTION_GROWTH_DOWN;
211 info.value = "down";
212 info.owner = this;
213 info.func = CCWatchGrowthDropDown_OnClick;
214 UIDropDownMenu_AddButton(info);
215 end
216  
217 function CCWatchTimersDropDown_OnInit()
218 UIDROPDOWNMENU_INIT_MENU = "CCWatch_OptionsMenuTimersDropDown";
219 local info = { };
220  
221 info.text = CCWATCH_OPTION_TIMERS_OFF;
222 info.value = "off";
223 info.owner = this;
224 info.func = CCWatchTimersDropDown_OnClick;
225 UIDropDownMenu_AddButton(info);
226  
227 info.text = CCWATCH_OPTION_TIMERS_ON;
228 info.value = "on";
229 info.owner = this;
230 info.func = CCWatchTimersDropDown_OnClick;
231 UIDropDownMenu_AddButton(info);
232  
233 info.text = CCWATCH_OPTION_TIMERS_REVERSE;
234 info.value = "reverse";
235 info.owner = this;
236 info.func = CCWatchTimersDropDown_OnClick;
237 UIDropDownMenu_AddButton(info);
238 end
239  
240 function CCWatchGrowthDropDown_OnClick()
241 if (this.value == "off") then
242 CCWatch_Save[CCWATCH.PROFILE].growth = 0;
243 CCWATCH.GROWTH = CCWatch_Save[CCWATCH.PROFILE].growth;
244 CCWatchGrowthDropDownText:SetText(CCWATCH_OPTION_GROWTH_OFF);
245 CCWatch_AddMessage(CCWATCH_GROW_OFF);
246 elseif( this.value == "up" ) then
247 CCWatch_Save[CCWATCH.PROFILE].growth = 1;
248 CCWATCH.GROWTH = CCWatch_Save[CCWATCH.PROFILE].growth;
249 CCWatchGrowthDropDownText:SetText(CCWATCH_OPTION_GROWTH_UP);
250 CCWatch_AddMessage(CCWATCH_GROW_UP);
251 elseif( this.value == "down" ) then
252 CCWatch_Save[CCWATCH.PROFILE].growth = 2;
253 CCWATCH.GROWTH = CCWatch_Save[CCWATCH.PROFILE].growth;
254 CCWatchGrowthDropDownText:SetText(CCWATCH_OPTION_GROWTH_DOWN);
255 CCWatch_AddMessage(CCWATCH_GROW_DOWN);
256 end
257 end
258  
259 function CCWatchTimersDropDown_OnClick()
260 if (this.value == "off") then
261 CCWatch_Save[CCWATCH.PROFILE].timers = 0;
262 CCWATCH.TIMERS = CCWatch_Save[CCWATCH.PROFILE].timers;
263 CCWatchTimersDropDownText:SetText(CCWATCH_OPTION_TIMERS_OFF);
264 CCWatch_AddMessage(CCWATCH_TIMERS_OFF);
265 elseif( this.value == "on" ) then
266 CCWatch_Save[CCWATCH.PROFILE].timers = 1;
267 CCWATCH.TIMERS = CCWatch_Save[CCWATCH.PROFILE].timers;
268 CCWatchTimersDropDownText:SetText(CCWATCH_OPTION_TIMERS_ON);
269 CCWatch_AddMessage(CCWATCH_TIMERS_ON);
270 elseif( this.value == "reverse" ) then
271 CCWatch_Save[CCWATCH.PROFILE].timers = 2;
272 CCWATCH.TIMERS = CCWatch_Save[CCWATCH.PROFILE].timers;
273 CCWatchTimersDropDownText:SetText(CCWATCH_OPTION_TIMERS_REVERSE);
274 CCWatch_AddMessage(CCWATCH_TIMERS_REVERSE);
275 end
276 end
277  
278 --------------------------------------------------------------------------------
279 -- Monitor Frame
280 --------------------------------------------------------------------------------
281  
282 function CCWatchOptions_MonitorCCToggle()
283 CCWATCH.MONITORING = bit.bxor(CCWATCH.MONITORING, ETYPE_CC);
284 CCWatch_Save[CCWATCH.PROFILE].Monitoring = CCWATCH.MONITORING;
285 if bit.band(CCWATCH.MONITORING, ETYPE_DEBUFF) == 0 then
286 if bit.band(CCWATCH.MONITORING, ETYPE_CC) ~= 0 then
287 CCWatchObject:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_CREATURE_DAMAGE");
288 CCWatchObject:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_DAMAGE");
289 else
290 CCWatchObject:UnregisterEvent("CHAT_MSG_SPELL_PERIODIC_CREATURE_DAMAGE");
291 CCWatchObject:UnregisterEvent("CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_DAMAGE");
292 end
293 end
294 end
295  
296 function CCWatchOptions_MonitorDebuffToggle()
297 CCWATCH.MONITORING = bit.bxor(CCWATCH.MONITORING, ETYPE_DEBUFF);
298 CCWatch_Save[CCWATCH.PROFILE].Monitoring = CCWATCH.MONITORING;
299 if bit.band(CCWATCH.MONITORING, ETYPE_CC) == 0 then
300 if bit.band(CCWATCH.MONITORING, ETYPE_DEBUFF) ~= 0 then
301 CCWatchObject:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_CREATURE_DAMAGE");
302 CCWatchObject:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_DAMAGE");
303 else
304 CCWatchObject:UnregisterEvent("CHAT_MSG_SPELL_PERIODIC_CREATURE_DAMAGE");
305 CCWatchObject:UnregisterEvent("CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_DAMAGE");
306 end
307 end
308 end
309  
310 function CCWatchOptions_MonitorBuffToggle()
311 CCWATCH.MONITORING = bit.bxor(CCWATCH.MONITORING, ETYPE_BUFF);
312 CCWatch_Save[CCWATCH.PROFILE].Monitoring = CCWATCH.MONITORING;
313 if bit.band(CCWATCH.MONITORING, ETYPE_BUFF) ~= 0 then
314 CCWatchObject:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_CREATURE_BUFFS");
315 CCWatchObject:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_BUFFS");
316 else
317 CCWatchObject:UnregisterEvent("CHAT_MSG_SPELL_PERIODIC_CREATURE_BUFFS");
318 CCWatchObject:UnregisterEvent("CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_BUFFS");
319 end
320 end
321  
322 function CCWatchOptions_ArcanistToggle()
323 CCWATCH.ARCANIST = not CCWATCH.ARCANIST;
324 CCWatch_Save[CCWATCH.PROFILE].arcanist = CCWATCH.ARCANIST;
325 if CCWATCH.ARCANIST then
326 CCWATCH.CCS[CCWATCH_POLYMORPH].LENGTH = CCWATCH.CCS[CCWATCH_POLYMORPH].LENGTH + 15;
327 CCWatch_AddMessage(CCWATCH_ARCANIST_ON);
328 else
329 CCWATCH.CCS[CCWATCH_POLYMORPH].LENGTH = CCWATCH.CCS[CCWATCH_POLYMORPH].LENGTH - 15;
330 CCWatch_AddMessage(CCWATCH_ARCANIST_OFF);
331 end
332 CCWatchOptionsFrameArcanist:SetChecked(CCWATCH.ARCANIST);
333 end
334  
335 function CCWatchOptions_WarnAppliedToggle()
336 CCWATCH.WARNMSG = bit.bxor(CCWATCH.WARNMSG, CCW_EWARN_APPLIED);
337 CCWatch_Save[CCWATCH.PROFILE].WarnMsg = CCWATCH.WARNMSG;
338 CCWatchOptionsFrameWarnApplied:SetChecked(bit.band(CCWATCH.WARNMSG, CCW_EWARN_APPLIED));
339 end
340  
341 function CCWatchOptions_WarnFadedToggle()
342 CCWATCH.WARNMSG = bit.bxor(CCWATCH.WARNMSG, CCW_EWARN_FADED);
343 CCWatch_Save[CCWATCH.PROFILE].WarnMsg = CCWATCH.WARNMSG;
344 CCWatchOptionsFrameWarnFaded:SetChecked(bit.band(CCWATCH.WARNMSG, CCW_EWARN_FADED));
345 end
346  
347 function CCWatchOptions_WarnBrokenToggle()
348 CCWATCH.WARNMSG = bit.bxor(CCWATCH.WARNMSG, CCW_EWARN_BROKEN);
349 CCWatch_Save[CCWATCH.PROFILE].WarnMsg = CCWATCH.WARNMSG;
350 CCWatchOptionsFrameWarnBroken:SetChecked(bit.band(CCWATCH.WARNMSG, CCW_EWARN_BROKEN));
351 end
352  
353 function CCWatchOptions_WarnLowTimeToggle()
354 CCWATCH.WARNMSG = bit.bxor(CCWATCH.WARNMSG, CCW_EWARN_LOWTIME);
355 CCWatch_Save[CCWATCH.PROFILE].WarnMsg = CCWATCH.WARNMSG;
356 CCWatchOptionsFrameWarnLowTime:SetChecked(bit.band(CCWATCH.WARNMSG, CCW_EWARN_LOWTIME));
357 end
358  
359 function CCWatchOptions_SetWarnLow()
360 CCWatch_Save[CCWATCH.PROFILE].WarnLow = CCWatchOptionsFrameWarnLowEdit:GetNumber();
361 CCWATCH.WARNLOW = CCWatch_Save[CCWATCH.PROFILE].WarnLow;
362 end
363  
364 function CCWatchOptionsStyleDropDown_OnInit()
365 UIDROPDOWNMENU_INIT_MENU = "CCWatch_OptionsStyleDropDown";
366 local info = { };
367  
368 info.text = CCWATCH_OPTION_STYLE_CURRENT;
369 info.value = "normal";
370 info.owner = this;
371 info.func = CCWatchOptionsStyleDropDown_OnClick;
372 UIDropDownMenu_AddButton(info);
373  
374 info.text = CCWATCH_OPTION_STYLE_RECENT;
375 info.value = "recent";
376 info.owner = this;
377 info.func = CCWatchOptionsStyleDropDown_OnClick;
378 UIDropDownMenu_AddButton(info);
379  
380 info.text = CCWATCH_OPTION_STYLE_ALL;
381 info.value = "all";
382 info.owner = this;
383 info.func = CCWatchOptionsStyleDropDown_OnClick;
384 UIDropDownMenu_AddButton(info);
385 end
386  
387 function CCWatchOptionsStyleDropDown_OnClick()
388 if (this.value == "normal") then
389 CCWatch_Save[CCWATCH.PROFILE].style = 0;
390 CCWATCH.STYLE = CCWatch_Save[CCWATCH.PROFILE].style;
391 CCWatchOptionsStyleDropDownText:SetText(CCWATCH_OPTION_STYLE_CURRENT);
392 CCWatch_AddMessage(CCWATCH_STYLE_CURRENT);
393 elseif( this.value == "recent" ) then
394 CCWatch_Save[CCWATCH.PROFILE].style = 1;
395 CCWATCH.STYLE = CCWatch_Save[CCWATCH.PROFILE].style;
396 CCWatchOptionsStyleDropDownText:SetText(CCWATCH_OPTION_STYLE_RECENT);
397 CCWatch_AddMessage(CCWATCH_STYLE_RECENT);
398 elseif( this.value == "all" ) then
399 CCWatch_Save[CCWATCH.PROFILE].style = 2;
400 CCWATCH.STYLE = CCWatch_Save[CCWATCH.PROFILE].style;
401 CCWatchOptionsStyleDropDownText:SetText(CCWATCH_OPTION_STYLE_ALL);
402 CCWatch_AddMessage(CCWATCH_STYLE_ALL);
403 end
404 end
405  
406  
407 function CCWatchOptionsWarnCCDropDown_OnInit()
408 UIDROPDOWNMENU_INIT_MENU = "CCWatch_OptionsWarnCCDropDown";
409 local info = { };
410  
411 info.text = "EMOTE";
412 info.value = "EMOTE";
413 info.owner = this;
414 info.func = CCWatchOptionsWarnCCDropDown_OnClick;
415 UIDropDownMenu_AddButton(info);
416  
417 info.text = "SAY";
418 info.value = "SAY";
419 info.owner = this;
420 info.func = CCWatchOptionsWarnCCDropDown_OnClick;
421 UIDropDownMenu_AddButton(info);
422  
423 info.text = "PARTY";
424 info.value = "PARTY";
425 info.owner = this;
426 info.func = CCWatchOptionsWarnCCDropDown_OnClick;
427 UIDropDownMenu_AddButton(info);
428  
429 info.text = "RAID";
430 info.value = "RAID";
431 info.owner = this;
432 info.func = CCWatchOptionsWarnCCDropDown_OnClick;
433 UIDropDownMenu_AddButton(info);
434  
435 info.text = "YELL";
436 info.value = "YELL";
437 info.owner = this;
438 info.func = CCWatchOptionsWarnCCDropDown_OnClick;
439 UIDropDownMenu_AddButton(info);
440  
441 info.text = "CHANNEL";
442 info.value = "CHANNEL";
443 info.owner = this;
444 info.func = CCWatchOptionsWarnCCDropDown_OnClick;
445 UIDropDownMenu_AddButton(info);
446 end
447  
448 function CCWatchOptionsWarnCCDropDown_OnClick()
449 if (this.value == "EMOTE") or (this.value == "SAY") or (this.value == "PARTY")
450 or (this.value == "RAID") or (this.value == "YELL") or (this.value == "CHANNEL") then
451 CCWatch_Save[CCWATCH.PROFILE].WarnType = this.value;
452 CCWATCH.WARNTYPE = CCWatch_Save[CCWATCH.PROFILE].WarnType;
453 CCWatchOptionsWarnCCDropDownText:SetText(this.value);
454 if (this.value == "CHANNEL") then
455 CCWatchOptionsFrameCustomCCEdit:Show();
456 else
457 CCWatchOptionsFrameCustomCCEdit:Hide();
458 end
459 CCWatch_AddMessage(CCWATCH_WARNCC_SETTO..this.value);
460 end
461 end
462  
463 function CCWatchOptions_SetCustomCC()
464 CCWatch_Save[CCWATCH.PROFILE].WarnCustomCC = CCWatchOptionsFrameCustomCCEdit:GetText();
465 CCWATCH.WARNCUSTOMCC = CCWatch_Save[CCWATCH.PROFILE].WarnCustomCC;
466 end
467  
468 --------------------------------------------------------------------------------
469 -- Learn Frame
470 --------------------------------------------------------------------------------
471  
472 function CCWatchOptions_MonitorToggle()
473 end
474  
475 function CCWatchOptions_WarnToggle()
476 end
477  
478 function CCWatchOptions_UseColorToggle()
479 if CCWatchOptionsEffectUseColor:GetChecked() then
480 CCWatchOptionsBarColorEffect:Enable();
481 else
482 CCWatchOptionsBarColorEffect:Disable();
483 end
484 end
485  
486 function CCWatchOptionsEffectTypeDropDown_OnInit()
487 UIDROPDOWNMENU_INIT_MENU = "CCWatch_OptionsEffectTypeDropDown";
488 local info = { };
489  
490 info.text = "CC";
491 info.value = "cc";
492 info.owner = this;
493 info.func = CCWatchOptionsEffectTypeDropDown_OnClick;
494 UIDropDownMenu_AddButton(info);
495  
496 info.text = "DEBUFF";
497 info.value = "debuff";
498 info.owner = this;
499 info.func = CCWatchOptionsEffectTypeDropDown_OnClick;
500 UIDropDownMenu_AddButton(info);
501  
502 info.text = "BUFF";
503 info.value = "buff";
504 info.owner = this;
505 info.func = CCWatchOptionsEffectTypeDropDown_OnClick;
506 UIDropDownMenu_AddButton(info);
507 end
508  
509 function CCWatchOptionsEffectGroupDropDown_OnInit()
510 UIDROPDOWNMENU_INIT_MENU = "CCWatch_OptionsEffectGroupDropDown";
511 local info = { };
512  
513 info.text = "1";
514 info.value = "1";
515 info.owner = this;
516 info.func = CCWatchOptionsEffectGroupDropDown_OnClick;
517 UIDropDownMenu_AddButton(info);
518  
519 info.text = "2";
520 info.value = "2";
521 info.owner = this;
522 info.func = CCWatchOptionsEffectGroupDropDown_OnClick;
523 UIDropDownMenu_AddButton(info);
524  
525 info.text = "3";
526 info.value = "3";
527 info.owner = this;
528 info.func = CCWatchOptionsEffectGroupDropDown_OnClick;
529 UIDropDownMenu_AddButton(info);
530  
531 info.text = "4";
532 info.value = "4";
533 info.owner = this;
534 info.func = CCWatchOptionsEffectGroupDropDown_OnClick;
535 UIDropDownMenu_AddButton(info);
536  
537 info.text = "5";
538 info.value = "5";
539 info.owner = this;
540 info.func = CCWatchOptionsEffectGroupDropDown_OnClick;
541 UIDropDownMenu_AddButton(info);
542 end
543  
544 function CCWatchOptionsEffectDRDropDown_OnInit()
545 UIDROPDOWNMENU_INIT_MENU = "CCWatch_OptionsEffectDRDropDown";
546 local info = { };
547  
548 info.text = CCWATCH_OPTION_DR_NEVER;
549 info.value = "0";
550 info.owner = this;
551 info.func = CCWatchOptionsEffectDRDropDown_OnClick;
552 UIDropDownMenu_AddButton(info);
553  
554 info.text = CCWATCH_OPTION_DR_MOBPLAYERS;
555 info.value = "1";
556 info.owner = this;
557 info.func = CCWatchOptionsEffectDRDropDown_OnClick;
558 UIDropDownMenu_AddButton(info);
559  
560 info.text = CCWATCH_OPTION_DR_PLAYERS;
561 info.value = "2";
562 info.owner = this;
563 info.func = CCWatchOptionsEffectDRDropDown_OnClick;
564 UIDropDownMenu_AddButton(info);
565 end
566  
567 function CCWatchOptionsEffectTypeDropDown_OnClick()
568 if (this.value == "cc") then
569 CCWatchOptionsEffectTypeDropDownText:SetText("CC");
570 elseif( this.value == "debuff" ) then
571 CCWatchOptionsEffectTypeDropDownText:SetText("DEBUFF");
572 elseif( this.value == "buff" ) then
573 CCWatchOptionsEffectTypeDropDownText:SetText("BUFF");
574 end
575 end
576  
577 function CCWatchOptionsEffectDRDropDown_OnClick()
578 if (this.value == "0") then
579 CCWatchOptionsEffectDRDropDownText:SetText(CCWATCH_OPTION_DR_NEVER);
580 elseif( this.value == "1") then
581 CCWatchOptionsEffectDRDropDownText:SetText(CCWATCH_OPTION_DR_MOBPLAYERS);
582 else
583 CCWatchOptionsEffectDRDropDownText:SetText(CCWATCH_OPTION_DR_PLAYERS);
584 end
585 end
586  
587 function CCWatchOptionsEffectGroupDropDown_OnClick()
588 CCWatchOptionsEffectGroupDropDownText:SetText(this.value);
589 end
590  
591 function CCWatchOptionsLearnDelete_OnClick()
592 -- Pop alert to confirm deletion
593 CCWatch_ShowDeletePrompt();
594 end
595  
596  
597 function CCWatchOptionsLearnClear_OnClick()
598 CCWatchOptionsEffectNameEdit:SetText("");
599 CCWatchOptionsEffectNameStatic:SetText("");
600 CCWatchOptionsEffectDurationEdit:SetText("");
601 CCWatchOptionsEffectDurationStatic:SetText("");
602  
603 CCWatchOptionsEffectTypeDropDownText:SetText("CC");
604 CCWatchOptionsEffectGroupDropDownText:SetText("1");
605 CCWatchOptionsEffectDRDropDownText:SetText(CCWATCH_OPTION_DR_NEVER);
606 CCWatchOptionsEffectMonitor:SetChecked(true);
607 CCWatchOptionsEffectWarn:SetChecked(false);
608 CCWatchOptionsEffectUseColor:SetChecked(false);
609 CCWatchOptionsBarColorEffect:Disable();
610 SetButtonPickerColor("CCWatchOptionsBarColorEffect", {r=0,g=0,b=0});
611  
612 CCWatchOptionsLearnModify:SetText("Add");
613 bModify = false;
614  
615 CCWatch_EnableDropDown(CCWatchOptionsEffectTypeDropDown);
616 CCWatch_EnableDropDown(CCWatchOptionsEffectGroupDropDown);
617 CCWatch_EnableDropDown(CCWatchOptionsEffectDRDropDown);
618 CCWatchOptionsEffectNameEdit:Show();
619 CCWatchOptionsEffectDurationEdit:Show();
620 end
621  
622 function CCWatchOptionsLearnModify_OnClick()
623 local effect = CCWatchOptionsEffectNameEdit:GetText();
624 local duration = CCWatchOptionsEffectDurationEdit:GetNumber();
625 local group = CCWatchOptionsEffectGroupDropDownText:GetText();
626 local stype = CCWatchOptionsEffectTypeDropDownText:GetText();
627 local sdr = CCWatchOptionsEffectDRDropDownText:GetText();
628 local monitor = CCWatchOptionsEffectMonitor:GetChecked();
629 local warn = CCWatchOptionsEffectWarn:GetChecked();
630  
631 local color = {r=0, g=0, b=0};
632  
633 local etype;
634 local edr;
635 if stype == "BUFF" then
636 etype = ETYPE_BUFF;
637 elseif stype == "DEBUFF" then
638 etype = ETYPE_DEBUFF;
639 else
640 etype = ETYPE_CC;
641 end
642  
643 if dr == CCWATCH_OPTION_DR_NEVER then
644 edr = 0;
645 elseif sdr == CCWATCH_OPTION_DR_MOBPLAYERS then
646 edr = 1;
647 else
648 edr = 2;
649 end
650  
651 if effect == "" then
652 message("Invalid Effect name");
653 return;
654 end
655 if duration <= 0 then
656 message("Invalid duration.");
657 return;
658 end
659  
660 if CCWatchOptionsEffectUseColor:GetChecked() then
661 color.r = CCWatchOptionsBarColorEffect.r;
662 color.g = CCWatchOptionsBarColorEffect.g;
663 color.b = CCWatchOptionsBarColorEffect.b;
664 else
665 color = nil;
666 end
667  
668 if bModify then
669 -- modifying
670 -- check if existing custom effect
671 if CCWatch_Save[CCWATCH.PROFILE].SavedCC[effect] ~= nil then
672 if effect ~= CCWatchEffectSelection then -- skillname change...
673 -- remove old effect
674 CCWATCH.CCS[CCWatchEffectSelection] = nil;
675 CCWatch_Save[CCWATCH.PROFILE].ConfCC[CCWatchEffectSelection] = nil;
676 CCWatch_Save[CCWATCH.PROFILE].SavedCC[CCWatchEffectSelection] = nil;
677 end
678 -- add/update effect
679 CCWatchAddEffect(false, effect, group, etype, duration, edr, monitor, warn, color);
680 else -- if not we are modifying a builtin effect
681 if effect ~= CCWatchEffectSelection then -- skillname change...
682 message("WARNING : adding an effect require to select the NEW button");
683 end
684 CCWatchAddEffect(true, effect, group, etype, duration, edr, monitor, warn, color);
685 end
686 else
687 -- add
688 if CCWATCH.CCS[effect] ~= nil then
689 message("Effect '"..effect.."' already exist.\nPlease select Edit to modify it");
690 return;
691 else
692 CCWatchAddEffect(false, effect, group, etype, duration, edr, monitor, warn, color);
693 end
694 end
695 UpdateSortTable();
696 CCWatchOptionsEffects_Update();
697 CCWatch_AddMessage(CCWATCH_EFFECT.." "..effect..CCWATCH_ADDEDMODIFIED);
698 end
699  
700 --------------------------------------------------------------------------------
701 -- Custom effect management
702 --------------------------------------------------------------------------------
703  
704 function CCWatchAddEffect(builtin, effect, group, etype, duration, diminishes, monitor, warn, color)
705 local iWarn;
706 if warn then
707 iWarn = 1;
708 else
709 iWarn = 0;
710 end
711 CCWATCH.CCS[effect] = {
712 GROUP = tonumber(group),
713 ETYPE = etype,
714 LENGTH = duration,
715 DIMINISHES = diminishes,
716 MONITOR = monitor,
717 WARN = iWarn,
718 COLOR = color,
719  
720 TARGET = "",
721 PLAYER = nil,
722 TIMER_START = 0,
723 TIMER_END = 0,
724 DIMINISH = 1
725 };
726  
727 if builtin then
728 CCWatch_Save[CCWATCH.PROFILE].ConfCC[effect] = {
729 MONITOR = monitor,
730 WARN = iWarn,
731 COLOR = color
732 };
733 else
734 CCWatch_Save[CCWATCH.PROFILE].SavedCC[effect] = {
735 GROUP = tonumber(group),
736 ETYPE = etype,
737 LENGTH = duration,
738 DIMINISHES = diminishes,
739 MONITOR = monitor,
740 WARN = iWarn,
741 COLOR = color
742 };
743 end
744 end
745  
746 function CCWatch_SetColorCallback(id)
747 local iRed, iGreen, iBlue = ColorPickerFrame:GetColorRGB();
748 local swatch, button, border;
749  
750 button = getglobal("CCWatchOptionsBarColor" .. id);
751 swatch = getglobal("CCWatchOptionsBarColor" .. id .. "_SwatchTexture");
752 border = getglobal("CCWatchOptionsBarColor" .. id .. "_BorderTexture");
753  
754 swatch:SetVertexColor(iRed, iGreen, iBlue);
755 border:SetVertexColor(iRed, iGreen, iBlue);
756 button.r = iRed;
757 button.g = iGreen;
758 button.b = iBlue;
759  
760 if id == "Urge" then
761 CCWATCH.COTURGECOLOR.r = iRed;
762 CCWATCH.COTURGECOLOR.g = iGreen;
763 CCWATCH.COTURGECOLOR.b = iBlue;
764 CCWatch_Save[CCWATCH.PROFILE].CoTUrgeColor = CCWATCH.COTURGECOLOR;
765 elseif id == "Low" then
766 CCWATCH.COTLOWCOLOR.r = iRed;
767 CCWATCH.COTLOWCOLOR.g = iGreen;
768 CCWATCH.COTLOWCOLOR.b = iBlue;
769 CCWatch_Save[CCWATCH.PROFILE].CoTLowColor = CCWATCH.COTLOWCOLOR;
770 elseif id == "Normal" then
771 CCWATCH.COTNORMALCOLOR.r = iRed;
772 CCWATCH.COTNORMALCOLOR.g = iGreen;
773 CCWATCH.COTNORMALCOLOR.b = iBlue;
774 CCWatch_Save[CCWATCH.PROFILE].CoTNormalColor = CCWATCH.COTNORMALCOLOR;
775 end
776 end
777  
778 function CCWatch_CancelColorCallback(id, prev)
779 local iRed = prev.r;
780 local iGreen = prev.g;
781 local iBlue = prev.b;
782  
783 local swatch, button, border;
784  
785 button = getglobal("CCWatchOptionsBarColor" .. id);
786 swatch = getglobal("CCWatchOptionsBarColor" .. id .. "_SwatchTexture");
787 border = getglobal("CCWatchOptionsBarColor" .. id .. "_BorderTexture");
788  
789 swatch:SetVertexColor(iRed, iGreen, iBlue);
790 border:SetVertexColor(iRed, iGreen, iBlue);
791 button.r = iRed;
792 button.g = iGreen;
793 button.b = iBlue;
794 end
795  
796  
797  
798 function CCWatchOptionsLearnFillFields()
799 if CCWatchEffectSelection == nil then
800 return;
801 end
802  
803 -- check if builtin effect to disable editing
804 if CCWatch_Save[CCWATCH.PROFILE].SavedCC[CCWatchEffectSelection] == nil then
805 CCWatch_DisableDropDown(CCWatchOptionsEffectTypeDropDown);
806 CCWatch_DisableDropDown(CCWatchOptionsEffectGroupDropDown);
807 CCWatch_DisableDropDown(CCWatchOptionsEffectDRDropDown);
808 -- hack because I have no other idea
809 CCWatchOptionsEffectNameEdit:Hide();
810 CCWatchOptionsEffectDurationEdit:Hide();
811 CCWatchOptionsEffectNameStatic:SetText(CCWatchEffectSelection);
812 CCWatchOptionsEffectDurationStatic:SetText(CCWATCH.CCS[CCWatchEffectSelection].LENGTH);
813 else
814 CCWatch_EnableDropDown(CCWatchOptionsEffectTypeDropDown);
815 CCWatch_EnableDropDown(CCWatchOptionsEffectGroupDropDown);
816 CCWatch_EnableDropDown(CCWatchOptionsEffectDRDropDown);
817 CCWatchOptionsEffectNameEdit:Show();
818 CCWatchOptionsEffectDurationEdit:Show();
819 CCWatchOptionsEffectNameStatic:SetText("");
820 CCWatchOptionsEffectDurationStatic:SetText("");
821 end
822 CCWatchOptionsEffectNameEdit:SetText(CCWatchEffectSelection);
823 CCWatchOptionsEffectDurationEdit:SetText(CCWATCH.CCS[CCWatchEffectSelection].LENGTH);
824  
825 if CCWATCH.CCS[CCWatchEffectSelection].ETYPE == ETYPE_BUFF then
826 CCWatchOptionsEffectTypeDropDownText:SetText("BUFF");
827 elseif CCWATCH.CCS[CCWatchEffectSelection].ETYPE == ETYPE_DEBUFF then
828 CCWatchOptionsEffectTypeDropDownText:SetText("DEBUFF");
829 else
830 CCWatchOptionsEffectTypeDropDownText:SetText("CC");
831 end
832 CCWatchOptionsEffectGroupDropDownText:SetText(CCWATCH.CCS[CCWatchEffectSelection].GROUP);
833  
834 if CCWATCH.CCS[CCWatchEffectSelection].DIMINISHES == 0 then
835 CCWatchOptionsEffectDRDropDownText:SetText(CCWATCH_OPTION_DR_NEVER);
836 elseif CCWATCH.CCS[CCWatchEffectSelection].DIMINISHES == 1 then
837 CCWatchOptionsEffectDRDropDownText:SetText(CCWATCH_OPTION_DR_MOBPLAYERS);
838 else
839 CCWatchOptionsEffectDRDropDownText:SetText(CCWATCH_OPTION_DR_PLAYERS);
840 end
841  
842 CCWatchOptionsEffectMonitor:SetChecked(CCWATCH.CCS[CCWatchEffectSelection].MONITOR);
843 local bFlag = CCWATCH.CCS[CCWatchEffectSelection].WARN > 0;
844 CCWatchOptionsEffectWarn:SetChecked(bFlag);
845  
846 if CCWATCH.CCS[CCWatchEffectSelection].COLOR ~= nil then
847 CCWatchOptionsEffectUseColor:SetChecked(true);
848 CCWatchOptionsBarColorEffect:Enable();
849 SetButtonPickerColor("CCWatchOptionsBarColorEffect", CCWATCH.CCS[CCWatchEffectSelection].COLOR);
850 else
851 CCWatchOptionsEffectUseColor:SetChecked(false);
852 CCWatchOptionsBarColorEffect:Disable();
853 SetButtonPickerColor("CCWatchOptionsBarColorEffect", {r=1,g=1,b=1});
854 end
855  
856 bModify = true;
857 CCWatchOptionsLearnModify:SetText("Modify");
858 end
859  
860 function CCWatch_DeleteLearntEffect()
861 CCWATCH.CCS[CCWatchEffectSelection] = nil;
862 -- CCWatch_Save[CCWATCH.PROFILE].SavedCC[CCWatchEffectSelection] = nil;
863 CCWatch_Save[CCWATCH.PROFILE].SavedCC[CCWatchEffectSelection] = {}
864  
865 UpdateSortTable();
866 CCWatchOptionsEffects_Update();
867 CCWatch_OpenDiagToggle();
868  
869 CCWatch_AddMessage(CCWATCH_REMOVED_NOTICE..CCWatchEffectSelection..".");
870 CCWatchEffectSelection = "";
871 end
872  
873  
874 function CCWatchOptions_OnLoad()
875 UIPanelWindows['CCWatchOptionsFrame'] = {area = 'center', pushable = 1};
876 end
877  
878 --------------------------------------------------------------------------------
879 -- Init
880 --------------------------------------------------------------------------------
881 function CCWatchOptions_Init()
882 CCWatchSliderAlpha:SetValue(CCWATCH.ALPHA);
883 CCWatchSliderScale:SetValue(CCWATCH.SCALE);
884 CCWatchSliderWidth:SetValue(CCWATCH.WIDTH);
885  
886 CCWatchOptionsFrameMonitorCC:SetChecked(bit.band(CCWATCH.MONITORING, ETYPE_CC));
887 CCWatchOptionsFrameMonitorDebuff:SetChecked(bit.band(CCWATCH.MONITORING, ETYPE_DEBUFF));
888 CCWatchOptionsFrameMonitorBuff:SetChecked(bit.band(CCWATCH.MONITORING, ETYPE_BUFF));
889  
890 CCWatchOptionsFrameUnlock:SetChecked(CCWATCH.STATUS == 2);
891 CCWatchOptionsFrameInvert:SetChecked(CCWATCH.INVERT);
892 CCWatchOptionsFrameArcanist:SetChecked(CCWATCH.ARCANIST);
893 CCWatchOptionsWarnCCDropDownText:SetText(CCWATCH.WARNTYPE);
894 CCWatchOptionsFrameCustomCCEdit:SetText(CCWATCH.WARNCUSTOMCC);
895 if CCWATCH.WARNTYPE == "CHANNEL" then
896 CCWatchOptionsFrameCustomCCEdit:Show();
897 else
898 CCWatchOptionsFrameCustomCCEdit:Hide();
899 end
900  
901 CCWatchOptionsEffectTypeDropDownText:SetText("CC");
902 CCWatchOptionsEffectGroupDropDownText:SetText("1");
903 CCWatchOptionsEffectDRDropDownText:SetText(CCWATCH_OPTION_DR_NEVER);
904 CCWatchOptionsEffectMonitor:SetChecked(true);
905 CCWatchOptionsEffectWarn:SetChecked(false);
906  
907 if CCWATCH.GROWTH == 0 then
908 CCWatchGrowthDropDownText:SetText(CCWATCH_OPTION_GROWTH_OFF);
909 elseif CCWATCH.GROWTH == 1 then
910 CCWatchGrowthDropDownText:SetText(CCWATCH_OPTION_GROWTH_UP);
911 else
912 CCWatchGrowthDropDownText:SetText(CCWATCH_OPTION_GROWTH_DOWN);
913 end
914  
915 if CCWATCH.TIMERS == 0 then
916 CCWatchTimersDropDownText:SetText(CCWATCH_OPTION_TIMERS_OFF);
917 elseif CCWATCH.TIMERS == 1 then
918 CCWatchTimersDropDownText:SetText(CCWATCH_OPTION_TIMERS_ON);
919 else
920 CCWatchTimersDropDownText:SetText(CCWATCH_OPTION_TIMERS_REVERSE);
921 end
922  
923 if CCWATCH.STYLE == 0 then
924 CCWatchOptionsStyleDropDownText:SetText(CCWATCH_OPTION_STYLE_CURRENT);
925 elseif CCWATCH.STYLE == 1 then
926 CCWatchOptionsStyleDropDownText:SetText(CCWATCH_OPTION_STYLE_RECENT);
927 else
928 CCWatchOptionsStyleDropDownText:SetText(CCWATCH_OPTION_STYLE_ALL);
929 end
930  
931 UpdateSortTable();
932 CCWatchOptionsEffects_Update();
933  
934 CCWatchOptionsUseColorOverTime:SetChecked(CCWATCH.COLOROVERTIME);
935  
936 CCWatchOptionsBarColorUrge.swatchFunc = CCWatchConfig_SwatchFunc_SetColor["Urge"];
937 CCWatchOptionsBarColorUrge.cancelFunc = CCWatchConfig_SwatchFunc_CancelColor["Urge"];
938 CCWatchOptionsBarColorLow.swatchFunc = CCWatchConfig_SwatchFunc_SetColor["Low"];
939 CCWatchOptionsBarColorLow.cancelFunc = CCWatchConfig_SwatchFunc_CancelColor["Low"];
940 CCWatchOptionsBarColorNormal.swatchFunc = CCWatchConfig_SwatchFunc_SetColor["Normal"];
941 CCWatchOptionsBarColorNormal.cancelFunc = CCWatchConfig_SwatchFunc_CancelColor["Normal"];
942  
943 CCWatchOptionsBarColorEffect.swatchFunc = CCWatchConfig_SwatchFunc_SetColor["Effect"];
944 CCWatchOptionsBarColorEffect.cancelFunc = CCWatchConfig_SwatchFunc_CancelColor["Effect"];
945 CCWatchOptionsBarColorEffect:Disable();
946  
947 SetButtonPickerColor("CCWatchOptionsBarColorUrge", CCWATCH.COTURGECOLOR);
948 SetButtonPickerColor("CCWatchOptionsBarColorLow", CCWATCH.COTLOWCOLOR);
949 SetButtonPickerColor("CCWatchOptionsBarColorNormal", CCWATCH.COTNORMALCOLOR);
950  
951 CCWatchOptionsFrameWarnApplied:SetChecked(bit.band(CCWATCH.WARNMSG, CCW_EWARN_APPLIED));
952 CCWatchOptionsFrameWarnFaded:SetChecked(bit.band(CCWATCH.WARNMSG, CCW_EWARN_FADED));
953 CCWatchOptionsFrameWarnBroken:SetChecked(bit.band(CCWATCH.WARNMSG, CCW_EWARN_BROKEN));
954 CCWatchOptionsFrameWarnLowTime:SetChecked(bit.band(CCWATCH.WARNMSG, CCW_EWARN_LOWTIME));
955  
956 CCWatchOptionsFrameLeading:SetChecked(CCWATCH.LEADINGTIMER);
957  
958 CCWatchOptionsBarsFrame:Show();
959 CCWatchOptionsEffectsTabTexture:Hide();
960 CCWatchOptionsEffectsTab:SetBackdropBorderColor(0.25, 0.25, 0.25, 1.0);
961 CCWatchOptionsLearnTabTexture:Hide();
962 CCWatchOptionsLearnTab:SetBackdropBorderColor(0.25, 0.25, 0.25, 1.0);
963  
964 CCWatchOptionsBarColorUrgeEdit:SetText(CCWATCH.COTURGEVALUE);
965 CCWatchOptionsBarColorLowEdit:SetText(CCWATCH.COTLOWVALUE);
966 CCWatchOptionsFrameWarnLowEdit:SetText(CCWATCH.WARNLOW);
967 end
968  
969 --------------------------------------------------------------------------------
970 -- Scroll Frame functions
971 --------------------------------------------------------------------------------
972  
973 local item;
974 local CCcount;
975 local curoffset;
976  
977 local function EffectsUpdate(k, v)
978 item = item + 1;
979 if (curoffset > item) or ((item - curoffset) >= 11) then
980 return;
981 end
982  
983 local itemSlot = getglobal("CCWatchOptionsEffectsItem"..(item-curoffset+1));
984 local name = v;
985 if (name == CCWatchEffectSelection) then
986 itemSlot:SetTextColor(1, 1, 0);
987 else
988 itemSlot:SetTextColor(1, 1, 1);
989 end
990 itemSlot:SetText(name);
991 itemSlot:Show();
992 end
993  
994 function CCWatchOptionsEffects_Update()
995 -- CCWatch_AddMessage("CCWatchOptionsEffects_Update");
996  
997 CCcount = 0;
998  
999 CCcount = table.getn(DisplayTable);
1000  
1001 FauxScrollFrame_Update(CCWatchOptionsEffectsListScrollFrame, CCcount, 11, 16);
1002  
1003 item = -1;
1004 curoffset = FauxScrollFrame_GetOffset(CCWatchOptionsEffectsListScrollFrame);
1005 -- CCWatch_AddMessage("We're at "..curoffset);
1006  
1007 table.foreach(DisplayTable, EffectsUpdate);
1008 end
1009  
1010 -- Tooltip Window
1011  
1012 function CCWatchOptionsEffects_OnEnter()
1013 -- CCWatch_AddMessage("CCWatchOptionsEffects_OnEnter");
1014  
1015 GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
1016  
1017 local spellname = this:GetText();
1018 if spellname == nil then
1019 return;
1020 end
1021  
1022 if CCWATCH.CCS[spellname] == nil then
1023 CCWatch_AddMessage("Error : '"..spellname.."' not found in effect array.");
1024 return;
1025 end
1026 local str = spellname.."\nDuration: "..CCWATCH.CCS[spellname].LENGTH.."\nType: ";
1027 if CCWATCH.CCS[spellname].ETYPE == ETYPE_BUFF then
1028 str = str.."Buff";
1029 elseif CCWATCH.CCS[spellname].ETYPE == ETYPE_DEBUFF then
1030 str = str.."DeBuff";
1031 else
1032 str = str.."CC";
1033 end
1034 str = str.."\nDR: ";
1035 if CCWATCH.CCS[spellname].DIMINISHES == 0 then
1036 str = str..CCWATCH_OPTION_DR_NEVER;
1037 elseif CCWATCH.CCS[spellname].DIMINISHES == 1 then
1038 str = str..CCWATCH_OPTION_DR_MOBPLAYERS;
1039 else
1040 str = str..CCWATCH_OPTION_DR_PLAYERS;
1041 end
1042 str = str.."\nMonitor: ";
1043 if CCWATCH.CCS[spellname].MONITOR then
1044 str = str.."on";
1045 else
1046 str = str.."off";
1047 end
1048 str = str.."\nWarn: ";
1049 if CCWATCH.CCS[spellname].WARN > 0 then
1050 str = str.."on";
1051 else
1052 str = str.."off";
1053 end
1054  
1055 GameTooltip:SetText(str, 1, 1, 1);
1056 end
1057  
1058  
1059 -- Confirm dialog frame
1060  
1061 function CCWatch_OpenDiagToggle()
1062 if (CCWatch_DiagOpen) then
1063 CCWatch_DiagOpen = false;
1064 else
1065 CCWatch_DiagOpen = true;
1066 end
1067 end
1068  
1069 function CCWatch_ShowDeletePrompt(cost)
1070 StaticPopupDialogs["CCWATCH_DELETE_EFFECT"] = {
1071 text = TEXT(STATUS_COLOR..CCWATCH_FULLVERSION.." (Elwen)\n\n\n"..CCWATCH_LEARN_DELETE_PROMPT.."'"..CCWatchEffectSelection.."' ?"),
1072 button1 = TEXT(OKAY),
1073 button2 = TEXT(CANCEL),
1074 OnAccept = function()
1075 CCWatch_DeleteLearntEffect();
1076 end,
1077 OnShow = function()
1078 CCWatch_OpenDiagToggle();
1079 end,
1080 OnHide = function()
1081 CCWatch_OpenDiagToggle();
1082 end,
1083 showAlert = 1,
1084 timeout = 0,
1085 exclusive = 0,
1086 whileDead = 1,
1087 interruptCinematic = 1
1088 };
1089 PlaySound("QUESTADDED");
1090 StaticPopup_Show("CCWATCH_DELETE_EFFECT");
1091 end
1092