vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 ------------------------------------------------------------------------------------------------------
2 -- Necrosis LdC
3 --
4 -- Créateur initial (US) : Infernal (http://www.revolvus.com/games/interface/necrosis/)
5 -- Implémentation de base (FR) : Tilienna Thorondor
6 -- Reprise du projet : Lomig & Nyx des Larmes de Cenarius, Kael'Thas
7 --
8 -- Skins et voix Françaises : Eliah, Ner'zhul
9 -- Version Allemande par Arne Meier et Halisstra, Lothar
10 -- Remerciements spéciaux pour Sadyre (JoL)
11 -- Version 07.04.2006-1
12 ------------------------------------------------------------------------------------------------------
13  
14  
15 -- La fonction d'affichage des timers
16 -- tableau est de la forme suivante :
17 -- tableau {
18 -- texte = "Nom du mob ou du sort",
19 -- TimeMax = "TimeMax du sort",
20 -- Time = "Time du sort",
21 -- titre = "vrai si titre, faux sinon",
22 -- temps = "timer numérique",
23 -- Gtimer = "Numéro du timer associé (entre 1 et 65)"
24 -- }
25 function NecrosisAfficheTimer(tableau, pointeur)
26 -- On définit l'endroit ou apparaitra la première frame
27 -- On déclare que la première frame est toujours le premier mob (logique :P)
28  
29 if tableau ~= nil then
30 local TimerTarget = 0;
31 local yPosition = NecrosisConfig.SensListe * 5;
32  
33 local PositionTitre = {};
34  
35 if NecrosisConfig.SensListe > 0 then
36 PositionTitre = {11, 13};
37 else
38 PositionTitre = {-13, -11};
39 end
40  
41  
42 for index = 1, table.getn(tableau.texte), 1 do
43 -- Si l'entrée est un titre de mob
44 if tableau.titre[index] then
45 -- On change de groupe de mob
46 TimerTarget = TimerTarget + 1;
47 if TimerTarget ~= 1 then yPosition = yPosition - PositionTitre[1]; end
48 if TimerTarget == 11 then TimerTarget = 1; end
49 -- On affiche le titre
50 local frameName = "NecrosisTarget"..TimerTarget.."Text";
51 local frameItem = getglobal(frameName);
52 -- On place le coin gauche de la frame par rapport au centre du bouton des SpellTimers
53 frameItem:ClearAllPoints();
54 frameItem:SetPoint(NecrosisConfig.SpellTimerJust, "NecrosisSpellTimerButton", "CENTER", NecrosisConfig.SpellTimerPos * 23, yPosition);
55 yPosition = yPosition - PositionTitre[2];
56 -- On nomme la frame, puis on l'affiche ! :)
57 frameItem:SetText(tableau.texte[index]);
58 if not frameItem:IsShown() then
59 frameItem:Show();
60 end
61 else
62 -- Pareil pour les DoT
63 local JustifInverse = "LEFT";
64 if NecrosisConfig.SpellTimerJust == "LEFT" then JustifInverse = "RIGHT"; end
65  
66 local frameName1 = "NecrosisTimer"..tableau.Gtimer[index].."Text";
67 local frameItem1 = getglobal(frameName1);
68 local frameName2 = "NecrosisTimer"..tableau.Gtimer[index].."Bar";
69 local frameItem2 = getglobal(frameName2);
70 local frameName3 = "NecrosisTimer"..tableau.Gtimer[index].."Texture";
71 local frameItem3 = getglobal(frameName3);
72 local frameName4 = "NecrosisTimer"..tableau.Gtimer[index].."Spark";
73 local frameItem4 = getglobal(frameName4);
74 local frameName5 = "NecrosisTimer"..tableau.Gtimer[index].."OutText";
75 local frameItem5 = getglobal(frameName5);
76  
77 frameItem1:ClearAllPoints();
78 frameItem1:SetPoint(NecrosisConfig.SpellTimerJust, "NecrosisSpellTimerButton", "CENTER", NecrosisConfig.SpellTimerPos * 23, yPosition + 1);
79 if NecrosisConfig.Yellow then
80 frameItem1:SetTextColor(1, 0.82, 0);
81 else
82 frameItem1:SetTextColor(1, 1, 1);
83 end
84 frameItem1:SetJustifyH("LEFT");
85 frameItem1:SetText(tableau.texte[index]);
86 frameItem2:ClearAllPoints();
87 frameItem2:SetPoint(NecrosisConfig.SpellTimerJust, "NecrosisSpellTimerButton", "CENTER", NecrosisConfig.SpellTimerPos * 23, yPosition);
88 frameItem2:SetMinMaxValues(tableau.TimeMax[index] - tableau.Time[index], tableau.TimeMax[index]);
89 frameItem2:SetValue(2 * tableau.TimeMax[index] - (tableau.Time[index] + floor(GetTime())));
90 local r, g;
91 local b = 37/255;
92 local PercentColor = (tableau.TimeMax[index] - floor(GetTime())) / tableau.Time[index]
93 if PercentColor > 0.5 then
94 r = (49/255) + (((1 - PercentColor) * 2) * (1 - (49/255)));
95 g = 207/255;
96 else
97 r = 1.0;
98 g = (207/255) - (0.5 - PercentColor) * 2 * (207/255);
99 end
100 frameItem2:SetStatusBarColor(r, g, b)
101 frameItem3:ClearAllPoints();
102 frameItem3:SetPoint(NecrosisConfig.SpellTimerJust, "NecrosisSpellTimerButton", "CENTER", NecrosisConfig.SpellTimerPos * 23, yPosition);
103 frameItem5:ClearAllPoints();
104 frameItem5:SetTextColor(1, 1, 1);
105 frameItem5:SetJustifyH(NecrosisConfig.SpellTimerJust);
106 frameItem5:SetPoint(NecrosisConfig.SpellTimerJust, frameItem2, JustifInverse, NecrosisConfig.SpellTimerPos * 5, 1);
107 frameItem5:SetText(tableau.temps[index]);
108  
109 local sparkPosition = 150 - ((floor(GetTime()) - (tableau.TimeMax[index] - tableau.Time[index])) / tableau.Time[index]) * 150;
110 if (sparkPosition < 1) then
111 sparkPosition = 1;
112 end
113 frameItem4:SetPoint("CENTER", frameItem2, "LEFT", sparkPosition, 0);
114 yPosition = yPosition - NecrosisConfig.SensListe * 11;
115 end
116 end
117 if TimerTarget < 10 then
118 for i = TimerTarget + 1, 10, 1 do
119 local frameName = "NecrosisTarget"..i.."Text";
120 local frameItem = getglobal(frameName);
121 if frameItem:IsShown() then
122 frameItem:Hide();
123 end
124 end
125 end
126 end
127 end
128  
129 function Necrosis_AddFrame(SpellTimer, TimerTable)
130 for i = 1, table.getn(TimerTable), 1 do
131 if not TimerTable[i] then
132 TimerTable[i] = true;
133 SpellTimer[table.getn(SpellTimer)].Gtimer = i;
134 -- Affichage du timer graphique associé
135 if NecrosisConfig.Graphical then
136 local elements = {"Text", "Bar", "Texture", "OutText"}
137 for j = 1, 4, 1 do
138 frameName = "NecrosisTimer"..i..elements[j];
139 frameItem = getglobal(frameName);
140 frameItem:Show();
141 end
142 end
143 break
144 end
145 end
146 return SpellTimer, TimerTable;
147 end
148  
149 function Necrosis_RemoveFrame(Gtime, TimerTable)
150 -- On cache le timer graphique
151 local elements = {"Text", "Bar", "Texture", "OutText"}
152 for j = 1, 4, 1 do
153 frameName = "NecrosisTimer"..Gtime..elements[j];
154 frameItem = getglobal(frameName);
155 frameItem:Hide();
156 end
157  
158 -- On déclare le timer graphique comme réutilisable
159 TimerTable[Gtime] = false;
160  
161 return TimerTable;
162 end