vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 -- -------------------------------------------
2 -- << Power Auras >>
3 -- Par -Sinsthar-
4 -- [Ziya/Tiven - serveur Fr - Kirin Tor]
5 --
6 -- Effets visuels autour du personnage
7 -- en cas de buff ou de debuff.
8 -- -------------------------------------------
9  
10 PowaVersion = "v2.01"
11  
12 CurrentAura = 1;
13 CurrentSecondeAura = 0;
14 MaxAuras = 20;
15 SecondeAura = MaxAuras + 1;
16 CurrentTestAura = MaxAuras + 2;
17  
18 PowaEnabled = 0;
19 PowaModTest = false; -- on test les effets
20  
21 Powa_FramesVisibleTime = {}; -- visible ou pas
22  
23 PowaMisc = {
24 quickhide = false,
25 disabled = false,
26 BTimerX = 0,
27 BTimerY = 0,
28 BTimerA = 1.00,
29 BTimerScale = 1.00,
30 BCents = true,
31 DTimerX = 0,
32 DTimerY = 0,
33 DTimerA = 1.00,
34 DTimerScale = 1.00,
35 DCents = true
36 };
37  
38 PowaGlobal = {maxeffects = 20, maxtextures = 15}
39  
40 PowaSet = {};
41 for i = 1, SecondeAura do
42 PowaSet[i] = {
43 texture = 1,
44 anim1 = 1,
45 anim2 = 0,
46 speed = 1.00,
47 begin = 0,
48 duration = 0,
49 alpha = 0.75,
50 size = 0.75,
51 torsion = 1,
52 symetrie = 0,
53 x = 0,
54 y = -30,
55 buffname = "",
56 isdebuff = false,
57 isdebufftype = false,
58 timer = false,
59 inverse = false,
60 r = 1.0,
61 g = 1.0,
62 b = 1.0
63 };
64 end
65  
66 TabBuff = {}; -- liste des buffs en cours
67 TabDebuff = {}; -- debuffs
68 TabDebuffType = {}; -- debuff types
69  
70 -- ---------------------------------------------------------------------------------------------
71  
72 function Powa_OnLoad()
73  
74 -- Registering Events --
75 this:RegisterEvent("PLAYER_AURAS_CHANGED");
76 this:RegisterEvent("PLAYER_ENTERING_WORLD");
77 this:RegisterEvent("VARIABLES_LOADED");
78  
79 Powa_Frames = {};
80 Powa_textures = {};
81  
82 -- options init
83 SlashCmdList["POWA"] = Powa_SlashHandler;
84 SLASH_POWA1 = "/powa";
85 end
86  
87 -- ----------------------------------------------------------------------------------------------
88  
89 function Powa_InitTabs()
90 for i = 1, CurrentTestAura do
91 if (PowaSet[i]) then -- gere les rajout de variables suivant les versions
92 if (PowaSet[i].timer == nil) then PowaSet[i].timer = false; end
93 if (PowaSet[i].inverse == nil) then PowaSet[i].inverse = false; end
94 if (PowaSet[i].speed == nil) then PowaSet[i].speed = 1.0; end
95 if (PowaSet[i].begin == nil) then PowaSet[i].begin = 0; end
96 if (PowaSet[i].duration == nil) then PowaSet[i].duration = 0; end
97 else -- pas init
98 PowaSet[i] = {
99 texture = 1,
100 anim1 = 1,
101 anim2 = 0,
102 speed = 1.00,
103 begin = 0,
104 duration = 0,
105 alpha = 0.75,
106 size = 0.75,
107 torsion = 1,
108 symetrie = 0,
109 x = 0,
110 y = -30,
111 buffname = "",
112 isdebuff = false,
113 isdebufftype = false,
114 timer = false,
115 inverse = false,
116 r = 1.0,
117 g = 1.0,
118 b = 1.0 }
119 Powa_FramesVisibleTime[i] = 0;
120 end
121 end
122 if (PowaMisc) then
123 if (PowaMisc.BTimerX == nil) then PowaMisc.BTimerX = 0; end
124 if (PowaMisc.BTimerY == nil) then PowaMisc.BTimerY = 0; end
125 if (PowaMisc.BTimerA == nil) then PowaMisc.BTimerA = 1.00; end
126 if (PowaMisc.BTimerScale == nil) then PowaMisc.BTimerScale = 1.00; end
127 if (PowaMisc.DTimerX == nil) then PowaMisc.DTimerX = 0; end
128 if (PowaMisc.DTimerY == nil) then PowaMisc.DTimerY = 0; end
129 if (PowaMisc.DTimerA == nil) then PowaMisc.DTimerA = 1.00; end
130 if (PowaMisc.DTimerScale == nil) then PowaMisc.DTimerScale = 1.00; end
131 if (PowaMisc.BCents == nil) then PowaMisc.BCents = true; end
132 if (PowaMisc.DCents == nil) then PowaMisc.DCents = true; end
133 else
134 PowaMisc.quickhide = false;
135 PowaMisc.disabled = false;
136 PowaMisc.BTimerX = 0;
137 PowaMisc.BTimerY = 0;
138 PowaMisc.BTimerA = 1.00;
139 PowaMisc.BTimerScale = 1.00;
140 PowaMisc.DTimerX = 0;
141 PowaMisc.DTimerY = 0;
142 PowaMisc.DTimerA = 1.00;
143 PowaMisc.DTimerScale = 1.00;
144 PowaMisc.BCents = true;
145 PowaMisc.DCents = true;
146 end
147 end
148  
149 -- -----------------------------------------------------------------------------------------------
150  
151 function Powa_CreateFrames()
152  
153 for i = 1, CurrentTestAura do
154 if (Powa_Frames[i]) then
155 -- deja cree, ne fait rien
156 else
157 -- Frame --
158 Powa_Frames[i] = CreateFrame("Frame","Frame"..i);
159 Powa_Frames[i]:Hide();
160  
161 -- Texture --
162 Powa_textures[i] = Powa_Frames[i]:CreateTexture(nil,"BACKGROUND");
163 Powa_textures[i]:SetBlendMode("ADD");
164  
165 Powa_textures[i]:SetAllPoints(Powa_Frames[i]); -- attache la texture a la frame
166 Powa_Frames[i].texture = Powa_textures[i];
167 Powa_Frames[i].baseL = 256;
168 Powa_Frames[i].baseH = 256;
169  
170 Powa_FramesVisibleTime[i] = 0;
171 end
172 end
173  
174 end
175  
176 Powa_Timer = {};
177 Powa_timertex = {};
178 Tstep = 0.09765625;
179  
180 function Powa_CreateTimer()
181 for i = 1, 4 do
182 if (Powa_Timer[i]) then
183 else
184 Powa_Timer[i] = CreateFrame("Frame","Timer"..i);
185 Powa_Timer[i]:Hide();
186  
187 Powa_timertex[i] = Powa_Timer[i]:CreateTexture(nil,"BACKGROUND");
188 Powa_timertex[i]:SetBlendMode("ADD");
189  
190 Powa_timertex[i]:SetAllPoints(Powa_Timer[i]); -- attache la texture a la frame
191 Powa_Timer[i].texture = Powa_timertex[i];
192  
193 Powa_timertex[i]:SetTexture("Interface\\Addons\\PowerAuras\\timers.tga");
194 end
195 end
196 Powa_UpdateOptionsTimer();
197 Powa_UpdateOptionsTimer2();
198 end
199  
200 -- ------------------------------------------------------------------------------------ BUFF CHECKS
201  
202 function Powa_MemorizeBuffs() -- cree un string contenant tous les noms des buffs en cours
203 local buffIndex, untilCancelled;
204 for i = 1, 24 do
205 TabBuff[i] = "xXx";
206 buffIndex, untilCancelled = GetPlayerBuff(i-1, "HELPFUL");
207 if (buffIndex >= 0) then
208 Powa_Tooltip:SetPlayerBuff(buffIndex);
209 if (Powa_TooltipTextLeft1:IsShown()) then
210 TabBuff[i] = string.upper(Powa_TooltipTextLeft1:GetText());
211 else
212 Powa_Tooltip:SetOwner(UIParent, "ANCHOR_NONE"); -- ERROR !! Ca ne doit jamais arriver ca
213 end
214 end
215 end
216 for i = 1, 16 do
217 TabDebuff[i] = "xXx";
218 TabDebuffType[i] = "xXx";
219 buffIndex, untilCancelled = GetPlayerBuff(i-1, "HARMFUL");
220 if (buffIndex >= 0) then
221 Powa_Tooltip:SetPlayerBuff(buffIndex);
222 if (Powa_TooltipTextLeft1:IsShown()) then
223 TabDebuff[i] = string.upper(Powa_TooltipTextLeft1:GetText());
224 if (Powa_TooltipTextRight1:IsShown()) then
225 TabDebuffType[i] = string.upper(Powa_TooltipTextRight1:GetText());
226 else
227 TabDebuffType[i] = string.upper(PowaText.aucun);
228 end
229 else
230 Powa_Tooltip:SetOwner(UIParent, "ANCHOR_NONE"); -- ERROR !! Ca ne doit jamais arriver ca
231 end
232 end
233 end
234 end
235  
236 function PowaCompareBuffDebuff(xnum)
237 if (PowaMisc.disabled == true) then return false; end
238  
239 if (PowaSet[xnum].isdebuff) then -- un debuff
240 for i = 1, 16 do
241 Powa_Frames[xnum].buffindex = 0;
242 for pword in string.gfind(PowaSet[xnum].buffname, "[%w%s%-%'\195\130-\195\190]+") do
243 if (string.find(TabDebuff[i], string.upper(pword), 1, true)) then
244 Powa_Frames[xnum].buffindex = i-1; -- point vers le debuff qui a le timer
245 return true;
246 end
247 end
248 end
249 elseif (PowaSet[xnum].isdebufftype) then -- type de debuff (cherche a l'inverse)
250 for i = 1, 16 do
251 if (string.find(string.upper(PowaSet[xnum].buffname), TabDebuffType[i], 1, true)) then
252 Powa_Frames[xnum].buffindex = i-1; -- point vers le debuff type qui a le timer
253 return true;
254 end
255 end
256 else -- un buff
257 for i = 1, 24 do
258 Powa_Frames[xnum].buffindex = 0;
259 for pword in string.gfind(PowaSet[xnum].buffname, "[%w%s%-%'\195\130-\195\190]+") do
260 if (string.find(TabBuff[i], string.upper(pword), 1, true)) then
261 Powa_Frames[xnum].buffindex = i-1; -- point vers le buff qui a le timer
262 return true;
263 end
264 end
265 end
266 end
267 return false;
268 end
269  
270 function Powa_NewCheckBuffs() -- compare chaque nom de buff d'activation avec l'ensemble des buffs memorises
271 local LastAura;
272  
273 Powa_MemorizeBuffs();
274  
275 LastAura = 0;
276 for j = 1, MaxAuras do
277 if (PowaSet[j].buffname == "" or PowaSet[j].buffname == " ") then -- ne fait rien si vide
278 PowaSet[j].buffname = "";
279 elseif (PowaCompareBuffDebuff(j)) then -- buff actif
280 if (PowaSet[j].inverse == true) then
281 if (Powa_Frames[j]:IsVisible() ) then
282 Powa_FramesVisibleTime[j] = 0;
283 if (j == CurrentSecondeAura) then
284 Powa_FramesVisibleTime[SecondeAura] = 0;
285 if (LastAura > 0) then -- cet effet n'est plus actif mais on affiche l'aura 2 sur le dernier effet
286 CurrentSecondeAura = LastAura;
287 Powa_DisplayAura(LastAura);
288 end
289 end
290 end
291 else
292 Powa_DisplayAura(j);
293 LastAura = j;
294 end
295 else -- -- perte d'aura, s'il est visible on le cache
296 if (PowaSet[j].inverse == false) then
297 if (Powa_Frames[j]:IsVisible() ) then
298 Powa_FramesVisibleTime[j] = 0;
299 if (j == CurrentSecondeAura) then
300 Powa_FramesVisibleTime[SecondeAura] = 0;
301 if (LastAura > 0) then -- cet effet n'est plus actif mais on affiche l'aura 2 sur le dernier effet
302 CurrentSecondeAura = LastAura;
303 Powa_DisplayAura(LastAura);
304 end
305 end
306 end
307 else
308 Powa_DisplayAura(j);
309 LastAura = j;
310 end
311 end
312 end -- end for
313  
314 end
315  
316 -- ----------------------------------------------------------------------------------------- EVENT
317  
318 function Powa_OnEvent()
319  
320 if event == "PLAYER_ENTERING_WORLD" then
321  
322 Powa_Tooltip:SetOwner(UIParent, "ANCHOR_NONE");
323  
324 elseif event == "VARIABLES_LOADED" then
325 DEFAULT_CHAT_FRAME:AddMessage("|cffB0A0ff<Power Auras>|r |cffffff00"..PowaVersion.."|r - "..PowaText.welcome);
326 -- defini le nombre max d'effets
327 MaxAuras = PowaGlobal.maxeffects;
328 SecondeAura = MaxAuras + 1;
329 CurrentTestAura = MaxAuras + 2;
330 -- verifie en cas de rajout d'effets que tous sont initialises (sinon ca bug :P)
331 Powa_InitTabs();
332 Powa_CreateFrames();
333 -- defini le nombre max de textures
334 if (PowaGlobal.maxtextures > 50) then PowaGlobal.maxtextures = 50;
335 elseif (PowaGlobal.maxtextures < 20) then PowaGlobal.maxtextures = 20; end
336 getglobal("PowaBarAuraTextureSlider"):SetMinMaxValues(1,PowaGlobal.maxtextures);
337 getglobal("PowaBarAuraTextureSliderHigh"):SetText(PowaGlobal.maxtextures);
338 PowaEnabled = 1;
339 Powa_CreateTimer();
340  
341 elseif event == "PLAYER_AURAS_CHANGED" then -- passe les buffs en revue
342 if (PowaModTest == false) then
343 Powa_NewCheckBuffs();
344 end
345 end
346 end
347  
348 -- -----------------------------------------------------------------------------------------------
349  
350 function Powa_DisplayAura(FNum)
351  
352 if (PowaEnabled == 0) then return; end -- desactived
353  
354 if (Powa_FramesVisibleTime[FNum] == 0) then -- si pas en cours
355  
356 Powa_textures[FNum]:SetTexture("Interface\\Addons\\PowerAuras\\aura"..PowaSet[FNum].texture..".tga");
357 Powa_textures[FNum]:SetVertexColor(PowaSet[FNum].r,PowaSet[FNum].g,PowaSet[FNum].b);
358  
359 if (PowaSet[FNum].symetrie == 1) then Powa_textures[FNum]:SetTexCoord(1, 0, 0, 1); -- inverse X
360 elseif (PowaSet[FNum].symetrie == 2) then Powa_textures[FNum]:SetTexCoord(0, 1, 1, 0); -- inverse Y
361 elseif (PowaSet[FNum].symetrie == 3) then Powa_textures[FNum]:SetTexCoord(1, 0, 1, 0); -- inverse XY
362 else Powa_textures[FNum]:SetTexCoord(0, 1, 0, 1); end
363  
364 if (PowaSet[FNum].begin > 0) then Powa_Frames[FNum].beginAnim = 1;
365 else Powa_Frames[FNum].beginAnim = 0; end
366  
367 Powa_Frames[FNum].baseL = 256 * PowaSet[FNum].size * PowaSet[FNum].torsion;
368 Powa_Frames[FNum].baseH = 256 * PowaSet[FNum].size * (2-PowaSet[FNum].torsion);
369 Powa_Frames[FNum]:SetAlpha(PowaSet[FNum].alpha);
370 Powa_Frames[FNum]:SetPoint("Center",PowaSet[FNum].x, PowaSet[FNum].y);
371 Powa_Frames[FNum]:SetWidth(Powa_Frames[FNum].baseL);
372 Powa_Frames[FNum]:SetHeight(Powa_Frames[FNum].baseH);
373 Powa_Frames[FNum].statut = 0;
374 Powa_Frames[FNum].duree = 0;
375 Powa_Frames[FNum]:Show();
376  
377 Powa_FramesVisibleTime[FNum] = 1; -- affiche anim1
378 Powa_FramesVisibleTime[SecondeAura] = 0; -- init anim2
379 end
380  
381 if (Powa_FramesVisibleTime[SecondeAura] == 0) then -- si pas en cours (Anim 2)
382  
383 CurrentSecondeAura = FNum; -- 2eme aura en cours
384  
385 if (PowaSet[FNum].anim2 == 0) then -- pas d'anim
386 Powa_Frames[SecondeAura]:Hide();
387 return;
388 end
389  
390 if (PowaSet[FNum].begin > 0) then Powa_Frames[FNum].beginAnim = 2;
391 else Powa_Frames[FNum].beginAnim = 0; end
392  
393 PowaSet[SecondeAura].size = PowaSet[FNum].size;
394 PowaSet[SecondeAura].torsion = PowaSet[FNum].torsion;
395 PowaSet[SecondeAura].alpha = PowaSet[FNum].alpha * 0.5;
396 PowaSet[SecondeAura].anim1 = PowaSet[FNum].anim2;
397 PowaSet[SecondeAura].speed = PowaSet[FNum].speed;
398 PowaSet[SecondeAura].duration = PowaSet[FNum].duration;
399 PowaSet[SecondeAura].x = PowaSet[FNum].x;
400 PowaSet[SecondeAura].y = PowaSet[FNum].y;
401  
402 Powa_textures[SecondeAura]:SetTexture("Interface\\Addons\\PowerAuras\\aura"..PowaSet[FNum].texture..".tga");
403 Powa_textures[SecondeAura]:SetVertexColor(PowaSet[FNum].r,PowaSet[FNum].g,PowaSet[FNum].b);
404  
405 if (PowaSet[FNum].symetrie == 1) then Powa_textures[SecondeAura]:SetTexCoord(1, 0, 0, 1); -- inverse X
406 elseif (PowaSet[FNum].symetrie == 2) then Powa_textures[SecondeAura]:SetTexCoord(0, 1, 1, 0); -- inverse Y
407 elseif (PowaSet[FNum].symetrie == 3) then Powa_textures[SecondeAura]:SetTexCoord(1, 0, 1, 0); -- inverse XY
408 else Powa_textures[SecondeAura]:SetTexCoord(0, 1, 0, 1); end
409  
410 Powa_Frames[SecondeAura].baseL = Powa_Frames[FNum].baseL;
411 Powa_Frames[SecondeAura].baseH = Powa_Frames[FNum].baseH;
412 Powa_Frames[SecondeAura]:SetAlpha(PowaSet[SecondeAura].alpha);
413 Powa_Frames[SecondeAura]:SetPoint("Center",PowaSet[FNum].x, PowaSet[FNum].y);
414 Powa_Frames[SecondeAura]:SetWidth(Powa_Frames[SecondeAura].baseL);
415 Powa_Frames[SecondeAura]:SetHeight(Powa_Frames[SecondeAura].baseH);
416 Powa_Frames[SecondeAura].statut = 1;
417 Powa_Frames[SecondeAura].duree = Powa_Frames[FNum].duree;
418 Powa_Frames[SecondeAura]:Show();
419  
420 Powa_FramesVisibleTime[SecondeAura] = 1;
421 end
422 end
423  
424 -- -------------------------------------------------------------------------------------- TIMERS
425 PowaActiveTimer = 0; -- le timer en cours
426 PowaActiveTimerValue = 0;
427 PowaActiveTimerSup = 0; -- le 2eme timer en cours
428 PowaActiveTimerSupValue = 0;
429 PowaActiveTimer2 = 0; -- le timer en cours (debuffs)
430 PowaActiveTimer2Value = 0;
431 PowaActiveTimer2Sup = 0; -- le 2eme timer en cours
432 PowaActiveTimer2SupValue = 0;
433  
434 function Powa_UpdateTimer(numi)
435 local newvalue;
436  
437 if (numi > MaxAuras) then -- fin du cycle on arrete
438 return;
439 elseif (PowaSet[numi].timer == false) then -- cet effet n'affiche pas de timer
440 return;
441 end
442  
443 -- prend le timer
444 if (getglobal("PowaBarConfigFrameOptions"):IsVisible()) then -- options des timers, affiche
445 PowaActiveTimer2 = numi;
446 PowaActiveTimer2Value = random(1,9) + (random(1, 99) / 100);
447 PowaActiveTimer = numi;
448 PowaActiveTimerValue = random(1,9) + (random(1, 99) / 100);
449  
450 elseif (PowaSet[numi].isdebuff or PowaSet[numi].isdebufftype) then
451 if (PowaModTest) then
452 newvalue = random(1,9) + (random(1, 99) / 100);
453 else
454 newvalue = GetPlayerBuffTimeLeft( GetPlayerBuff(Powa_Frames[numi].buffindex, "HARMFUL") );
455 end
456  
457 if (newvalue > 0) then -- ok on a un timer a afficher...
458 if ((PowaActiveTimer2Value > 0) and (newvalue > PowaActiveTimer2Value)) then
459 -- y'a deja un timer dont le nombre est plus petit, domage
460 return;
461 end
462 PowaActiveTimer2 = numi; -- lien vers l'effet
463 PowaActiveTimer2Value = newvalue; -- retiens la valeur
464 end
465 else
466 if (PowaModTest) then
467 newvalue = random(1,9) + (random(1, 99) / 100);
468 else
469 newvalue = GetPlayerBuffTimeLeft( GetPlayerBuff(Powa_Frames[numi].buffindex, "HELPFUL") );
470 end
471  
472 if (newvalue > 0) then -- ok on a un timer a afficher...
473 if ((PowaActiveTimerValue > 0) and (newvalue > PowaActiveTimerValue)) then
474 -- y'a deja un timer dont le nombre est plus petit, domage
475 return;
476 end
477 PowaActiveTimer = numi; -- lien vers l'effet
478 PowaActiveTimerValue = newvalue; -- retiens la valeur
479 end
480 end
481 end
482  
483 function Powa_ResetTimers()
484 local deci, uni, newvalue;
485  
486 if (PowaActiveTimer > 0) then -- timer a un lien
487 if (Powa_Frames[PowaActiveTimer]:IsVisible()) then -- l'effet est visible, affiche
488 -- timer 1, le gros (secondes)
489 Powa_timertex[1]:SetVertexColor(PowaSet[PowaActiveTimer].r,PowaSet[PowaActiveTimer].g,PowaSet[PowaActiveTimer].b);
490 -- si le timer est > 60, le transforme en minutes
491 newvalue = PowaActiveTimerValue;
492 if (newvalue > 60.00) then newvalue = newvalue / 60; end
493 newvalue = math.min (99.00, newvalue);
494  
495 deci = math.floor(newvalue / 10);
496 uni = math.floor(newvalue - (deci*10));
497 Powa_timertex[1]:SetTexCoord(Tstep * uni, Tstep * (uni+1), Tstep * deci, Tstep * (deci+1));
498 Powa_Timer[1]:Show();
499 -- timer 2, le petit (centieme de secondes)
500 Powa_timertex[2]:SetVertexColor(PowaSet[PowaActiveTimer].r,PowaSet[PowaActiveTimer].g,PowaSet[PowaActiveTimer].b);
501  
502 newvalue = PowaActiveTimerValue;
503 if (newvalue > 60.00) then
504 newvalue = math.mod(newvalue,60);
505 else
506 newvalue = (newvalue - math.floor(newvalue)) * 100;
507 end
508 deci = math.floor(newvalue / 10);
509 uni = math.floor(newvalue - (deci*10));
510 Powa_timertex[2]:SetTexCoord(Tstep * uni, Tstep * (uni+1), Tstep * deci, Tstep * (deci+1));
511 if (PowaMisc.BCents == true) then
512 Powa_Timer[2]:Show();
513 else
514 Powa_Timer[2]:Hide();
515 end
516 else
517 Powa_Timer[1]:Hide(); -- cache les timer
518 Powa_Timer[2]:Hide(); -- cache les timer
519 end
520 else
521 Powa_Timer[1]:Hide();
522 Powa_Timer[2]:Hide(); -- cache les timer
523 end
524 PowaActiveTimer = 0;
525 PowaActiveTimerValue = 0;
526  
527 -- idem pour les debuffs
528 if (PowaActiveTimer2 > 0) then -- timer a un lien
529 if (Powa_Frames[PowaActiveTimer2]:IsVisible()) then -- l'effet est visible, affiche
530 -- timer 1, le gros (secondes)
531 Powa_timertex[3]:SetVertexColor(PowaSet[PowaActiveTimer2].r,PowaSet[PowaActiveTimer2].g,PowaSet[PowaActiveTimer2].b);
532 -- si le timer est > 60, le transforme en minutes
533 newvalue = PowaActiveTimer2Value;
534 if (newvalue > 60.00) then newvalue = newvalue / 60; end
535 newvalue = math.min (99.00, newvalue);
536  
537 deci = math.floor(newvalue / 10);
538 uni = math.floor(newvalue - (deci*10));
539 Powa_timertex[3]:SetTexCoord(Tstep * uni, Tstep * (uni+1), Tstep * deci, Tstep * (deci+1));
540 Powa_Timer[3]:Show();
541 -- timer 2, le petit (centieme de secondes)
542 Powa_timertex[4]:SetVertexColor(PowaSet[PowaActiveTimer2].r,PowaSet[PowaActiveTimer2].g,PowaSet[PowaActiveTimer2].b);
543  
544 newvalue = PowaActiveTimer2Value;
545 if (newvalue > 60.00) then
546 newvalue = math.mod(newvalue,60);
547 else
548 newvalue = (newvalue - math.floor(newvalue)) * 100;
549 end
550 deci = math.floor(newvalue / 10);
551 uni = math.floor(newvalue - (deci*10));
552 Powa_timertex[4]:SetTexCoord(Tstep * uni, Tstep * (uni+1), Tstep * deci, Tstep * (deci+1));
553 if (PowaMisc.DCents == true) then
554 Powa_Timer[4]:Show();
555 else
556 Powa_Timer[4]:Hide();
557 end
558 else
559 Powa_Timer[3]:Hide(); -- cache les timer
560 Powa_Timer[4]:Hide(); -- cache les timer
561 end
562 else
563 Powa_Timer[3]:Hide();
564 Powa_Timer[4]:Hide(); -- cache les timer
565 end
566 PowaActiveTimer2 = 0;
567 PowaActiveTimer2Value = 0;
568 end
569  
570 -- -------------------------------------------------------------------------------------- ON UPDATE
571 minScale = {a=0, w=0, h=0};
572 maxScale = {a=0, w=0, h=0};
573 curScale = {a=0, w=0, h=0};
574 speedScale = 0;
575  
576 function Powa_OnUpdate(elapsed)
577  
578 for i = 1, CurrentTestAura do
579  
580 if (PowaEnabled == 0) then return; end -- desactived
581  
582 if (Powa_FramesVisibleTime[i] > 0) then -- si visible seulement
583  
584 Powa_UpdateTimer(i); -- met a jour les Timers
585  
586 curScale.w = Powa_Frames[i].baseL; -- regle la taille de l'image en pixel
587 curScale.h = Powa_Frames[i].baseH;
588  
589 -- pas d'anim si l'effet va disparaitre avec duree
590 if ((PowaSet[i].duration > 0) and (Powa_Frames[i].duree > PowaSet[i].duration)) then
591 -- si visible, baisse l'alpha
592 if (Powa_Frames[i]:GetAlpha() > 0) then
593 curScale.a = Powa_Frames[i]:GetAlpha() - (elapsed / 2);
594 -- si alpha 0, cache
595 if (curScale.a <= 0) then
596 Powa_Frames[i]:SetAlpha(0);
597 else
598 Powa_Frames[i]:SetAlpha(curScale.a);
599 end
600 end
601 -- Animation 1 : aucune
602 elseif (PowaSet[i].anim1 == 1) then
603  
604 -- Animation 2 : max alpha <-> mi-alpha
605 elseif (PowaSet[i].anim1 == 2) then
606 minScale.a = PowaSet[i].alpha * 0.5 * PowaSet[i].speed;
607 maxScale.a = PowaSet[i].alpha;
608  
609 if (Powa_Frames[i].statut == 0) then
610 curScale.a = Powa_Frames[i]:GetAlpha() - (elapsed / 2);
611 Powa_Frames[i]:SetAlpha( curScale.a )
612 if (Powa_Frames[i]:GetAlpha() < minScale.a) then
613 Powa_Frames[i]:SetAlpha(minScale.a);
614 Powa_Frames[i].statut = 1;
615 end
616 else
617 curScale.a = Powa_Frames[i]:GetAlpha() + (elapsed / 2);
618 if (curScale.a > 1.0) then curScale.a = 1.0; end -- pas trop haut non plus
619 Powa_Frames[i]:SetAlpha( curScale.a )
620 if (Powa_Frames[i]:GetAlpha() >= maxScale.a) then
621 Powa_Frames[i]:SetAlpha(maxScale.a);
622 Powa_Frames[i].statut = 0;
623 end
624 end
625 -- Animation 3 : mini-zoom in repetitif + fading
626 elseif (PowaSet[i].anim1 == 3) then
627 minScale.w = curScale.w * 0.90;
628 minScale.h = curScale.h * 0.90;
629 maxScale.w = curScale.w * 1.20;
630 maxScale.h = curScale.h * 1.20;
631 speedScale = (25 * PowaSet[i].speed) * PowaSet[i].size;
632  
633 if (Powa_Frames[i].statut == 1) then -- decale anim 2
634 Powa_Frames[i]:SetWidth(curScale.w * 1.15);
635 Powa_Frames[i]:SetHeight(curScale.h * 1.15);
636 Powa_Frames[i].statut = 0;
637 end
638  
639 Powa_Frames[i]:SetWidth( Powa_Frames[i]:GetWidth() + (elapsed * speedScale) )
640 Powa_Frames[i]:SetHeight( Powa_Frames[i]:GetHeight() + (elapsed * speedScale) )
641  
642 Powa_Frames[i]:SetAlpha( ((maxScale.w - Powa_Frames[i]:GetWidth()) / (maxScale.w - minScale.w)) * PowaSet[i].alpha );
643  
644 if (Powa_Frames[i]:GetWidth() > maxScale.w) then
645 Powa_Frames[i]:SetWidth(minScale.w);
646 Powa_Frames[i]:SetHeight(minScale.h);
647 end
648 -- Animation 4 : mini-zoom in/out
649 elseif (PowaSet[i].anim1 == 4) then
650 minScale.w = curScale.w * 0.95;
651 minScale.h = curScale.h * 0.95;
652 maxScale.w = curScale.w * 1.05;
653 maxScale.h = curScale.h * 1.05;
654 speedScale = (50 * PowaSet[i].speed) * PowaSet[i].size;
655  
656 if (Powa_Frames[i].statut == 0) then
657 Powa_Frames[i]:SetWidth( Powa_Frames[i]:GetWidth() + (elapsed * speedScale * PowaSet[i].torsion) )
658 Powa_Frames[i]:SetHeight( Powa_Frames[i]:GetHeight() + (elapsed * speedScale * (2-PowaSet[i].torsion) ) )
659 if (Powa_Frames[i]:GetWidth() > maxScale.w) then
660 Powa_Frames[i]:SetWidth(maxScale.w);
661 Powa_Frames[i]:SetHeight(maxScale.h);
662 Powa_Frames[i].statut = 1;
663 end
664 else
665 Powa_Frames[i]:SetWidth( Powa_Frames[i]:GetWidth() - (elapsed * speedScale * PowaSet[i].torsion) )
666 Powa_Frames[i]:SetHeight( Powa_Frames[i]:GetHeight() - (elapsed * speedScale * (2-PowaSet[i].torsion) ) )
667 if (Powa_Frames[i]:GetWidth() < minScale.w) then
668 Powa_Frames[i]:SetWidth(minScale.w);
669 Powa_Frames[i]:SetHeight(minScale.h);
670 Powa_Frames[i].statut = 0;
671 end
672 end
673 -- Animation 5 : effet bulle
674 elseif (PowaSet[i].anim1 == 5) then
675 minScale.w = curScale.w * 0.95;
676 minScale.h = curScale.h * 0.95;
677 maxScale.w = curScale.w * 1.05;
678 maxScale.h = curScale.h * 1.05;
679 speedScale = (50 * PowaSet[i].speed) * PowaSet[i].size;
680  
681 if (Powa_Frames[i].statut == 0) then
682 Powa_Frames[i]:SetWidth( Powa_Frames[i]:GetWidth() + (elapsed * speedScale * PowaSet[i].torsion) )
683 Powa_Frames[i]:SetHeight( Powa_Frames[i]:GetHeight() - (elapsed * speedScale * (2-PowaSet[i].torsion) ) )
684 if (Powa_Frames[i]:GetWidth() > maxScale.w) then
685 Powa_Frames[i]:SetWidth(maxScale.w);
686 Powa_Frames[i]:SetHeight(minScale.h);
687 Powa_Frames[i].statut = 1;
688 end
689 else
690 Powa_Frames[i]:SetWidth( Powa_Frames[i]:GetWidth() - (elapsed * speedScale * PowaSet[i].torsion) )
691 Powa_Frames[i]:SetHeight( Powa_Frames[i]:GetHeight() + (elapsed * speedScale * (2-PowaSet[i].torsion) ) )
692 if (Powa_Frames[i]:GetHeight() > maxScale.h) then
693 Powa_Frames[i]:SetWidth(minScale.w);
694 Powa_Frames[i]:SetHeight(maxScale.h);
695 Powa_Frames[i].statut = 0;
696 end
697 end
698 -- position au hasard + zoom in + fade
699 elseif (PowaSet[i].anim1 == 6) then
700 if (Powa_Frames[i]:GetAlpha() > 0) then
701 curScale.a = Powa_Frames[i]:GetAlpha() - (elapsed * PowaSet[i].alpha * 0.5);
702 if (curScale.a < 0) then Powa_Frames[i]:SetAlpha(0.0);
703 else Powa_Frames[i]:SetAlpha(curScale.a); end
704 maxScale.w = Powa_Frames[i]:GetWidth() + (elapsed * 100 * PowaSet[i].speed * PowaSet[i].size);
705 maxScale.h = Powa_Frames[i]:GetHeight() + (elapsed * 100 * PowaSet[i].speed * PowaSet[i].size);
706 if ( (maxScale.w * 1.5) > Powa_Frames[i]:GetWidth()) then -- evite les lags
707 Powa_Frames[i]:SetWidth(maxScale.w)
708 Powa_Frames[i]:SetHeight(maxScale.h)
709 end
710 else
711 maxScale.w = random(0,10) - 5;
712 maxScale.h = random(0,10) - 5;
713 Powa_Frames[i]:SetAlpha(PowaSet[i].alpha);
714 Powa_Frames[i]:SetWidth(curScale.w * 0.85);
715 Powa_Frames[i]:SetHeight(curScale.h * 0.85);
716 Powa_Frames[i]:SetPoint("Center",PowaSet[i].x + maxScale.w, PowaSet[i].y + maxScale.h);
717 end
718 -- static sauf parfois ou la texture est decalee + opaque (type electrique)
719 elseif (PowaSet[i].anim1 == 7) then
720 if (Powa_Frames[i].statut < 2) then
721 Powa_Frames[i]:SetAlpha(PowaSet[i].alpha / 2); -- mi-alpha
722 if (random( 210-(PowaSet[i].speed*100) ) == 1) then
723 Powa_Frames[i].statut = 2;
724 maxScale.w = random(0,10) - 5;
725 maxScale.h = random(0,10) - 5;
726 Powa_Frames[i]:SetPoint("Center",PowaSet[i].x + maxScale.w, PowaSet[i].y + maxScale.h);
727 Powa_Frames[i]:SetAlpha(PowaSet[i].alpha);
728 end
729 else
730 Powa_Frames[i]:SetPoint("Center",PowaSet[i].x, PowaSet[i].y);
731 Powa_Frames[i].statut = 0;
732 end
733 -- zoom out + stop + fade
734 elseif (PowaSet[i].anim1 == 8) then
735 minScale.w = curScale.w;
736 minScale.h = curScale.h;
737 maxScale.w = curScale.w * 1.30;
738 maxScale.h = curScale.h * 1.30;
739 speedScale = (50 * PowaSet[i].speed) * PowaSet[i].size;
740  
741 if (Powa_Frames[i].statut == 0) then -- demarre le zoom out (max size)
742 Powa_Frames[i]:SetWidth(maxScale.w);
743 Powa_Frames[i]:SetHeight(maxScale.h);
744 Powa_Frames[i]:SetAlpha(0.0);
745 Powa_Frames[i].statut = 2;
746 elseif (Powa_Frames[i].statut == 2) then -- zoom out + fade in
747 Powa_Frames[i]:SetWidth( Powa_Frames[i]:GetWidth() - (elapsed * speedScale * PowaSet[i].torsion) )
748 Powa_Frames[i]:SetHeight( Powa_Frames[i]:GetHeight() - (elapsed * speedScale * (2-PowaSet[i].torsion) ) )
749  
750 Powa_Frames[i]:SetAlpha( ((maxScale.w - Powa_Frames[i]:GetWidth()) / (maxScale.w - minScale.w)) * PowaSet[i].alpha );
751  
752 if (Powa_Frames[i]:GetWidth() < curScale.w) then
753 Powa_Frames[i]:SetWidth(curScale.w);
754 Powa_Frames[i]:SetHeight(curScale.h);
755 Powa_Frames[i].statut = 1;
756 end
757 elseif (Powa_Frames[i].statut == 1) then -- demarre le fade-out
758 Powa_Frames[i]:SetWidth(curScale.w);
759 Powa_Frames[i]:SetHeight(curScale.h);
760 Powa_Frames[i]:SetAlpha(PowaSet[i].alpha);
761 Powa_Frames[i].statut = 3;
762  
763 elseif (Powa_Frames[i].statut == 3) then -- fade-out
764 curScale.a = Powa_Frames[i]:GetAlpha() - (elapsed / random(1,2));
765  
766 if (curScale.a < 0.0) then
767 Powa_Frames[i]:SetAlpha(0.0);
768 Powa_Frames[i].statut = 0;
769 else
770 Powa_Frames[i]:SetAlpha(curScale.a);
771 end
772 end
773  
774 -- deplacement vers le haut + fade-out + reduction
775 elseif (PowaSet[i].anim1 == 9) then
776 speedScale = (50 * PowaSet[i].speed) * PowaSet[i].size;
777  
778 if (Powa_Frames[i].statut < 2) then -- debut
779 Powa_Frames[i]:SetWidth(curScale.w);
780 Powa_Frames[i]:SetHeight(curScale.h);
781 Powa_Frames[i]:SetPoint("Center",PowaSet[i].x, PowaSet[i].y);
782 Powa_Frames[i]:SetAlpha(PowaSet[i].alpha);
783 Powa_Frames[i].statut = 2;
784 else
785 _,_,_,xOfs,yOfs = Powa_Frames[i]:GetPoint();
786 Powa_Frames[i]:SetPoint("Center",xOfs + (random(1,3)-2), yOfs + (elapsed * random(10,20)));
787 curScale.a = Powa_Frames[i]:GetAlpha() - ( (elapsed / random(2,4)) * PowaSet[i].alpha);
788  
789 Powa_Frames[i]:SetWidth( Powa_Frames[i]:GetWidth() - (elapsed * speedScale * PowaSet[i].torsion) )
790 Powa_Frames[i]:SetHeight( Powa_Frames[i]:GetHeight() - (elapsed * speedScale * (2-PowaSet[i].torsion) ) )
791  
792 if (curScale.a < 0.0) then
793 Powa_Frames[i]:SetAlpha(0.0);
794 Powa_Frames[i].statut = 1;
795 else
796 Powa_Frames[i]:SetAlpha(curScale.a);
797 end
798 end
799  
800 end
801  
802 -- si duration
803 if (PowaSet[i].duration > 0) then
804 -- ajoute le temps passe
805 Powa_Frames[i].duree = Powa_Frames[i].duree + elapsed;
806 end
807  
808 -- FADE OUT
809 elseif Powa_Frames[i]:IsVisible() then
810  
811 if (PowaMisc.quickhide == false) then
812 curScale.a = Powa_Frames[i]:GetAlpha() - (elapsed * 2);
813  
814 if (curScale.a <= 0) then
815 Powa_Frames[i]:Hide();
816 else
817 Powa_Frames[i]:SetAlpha(curScale.a);
818 Powa_Frames[i]:SetWidth(Powa_Frames[i]:GetWidth() + (elapsed * 200) );
819 Powa_Frames[i]:SetHeight(Powa_Frames[i]:GetHeight() + (elapsed * 200) );
820 end
821 else
822 Powa_Frames[i]:Hide();
823 end
824 end
825  
826 end
827  
828 Powa_ResetTimers(); -- reset Timers
829  
830 end
831  
832 -- ----------------------------------------------------------------------------- LIGNE DE COMMANDE
833  
834 function Powa_SlashHandler(msg)
835 msgNumber = 0;
836 if (msg == "") then
837 -- aucun parametre, on ouvre/ferme les options
838 if (PowaBarConfigFrame:IsVisible()) then
839 Powa_OptionClose();
840 else
841 Powa_OptionHideAll();
842 Powa_InitPage();
843 PowaModTest = true;
844 PowaBarConfigFrame:Show();
845 end
846 else -- y'a des parametres, on y travaille
847 for a in string.gfind( msg, "maxtex (%d+)" ) do
848 msgNumber = tonumber(a);
849 if (msgNumber > 50) then msgNumber = 50; elseif (msgNumber < 20) then msgNumber = 2; end
850 PowaGlobal.maxtextures = msgNumber;
851 getglobal("PowaBarAuraTextureSlider"):SetMinMaxValues(1,msgNumber);
852 getglobal("PowaBarAuraTextureSliderHigh"):SetText(msgNumber);
853 DEFAULT_CHAT_FRAME:AddMessage("|cffB0A0ff<Power Auras>|r "..PowaText.aideCommande2a.." "..a);
854 return;
855 end
856 for a in string.gfind( msg, "maxeffect (%d+)" ) do
857 msgNumber = tonumber(a);
858 if (msgNumber > 100) then msgNumber = 100; elseif (msgNumber < 10) then msgNumber = 10; end
859 PowaEnabled = 0; -- desactive temporairement les effets
860 Powa_OptionHideAll(); -- cache tout les effets en cours
861 MaxAuras = msgNumber; -- definie le max d'aura
862 SecondeAura = MaxAuras + 1; -- definie la derniere aura
863 CurrentTestAura = MaxAuras + 2;
864 PowaGlobal.maxeffects = MaxAuras; -- sauve le nombre max d'effet
865 Powa_InitTabs(); -- initialise les pages d'effets en plus
866 Powa_CreateFrames(); -- cree les textures des effets en plus
867 PowaEnabled = 1; -- reactive les effets
868 CurrentAura = 1; -- defini l'effet en cours 1
869 Powa_InitPage(); -- initalise les pages des options
870 DEFAULT_CHAT_FRAME:AddMessage("|cffB0A0ff<Power Auras>|r "..PowaText.aideCommande3a.." "..a);
871 return;
872 end
873 DEFAULT_CHAT_FRAME:AddMessage("|cffB0A0ff<Power Auras>|r "..PowaText.aideCommande1);
874 DEFAULT_CHAT_FRAME:AddMessage("|cffffff50 /powa maxtex ##|r : "..PowaText.aideCommande2);
875 DEFAULT_CHAT_FRAME:AddMessage("|cffffff50 /powa maxeffect ##|r : "..PowaText.aideCommande3);
876 end
877 end
878  
879 -- --------------------------------------------------------------------------- GESTION DES OPTIONS
880  
881 function Powa_InitPage()
882 getglobal("PowaBarAuraTextureSlider"):SetValue(PowaSet[CurrentAura].texture);
883 getglobal("PowaBarAuraAlphaSlider"):SetValue(PowaSet[CurrentAura].alpha);
884 getglobal("PowaBarAuraSizeSlider"):SetValue(PowaSet[CurrentAura].size);
885 getglobal("PowaBarAuraCoordSlider"):SetValue(PowaSet[CurrentAura].y);
886 getglobal("PowaBarAuraCoordXSlider"):SetValue(PowaSet[CurrentAura].x);
887 getglobal("PowaBarAuraAnim2Slider"):SetValue(PowaSet[CurrentAura].anim2);
888 getglobal("PowaBarAuraAnim1Slider"):SetValue(PowaSet[CurrentAura].anim1);
889 getglobal("PowaBarAuraAnimSpeedSlider"):SetValue(PowaSet[CurrentAura].speed);
890 getglobal("PowaBarAuraDurationSlider"):SetValue(PowaSet[CurrentAura].duration);
891 getglobal("PowaBarAuraSymSlider"):SetValue(PowaSet[CurrentAura].symetrie);
892 getglobal("PowaBarAuraDeformSlider"):SetValue(PowaSet[CurrentAura].torsion);
893 getglobal("PowaBarBuffName"):SetText(PowaSet[CurrentAura].buffname);
894  
895 getglobal("AuraTexture"):SetTexture("Interface\\Addons\\PowerAuras\\Aura"..PowaSet[CurrentAura].texture..".tga");
896  
897 getglobal("PowaColorNormalTexture"):SetVertexColor(PowaSet[CurrentAura].r,PowaSet[CurrentAura].g,PowaSet[CurrentAura].b);
898 getglobal("AuraTexture"):SetVertexColor(PowaSet[CurrentAura].r,PowaSet[CurrentAura].g,PowaSet[CurrentAura].b);
899  
900 getglobal("PowaColor_SwatchBg").r = PowaSet[CurrentAura].r;
901 getglobal("PowaColor_SwatchBg").g = PowaSet[CurrentAura].g;
902 getglobal("PowaColor_SwatchBg").b = PowaSet[CurrentAura].b;
903  
904 getglobal("PowaHeader"):SetText("POWER AURAS "..PowaVersion);
905 getglobal("powa_Text"):SetText(PowaText.nomTitre.." "..CurrentAura.."/"..MaxAuras);
906 getglobal("PowaHideAllButton"):SetText(PowaText.nomHide);
907 getglobal("PowaTestButton"):SetText(PowaText.nomTest);
908 getglobal("PowaCloseButton"):SetText(PowaText.nomClose);
909 getglobal("PowaListButton"):SetText(PowaText.nomListe);
910  
911 if (PowaSet[CurrentAura].isdebuff) then
912 getglobal("PowaDebuffButton"):SetChecked(true);
913 getglobal("PowaDebuffTypeButton"):SetChecked(false);
914 getglobal("PowaBarBuffNameText"):SetText(PowaText.nomDebuff);
915 getglobal("PowaBarBuffName").aide = PowaText.aideBuff2;
916  
917 elseif (PowaSet[CurrentAura].isdebufftype) then
918 getglobal("PowaDebuffTypeButton"):SetChecked(true);
919 getglobal("PowaDebuffButton"):SetChecked(false);
920 getglobal("PowaBarBuffNameText"):SetText(PowaText.nomDebuffType);
921 getglobal("PowaBarBuffName").aide = PowaText.aideBuff3;
922 else
923 getglobal("PowaDebuffButton"):SetChecked(false);
924 getglobal("PowaDebuffTypeButton"):SetChecked(false);
925 getglobal("PowaBarBuffNameText"):SetText(PowaText.nomBuff);
926 getglobal("PowaBarBuffName").aide = PowaText.aideBuff;
927 end
928  
929 getglobal("PowaShowTimerButton"):SetChecked(PowaSet[CurrentAura].timer);
930 getglobal("PowaInverseButton"):SetChecked(PowaSet[CurrentAura].inverse);
931 if (PowaSet[CurrentAura].inverse) then
932 PowaSet[CurrentAura].timer = false;
933 getglobal("PowaShowTimerButton"):SetChecked(PowaSet[CurrentAura].timer);
934 Powa_DisableCheckBox("PowaShowTimerButton");
935 else
936 Powa_EnableCheckBox("PowaShowTimerButton");
937 end
938 end
939  
940 function Powa_ChangePagePrev() -- page precedente
941 if (CurrentAura == 1) then
942 CurrentAura = MaxAuras;
943 else
944 CurrentAura = CurrentAura - 1;
945 end
946 Powa_InitPage();
947 end
948  
949 function Powa_ChangePageNext() -- page suivante
950 if (CurrentAura == MaxAuras) then
951 CurrentAura = 1;
952 else
953 CurrentAura = CurrentAura + 1;
954 end
955 Powa_InitPage();
956 end
957  
958 function Powa_UpdateAura() -- met a jour l'effet apres modification d'options
959  
960 if (PowaEnabled == 0) then return; end -- desactived
961  
962 Powa_FramesVisibleTime[CurrentAura] = 0;
963 Powa_FramesVisibleTime[SecondeAura] = 0;
964  
965 if (Powa_Frames[CurrentAura]:IsVisible()) then -- sinon on affiche seulement si deja visible
966 Powa_DisplayAura(CurrentAura);
967 end
968 end
969  
970 function Powa_OptionClose() -- ferme la fenetre d'option
971 PowaModTest = false;
972 getglobal("PowaBarConfigFrame"):Hide();
973 getglobal("PowaListFrame"):Hide();
974 -- cache tous les effets en test
975 for i = 1, MaxAuras+2 do
976 if (PowaSet[i].duration > 0) then
977 Powa_Frames[i].duree = 31; -- force affiche et mode transparent
978 Powa_Frames[i]:Show();
979 Powa_Frames[i]:SetAlpha(0.0);
980 Powa_FramesVisibleTime[i] = 1;
981 else
982 Powa_FramesVisibleTime[i] = 0;
983 end
984 end
985 Powa_NewCheckBuffs(); -- detect les effets en cours
986 end
987  
988 function Powa_OptionTest() -- teste ou masque l'effet choisi
989 if (Powa_Frames[CurrentAura]:IsVisible()) then -- deja visible, on la cache
990 Powa_FramesVisibleTime[CurrentAura] = 0;
991 Powa_FramesVisibleTime[SecondeAura] = 0;
992 else -- pas visible alors on affiche
993 Powa_DisplayAura(CurrentAura);
994 end
995 end
996  
997 function Powa_OptionHideAll() -- cache tous les effets
998 -- cache tous les effets en test
999 for i = 1, MaxAuras+2 do
1000 Powa_FramesVisibleTime[i] = 0;
1001 end
1002 end
1003  
1004 -- ---------------------------------------------------------------------------------- FENETRE D'OPTION
1005  
1006 function PowaBarAuraTextureSliderChanged()
1007 local SliderValue = getglobal("PowaBarAuraTextureSlider"):GetValue();
1008  
1009 getglobal("PowaBarAuraTextureSliderText"):SetText(PowaText.nomTexture.." : "..SliderValue);
1010 getglobal("AuraTexture"):SetTexture("Interface\\Addons\\PowerAuras\\Aura"..SliderValue..".tga");
1011  
1012 PowaSet[CurrentAura].texture = SliderValue;
1013 Powa_UpdateAura();
1014 end
1015  
1016 function PowaBarAuraAlphaSliderChanged()
1017 local SliderValue = getglobal("PowaBarAuraAlphaSlider"):GetValue();
1018  
1019 getglobal("PowaBarAuraAlphaSliderText"):SetText(PowaText.nomAlpha.." : "..format("%.2f", SliderValue) );
1020  
1021 PowaSet[CurrentAura].alpha = SliderValue;
1022 Powa_UpdateAura();
1023 end
1024  
1025 function PowaBarAuraSizeSliderChanged()
1026 local SliderValue = getglobal("PowaBarAuraSizeSlider"):GetValue();
1027  
1028 getglobal("PowaBarAuraSizeSliderText"):SetText(PowaText.nomTaille.." : "..format("%.2f", SliderValue) );
1029  
1030 PowaSet[CurrentAura].size = SliderValue;
1031 Powa_UpdateAura();
1032 end
1033  
1034 function PowaBarAuraCoordSliderChanged()
1035 local SliderValue = getglobal("PowaBarAuraCoordSlider"):GetValue();
1036  
1037 getglobal("PowaBarAuraCoordSliderText"):SetText(PowaText.nomPos.." Y : "..SliderValue);
1038  
1039 PowaSet[CurrentAura].y = SliderValue;
1040 Powa_UpdateAura();
1041 end
1042  
1043 function PowaBarAuraCoordXSliderChanged()
1044 local SliderValue = getglobal("PowaBarAuraCoordXSlider"):GetValue();
1045  
1046 getglobal("PowaBarAuraCoordXSliderText"):SetText(PowaText.nomPos.." X : "..SliderValue);
1047  
1048 PowaSet[CurrentAura].x = SliderValue;
1049 Powa_UpdateAura();
1050 end
1051  
1052 function PowaBarAuraAnim2SliderChanged()
1053 local SliderValue = getglobal("PowaBarAuraAnim2Slider"):GetValue();
1054  
1055 getglobal("PowaBarAuraAnim2SliderText"):SetText(PowaText.nomAnim2.." : "..SliderValue);
1056  
1057 PowaSet[CurrentAura].anim2 = SliderValue;
1058 Powa_UpdateAura();
1059 end
1060  
1061 function PowaBarAuraAnim1SliderChanged()
1062 local SliderValue = getglobal("PowaBarAuraAnim1Slider"):GetValue();
1063  
1064 getglobal("PowaBarAuraAnim1SliderText"):SetText(PowaText.nomAnim1.." : "..SliderValue);
1065  
1066 PowaSet[CurrentAura].anim1 = SliderValue;
1067 Powa_UpdateAura();
1068 end
1069  
1070 function PowaBarAuraAnimSpeedSliderChanged()
1071 local SliderValue = getglobal("PowaBarAuraAnimSpeedSlider"):GetValue();
1072  
1073 getglobal("PowaBarAuraAnimSpeedSliderText"):SetText(PowaText.nomSpeed.." : "..format("%.0f",SliderValue*100).."%");
1074  
1075 PowaSet[CurrentAura].speed = SliderValue;
1076 Powa_UpdateAura();
1077 end
1078  
1079 function PowaBarAuraAnimDurationSliderChanged()
1080 local SliderValue = getglobal("PowaBarAuraDurationSlider"):GetValue();
1081  
1082 getglobal("PowaBarAuraDurationSliderText"):SetText(PowaText.nomDuration.." : "..SliderValue.." sec");
1083  
1084 PowaSet[CurrentAura].duration = SliderValue;
1085 Powa_UpdateAura();
1086 end
1087  
1088 function PowaBarAuraSymSliderChanged()
1089 local SliderValue = getglobal("PowaBarAuraSymSlider"):GetValue();
1090  
1091 if (SliderValue == 0) then
1092 getglobal("PowaBarAuraSymSliderText"):SetText(PowaText.nomSymetrie.." : "..PowaText.aucune);
1093 elseif (SliderValue == 1) then
1094 getglobal("PowaBarAuraSymSliderText"):SetText(PowaText.nomSymetrie.." : X");
1095 elseif (SliderValue == 2) then
1096 getglobal("PowaBarAuraSymSliderText"):SetText(PowaText.nomSymetrie.." : Y");
1097 elseif (SliderValue == 3) then
1098 getglobal("PowaBarAuraSymSliderText"):SetText(PowaText.nomSymetrie.." : XY");
1099 end
1100  
1101 PowaSet[CurrentAura].symetrie = SliderValue;
1102 Powa_UpdateAura();
1103 end
1104  
1105 function PowaBarAuraDeformSliderChanged()
1106 local SliderValue = getglobal("PowaBarAuraDeformSlider"):GetValue();
1107  
1108 getglobal("PowaBarAuraDeformSliderText"):SetText(PowaText.nomDeform.." : "..format("%.2f", SliderValue));
1109  
1110 PowaSet[CurrentAura].torsion = SliderValue;
1111 Powa_UpdateAura();
1112 end
1113  
1114 function PowaMaxTexSliderChanged()
1115 local SliderValue = getglobal("PowaMaxTexSlider"):GetValue();
1116  
1117 getglobal("PowaMaxTexSliderText"):SetText(PowaText.nomMaxTex.." : "..SliderValue);
1118  
1119 getglobal("PowaBarAuraTextureSlider"):SetMinMaxValues(1,SliderValue);
1120 getglobal("PowaBarAuraTextureSliderHigh"):SetText(SliderValue);
1121  
1122 PowaGlobal.maxtextures = SliderValue;
1123 end
1124  
1125 function PowaTextChanged()
1126 PowaSet[CurrentAura].buffname = getglobal("PowaBarBuffName"):GetText();
1127 end
1128  
1129 function PowaDebuffChecked()
1130 if (getglobal("PowaDebuffButton"):GetChecked()) then
1131 PowaSet[CurrentAura].isdebuff = true;
1132 PowaSet[CurrentAura].isdebufftype = false;
1133 getglobal("PowaDebuffTypeButton"):SetChecked(false);
1134 getglobal("PowaBarBuffNameText"):SetText(PowaText.nomDebuff);
1135 getglobal("PowaBarBuffName").aide = PowaText.aideBuff2;
1136 else
1137 PowaSet[CurrentAura].isdebuff = false;
1138 getglobal("PowaBarBuffNameText"):SetText(PowaText.nomBuff);
1139 getglobal("PowaBarBuffName").aide = PowaText.aideBuff;
1140 end
1141 Powa_UpdateList();
1142 end
1143  
1144 function PowaDebuffTypeChecked()
1145 if (getglobal("PowaDebuffTypeButton"):GetChecked()) then
1146 PowaSet[CurrentAura].isdebufftype = true;
1147 PowaSet[CurrentAura].isdebuff = false;
1148 getglobal("PowaDebuffButton"):SetChecked(false);
1149 getglobal("PowaBarBuffNameText"):SetText(PowaText.nomDebuffType);
1150 getglobal("PowaBarBuffName").aide = PowaText.aideBuff3;
1151 else
1152 PowaSet[CurrentAura].isdebufftype = false;
1153 getglobal("PowaBarBuffNameText"):SetText(PowaText.nomBuff);
1154 getglobal("PowaBarBuffName").aide = PowaText.aideBuff;
1155 end
1156 Powa_UpdateList();
1157 end
1158  
1159 function PowaQuickHideChecked()
1160 if (getglobal("PowaQuickHideButton"):GetChecked()) then
1161 PowaMisc.quickhide = true;
1162 else
1163 PowaMisc.quickhide = false;
1164 end
1165 end
1166  
1167 function PowaShowTimerChecked()
1168 if (getglobal("PowaShowTimerButton"):GetChecked()) then
1169 PowaSet[CurrentAura].timer = true;
1170 else
1171 PowaSet[CurrentAura].timer = false;
1172 end
1173 end
1174  
1175 function PowaInverseChecked()
1176 if (getglobal("PowaInverseButton"):GetChecked()) then
1177 PowaSet[CurrentAura].inverse = true;
1178 PowaSet[CurrentAura].timer = false;
1179 getglobal("PowaShowTimerButton"):SetChecked(false);
1180 Powa_DisableCheckBox("PowaShowTimerButton");
1181 else
1182 PowaSet[CurrentAura].inverse = false;
1183 Powa_EnableCheckBox("PowaShowTimerButton");
1184 end
1185 end
1186  
1187 function Powa_DisableCheckBox(checkBox)
1188 getglobal(checkBox):Disable();
1189 getglobal(checkBox.."Text"):SetTextColor(GRAY_FONT_COLOR.r, GRAY_FONT_COLOR.g, GRAY_FONT_COLOR.b);
1190 end
1191  
1192 function Powa_EnableCheckBox(checkBox, checked)
1193 getglobal(checkBox):Enable();
1194 getglobal(checkBox.."Text"):SetTextColor(NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b);
1195 end
1196  
1197 -- ---------------------------------------------------------------------------- OPTIONS DEPLACEMENT
1198  
1199 function PowaBar_MouseDown( strButton, frmFrame)
1200 if( strButton == "LeftButton") then
1201 getglobal( frmFrame ):StartMoving( );
1202 end
1203 end
1204  
1205 function PowaBar_MouseUp( strButton, frmFrame)
1206 getglobal( frmFrame ):StopMovingOrSizing( );
1207 end
1208  
1209 -- ----------------------------------------------------------------------------------- COLOR PICKER
1210  
1211 function PowaOptionsFrame_SetColor()
1212 local r,g,b = ColorPickerFrame:GetColorRGB();
1213 local swatch,frame;
1214 swatch = getglobal("PowaColorNormalTexture"); -- juste le visuel
1215 frame = getglobal("PowaColor_SwatchBg"); -- enregistre la couleur
1216 swatch:SetVertexColor(r,g,b);
1217 frame.r = r;
1218 frame.g = g;
1219 frame.b = b;
1220  
1221 PowaSet[CurrentAura].r = r;
1222 PowaSet[CurrentAura].g = g;
1223 PowaSet[CurrentAura].b = b;
1224  
1225 getglobal("AuraTexture"):SetVertexColor(r,g,b);
1226 Powa_UpdateAura();
1227 end
1228  
1229 function PowaOptionsFrame_CancelColor()
1230 local r = ColorPickerFrame.previousValues.r;
1231 local g = ColorPickerFrame.previousValues.g;
1232 local b = ColorPickerFrame.previousValues.b;
1233 local swatch,frame;
1234 swatch = getglobal("PowaColorNormalTexture"); -- juste le visuel
1235 frame = getglobal("PowaColor_SwatchBg"); -- enregistre la couleur
1236 swatch:SetVertexColor(r,g,b);
1237 frame.r = r;
1238 frame.g = g;
1239 frame.b = b;
1240  
1241 getglobal("AuraTexture"):SetVertexColor(r,g,b);
1242 end
1243  
1244 function Powa_OpenColorPicker()
1245 CloseMenus();
1246  
1247 button = getglobal("PowaColor_SwatchBg");
1248  
1249 ColorPickerFrame.func = PowaOptionsFrame_SetColor -- button.swatchFunc;
1250 ColorPickerFrame:SetColorRGB(button.r, button.g, button.b);
1251 ColorPickerFrame.previousValues = {r = button.r, g = button.g, b = button.b, opacity = button.opacity};
1252 ColorPickerFrame.cancelFunc = PowaOptionsFrame_CancelColor
1253  
1254 ColorPickerFrame:SetPoint("TOPLEFT", "PowaBarConfigFrame", "TOPRIGHT", 0, 0)
1255  
1256 ColorPickerFrame:Show();
1257 end