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 23.04.2006-1
12 ------------------------------------------------------------------------------------------------------
13  
14  
15 ------------------------------------------------------------------------------------------------------
16 -- FONCTIONS D'INSERTION
17 ------------------------------------------------------------------------------------------------------
18  
19 -- La table des timers est là pour ça !
20 function Necrosis_InsertTimerParTable(IndexTable, Target, LevelTarget, SpellGroup, SpellTimer, TimerTable)
21  
22 -- Insertion de l'entrée dans le tableau
23 table.insert(SpellTimer,
24 {
25 Name = NECROSIS_SPELL_TABLE[IndexTable].Name,
26 Time = NECROSIS_SPELL_TABLE[IndexTable].Length,
27 TimeMax = floor(GetTime() + NECROSIS_SPELL_TABLE[IndexTable].Length),
28 Type = NECROSIS_SPELL_TABLE[IndexTable].Type,
29 Target = Target,
30 TargetLevel = LevelTarget,
31 Group = 0,
32 Gtimer = nil
33 });
34  
35 -- Association d'un timer graphique au timer
36 SpellTimer, TimerTable = Necrosis_AddFrame(SpellTimer, TimerTable);
37  
38 -- Tri des entrées par type de sort
39 Necrosis_Tri(SpellTimer, "Type");
40  
41 -- Création des groupes (noms des mobs) des timers
42 SpellGroup, SpellTimer = Necrosis_Parsing(SpellGroup, SpellTimer);
43  
44 return SpellGroup, SpellTimer, TimerTable;
45 end
46  
47 -- Et pour insérer le timer de pierres
48 function Necrosis_InsertTimerStone(Stone, start, duration, SpellGroup, SpellTimer, TimerTable)
49  
50 -- Insertion de l'entrée dans le tableau
51 if Stone == "Healthstone" then
52 table.insert(SpellTimer,
53 {
54 Name = NECROSIS_COOLDOWN.Healthstone,
55 Time = 180,
56 TimeMax = floor(GetTime() + 180),
57 Type = 2,
58 Target = "",
59 TargetLevel = "",
60 Group = 2,
61 Gtimer = nil
62 });
63  
64 -- Association d'un timer graphique au timer
65 SpellTimer, TimerTable = Necrosis_AddFrame(SpellTimer, TimerTable);
66  
67 elseif Stone == "Spellstone" then
68 table.insert(SpellTimer,
69 {
70 Name = NECROSIS_COOLDOWN.Spellstone,
71 Time = 30,
72 TimeMax = floor(GetTime() + 30),
73 Type = 2,
74 Target = "",
75 TargetLevel = "",
76 Group = 2,
77 Gtimer = nil
78 });
79  
80 -- Association d'un timer graphique au timer
81 SpellTimer, TimerTable = Necrosis_AddFrame(SpellTimer, TimerTable);
82  
83 elseif Stone == "Soulstone" then
84 table.insert(SpellTimer,
85 {
86 Name = NECROSIS_SPELL_TABLE[11].Name,
87 Time = floor(duration - GetTime() + start),
88 TimeMax = floor(start + duration),
89 Type = NECROSIS_SPELL_TABLE[11].Type,
90 Target = "???",
91 TargetLevel = "",
92 Group = 1,
93 Gtimer = nil,
94 });
95  
96 -- Association d'un timer graphique au timer
97 SpellTimer, TimerTable = Necrosis_AddFrame(SpellTimer, TimerTable);
98 end
99  
100 -- Tri des entrées par type de sort
101 Necrosis_Tri(SpellTimer, "Type");
102  
103 -- Création des groupes (noms des mobs) des timers
104 SpellGroup, SpellTimer = Necrosis_Parsing(SpellGroup, SpellTimer);
105  
106 return SpellGroup, SpellTimer, TimerTable;
107 end
108  
109 -- Pour la création de timers personnels
110 function NecrosisTimerX(nom, duree, truc, Target, LevelTarget, SpellGroup, SpellTimer, TimerTable)
111  
112 table.insert(SpellTimer,
113 {
114 Name = nom,
115 Time = duree,
116 TimeMax = floor(GetTime() + duree),
117 Type = truc,
118 Target = Target,
119 TargetLevel = LevelTarget,
120 Group = 0,
121 Gtimer = nil
122 });
123  
124 -- Association d'un timer graphique au timer
125 SpellTimer, TimerTable = Necrosis_AddFrame(SpellTimer, TimerTable);
126  
127 -- Tri des entrées par type de sort
128 Necrosis_Tri(SpellTimer, "Type");
129  
130 -- Création des groupes (noms des mobs) des timers
131 SpellGroup, SpellTimer = Necrosis_Parsing(SpellGroup, SpellTimer);
132  
133 return SpellGroup, SpellTimer, TimerTable;
134 end
135  
136 ------------------------------------------------------------------------------------------------------
137 -- FONCTIONS DE RETRAIT
138 ------------------------------------------------------------------------------------------------------
139  
140  
141 -- Connaissant l'index du Timer dans la liste, on le supprime
142 function Necrosis_RetraitTimerParIndex(index, SpellTimer, TimerTable)
143  
144 -- Suppression du timer graphique
145 local Gtime = SpellTimer[index].Gtimer;
146 TimerTable = Necrosis_RemoveFrame(Gtime, TimerTable);
147  
148 -- On enlève le timer de la liste
149 table.remove(SpellTimer, index);
150  
151 return SpellTimer, TimerTable;
152 end
153  
154 -- Si on veut supprimer spécifiquement un Timer...
155 function Necrosis_RetraitTimerParNom(name, SpellTimer, TimerTable)
156 for index = 1, table.getn(SpellTimer), 1 do
157 if SpellTimer[index].Name == name then
158 SpellTimer = Necrosis_RetraitTimerParIndex(index, SpellTimer, TimerTable);
159 break;
160 end
161 end
162 return SpellTimer, TimerTable;
163 end
164  
165 -- Fonction pour enlever les timers de combat lors de la regen
166 function Necrosis_RetraitTimerCombat(SpellGroup, SpellTimer, TimerTable)
167 for index=1, table.getn(SpellTimer), 1 do
168 if SpellTimer[index] then
169 -- Si les cooldowns sont nominatifs, on enlève le nom
170 if SpellTimer[index].Type == 3 then
171 SpellTimer[index].Target = "";
172 SpellTimer[index].TargetLevel = "";
173 end
174 -- Enlevage des timers de combat
175 if ((SpellTimer[index].Type == 4) or (SpellTimer[index].Type == 5)) then
176 SpellTimer = Necrosis_RetraitTimerParIndex(index, SpellTimer, TimerTable);
177 end
178 end
179 end
180  
181 if table.getn(SpellGroup.Name) >= 4 then
182 for index = 4, table.getn(SpellGroup.Name), 1 do
183 table.remove(SpellGroup.Name);
184 table.remove(SpellGroup.SubName);
185 table.remove(SpellGroup.Visible);
186 end
187 end
188 return SpellGroup, SpellTimer, TimerTable;
189 end
190  
191 ------------------------------------------------------------------------------------------------------
192 -- FONCTIONS BOOLEENNES
193 ------------------------------------------------------------------------------------------------------
194  
195 function Necrosis_TimerExisteDeja(Nom, SpellTimer)
196 for index = 1, table.getn(SpellTimer), 1 do
197 if SpellTimer[index].Name == Nom then
198 return true;
199 end
200 end
201 return false;
202 end
203  
204  
205 ------------------------------------------------------------------------------------------------------
206 -- FONCTIONS DE TRI
207 ------------------------------------------------------------------------------------------------------
208  
209 -- On définit les groupes de chaque Timer
210 function Necrosis_Parsing(SpellGroup, SpellTimer)
211 local GroupeOK = false;
212 for index = 1, table.getn(SpellTimer), 1 do
213 local GroupeOK = false;
214 for i = 1, table.getn(SpellGroup.Name), 1 do
215 if ((SpellTimer[index].Type == i) and (i <= 3)) or
216 (SpellTimer[index].Target == SpellGroup.Name[i]
217 and SpellTimer[index].TargetLevel == SpellGroup.SubName[i])
218 then
219 GroupeOK = true;
220 SpellTimer[index].Group = i;
221 break;
222 end
223 end
224 -- Si le groupe n'existe pas, on en crée un nouveau
225 if not GroupeOK then
226 table.insert(SpellGroup.Name, SpellTimer[index].Target);
227 table.insert(SpellGroup.SubName, SpellTimer[index].TargetLevel);
228 table.insert(SpellGroup.Visible, false);
229 SpellTimer[index].Group = table.getn(SpellGroup.Name);
230 end
231 end
232  
233 Necrosis_Tri(SpellTimer, "Group");
234 return SpellGroup, SpellTimer;
235 end
236  
237 -- On trie les timers selon leur groupe
238 function Necrosis_Tri(SpellTimer, clef)
239 return table.sort(SpellTimer,
240 function (SubTab1, SubTab2)
241 return SubTab1[clef] < SubTab2[clef]
242 end);
243 end
244  
245 ------------------------------------------------------------------------------------------------------
246 -- FONCTIONS D'AFFICHAGE : CREATION DE LA CHAINE DE CARACTERE
247 ------------------------------------------------------------------------------------------------------
248  
249  
250 function Necrosis_DisplayTimer(display, index, SpellGroup, SpellTimer, GraphicalTimer, TimerTable)
251 if not SpellTimer then
252 return display, SpellGroup;
253 end
254  
255 local minutes = 0;
256 local seconds = 0;
257 local affichage;
258  
259 -- Changement de la couleur suivant le temps restant
260 local percent = (floor(SpellTimer[index].TimeMax - floor(GetTime())) / SpellTimer[index].Time)*100;
261 local color = NecrosisTimerColor(percent);
262  
263 if not SpellGroup.Visible[SpellTimer[index].Group]
264 and SpellGroup.SubName[SpellTimer[index].Group] ~= nil
265 and SpellGroup.Name[SpellTimer[index].Group] ~= nil then
266 display = display.."<purple>-------------------------------\n"..SpellGroup.Name[SpellTimer[index].Group].." "..SpellGroup.SubName[SpellTimer[index].Group].."\n-------------------------------<close>\n";
267 -- Crée le tableau qui servira aux timers graphiques
268 table.insert(GraphicalTimer.texte, SpellGroup.Name[SpellTimer[index].Group].." "..SpellGroup.SubName[SpellTimer[index].Group]);
269 table.insert(GraphicalTimer.TimeMax, 0);
270 table.insert(GraphicalTimer.Time, 0);
271 table.insert(GraphicalTimer.titre, true);
272 table.insert(GraphicalTimer.temps, "");
273 table.insert(GraphicalTimer.Gtimer, 0);
274 SpellGroup.Visible[SpellTimer[index].Group] = true;
275 end
276  
277 -- Mise en place d'un Chrono plutôt qu'un Compte à Rebours pour l'asservissement
278 if SpellTimer[index].Name == NECROSIS_SPELL_TABLE[10].Name then
279 seconds = floor(GetTime()) - (SpellTimer[index].TimeMax - SpellTimer[index].Time);
280 else
281 seconds = SpellTimer[index].TimeMax - floor(GetTime());
282 end
283 minutes = floor(seconds/60);
284 if (minutes > 0) then
285 if (minutes > 9) then
286 affichage = tostring(minutes)..":";
287 else
288 affichage = "0"..minutes..":"
289 end
290 else
291 affichage = "0:";
292 end
293 seconds = mod(seconds, 60);
294 if (seconds > 9) then
295 affichage = affichage..seconds
296 else
297 affichage = affichage.."0"..seconds
298 end
299 display = display.."<white>"..affichage.." - <close>";
300  
301 -- Crée le tableau qui servira aux timers graphiques
302 if (SpellTimer[index].Type == 1 or SpellTimer[index].Name == NECROSIS_SPELL_TABLE[16].Name)
303 and (SpellTimer[index].Target ~= "") then
304 if NecrosisConfig.SpellTimerPos == 1 then
305 affichage = affichage.." - "..SpellTimer[index].Target;
306 else
307 affichage = SpellTimer[index].Target.." - "..affichage;
308 end
309 end
310 table.insert(GraphicalTimer.texte, SpellTimer[index].Name);
311 table.insert(GraphicalTimer.TimeMax, SpellTimer[index].TimeMax);
312 table.insert(GraphicalTimer.Time, SpellTimer[index].Time);
313 table.insert(GraphicalTimer.titre, false);
314 table.insert(GraphicalTimer.temps, affichage);
315 table.insert(GraphicalTimer.Gtimer, SpellTimer[index].Gtimer);
316  
317 if NecrosisConfig.CountType == 3 then
318 if SpellTimer[index].Name == NECROSIS_SPELL_TABLE[11].Name then
319 if (minutes > 0) then
320 NecrosisShardCount:SetText(minutes.." m");
321 else
322 NecrosisShardCount:SetText(seconds);
323 end
324 end
325 end
326 if NecrosisConfig.Circle == 2 then
327 if SpellTimer[index].Name == NECROSIS_SPELL_TABLE[11].Name then
328 if (minutes >= 16) then
329 NecrosisButton:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Turquoise\\Shard"..minutes - 15);
330 elseif minutes >= 1 or seconds >= 33 then
331 NecrosisButton:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Orange\\Shard"..minutes + 1);
332 else
333 NecrosisButton:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Rose\\Shard"..seconds);
334 end
335 end
336 end
337 display = display..color..SpellTimer[index].Name.."<close><white>";
338 if (SpellTimer[index].Type == 1 or SpellTimer[index].Name == NECROSIS_SPELL_TABLE[16].Name)
339 and (SpellTimer[index].Target ~= "")
340 then
341 display = display.." - "..SpellTimer[index].Target.."<close>\n";
342 else
343 display = display.."<close>\n";
344 end
345 -- Affichage des timers graphiques (si sélectionnés)
346 if NecrosisConfig.Graphical then
347 NecrosisAfficheTimer(GraphicalTimer, TimerTable);
348 end
349  
350 return display, SpellGroup, GraphicalTimer, TimerTable;
351 end