vanilla-wow-addons – Blame information for rev 1
?pathlinks?
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 28.06.2006-1 |
||
12 | ------------------------------------------------------------------------------------------------------ |
||
13 | |||
14 | -- Configuration par défaut |
||
15 | -- Se charge en cas d'absence de configuration ou de changement de version |
||
16 | Default_NecrosisConfig = { |
||
17 | Version = NecrosisData.Version; |
||
18 | SoulshardContainer = 4; |
||
19 | SoulshardSort = false; |
||
20 | SoulshardDestroy = false; |
||
21 | ShadowTranceAlert = true; |
||
22 | ShowSpellTimers = true; |
||
23 | AntiFearAlert = true; |
||
24 | NecrosisLockServ = true; |
||
25 | NecrosisAngle = 180; |
||
26 | StonePosition = {true, true, true, true, true, true, true, true}; |
||
27 | NecrosisToolTip = true; |
||
28 | NoDragAll = false; |
||
29 | PetMenuPos = 34; |
||
30 | BuffMenuPos = 34; |
||
31 | CurseMenuPos = 34; |
||
32 | ChatMsg = true; |
||
33 | ChatType = true; |
||
34 | NecrosisLanguage = GetLocale(); |
||
35 | ShowCount = true; |
||
36 | CountType = 1; |
||
37 | ShadowTranceScale = 100; |
||
38 | NecrosisButtonScale = 90; |
||
39 | NecrosisColor = "Rose"; |
||
40 | Sound = true; |
||
41 | SpellTimerPos = 1; |
||
42 | SpellTimerJust = "LEFT"; |
||
43 | Circle = 1; |
||
44 | Graphical = true; |
||
45 | Yellow = true; |
||
46 | SensListe = 1; |
||
47 | PetName = { |
||
48 | [1] = " ", |
||
49 | [2] = " ", |
||
50 | [3] = " ", |
||
51 | [4] = " " |
||
52 | }; |
||
53 | DominationUp = false; |
||
54 | AmplifyUp = false; |
||
55 | SM = false; |
||
56 | SteedSummon = false; |
||
57 | DemonSummon = true; |
||
58 | BanishScale = 100; |
||
59 | }; |
||
60 | |||
61 | NecrosisConfig = {}; |
||
62 | local Debug = false; |
||
63 | local Loaded = false |
||
64 | |||
65 | -- Détection des initialisations du mod |
||
66 | local NecrosisRL = true; |
||
67 | |||
68 | -- Initialisation des variables utilisées par Necrosis pour la gestion des sorts lancés |
||
69 | local SpellCastName = nil; |
||
70 | local SpellCastRank = nil; |
||
71 | local SpellTargetName = nil; |
||
72 | local SpellTargetLevel = nil; |
||
73 | local SpellCastTime = 0; |
||
74 | |||
75 | -- Initialisation des tableaux gérant les Timers |
||
76 | -- Un pour les sorts à timer, l'autre pour les groupes de mobs |
||
77 | -- Le dernier permet l'association d'un timer à une frame graphique |
||
78 | SpellTimer = {}; |
||
79 | local SpellGroup = { |
||
80 | Name = {"Rez", "Main", "Cooldown"}, |
||
81 | SubName = {" ", " ", " "}, |
||
82 | Visible = {true, true, true} |
||
83 | }; |
||
84 | |||
85 | local TimerTable = {}; |
||
86 | for i = 1, 50, 1 do |
||
87 | TimerTable[i] = false; |
||
88 | end |
||
89 | |||
90 | -- Menus : Permet l'affichage des menus de buff et de pet |
||
91 | local PetShow = false; |
||
92 | local PetMenuShow = false; |
||
93 | local BuffShow = false; |
||
94 | local BuffMenuShow = false; |
||
95 | local CurseShow = false; |
||
96 | local CurseMenuShow = false; |
||
97 | |||
98 | -- Menus : Permet la disparition progressive du menu des pets (transparence) |
||
99 | local AlphaPetMenu = 1; |
||
100 | local AlphaPetVar = 0; |
||
101 | local PetVisible = false; |
||
102 | |||
103 | -- Menus : Permet la disparition progressive du menu des buffs (transparence) |
||
104 | local AlphaBuffMenu = 1; |
||
105 | local AlphaBuffVar = 0; |
||
106 | local BuffVisible = false; |
||
107 | |||
108 | -- Menus : Permet la disparition progressive du menu des curses (transparence) |
||
109 | local AlphaCurseMenu = 1; |
||
110 | local AlphaCurseVar = 0; |
||
111 | local CurseVisible = false; |
||
112 | |||
113 | -- Menus : Permet de recaster le dernier cast du menu en cliquant milieu sur celui-ci |
||
114 | local LastDemon = 0; |
||
115 | local LastBuff = 0; |
||
116 | local LastCurse = 0; |
||
117 | |||
118 | -- Liste des boutons disponible pour le démoniste dans chaque menu |
||
119 | local PetMenuCreate = {}; |
||
120 | local BuffMenuCreate = {}; |
||
121 | local CurseMenuCreate = {}; |
||
122 | |||
123 | -- Variables utilisées pour la gestion des montures |
||
124 | local MountAvailable = false; |
||
125 | local NecrosisMounted = false; |
||
126 | local NecrosisTellMounted = true; |
||
127 | local PlayerCombat = false; |
||
128 | |||
129 | -- Variables utilisées pour la gestion des transes de l'ombre |
||
130 | local ShadowTrance = false; |
||
131 | local AntiFearInUse = false; |
||
132 | local ShadowTranceID = -1; |
||
133 | |||
134 | -- Variables utilisées pour la gestion des fragments d'âme |
||
135 | -- (principalement comptage) |
||
136 | local Soulshards = 0; |
||
137 | local SoulshardContainer = 4; |
||
138 | local SoulshardSlot = {}; |
||
139 | local SoulshardSlotID = 1; |
||
140 | local SoulshardMP = 0; |
||
141 | local SoulshardTime = 0; |
||
142 | |||
143 | -- Variables utilisées pour la gestion des composants d'invocation |
||
144 | -- (principalement comptage) |
||
145 | local InfernalStone = 0; |
||
146 | local DemoniacStone = 0; |
||
147 | |||
148 | |||
149 | -- Variables utilisées pour la gestion des boutons d'invocation et d'utilisation des pierres |
||
150 | local StoneIDInSpellTable = {0, 0, 0, 0} |
||
151 | local SoulstoneUsedOnTarget = false; |
||
152 | local SoulstoneOnHand = false; |
||
153 | local SoulstoneLocation = {nil,nil}; |
||
154 | local SoulstoneMode = 1; |
||
155 | local HealthstoneOnHand = false; |
||
156 | local HealthstoneLocation = {nil,nil}; |
||
157 | local HealthstoneMode = 1; |
||
158 | local FirestoneOnHand = false; |
||
159 | local FirestoneLocation = {nil,nil}; |
||
160 | local FirestoneMode = 1; |
||
161 | local SpellstoneOnHand = false; |
||
162 | local SpellstoneLocation = {nil,nil}; |
||
163 | local SpellstoneMode = 1; |
||
164 | local HearthstoneOnHand = false; |
||
165 | local HearthstoneLocation = {nil,nil}; |
||
166 | local ItemswitchLocation = {nil,nil}; |
||
167 | local ItemOnHand = false; |
||
168 | |||
169 | -- Variables gérant la possibilité ou l'impossibilité d'utiliser un timer de rez |
||
170 | local SoulstoneWaiting = false; |
||
171 | local SoulstoneCooldown = false; |
||
172 | local SoulstoneAdvice = false; |
||
173 | local SoulstoneTarget = ""; |
||
174 | |||
175 | -- Variables utilisées dans la gestion des démons |
||
176 | local DemonType = nil; |
||
177 | local DemonEnslaved = false; |
||
178 | |||
179 | -- Variables utilisées pour l'anti-fear |
||
180 | local AFblink1, AFBlink2 = 0; |
||
181 | local AFImageType = { "", "Immu", "Prot"}; -- Fear warning button filename variations |
||
182 | local AFCurrentTargetImmune = false; |
||
183 | |||
184 | -- Variables utilisées pour les échanges de pierre avec les joueurs |
||
185 | local NecrosisTradeRequest = false; |
||
186 | local Trading = false; |
||
187 | local TradingNow = 0; |
||
188 | |||
189 | -- Gestion des sacs à fragment d'âme |
||
190 | local BagIsSoulPouch = {nil, nil, nil, nil, nil}; |
||
191 | |||
192 | -- Variable contenant les derniers messages invoqués |
||
193 | local PetMess = 0 |
||
194 | local SteedMess = 0 |
||
195 | local RezMess = 0 |
||
196 | local TPMess = 0 |
||
197 | |||
198 | -- Permet la gestion des tooltips dans Necrosis (sans la frame des pièces de monnaie) |
||
199 | local lOriginal_GameTooltip_ClearMoney; |
||
200 | |||
201 | local Necrosis_In = true; |
||
202 | |||
203 | ------------------------------------------------------------------------------------------------------ |
||
204 | -- FONCTIONS NECROSIS APPLIQUEES A L'ENTREE DANS LE JEU |
||
205 | ------------------------------------------------------------------------------------------------------ |
||
206 | |||
207 | |||
208 | -- Fonction appliquée au chargement |
||
209 | function Necrosis_OnLoad() |
||
210 | |||
211 | -- Permet de repérer les sorts lancés |
||
212 | Necrosis_Hook("UseAction", "Necrosis_UseAction", "before"); |
||
213 | Necrosis_Hook("CastSpell", "Necrosis_CastSpell", "before"); |
||
214 | Necrosis_Hook("CastSpellByName", "Necrosis_CastSpellByName", "before"); |
||
215 | |||
216 | -- Enregistrement des événements interceptés par Necrosis |
||
217 | this:RegisterEvent("PLAYER_ENTERING_WORLD"); |
||
218 | this:RegisterEvent("PLAYER_LEAVING_WORLD"); |
||
219 | NecrosisButton:RegisterEvent("BAG_UPDATE"); |
||
220 | NecrosisButton:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS"); |
||
221 | NecrosisButton:RegisterEvent("CHAT_MSG_SPELL_AURA_GONE_SELF"); |
||
222 | NecrosisButton:RegisterEvent("CHAT_MSG_SPELL_BREAK_AURA"); |
||
223 | NecrosisButton:RegisterEvent("PLAYER_REGEN_DISABLED"); |
||
224 | NecrosisButton:RegisterEvent("PLAYER_REGEN_ENABLED"); |
||
225 | NecrosisButton:RegisterEvent("UNIT_PET"); |
||
226 | NecrosisButton:RegisterEvent("SPELLCAST_START"); |
||
227 | NecrosisButton:RegisterEvent("SPELLCAST_FAILED"); |
||
228 | NecrosisButton:RegisterEvent("SPELLCAST_INTERRUPTED"); |
||
229 | NecrosisButton:RegisterEvent("SPELLCAST_STOP"); |
||
230 | NecrosisButton:RegisterEvent("LEARNED_SPELL_IN_TAB"); |
||
231 | NecrosisButton:RegisterEvent("CHAT_MSG_SPELL_SELF_DAMAGE"); |
||
232 | NecrosisButton:RegisterEvent("PLAYER_TARGET_CHANGED"); |
||
233 | NecrosisButton:RegisterEvent("TRADE_REQUEST"); |
||
234 | NecrosisButton:RegisterEvent("TRADE_REQUEST_CANCEL"); |
||
235 | NecrosisButton:RegisterEvent("TRADE_SHOW"); |
||
236 | NecrosisButton:RegisterEvent("TRADE_CLOSED"); |
||
237 | |||
238 | -- Enregistrement des composants graphiques |
||
239 | NecrosisButton:RegisterForDrag("LeftButton"); |
||
240 | NecrosisButton:RegisterForClicks("LeftButtonUp", "RightButtonUp"); |
||
241 | NecrosisButton:SetFrameLevel(1); |
||
242 | |||
243 | -- Enregistrement de la commande console |
||
244 | SlashCmdList["NecrosisCommand"] = Necrosis_SlashHandler; |
||
245 | SLASH_NecrosisCommand1 = "/necro"; |
||
246 | end |
||
247 | |||
248 | |||
249 | -- Fonction appliquée une fois les paramètres des mods chargés |
||
250 | function Necrosis_LoadVariables() |
||
251 | if Loaded or UnitClass("player") ~= NECROSIS_UNIT_WARLOCK then |
||
252 | return |
||
253 | end |
||
254 | |||
255 | Necrosis_Initialize(); |
||
256 | Loaded = true ; |
||
257 | |||
258 | -- Détection du type de démon présent à la connexion |
||
259 | DemonType = UnitCreatureFamily("pet"); |
||
260 | end |
||
261 | |||
262 | ------------------------------------------------------------------------------------------------------ |
||
263 | -- FONCTIONS NECROSIS |
||
264 | ------------------------------------------------------------------------------------------------------ |
||
265 | |||
266 | -- Fonction lancée à la mise à jour de l'interface (main) -- toutes les 0,1 secondes environ |
||
267 | function Necrosis_OnUpdate() |
||
268 | |||
269 | -- La fonction n'est utilisée que si Necrosis est initialisé et le joueur un Démoniste -- |
||
270 | if (not Loaded) and UnitClass("player") ~= NECROSIS_UNIT_WARLOCK then |
||
271 | return; |
||
272 | end |
||
273 | -- La fonction n'est utilisée que si Necrosis est initialisé et le joueur un Démoniste -- |
||
274 | |||
275 | |||
276 | -- Gestion des fragments d'âme : Tri des fragment toutes les secondes |
||
277 | local curTime = GetTime(); |
||
278 | if ((curTime-SoulshardTime) >= 1) then |
||
279 | SoulshardTime = curTime; |
||
280 | if (SoulshardMP > 0) then |
||
281 | Necrosis_SoulshardSwitch("MOVE"); |
||
282 | end |
||
283 | end |
||
284 | |||
285 | ---------------------------------------------------------- |
||
286 | -- Gestion des sorts du Démoniste |
||
287 | ---------------------------------------------------------- |
||
288 | |||
289 | -- Gestion du menu d'invocation des démons |
||
290 | if PetShow then |
||
291 | if GetTime() >= AlphaPetVar and AlphaPetMenu > 0 and (not PetVisible) then |
||
292 | AlphaPetVar = GetTime() + 0.1; |
||
293 | NecrosisPetMenu1:SetAlpha(AlphaPetMenu); |
||
294 | NecrosisPetMenu2:SetAlpha(AlphaPetMenu); |
||
295 | NecrosisPetMenu3:SetAlpha(AlphaPetMenu); |
||
296 | NecrosisPetMenu4:SetAlpha(AlphaPetMenu); |
||
297 | NecrosisPetMenu5:SetAlpha(AlphaPetMenu); |
||
298 | NecrosisPetMenu6:SetAlpha(AlphaPetMenu); |
||
299 | NecrosisPetMenu7:SetAlpha(AlphaPetMenu); |
||
300 | NecrosisPetMenu8:SetAlpha(AlphaPetMenu); |
||
301 | NecrosisPetMenu9:SetAlpha(AlphaPetMenu); |
||
302 | AlphaPetMenu = AlphaPetMenu - 0.1; |
||
303 | end |
||
304 | if AlphaPetMenu <= 0 then |
||
305 | Necrosis_PetMenu(); |
||
306 | end |
||
307 | end |
||
308 | |||
309 | -- Gestion du menu des Buffs |
||
310 | if BuffShow then |
||
311 | if GetTime() >= AlphaBuffVar and AlphaBuffMenu > 0 and (not BuffVisible) then |
||
312 | AlphaBuffVar = GetTime() + 0.1; |
||
313 | NecrosisBuffMenu1:SetAlpha(AlphaBuffMenu); |
||
314 | NecrosisBuffMenu2:SetAlpha(AlphaBuffMenu); |
||
315 | NecrosisBuffMenu3:SetAlpha(AlphaBuffMenu); |
||
316 | NecrosisBuffMenu4:SetAlpha(AlphaBuffMenu); |
||
317 | NecrosisBuffMenu5:SetAlpha(AlphaBuffMenu); |
||
318 | NecrosisBuffMenu6:SetAlpha(AlphaBuffMenu); |
||
319 | NecrosisBuffMenu7:SetAlpha(AlphaBuffMenu); |
||
320 | NecrosisBuffMenu8:SetAlpha(AlphaBuffMenu); |
||
321 | NecrosisBuffMenu9:SetAlpha(AlphaBuffMenu); |
||
322 | AlphaBuffMenu = AlphaBuffMenu - 0.1; |
||
323 | end |
||
324 | if AlphaBuffMenu <= 0 then |
||
325 | Necrosis_BuffMenu(); |
||
326 | end |
||
327 | end |
||
328 | |||
329 | -- Gestion du menu des Curses |
||
330 | if CurseShow then |
||
331 | if GetTime() >= AlphaCurseVar and AlphaCurseMenu > 0 and (not CurseVisible) then |
||
332 | AlphaCurseVar = GetTime() + 0.1; |
||
333 | NecrosisCurseMenu1:SetAlpha(AlphaCurseMenu); |
||
334 | NecrosisCurseMenu2:SetAlpha(AlphaCurseMenu); |
||
335 | NecrosisCurseMenu3:SetAlpha(AlphaCurseMenu); |
||
336 | NecrosisCurseMenu4:SetAlpha(AlphaCurseMenu); |
||
337 | NecrosisCurseMenu5:SetAlpha(AlphaCurseMenu); |
||
338 | NecrosisCurseMenu6:SetAlpha(AlphaCurseMenu); |
||
339 | NecrosisCurseMenu7:SetAlpha(AlphaCurseMenu); |
||
340 | NecrosisCurseMenu8:SetAlpha(AlphaCurseMenu); |
||
341 | NecrosisCurseMenu9:SetAlpha(AlphaCurseMenu); |
||
342 | AlphaCurseMenu = AlphaCurseMenu - 0.1; |
||
343 | end |
||
344 | if AlphaCurseMenu <= 0 then |
||
345 | Necrosis_CurseMenu(); |
||
346 | end |
||
347 | end |
||
348 | |||
349 | -- Gestion du talent "Crépuscule" |
||
350 | if NecrosisConfig.ShadowTranceAlert then |
||
351 | local Actif = false; |
||
352 | local TimeLeft = 0; |
||
353 | Necrosis_UnitHasTrance(); |
||
354 | if ShadowTranceID ~= -1 then Actif = true; end |
||
355 | if Actif and not ShadowTrance then |
||
356 | ShadowTrance = true; |
||
357 | Necrosis_Msg(NECROSIS_NIGHTFALL_TEXT.Message, "USER"); |
||
358 | if NecrosisConfig.Sound then PlaySoundFile(NECROSIS_SOUND.ShadowTrance); end |
||
359 | local ShadowTranceIndex, cancel = GetPlayerBuff(ShadowTranceID,"HELPFUL|HARMFUL|PASSIVE"); |
||
360 | TimeLeft = floor(GetPlayerBuffTimeLeft(ShadowTranceIndex)); |
||
361 | NecrosisShadowTranceTimer:SetText(TimeLeft); |
||
362 | ShowUIPanel(NecrosisShadowTranceButton); |
||
363 | end |
||
364 | if not Actif and ShadowTrance then |
||
365 | HideUIPanel(NecrosisShadowTranceButton); |
||
366 | ShadowTrance = false; |
||
367 | end |
||
368 | if Actif and ShadowTrance then |
||
369 | local ShadowTranceIndex, cancel = GetPlayerBuff(ShadowTranceID,"HELPFUL|HARMFUL|PASSIVE"); |
||
370 | TimeLeft = floor(GetPlayerBuffTimeLeft(ShadowTranceIndex)); |
||
371 | NecrosisShadowTranceTimer:SetText(TimeLeft); |
||
372 | end |
||
373 | end |
||
374 | |||
375 | -- Gestion des Antifears |
||
376 | if NecrosisConfig.AntiFearAlert then |
||
377 | local Actif = false; -- must be False, or a number from 1 to AFImageType[] max element. |
||
378 | |||
379 | -- Checking if we have a target. Any fear need a target to be casted on |
||
380 | if UnitExists("target") and UnitCanAttack("player", "target") and not UnitIsDead("target") then |
||
381 | -- Checking if the target has natural immunity (only NPC target) |
||
382 | if not UnitIsPlayer("target") then |
||
383 | for index=1, table.getn(NECROSIS_ANTI_FEAR_UNIT), 1 do |
||
384 | if (UnitCreatureType("target") == NECROSIS_ANTI_FEAR_UNIT[index] ) then |
||
385 | Actif = 2; -- Immun |
||
386 | break; |
||
387 | end |
||
388 | end |
||
389 | end |
||
390 | |||
391 | -- We'll start to parse the target buffs, as his class doesn't give him natural permanent immunity |
||
392 | if not Actif then |
||
393 | for index=1, table.getn(NECROSIS_ANTI_FEAR_SPELL.Buff), 1 do |
||
394 | if Necrosis_UnitHasBuff("target",NECROSIS_ANTI_FEAR_SPELL.Buff[index]) then |
||
395 | Actif = 3; -- Prot |
||
396 | break; |
||
397 | end |
||
398 | end |
||
399 | |||
400 | -- No buff found, let's try the debuffs |
||
401 | for index=1, table.getn(NECROSIS_ANTI_FEAR_SPELL.Debuff), 1 do |
||
402 | if Necrosis_UnitHasEffect("target",NECROSIS_ANTI_FEAR_SPELL.Debuff[index]) then |
||
403 | Actif = 3; -- Prot |
||
404 | break; |
||
405 | end |
||
406 | end |
||
407 | end |
||
408 | |||
409 | -- an immunity has been detected before, but we still don't know why => show the button anyway |
||
410 | if AFCurrentTargetImmune and not Actif then |
||
411 | Actif = 1; |
||
412 | end |
||
413 | end |
||
414 | |||
415 | if Actif then |
||
416 | -- Antifear button is currently not visible, we have to change that |
||
417 | if not AntiFearInUse then |
||
418 | AntiFearInUse = true; |
||
419 | Necrosis_Msg(NECROSIS_MESSAGE.Information.FearProtect, "USER"); |
||
420 | NecrosisAntiFearButton:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\AntiFear"..AFImageType[Actif].."-02"); |
||
421 | if NecrosisConfig.Sound then PlaySoundFile(NECROSIS_SOUND.Fear); end |
||
422 | ShowUIPanel(NecrosisAntiFearButton); |
||
423 | AFBlink1 = GetTime() + 0.6; |
||
424 | AFBlink2 = 2; |
||
425 | |||
426 | -- Timer to make the button blink |
||
427 | elseif GetTime() >= AFBlink1 then |
||
428 | if AFBlink2 == 1 then |
||
429 | AFBlink2 = 2; |
||
430 | else |
||
431 | AFBlink2 = 1; |
||
432 | end |
||
433 | AFBlink1 = GetTime() + 0.4; |
||
434 | NecrosisAntiFearButton:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\AntiFear"..AFImageType[Actif].."-0"..AFBlink2); |
||
435 | end |
||
436 | |||
437 | elseif AntiFearInUse then -- No antifear on target, but the button is still visible => gonna hide it |
||
438 | AntiFearInUse = false; |
||
439 | HideUIPanel(NecrosisAntiFearButton); |
||
440 | end |
||
441 | end |
||
442 | |||
443 | -- Gestion du Timer des sorts |
||
444 | if (not NecrosisSpellTimerButton:IsVisible()) then |
||
445 | ShowUIPanel(NecrosisSpellTimerButton); |
||
446 | end |
||
447 | local display = ""; |
||
448 | |||
449 | if NecrosisConfig.CountType == 3 then |
||
450 | NecrosisShardCount:SetText(""); |
||
451 | end |
||
452 | local update = false; |
||
453 | if ((curTime - SpellCastTime) >= 1) then |
||
454 | SpellCastTime = curTime; |
||
455 | update = true; |
||
456 | end |
||
457 | |||
458 | -- On met à jour les boutons toutes les secondes |
||
459 | -- On accepte le trade de la pierre de soin si transfert en cours |
||
460 | if update then |
||
461 | if Trading then |
||
462 | TradingNow = TradingNow - 1; |
||
463 | if TradingNow == 0 then |
||
464 | AcceptTrade(); |
||
465 | Trading = false; |
||
466 | end |
||
467 | end |
||
468 | Necrosis_UpdateIcons(); |
||
469 | end |
||
470 | |||
471 | -- Parcours du tableau des Timers |
||
472 | local GraphicalTimer = {texte = {}, TimeMax = {}, Time = {}, titre = {}, temps = {}, Gtimer = {}}; |
||
473 | if SpellTimer then |
||
474 | for index = 1, table.getn(SpellTimer), 1 do |
||
475 | if SpellTimer[index] then |
||
476 | if (GetTime() <= SpellTimer[index].TimeMax) then |
||
477 | -- Création de l'affichage des timers |
||
478 | display, SpellGroup, GraphicalTimer, TimerTable = Necrosis_DisplayTimer(display, index, SpellGroup, SpellTimer, GraphicalTimer, TimerTable); |
||
479 | end |
||
480 | -- Action toutes les secondes |
||
481 | if (update) then |
||
482 | -- On enlève les timers terminés |
||
483 | local TimeLocal = GetTime(); |
||
484 | if TimeLocal >= (SpellTimer[index].TimeMax - 0.5) and SpellTimer[index].TimeMax ~= -1 then |
||
485 | -- Si le timer était celui de la Pierre d'âme, on prévient le Démoniste |
||
486 | if SpellTimer[index].Name == NECROSIS_SPELL_TABLE[11].Name then |
||
487 | Necrosis_Msg(NECROSIS_MESSAGE.Information.SoulstoneEnd, "USER"); |
||
488 | SpellTimer[index].Target = ""; |
||
489 | SpellTimer[index].TimeMax = -1; |
||
490 | if NecrosisConfig.Sound then PlaySoundFile(NECROSIS_SOUND.SoulstoneEnd); end |
||
491 | Necrosis_RemoveFrame(SpellTimer[index].Gtimer, TimerTable); |
||
492 | -- On met à jour l'apparence du bouton de la pierre d'âme |
||
493 | Necrosis_UpdateIcons(); |
||
494 | -- Sinon on enlève le timer silencieusement (mais pas en cas d'enslave) |
||
495 | elseif SpellTimer[index].Name ~= NECROSIS_SPELL_TABLE[10].Name then |
||
496 | SpellTimer, TimerTable = Necrosis_RetraitTimerParIndex(index, SpellTimer, TimerTable); |
||
497 | index = 0; |
||
498 | break; |
||
499 | end |
||
500 | end |
||
501 | -- Si le Démoniste n'est plus sous l'emprise du Sacrifice |
||
502 | if SpellTimer and SpellTimer[index].Name == NECROSIS_SPELL_TABLE[17].Name then -- Sacrifice |
||
503 | if not Necrosis_UnitHasEffect("player", SpellTimer[index].Name) and SpellTimer[index].TimeMax ~= nil then |
||
504 | SpellTimer, TimerTable = Necrosis_RetraitTimerParIndex(index, SpellTimer, TimerTable); |
||
505 | index = 0; |
||
506 | break; |
||
507 | end |
||
508 | end |
||
509 | -- Si la cible visée n'est plus atteinte par un sort lancé [résists] |
||
510 | if SpellTimer and (SpellTimer[index].Type == 4 or SpellTimer[index].Type == 5) |
||
511 | and SpellTimer[index].Target == UnitName("target") |
||
512 | then |
||
513 | -- On triche pour laisser le temps au mob de bien sentir qu'il est débuffé ^^ |
||
514 | if TimeLocal >= ((SpellTimer[index].TimeMax - SpellTimer[index].Time) + 1.5) |
||
515 | and SpellTimer[index] ~= 6 then |
||
516 | if not Necrosis_UnitHasEffect("target", SpellTimer[index].Name) then |
||
517 | SpellTimer, TimerTable = Necrosis_RetraitTimerParIndex(index, SpellTimer, TimerTable); |
||
518 | index = 0; |
||
519 | break; |
||
520 | end |
||
521 | end |
||
522 | end |
||
523 | end |
||
524 | end |
||
525 | end |
||
526 | else |
||
527 | for i = 1, 10, 1 do |
||
528 | local frameName = "NecrosisTarget"..i.."Text"; |
||
529 | local frameItem = getglobal(frameName); |
||
530 | if frameItem:IsShown() then |
||
531 | frameItem:Hide(); |
||
532 | end |
||
533 | end |
||
534 | end |
||
535 | |||
536 | if NecrosisConfig.ShowSpellTimers or NecrosisConfig.Graphical then |
||
537 | -- Si affichage de timer texte |
||
538 | if not NecrosisConfig.Graphical then |
||
539 | -- Coloration de l'affichage des timers |
||
540 | display = Necrosis_MsgAddColor(display); |
||
541 | -- Affichage des timers |
||
542 | NecrosisListSpells:SetText(display); |
||
543 | else |
||
544 | NecrosisListSpells:SetText(""); |
||
545 | end |
||
546 | for i = 4, table.getn(SpellGroup.Name) do |
||
547 | SpellGroup.Visible[i] = false; |
||
548 | end |
||
549 | else |
||
550 | if (NecrosisSpellTimerButton:IsVisible()) then |
||
551 | NecrosisListSpells:SetText(""); |
||
552 | HideUIPanel(NecrosisSpellTimerButton); |
||
553 | end |
||
554 | end |
||
555 | end |
||
556 | |||
557 | -- Fonction lancée selon l'événement intercepté |
||
558 | function Necrosis_OnEvent(event) |
||
559 | if (event == "PLAYER_ENTERING_WORLD") then |
||
560 | Necrosis_In = true; |
||
561 | elseif (event == "PLAYER_LEAVING_WORLD") then |
||
562 | Necrosis_In = false; |
||
563 | end |
||
564 | |||
565 | -- Traditionnel test : Le joueur est-il bien Démoniste ? |
||
566 | -- Le jeu est-il bine chargé ? |
||
567 | if (not Loaded) or (not Necrosis_In) or UnitClass("player") ~= NECROSIS_UNIT_WARLOCK then |
||
568 | return; |
||
569 | end |
||
570 | |||
571 | -- Si le contenu des sacs a changé, on vérifie que les Fragments d'âme sont toujours dans le bon sac |
||
572 | if (event == "BAG_UPDATE") then |
||
573 | if (NecrosisConfig.SoulshardSort) then |
||
574 | Necrosis_SoulshardSwitch("CHECK"); |
||
575 | else |
||
576 | Necrosis_BagExplore(); |
||
577 | end |
||
578 | -- Gestion de la fin de l'incantation des sorts |
||
579 | elseif (event == "SPELLCAST_STOP") then |
||
580 | Necrosis_SpellManagement(); |
||
581 | -- Quand le démoniste commence à incanter un sort, on intercepte le nom de celui-ci |
||
582 | -- On sauve également le nom de la cible du sort ainsi que son niveau |
||
583 | elseif (event == "SPELLCAST_START") then |
||
584 | SpellCastName = arg1; |
||
585 | SpellTargetName = UnitName("target"); |
||
586 | if not SpellTargetName then |
||
587 | SpellTargetName = ""; |
||
588 | end |
||
589 | SpellTargetLevel = UnitLevel("target"); |
||
590 | if not SpellTargetLevel then |
||
591 | SpellTargetLevel = ""; |
||
592 | end |
||
593 | -- Quand le démoniste stoppe son incantation, on relache le nom de celui-ci |
||
594 | elseif (event == "SPELLCAST_FAILED") or (event == "SPELLCAST_INTERRUPTED") then |
||
595 | SpellCastName = nil; |
||
596 | SpellCastRank = nil; |
||
597 | SpellTargetName = nil; |
||
598 | SpellTargetLevel = nil; |
||
599 | -- Flag si une fenetre de Trade est ouverte, afin de pouvoir trader automatiquement les pierres de soin |
||
600 | elseif event == "TRADE_REQUEST" or event == "TRADE_SHOW" then |
||
601 | NecrosisTradeRequest = true; |
||
602 | elseif event == "TRADE_REQUEST_CANCEL" or event == "TRADE_CLOSED" then |
||
603 | NecrosisTradeRequest = false; |
||
604 | -- AntiFear button hide on target change |
||
605 | elseif event == "PLAYER_TARGET_CHANGED" then |
||
606 | if NecrosisConfig.AntiFearAlert and AFCurrentTargetImmune then |
||
607 | AFCurrentTargetImmune = false; |
||
608 | end |
||
609 | -- AntiFear immunity on cast detection |
||
610 | elseif event == "CHAT_MSG_SPELL_SELF_DAMAGE" then |
||
611 | if NecrosisConfig.AntiFearAlert then |
||
612 | for spell, creatureName in string.gfind(arg1, NECROSIS_ANTI_FEAR_SRCH) do |
||
613 | -- We check if the casted spell on the immune target is Fear or Death Coil |
||
614 | if spell == NECROSIS_SPELL_TABLE[13].Name or spell == NECROSIS_SPELL_TABLE[19].Name then |
||
615 | AFCurrentTargetImmune = true; |
||
616 | break; |
||
617 | end |
||
618 | end |
||
619 | end |
||
620 | |||
621 | -- Si le Démoniste apprend un nouveau sort / rang de sort, on récupère la nouvelle liste des sorts |
||
622 | -- Si le Démoniste apprend un nouveau sort de buff ou d'invocation, on recrée les boutons |
||
623 | elseif (event == "LEARNED_SPELL_IN_TAB") then |
||
624 | Necrosis_SpellSetup(); |
||
625 | Necrosis_CreateMenu(); |
||
626 | Necrosis_ButtonSetup(); |
||
627 | |||
628 | -- A la fin du combat, on arrête de signaler le Crépuscule |
||
629 | -- On enlève les timers de sorts ainsi que les noms des mobs |
||
630 | elseif (event == "PLAYER_REGEN_ENABLED") then |
||
631 | PlayerCombat = false; |
||
632 | SpellGroup, SpellTimer, TimerTable = Necrosis_RetraitTimerCombat(SpellGroup, SpellTimer, TimerTable); |
||
633 | for i = 1, 10, 1 do |
||
634 | local frameName = "NecrosisTarget"..i.."Text"; |
||
635 | local frameItem = getglobal(frameName); |
||
636 | if frameItem:IsShown() then |
||
637 | frameItem:Hide(); |
||
638 | end |
||
639 | end |
||
640 | -- Quand le démoniste change de démon |
||
641 | elseif (event == "UNIT_PET" and arg1 == "player") then |
||
642 | Necrosis_ChangeDemon(); |
||
643 | -- Actions personnelles -- "Buffs" |
||
644 | elseif (event == "CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS") then |
||
645 | Necrosis_SelfEffect("BUFF"); |
||
646 | -- Actions personnelles -- "Debuffs" |
||
647 | elseif event == "CHAT_MSG_SPELL_AURA_GONE_SELF" or event == "CHAT_MSG_SPELL_BREAK_AURA" then |
||
648 | Necrosis_SelfEffect("DEBUFF"); |
||
649 | elseif event == "PLAYER_REGEN_DISABLED" then |
||
650 | PlayerCombat = true; |
||
651 | -- Fin de l'écran de chargement |
||
652 | end |
||
653 | return; |
||
654 | end |
||
655 | |||
656 | ------------------------------------------------------------------------------------------------------ |
||
657 | -- FONCTIONS NECROSIS "ON EVENT" |
||
658 | ------------------------------------------------------------------------------------------------------ |
||
659 | |||
660 | -- Events : PLAYER_ENTERING_WORLD et PLAYER_LEAVING_WORLD |
||
661 | -- Fonction appliquée à chaque écran de chargement |
||
662 | -- Quand on sort d'une zone, on arrête de surveiller les envents |
||
663 | -- Quand on rentre dans une zone, on reprend la surveillance |
||
664 | -- Cela permet d'éviter un temps de chargement trop long du mod |
||
665 | function Necrosis_RegisterManagement(RegistrationType) |
||
666 | if RegistrationType == "IN" then |
||
667 | NecrosisButton:RegisterEvent("BAG_UPDATE"); |
||
668 | NecrosisButton:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS"); |
||
669 | NecrosisButton:RegisterEvent("CHAT_MSG_SPELL_AURA_GONE_SELF"); |
||
670 | NecrosisButton:RegisterEvent("CHAT_MSG_SPELL_BREAK_AURA"); |
||
671 | NecrosisButton:RegisterEvent("PLAYER_REGEN_DISABLED"); |
||
672 | NecrosisButton:RegisterEvent("PLAYER_REGEN_ENABLED"); |
||
673 | NecrosisButton:RegisterEvent("UNIT_PET"); |
||
674 | NecrosisButton:RegisterEvent("SPELLCAST_START"); |
||
675 | NecrosisButton:RegisterEvent("SPELLCAST_FAILED"); |
||
676 | NecrosisButton:RegisterEvent("SPELLCAST_INTERRUPTED"); |
||
677 | NecrosisButton:RegisterEvent("SPELLCAST_STOP"); |
||
678 | NecrosisButton:RegisterEvent("LEARNED_SPELL_IN_TAB"); |
||
679 | NecrosisButton:RegisterEvent("CHAT_MSG_SPELL_SELF_DAMAGE"); |
||
680 | NecrosisButton:RegisterEvent("PLAYER_TARGET_CHANGED"); |
||
681 | NecrosisButton:RegisterEvent("TRADE_REQUEST"); |
||
682 | NecrosisButton:RegisterEvent("TRADE_REQUEST_CANCEL"); |
||
683 | NecrosisButton:RegisterEvent("TRADE_SHOW"); |
||
684 | NecrosisButton:RegisterEvent("TRADE_CLOSED"); |
||
685 | else |
||
686 | NecrosisButton:UnregisterEvent("BAG_UPDATE"); |
||
687 | NecrosisButton:UnregisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS"); |
||
688 | NecrosisButton:UnregisterEvent("CHAT_MSG_SPELL_AURA_GONE_SELF"); |
||
689 | NecrosisButton:UnregisterEvent("CHAT_MSG_SPELL_BREAK_AURA"); |
||
690 | NecrosisButton:UnregisterEvent("PLAYER_REGEN_DISABLED"); |
||
691 | NecrosisButton:UnregisterEvent("PLAYER_REGEN_ENABLED"); |
||
692 | NecrosisButton:UnregisterEvent("UNIT_PET"); |
||
693 | NecrosisButton:UnregisterEvent("SPELLCAST_START"); |
||
694 | NecrosisButton:UnregisterEvent("SPELLCAST_FAILED"); |
||
695 | NecrosisButton:UnregisterEvent("SPELLCAST_INTERRUPTED"); |
||
696 | NecrosisButton:UnregisterEvent("SPELLCAST_STOP"); |
||
697 | NecrosisButton:UnregisterEvent("LEARNED_SPELL_IN_TAB"); |
||
698 | NecrosisButton:UnregisterEvent("CHAT_MSG_SPELL_SELF_DAMAGE"); |
||
699 | NecrosisButton:UnregisterEvent("PLAYER_TARGET_CHANGED"); |
||
700 | NecrosisButton:UnregisterEvent("TRADE_REQUEST"); |
||
701 | NecrosisButton:UnregisterEvent("TRADE_REQUEST_CANCEL"); |
||
702 | NecrosisButton:UnregisterEvent("TRADE_SHOW"); |
||
703 | NecrosisButton:UnregisterEvent("TRADE_CLOSED"); |
||
704 | end |
||
705 | return; |
||
706 | end |
||
707 | |||
708 | -- event : UNIT_PET |
||
709 | -- Permet de timer les asservissements, ainsi que de prévenir pour les ruptures d'asservissement |
||
710 | -- Change également le nom du pet au remplacement de celui-ci |
||
711 | function Necrosis_ChangeDemon() |
||
712 | -- Si le nouveau démon est un démon asservi, on place un timer de 5 minutes |
||
713 | if (Necrosis_UnitHasEffect("pet", NECROSIS_SPELL_TABLE[10].Name)) then |
||
714 | if (not DemonEnslaved) then |
||
715 | DemonEnslaved = true; |
||
716 | SpellGroup, SpellTimer, TimerTable = Necrosis_InsertTimerParTable(10, "","", SpellGroup, SpellTimer, TimerTable); |
||
717 | end |
||
718 | else |
||
719 | -- Quand le démon asservi est perdu, on retire le Timer et on prévient le Démoniste |
||
720 | if (DemonEnslaved) then |
||
721 | DemonEnslaved = false; |
||
722 | SpellTimer, TimerTable = Necrosis_RetraitTimerParNom(NECROSIS_SPELL_TABLE[10].Name, SpellTimer, TimerTable); |
||
723 | if NecrosisConfig.Sound then PlaySoundFile(NECROSIS_SOUND.EnslaveEnd); end |
||
724 | Necrosis_Msg(NECROSIS_MESSAGE.Information.EnslaveBreak, "USER"); |
||
725 | end |
||
726 | end |
||
727 | |||
728 | -- Si le démon n'est pas asservi on définit son titre, et on met à jour son nom dans Necrosis |
||
729 | DemonType = UnitCreatureFamily("pet"); |
||
730 | for i = 1, 4, 1 do |
||
731 | if DemonType == NECROSIS_PET_LOCAL_NAME[i] and NecrosisConfig.PetName[i] == " " and UnitName("pet") ~= UNKNOWNOBJECT then |
||
732 | NecrosisConfig.PetName[i] = UnitName("pet"); |
||
733 | NecrosisLocalization(); |
||
734 | break; |
||
735 | end |
||
736 | end |
||
737 | |||
738 | return; |
||
739 | end |
||
740 | |||
741 | -- events : CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS, CHAT_MSG_SPELL_AURA_GONE_SELF et CHAT_MSG_SPELL_BREAK_AURA |
||
742 | -- Permet de gérer les effets apparaissants et disparaissants sur le démoniste |
||
743 | -- Basé sur le CombatLog |
||
744 | function Necrosis_SelfEffect(action) |
||
745 | if action == "BUFF" then |
||
746 | -- Insertion d'un timer quand le Démoniste subit "Sacrifice" |
||
747 | if arg1 == NECROSIS_TRANSLATION.SacrificeGain then |
||
748 | SpellGroup, SpellTimer, TimerTable = Necrosis_InsertTimerParTable(17, "", "", SpellGroup, SpellTimer, TimerTable); |
||
749 | end |
||
750 | -- Changement du bouton de monture quand le Démoniste chevauche |
||
751 | if string.find(arg1, NECROSIS_SPELL_TABLE[1].Name) or string.find(arg1, NECROSIS_SPELL_TABLE[2].Name) then |
||
752 | NecrosisMounted = true; |
||
753 | if NecrosisConfig.SteedSummon and NecrosisTellMounted |
||
754 | and NecrosisConfig.ChatMsg and NECROSIS_PET_MESSAGE[6] and not NecrosisConfig.SM |
||
755 | then |
||
756 | local tempnum = random(1, table.getn(NECROSIS_PET_MESSAGE[6])); |
||
757 | while tempnum == SteedMess and table.getn(NECROSIS_PET_MESSAGE[6]) >= 2 do |
||
758 | tempnum = random(1, table.getn(NECROSIS_PET_MESSAGE[6])); |
||
759 | end |
||
760 | SteedMess = tempnum; |
||
761 | for i = 1, table.getn(NECROSIS_PET_MESSAGE[6][tempnum]) do |
||
762 | Necrosis_Msg(Necrosis_MsgReplace(NECROSIS_PET_MESSAGE[6][tempnum][i]), "SAY"); |
||
763 | end |
||
764 | NecrosisTellMounted = false; |
||
765 | end |
||
766 | NecrosisMountButton:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\MountButton-02"); |
||
767 | |||
768 | end |
||
769 | -- Changement du bouton de la domination corrompue si celle-ci est activée + Timer de cooldown |
||
770 | if string.find(arg1, NECROSIS_SPELL_TABLE[15].Name) and NECROSIS_SPELL_TABLE[15].ID ~= nil then |
||
771 | DominationUp = true; |
||
772 | NecrosisPetMenu1:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Domination-02"); |
||
773 | end |
||
774 | -- Changement du bouton de la malédiction amplifiée si celle-ci est activée + Timer de cooldown |
||
775 | if string.find(arg1, NECROSIS_SPELL_TABLE[42].Name) and NECROSIS_SPELL_TABLE[42].ID ~= nil then |
||
776 | AmplifyUp = true; |
||
777 | NecrosisCurseMenu1:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Amplify-02"); |
||
778 | end |
||
779 | else |
||
780 | -- Changement du bouton de monture quand le Démoniste est démonté |
||
781 | if string.find(arg1, NECROSIS_SPELL_TABLE[1].Name) or string.find(arg1, NECROSIS_SPELL_TABLE[2].Name) then |
||
782 | NecrosisMounted = false; |
||
783 | NecrosisTellMounted = true; |
||
784 | NecrosisMountButton:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\MountButton-01"); |
||
785 | end |
||
786 | -- Changement du bouton de Domination quand le Démoniste n'est plus sous son emprise |
||
787 | if string.find(arg1, NECROSIS_SPELL_TABLE[15].Name) and NECROSIS_SPELL_TABLE[15].ID ~= nil then |
||
788 | DominationUp = false; |
||
789 | NecrosisPetMenu1:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Domination-01"); |
||
790 | end |
||
791 | -- Changement du bouton de la malédiction amplifiée quand le Démoniste n'est plus sous son emprise |
||
792 | if string.find(arg1, NECROSIS_SPELL_TABLE[42].Name) and NECROSIS_SPELL_TABLE[42].ID ~= nil then |
||
793 | AmplifyUp = false; |
||
794 | NecrosisCurseMenu1:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Amplify-01"); |
||
795 | end |
||
796 | end |
||
797 | return; |
||
798 | end |
||
799 | |||
800 | -- event : SPELLCAST_STOP |
||
801 | -- Permet de gérer tout ce qui touche aux sorts une fois leur incantation réussie |
||
802 | function Necrosis_SpellManagement() |
||
803 | local SortActif = false; |
||
804 | if (SpellCastName) then |
||
805 | -- Si le sort lancé à été une Résurrection de Pierre d'âme, on place un timer |
||
806 | if (SpellCastName == NECROSIS_SPELL_TABLE[11].Name) then |
||
807 | if SpellTargetName == UnitName("player") then |
||
808 | SpellTargetName = ""; |
||
809 | end |
||
810 | -- Si les messages sont actifs et que la pierre est posée sur un joueur ciblé, hop, message ! |
||
811 | if (NecrosisConfig.ChatMsg or NecrosisConfig.SM) |
||
812 | and SoulstoneUsedOnTarget then |
||
813 | SoulstoneTarget = SpellTargetName; |
||
814 | SoulstoneAdvice = true; |
||
815 | end |
||
816 | SpellGroup, SpellTimer, TimerTable = Necrosis_InsertTimerParTable(11, SpellTargetName, "", SpellGroup, SpellTimer, TimerTable); |
||
817 | -- Si le sort était un rituel d'invocation, alors on écrit une phrase a caractère informatif aux joueurs |
||
818 | elseif (SpellCastName == NECROSIS_TRANSLATION.SummoningRitual) |
||
819 | and (NecrosisConfig.ChatMsg or NecrosisConfig.SM) |
||
820 | and NECROSIS_INVOCATION_MESSAGES then |
||
821 | local tempnum = random(1, table.getn(NECROSIS_INVOCATION_MESSAGES)); |
||
822 | while tempnum == TPMess and table.getn(NECROSIS_INVOCATION_MESSAGES) >= 2 do |
||
823 | tempnum = random(1, table.getn(NECROSIS_INVOCATION_MESSAGES)); |
||
824 | end |
||
825 | TPMess = tempnum; |
||
826 | for i = 1, table.getn(NECROSIS_INVOCATION_MESSAGES[tempnum]) do |
||
827 | Necrosis_Msg(Necrosis_MsgReplace(NECROSIS_INVOCATION_MESSAGES[tempnum][i], SpellTargetName), "WORLD"); |
||
828 | end |
||
829 | -- Pour les autres sorts castés, tentative de timer si valable |
||
830 | else |
||
831 | for spell=1, table.getn(NECROSIS_SPELL_TABLE), 1 do |
||
832 | if SpellCastName == NECROSIS_SPELL_TABLE[spell].Name and not (spell == 10) then |
||
833 | -- Si le timer existe déjà sur la cible, on le met à jour |
||
834 | for thisspell=1, table.getn(SpellTimer), 1 do |
||
835 | if SpellTimer[thisspell].Name == SpellCastName |
||
836 | and SpellTimer[thisspell].Target == SpellTargetName |
||
837 | and SpellTimer[thisspell].TargetLevel == SpellTargetLevel |
||
838 | and NECROSIS_SPELL_TABLE[spell].Type ~= 4 |
||
839 | and spell ~= 16 |
||
840 | then |
||
841 | -- Si c'est sort lancé déjà présent sur un mob, on remet le timer à fond |
||
842 | if spell ~= 9 or (spell == 9 and not Necrosis_UnitHasEffect("target", SpellCastName)) then |
||
843 | SpellTimer[thisspell].Time = NECROSIS_SPELL_TABLE[spell].Length; |
||
844 | SpellTimer[thisspell].TimeMax = floor(GetTime() + NECROSIS_SPELL_TABLE[spell].Length); |
||
845 | if spell == 9 and SpellCastRank == 1 then |
||
846 | SpellTimer[thisspell].Time = 20; |
||
847 | SpellTimer[thisspell].TimeMax = floor(GetTime() + 20); |
||
848 | end |
||
849 | end |
||
850 | SortActif = true; |
||
851 | break; |
||
852 | end |
||
853 | -- Si c'est un banish sur une nouvelle cible, on supprime le timer précédent |
||
854 | if SpellTimer[thisspell].Name == SpellCastName and spell == 9 |
||
855 | and |
||
856 | (SpellTimer[thisspell].Target ~= SpellTargetName |
||
857 | or SpellTimer[thisspell].TargetLevel ~= SpellTargetLevel) |
||
858 | then |
||
859 | SpellTimer, TimerTable = Necrosis_RetraitTimerParIndex(thisspell, SpellTimer, TimerTable); |
||
860 | SortActif = false; |
||
861 | break; |
||
862 | end |
||
863 | |||
864 | -- Si c'est un fear, on supprime le timer du fear précédent |
||
865 | if SpellTimer[thisspell].Name == SpellCastName and spell == 13 then |
||
866 | SpellTimer, TimerTable = Necrosis_RetraitTimerParIndex(thisspell, SpellTimer, TimerTable); |
||
867 | SortActif = false; |
||
868 | break; |
||
869 | end |
||
870 | if SortActif then break; end |
||
871 | end |
||
872 | -- Si le timer est une malédiction, on enlève la précédente malédiction sur la cible |
||
873 | if (NECROSIS_SPELL_TABLE[spell].Type == 4) or (spell == 16) then |
||
874 | for thisspell=1, table.getn(SpellTimer), 1 do |
||
875 | -- Mais on garde le cooldown de la malédiction funeste |
||
876 | if SpellTimer[thisspell].Name == NECROSIS_SPELL_TABLE[16].Name then |
||
877 | SpellTimer[thisspell].Target = ""; |
||
878 | SpellTimer[thisspell].TargetLevel = ""; |
||
879 | end |
||
880 | if SpellTimer[thisspell].Type == 4 |
||
881 | and SpellTimer[thisspell].Target == SpellTargetName |
||
882 | and SpellTimer[thisspell].TargetLevel == SpellTargetLevel |
||
883 | then |
||
884 | SpellTimer, TimerTable = Necrosis_RetraitTimerParIndex(thisspell, SpellTimer, TimerTable); |
||
885 | break; |
||
886 | end |
||
887 | end |
||
888 | SortActif = false; |
||
889 | end |
||
890 | if not SortActif |
||
891 | and NECROSIS_SPELL_TABLE[spell].Type ~= 0 |
||
892 | and spell ~= 10 |
||
893 | then |
||
894 | |||
895 | if spell == 9 then |
||
896 | if SpellCastRank == 1 then |
||
897 | NECROSIS_SPELL_TABLE[spell].Length = 20; |
||
898 | else |
||
899 | NECROSIS_SPELL_TABLE[spell].Length = 30; |
||
900 | end |
||
901 | end |
||
902 | |||
903 | SpellGroup, SpellTimer, TimerTable = Necrosis_InsertTimerParTable(spell, SpellTargetName, SpellTargetLevel, SpellGroup, SpellTimer, TimerTable); |
||
904 | break; |
||
905 | end |
||
906 | end |
||
907 | end |
||
908 | end |
||
909 | end |
||
910 | SpellCastName = nil; |
||
911 | SpellCastRank = nil; |
||
912 | return; |
||
913 | end |
||
914 | |||
915 | ------------------------------------------------------------------------------------------------------ |
||
916 | -- FONCTIONS DE L'INTERFACE -- LIENS XML |
||
917 | ------------------------------------------------------------------------------------------------------ |
||
918 | |||
919 | -- En cliquant droit sur Necrosis, on affiche ou masque les deux panneaux de configurations |
||
920 | function Necrosis_Toggle(button) |
||
921 | if button == "LeftButton" then |
||
922 | if NECROSIS_SPELL_TABLE[41].ID then |
||
923 | CastSpell(NECROSIS_SPELL_TABLE[41].ID, "spell"); |
||
924 | end |
||
925 | return; |
||
926 | elseif (NecrosisGeneralFrame:IsVisible()) then |
||
927 | HideUIPanel(NecrosisGeneralFrame); |
||
928 | return; |
||
929 | else |
||
930 | if NecrosisConfig.SM then |
||
931 | Necrosis_Msg("!!! Short Messages : <brightGreen>On", "USER"); |
||
932 | end |
||
933 | ShowUIPanel(NecrosisGeneralFrame); |
||
934 | NecrosisGeneralTab_OnClick(1); |
||
935 | return; |
||
936 | end |
||
937 | end |
||
938 | |||
939 | -- Fonction permettant le déplacement d'éléments de Necrosis sur l'écran |
||
940 | function Necrosis_OnDragStart(button) |
||
941 | if (button == "NecrosisIcon") then GameTooltip:Hide(); end |
||
942 | button:StartMoving(); |
||
943 | end |
||
944 | |||
945 | -- Fonction arrêtant le déplacement d'éléments de Necrosis sur l'écran |
||
946 | function Necrosis_OnDragStop(button) |
||
947 | if (button == "NecrosisIcon") then Necrosis_BuildTooltip("OVERALL"); end |
||
948 | button:StopMovingOrSizing(); |
||
949 | end |
||
950 | |||
951 | -- Fonction alternant Timers graphiques et Timers textes |
||
952 | function Necrosis_HideGraphTimer() |
||
953 | for i = 1, 50, 1 do |
||
954 | local elements = {"Text", "Bar", "Texture", "OutText"} |
||
955 | if NecrosisConfig.Graphical then |
||
956 | if TimerTable[i] then |
||
957 | for j = 1, 4, 1 do |
||
958 | frameName = "NecrosisTimer"..i..elements[j]; |
||
959 | frameItem = getglobal(frameName); |
||
960 | frameItem:Show(); |
||
961 | end |
||
962 | end |
||
963 | else |
||
964 | for j = 1, 4, 1 do |
||
965 | frameName = "NecrosisTimer"..i..elements[j]; |
||
966 | frameItem = getglobal(frameName); |
||
967 | frameItem:Hide(); |
||
968 | end |
||
969 | end |
||
970 | end |
||
971 | end |
||
972 | |||
973 | -- Fonction gérant les bulles d'aide |
||
974 | function Necrosis_BuildTooltip(button, type, anchor) |
||
975 | |||
976 | -- Si l'affichage des bulles d'aide est désactivé, Bye bye ! |
||
977 | if not NecrosisConfig.NecrosisToolTip then |
||
978 | return; |
||
979 | end |
||
980 | |||
981 | -- On regarde si la domination corrompue, le gardien de l'ombre ou l'amplification de malédiction sont up (pour tooltips) |
||
982 | local start, duration, start2, duration2, start3, duration3 |
||
983 | if NECROSIS_SPELL_TABLE[15].ID then |
||
984 | start, duration = GetSpellCooldown(NECROSIS_SPELL_TABLE[15].ID, BOOKTYPE_SPELL); |
||
985 | else |
||
986 | start = 1; |
||
987 | duration = 1; |
||
988 | end |
||
989 | if NECROSIS_SPELL_TABLE[43].ID then |
||
990 | start2, duration2 = GetSpellCooldown(NECROSIS_SPELL_TABLE[43].ID, BOOKTYPE_SPELL); |
||
991 | else |
||
992 | start2 = 1; |
||
993 | duration2 = 1; |
||
994 | end |
||
995 | if NECROSIS_SPELL_TABLE[42].ID then |
||
996 | start3, duration3 = GetSpellCooldown(NECROSIS_SPELL_TABLE[42].ID, BOOKTYPE_SPELL); |
||
997 | else |
||
998 | start3 = 1; |
||
999 | duration3 = 1; |
||
1000 | end |
||
1001 | |||
1002 | -- Création des bulles d'aides.... |
||
1003 | GameTooltip:SetOwner(button, anchor); |
||
1004 | GameTooltip:SetText(NecrosisTooltipData[type].Label); |
||
1005 | -- ..... pour le bouton principal |
||
1006 | if (type == "Main") then |
||
1007 | GameTooltip:AddLine(NecrosisTooltipData.Main.Soulshard..Soulshards); |
||
1008 | GameTooltip:AddLine(NecrosisTooltipData.Main.InfernalStone..InfernalStone); |
||
1009 | GameTooltip:AddLine(NecrosisTooltipData.Main.DemoniacStone..DemoniacStone); |
||
1010 | GameTooltip:AddLine(NecrosisTooltipData.Main.Soulstone..NecrosisTooltipData[type].Stone[SoulstoneOnHand]); |
||
1011 | GameTooltip:AddLine(NecrosisTooltipData.Main.Healthstone..NecrosisTooltipData[type].Stone[HealthstoneOnHand]); |
||
1012 | -- On vérifie si une pierre de sort n'est pas équipée |
||
1013 | NecrosisTooltip:SetInventoryItem("player", 17); |
||
1014 | local rightHand = tostring(NecrosisTooltipTextLeft1:GetText()); |
||
1015 | if string.find(rightHand, NECROSIS_ITEM.Spellstone) then SpellstoneOnHand = true; end |
||
1016 | GameTooltip:AddLine(NecrosisTooltipData.Main.Spellstone..NecrosisTooltipData[type].Stone[SpellstoneOnHand]); |
||
1017 | -- De même pour la pierre de feu |
||
1018 | if string.find(rightHand, NECROSIS_ITEM.Firestone) then FirestoneOnHand = true; end |
||
1019 | GameTooltip:AddLine(NecrosisTooltipData.Main.Firestone..NecrosisTooltipData[type].Stone[FirestoneOnHand]); |
||
1020 | -- Affichage du nom du démon, ou s'il est asservi, ou "Aucun" si aucun démon n'est présent |
||
1021 | if (DemonType) then |
||
1022 | GameTooltip:AddLine(NecrosisTooltipData.Main.CurrentDemon..DemonType); |
||
1023 | elseif DemonEnslaved then |
||
1024 | GameTooltip:AddLine(NecrosisTooltipData.Main.EnslavedDemon); |
||
1025 | else |
||
1026 | GameTooltip:AddLine(NecrosisTooltipData.Main.NoCurrentDemon); |
||
1027 | end |
||
1028 | -- ..... pour les boutons de pierre |
||
1029 | elseif (string.find(type, "stone")) then |
||
1030 | -- Pierre d'âme |
||
1031 | if (type == "Soulstone") then |
||
1032 | -- On affiche le nom de la pierre et l'action que produira le clic sur le bouton |
||
1033 | -- Et aussi le Temps de recharge |
||
1034 | if SoulstoneMode == 1 or SoulstoneMode == 3 then |
||
1035 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[StoneIDInSpellTable[1]].Mana.." Mana"); |
||
1036 | end |
||
1037 | Necrosis_MoneyToggle(); |
||
1038 | NecrosisTooltip:SetBagItem(SoulstoneLocation[1], SoulstoneLocation[2]); |
||
1039 | local itemName = tostring(NecrosisTooltipTextLeft6:GetText()); |
||
1040 | GameTooltip:AddLine(NecrosisTooltipData[type].Text[SoulstoneMode]); |
||
1041 | if string.find(itemName, NECROSIS_TRANSLATION.Cooldown) then |
||
1042 | GameTooltip:AddLine(itemName); |
||
1043 | end |
||
1044 | -- Pierre de vie |
||
1045 | elseif (type == "Healthstone") then |
||
1046 | -- Idem |
||
1047 | if HealthstoneMode == 1 then |
||
1048 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[StoneIDInSpellTable[2]].Mana.." Mana"); |
||
1049 | end |
||
1050 | Necrosis_MoneyToggle(); |
||
1051 | NecrosisTooltip:SetBagItem(HealthstoneLocation[1], HealthstoneLocation[2]); |
||
1052 | local itemName = tostring(NecrosisTooltipTextLeft6:GetText()); |
||
1053 | GameTooltip:AddLine(NecrosisTooltipData[type].Text[HealthstoneMode]); |
||
1054 | if string.find(itemName, NECROSIS_TRANSLATION.Cooldown) then |
||
1055 | GameTooltip:AddLine(itemName); |
||
1056 | end |
||
1057 | -- Pierre de sort |
||
1058 | elseif (type == "Spellstone") then |
||
1059 | -- Eadem |
||
1060 | if SpellstoneMode == 1 then |
||
1061 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[StoneIDInSpellTable[3]].Mana.." Mana"); |
||
1062 | end |
||
1063 | Necrosis_MoneyToggle(); |
||
1064 | NecrosisTooltip:SetInventoryItem("player", 17); |
||
1065 | local itemName = tostring(NecrosisTooltipTextLeft9:GetText()); |
||
1066 | local itemStone = tostring(NecrosisTooltipTextLeft1:GetText()); |
||
1067 | GameTooltip:AddLine(NecrosisTooltipData[type].Text[SpellstoneMode]); |
||
1068 | if (string.find(itemStone, NECROSIS_ITEM.Spellstone) |
||
1069 | and string.find(itemName, NECROSIS_TRANSLATION.Cooldown)) then |
||
1070 | GameTooltip:AddLine(itemName); |
||
1071 | end |
||
1072 | -- Pierre de feu |
||
1073 | elseif (type == "Firestone") then |
||
1074 | -- Idem, mais sans le cooldown |
||
1075 | if FirestoneMode == 1 then |
||
1076 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[StoneIDInSpellTable[4]].Mana.." Mana"); |
||
1077 | end |
||
1078 | GameTooltip:AddLine(NecrosisTooltipData[type].Text[FirestoneMode]); |
||
1079 | end |
||
1080 | -- ..... pour le bouton des Timers |
||
1081 | elseif (type == "SpellTimer") then |
||
1082 | Necrosis_MoneyToggle(); |
||
1083 | NecrosisTooltip:SetBagItem(HearthstoneLocation[1], HearthstoneLocation[2]); |
||
1084 | local itemName = tostring(NecrosisTooltipTextLeft5:GetText()); |
||
1085 | GameTooltip:AddLine(NecrosisTooltipData[type].Text); |
||
1086 | if string.find(itemName, NECROSIS_TRANSLATION.Cooldown) then |
||
1087 | GameTooltip:AddLine(NECROSIS_TRANSLATION.Hearth.." - "..itemName); |
||
1088 | else |
||
1089 | GameTooltip:AddLine(NecrosisTooltipData[type].Right..GetBindLocation()); |
||
1090 | end |
||
1091 | |||
1092 | -- ..... pour le bouton de la Transe de l'ombre |
||
1093 | elseif (type == "ShadowTrance") then |
||
1094 | local rank = Necrosis_FindSpellAttribute("Name", NECROSIS_NIGHTFALL.BoltName, "Rank"); |
||
1095 | GameTooltip:SetText(NecrosisTooltipData[type].Label.." |CFF808080Rank "..rank.."|r"); |
||
1096 | -- ..... pour les autres buffs et démons, le coût en mana... |
||
1097 | elseif (type == "Enslave") then |
||
1098 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[35].Mana.." Mana"); |
||
1099 | if Soulshards == 0 then |
||
1100 | GameTooltip:AddLine("|c00FF4444"..NecrosisTooltipData.Main.Soulshard..Soulshards.."|r"); |
||
1101 | end |
||
1102 | elseif (type == "Mount") then |
||
1103 | if NECROSIS_SPELL_TABLE[2].ID then |
||
1104 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[2].Mana.." Mana"); |
||
1105 | elseif NECROSIS_SPELL_TABLE[1].ID then |
||
1106 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[1].Mana.." Mana"); |
||
1107 | end |
||
1108 | elseif (type == "Armor") then |
||
1109 | if NECROSIS_SPELL_TABLE[31].ID then |
||
1110 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[31].Mana.." Mana"); |
||
1111 | else |
||
1112 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[36].Mana.." Mana"); |
||
1113 | end |
||
1114 | elseif (type == "Invisible") then |
||
1115 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[33].Mana.." Mana"); |
||
1116 | elseif (type == "Aqua") then |
||
1117 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[32].Mana.." Mana"); |
||
1118 | elseif (type == "Kilrogg") then |
||
1119 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[34].Mana.." Mana"); |
||
1120 | elseif (type == "Banish") then |
||
1121 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[9].Mana.." Mana"); |
||
1122 | elseif (type == "Weakness") then |
||
1123 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[23].Mana.." Mana"); |
||
1124 | if not (start3 > 0 and duration3 > 0) then |
||
1125 | GameTooltip:AddLine(NecrosisTooltipData.AmplifyCooldown); |
||
1126 | end |
||
1127 | elseif (type == "Agony") then |
||
1128 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[22].Mana.." Mana"); |
||
1129 | if not (start3 > 0 and duration3 > 0) then |
||
1130 | GameTooltip:AddLine(NecrosisTooltipData.AmplifyCooldown); |
||
1131 | end |
||
1132 | elseif (type == "Reckless") then |
||
1133 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[24].Mana.." Mana"); |
||
1134 | elseif (type == "Tongues") then |
||
1135 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[25].Mana.." Mana"); |
||
1136 | elseif (type == "Exhaust") then |
||
1137 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[40].Mana.." Mana"); |
||
1138 | if not (start3 > 0 and duration3 > 0) then |
||
1139 | GameTooltip:AddLine(NecrosisTooltipData.AmplifyCooldown); |
||
1140 | end |
||
1141 | elseif (type == "Elements") then |
||
1142 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[26].Mana.." Mana"); |
||
1143 | elseif (type == "Shadow") then |
||
1144 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[27].Mana.." Mana"); |
||
1145 | elseif (type == "Doom") then |
||
1146 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[16].Mana.." Mana"); |
||
1147 | elseif (type == "Amplify") then |
||
1148 | if start3 > 0 and duration3 > 0 then |
||
1149 | local seconde = duration3 - ( GetTime() - start3) |
||
1150 | local affiche, minute, time |
||
1151 | if seconde <= 59 then |
||
1152 | affiche = tostring(floor(seconde)).." sec"; |
||
1153 | else |
||
1154 | minute = tostring(floor(seconde/60)) |
||
1155 | seconde = mod(seconde, 60); |
||
1156 | if seconde <= 9 then |
||
1157 | time = "0"..tostring(floor(seconde)); |
||
1158 | else |
||
1159 | time = tostring(floor(seconde)); |
||
1160 | end |
||
1161 | affiche = minute..":"..time; |
||
1162 | end |
||
1163 | GameTooltip:AddLine("Cooldown : "..affiche); |
||
1164 | end |
||
1165 | elseif (type == "TP") then |
||
1166 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[37].Mana.." Mana"); |
||
1167 | if Soulshards == 0 then |
||
1168 | GameTooltip:AddLine("|c00FF4444"..NecrosisTooltipData.Main.Soulshard..Soulshards.."|r"); |
||
1169 | end |
||
1170 | elseif (type == "SoulLink") then |
||
1171 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[38].Mana.." Mana"); |
||
1172 | elseif (type == "ShadowProtection") then |
||
1173 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[43].Mana.." Mana"); |
||
1174 | if start2 > 0 and duration2 > 0 then |
||
1175 | local seconde = duration2 - ( GetTime() - start2) |
||
1176 | local affiche |
||
1177 | affiche = tostring(floor(seconde)).." sec"; |
||
1178 | GameTooltip:AddLine("Cooldown : "..affiche); |
||
1179 | end |
||
1180 | elseif (type == "Domination") then |
||
1181 | if start > 0 and duration > 0 then |
||
1182 | local seconde = duration - ( GetTime() - start) |
||
1183 | local affiche, minute, time |
||
1184 | if seconde <= 59 then |
||
1185 | affiche = tostring(floor(seconde)).." sec"; |
||
1186 | else |
||
1187 | minute = tostring(floor(seconde/60)) |
||
1188 | seconde = mod(seconde, 60); |
||
1189 | if seconde <= 9 then |
||
1190 | time = "0"..tostring(floor(seconde)); |
||
1191 | else |
||
1192 | time = tostring(floor(seconde)); |
||
1193 | end |
||
1194 | affiche = minute..":"..time; |
||
1195 | end |
||
1196 | GameTooltip:AddLine("Cooldown : "..affiche); |
||
1197 | end |
||
1198 | elseif (type == "Imp") then |
||
1199 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[3].Mana.." Mana"); |
||
1200 | if not (start > 0 and duration > 0) then |
||
1201 | GameTooltip:AddLine(NecrosisTooltipData.DominationCooldown); |
||
1202 | end |
||
1203 | |||
1204 | elseif (type == "Void") then |
||
1205 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[4].Mana.." Mana"); |
||
1206 | if Soulshards == 0 then |
||
1207 | GameTooltip:AddLine("|c00FF4444"..NecrosisTooltipData.Main.Soulshard..Soulshards.."|r"); |
||
1208 | elseif not (start > 0 and duration > 0) then |
||
1209 | GameTooltip:AddLine(NecrosisTooltipData.DominationCooldown); |
||
1210 | end |
||
1211 | elseif (type == "Succubus") then |
||
1212 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[5].Mana.." Mana"); |
||
1213 | if Soulshards == 0 then |
||
1214 | GameTooltip:AddLine("|c00FF4444"..NecrosisTooltipData.Main.Soulshard..Soulshards.."|r"); |
||
1215 | elseif not (start > 0 and duration > 0) then |
||
1216 | GameTooltip:AddLine(NecrosisTooltipData.DominationCooldown); |
||
1217 | end |
||
1218 | elseif (type == "Fel") then |
||
1219 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[6].Mana.." Mana"); |
||
1220 | if Soulshards == 0 then |
||
1221 | GameTooltip:AddLine("|c00FF4444"..NecrosisTooltipData.Main.Soulshard..Soulshards.."|r"); |
||
1222 | elseif not (start > 0 and duration > 0) then |
||
1223 | GameTooltip:AddLine(NecrosisTooltipData.DominationCooldown); |
||
1224 | end |
||
1225 | elseif (type == "Infernal") then |
||
1226 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[8].Mana.." Mana"); |
||
1227 | if InfernalStone == 0 then |
||
1228 | GameTooltip:AddLine("|c00FF4444"..NecrosisTooltipData.Main.InfernalStone..InfernalStone.."|r"); |
||
1229 | else |
||
1230 | GameTooltip:AddLine(NecrosisTooltipData.Main.InfernalStone..InfernalStone); |
||
1231 | end |
||
1232 | elseif (type == "Doomguard") then |
||
1233 | GameTooltip:AddLine(NECROSIS_SPELL_TABLE[30].Mana.." Mana"); |
||
1234 | if DemoniacStone == 0 then |
||
1235 | GameTooltip:AddLine("|c00FF4444"..NecrosisTooltipData.Main.DemoniacStone..DemoniacStone.."|r"); |
||
1236 | else |
||
1237 | GameTooltip:AddLine(NecrosisTooltipData.Main.DemoniacStone..DemoniacStone); |
||
1238 | end |
||
1239 | elseif (type == "Buff") and LastBuff ~= 0 then |
||
1240 | GameTooltip:AddLine(NecrosisTooltipData.LastSpell..NECROSIS_SPELL_TABLE[LastBuff].Name); |
||
1241 | elseif (type == "Curse") and LastCurse ~= 0 then |
||
1242 | GameTooltip:AddLine(NecrosisTooltipData.LastSpell..NECROSIS_SPELL_TABLE[LastCurse].Name); |
||
1243 | elseif (type == "Pet") and LastDemon ~= 0 then |
||
1244 | GameTooltip:AddLine(NecrosisTooltipData.LastSpell..NECROSIS_PET_LOCAL_NAME[(LastDemon - 2)]); |
||
1245 | end |
||
1246 | -- Et hop, affichage ! |
||
1247 | GameTooltip:Show(); |
||
1248 | end |
||
1249 | |||
1250 | -- Fonction mettant à jour les boutons Necrosis et donnant l'état du bouton de la pierre d'âme |
||
1251 | function Necrosis_UpdateIcons() |
||
1252 | -- Pierre d'âme |
||
1253 | ----------------------------------------------- |
||
1254 | |||
1255 | -- On se renseigne pour savoir si une pierre d'âme a été utilisée --> vérification dans les timers |
||
1256 | local SoulstoneInUse = false; |
||
1257 | if SpellTimer then |
||
1258 | for index = 1, table.getn(SpellTimer), 1 do |
||
1259 | if (SpellTimer[index].Name == NECROSIS_SPELL_TABLE[11].Name) and SpellTimer[index].TimeMax > 0 then |
||
1260 | SoulstoneInUse = true; |
||
1261 | break; |
||
1262 | end |
||
1263 | end |
||
1264 | end |
||
1265 | |||
1266 | -- Si la Pierre n'a pas été utilisée, et qu'il n'y a pas de pierre en inventaire -> Mode 1 |
||
1267 | if not (SoulstoneOnHand or SoulstoneInUse) then |
||
1268 | SoulstoneMode = 1; |
||
1269 | SoulstoneWaiting = false; |
||
1270 | SoulstoneCooldown = false; |
||
1271 | end |
||
1272 | |||
1273 | -- Si la Pierre n'a pas été utilisée, mais qu'il y a une pierre en inventaire |
||
1274 | if SoulstoneOnHand and (not SoulstoneInUse) then |
||
1275 | -- Si la pierre en inventaire contient un timer, et qu'on sort d'un RL --> Mode 4 |
||
1276 | local start, duration = GetContainerItemCooldown(SoulstoneLocation[1],SoulstoneLocation[2]); |
||
1277 | if NecrosisRL and start > 0 and duration > 0 then |
||
1278 | SpellGroup, SpellTimer, TimerTable = Necrosis_InsertTimerStone("Soulstone", start, duration, SpellGroup, SpellTimer, TimerTable); |
||
1279 | SoulstoneMode = 4; |
||
1280 | NecrosisRL = false; |
||
1281 | SoulstoneWaiting = false; |
||
1282 | SoulstoneCooldown = true; |
||
1283 | -- Si la pierre ne contient pas de timer, ou qu'on ne sort pas d'un RL --> Mode 2 |
||
1284 | else |
||
1285 | SoulstoneMode = 2; |
||
1286 | NecrosisRL = false; |
||
1287 | SoulstoneWaiting = false; |
||
1288 | SoulstoneCooldown = false; |
||
1289 | end |
||
1290 | end |
||
1291 | |||
1292 | -- Si la Pierre a été utilisée mais qu'il n'y a pas de pierre en inventaire --> Mode 3 |
||
1293 | if (not SoulstoneOnHand) and SoulstoneInUse then |
||
1294 | SoulstoneMode = 3; |
||
1295 | SoulstoneWaiting = true; |
||
1296 | -- Si on vient de poser la pierre, on l'annonce au raid |
||
1297 | if SoulstoneAdvice and NECROSIS_SOULSTONE_ALERT_MESSAGE then |
||
1298 | local tempnum = random(1, table.getn(NECROSIS_SOULSTONE_ALERT_MESSAGE)); |
||
1299 | while tempnum == RezMess and table.getn(NECROSIS_SOULSTONE_ALERT_MESSAGE) >= 2 do |
||
1300 | tempnum = random(1, table.getn(NECROSIS_SOULSTONE_ALERT_MESSAGE)); |
||
1301 | end |
||
1302 | RezMess = tempnum; |
||
1303 | for i = 1, table.getn(NECROSIS_SOULSTONE_ALERT_MESSAGE[tempnum]) do |
||
1304 | Necrosis_Msg(Necrosis_MsgReplace(NECROSIS_SOULSTONE_ALERT_MESSAGE[tempnum][i], SoulstoneTarget), "WORLD"); |
||
1305 | end |
||
1306 | SoulstoneAdvice = false; |
||
1307 | end |
||
1308 | end |
||
1309 | |||
1310 | -- Si la Pierre a été utilisée et qu'il y a une pierre en inventaire |
||
1311 | if SoulstoneOnHand and SoulstoneInUse then |
||
1312 | SoulstoneAdvice = false; |
||
1313 | if not (SoulstoneWaiting or SoulstoneCooldown) then |
||
1314 | SpellTimer, TimerTable = Necrosis_RetraitTimerParNom(NECROSIS_SPELL_TABLE[11].Name, SpellTimer, TimerTable); |
||
1315 | SoulstoneMode = 2; |
||
1316 | else |
||
1317 | SoulstoneWaiting = false; |
||
1318 | SoulstoneCooldown = true; |
||
1319 | SoulstoneMode = 4; |
||
1320 | end |
||
1321 | end |
||
1322 | |||
1323 | -- Affichage de l'icone liée au mode |
||
1324 | NecrosisSoulstoneButton:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\SoulstoneButton-0"..SoulstoneMode); |
||
1325 | |||
1326 | -- Pierre de vie |
||
1327 | ----------------------------------------------- |
||
1328 | |||
1329 | -- Mode "j'en ai une" (2) / "j'en ai pas" (1) |
||
1330 | if (HealthstoneOnHand) then |
||
1331 | HealthstoneMode = 2; |
||
1332 | else |
||
1333 | HealthstoneMode = 1; |
||
1334 | end |
||
1335 | |||
1336 | -- Affichage de l'icone liée au mode |
||
1337 | NecrosisHealthstoneButton:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\HealthstoneButton-0"..HealthstoneMode); |
||
1338 | |||
1339 | -- Pierre de sort |
||
1340 | ----------------------------------------------- |
||
1341 | |||
1342 | -- Si la pierre est équipée, mode 3 |
||
1343 | local rightHand = GetInventoryItemTexture("player", 17); |
||
1344 | if (rightHand == "Interface\\Icons\\INV_Misc_Gem_Sapphire_01" and not SpellstoneOnHand) then |
||
1345 | SpellstoneMode = 3; |
||
1346 | else |
||
1347 | -- Pierre dans l'inventaire, mode 2 |
||
1348 | if (SpellstoneOnHand) then |
||
1349 | SpellstoneMode = 2; |
||
1350 | -- Pierre inexistante, mode 1 |
||
1351 | else |
||
1352 | SpellstoneMode = 1; |
||
1353 | end |
||
1354 | end |
||
1355 | |||
1356 | -- Affichage de l'icone liée au mode |
||
1357 | NecrosisSpellstoneButton:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\SpellstoneButton-0"..SpellstoneMode); |
||
1358 | |||
1359 | -- Pierre de feu |
||
1360 | ----------------------------------------------- |
||
1361 | |||
1362 | -- Pierre équipée = mode 3 |
||
1363 | if (rightHand == "Interface\\Icons\\INV_Misc_Gem_Bloodstone_02" and not FirestoneOnHand) then |
||
1364 | FirestoneMode = 3; |
||
1365 | -- Pierre dans l'inventaire = mode 2 |
||
1366 | elseif (FirestoneOnHand) then |
||
1367 | FirestoneMode = 2; |
||
1368 | -- Pierre inexistante = mode 1 |
||
1369 | else |
||
1370 | FirestoneMode = 1; |
||
1371 | end |
||
1372 | |||
1373 | -- Affichage de l'icone liée au mode |
||
1374 | NecrosisFirestoneButton:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\FirestoneButton-0"..FirestoneMode); |
||
1375 | |||
1376 | |||
1377 | -- Bouton des démons |
||
1378 | ----------------------------------------------- |
||
1379 | local mana = UnitMana("player"); |
||
1380 | |||
1381 | local ManaPet = {"1", "1", "1", "1", "1", "1"}; |
||
1382 | |||
1383 | -- Si cooldown de domination corrompue on grise |
||
1384 | if NECROSIS_SPELL_TABLE[15].ID and not DominationUp then |
||
1385 | local start, duration = GetSpellCooldown(NECROSIS_SPELL_TABLE[15].ID, "spell"); |
||
1386 | if start > 0 and duration > 0 then |
||
1387 | NecrosisPetMenu1:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Domination-03"); |
||
1388 | else |
||
1389 | NecrosisPetMenu1:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Domination-01"); |
||
1390 | end |
||
1391 | end |
||
1392 | |||
1393 | -- Si cooldown de gardien de l'ombre on grise |
||
1394 | if NECROSIS_SPELL_TABLE[43].ID then |
||
1395 | local start2, duration2 = GetSpellCooldown(NECROSIS_SPELL_TABLE[43].ID, "spell"); |
||
1396 | if start2 > 0 and duration2 > 0 then |
||
1397 | NecrosisBuffMenu8:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\ShadowWard-03"); |
||
1398 | else |
||
1399 | NecrosisBuffMenu8:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\ShadowWard-01"); |
||
1400 | end |
||
1401 | end |
||
1402 | |||
1403 | -- Si cooldown de la malédiction amplifiée on grise |
||
1404 | if NECROSIS_SPELL_TABLE[42].ID and not AmplifyUp then |
||
1405 | local start3, duration3 = GetSpellCooldown(NECROSIS_SPELL_TABLE[42].ID, "spell"); |
||
1406 | if start3 > 0 and duration3 > 0 then |
||
1407 | NecrosisCurseMenu1:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Amplify-03"); |
||
1408 | else |
||
1409 | NecrosisCurseMenu1:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Amplify-01"); |
||
1410 | end |
||
1411 | end |
||
1412 | |||
1413 | if mana ~= nil then |
||
1414 | -- Coloration du bouton en grisé si pas assez de mana |
||
1415 | if NECROSIS_SPELL_TABLE[3].ID then |
||
1416 | if NECROSIS_SPELL_TABLE[3].Mana > mana then |
||
1417 | for i = 1, 6, 1 do |
||
1418 | ManaPet[i] = "3"; |
||
1419 | end |
||
1420 | elseif NECROSIS_SPELL_TABLE[4].ID then |
||
1421 | if NECROSIS_SPELL_TABLE[4].Mana > mana then |
||
1422 | for i = 2, 6, 1 do |
||
1423 | ManaPet[i] = "3"; |
||
1424 | end |
||
1425 | elseif NECROSIS_SPELL_TABLE[8].ID then |
||
1426 | if NECROSIS_SPELL_TABLE[8].Mana > mana then |
||
1427 | for i = 5, 6, 1 do |
||
1428 | ManaPet[i] = "3"; |
||
1429 | end |
||
1430 | elseif NECROSIS_SPELL_TABLE[30].ID then |
||
1431 | if NECROSIS_SPELL_TABLE[30].Mana > mana then |
||
1432 | ManaPet[6] = "3"; |
||
1433 | end |
||
1434 | end |
||
1435 | end |
||
1436 | end |
||
1437 | end |
||
1438 | end |
||
1439 | |||
1440 | -- Coloration du bouton en grisé si pas de pierre pour l'invocation |
||
1441 | if Soulshards == 0 then |
||
1442 | for i = 2, 4, 1 do |
||
1443 | ManaPet[i] = "3"; |
||
1444 | end |
||
1445 | end |
||
1446 | if InfernalStone == 0 then |
||
1447 | ManaPet[5] = "3"; |
||
1448 | end |
||
1449 | if DemoniacStone == 0 then |
||
1450 | ManaPet[6] = "3"; |
||
1451 | end |
||
1452 | |||
1453 | -- Texturage des boutons de pet |
||
1454 | if DemonType == NECROSIS_PET_LOCAL_NAME[1] then |
||
1455 | NecrosisPetMenu2:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Imp-02"); |
||
1456 | NecrosisPetMenu3:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Voidwalker-0"..ManaPet[2]); |
||
1457 | NecrosisPetMenu4:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Succubus-0"..ManaPet[3]); |
||
1458 | NecrosisPetMenu5:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Felhunter-0"..ManaPet[4]); |
||
1459 | NecrosisPetMenu6:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Infernal-0"..ManaPet[5]); |
||
1460 | NecrosisPetMenu7:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Doomguard-0"..ManaPet[6]); |
||
1461 | elseif DemonType == NECROSIS_PET_LOCAL_NAME[2] then |
||
1462 | NecrosisPetMenu2:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Imp-0"..ManaPet[1]); |
||
1463 | NecrosisPetMenu3:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Voidwalker-02"); |
||
1464 | NecrosisPetMenu4:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Succubus-0"..ManaPet[3]); |
||
1465 | NecrosisPetMenu5:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Felhunter-0"..ManaPet[4]); |
||
1466 | NecrosisPetMenu6:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Infernal-0"..ManaPet[5]); |
||
1467 | NecrosisPetMenu7:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Doomguard-0"..ManaPet[6]); |
||
1468 | elseif DemonType == NECROSIS_PET_LOCAL_NAME[3] then |
||
1469 | NecrosisPetMenu2:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Imp-0"..ManaPet[1]); |
||
1470 | NecrosisPetMenu3:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Voidwalker-0"..ManaPet[2]); |
||
1471 | NecrosisPetMenu4:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Succubus-02"); |
||
1472 | NecrosisPetMenu5:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Felhunter-0"..ManaPet[4]); |
||
1473 | NecrosisPetMenu6:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Infernal-0"..ManaPet[5]); |
||
1474 | NecrosisPetMenu7:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Doomguard-0"..ManaPet[6]); |
||
1475 | elseif DemonType == NECROSIS_PET_LOCAL_NAME[4] then |
||
1476 | NecrosisPetMenu2:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Imp-0"..ManaPet[1]); |
||
1477 | NecrosisPetMenu3:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Voidwalker-0"..ManaPet[2]); |
||
1478 | NecrosisPetMenu4:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Succubus-0"..ManaPet[3]); |
||
1479 | NecrosisPetMenu5:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Felhunter-02"); |
||
1480 | NecrosisPetMenu6:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Infernal-0"..ManaPet[5]); |
||
1481 | NecrosisPetMenu7:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Doomguard-0"..ManaPet[6]); |
||
1482 | elseif DemonType == NECROSIS_PET_LOCAL_NAME[5] then |
||
1483 | NecrosisPetMenu2:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Imp-0"..ManaPet[1]); |
||
1484 | NecrosisPetMenu3:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Voidwalker-0"..ManaPet[2]); |
||
1485 | NecrosisPetMenu4:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Succubus-0"..ManaPet[3]); |
||
1486 | NecrosisPetMenu5:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Felhunter-0"..ManaPet[4]) |
||
1487 | NecrosisPetMenu6:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Infernal-02"); |
||
1488 | NecrosisPetMenu7:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Doomguard-0"..ManaPet[6]); |
||
1489 | elseif DemonType == NECROSIS_PET_LOCAL_NAME[6] then |
||
1490 | NecrosisPetMenu2:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Imp-0"..ManaPet[1]); |
||
1491 | NecrosisPetMenu3:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Voidwalker-0"..ManaPet[2]); |
||
1492 | NecrosisPetMenu4:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Succubus-0"..ManaPet[3]); |
||
1493 | NecrosisPetMenu5:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Felhunter-0"..ManaPet[4]) |
||
1494 | NecrosisPetMenu6:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Infernal-0"..ManaPet[5]); |
||
1495 | NecrosisPetMenu7:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Doomguard-02"); |
||
1496 | else |
||
1497 | NecrosisPetMenu2:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Imp-0"..ManaPet[1]); |
||
1498 | NecrosisPetMenu3:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Voidwalker-0"..ManaPet[2]); |
||
1499 | NecrosisPetMenu4:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Succubus-0"..ManaPet[3]); |
||
1500 | NecrosisPetMenu5:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Felhunter-0"..ManaPet[4]) |
||
1501 | NecrosisPetMenu6:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Infernal-0"..ManaPet[5]); |
||
1502 | NecrosisPetMenu7:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\Doomguard-0"..ManaPet[6]); |
||
1503 | end |
||
1504 | |||
1505 | |||
1506 | -- Bouton des buffs |
||
1507 | ----------------------------------------------- |
||
1508 | |||
1509 | if mana ~= nil then |
||
1510 | -- Coloration du bouton en grisé si pas assez de mana |
||
1511 | if MountAvailable and not NecrosisMounted then |
||
1512 | if NECROSIS_SPELL_TABLE[2].ID then |
||
1513 | if NECROSIS_SPELL_TABLE[2].Mana > mana or PlayerCombat then |
||
1514 | NecrosisMountButton:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\MountButton-03"); |
||
1515 | else |
||
1516 | NecrosisMountButton:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\MountButton-01"); |
||
1517 | end |
||
1518 | else |
||
1519 | if NECROSIS_SPELL_TABLE[1].Mana > mana or PlayerCombat then |
||
1520 | NecrosisMountButton:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\MountButton-03"); |
||
1521 | else |
||
1522 | NecrosisMountButton:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\MountButton-01"); |
||
1523 | end |
||
1524 | end |
||
1525 | end |
||
1526 | if NECROSIS_SPELL_TABLE[35].ID then |
||
1527 | if NECROSIS_SPELL_TABLE[35].Mana > mana or Soulshards == 0 then |
||
1528 | NecrosisPetMenu8:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Enslave-03"); |
||
1529 | else |
||
1530 | NecrosisPetMenu8:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Enslave-01"); |
||
1531 | end |
||
1532 | end |
||
1533 | if NECROSIS_SPELL_TABLE[31].ID then |
||
1534 | if NECROSIS_SPELL_TABLE[31].Mana > mana then |
||
1535 | NecrosisBuffMenu1:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\ArmureDemo-03"); |
||
1536 | else |
||
1537 | NecrosisBuffMenu1:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\ArmureDemo-01"); |
||
1538 | end |
||
1539 | elseif NECROSIS_SPELL_TABLE[36].ID then |
||
1540 | if NECROSIS_SPELL_TABLE[36].Mana > mana then |
||
1541 | NecrosisBuffMenu1:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\ArmureDemo-03"); |
||
1542 | else |
||
1543 | NecrosisBuffMenu1:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\ArmureDemo-01"); |
||
1544 | end |
||
1545 | end |
||
1546 | if NECROSIS_SPELL_TABLE[32].ID then |
||
1547 | if NECROSIS_SPELL_TABLE[32].Mana > mana then |
||
1548 | NecrosisBuffMenu2:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Aqua-03"); |
||
1549 | else |
||
1550 | NecrosisBuffMenu2:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Aqua-01"); |
||
1551 | end |
||
1552 | end |
||
1553 | if NECROSIS_SPELL_TABLE[33].ID then |
||
1554 | if NECROSIS_SPELL_TABLE[33].Mana > mana then |
||
1555 | NecrosisBuffMenu3:SetNormalTexture("Interface\\AddOns\\Necrosis\\\UI\\Invisible-03"); |
||
1556 | else |
||
1557 | NecrosisBuffMenu3:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Invisible-01"); |
||
1558 | end |
||
1559 | end |
||
1560 | if NECROSIS_SPELL_TABLE[34].ID then |
||
1561 | if NECROSIS_SPELL_TABLE[34].Mana > mana then |
||
1562 | NecrosisBuffMenu4:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Kilrogg-03"); |
||
1563 | else |
||
1564 | NecrosisBuffMenu4:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Kilrogg-01"); |
||
1565 | end |
||
1566 | end |
||
1567 | if NECROSIS_SPELL_TABLE[37].ID then |
||
1568 | if NECROSIS_SPELL_TABLE[37].Mana > mana or Soulshards == 0 then |
||
1569 | NecrosisBuffMenu5:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\TPButton-05"); |
||
1570 | else |
||
1571 | NecrosisBuffMenu5:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\TPButton-01"); |
||
1572 | end |
||
1573 | end |
||
1574 | if NECROSIS_SPELL_TABLE[38].ID then |
||
1575 | if NECROSIS_SPELL_TABLE[38].Mana > mana then |
||
1576 | NecrosisBuffMenu7:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Lien-03"); |
||
1577 | else |
||
1578 | NecrosisBuffMenu7:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Lien-01"); |
||
1579 | end |
||
1580 | end |
||
1581 | if NECROSIS_SPELL_TABLE[43].ID then |
||
1582 | if NECROSIS_SPELL_TABLE[43].Mana > mana then |
||
1583 | NecrosisBuffMenu8:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\ShadowWard-03"); |
||
1584 | else |
||
1585 | NecrosisBuffMenu8:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\ShadowWard-01"); |
||
1586 | end |
||
1587 | end |
||
1588 | if NECROSIS_SPELL_TABLE[9].ID then |
||
1589 | if NECROSIS_SPELL_TABLE[9].Mana > mana then |
||
1590 | NecrosisBuffMenu9:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Banish-03"); |
||
1591 | else |
||
1592 | NecrosisBuffMenu9:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Banish-01"); |
||
1593 | end |
||
1594 | end |
||
1595 | if NECROSIS_SPELL_TABLE[44].ID then |
||
1596 | if (NECROSIS_SPELL_TABLE[44].Mana > mana) or (not UnitExists("Pet")) then |
||
1597 | NecrosisPetMenu9:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Sacrifice-03"); |
||
1598 | else |
||
1599 | NecrosisPetMenu9:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Sacrifice-01"); |
||
1600 | end |
||
1601 | end |
||
1602 | |||
1603 | end |
||
1604 | |||
1605 | -- Bouton des curses |
||
1606 | ----------------------------------------------- |
||
1607 | |||
1608 | if mana ~= nil then |
||
1609 | -- Coloration du bouton en grisé si pas assez de mana |
||
1610 | if NECROSIS_SPELL_TABLE[23].ID then |
||
1611 | if NECROSIS_SPELL_TABLE[23].Mana > mana then |
||
1612 | NecrosisCurseMenu2:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Weakness-03"); |
||
1613 | else |
||
1614 | NecrosisCurseMenu2:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Weakness-01"); |
||
1615 | end |
||
1616 | end |
||
1617 | if NECROSIS_SPELL_TABLE[22].ID then |
||
1618 | if NECROSIS_SPELL_TABLE[22].Mana > mana then |
||
1619 | NecrosisCurseMenu3:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Agony-03"); |
||
1620 | else |
||
1621 | NecrosisCurseMenu3:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Agony-01"); |
||
1622 | end |
||
1623 | end |
||
1624 | if NECROSIS_SPELL_TABLE[24].ID then |
||
1625 | if NECROSIS_SPELL_TABLE[24].Mana > mana then |
||
1626 | NecrosisCurseMenu4:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Reckless-03"); |
||
1627 | else |
||
1628 | NecrosisCurseMenu4:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Reckless-01"); |
||
1629 | end |
||
1630 | end |
||
1631 | if NECROSIS_SPELL_TABLE[25].ID then |
||
1632 | if NECROSIS_SPELL_TABLE[25].Mana > mana then |
||
1633 | NecrosisCurseMenu5:SetNormalTexture("Interface\\AddOns\\Necrosis\\\UI\\Tongues-03"); |
||
1634 | else |
||
1635 | NecrosisCurseMenu5:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Tongues-01"); |
||
1636 | end |
||
1637 | end |
||
1638 | if NECROSIS_SPELL_TABLE[40].ID then |
||
1639 | if NECROSIS_SPELL_TABLE[40].Mana > mana then |
||
1640 | NecrosisCurseMenu6:SetNormalTexture("Interface\\AddOns\\Necrosis\\\UI\\Exhaust-03"); |
||
1641 | else |
||
1642 | NecrosisCurseMenu6:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Exhaust-01"); |
||
1643 | end |
||
1644 | end |
||
1645 | if NECROSIS_SPELL_TABLE[26].ID then |
||
1646 | if NECROSIS_SPELL_TABLE[26].Mana > mana then |
||
1647 | NecrosisCurseMenu7:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Elements-03"); |
||
1648 | else |
||
1649 | NecrosisCurseMenu7:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Elements-01"); |
||
1650 | end |
||
1651 | end |
||
1652 | if NECROSIS_SPELL_TABLE[27].ID then |
||
1653 | if NECROSIS_SPELL_TABLE[27].Mana > mana then |
||
1654 | NecrosisCurseMenu8:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Shadow-03"); |
||
1655 | else |
||
1656 | NecrosisCurseMenu8:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Shadow-01"); |
||
1657 | end |
||
1658 | end |
||
1659 | if NECROSIS_SPELL_TABLE[16].ID then |
||
1660 | if NECROSIS_SPELL_TABLE[16].Mana > mana then |
||
1661 | NecrosisCurseMenu9:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Doom-03"); |
||
1662 | else |
||
1663 | NecrosisCurseMenu9:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Doom-01"); |
||
1664 | end |
||
1665 | end |
||
1666 | end |
||
1667 | |||
1668 | |||
1669 | -- Bouton des Timers |
||
1670 | ----------------------------------------------- |
||
1671 | if HearthstoneLocation[1] then |
||
1672 | local start, duration, enable = GetContainerItemCooldown(HearthstoneLocation[1], HearthstoneLocation[2]); |
||
1673 | if duration > 20 and start > 0 then |
||
1674 | NecrosisSpellTimerButton:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\SpellTimerButton-Cooldown"); |
||
1675 | else |
||
1676 | NecrosisSpellTimerButton:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\SpellTimerButton-Normal"); |
||
1677 | end |
||
1678 | end |
||
1679 | end |
||
1680 | |||
1681 | ------------------------------------------------------------------------------------------------------ |
||
1682 | -- FONCTIONS DES PIERRES ET DES FRAGMENTS |
||
1683 | ------------------------------------------------------------------------------------------------------ |
||
1684 | |||
1685 | |||
1686 | -- T'AS QU'A SAVOIR OU T'AS MIS TES AFFAIRES ! |
||
1687 | function Necrosis_SoulshardSetup() |
||
1688 | SoulshardSlotID = 1; |
||
1689 | for slot=1, table.getn(SoulshardSlot), 1 do |
||
1690 | table.remove(SoulshardSlot, slot); |
||
1691 | end |
||
1692 | for slot=1, GetContainerNumSlots(NecrosisConfig.SoulshardContainer), 1 do |
||
1693 | table.insert(SoulshardSlot, nil); |
||
1694 | end |
||
1695 | end |
||
1696 | |||
1697 | |||
1698 | -- Fonction qui fait l'inventaire des éléments utilisés en démonologie : Pierres, Fragments, Composants d'invocation |
||
1699 | function Necrosis_BagExplore() |
||
1700 | local soulshards = Soulshards; |
||
1701 | Soulshards = 0; |
||
1702 | InfernalStone = 0; |
||
1703 | DemoniacStone = 0; |
||
1704 | SoulstoneOnHand = false; |
||
1705 | HealthstoneOnHand = false; |
||
1706 | FirestoneOnHand = false; |
||
1707 | SpellstoneOnHand = false; |
||
1708 | HearthstoneOnHand = false; |
||
1709 | ItemOnHand = false; |
||
1710 | -- Parcours des sacs |
||
1711 | for container=0, 4, 1 do |
||
1712 | -- Parcours des emplacements des sacs |
||
1713 | for slot=1, GetContainerNumSlots(container), 1 do |
||
1714 | Necrosis_MoneyToggle(); |
||
1715 | NecrosisTooltip:SetBagItem(container, slot); |
||
1716 | local itemName = tostring(NecrosisTooltipTextLeft1:GetText()); |
||
1717 | local itemSwitch = tostring(NecrosisTooltipTextLeft3:GetText()); |
||
1718 | local itemSwitch2 = tostring(NecrosisTooltipTextLeft4:GetText()); |
||
1719 | -- Si le sac est le sac défini pour les fragments |
||
1720 | -- hop la valeur du Tableau qui représente le slot du Sac = nil (pas de Shard) |
||
1721 | if (container == NecrosisConfig.SoulshardContainer) then |
||
1722 | if itemName ~= NECROSIS_ITEM.Soulshard then |
||
1723 | SoulshardSlot[slot] = nil; |
||
1724 | end |
||
1725 | end |
||
1726 | -- Dans le cas d'un emplacement non vide |
||
1727 | if itemName then |
||
1728 | -- On prend le nombre d'item en stack sur le slot |
||
1729 | local _, ItemCount = GetContainerItemInfo(container, slot); |
||
1730 | -- Si c'est un fragment ou une pierre infernale, alors on rajoute la qté au nombre de pierres |
||
1731 | if itemName == NECROSIS_ITEM.Soulshard then Soulshards = Soulshards + 1; end |
||
1732 | if itemName == NECROSIS_ITEM.InfernalStone then InfernalStone = InfernalStone + ItemCount; end |
||
1733 | if itemName == NECROSIS_ITEM.DemoniacStone then DemoniacStone = DemoniacStone + ItemCount; end |
||
1734 | -- Si c'est une pierre d'âme, on note son existence et son emplacement |
||
1735 | if string.find(itemName, NECROSIS_ITEM.Soulstone) then |
||
1736 | SoulstoneOnHand = true; |
||
1737 | SoulstoneLocation = {container,slot}; |
||
1738 | end |
||
1739 | -- Même chose pour une pierre de soin |
||
1740 | if string.find(itemName, NECROSIS_ITEM.Healthstone) then |
||
1741 | HealthstoneOnHand = true; |
||
1742 | HealthstoneLocation = {container,slot}; |
||
1743 | end |
||
1744 | -- Et encore pour la pierre de sort |
||
1745 | if string.find(itemName, NECROSIS_ITEM.Spellstone) then |
||
1746 | SpellstoneOnHand = true; |
||
1747 | SpellstoneLocation = {container,slot}; |
||
1748 | end |
||
1749 | -- La pierre de feu maintenant |
||
1750 | if string.find(itemName, NECROSIS_ITEM.Firestone) then |
||
1751 | FirestoneOnHand = true; |
||
1752 | FirestoneLocation = {container,slot}; |
||
1753 | end |
||
1754 | -- et enfin la pierre de foyer |
||
1755 | if string.find(itemName, NECROSIS_ITEM.Hearthstone) then |
||
1756 | HearthstoneOnHand = true; |
||
1757 | HearthstoneLocation = {container,slot}; |
||
1758 | end |
||
1759 | |||
1760 | -- On note aussi la présence ou non des objets "main gauche" |
||
1761 | -- Plus tard ce sera utilisé pour remplacer automatiquement une pierre absente |
||
1762 | if itemSwitch == NECROSIS_ITEM.Offhand or itemSwitch2 == NECROSIS_ITEM.Offhand then |
||
1763 | ItemOnHand = true; |
||
1764 | ItemswitchLocation = {container, slot}; |
||
1765 | end |
||
1766 | end |
||
1767 | end |
||
1768 | end |
||
1769 | |||
1770 | -- Affichage du bouton principal de Necrosis |
||
1771 | if NecrosisConfig.Circle == 1 then |
||
1772 | if (Soulshards <= 32) then |
||
1773 | NecrosisButton:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\"..NecrosisConfig.NecrosisColor.."\\Shard"..Soulshards); |
||
1774 | else |
||
1775 | NecrosisButton:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\"..NecrosisConfig.NecrosisColor.."\\Shard32"); |
||
1776 | end |
||
1777 | elseif SoulstoneMode ==1 or SoulstoneMode == 2 then |
||
1778 | if (Soulshards <= 32) then |
||
1779 | NecrosisButton:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Bleu\\Shard"..Soulshards); |
||
1780 | else |
||
1781 | NecrosisButton:SetNormalTexture("Interface\\AddOns\\Necrosis\\UI\\Bleu\\Shard32"); |
||
1782 | end |
||
1783 | end |
||
1784 | if NecrosisConfig.ShowCount then |
||
1785 | if NecrosisConfig.CountType == 2 then |
||
1786 | NecrosisShardCount:SetText(InfernalStone.." / "..DemoniacStone); |
||
1787 | elseif NecrosisConfig.CountType == 1 then |
||
1788 | if Soulshards < 10 then |
||
1789 | NecrosisShardCount:SetText("0"..Soulshards); |
||
1790 | else |
||
1791 | NecrosisShardCount:SetText(Soulshards); |
||
1792 | end |
||
1793 | end |
||
1794 | else |
||
1795 | NecrosisShardCount:SetText(""); |
||
1796 | end |
||
1797 | -- Et on met le tout à jour ! |
||
1798 | Necrosis_UpdateIcons(); |
||
1799 | |||
1800 | -- S'il y a plus de fragment que d'emplacements dans le sac défini, on affiche un message d'avertissement |
||
1801 | if (Soulshards > soulshards and Soulshards == GetContainerNumSlots(NecrosisConfig.SoulshardContainer)) then |
||
1802 | if (SoulshardDestroy) then |
||
1803 | Necrosis_Msg(NECROSIS_MESSAGE.Bag.FullPrefix..GetBagName(NecrosisConfig.SoulshardContainer)..NECROSIS_MESSAGE.Bag.FullDestroySuffix); |
||
1804 | else |
||
1805 | Necrosis_Msg(NECROSIS_MESSAGE.Bag.FullPrefix..GetBagName(NecrosisConfig.SoulshardContainer)..NECROSIS_MESSAGE.Bag.FullSuffix); |
||
1806 | end |
||
1807 | end |
||
1808 | end |
||
1809 | |||
1810 | -- Fonction qui permet de trouver / ranger les fragments dans les sacs |
||
1811 | function Necrosis_SoulshardSwitch(type) |
||
1812 | if (type == "CHECK") then |
||
1813 | SoulshardMP = 0; |
||
1814 | for container = 0, 4, 1 do |
||
1815 | for i = 1, 3, 1 do |
||
1816 | if GetBagName(container) == NECROSIS_ITEM.SoulPouch[i] then |
||
1817 | BagIsSoulPouch[container + 1] = true; |
||
1818 | break; |
||
1819 | else |
||
1820 | BagIsSoulPouch[container + 1] = false; |
||
1821 | end |
||
1822 | end |
||
1823 | end |
||
1824 | end |
||
1825 | for container = 0, 4, 1 do |
||
1826 | if BagIsSoulPouch[container+1] then break; end |
||
1827 | if container ~= NecrosisConfig.SoulshardContainer then |
||
1828 | for slot=1, GetContainerNumSlots(container), 1 do |
||
1829 | Necrosis_MoneyToggle(); |
||
1830 | NecrosisTooltip:SetBagItem(container, slot); |
||
1831 | local itemInfo = tostring(NecrosisTooltipTextLeft1:GetText()); |
||
1832 | if itemInfo == NECROSIS_ITEM.Soulshard then |
||
1833 | if (type == "CHECK") then |
||
1834 | SoulshardMP = SoulshardMP + 1; |
||
1835 | elseif (type == "MOVE") then |
||
1836 | Necrosis_FindSlot(container, slot); |
||
1837 | SoulshardMP = SoulshardMP - 1; |
||
1838 | end |
||
1839 | end |
||
1840 | end |
||
1841 | end |
||
1842 | end |
||
1843 | -- Après avoir tout déplacer, il faut retrouver les emplacements des pierres, etc, etc... |
||
1844 | Necrosis_BagExplore(); |
||
1845 | end |
||
1846 | |||
1847 | -- Pendant le déplacement des fragments, il faut trouver un nouvel emplacement aux objets déplacés :) |
||
1848 | function Necrosis_FindSlot(shardIndex, shardSlot) |
||
1849 | local full = true; |
||
1850 | for slot=1, GetContainerNumSlots(NecrosisConfig.SoulshardContainer), 1 do |
||
1851 | Necrosis_MoneyToggle(); |
||
1852 | NecrosisTooltip:SetBagItem(NecrosisConfig.SoulshardContainer, slot); |
||
1853 | local itemInfo = tostring(NecrosisTooltipTextLeft1:GetText()); |
||
1854 | if string.find(itemInfo, NECROSIS_ITEM.Soulshard) == nil then |
||
1855 | PickupContainerItem(shardIndex, shardSlot); |
||
1856 | PickupContainerItem(NecrosisConfig.SoulshardContainer, slot); |
||
1857 | SoulshardSlot[SoulshardSlotID] = slot; |
||
1858 | SoulshardSlotID = SoulshardSlotID + 1 |
||
1859 | if (CursorHasItem()) then |
||
1860 | if shardIndex == 0 then |
||
1861 | PutItemInBackpack(); |
||
1862 | else |
||
1863 | PutItemInBag(19 + shardIndex); |
||
1864 | end |
||
1865 | end |
||
1866 | full = false; |
||
1867 | break; |
||
1868 | end |
||
1869 | end |
||
1870 | -- Destruction des fragments en sur-nombre si l'option est activée |
||
1871 | if (full and NecrosisConfig.SoulshardDestroy) then |
||
1872 | PickupContainerItem(shardIndex, shardSlot); |
||
1873 | if (CursorHasItem()) then DeleteCursorItem(); end |
||
1874 | end |
||
1875 | end |
||
1876 | |||
1877 | ------------------------------------------------------------------------------------------------------ |
||
1878 | -- FONCTIONS DES SORTS |
||
1879 | ------------------------------------------------------------------------------------------------------ |
||
1880 | |||
1881 | |||
1882 | |||
1883 | -- Affiche ou masque les boutons de sort à chaque nouveau sort appris |
||
1884 | function Necrosis_ButtonSetup() |
||
1885 | if NecrosisConfig.NecrosisLockServ then |
||
1886 | Necrosis_NoDrag(); |
||
1887 | Necrosis_UpdateButtonsScale(); |
||
1888 | else |
||
1889 | HideUIPanel(NecrosisPetMenuButton); |
||
1890 | HideUIPanel(NecrosisBuffMenuButton); |
||
1891 | HideUIPanel(NecrosisCurseMenuButton); |
||
1892 | HideUIPanel(NecrosisMountButton); |
||
1893 | HideUIPanel(NecrosisFirestoneButton); |
||
1894 | HideUIPanel(NecrosisSpellstoneButton); |
||
1895 | HideUIPanel(NecrosisHealthstoneButton); |
||
1896 | HideUIPanel(NecrosisSoulstoneButton); |
||
1897 | if (NecrosisConfig.StonePosition[1]) and StoneIDInSpellTable[4] ~= 0 then |
||
1898 | ShowUIPanel(NecrosisFirestoneButton); |
||
1899 | end |
||
1900 | if (NecrosisConfig.StonePosition[2]) and StoneIDInSpellTable[3] ~= 0 then |
||
1901 | ShowUIPanel(NecrosisSpellstoneButton); |
||
1902 | end |
||
1903 | if (NecrosisConfig.StonePosition[3]) and StoneIDInSpellTable[2] ~= 0 then |
||
1904 | ShowUIPanel(NecrosisHealthstoneButton); |
||
1905 | end |
||
1906 | if (NecrosisConfig.StonePosition[4]) and StoneIDInSpellTable[1] ~= 0 then |
||
1907 | ShowUIPanel(NecrosisSoulstoneButton); |
||
1908 | end |
||
1909 | if (NecrosisConfig.StonePosition[5]) and BuffMenuCreate ~= {} then |
||
1910 | ShowUIPanel(NecrosisBuffMenuButton); |
||
1911 | end |
||
1912 | if (NecrosisConfig.StonePosition[6]) and MountAvailable then |
||
1913 | ShowUIPanel(NecrosisMountButton); |
||
1914 | end |
||
1915 | if (NecrosisConfig.StonePosition[7]) and PetMenuCreate ~= {} then |
||
1916 | ShowUIPanel(NecrosisPetMenuButton); |
||
1917 | end |
||
1918 | if (NecrosisConfig.StonePosition[8]) and CurseMenuCreate ~= {} then |
||
1919 | ShowUIPanel(NecrosisCurseMenuButton); |
||
1920 | end |
||
1921 | end |
||
1922 | end |
||
1923 | |||
1924 | |||
1925 | |||
1926 | -- Ma fonction préférée ! Elle fait la liste des sorts connus par le démo, et les classe par rang. |
||
1927 | -- Pour les pierres, elle sélectionne le plus haut rang connu |
||
1928 | function Necrosis_SpellSetup() |
||
1929 | local StoneType = {NECROSIS_ITEM.Soulstone, NECROSIS_ITEM.Healthstone, NECROSIS_ITEM.Spellstone, NECROSIS_ITEM.Firestone}; |
||
1930 | local StoneMaxRank = {0, 0, 0, 0}; |
||
1931 | |||
1932 | local CurrentStone = { |
||
1933 | ID = {}, |
||
1934 | Name = {}, |
||
1935 | subName = {} |
||
1936 | }; |
||
1937 | |||
1938 | local CurrentSpells = { |
||
1939 | ID = {}, |
||
1940 | Name = {}, |
||
1941 | subName = {} |
||
1942 | }; |
||
1943 | |||
1944 | local spellID = 1; |
||
1945 | local Invisible = 0; |
||
1946 | local InvisibleID = 0; |
||
1947 | |||
1948 | -- On va parcourir tous les sorts possedés par le Démoniste |
||
1949 | while true do |
||
1950 | local spellName, subSpellName = GetSpellName(spellID, BOOKTYPE_SPELL); |
||
1951 | |||
1952 | if not spellName then |
||
1953 | do break end |
||
1954 | end |
||
1955 | |||
1956 | -- Pour les sorts avec des rangs numérotés, on compare pour chaque sort les rangs 1 à 1 |
||
1957 | -- Le rang supérieur est conservé |
||
1958 | if (string.find(subSpellName, NECROSIS_TRANSLATION.Rank)) then |
||
1959 | local found = false; |
||
1960 | local rank = tonumber(strsub(subSpellName, 6, strlen(subSpellName))); |
||
1961 | for index=1, table.getn(CurrentSpells.Name), 1 do |
||
1962 | if (CurrentSpells.Name[index] == spellName) then |
||
1963 | found = true; |
||
1964 | if (CurrentSpells.subName[index] < rank) then |
||
1965 | CurrentSpells.ID[index] = spellID; |
||
1966 | CurrentSpells.subName[index] = rank; |
||
1967 | end |
||
1968 | break; |
||
1969 | end |
||
1970 | end |
||
1971 | -- Les plus grands rangs de chacun des sorts à rang numérotés sont insérés dans la table |
||
1972 | if (not found) then |
||
1973 | table.insert(CurrentSpells.ID, spellID); |
||
1974 | table.insert(CurrentSpells.Name, spellName); |
||
1975 | table.insert(CurrentSpells.subName, rank); |
||
1976 | end |
||
1977 | end |
||
1978 | |||
1979 | -- Test du Rang de la détection d'invisibilité |
||
1980 | if spellName == NECROSIS_TRANSLATION.GreaterInvisible then |
||
1981 | Invisible = 3; |
||
1982 | InvisibleID = spellID; |
||
1983 | elseif spellName == NECROSIS_TRANSLATION.Invisible and Invisible ~= 3 then |
||
1984 | Invisible = 2; |
||
1985 | InvisibleID = spellID; |
||
1986 | elseif spellName == NECROSIS_TRANSLATION.LesserInvisible and Invisible ~= 3 and Invisible ~= 2 then |
||
1987 | Invisible = 1; |
||
1988 | InvisibleID = spellID; |
||
1989 | end |
||
1990 | |||
1991 | -- Les pierres n'ont pas de rang numéroté, l'attribut de rang fait partie du nom du sort |
||
1992 | -- Pour chaque type de pierre, on va donc faire.... |
||
1993 | for stoneID=1, table.getn(StoneType), 1 do |
||
1994 | -- Si le sort étudié est bien une invocation de ce type de pierre et qu'on n'a pas |
||
1995 | -- déjà assigné un rang maximum à cette dernière |
||
1996 | if (string.find(spellName, StoneType[stoneID])) |
||
1997 | and StoneMaxRank[stoneID] ~= table.getn(NECROSIS_STONE_RANK) |
||
1998 | then |
||
1999 | -- Récupération de la fin du nom de la pierre, contenant son rang |
||
2000 | local stoneSuffix = string.sub(spellName, string.len(NECROSIS_CREATE[stoneID]) + 1); |
||
2001 | -- Reste à trouver la correspondance de son rang |
||
2002 | for rankID=1, table.getn(NECROSIS_STONE_RANK), 1 do |
||
2003 | -- Si la fin du nom de la pierre correspond à une taille de pierre, on note le rang ! |
||
2004 | if string.lower(stoneSuffix) == string.lower(NECROSIS_STONE_RANK[rankID]) then |
||
2005 | -- On a une pierre, on a son rang, reste à vérifier si c'est la plus puissante, |
||
2006 | -- et si oui, l'enregistrer |
||
2007 | if rankID > StoneMaxRank[stoneID] then |
||
2008 | StoneMaxRank[stoneID] = rankID; |
||
2009 | CurrentStone.Name[stoneID] = spellName; |
||
2010 | CurrentStone.subName[stoneID] = NECROSIS_STONE_RANK[rankID]; |
||
2011 | CurrentStone.ID[stoneID] = spellID; |
||
2012 | end |
||
2013 | break |
||
2014 | end |
||
2015 | end |
||
2016 | end |
||
2017 | end |
||
2018 | |||
2019 | spellID = spellID + 1; |
||
2020 | end |
||
2021 | |||
2022 | -- On insère dans la table les pierres avec le plus grand rang |
||
2023 | for stoneID=1, table.getn(StoneType), 1 do |
||
2024 | if StoneMaxRank[stoneID] ~= 0 then |
||
2025 | table.insert(NECROSIS_SPELL_TABLE, { |
||
2026 | ID = CurrentStone.ID[stoneID], |
||
2027 | Name = CurrentStone.Name[stoneID], |
||
2028 | Rank = 0, |
||
2029 | CastTime = 0, |
||
2030 | Length = 0, |
||
2031 | Type = 0, |
||
2032 | }); |
||
2033 | StoneIDInSpellTable[stoneID] = table.getn(NECROSIS_SPELL_TABLE); |
||
2034 | end |
||
2035 | end |
||
2036 | -- On met à jour la liste des sorts avec les nouveaux rangs |
||
2037 | for spell=1, table.getn(NECROSIS_SPELL_TABLE), 1 do |
||
2038 | for index = 1, table.getn(CurrentSpells.Name), 1 do |
||
2039 | if (NECROSIS_SPELL_TABLE[spell].Name == CurrentSpells.Name[index]) |
||
2040 | and NECROSIS_SPELL_TABLE[spell].ID ~= StoneIDInSpellTable[1] |
||
2041 | and NECROSIS_SPELL_TABLE[spell].ID ~= StoneIDInSpellTable[2] |
||
2042 | and NECROSIS_SPELL_TABLE[spell].ID ~= StoneIDInSpellTable[3] |
||
2043 | and NECROSIS_SPELL_TABLE[spell].ID ~= StoneIDInSpellTable[4] |
||
2044 | then |
||
2045 | NECROSIS_SPELL_TABLE[spell].ID = CurrentSpells.ID[index]; |
||
2046 | NECROSIS_SPELL_TABLE[spell].Rank = CurrentSpells.subName[index]; |
||
2047 | end |
||
2048 | end |
||
2049 | end |
||
2050 | |||
2051 | -- On met à jour la durée de chaque sort en fonction de son rang |
||
2052 | for index=1, table.getn(NECROSIS_SPELL_TABLE), 1 do |
||
2053 | if (index == 9) then -- si Bannish |
||
2054 | if NECROSIS_SPELL_TABLE[index].ID ~= nil then |
||
2055 | NECROSIS_SPELL_TABLE[index].Length = NECROSIS_SPELL_TABLE[index].Rank * 10 + 10; |
||
2056 | end |
||
2057 | end |
||
2058 | if (index == 13) then -- si Fear |
||
2059 | if NECROSIS_SPELL_TABLE[index].ID ~= nil then |
||
2060 | NECROSIS_SPELL_TABLE[index].Length = NECROSIS_SPELL_TABLE[index].Rank * 5 + 5; |
||
2061 | end |
||
2062 | end |
||
2063 | if (index == 14) then -- si Corruption |
||
2064 | if NECROSIS_SPELL_TABLE[index].ID ~= nil and NECROSIS_SPELL_TABLE[index].Rank <= 2 then |
||
2065 | NECROSIS_SPELL_TABLE[index].Length = NECROSIS_SPELL_TABLE[index].Rank * 3 + 9; |
||
2066 | end |
||
2067 | end |
||
2068 | end |
||
2069 | |||
2070 | for spellID=1, MAX_SPELLS, 1 do |
||
2071 | local spellName, subSpellName = GetSpellName(spellID, "spell"); |
||
2072 | if (spellName) then |
||
2073 | for index=1, table.getn(NECROSIS_SPELL_TABLE), 1 do |
||
2074 | if NECROSIS_SPELL_TABLE[index].Name == spellName then |
||
2075 | Necrosis_MoneyToggle(); |
||
2076 | NecrosisTooltip:SetSpell(spellID, 1); |
||
2077 | local _, _, ManaCost = string.find(NecrosisTooltipTextLeft2:GetText(), "(%d+)"); |
||
2078 | if not NECROSIS_SPELL_TABLE[index].ID then |
||
2079 | NECROSIS_SPELL_TABLE[index].ID = spellID; |
||
2080 | end |
||
2081 | NECROSIS_SPELL_TABLE[index].Mana = tonumber(ManaCost); |
||
2082 | end |
||
2083 | end |
||
2084 | end |
||
2085 | end |
||
2086 | if NECROSIS_SPELL_TABLE[1].ID or NECROSIS_SPELL_TABLE[2].ID then |
||
2087 | MountAvailable = true; |
||
2088 | else |
||
2089 | MountAvailable = false; |
||
2090 | end |
||
2091 | |||
2092 | -- Insertion du plus haut rang de détection d'invisibilité connu |
||
2093 | if Invisible >= 1 then |
||
2094 | NECROSIS_SPELL_TABLE[33].ID = InvisibleID; |
||
2095 | NECROSIS_SPELL_TABLE[33].Rank = 0; |
||
2096 | NECROSIS_SPELL_TABLE[33].CastTime = 0; |
||
2097 | NECROSIS_SPELL_TABLE[33].Length = 0; |
||
2098 | Necrosis_MoneyToggle(); |
||
2099 | NecrosisTooltip:SetSpell(InvisibleID, 1); |
||
2100 | local _, _, ManaCost = string.find(NecrosisTooltipTextLeft2:GetText(), "(%d+)"); |
||
2101 | NECROSIS_SPELL_TABLE[33].Mana = tonumber(ManaCost); |
||
2102 | end |
||
2103 | end |
||
2104 | |||
2105 | -- Fonction d'extraction d'attribut de sort |
||
2106 | -- F(type=string, string, int) -> Spell=table |
||
2107 | function Necrosis_FindSpellAttribute(type, attribute, array) |
||
2108 | for index=1, table.getn(NECROSIS_SPELL_TABLE), 1 do |
||
2109 | if string.find(NECROSIS_SPELL_TABLE[index][type], attribute) then return NECROSIS_SPELL_TABLE[index][array]; end |
||
2110 | end |
||
2111 | return nil; |
||
2112 | end |
||
2113 | |||
2114 | -- Fonction pour caster un Eclat d'ombre depuis le bouton de la Transe de l'Ombre |
||
2115 | -- L'éclat doit avoir le rang le plus haut |
||
2116 | function Necrosis_CastShadowBolt() |
||
2117 | local spellID = Necrosis_FindSpellAttribute("Name", NECROSIS_NIGHTFALL.BoltName, "ID"); |
||
2118 | if (spellID) then |
||
2119 | CastSpell(spellID, "spell"); |
||
2120 | else |
||
2121 | Necrosis_Msg(NECROSIS_NIGHTFALL_TEXT.NoBoltSpell, "USER"); |
||
2122 | end |
||
2123 | end |
||
2124 | |||
2125 | ------------------------------------------------------------------------------------------------------ |
||
2126 | -- FONCTIONS DIVERSES |
||
2127 | ------------------------------------------------------------------------------------------------------ |
||
2128 | |||
2129 | -- Fonction pour savoir si une unité subit un effet |
||
2130 | -- F(string, string)->bool |
||
2131 | function Necrosis_UnitHasEffect(unit, effect) |
||
2132 | local index = 1; |
||
2133 | while UnitDebuff(unit, index) do |
||
2134 | Necrosis_MoneyToggle(); |
||
2135 | NecrosisTooltip:SetUnitDebuff(unit, index); |
||
2136 | local DebuffName = tostring(NecrosisTooltipTextLeft1:GetText()); |
||
2137 | if (string.find(DebuffName, effect)) then |
||
2138 | return true; |
||
2139 | end |
||
2140 | index = index+1; |
||
2141 | end |
||
2142 | return false; |
||
2143 | end |
||
2144 | |||
2145 | -- Function to check the presence of a buff on the unit. |
||
2146 | -- Strictly identical to UnitHasEffect, but as WoW distinguishes Buff and DeBuff, so we have to. |
||
2147 | function Necrosis_UnitHasBuff(unit, effect) |
||
2148 | local index = 1; |
||
2149 | while UnitBuff(unit, index) do |
||
2150 | -- Here we'll cheat a little. checking a buff or debuff return the internal spell name, and not the name we give at start |
||
2151 | -- So we use an API widget that will use the internal name to return the known name. |
||
2152 | -- For example, the "Curse of Agony" spell is internaly known as "Spell_Shadow_CurseOfSargeras". Much easier to use the first one than the internal one. |
||
2153 | Necrosis_MoneyToggle(); |
||
2154 | NecrosisTooltip:SetUnitBuff(unit, index); |
||
2155 | local BuffName = tostring(NecrosisTooltipTextLeft1:GetText()); |
||
2156 | if (string.find(BuffName, effect)) then |
||
2157 | return true; |
||
2158 | end |
||
2159 | index = index+1; |
||
2160 | end |
||
2161 | return false; |
||
2162 | end |
||
2163 | |||
2164 | |||
2165 | -- Permet de reconnaitre quand le joueur gagne Crépuscule / Transe de l'ombre |
||
2166 | function Necrosis_UnitHasTrance() |
||
2167 | local ID = -1; |
||
2168 | for buffID = 0, 24, 1 do |
||
2169 | local buffTexture = GetPlayerBuffTexture(buffID); |
||
2170 | if buffTexture == nil then break end |
||
2171 | if strfind(buffTexture, "Spell_Shadow_Twilight") then |
||
2172 | ID = buffID; |
||
2173 | break |
||
2174 | end |
||
2175 | end |
||
2176 | ShadowTranceID = ID; |
||
2177 | end |
||
2178 | |||
2179 | -- Fonction pour gérer les actions effectuées par Necrosis au clic sur un bouton |
||
2180 | function Necrosis_UseItem(type,button) |
||
2181 | Necrosis_MoneyToggle(); |
||
2182 | NecrosisTooltip:SetBagItem("player", 17); |
||
2183 | local rightHand = tostring(NecrosisTooltipTextLeft1:GetText()); |
||
2184 | |||
2185 | -- Fonction pour utiliser une pierre de foyer dans l'inventaire |
||
2186 | -- s'il y en a une dans l'inventaire, et si c'était un click droit |
||
2187 | if type == "Hearthstone" and button == "RightButton" then |
||
2188 | if (HearthstoneOnHand) then |
||
2189 | -- on l'utilise |
||
2190 | UseContainerItem(HearthstoneLocation[1], HearthstoneLocation[2]); |
||
2191 | -- soit il n'y en a pas dans l'inventaire, on affiche un message d'erreur |
||
2192 | else |
||
2193 | Necrosis_Msg(NECROSIS_MESSAGE.Error.NoHearthStone, "USER"); |
||
2194 | end |
||
2195 | end |
||
2196 | |||
2197 | -- Si on clique sur le bouton de la pierre d'âme |
||
2198 | -- On met à jour le bouton pour savoir quel est le mode |
||
2199 | if (type == "Soulstone") then |
||
2200 | Necrosis_UpdateIcons(); |
||
2201 | -- Si le mode = 2 (une pierre dans l'inventaire, pas de pierre utilisée) |
||
2202 | -- alors on l'utilise |
||
2203 | if (SoulstoneMode == 2) then |
||
2204 | -- Si un joueur est ciblé, sur le joueur (avec message d'alerte) |
||
2205 | -- Si un joueur n'est pas ciblé, sur le Démoniste (sans message) |
||
2206 | if UnitIsPlayer("target") then |
||
2207 | SoulstoneUsedOnTarget = true; |
||
2208 | else |
||
2209 | SoulstoneUsedOnTarget = false; |
||
2210 | TargetUnit("player"); |
||
2211 | end |
||
2212 | UseContainerItem(SoulstoneLocation[1], SoulstoneLocation[2]); |
||
2213 | -- Maintenant que l'on crée un timer sur la session, nous ne sortons plus d'un RL |
||
2214 | NecrosisRL = false; |
||
2215 | -- Et hop, on remet à jour l'affichage des boutons :) |
||
2216 | Necrosis_UpdateIcons(); |
||
2217 | -- si il n'y a pas de pierre d'âme dans l'inventaire, alors on crée la pierre d'âme de rang le plus grand :) |
||
2218 | elseif (SoulstoneMode == 1) or (SoulstoneMode == 3) then |
||
2219 | if StoneIDInSpellTable[1] ~= 0 then |
||
2220 | CastSpell(NECROSIS_SPELL_TABLE[StoneIDInSpellTable[1]].ID, "spell"); |
||
2221 | else |
||
2222 | Necrosis_Msg(NECROSIS_MESSAGE.Error.NoSoulStoneSpell, "USER"); |
||
2223 | end |
||
2224 | |||
2225 | end |
||
2226 | -- Si on clique sur le bouton de la pierre de vie : |
||
2227 | elseif (type == "Healthstone") then |
||
2228 | -- soit il y en a une dans l'inventaire |
||
2229 | if HealthstoneOnHand then |
||
2230 | -- Dans ce cas si un pj allié est sélectionné, on lui donne la pierre |
||
2231 | -- Sinon, on l'utilise |
||
2232 | if NecrosisTradeRequest then |
||
2233 | PickupContainerItem(HealthstoneLocation[1], HealthstoneLocation[2]); |
||
2234 | ClickTradeButton(1); |
||
2235 | NecrosisTradeRequest = false; |
||
2236 | Trading = true; |
||
2237 | TradingNow = 3; |
||
2238 | return; |
||
2239 | elseif (UnitExists("target") and UnitIsPlayer("target") and UnitIsFriend("player", "target") and UnitName("target") ~= UnitName("player")) then |
||
2240 | PickupContainerItem(HealthstoneLocation[1], HealthstoneLocation[2]); |
||
2241 | if ( CursorHasItem() ) then |
||
2242 | DropItemOnUnit("target"); |
||
2243 | Trading = true; |
||
2244 | TradingNow = 3; |
||
2245 | end |
||
2246 | return; |
||
2247 | end |
||
2248 | if (UnitHealth("player") == UnitHealthMax("player")) then |
||
2249 | Necrosis_Msg(NECROSIS_MESSAGE.Error.FullHealth, "USER"); |
||
2250 | else |
||
2251 | SpellStopCasting(); |
||
2252 | UseContainerItem(HealthstoneLocation[1], HealthstoneLocation[2]); |
||
2253 | local HealthstoneInUse = false |
||
2254 | if Necrosis_TimerExisteDeja(NECROSIS_COOLDOWN.Healthstone, SpellTimer) then |
||
2255 | HealthstoneInUse = true; |
||
2256 | end |
||
2257 | if not HealthstoneInUse then |
||
2258 | SpellGroup, SpellTimer, TimerTable = Necrosis_InsertTimerStone(type, nil, nil, SpellGroup, SpellTimer, TimerTable); |
||
2259 | end |
||
2260 | end |
||
2261 | -- soit il n'y en a pas dans l'inventaire, et la pierre de plus haut rang est créée |
||
2262 | else |
||
2263 | if StoneIDInSpellTable[2] ~= 0 then |
||
2264 | CastSpell(NECROSIS_SPELL_TABLE[StoneIDInSpellTable[2]].ID, "spell"); |
||
2265 | else |
||
2266 | Necrosis_Msg(NECROSIS_MESSAGE.Error.NoHealthStoneSpell, "USER"); |
||
2267 | end |
||
2268 | end |
||
2269 | -- Au tour de la pierre de sort |
||
2270 | elseif (type == "Spellstone") then |
||
2271 | -- Si la pierre est équipée ou dans l'inventaire, un clic droit l'équipe / la déséquipe |
||
2272 | if (SpellstoneMode ~= 1 and button == "RightButton") |
||
2273 | -- Si la pierre n'est pas équipée, le raccourci clavier équipe la pierre |
||
2274 | or (SpellstoneMode == 2 and button == "Binding") then |
||
2275 | Necrosis_SwitchOffHand(type); |
||
2276 | -- Si la pierre est équipée, un clic gauche utilise la pierre |
||
2277 | elseif SpellstoneMode == 3 then |
||
2278 | local start, duration, enable = GetInventoryItemCooldown("player", 17) ; |
||
2279 | UseInventoryItem(17); |
||
2280 | if duration == 0 or start == 0 then Necrosis_SwitchOffHand("Off-hand"); end |
||
2281 | -- sinon on crée la pierre :) |
||
2282 | elseif (SpellstoneMode == 1) then |
||
2283 | if StoneIDInSpellTable[3] ~= 0 then |
||
2284 | CastSpell(NECROSIS_SPELL_TABLE[StoneIDInSpellTable[3]].ID, "spell"); |
||
2285 | else |
||
2286 | Necrosis_Msg(NECROSIS_MESSAGE.Error.NoSpellStoneSpell, "USER"); |
||
2287 | end |
||
2288 | end |
||
2289 | -- Meme chose pour la pierre de feu |
||
2290 | elseif (type == "Firestone") then |
||
2291 | -- Si la pierre n'existe pas, elle est créée |
||
2292 | if (FirestoneMode == 1) then |
||
2293 | if StoneIDInSpellTable[4] ~= 0 then |
||
2294 | CastSpell(NECROSIS_SPELL_TABLE[StoneIDInSpellTable[4]].ID, "spell"); |
||
2295 | else |
||
2296 | Necrosis_Msg(NECROSIS_MESSAGE.Error.NoFireStoneSpell, "USER"); |
||
2297 | end |
||
2298 | -- Si la pierre existe, un clic droit l'équipe / la déséquiper |
||
2299 | elseif button ~= "LeftButton" then |
||
2300 | Necrosis_SwitchOffHand(type); |
||
2301 | end |
||
2302 | -- Si on clic sur le bouton de monture |
||
2303 | elseif (type == "Mount") then |
||
2304 | -- Soit c'est la monture épique |
||
2305 | if NECROSIS_SPELL_TABLE[2].ID ~= nil then |
||
2306 | CastSpell(NECROSIS_SPELL_TABLE[2].ID, "spell"); |
||
2307 | Necrosis_OnUpdate(); |
||
2308 | -- Soit c'est la monture classique |
||
2309 | elseif NECROSIS_SPELL_TABLE[1].ID ~= nil then |
||
2310 | CastSpell(NECROSIS_SPELL_TABLE[1].ID, "spell"); |
||
2311 | Necrosis_OnUpdate(); |
||
2312 | -- (Soit c'est rien :) ) |
||
2313 | else |
||
2314 | Necrosis_Msg(NECROSIS_MESSAGE.Error.NoRiding, "USER"); |
||
2315 | end |
||
2316 | end |
||
2317 | end |
||
2318 | |||
2319 | -- Fonction permettant de permutter un objet main-gauche équipé avec un objet main-gauche de l'inventaire |
||
2320 | function Necrosis_SwitchOffHand(type) |
||
2321 | if (type == "Spellstone") then |
||
2322 | if SpellstoneMode == 3 then |
||
2323 | if ItemOnHand then |
||
2324 | Necrosis_Msg("Equipe "..GetContainerItemLink(ItemswitchLocation[1],ItemswitchLocation[2])..NECROSIS_MESSAGE.SwitchMessage..GetInventoryItemLink("player",17), "USER"); |
||
2325 | PickupInventoryItem(17); |
||
2326 | PickupContainerItem(ItemswitchLocation[1],ItemswitchLocation[2]); |
||
2327 | end |
||
2328 | return; |
||
2329 | else |
||
2330 | PickupContainerItem(SpellstoneLocation[1], SpellstoneLocation[2]); |
||
2331 | PickupInventoryItem(17); |
||
2332 | -- Le switch avec une pierre de sort implique un cooldown porté au timer |
||
2333 | if Necrosis_TimerExisteDeja(NECROSIS_COOLDOWN.Spellstone, SpellTimer) then |
||
2334 | SpellTimer, TimerTable = Necrosis_RetraitTimerParNom(NECROSIS_COOLDOWN.Spellstone, SpellTimer, TimerTable); |
||
2335 | end |
||
2336 | SpellGroup, SpellTimer, TimerTable = Necrosis_InsertTimerStone(type, nil, nil, SpellGroup, SpellTimer, TimerTable); |
||
2337 | return; |
||
2338 | end |
||
2339 | elseif (type == "Firestone") then |
||
2340 | if FirestoneMode == 3 then |
||
2341 | if ItemOnHand then |
||
2342 | PickupInventoryItem(17); |
||
2343 | PickupContainerItem(ItemswitchLocation[1],ItemswitchLocation[2]); |
||
2344 | Necrosis_Msg(NECROSIS_MESSAGE.EquipMessage..GetContainerItemLink(ItemswitchLocation[1],ItemswitchLocation[2])..NECROSIS_MESSAGE.SwitchMessage..GetInventoryItemLink("player",17), "USER"); |
||
2345 | end |
||
2346 | return; |
||
2347 | else |
||
2348 | PickupContainerItem(FirestoneLocation[1], FirestoneLocation[2]); |
||
2349 | PickupInventoryItem(17); |
||
2350 | return; |
||
2351 | end |
||
2352 | end |
||
2353 | if (type == "OffHand") and UnitClass("player") == NECROSIS_UNIT_WARLOCK then |
||
2354 | if ItemswitchLocation[1] ~= nil and ItemswitchLocation[2] ~= nil then |
||
2355 | PickupContainerItem(ItemswitchLocation[1],ItemswitchLocation[2]); |
||
2356 | PickupInventoryItem(17); |
||
2357 | end |
||
2358 | end |
||
2359 | end |
||
2360 | |||
2361 | function Necrosis_MoneyToggle() |
||
2362 | for index=1, 10 do |
||
2363 | local text = getglobal("NecrosisTooltipTextLeft"..index); |
||
2364 | text:SetText(nil); |
||
2365 | text = getglobal("NecrosisTooltipTextRight"..index); |
||
2366 | text:SetText(nil); |
||
2367 | end |
||
2368 | NecrosisTooltip:Hide(); |
||
2369 | NecrosisTooltip:SetOwner(WorldFrame, "ANCHOR_NONE"); |
||
2370 | end |
||
2371 | |||
2372 | function Necrosis_GameTooltip_ClearMoney() |
||
2373 | -- Intentionally empty; don't clear money while we use hidden tooltips |
||
2374 | end |
||
2375 | |||
2376 | |||
2377 | -- Fonction pour placer les boutons autour de Necrosis (et pour grossir / retracir l'interface...) |
||
2378 | function Necrosis_UpdateButtonsScale() |
||
2379 | local NBRScale = (100 + (NecrosisConfig.NecrosisButtonScale - 85)) / 100; |
||
2380 | if NecrosisConfig.NecrosisButtonScale <= 95 then |
||
2381 | NBRScale = 1.1; |
||
2382 | end |
||
2383 | if NecrosisConfig.NecrosisLockServ then |
||
2384 | Necrosis_ClearAllPoints(); |
||
2385 | HideUIPanel(NecrosisPetMenuButton); |
||
2386 | HideUIPanel(NecrosisBuffMenuButton); |
||
2387 | HideUIPanel(NecrosisCurseMenuButton); |
||
2388 | HideUIPanel(NecrosisMountButton); |
||
2389 | HideUIPanel(NecrosisFirestoneButton); |
||
2390 | HideUIPanel(NecrosisSpellstoneButton); |
||
2391 | HideUIPanel(NecrosisHealthstoneButton); |
||
2392 | HideUIPanel(NecrosisSoulstoneButton); |
||
2393 | local indexScale = -36; |
||
2394 | for index=1, 8, 1 do |
||
2395 | if NecrosisConfig.StonePosition[index] then |
||
2396 | if index == 1 and StoneIDInSpellTable[4] ~= 0 then |
||
2397 | NecrosisFirestoneButton:SetPoint("CENTER", "NecrosisButton", "CENTER", ((40 * NBRScale) * cos(NecrosisConfig.NecrosisAngle-indexScale)), ((40 * NBRScale) * sin(NecrosisConfig.NecrosisAngle-indexScale))); |
||
2398 | ShowUIPanel(NecrosisFirestoneButton); |
||
2399 | indexScale = indexScale + 36; |
||
2400 | end |
||
2401 | if index == 2 and StoneIDInSpellTable[3] ~= 0 then |
||
2402 | NecrosisSpellstoneButton:SetPoint("CENTER", "NecrosisButton", "CENTER", ((40 * NBRScale) * cos(NecrosisConfig.NecrosisAngle-indexScale)), ((40 * NBRScale) * sin(NecrosisConfig.NecrosisAngle-indexScale))); |
||
2403 | ShowUIPanel(NecrosisSpellstoneButton); |
||
2404 | indexScale = indexScale + 36; |
||
2405 | end |
||
2406 | if index == 3 and StoneIDInSpellTable[2] ~= 0 then |
||
2407 | NecrosisHealthstoneButton:SetPoint("CENTER", "NecrosisButton", "CENTER", ((40 * NBRScale) * cos(NecrosisConfig.NecrosisAngle-indexScale)), ((40 * NBRScale) * sin(NecrosisConfig.NecrosisAngle-indexScale))); |
||
2408 | ShowUIPanel(NecrosisHealthstoneButton); |
||
2409 | indexScale = indexScale + 36; |
||
2410 | end |
||
2411 | if index == 4 and StoneIDInSpellTable[1] ~= 0 then |
||
2412 | NecrosisSoulstoneButton:SetPoint("CENTER", "NecrosisButton", "CENTER", ((40 * NBRScale) * cos(NecrosisConfig.NecrosisAngle-indexScale)), ((40 * NBRScale) * sin(NecrosisConfig.NecrosisAngle-indexScale))); |
||
2413 | ShowUIPanel(NecrosisSoulstoneButton); |
||
2414 | indexScale = indexScale + 36; |
||
2415 | end |
||
2416 | if index == 5 and BuffMenuCreate ~= {} then |
||
2417 | NecrosisBuffMenuButton:SetPoint("CENTER", "NecrosisButton", "CENTER", ((40 * NBRScale) * cos(NecrosisConfig.NecrosisAngle-indexScale)), ((40 * NBRScale) * sin(NecrosisConfig.NecrosisAngle-indexScale))); |
||
2418 | ShowUIPanel(NecrosisBuffMenuButton); |
||
2419 | indexScale = indexScale + 36; |
||
2420 | end |
||
2421 | if index == 6 and MountAvailable then |
||
2422 | NecrosisMountButton:SetPoint("CENTER", "NecrosisButton", "CENTER", ((40 * NBRScale) * cos(NecrosisConfig.NecrosisAngle-indexScale)), ((40 * NBRScale) * sin(NecrosisConfig.NecrosisAngle-indexScale))); |
||
2423 | ShowUIPanel(NecrosisMountButton); |
||
2424 | indexScale = indexScale + 36; |
||
2425 | end |
||
2426 | if index == 7 and PetMenuCreate ~= {} then |
||
2427 | NecrosisPetMenuButton:SetPoint("CENTER", "NecrosisButton", "CENTER", ((40 * NBRScale) * cos(NecrosisConfig.NecrosisAngle-indexScale)), ((40 * NBRScale) * sin(NecrosisConfig.NecrosisAngle-indexScale))); |
||
2428 | ShowUIPanel(NecrosisPetMenuButton); |
||
2429 | indexScale = indexScale + 36; |
||
2430 | end |
||
2431 | if index == 8 and CurseMenuCreate ~= {} then |
||
2432 | NecrosisCurseMenuButton:SetPoint("CENTER", "NecrosisButton", "CENTER", ((40 * NBRScale) * cos(NecrosisConfig.NecrosisAngle-indexScale)), ((40 * NBRScale) * sin(NecrosisConfig.NecrosisAngle-indexScale))); |
||
2433 | ShowUIPanel(NecrosisCurseMenuButton); |
||
2434 | indexScale = indexScale + 36; |
||
2435 | end |
||
2436 | end |
||
2437 | end |
||
2438 | end |
||
2439 | end |
||
2440 | |||
2441 | |||
2442 | |||
2443 | -- Fonction (XML) pour rétablir les points d'attache par défaut des boutons |
||
2444 | function Necrosis_ClearAllPoints() |
||
2445 | NecrosisFirestoneButton:ClearAllPoints(); |
||
2446 | NecrosisSpellstoneButton:ClearAllPoints(); |
||
2447 | NecrosisHealthstoneButton:ClearAllPoints(); |
||
2448 | NecrosisSoulstoneButton:ClearAllPoints(); |
||
2449 | NecrosisMountButton:ClearAllPoints(); |
||
2450 | NecrosisPetMenuButton:ClearAllPoints(); |
||
2451 | NecrosisBuffMenuButton:ClearAllPoints(); |
||
2452 | NecrosisCurseMenuButton:ClearAllPoints(); |
||
2453 | end |
||
2454 | |||
2455 | -- Fonction (XML) pour étendre la propriété NoDrag() du bouton principal de Necrosis sur tout ses boutons |
||
2456 | function Necrosis_NoDrag() |
||
2457 | NecrosisFirestoneButton:RegisterForDrag(""); |
||
2458 | NecrosisSpellstoneButton:RegisterForDrag(""); |
||
2459 | NecrosisHealthstoneButton:RegisterForDrag(""); |
||
2460 | NecrosisSoulstoneButton:RegisterForDrag(""); |
||
2461 | NecrosisMountButton:RegisterForDrag(""); |
||
2462 | NecrosisPetMenuButton:RegisterForDrag(""); |
||
2463 | NecrosisBuffMenuButton:RegisterForDrag(""); |
||
2464 | NecrosisCurseMenuButton:RegisterForDrag(""); |
||
2465 | end |
||
2466 | |||
2467 | -- Fonction (XML) inverse de celle du dessus |
||
2468 | function Necrosis_Drag() |
||
2469 | NecrosisFirestoneButton:RegisterForDrag("LeftButton"); |
||
2470 | NecrosisSpellstoneButton:RegisterForDrag("LeftButton"); |
||
2471 | NecrosisHealthstoneButton:RegisterForDrag("LeftButton"); |
||
2472 | NecrosisSoulstoneButton:RegisterForDrag("LeftButton"); |
||
2473 | NecrosisMountButton:RegisterForDrag("LeftButton"); |
||
2474 | NecrosisPetMenuButton:RegisterForDrag("LeftButton"); |
||
2475 | NecrosisBuffMenuButton:RegisterForDrag("LeftButton"); |
||
2476 | NecrosisCurseMenuButton:RegisterForDrag("LeftButton"); |
||
2477 | end |
||
2478 | |||
2479 | -- Ouverture du menu des buffs |
||
2480 | function Necrosis_BuffMenu(button) |
||
2481 | if button == "MiddleButton" and LastBuff ~= 0 then |
||
2482 | Necrosis_BuffCast(LastBuff); |
||
2483 | return; |
||
2484 | end |
||
2485 | BuffMenuShow = not BuffMenuShow; |
||
2486 | if not BuffMenuShow then |
||
2487 | BuffShow = false; |
||
2488 | BuffVisible = false; |
||
2489 | NecrosisBuffMenuButton:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\BuffMenuButton-01"); |
||
2490 | BuffMenuCreate[1]:ClearAllPoints(); |
||
2491 | BuffMenuCreate[1]:SetPoint("CENTER", "NecrosisBuffMenuButton", "CENTER", 3000, 3000); |
||
2492 | AlphaBuffMenu = 1; |
||
2493 | else |
||
2494 | BuffShow = true; |
||
2495 | NecrosisBuffMenuButton:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\BuffMenuButton-02"); |
||
2496 | -- Si clic droit, le menu de buff reste ouvert |
||
2497 | if button == "RightButton" then |
||
2498 | BuffVisible = true; |
||
2499 | end |
||
2500 | -- S'il n'existe aucun buff on ne fait rien |
||
2501 | if BuffMenuCreate == nil then |
||
2502 | return; |
||
2503 | end |
||
2504 | -- Sinon on affiche les icones |
||
2505 | NecrosisBuffMenu1:SetAlpha(1); |
||
2506 | NecrosisBuffMenu2:SetAlpha(1); |
||
2507 | NecrosisBuffMenu3:SetAlpha(1); |
||
2508 | NecrosisBuffMenu4:SetAlpha(1); |
||
2509 | NecrosisBuffMenu5:SetAlpha(1); |
||
2510 | NecrosisBuffMenu6:SetAlpha(1); |
||
2511 | NecrosisBuffMenu7:SetAlpha(1); |
||
2512 | NecrosisBuffMenu8:SetAlpha(1); |
||
2513 | NecrosisBuffMenu9:SetAlpha(1); |
||
2514 | BuffMenuCreate[1]:ClearAllPoints(); |
||
2515 | BuffMenuCreate[1]:SetPoint("CENTER", "NecrosisBuffMenuButton", "CENTER", ((36 / NecrosisConfig.BuffMenuPos) * 31) , 26); |
||
2516 | AlphaPetVar = GetTime() + 3; |
||
2517 | AlphaBuffVar = GetTime() + 6; |
||
2518 | AlphaCurseVar = GetTime() + 6; |
||
2519 | end |
||
2520 | end |
||
2521 | |||
2522 | -- Ouverture du menu des curses |
||
2523 | function Necrosis_CurseMenu(button) |
||
2524 | if button == "MiddleButton" and LastCurse ~= 0 then |
||
2525 | Necrosis_CurseCast(LastCurse); |
||
2526 | return; |
||
2527 | end |
||
2528 | -- S'il n'existe aucune curse on ne fait rien |
||
2529 | if CurseMenuCreate[1] == nil then |
||
2530 | return; |
||
2531 | end |
||
2532 | CurseMenuShow = not CurseMenuShow; |
||
2533 | if not CurseMenuShow then |
||
2534 | CurseShow = false; |
||
2535 | CurseVisible = false; |
||
2536 | NecrosisCurseMenuButton:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\CurseMenuButton-01"); |
||
2537 | CurseMenuCreate[1]:ClearAllPoints(); |
||
2538 | CurseMenuCreate[1]:SetPoint("CENTER", "NecrosisCurseMenuButton", "CENTER", 3000, 3000); |
||
2539 | AlphaCurseMenu = 1; |
||
2540 | else |
||
2541 | CurseShow = true; |
||
2542 | NecrosisCurseMenuButton:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\CurseMenuButton-02"); |
||
2543 | -- Si clic droit, le menu de curse reste ouvert |
||
2544 | if button == "RightButton" then |
||
2545 | CurseVisible = true; |
||
2546 | end |
||
2547 | -- Sinon on affiche les icones |
||
2548 | NecrosisCurseMenu1:SetAlpha(1); |
||
2549 | NecrosisCurseMenu2:SetAlpha(1); |
||
2550 | NecrosisCurseMenu3:SetAlpha(1); |
||
2551 | NecrosisCurseMenu4:SetAlpha(1); |
||
2552 | NecrosisCurseMenu5:SetAlpha(1); |
||
2553 | NecrosisCurseMenu6:SetAlpha(1); |
||
2554 | NecrosisCurseMenu7:SetAlpha(1); |
||
2555 | NecrosisCurseMenu8:SetAlpha(1); |
||
2556 | NecrosisCurseMenu9:SetAlpha(1); |
||
2557 | CurseMenuCreate[1]:ClearAllPoints(); |
||
2558 | CurseMenuCreate[1]:SetPoint("CENTER", "NecrosisCurseMenuButton", "CENTER", ((36 / NecrosisConfig.CurseMenuPos) * 31) , -26); |
||
2559 | AlphaPetVar = GetTime() + 3; |
||
2560 | AlphaBuffVar = GetTime() + 6; |
||
2561 | AlphaCurseVar = GetTime() + 6; |
||
2562 | end |
||
2563 | end |
||
2564 | |||
2565 | -- Ouverture du menu des démons |
||
2566 | function Necrosis_PetMenu(button) |
||
2567 | if button == "MiddleButton" and LastDemon ~= 0 then |
||
2568 | Necrosis_PetCast(LastDemon); |
||
2569 | return; |
||
2570 | end |
||
2571 | -- S'il n'existe aucun sort d'invocation on ne fait rien |
||
2572 | if PetMenuCreate[1] == nil then |
||
2573 | return; |
||
2574 | end |
||
2575 | PetMenuShow = not PetMenuShow; |
||
2576 | if not PetMenuShow then |
||
2577 | PetShow = false; |
||
2578 | PetVisible = false; |
||
2579 | NecrosisPetMenuButton:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\PetMenuButton-01"); |
||
2580 | PetMenuCreate[1]:ClearAllPoints(); |
||
2581 | PetMenuCreate[1]:SetPoint("CENTER", "NecrosisPetMenuButton", "CENTER", 3000, 3000); |
||
2582 | AlphaPetMenu = 1; |
||
2583 | else |
||
2584 | PetShow = true; |
||
2585 | NecrosisPetMenuButton:SetNormalTexture("Interface\\Addons\\Necrosis\\UI\\PetMenuButton-02"); |
||
2586 | -- Si clic droit, le menu de pet reste ouvert |
||
2587 | if button == "RightButton" then |
||
2588 | PetVisible = true; |
||
2589 | end |
||
2590 | -- Sinon on affiche les icones (on les déplace sur l'écran) |
||
2591 | NecrosisPetMenu1:SetAlpha(1); |
||
2592 | NecrosisPetMenu2:SetAlpha(1); |
||
2593 | NecrosisPetMenu3:SetAlpha(1); |
||
2594 | NecrosisPetMenu4:SetAlpha(1); |
||
2595 | NecrosisPetMenu5:SetAlpha(1); |
||
2596 | NecrosisPetMenu6:SetAlpha(1); |
||
2597 | NecrosisPetMenu7:SetAlpha(1); |
||
2598 | NecrosisPetMenu8:SetAlpha(1); |
||
2599 | NecrosisPetMenu9:SetAlpha(1); |
||
2600 | PetMenuCreate[1]:ClearAllPoints(); |
||
2601 | PetMenuCreate[1]:SetPoint("CENTER", "NecrosisPetMenuButton", "CENTER", ((36 / NecrosisConfig.PetMenuPos) * 31) , 26); |
||
2602 | AlphaPetVar = GetTime() + 3; |
||
2603 | end |
||
2604 | end |
||
2605 | |||
2606 | -- A chaque changement du livre des sorts, au démarrage du mod, ainsi qu'au changement de sens du menu on reconstruit les menus des sorts |
||
2607 | function Necrosis_CreateMenu() |
||
2608 | PetMenuCreate = {}; |
||
2609 | CurseMenuCreate = {}; |
||
2610 | BuffMenuCreate = {}; |
||
2611 | local menuVariable = nil; |
||
2612 | local PetButtonPosition = 0; |
||
2613 | local BuffButtonPosition = 0; |
||
2614 | local CurseButtonPosition = 0; |
||
2615 | |||
2616 | -- On cache toutes les icones des démons |
||
2617 | for i = 1, 9, 1 do |
||
2618 | menuVariable = getglobal("NecrosisPetMenu"..i); |
||
2619 | menuVariable:Hide(); |
||
2620 | end |
||
2621 | -- On cache toutes les icones des sorts |
||
2622 | for i = 1, 9, 1 do |
||
2623 | menuVariable = getglobal("NecrosisBuffMenu"..i); |
||
2624 | menuVariable:Hide(); |
||
2625 | end |
||
2626 | -- On cache toutes les icones des curses |
||
2627 | for i = 1, 9, 1 do |
||
2628 | menuVariable = getglobal("NecrosisCurseMenu"..i); |
||
2629 | menuVariable:Hide(); |
||
2630 | end |
||
2631 | |||
2632 | |||
2633 | -- Si le sort de Domination corrompue existe, on affiche le bouton dans le menu des pets |
||
2634 | if NECROSIS_SPELL_TABLE[15].ID then |
||
2635 | menuVariable = getglobal("NecrosisPetMenu1"); |
||
2636 | menuVariable:ClearAllPoints(); |
||
2637 | menuVariable:SetPoint("CENTER", "NecrosisPetMenuButton", "CENTER", 3000, 3000); |
||
2638 | PetButtonPosition = 1; |
||
2639 | table.insert(PetMenuCreate, menuVariable); |
||
2640 | end |
||
2641 | -- Si l'invocation du Diablotin existe, on affiche le bouton dans le menu des pets |
||
2642 | if NECROSIS_SPELL_TABLE[3].ID then |
||
2643 | menuVariable = getglobal("NecrosisPetMenu2"); |
||
2644 | menuVariable:ClearAllPoints(); |
||
2645 | if PetButtonPosition == 0 then |
||
2646 | menuVariable:SetPoint("CENTER", "NecrosisPetMenuButton", "CENTER", 3000, 3000); |
||
2647 | else |
||
2648 | menuVariable:SetPoint("CENTER", "NecrosisPetMenu"..PetButtonPosition, "CENTER", ((36 / NecrosisConfig.PetMenuPos) * 31), 0); |
||
2649 | end |
||
2650 | PetButtonPosition = 2; |
||
2651 | table.insert(PetMenuCreate, menuVariable); |
||
2652 | end |
||
2653 | -- Si l'invocation du Marcheur existe, on affiche le bouton dans le menu des pets |
||
2654 | if NECROSIS_SPELL_TABLE[4].ID then |
||
2655 | menuVariable = getglobal("NecrosisPetMenu3"); |
||
2656 | menuVariable:ClearAllPoints(); |
||
2657 | menuVariable:SetPoint("CENTER", "NecrosisPetMenu"..PetButtonPosition, "CENTER", ((36 / NecrosisConfig.PetMenuPos) * 31), 0); |
||
2658 | PetButtonPosition = 3; |
||
2659 | table.insert(PetMenuCreate, menuVariable); |
||
2660 | end |
||
2661 | -- Si l'invocation du Succube existe, on affiche le bouton dans le menu des pets |
||
2662 | if NECROSIS_SPELL_TABLE[5].ID then |
||
2663 | menuVariable = getglobal("NecrosisPetMenu4"); |
||
2664 | menuVariable:ClearAllPoints(); |
||
2665 | menuVariable:SetPoint("CENTER", "NecrosisPetMenu"..PetButtonPosition, "CENTER", ((36 / NecrosisConfig.PetMenuPos) * 31), 0); |
||
2666 | PetButtonPosition = 4; |
||
2667 | table.insert(PetMenuCreate, menuVariable); |
||
2668 | end |
||
2669 | -- Si l'invocation du Felhunter existe, on affiche le bouton dans le menu des pets |
||
2670 | if NECROSIS_SPELL_TABLE[6].ID then |
||
2671 | menuVariable = getglobal("NecrosisPetMenu5"); |
||
2672 | menuVariable:ClearAllPoints(); |
||
2673 | menuVariable:SetPoint("CENTER", "NecrosisPetMenu"..PetButtonPosition, "CENTER", ((36 / NecrosisConfig.PetMenuPos) * 31), 0); |
||
2674 | PetButtonPosition = 5; |
||
2675 | table.insert(PetMenuCreate, menuVariable); |
||
2676 | end |
||
2677 | -- Si l'invocation de l'Infernal existe, on affiche le bouton dans le menu des pets |
||
2678 | if NECROSIS_SPELL_TABLE[8].ID then |
||
2679 | menuVariable = getglobal("NecrosisPetMenu6"); |
||
2680 | menuVariable:ClearAllPoints(); |
||
2681 | menuVariable:SetPoint("CENTER", "NecrosisPetMenu"..PetButtonPosition, "CENTER", ((36 / NecrosisConfig.PetMenuPos) * 31), 0); |
||
2682 | PetButtonPosition = 6; |
||
2683 | table.insert(PetMenuCreate, menuVariable); |
||
2684 | end |
||
2685 | -- Si l'invocation du Doomguard existe, on affiche le bouton dans le menu des pets |
||
2686 | if NECROSIS_SPELL_TABLE[30].ID then |
||
2687 | menuVariable = getglobal("NecrosisPetMenu7"); |
||
2688 | menuVariable:ClearAllPoints(); |
||
2689 | menuVariable:SetPoint("CENTER", "NecrosisPetMenu"..PetButtonPosition, "CENTER", ((36 / NecrosisConfig.PetMenuPos) * 31), 0); |
||
2690 | PetButtonPosition = 7; |
||
2691 | table.insert(PetMenuCreate, menuVariable); |
||
2692 | end |
||
2693 | -- Si l'asservissement existe, on affiche le bouton dans le menu des pets |
||
2694 | if NECROSIS_SPELL_TABLE[35].ID then |
||
2695 | menuVariable = getglobal("NecrosisPetMenu8"); |
||
2696 | menuVariable:ClearAllPoints(); |
||
2697 | menuVariable:SetPoint("CENTER", "NecrosisPetMenu"..PetButtonPosition, "CENTER", ((36 / NecrosisConfig.PetMenuPos) * 31), 0); |
||
2698 | PetButtonPosition = 8; |
||
2699 | table.insert(PetMenuCreate, menuVariable); |
||
2700 | end |
||
2701 | -- Si le sacrifice démoniaque existe, on affiche le bouton dans le menu des pets |
||
2702 | if NECROSIS_SPELL_TABLE[44].ID then |
||
2703 | menuVariable = getglobal("NecrosisPetMenu9"); |
||
2704 | menuVariable:ClearAllPoints(); |
||
2705 | menuVariable:SetPoint("CENTER", "NecrosisPetMenu"..PetButtonPosition, "CENTER", ((36 / NecrosisConfig.PetMenuPos) * 31), 0); |
||
2706 | PetButtonPosition = 9; |
||
2707 | table.insert(PetMenuCreate, menuVariable); |
||
2708 | end |
||
2709 | |||
2710 | |||
2711 | -- Maintenant que tous les boutons de pet sont placés les uns à côté des autres (hors de l'écran), on affiche les disponibles |
||
2712 | for i = 1, table.getn(PetMenuCreate), 1 do |
||
2713 | ShowUIPanel(PetMenuCreate[i]); |
||
2714 | end |
||
2715 | |||
2716 | -- Si l'Armure Démoniaque existe, on affiche le bouton dans le menu des buffs |
||
2717 | if NECROSIS_SPELL_TABLE[31].ID or NECROSIS_SPELL_TABLE[36].ID then |
||
2718 | menuVariable = getglobal("NecrosisBuffMenu1"); |
||
2719 | menuVariable:ClearAllPoints(); |
||
2720 | menuVariable:SetPoint("CENTER", "NecrosisBuffMenuButton", "CENTER", 3000, 3000); |
||
2721 | BuffButtonPosition = 1; |
||
2722 | table.insert(BuffMenuCreate, menuVariable); |
||
2723 | end |
||
2724 | -- Si la respiration interminable existe, on affiche le bouton dans le menu des buffs |
||
2725 | if NECROSIS_SPELL_TABLE[32].ID then |
||
2726 | menuVariable = getglobal("NecrosisBuffMenu2"); |
||
2727 | menuVariable:ClearAllPoints(); |
||
2728 | menuVariable:SetPoint("CENTER", "NecrosisBuffMenu"..BuffButtonPosition, "CENTER", ((36 / NecrosisConfig.BuffMenuPos) * 31), 0); |
||
2729 | BuffButtonPosition = 2; |
||
2730 | table.insert(BuffMenuCreate, menuVariable); |
||
2731 | end |
||
2732 | -- Si la détection de l'invisibilité existe, on affiche le bouton dans le menu des buffs (au plus haut rang) |
||
2733 | if NECROSIS_SPELL_TABLE[33].ID then |
||
2734 | menuVariable = getglobal("NecrosisBuffMenu3"); |
||
2735 | menuVariable:ClearAllPoints(); |
||
2736 | menuVariable:SetPoint("CENTER", "NecrosisBuffMenu"..BuffButtonPosition, "CENTER", ((36 / NecrosisConfig.BuffMenuPos) * 31), 0); |
||
2737 | BuffButtonPosition = 3; |
||
2738 | table.insert(BuffMenuCreate, menuVariable); |
||
2739 | end |
||
2740 | -- Si la respiration interminable existe, on affiche le bouton dans le menu des buffs |
||
2741 | if NECROSIS_SPELL_TABLE[34].ID then |
||
2742 | menuVariable = getglobal("NecrosisBuffMenu4"); |
||
2743 | menuVariable:ClearAllPoints(); |
||
2744 | menuVariable:SetPoint("CENTER", "NecrosisBuffMenu"..BuffButtonPosition, "CENTER", ((36 / NecrosisConfig.BuffMenuPos) * 31), 0); |
||
2745 | BuffButtonPosition = 4; |
||
2746 | table.insert(BuffMenuCreate, menuVariable); |
||
2747 | end |
||
2748 | -- Si l'invocation de joueur existe, on affiche le bouton dans le menu des buffs |
||
2749 | if NECROSIS_SPELL_TABLE[37].ID then |
||
2750 | menuVariable = getglobal("NecrosisBuffMenu5"); |
||
2751 | menuVariable:ClearAllPoints(); |
||
2752 | menuVariable:SetPoint("CENTER", "NecrosisBuffMenu"..BuffButtonPosition, "CENTER", ((36 / NecrosisConfig.BuffMenuPos) * 31), 0); |
||
2753 | BuffButtonPosition = 5; |
||
2754 | table.insert(BuffMenuCreate, menuVariable); |
||
2755 | end |
||
2756 | -- Si le Radar à démon existe, on affiche le bouton dans le menu des buffs |
||
2757 | if NECROSIS_SPELL_TABLE[39].ID then |
||
2758 | menuVariable = getglobal("NecrosisBuffMenu6"); |
||
2759 | menuVariable:ClearAllPoints(); |
||
2760 | menuVariable:SetPoint("CENTER", "NecrosisBuffMenu"..BuffButtonPosition, "CENTER", ((36 / NecrosisConfig.BuffMenuPos) * 31), 0); |
||
2761 | BuffButtonPosition = 6; |
||
2762 | table.insert(BuffMenuCreate, menuVariable); |
||
2763 | end |
||
2764 | -- Si le Lien Spirituel existe, on affiche le bouton dans le menu des buffs |
||
2765 | if NECROSIS_SPELL_TABLE[38].ID then |
||
2766 | menuVariable = getglobal("NecrosisBuffMenu7"); |
||
2767 | menuVariable:ClearAllPoints(); |
||
2768 | menuVariable:SetPoint("CENTER", "NecrosisBuffMenu"..BuffButtonPosition, "CENTER", ((36 / NecrosisConfig.BuffMenuPos) * 31), 0); |
||
2769 | BuffButtonPosition = 7; |
||
2770 | table.insert(BuffMenuCreate, menuVariable); |
||
2771 | end |
||
2772 | -- Si la protection contre les ombres existe, on affiche le bouton dans le menu des buffs |
||
2773 | if NECROSIS_SPELL_TABLE[43].ID then |
||
2774 | menuVariable = getglobal("NecrosisBuffMenu8"); |
||
2775 | menuVariable:ClearAllPoints(); |
||
2776 | menuVariable:SetPoint("CENTER", "NecrosisBuffMenu"..BuffButtonPosition, "CENTER", ((36 / NecrosisConfig.BuffMenuPos) * 31), 0); |
||
2777 | BuffButtonPosition = 8; |
||
2778 | table.insert(BuffMenuCreate, menuVariable); |
||
2779 | end |
||
2780 | -- Si le banissement existe, on affiche le bouton dans le menu des buffs |
||
2781 | if NECROSIS_SPELL_TABLE[9].ID then |
||
2782 | menuVariable = getglobal("NecrosisBuffMenu9"); |
||
2783 | menuVariable:ClearAllPoints(); |
||
2784 | menuVariable:SetPoint("CENTER", "NecrosisBuffMenu"..BuffButtonPosition, "CENTER", ((36 / NecrosisConfig.BuffMenuPos) * 31), 0); |
||
2785 | BuffButtonPosition = 9; |
||
2786 | table.insert(BuffMenuCreate, menuVariable); |
||
2787 | end |
||
2788 | |||
2789 | -- Maintenant que tous les boutons de buff sont placés les uns à côté des autres (hors de l'écran), on affiche les disponibles |
||
2790 | for i = 1, table.getn(BuffMenuCreate), 1 do |
||
2791 | ShowUIPanel(BuffMenuCreate[i]); |
||
2792 | end |
||
2793 | |||
2794 | -- Si la Malédiction amplifiée existe, on affiche le bouton dans le menu des curses |
||
2795 | if NECROSIS_SPELL_TABLE[42].ID then |
||
2796 | menuVariable = getglobal("NecrosisCurseMenu1"); |
||
2797 | menuVariable:ClearAllPoints(); |
||
2798 | menuVariable:SetPoint("CENTER", "NecrosisCurseMenuButton", "CENTER", 3000, 3000); |
||
2799 | CurseButtonPosition = 1; |
||
2800 | table.insert(CurseMenuCreate, menuVariable); |
||
2801 | end |
||
2802 | -- Si la Malédiction de faiblesse existe, on affiche le bouton dans le menu des curses |
||
2803 | if NECROSIS_SPELL_TABLE[23].ID then |
||
2804 | menuVariable = getglobal("NecrosisCurseMenu2"); |
||
2805 | menuVariable:ClearAllPoints(); |
||
2806 | if CurseButtonPosition == 0 then |
||
2807 | menuVariable:SetPoint("CENTER", "NecrosisCurseMenuButton", "CENTER", 3000, 3000); |
||
2808 | else |
||
2809 | menuVariable:SetPoint("CENTER", "NecrosisCurseMenu"..CurseButtonPosition, "CENTER", ((36 / NecrosisConfig.CurseMenuPos) * 31), 0); |
||
2810 | end |
||
2811 | CurseButtonPosition = 2; |
||
2812 | table.insert(CurseMenuCreate, menuVariable); |
||
2813 | end |
||
2814 | -- Si la Malédiction d'agonie existe, on affiche le bouton dans le menu des curses |
||
2815 | if NECROSIS_SPELL_TABLE[22].ID then |
||
2816 | menuVariable = getglobal("NecrosisCurseMenu3"); |
||
2817 | menuVariable:ClearAllPoints(); |
||
2818 | if CurseButtonPosition == 0 then |
||
2819 | menuVariable:SetPoint("CENTER", "NecrosisCurseMenuButton", "CENTER", 3000, 3000); |
||
2820 | else |
||
2821 | menuVariable:SetPoint("CENTER", "NecrosisCurseMenu"..CurseButtonPosition, "CENTER", ((36 / NecrosisConfig.CurseMenuPos) * 31), 0); |
||
2822 | end |
||
2823 | CurseButtonPosition = 3; |
||
2824 | table.insert(CurseMenuCreate, menuVariable); |
||
2825 | end |
||
2826 | -- Si la Malédiction de témérité existe, on affiche le bouton dans le menu des curses (au plus haut rang) |
||
2827 | if NECROSIS_SPELL_TABLE[24].ID then |
||
2828 | menuVariable = getglobal("NecrosisCurseMenu4"); |
||
2829 | menuVariable:ClearAllPoints(); |
||
2830 | if CurseButtonPosition == 0 then |
||
2831 | menuVariable:SetPoint("CENTER", "NecrosisCurseMenuButton", "CENTER", 3000, 3000); |
||
2832 | else |
||
2833 | menuVariable:SetPoint("CENTER", "NecrosisCurseMenu"..CurseButtonPosition, "CENTER", ((36 / NecrosisConfig.CurseMenuPos) * 31), 0); |
||
2834 | end |
||
2835 | CurseButtonPosition = 4; |
||
2836 | table.insert(CurseMenuCreate, menuVariable); |
||
2837 | end |
||
2838 | -- Si la Malédiction des languages existe, on affiche le bouton dans le menu des curses |
||
2839 | if NECROSIS_SPELL_TABLE[25].ID then |
||
2840 | menuVariable = getglobal("NecrosisCurseMenu5"); |
||
2841 | menuVariable:ClearAllPoints(); |
||
2842 | if CurseButtonPosition == 0 then |
||
2843 | menuVariable:SetPoint("CENTER", "NecrosisCurseMenuButton", "CENTER", 3000, 3000); |
||
2844 | else |
||
2845 | menuVariable:SetPoint("CENTER", "NecrosisCurseMenu"..CurseButtonPosition, "CENTER", ((36 / NecrosisConfig.CurseMenuPos) * 31), 0); |
||
2846 | end |
||
2847 | CurseButtonPosition = 5; |
||
2848 | table.insert(CurseMenuCreate, menuVariable); |
||
2849 | end |
||
2850 | -- Si la Malédiction de fatigue existe, on affiche le bouton dans le menu des curses |
||
2851 | if NECROSIS_SPELL_TABLE[40].ID then |
||
2852 | menuVariable = getglobal("NecrosisCurseMenu6"); |
||
2853 | menuVariable:ClearAllPoints(); |
||
2854 | if CurseButtonPosition == 0 then |
||
2855 | menuVariable:SetPoint("CENTER", "NecrosisCurseMenuButton", "CENTER", 3000, 3000); |
||
2856 | else |
||
2857 | menuVariable:SetPoint("CENTER", "NecrosisCurseMenu"..CurseButtonPosition, "CENTER", ((36 / NecrosisConfig.CurseMenuPos) * 31), 0); |
||
2858 | end |
||
2859 | CurseButtonPosition = 6; |
||
2860 | table.insert(CurseMenuCreate, menuVariable); |
||
2861 | end |
||
2862 | -- Si la Malédiction des éléments existe, on affiche le bouton dans le menu des curses |
||
2863 | if NECROSIS_SPELL_TABLE[26].ID then |
||
2864 | menuVariable = getglobal("NecrosisCurseMenu7"); |
||
2865 | menuVariable:ClearAllPoints(); |
||
2866 | if CurseButtonPosition == 0 then |
||
2867 | menuVariable:SetPoint("CENTER", "NecrosisCurseMenuButton", "CENTER", 3000, 3000); |
||
2868 | else |
||
2869 | menuVariable:SetPoint("CENTER", "NecrosisCurseMenu"..CurseButtonPosition, "CENTER", ((36 / NecrosisConfig.CurseMenuPos) * 31), 0); |
||
2870 | end |
||
2871 | CurseButtonPosition = 7; |
||
2872 | table.insert(CurseMenuCreate, menuVariable); |
||
2873 | end |
||
2874 | -- Si la Malédiction de l'ombre, on affiche le bouton dans le menu des curses |
||
2875 | if NECROSIS_SPELL_TABLE[27].ID then |
||
2876 | menuVariable = getglobal("NecrosisCurseMenu8"); |
||
2877 | menuVariable:ClearAllPoints(); |
||
2878 | if CurseButtonPosition == 0 then |
||
2879 | menuVariable:SetPoint("CENTER", "NecrosisCurseMenuButton", "CENTER", 3000, 3000); |
||
2880 | else |
||
2881 | menuVariable:SetPoint("CENTER", "NecrosisCurseMenu"..CurseButtonPosition, "CENTER", ((36 / NecrosisConfig.CurseMenuPos) * 31), 0); |
||
2882 | end |
||
2883 | CurseButtonPosition = 8; |
||
2884 | table.insert(CurseMenuCreate, menuVariable); |
||
2885 | end |
||
2886 | -- Si la Malédiction funeste existe, on affiche le bouton dans le menu des curses |
||
2887 | if NECROSIS_SPELL_TABLE[16].ID then |
||
2888 | menuVariable = getglobal("NecrosisCurseMenu9"); |
||
2889 | menuVariable:ClearAllPoints(); |
||
2890 | if CurseButtonPosition == 0 then |
||
2891 | menuVariable:SetPoint("CENTER", "NecrosisCurseMenuButton", "CENTER", 3000, 3000); |
||
2892 | else |
||
2893 | menuVariable:SetPoint("CENTER", "NecrosisCurseMenu"..CurseButtonPosition, "CENTER", ((36 / NecrosisConfig.CurseMenuPos) * 31), 0); |
||
2894 | end |
||
2895 | CurseButtonPosition = 9; |
||
2896 | table.insert(CurseMenuCreate, menuVariable); |
||
2897 | end |
||
2898 | |||
2899 | -- Maintenant que tous les boutons de curse sont placés les uns à côté des autres (hors de l'écran), on affiche les disponibles |
||
2900 | for i = 1, table.getn(CurseMenuCreate), 1 do |
||
2901 | ShowUIPanel(CurseMenuCreate[i]); |
||
2902 | end |
||
2903 | end |
||
2904 | |||
2905 | -- Gestion des casts du menu des buffs |
||
2906 | function Necrosis_BuffCast(type) |
||
2907 | local TargetEnemy = false; |
||
2908 | if (not (UnitIsFriend("player","target"))) and type ~= 9 then |
||
2909 | TargetUnit("player"); |
||
2910 | TargetEnemy = true; |
||
2911 | end |
||
2912 | -- Si le Démoniste possède la peau de démon mais pas l'armure démoniaque |
||
2913 | if not NECROSIS_SPELL_TABLE[type].ID then |
||
2914 | CastSpell(NECROSIS_SPELL_TABLE[36].ID, "spell"); |
||
2915 | else |
||
2916 | if (type ~= 44) or (type == 44 and UnitExists("Pet")) then |
||
2917 | CastSpell(NECROSIS_SPELL_TABLE[type].ID, "spell"); |
||
2918 | end |
||
2919 | end |
||
2920 | LastBuff = type; |
||
2921 | if TargetEnemy then TargetLastTarget(); end |
||
2922 | AlphaBuffMenu = 1; |
||
2923 | AlphaBuffVar = GetTime() + 3; |
||
2924 | end |
||
2925 | |||
2926 | -- Gestion des casts du menu des curses |
||
2927 | function Necrosis_CurseCast(type, click) |
||
2928 | if (UnitIsFriend("player","target")) then |
||
2929 | AssistUnit("target"); |
||
2930 | end |
||
2931 | if (not (UnitIsFriend("player","target"))) and (UnitName("Target") ~= nil) then |
||
2932 | if (type == 23 or type == 22 or type == 40) then |
||
2933 | if (click == "RightButton") and (NECROSIS_SPELL_TABLE[42].ID ~= nil) then |
||
2934 | local start3, duration3 = GetSpellCooldown(NECROSIS_SPELL_TABLE[42].ID, "spell"); |
||
2935 | if not (start3 > 0 and duration3 > 0) then |
||
2936 | CastSpell(NECROSIS_SPELL_TABLE[42].ID, "spell"); |
||
2937 | SpellStopCasting(NECROSIS_SPELL_TABLE[42].Name); |
||
2938 | end |
||
2939 | end |
||
2940 | end |
||
2941 | CastSpell(NECROSIS_SPELL_TABLE[type].ID, "spell"); |
||
2942 | LastCurse = type; |
||
2943 | if (click == "MiddleButton") and (UnitExists("Pet")) then |
||
2944 | PetAttack(); |
||
2945 | end |
||
2946 | end |
||
2947 | AlphaCurseMenu = 1; |
||
2948 | AlphaCurseVar = GetTime() + 3; |
||
2949 | end |
||
2950 | |||
2951 | -- Gestion des casts du menu des démons |
||
2952 | function Necrosis_PetCast(type, click) |
||
2953 | if type == 8 and InfernalStone == 0 then |
||
2954 | Necrosis_Msg(NECROSIS_MESSAGE.Error.InfernalStoneNotPresent, "USER"); |
||
2955 | return; |
||
2956 | elseif type == 30 and DemoniacStone == 0 then |
||
2957 | Necrosis_Msg(NECROSIS_MESSAGE.Error.DemoniacStoneNotPresent, "USER"); |
||
2958 | return; |
||
2959 | elseif type ~= 15 and type ~= 3 and type ~= 8 and type ~= 30 and Soulshards == 0 then |
||
2960 | Necrosis_Msg(NECROSIS_MESSAGE.Error.SoulShardNotPresent, "USER"); |
||
2961 | return; |
||
2962 | end |
||
2963 | if (type == 3 or type == 4 or type == 5 or type == 6) then |
||
2964 | LastDemon = type; |
||
2965 | if (click == "RightButton") and (NECROSIS_SPELL_TABLE[15].ID ~= nil) then |
||
2966 | local start, duration = GetSpellCooldown(NECROSIS_SPELL_TABLE[15].ID, "spell"); |
||
2967 | if not (start > 0 and duration > 0) then |
||
2968 | CastSpell(NECROSIS_SPELL_TABLE[15].ID, "spell"); |
||
2969 | SpellStopCasting(NECROSIS_SPELL_TABLE[15].Name); |
||
2970 | end |
||
2971 | end |
||
2972 | if NecrosisConfig.DemonSummon and NecrosisConfig.ChatMsg and not NecrosisConfig.SM then |
||
2973 | if NecrosisConfig.PetName[(type - 2)] == " " and NECROSIS_PET_MESSAGE[5] then |
||
2974 | local tempnum = random(1, table.getn(NECROSIS_PET_MESSAGE[5])); |
||
2975 | while tempnum == PetMess and table.getn(NECROSIS_PET_MESSAGE[5]) >= 2 do |
||
2976 | tempnum = random(1, table.getn(NECROSIS_PET_MESSAGE[5])); |
||
2977 | end |
||
2978 | PetMess = tempnum; |
||
2979 | for i = 1, table.getn(NECROSIS_PET_MESSAGE[5][tempnum]) do |
||
2980 | Necrosis_Msg(Necrosis_MsgReplace(NECROSIS_PET_MESSAGE[5][tempnum][i]), "SAY"); |
||
2981 | end |
||
2982 | elseif NECROSIS_PET_MESSAGE[(type - 2)] then |
||
2983 | local tempnum = random(1, table.getn(NECROSIS_PET_MESSAGE[(type - 2)])); |
||
2984 | while tempnum == PetMess and table.getn(NECROSIS_PET_MESSAGE[(type - 2)]) >= 2 do |
||
2985 | tempnum = random(1, table.getn(NECROSIS_PET_MESSAGE[(type - 2)])); |
||
2986 | end |
||
2987 | PetMess = tempnum; |
||
2988 | for i = 1, table.getn(NECROSIS_PET_MESSAGE[(type - 2)][tempnum]) do |
||
2989 | Necrosis_Msg(Necrosis_MsgReplace(NECROSIS_PET_MESSAGE[(type - 2)][tempnum][i], nil , type - 2), "SAY"); |
||
2990 | end |
||
2991 | end |
||
2992 | end |
||
2993 | end |
||
2994 | CastSpell(NECROSIS_SPELL_TABLE[type].ID, "spell"); |
||
2995 | AlphaPetMenu = 1; |
||
2996 | AlphaPetVar = GetTime() + 3; |
||
2997 | end |
||
2998 | |||
2999 | -- Fonction permettant l'affichage des différentes pages du livre des configurations |
||
3000 | function NecrosisGeneralTab_OnClick(id) |
||
3001 | local TabName; |
||
3002 | for index=1, 5, 1 do |
||
3003 | TabName = getglobal("NecrosisGeneralTab"..index); |
||
3004 | if index == id then |
||
3005 | TabName:SetChecked(1); |
||
3006 | else |
||
3007 | TabName:SetChecked(nil); |
||
3008 | end |
||
3009 | end |
||
3010 | if id == 1 then |
||
3011 | ShowUIPanel(NecrosisShardMenu); |
||
3012 | HideUIPanel(NecrosisMessageMenu); |
||
3013 | HideUIPanel(NecrosisButtonMenu); |
||
3014 | HideUIPanel(NecrosisTimerMenu); |
||
3015 | HideUIPanel(NecrosisGraphOptionMenu); |
||
3016 | NecrosisGeneralIcon:SetTexture("Interface\\QuestFrame\\UI-QuestLog-BookIcon"); |
||
3017 | NecrosisGeneralPageText:SetText(NECROSIS_CONFIGURATION.Menu1); |
||
3018 | elseif id == 2 then |
||
3019 | HideUIPanel(NecrosisShardMenu); |
||
3020 | ShowUIPanel(NecrosisMessageMenu); |
||
3021 | HideUIPanel(NecrosisButtonMenu); |
||
3022 | HideUIPanel(NecrosisTimerMenu); |
||
3023 | HideUIPanel(NecrosisGraphOptionMenu); |
||
3024 | NecrosisGeneralIcon:SetTexture("Interface\\QuestFrame\\UI-QuestLog-BookIcon"); |
||
3025 | NecrosisGeneralPageText:SetText(NECROSIS_CONFIGURATION.Menu2); |
||
3026 | elseif id == 3 then |
||
3027 | HideUIPanel(NecrosisShardMenu); |
||
3028 | HideUIPanel(NecrosisMessageMenu); |
||
3029 | ShowUIPanel(NecrosisButtonMenu); |
||
3030 | HideUIPanel(NecrosisTimerMenu); |
||
3031 | HideUIPanel(NecrosisGraphOptionMenu); |
||
3032 | NecrosisGeneralIcon:SetTexture("Interface\\QuestFrame\\UI-QuestLog-BookIcon"); |
||
3033 | NecrosisGeneralPageText:SetText(NECROSIS_CONFIGURATION.Menu3); |
||
3034 | elseif id == 4 then |
||
3035 | HideUIPanel(NecrosisShardMenu); |
||
3036 | HideUIPanel(NecrosisMessageMenu); |
||
3037 | HideUIPanel(NecrosisButtonMenu); |
||
3038 | ShowUIPanel(NecrosisTimerMenu); |
||
3039 | HideUIPanel(NecrosisGraphOptionMenu); |
||
3040 | NecrosisGeneralIcon:SetTexture("Interface\\QuestFrame\\UI-QuestLog-BookIcon"); |
||
3041 | NecrosisGeneralPageText:SetText(NECROSIS_CONFIGURATION.Menu4); |
||
3042 | elseif id == 5 then |
||
3043 | HideUIPanel(NecrosisShardMenu); |
||
3044 | HideUIPanel(NecrosisMessageMenu); |
||
3045 | HideUIPanel(NecrosisButtonMenu); |
||
3046 | HideUIPanel(NecrosisTimerMenu); |
||
3047 | ShowUIPanel(NecrosisGraphOptionMenu); |
||
3048 | NecrosisGeneralIcon:SetTexture("Interface\\QuestFrame\\UI-QuestLog-BookIcon"); |
||
3049 | NecrosisGeneralPageText:SetText(NECROSIS_CONFIGURATION.Menu5); |
||
3050 | end |
||
3051 | end |
||
3052 | |||
3053 | |||
3054 | |||
3055 | -- Bon, pour pouvoir utiliser le Timer sur les sorts instants, j'ai été obligé de m'inspirer de Cosmos |
||
3056 | -- Comme je ne voulais pas rendre le mod dépendant de Sea, j'ai repris ses fonctions |
||
3057 | -- Apparemment, la version Stand-Alone de ShardTracker a fait pareil :) :) |
||
3058 | Necrosis_Hook = function (orig,new,type) |
||
3059 | if(not type) then type = "before"; end |
||
3060 | if(not Hx_Hooks) then Hx_Hooks = {}; end |
||
3061 | if(not Hx_Hooks[orig]) then |
||
3062 | Hx_Hooks[orig] = {}; Hx_Hooks[orig].before = {}; Hx_Hooks[orig].before.n = 0; Hx_Hooks[orig].after = {}; Hx_Hooks[orig].after.n = 0; Hx_Hooks[orig].hide = {}; Hx_Hooks[orig].hide.n = 0; Hx_Hooks[orig].replace = {}; Hx_Hooks[orig].replace.n = 0; Hx_Hooks[orig].orig = getglobal(orig); |
||
3063 | else |
||
3064 | for key,value in Hx_Hooks[orig][type] do if(value == getglobal(new)) then return; end end |
||
3065 | end |
||
3066 | Necrosis_Push(Hx_Hooks[orig][type],getglobal(new)); setglobal(orig,function(...) Necrosis_HookHandler(orig,arg); end); |
||
3067 | end |
||
3068 | |||
3069 | Necrosis_HookHandler = function (name,arg) |
||
3070 | local called = false; local continue = true; local retval; |
||
3071 | for key,value in Hx_Hooks[name].hide do |
||
3072 | if(type(value) == "function") then if(not value(unpack(arg))) then continue = false; end called = true; end |
||
3073 | end |
||
3074 | if(not continue) then return; end |
||
3075 | for key,value in Hx_Hooks[name].before do |
||
3076 | if(type(value) == "function") then value(unpack(arg)); called = true; end |
||
3077 | end |
||
3078 | continue = false; |
||
3079 | local replacedFunction = false; |
||
3080 | for key,value in Hx_Hooks[name].replace do |
||
3081 | if(type(value) == "function") then |
||
3082 | replacedFunction = true; if(value(unpack(arg))) then continue = true; end called = true; |
||
3083 | end |
||
3084 | end |
||
3085 | if(continue or (not replacedFunction)) then retval = Hx_Hooks[name].orig(unpack(arg)); end |
||
3086 | for key,value in Hx_Hooks[name].after do |
||
3087 | if(type(value) == "function") then value(unpack(arg)); called = true;end |
||
3088 | end |
||
3089 | if(not called) then setglobal(name,Hx_Hooks[name].orig); Hx_Hooks[name] = nil; end |
||
3090 | return retval; |
||
3091 | end |
||
3092 | |||
3093 | function Necrosis_Push (table,val) |
||
3094 | if(not table or not table.n) then return nil; end |
||
3095 | table.n = table.n+1; |
||
3096 | table[table.n] = val; |
||
3097 | end |
||
3098 | |||
3099 | function Necrosis_UseAction(id, number, onSelf) |
||
3100 | Necrosis_MoneyToggle(); |
||
3101 | NecrosisTooltip:SetAction(id); |
||
3102 | local tip = tostring(NecrosisTooltipTextLeft1:GetText()); |
||
3103 | if tip then |
||
3104 | SpellCastName = tip; |
||
3105 | SpellTargetName = UnitName("target"); |
||
3106 | if not SpellTargetName then |
||
3107 | SpellTargetName = ""; |
||
3108 | end |
||
3109 | SpellTargetLevel = UnitLevel("target"); |
||
3110 | if not SpellTargetLevel then |
||
3111 | SpellTargetLevel = ""; |
||
3112 | end |
||
3113 | end |
||
3114 | end |
||
3115 | |||
3116 | function Necrosis_CastSpell(spellId, spellbookTabNum) |
||
3117 | local Name, Rank = GetSpellName(spellId, spellbookTabNum); |
||
3118 | if Rank ~= nil then |
||
3119 | local _, _, Rank2 = string.find(Rank, "(%d+)"); |
||
3120 | SpellCastRank = tonumber(Rank2); |
||
3121 | end |
||
3122 | SpellCastName = Name; |
||
3123 | |||
3124 | SpellTargetName = UnitName("target"); |
||
3125 | if not SpellTargetName then |
||
3126 | SpellTargetName = ""; |
||
3127 | end |
||
3128 | SpellTargetLevel = UnitLevel("target"); |
||
3129 | if not SpellTargetLevel then |
||
3130 | SpellTargetLevel = ""; |
||
3131 | end |
||
3132 | end |
||
3133 | |||
3134 | function Necrosis_CastSpellByName(Spell) |
||
3135 | local _, _, Name = string.find(Spell, "(.+)%("); |
||
3136 | local _, _, Rank = string.find(Spell, "([%d]+)"); |
||
3137 | |||
3138 | if Rank ~= nil then |
||
3139 | local _, _, Rank2 = string.find(Rank, "(%d+)"); |
||
3140 | SpellCastRank = tonumber(Rank2); |
||
3141 | end |
||
3142 | |||
3143 | if not Name then |
||
3144 | _, _, Name = string.find(Spell, "(.+)"); |
||
3145 | end |
||
3146 | SpellCastName = Name; |
||
3147 | |||
3148 | SpellTargetName = UnitName("target"); |
||
3149 | if not SpellTargetName then |
||
3150 | SpellTargetName = ""; |
||
3151 | end |
||
3152 | SpellTargetLevel = UnitLevel("target"); |
||
3153 | if not SpellTargetLevel then |
||
3154 | SpellTargetLevel = ""; |
||
3155 | end |
||
3156 | end |
||
3157 | |||
3158 | function NecrosisTimer(nom, duree) |
||
3159 | local Cible = UnitName("target"); |
||
3160 | local Niveau = UnitLevel("target"); |
||
3161 | local truc = 6; |
||
3162 | if not Cible then |
||
3163 | Cible = ""; |
||
3164 | truc = 2; |
||
3165 | end |
||
3166 | if not Niveau then |
||
3167 | Niveau = ""; |
||
3168 | end |
||
3169 | |||
3170 | SpellGroup, SpellTimer, TimerTable = NecrosisTimerX(nom, duree, truc, Cible, Niveau, SpellGroup, SpellTimer, TimerTable); |
||
3171 | end |
||
3172 | |||
3173 | function NecrosisSpellCast(name) |
||
3174 | if string.find(name, "coa") then |
||
3175 | SpellCastName = NECROSIS_SPELL_TABLE[22].Name; |
||
3176 | SpellTargetName = UnitName("target"); |
||
3177 | if not SpellTargetName then |
||
3178 | SpellTargetName = ""; |
||
3179 | end |
||
3180 | SpellTargetLevel = UnitLevel("target"); |
||
3181 | if not SpellTargetLevel then |
||
3182 | SpellTargetLevel = ""; |
||
3183 | end |
||
3184 | CastSpell(NECROSIS_SPELL_TABLE[22].ID, "spell"); |
||
3185 | end |
||
3186 | end |