· 6 years ago · Nov 11, 2019, 11:40 AM
1 -- WoW Classic - Battlecry Generator
2 -- Version 2.14 (Beta)
3
4 -- By Mahtrok
5 -- mahtrok@mahtrok.info
6 -- 11/11/2019
7
8 -- This table is gonna be saved on program close, for all chars, it holds all available cries for all classes.
9 BattleCryDB = {};
10
11 -- This table is gonna be saved on program close, only for the current char, it holds this chars general settings.
12 BattleCryPerCharDB = {};
13
14 -- The default settings for BattleCry Generator are stored only for the current character.
15 local defaultSettings = {
16 Enabled = true,
17 Debugger = true,
18 Chance = 10
19 }
20
21 -- Runtime values
22 local playerClass = "";
23 local playerName = "";
24 local playerRace = "";
25 local mySpells = {};
26
27 -- All available cries.
28 local cries = {
29
30 ["General"] = {
31
32 ["Any"] = {
33 "Ah-ha!"
34 },
35
36 ["SWING_DAMAGE"] = {
37 "Ha!",
38 "Ough!",
39 "Ah-ha!",
40 "He-he!"
41 },
42
43 ["SWING_MISSED"] = {
44 "Bastard.",
45 "Verdammt!",
46 "Halt still!",
47 "Sportlich...",
48 "Wirst du wohl?!"
49 },
50
51 ["SWING_ABSORBED"] = {
52 "Oha!",
53 "Uhhhh!"
54 },
55
56 ["SWING_RESISTED"] = {
57 "Oha!",
58 "Uhhhh!"
59 },
60
61 ["SWING_BLOCKED"] = {
62 "Uh!",
63 "Ouh!",
64 "Huh!",
65 "Urgh!",
66 "Bastard!",
67 "Drecksack!",
68 "Auf's Maul?!",
69 "Wirst du wohl?!"
70 },
71
72 ["RANGE_DAMAGE"] = {
73 "BAM!",
74 "Ouch!",
75 "Jawoll!",
76 "Treffer!",
77 "Nimm das!",
78 "Der hat gesessen!",
79 "Auf 200 Schritt, direkt zwischen die Augen!"
80 },
81
82 ["RANGE_MISSED"] = {
83 "Bastard.",
84 "Verdammt!",
85 "Halt still!",
86 "Sportlich...",
87 "Wirst du wohl?!"
88 },
89
90 ["RANGE_ABSORBED"] = {
91 "Oha!",
92 "Uhhhh!"
93 },
94
95 ["RANGE_RESISTED"] = {
96 "Oha!",
97 "Uhhhh!"
98 },
99
100 ["RANGE_BLOCKED"] = {
101 "Uh!",
102 "Ouh!",
103 "Huh!",
104 "Urgh!",
105 "Bastard!",
106 "Drecksack!",
107 "Auf's Maul?!",
108 "Wirst du wohl?!"
109 },
110
111 ["SPELL_MISSED"] = {
112 "Bastard.",
113 "Verdammt!",
114 "Halt still!",
115 "Sportlich...",
116 "Wirst du wohl?!"
117 },
118
119 ["SPELL_ABSORBED"] = {
120 "Oha!",
121 "Uhhhh!"
122 },
123
124 ["SPELL_RESISTED"] = {
125 "Oha!",
126 "Uhhhh!"
127 },
128
129 ["SPELL_BLOCKED"] = {
130 "Uh!",
131 "Ouh!",
132 "Huh!",
133 "Urgh!",
134 "Bastard!",
135 "Drecksack!",
136 "Auf's Maul?!",
137 "Wirst du wohl?!"
138 },
139
140 ["PARTY_KILL"] = {
141 "Ab in den Dreck!",
142 "Hatter nu' davon!",
143 "Wieder einer weniger!",
144 "Ein weiterer Sieg! Natürlich."
145 }
146
147 },
148
149 ["Racial"] = {
150
151 -- Dwarf
152 ["Stoneform"] = {
153 "Steinhart!",
154 "Die Macht des Steins!",
155 "An mir beißt du dir die Zähne aus!"
156 },
157
158 -- Gnome
159 ["Escape artist"] = {
160 "Und tschüss!",
161 "Haste gedacht!",
162 "Schwupps und weg."
163 },
164
165 -- Night elf
166 ["Shadowmeld"] = {
167
168 },
169
170 -- Orc
171 ["Blood Fury"] = {
172
173 },
174
175 -- Troll
176 ["Berserking"] = {
177
178 },
179
180 -- Tauren
181 ["War Stomp"] = {
182
183 },
184
185 -- Undead 1
186 ["Cannibalize"] = {
187
188 },
189
190 -- Undead 2
191 ["Will of the Forsaken"] = {
192
193 }
194
195 },
196
197 ["Druid"] = {
198
199 },
200
201 ["Hunter"] = {
202
203 },
204
205 ["Mage"] = {
206
207 },
208
209 ["Paladin"] = {
210
211 ["Blessing of kings"] = {
212 "Die Könige segnen dich.",
213 "Geh mit dem Segen der Könige.",
214 "Der Segen der Könige erfülle dich."
215 },
216
217 ["Blessing of might"] = {
218 "Empfange die Macht des Lichts.",
219 "Die Macht des Lichts ist mit dir.",
220 "Sei gesegnet mit der Macht des Lichts.",
221 "Das Licht segne dich mit seiner Macht.",
222 "Geh mit der Macht, die das Licht schenkt.",
223 "Das Licht sei mit dir und schenke dir Macht."
224 },
225
226 ["Blessing of protection"] = {
227 "Licht, errette diese arme Seele.",
228 "Licht, beschütze diese arme Seele.",
229 "Das Licht möge deiner Seele gnädig sein!"
230 },
231
232 ["Blessing of salvation"] = {
233 "Das Licht ist mit dir.",
234 "Das Licht verdeckt deine Absichten."
235 },
236
237 ["Blessing of wisdom"] = {
238 "Spüre die Weisheit des Lichts.",
239 "Das Licht segne dich mit Weisheit.",
240 "Geh mit der Weisheit, die das Licht schenkt.",
241 "Das Licht sei mit dir und schenke dir Weisheit."
242 },
243
244 ["Divine protection"] = {
245 "Licht, beschütz mich!",
246 "Das Licht erfüllt mich!",
247 "Das Licht wacht über mich!",
248 "Licht, schütze deinen Diener."
249 },
250
251 ["Divine intervention"] = {
252 "Nimm dieses Opfer und ahhhhh",
253 "Ich opfere mich, für die Allianz!",
254 "Nimm mein Leben und rette das Seine."
255 },
256
257 ["Exorcism"] = {
258 "Es werde Licht!",
259 "Weiche, Kreatur!",
260 "Klaatu, Verata, Nachahaha!",
261 "Zurück in die Schatten, %t!",
262 "Das Licht wird dich bannen, %t!",
263 "Das Licht wird dich richten, %t!",
264 "Du hast hier nichts verloren, %t!",
265 "Zurück in das Loch, aus dem du kamst!",
266 "Ich verbanne dich, zurück in die Schatten!"
267 },
268
269 ["Flash of light"] = {
270 "Halt durch!",
271 "Hilfe ist unterwegs!",
272 "Wird gleich wieder gut.",
273 "Heile, heile, Gänschen!",
274 "Gleich wirds kurz hell!",
275 "Achtung, es blitzt kurz.",
276 "Warte, ich rufe Hilfe! Ach, moment... Die bin ja ich."
277 },
278
279 ["Judgement"] = {
280 "Das Licht wird dich richten!",
281 "Schuldig, im Sinne der Anklage!",
282 "Ich bin dein Richter und Henker!",
283 "Das hohe Gericht hat entschieden: Tod!",
284 "Höre nun dein Urteil! Tod auf Bewährung!",
285 "Das hohe Gericht serviert heut Tiefschläge!",
286 "Du hast das Recht zu STERBEN! Ein für alle mal!",
287 "Empfange das Urteil: Tod im Sinne von ...naja, tot!"
288 },
289
290 ["Hammer of justice"] = {
291 "Rumms!",
292 "Das gibt Kopfweh!",
293 "Gleich wirds dunkel!",
294 "Hier kommt der HAMMER!",
295 "Alles gute kommt von oben!"
296 },
297
298 ["Holy light"] = {
299 "Heiliges Licht! Hilf uns!",
300 "Das heilige Licht ist mit dir!",
301 "Der Schmerz ist gleich vorbei.",
302 "Das heilige Licht gibt dir neue Kraft!",
303 "Heiliges Licht, errette diese Arme Seele!",
304 "Ist das deine Mils? Naja, ich bau sie erstmal wieder ein.",
305 "Da hängen ja schon die Gedärme raus, ich mach dich mal wieder zu."
306 },
307
308 ["Lay on hands"] = {
309 "Du stirbst heut' nich!",
310 "Hier wird nich' gestorben!",
311 "Nich, während meiner Wache!"
312 },
313
314 ["Purify"] = {
315 "Ich nehme die Krankheit von dir!",
316 "Hier wird sich nich' krank gemeldet!",
317 "Verzage nicht, ich erlöse dich von dieser Krankheit."
318 },
319
320 ["Redemption"] = {
321 "REANIMATION!",
322 "Reanimation! Das kann ich.",
323 "Das Licht erfülle dich erneut!",
324 "Empfange erneut das heilige Licht!",
325 "Stirb an einem anderen Tag, Freund.",
326 "Atme wieder die gute Luft mein Freund.",
327 "Kein Licht, kein Ton, ich komm' ja schon!"
328 },
329
330 ["Righteous fury"] = {
331 "Ich werde sie ablenken!",
332 "Ich werde euch beschützen!",
333 "Ich nehme ihren Zorn auf mich!"
334 },
335
336 ["Sense undead"] = {
337 "Ich kann den Tod spüren!",
338 "Untote, ich kann Sie spüren.",
339 "Orks! Ah, ne, riecht nur so ähnlich.",
340 "Ich sehe untote Menschen...und anderes, was mir auch nich' richtig schmeckt."
341 }
342
343 },
344
345 ["Priest"] = {
346
347 },
348
349 ["Rogue"] = {
350
351 },
352
353 ["Shaman"] = {
354
355 },
356
357 ["Warrior"] = {
358
359 ["Battle shout"] = {
360 "Für Falstad!",
361 "Für den König!",
362 "Für die Allianz",
363 "Für Eisenschmiede!",
364 "Für die Wildhammer!",
365 "Für Falstad und die Wildhammer!",
366 "Für Bronzebart und Eisenschmiede!"
367 },
368
369 ["Bloodrage"] = {
370 "Roarrrr!",
371 "Aaaaargh!",
372 "Aggresssiooon!",
373 "Rrrrrraaaawww!",
374 "Ich bin stinksauer!",
375 "Aaargh, diese WUUUT!",
376 "Ich bin echt wütend!",
377 playerRace.. " ist WÜÜÜTEND!",
378 "Ne ordentliche Keilerei, wird auch Zeit!"
379 },
380
381 ["Charge"] = {
382 "ATTACKE!",
383 "Zum Angriff!",
384 "Hier kommt der SCHMEEERZ!",
385 "Die ersten Zehn sind meine!"
386 },
387
388 ["Demoralizing shout"] = {
389 "Oink, Oink!",
390 "Kommt nur her!",
391 "Ist das hier schon Alles?!",
392 "Jeder kriegt was ab, versprochen!",
393 "Wer hat noch nich, wer will noch mal?!",
394 "Ich hab' 'ne Posaune eingepflanzt un' es wurd' 'ne VUVUZELA!"
395 },
396
397 ["Execute"] = {
398 "Stirb!",
399 "SCHMERZEN!",
400 "Jetz' STIRB!",
401 "Und jetz' Stirb!",
402 "Fall. Endlich. Um!"
403 },
404
405 ["Heroic strike"] = {
406 "Ha-ha!",
407 "Treffer!",
408 "Nimm das!",
409 "So geht das!",
410 "Hier kommt der Schmerz!"
411 },
412
413 ["Overpower"] = {
414 "Zack!",
415 "So nich!",
416 "Erwischt!",
417 "Oink Oink!"
418 },
419
420 ["Revenge"] = {
421 "Haha!",
422 "Ha-ha!",
423 "So nicht!",
424 "Dir zeig ich's!",
425 "Oink, Oink, %t!",
426 "Haste gedacht, %t!",
427 "So nicht, mein Freund!",
428 "Hier kommt der Schmerz!"
429 },
430
431 ["Shield bash"] = {
432 "BAM!",
433 "Bist du ruhig!",
434 "Nein, nein, nein!",
435 "Haste gedacht, %t!",
436 "Pssst, %t, Klappe!",
437 "Halt die Klappe, %t!",
438 "Hier wird nich gezaubert, %t!",
439 "Ich zauber dir gleich mal'n Ring um die Augen, %t!"
440 },
441
442 ["Taunt"] = {
443 "Hier bin ich, %t!",
444 "He, Schweinenase?!",
445 "Ich bin hier unten!",
446 "Ich lache über dich, %t!",
447 "Du stinkst ganz schön, %t!",
448 "Wirst du wohl herkommen, %t!?",
449 "Hey %t, hier gibts aufs Maul!",
450 "Deine Nase passt mir nicht, %t!",
451 "Hey, %t, deine Mutter lässt grüßen!",
452 "Wir waren hier noch nich fertig, %t!",
453 "Mit dir bin ich noch nich fertig, %t!",
454 "Leg dich mit Jemand in deiner Größe an, %t!",
455 "Igitt, %t, der Geruch deiner Füße ist unerträglich!",
456 "Mein linker Zeh juckt und ich glaube DU hast Schuld!"
457 }
458
459 },
460
461 ["Warlock"] = {
462
463 }
464
465 }
466
467 -- Colors used to format the output text inside the ChatBox.
468 local colors = {
469 ["red"] = "|cffFF6969",
470 ["orange"] = "|cffFFA369",
471 ["yellow"] = "|cffFFE169",
472 ["green"] = "|cff6BBD57",
473 ["blue"] = "|cff5799BD",
474 ["violet"] = "|cffBD6FBF",
475 ["pink"] = "|cffFFB8F5",
476 ["white"] = "|cffFFFFFF",
477 ["gold"] = "|cffAD9E63",
478 ["Druid"] = "|cffFFB04F",
479 ["Hunter"] = "|cff8ECF63",
480 ["Mage"] = "|cff80CAFF",
481 ["Paladin"] = "|cffFAB6F7",
482 ["Priest"] = "|cffFDFFFC",
483 ["Rouge"] = "|cffFFEE03",
484 ["Shaman"] = "|cff78F1FF",
485 ["Warrior"] = "|cffCCB89B",
486 ["Warlock"] = "|cffCA86DB"
487 }
488
489 -- Create the main table for BattleCry Generator
490 local BattleCryGenHud = BattleCryGenHud or {};
491
492 -- Create the frame that will be used for any events
493 BattleCryGenHud.frame = CreateFrame("Frame", "BattleCryGenHud", UIParent);
494 BattleCryGenHud.frame:SetFrameStrata("BACKGROUND");
495
496 -- Register all required events.
497 BattleCryGenHud.frame:RegisterEvent("PLAYER_ENTERING_WORLD");
498 BattleCryGenHud.frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
499 BattleCryGenHud.frame:RegisterEvent("ADDON_LOADED");
500
501 -- Fired, when the player has finally entered the world.
502 function BattleCryGenHud.frame:PLAYER_ENTERING_WORLD(...)
503 if (playerClass ~= "Warrior") and (playerClass ~= "Paladin") then
504 BattleCryPerCharDB.Enabled = false;
505 BattleCryPerCharDB.Debugger = false;
506 Show_Msg (colors.gold .. " We're sorry, but your class " .. colors[playerClass] .. "" .. playerClass .. "is not yet supported!");
507 Show_Msg (colors.gold .. " BattleCry Generator has been " .. colors.red .. "disabled" .. colors.gold .. " for this character.");
508 else
509 Show_Status();
510 end;
511 end
512
513 -- Fired, when SAVEDVARIABLES## are loaded and ready.
514 function BattleCryGenHud.frame:ADDON_LOADED(...)
515 playerClass = inEnglish("class", UnitClass("player"));
516 playerGUID = UnitGUID("player");
517 playerName = UnitName("player");
518 playerRace = inEnglish("race", UnitRace("player"));
519 mySpells = cries[playerClass];
520
521 -- SETTINGs
522 if (BattleCryPerCharDB ~= {}) then
523 Show_Msg (colors.gold .. " BattleCry Generator " .. colors.yellow .. "settings " .. colors.green .. "found" .. colors.yellow .. ", for " .. colors[inEnglish("class", playerClass)] .. "" .. playerName .. "" .. colors.yellow .. ".");
524 else
525 Show_Msg (colors.gold .. " BattleCry Generator " .. colors.yellow .. "settings " .. colors.red .. "not found" .. colors.yellow .. ", for " .. colors[inEnglish("class", playerClass)] .. "" .. playerName .. "" .. colors.yellow .. ".");
526 Reset();
527 end;
528 -- Load player specific cries for faster access.
529 end
530
531 -- Restore default settings.
532 function Reset ()
533 BattleCryDB = {};
534 BattleCryPerCharDB = {};
535
536 if (BattleCryPerCharDB.Enabled == nil) then
537 BattleCryPerCharDB.Enabled = defaultSettings.Enabled;
538 end;
539 if (BattleCryPerCharDB.Debugger == nil) then
540 BattleCryPerCharDB.Debugger = defaultSettings.Debugger;
541 end;
542 if (BattleCryPerCharDB.Chance == nil) then
543 BattleCryPerCharDB.Chance = defaultSettings.Chance;
544 end;
545 Show_Msg (colors.gold .. " Stored BattleCry Generator settings deleted & reset to defaults.");
546 Show_Status();
547 end;
548
549 -- Fires on any event, non- or combat, registered by wow's combat log, from somewhere near the player.
550 function BattleCryGenHud.frame:COMBAT_LOG_EVENT_UNFILTERED(...)
551 -- If BattleCry Generator has been enabled, otherwise, do nothing.
552 if (BattleCryPerCharDB.Enabled) then
553 local _, subevent, _, sourceGUID, _, _, _, destGUID, _, _, _ = CombatLogGetCurrentEventInfo();
554 if (Ignore(subevent) == false) then
555 -- Only cry, if player is involved, either as source or target of the event.
556 if (sourceGUID == playerGUID) or (destGUID == playerGUID) then
557 -- Randomize to decide wether a cry should be generated or not, depending on 100 - the global cry chance.
558 local _rand = math.random( 100 );
559 -- Did we hit the chance to cry?
560 if (_rand > 100-BattleCryPerCharDB.Chance) then
561 if (BattleCryPerCharDB.Debugger) then Show_Msg (colors.gold .. " I rolled" .. colors.green .. " " .. _rand .. "" .. colors.gold .. " against" .. colors.orange .. " " .. BattleCryPerCharDB.Chance .. "" .. colors.gold .. "% Chance, on subevent " .. colors.yellow .. subevent .. "" .. colors.gold .. "."); end;
562 -- Generate a cry.
563 GenerateCry(...);
564 -- We missed the chance to cry, so do nothing.
565 else
566 if (BattleCryPerCharDB.Debugger) then Show_Msg (colors.gold .. " I rolled" .. colors.red .. " " .. _rand .. "" .. colors.gold .. " against" .. colors.orange .. " " .. BattleCryPerCharDB.Chance .. "" .. colors.gold .. "% Chance, on subevent " .. colors.yellow .. subevent .. "" .. colors.gold .. "."); end;
567 end;
568 end;
569 end;
570 end;
571 end
572
573 -- Generates the actual cry.
574 function GenerateCry(...)
575 -- Get event info.
576 local _, subevent, _, sourceGUID, sourceName, _, _, destGUID, destName, _, _ = CombatLogGetCurrentEventInfo();
577 local chnl = "SAY";
578 local tble = {};
579 local tbleCnt = table.getn( tble );
580
581 -- Player acts towards anyone/thing, but himself.
582 if (sourceGUID == playerGUID) and (destGUID ~= playerGUID) then
583 local _, spellName, _, _, _, _, _, _, _, _, _, _, _ = select(12, CombatLogGetCurrentEventInfo());
584 -- Find the table, that contains the exact subevent or spellName.
585 if (BattleCryPerCharDB.Debugger) then Show_Msg (colors.gold .. " >> Looking for key" .. colors.yellow .. " " .. subevent .. "" .. colors.gold .. " in Generals."); end;
586 tble = cries.General[subevent] or {};
587 if (tble == {}) or (table.getn( tble ) <= 0) then
588 if (BattleCryPerCharDB.Debugger) then Show_Msg (colors.gold .. " >> Looking for key" .. colors.yellow .. " " .. spellName .. "" .. colors.gold .. " in Racials."); end;
589 tble = cries.Racial[inEnglish("racial", spellName)] or {};
590 if (tble == {}) or (table.getn( tble ) <= 0) then
591 if (BattleCryPerCharDB.Debugger) then Show_Msg (colors.gold .. " >> Looking for key" .. colors.yellow .. " " .. spellName .. "" .. colors.gold .. " in Spells."); end;
592 tble = mySpells[inEnglish("spell", spellName)] or {};
593 if (tble == {}) or (table.getn( tble ) <= 0) then
594 if (BattleCryPerCharDB.Debugger) then Show_Msg (colors.red .. " >> No key found in Spells."); end;
595 else
596 if (BattleCryPerCharDB.Debugger) then Show_Msg (colors.green .. " >> Key found in Spells!"); end;
597 end;
598 end;
599 end;
600
601 -- Anyone/thing arround acts towards the player.
602 elseif (destGUID == playerGUID) or (subevent == "PARTY_KILL") then
603 if (BattleCryPerCharDB.Debugger) then Show_Msg (colors.yellow .. " " .. sourceName .. "" .. colors.gold .. " acts."); end;
604 -- Find the table, that contains the exact subevent name.
605 if (keyExists(cries.General[subevent])) then
606 -- Found the correct table in General.
607 tble = cries.General[subevent];
608 else
609 if (BattleCryPerCharDB.Debugger) then Show_Msg (colors.red .. " >> No key for external event found."); end;
610 tble = {};
611 end;
612 end;
613
614 -- Randomize the actual cry & send it to ChatBox 'chnl', if a 'tble' has been found.
615 if(tble ~= nil) and (tble ~= {}) then
616 -- Valid tble found, now randomize selection.
617 local _rand = math.random(table.getn( tble ));
618 -- Send random cry, if there is one.
619 if (tble[_rand] ~= "") and (tble[_rand] ~= nil) then
620 SendChatMessage(tble[_rand], chnl);
621 end;
622 else
623 if (BattleCryPerCharDB.Debugger) then Show_Msg (colors.red .. " >> No cry table found, for event '" .. colors.yellow .. "" .. subevent .. "" .. colors.red .. "'."); end;
624 end;
625 end
626
627 -- Chat box debugger/printer
628 function Show_Msg(_msg)
629 if( DEFAULT_CHAT_FRAME ) then
630 DEFAULT_CHAT_FRAME:AddMessage(_msg);
631 end
632 end
633
634 -- Recieved text command
635 function cmdBCG(_arg)
636 -- Recieved command for turning Battlecry Generator on.
637 if (string.lower(_arg) == "on") then
638 BattleCryPerCharDB.Enabled = true;
639 Show_Msg (colors.gold .. " BattleCry Generator is now " .. colors.green .. "ON" .. colors.gold .. ".");
640 -- Recieved command for turning Battlecry Generator off.
641 elseif (string.lower(_arg) == "off") then
642 BattleCryPerCharDB.Enabled = false;
643 Show_Msg (colors.gold .. " BattleCry Generator is now " .. colors.red .. "OFF" .. colors.gold .. ".");
644 -- Recieved command for turning Battlecry Generators Debugger on/off.
645 elseif (string.lower(_arg) == "debug") then
646 if (BattleCryPerCharDB.Debugger) then
647 BattleCryPerCharDB.Debugger = false;
648 Show_Msg (colors.gold .. " BattleCry Debugger is now " .. colors.red .. "OFF" .. colors.gold .. ".");
649 else
650 BattleCryPerCharDB.Debugger = true;
651 Show_Msg (colors.gold .. " BattleCry Debugger is now " .. colors.green .. "ON" .. colors.gold .. ".");
652 end;
653 -- Display status of BattleCry Generator on the ChatBox.
654 elseif (string.lower(_arg) == "status") then
655 Show_Status();
656 elseif (string.lower(_arg) == "reset") then
657 Reset();
658 -- If anything else comes in, as a command, but is not valid, show the info again.
659 else
660 Show_Info();
661 end;
662 end
663
664 -- Ignores specific events.
665 function Ignore(eventName)
666 if (eventName == "SPELL_AURA_APPLIED") then
667 return true;
668 elseif (eventName == "SPELL_AURA_REMOVED") then
669 return true;
670 elseif (eventName == "SPELL_AURA_REFRESH") then
671 return true;
672 elseif (eventName == "SPELL_CAST_FAILED") then
673 return true;
674 elseif (eventName == "SPELL_PERIODIC_ENERGIZE") then
675 return true;
676 elseif (eventName == "DAMAGE_SHIELD") then
677 return true;
678 elseif (eventName == "ENVIRONMENTAL_DAMAGE") then
679 return true;
680 else
681 return false;
682 end;
683 end;
684
685 -- Returns the translated, equivalent value of the passed-in _arg, if known (and therefor relevant) from a localized game version.
686 function inEnglish(_loc, _arg)
687 if(string.lower(_loc) == "class") then
688 -- CLASS NAMES in english in german
689 if(string.lower(_arg) == "druid") or (string.lower(_arg) == "druide") then
690 return "Druid";
691 elseif(string.lower(_arg) == "hunter") or (string.lower(_arg) == "jäger") then
692 return "Hunter";
693 elseif(string.lower(_arg) == "mage") or (string.lower(_arg) == "magier") then
694 return "Mage";
695 elseif(string.lower(_arg) == "paladin") or (string.lower(_arg) == "paladin") then
696 return "Paladin";
697 elseif(string.lower(_arg) == "priest") or (string.lower(_arg) == "priester") then
698 return "Priest";
699 elseif(string.lower(_arg) == "shaman") or (string.lower(_arg) == "schamane") then
700 return "Shaman";
701 elseif(string.lower(_arg) == "warrior") or (string.lower(_arg) == "krieger") then
702 return "Warrior";
703 elseif(string.lower(_arg) == "warlock") or (string.lower(_arg) == "hexenmeister") then
704 return "Warlock";
705 end;
706 end;
707 if(string.lower(_loc) == "race") then
708 -- RACE NAMES in english in german
709 if(string.lower(_arg) == "gnome") or (string.lower(_arg) == "gnom") then
710 return "gnome";
711 elseif(string.lower(_arg) == "human") or (string.lower(_arg) == "mensch") then
712 return "human";
713 elseif(string.lower(_arg) == "dwarf") or (string.lower(_arg) == "zwerg") then
714 return "dwarf";
715 elseif(string.lower(_arg) == "night elf") or (string.lower(_arg) == "nachtelf") then
716 return "night elf";
717 elseif(string.lower(_arg) == "orc") or (string.lower(_arg) == "ork") then
718 return "orc";
719 elseif(string.lower(_arg) == "troll") or (string.lower(_arg) == "troll") then
720 return "troll";
721 elseif(string.lower(_arg) == "tauren") or (string.lower(_arg) == "taure") then
722 return "tauren";
723 elseif(string.lower(_arg) == "undead") or (string.lower(_arg) == "untoter") then
724 return "undead";
725 end;
726 end;
727 if(string.lower(_loc) == "racial") then
728 -- RACIAL SPELL NAMES in english in german
729 if(string.lower(_arg) == "escape artist") or (string.lower(_arg) == "entfesselungskünstler") then
730 return "Escape Artist";
731 elseif(string.lower(_arg) == "stoneform") or (string.lower(_arg) == "steingestalt") then
732 return "Stoneform";
733 elseif(string.lower(_arg) == "shadowmeld") or (string.lower(_arg) == "schattenhaftigkeit") then
734 return "Shadowmeld";
735 elseif(string.lower(_arg) == "blood fury") or (string.lower(_arg) == "kochendes blut") then
736 return "Blood Fury";
737 elseif(string.lower(_arg) == "berserking") or (string.lower(_arg) == "Berserker") then
738 return "Berserking";
739 elseif(string.lower(_arg) == "war stomp") or (string.lower(_arg) == "kriegsdonner") then
740 return "War Stomp";
741 elseif(string.lower(_arg) == "cannibalize") or (string.lower(_arg) == "kannibalismus") then
742 return "Cannibalize";
743 elseif(string.lower(_arg) == "will of the forsaken") or (string.lower(_arg) == "wille der verlassenen") then
744 return "Will of the Forsaken";
745 end;
746 end;
747 if(string.lower(_loc) == "spell") then
748 if (string.lower(playerClass) == "druid") then
749
750 end;
751 if (string.lower(playerClass) == "hunter") then
752
753 end;
754 if (string.lower(playerClass) == "mage") then
755
756 end;
757 if (string.lower(playerClass) == "paladin") then
758 -- PALADIN SPELL NAMES in english in german
759 if (string.lower(_arg) == "blessing of kings") or (string.lower(_arg) == "segen der könige") then
760 return "Blessing of kings";
761 elseif (string.lower(_arg) == "blessing of might") or (string.lower(_arg) == "segen der macht") then
762 return "Blessing of might";
763 elseif (string.lower(_arg) == "blessing of protection") or (string.lower(_arg) == "segen des schutzes") then
764 return "Blessing of protection";
765 elseif (string.lower(_arg) == "blessing of salvation") or (string.lower(_arg) == "segen der rettung") then
766 return "Blessing of salvation";
767 elseif (string.lower(_arg) == "blessing of wisdom") or (string.lower(_arg) == "segen der weisheit") then
768 return "Blessing of wisdom";
769 elseif (string.lower(_arg) == "divine protection") or (string.lower(_arg) == "göttlicher schutz") then
770 return "Divine protection";
771 elseif (string.lower(_arg) == "divine intervention") or (string.lower(_arg) == "göttliches eingreifen") then
772 return "Divine intervention";
773 elseif (string.lower(_arg) == "exorcism") or (string.lower(_arg) == "exorzismus") then
774 return "Exorcism";
775 elseif (string.lower(_arg) == "judgement") or (string.lower(_arg) == "richturteil") then
776 return "Judgement";
777 elseif (string.lower(_arg) == "flash of light") or (string.lower(_arg) == "lichtblitz") then
778 return "Flash of light";
779 elseif (string.lower(_arg) == "hammer of justice") or (string.lower(_arg) == "hammer der gerechtigkeit") then
780 return "Hammer of justice";
781 elseif (string.lower(_arg) == "holy light") or (string.lower(_arg) == "heiliges licht") then
782 return "Holy light";
783 elseif (string.lower(_arg) == "lay on hands") or (string.lower(_arg) == "handauflegung") then
784 return "Lay on hands";
785 elseif (string.lower(_arg) == "purify") or (string.lower(_arg) == "läutern") then
786 return "Purify";
787 elseif (string.lower(_arg) == "redemption") or (string.lower(_arg) == "auferstehung") then
788 return "Redemption";
789 elseif (string.lower(_arg) == "righteous fury") or (string.lower(_arg) == "zorn der gerechtigkeit") then
790 return "Righteous fury";
791 elseif (string.lower(_arg) == "sense undead") or (string.lower(_arg) == "untote aufspüren") then
792 return "Sense undead";
793 end;
794 end;
795 if (string.lower(playerClass) == "priest") then
796
797 end;
798 if (string.lower(playerClass) == "shaman") then
799
800 end;
801 if (string.lower(playerClass) == "warrior") then
802 -- WARRIOR SPELL NAMES in english in german
803 if (string.lower(_arg) == "battle shout") or (string.lower(_arg) == "schlachtruf") then
804 return "Battle shout";
805 elseif (string.lower(_arg) == "bloodrage") or (string.lower(_arg) == "blutrausch") then
806 return "Bloodrage";
807 elseif (string.lower(_arg) == "charge") or (string.lower(_arg) == "sturmangriff") then
808 return "Charge";
809 elseif (string.lower(_arg) == "demoralizing shout") or (string.lower(_arg) == "demoralisierungsruf") then
810 return "Demoralizing shout";
811 elseif (string.lower(_arg) == "execute") or (string.lower(_arg) == "hinrichten") then
812 return "Execute";
813 elseif (string.lower(_arg) == "heroic strike") or (string.lower(_arg) == "heldenhafter stoß") then
814 return "Heroic strike";
815 elseif (string.lower(_arg) == "overpower") or (string.lower(_arg) == "überwältigen") then
816 return "Overpower";
817 elseif (string.lower(_arg) == "revenge") or (string.lower(_arg) == "rache") then
818 return "Revenge";
819 elseif (string.lower(_arg) == "shield bash") or (string.lower(_arg) == "schildhieb") then
820 return "Shield bash";
821 elseif (string.lower(_arg) == "taunt") or (string.lower(_arg) == "spott") then
822 return "Taunt";
823 end;
824 end;
825 if (string.lower(playerClass) == "warlock") then
826
827 end;
828 end;
829 -- Return nil, if no valid value has been found until here.
830 return nil;
831 end
832
833 -- Returns true, if the passed-in key exists inside the passed-in table set.
834 function keyExists(set, key)
835 return set[key] ~= nil
836 end
837
838 -- Displays the current status of BattleCry Generator on the ChatBox.
839 function Show_Status()
840 Show_Msg(colors.gold.. " BattleCry Generator " .. colors.white .. "v2.13 (beta)" .. colors.gold .. " " .. colors.yellow .. "Status:\n");
841
842 local _state = colors.red .. "OFF";
843 if (BattleCryPerCharDB.Enabled) then
844 _state = colors.green .. "ON";
845 end;
846
847 Show_Msg(colors.yellow .. " Generator is turned " .. _state .. colors.yellow .. ".");
848 if (BattleCryPerCharDB.Debugger) then
849 _state = colors.green .. "ON";
850 else
851 _state = colors.red .. "OFF";
852 end;
853 Show_Msg(colors.yellow .. " Debugger is turned " .. _state .. colors.yellow .. ".");
854
855 Show_Msg(colors.gold .. " Welcome" .. colors[inEnglish("class", playerClass)] .. " " .. playerName .. "" .. colors.gold .. ", your cry chance is" .. colors.orange .. " " .. BattleCryPerCharDB.Chance .. "" .. colors.gold .. "%");
856 Show_Msg(colors.gold .. " To see the options menu, type" .. colors.green .. " /bcg" .. colors.gold .. ".");
857 end
858
859 -- Displays the tutorial/info for BattleCry Generator on the ChatBox.
860 function Show_Info()
861 Show_Msg(colors.gold .. " BattleCry Generator " .. colors.white .. "v2.13 (beta)" .. colors.gold .. " " .. colors.yellow .. "Options:\n");
862 Show_Msg(colors.white .. " /bcg status " .. colors.yellow .. " Show Status");
863 Show_Msg(colors.white .. " /bcg debug " .. colors.yellow .. " Debugger On/Off");
864 Show_Msg(colors.white .. " /bcg off " .. colors.red .. " Disable" .. colors.yellow .. " BattleCry Generator");
865 Show_Msg(colors.white .. " /bcg on " .. colors.green .. " Enable" .. colors.yellow .. " BattleCry Generator");
866 end
867
868 -- Override the OnEvent() method to dispatch events to our processing functions.
869 BattleCryGenHud.frame:SetScript("OnEvent", function(self, event, ...) if self[event] then return self[event](self, ...) end end);
870
871 -- Slash command list
872 SLASH_BCGEN1 = "/bcg";
873 SLASH_BCGEN2 = "/bcg2";
874 SlashCmdList["BCGEN"] = cmdBCG;