vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 function DefendYourself_Panic(elapsed)
2 if not DYKey.On then DefendYourselfPanicButton:Hide(); else DefendYourselfPanicButton:Show(); end
3 DefendYourselfPanicButtonGraphics();
4 if not DYKey or not DYKey.PanicTime then return nil; end
5 if DYKey.PanicTime <= 0 then DYKey.PanicTime = nil; DefendYourself_Print("Panic Status over. Normality restored.",0,0,1); return nil; else DYKey.PanicTime = DYKey.PanicTime - elapsed; return true; end
6 end
7  
8 function DefendYourself_StartPanic(x)
9 if not DYKey then return end
10 if not DYKey.PanicTimer then DYKey.PanicTimer = 30; end
11 if not x then x = DYKey.PanicTimer; end
12 DefendYourselfPanicBar.maxtime = x;
13 DYKey.PanicTime = x;
14 DefendYourself_Print("Panic status enabled! "..x.." seconds to normality!",1,0,0);
15 if DYVar.combat then AttackTarget(); end
16 end
17  
18 function DefendYourselfPanicButtonClick(button)
19 if button == "LeftButton" then
20 DefendYourself_StartPanic();
21 else
22 if not DYKey.PanicState or DYKey.PanicState > 3 then DYKey.PanicState = -1; end
23 DYKey.PanicState = DYKey.PanicState + 1;
24 end
25 end
26  
27 function DefendYourselfPanicButtonGraphics()
28 local bu = getglobal("DefendYourselfPanicButton");
29 local bu1 = getglobal("DefendYourselfPanicButtonTex");
30 bu:SetScale(1);
31 if DYKey.PanicState == 0 then
32 bu:SetWidth(25);
33 bu:SetHeight(25);
34 bu1:SetAlpha(1);
35 bu:SetMovable(1);
36 elseif DYKey.PanicState == 1 then
37 bu:SetWidth(35);
38 bu:SetHeight(35);
39 bu1:SetAlpha(1);
40 bu:SetMovable(1);
41 elseif DYKey.PanicState == 2 then
42 bu:SetWidth(50);
43 bu:SetHeight(50);
44 bu1:SetAlpha(1);
45 bu:SetMovable(1);
46 elseif DYKey.PanicState == 3 then
47 bu:SetWidth(15);
48 bu:SetHeight(15);
49 bu1:SetAlpha(1);
50 bu:SetMovable(1);
51 elseif DYKey.PanicState == 4 then
52 bu:SetWidth(15);
53 bu:SetHeight(15);
54 bu1:SetAlpha(0.5);
55 bu:SetMovable(0);
56 else
57 bu:Hide();
58 end
59 local par = getglobal("DefendYourselfPanicBar");
60 local bar = getglobal("DefendYourselfBar");
61 local text = getglobal("DefendYourselfPanicText");
62 bar:SetFrameLevel(1);
63 if not DYKey.Bar then
64 par:Hide();
65 else
66 if DYKey.PanicTime and DYKey.PanicTime > 0 then
67 bar:SetMinMaxValues(0,par.maxtime);
68 bar:SetValue(DYKey.PanicTime);
69 bar:SetStatusBarColor(1,0,0);
70 text:SetText("Panic Status:"..floor(DYKey.PanicTime).."s");
71 if DYKey.Bar then par:Show(); else par:Hide(); end
72 else
73 bar:SetMinMaxValues(0,1);
74 bar:SetValue(1);
75 bar:SetStatusBarColor(0,1,0);
76 text:SetText("Panic Status:Good");
77 if DYKey.Bar == 1 then par:Show(); else par:Hide(); end
78 end
79 end
80 end