· 6 years ago · Nov 18, 2019, 11:10 PM
1 -- WoW Classic - Battlecry Generator
2 local Version = "2.21";
3 local Client = "(Alpha)"
4 -- By Mahtrok
5 -- mahtrok@mahtrok.info
6 -- 11-19-2019
7
8 -- ##################################################################################################################
9
10 -- ChangeLog 2.21:
11 --
12 -- New localization method in testing. -> Not yet debugged!
13 -- Added Hunter spells.
14 -- Added local chance settings to all existing class-spells.
15 -- Added additional spells to all existing classes.
16
17 -- ##################################################################################################################
18
19 -- What is BattleCry Generator?
20
21 -- Custom BattleCry Generator. Cries out specific phrases, defined either inside this code here, or added ingame,
22 -- whenever specific combat events happen, depending on the type of spell used, or the current combat action.
23 -- The goal of this addon is in-combat-roleplay, NOT to annoy the people you play with. Therefor the selection
24 -- of cries shouldn't be too small, while the cry chances shouldn't be too high. I suggest, using a global
25 -- cry chance not greater then 5-10% and around 10-20 cries per spell (larger selection is always a good thing).
26 -- You might define a local cry chance to any spell table, by adding ["Chance"] = xy; as the first line.
27 -- Spells that are not used that often, could then trigger a cry with a higher chance, then other spells/events,
28 -- that are happening all the time and might annoy people arround you, faster.
29 -- For example: Battle shout of the Warrior could have 25-50% Chance, cause it happens about every 2 minutes or so,
30 -- while SWING_DAMAGE should have arround 1-3%, because it happens ALL THE TIME in melee combat. a.s.o.
31
32 -- Supported classes:
33
34 -- At the moment, only Druid, Warrior, Rogue & Paladin classes are supported, for... reasons. More will be added,
35 -- once the generator engine runs as intended.
36
37
38 -- Editing Settings:
39
40 -- Scroll down to the code local defaultSettings = {} and change the values inside the table as you wish.
41 -- After changing the default settings inside this code, you MUST use '/bcg reset' ingame, to reload the settings.
42
43
44 -- Editing/Creating/Removing custom cries:
45
46 -- Ingame adding/removing/editing of cries is not yet implemented, but planned, later on.
47 -- At the moment, only in-code cries are supported. Scroll down and find the code: local cries = {}.
48 -- Search for the event or spell table inside the main table and change the cries or add new ones as strings.
49 -- Don't forget the , at the end!
50 -- ATTENTION: When editing cries inside this code, do NOT USE '%t' for target name! Instead, write 'targetName'
51 -- without the '' to your cry. It will then be replaced later, automatically with the actual '%t' value.
52 -- After changing the cry lists inside this code, you MUST use '/bcg dbreset' ingame, to reload the list completely,
53 -- or your changes will not be available.
54
55
56 -- Ingame command list:
57
58 -- /bcg Show options (and this list) default chatframe.
59 -- /bcg on Enable generator.
60 -- /bcg off Disable generator.
61 -- /bcg debug Toggle ingame debugger.
62 -- /bcg reset Reset settings to defaults. (Cry Chance, critical hit bonus, generator and debugger state.
63 -- /bcg dbreset Delete all custom cries and reset to default cries, offered in this code.
64 -- /bcg status Show ingame generator/debugger state info.
65
66 -- Language localizations currently supported: German, English.
67 -- Default cries language: German
68
69 -- ##################################################################################################################
70
71 -- This table is gonna be saved on program close, for all chars, it holds all available cries for all classes.
72 BattleCryDB = {};
73
74 -- This table is gonna be saved on program close, only for the current char, it holds this chars general settings.
75 BattleCryPerCharDB = {};
76
77 -- The default settings for BattleCry Generator are stored only for the current character.
78 local defaultSettings = {
79 Enabled = true,
80 Debugger = false,
81 Chance = 3,
82 CritBonus = 25
83 }
84
85 -- Runtime values
86 local playerClass = "";
87 local playerName = "";
88 local playerRace = "";
89 local targetName = "";
90 local mySpells = {};
91
92 -- All available cries.
93 local cries = {
94
95 ["GENERAL"] = {
96
97 ["ANY"] = {
98 ["Chance"] = 5,
99 "Aye!",
100 "Heureka!",
101 "Hervorragend.",
102 "Ahh, so geht das.",
103 "Besser geht's nich.",
104 "Aye, so macht man das.",
105 "Wusste doch, das klappt.",
106 },
107
108 ["SWING_DAMAGE"] = {
109 ["Chance"] = 5,
110 "Hoh!",
111 "Hah!",
112 "Heya!",
113 "He-he!",
114 "Ha-ha!",
115 "Ah-ha!",
116 "Erwischt!",
117 "Nimm' das!",
118 "Oink oink!",
119 "So sieht's aus!",
120 "Hier kommt der Schmerz!",
121 },
122
123 ["SWING_MISSED"] = {
124 ["Chance"] = 10,
125 "Mist!",
126 "Hoppla!",
127 "Bastard.",
128 "Verdammt!",
129 "Halt still!",
130 "Sportlich...",
131 "Wirst du wohl?!",
132 },
133
134 ["SWING_ABSORBED"] = {
135 ["Chance"] = 50,
136 "Oha!",
137 "Uhhhh!",
138 },
139
140 ["SWING_RESISTED"] = {
141 ["Chance"] = 100,
142 "Oha!",
143 "Uhhhh!",
144 },
145
146 ["SWING_BLOCKED"] = {
147 ["Chance"] = 50,
148 "Uhh!",
149 "Ouh!",
150 "Huh!",
151 "Urgh!",
152 "Bastard!",
153 "Drecksack!",
154 "Auf's Maul?!",
155 "Wirst du wohl?!",
156 },
157
158 ["RANGE_DAMAGE"] = {
159 ["Chance"] = 3,
160 "Jaawoll!",
161 "Treffer!",
162 "Bullseye!",
163 "Ins Schwarze!",
164 "Der hat gesessen!",
165 "Ich schieße scharf!",
166 "Genau ins Schwarze!",
167 "Zwischen die Augen!",
168 "Augen wie ein Adler!",
169 "Auf 200 Schritt, direkt zwischen die Augen!",
170 },
171
172 ["RANGE_MISSED"] = {
173 ["Chance"] = 10,
174 "Mist!",
175 "Bastard.",
176 "Daneben!",
177 "Verdammt!",
178 "Halt still!",
179 "Sportlich...",
180 "Wirst du wohl?!",
181 },
182
183 ["RANGE_ABSORBED"] = {
184 ["Chance"] = 50,
185 "Oha!",
186 "Uhhhh!",
187 },
188
189 ["RANGE_RESISTED"] = {
190 ["Chance"] = 50,
191 "Oha!",
192 "Uhhhh!",
193 },
194
195 ["RANGE_BLOCKED"] = {
196 ["Chance"] = 25,
197 "Uhh!",
198 "Ouh!",
199 "Huh!",
200 "Urgh!",
201 "Bastard!",
202 "Drecksack!",
203 "Auf's Maul?!",
204 "Wirst du wohl?!",
205 },
206
207 ["SPELL_MISSED"] = {
208 ["Chance"] = 10,
209 "Mist!",
210 "Daneben!",
211 "Verdammt!",
212 },
213
214 ["SPELL_ABSORBED"] = {
215 ["Chance"] = 10,
216 "Oha!",
217 "Uhhhh!",
218 },
219
220 ["SPELL_RESISTED"] = {
221 ["Chance"] = 10,
222 "Oha!",
223 "Uhhhh!",
224 },
225
226 ["SPELL_BLOCKED"] = {
227 ["Chance"] = 10,
228 "Uhh!",
229 "Ouh!",
230 "Huh!",
231 "Urgh!",
232 "Sowas!",
233 "Bastard!",
234 "Drecksack!",
235 "Auf's Maul?!",
236 "Wirst du wohl?!",
237 },
238
239 ["PARTY_KILL"] = {
240 ["Chance"] = 3,
241 "SIEEG!",
242 "Sonst noch wer?!",
243 "Ein weiterer Sieg!",
244 "Wer is der nächste?!",
245 "Wieder einer weniger!",
246 "Der zählt aber für mich!",
247 "Ein weiterer Sieg! War klar.",
248 "Wer hat noch nich, wer will noch mal?!",
249 },
250
251 ["SUBMERGED"] = {
252 "Mmmmmm blubb!",
253 "Blubb, blubb blubb!",
254 "Blubble, blubble!",
255 "Sprtzel, blubber blubb blubb!",
256 "Mmm, mmmmmh, blubb blubb, mmmh!",
257 "Blubber, blubb blubb mmmh blubber blörp!",
258 }
259
260 },
261
262 ["RACIAL"] = {
263
264 -- Dwarf
265 ["STONEFORM"] = {
266 ["Chance"] = 100,
267 "Irdene Macht!",
268 "Ich bin ein Fels!",
269 "Ich bin Steinhart!",
270 "Bei den Vorfahren!",
271 "Die Macht des Steins!",
272 "Die Macht der Irdenen!",
273 "Hier beißt du auf Granit!",
274 "An mir beißt du dir die Zähne aus!",
275 "Ich bin ein wahrhafter Sohn der Irdenen!",
276 "Ihr Irdenen und Vorfahren, helft mir mit eurer Kraft!",
277 },
278
279 -- Gnome
280 ["ESCAPE_ARTIST"] = {
281 "Und tschüss!",
282 "Haste gedacht!",
283 "Schwupps und weg."
284 },
285
286 -- Night elf
287 ["SHADOWMELD"] = {
288
289 },
290
291 -- Orc
292 ["BLOOD_FURY"] = {
293
294 },
295
296 -- Troll
297 ["BERSERKING"] = {
298
299 },
300
301 -- Tauren
302 ["WAR_STOMP"] = {
303
304 },
305
306 -- Undead 1
307 ["CANNIBALIZE"] = {
308
309 },
310
311 -- Undead 2
312 ["WILL_OF_THE_FORSAKEN"] = {
313
314 }
315
316 },
317
318 ["CLASS"] = {
319
320 -- Druide
321 ["DRUID"] = {
322
323 -- Vergiftung aufheben
324 ["ABOLISH_POISON"] = {
325 ["Chance"] = 3,
326 "Gift, weiche!",
327 "Nur die Dosis macht das Gift.",
328 "Auf die richtige Dosis kommt es an!"
329 },
330
331 -- Wucherwurzeln
332 ["ENTANGELING_ROOTS"] = {
333 ["Chance"] = 33,
334 "Bleib stehen!",
335 "Die Natur ist mit mir!",
336 "Cenarius, halte Sie auf!",
337 "Bis hier hin und nicht weiter!"
338 },
339
340 -- Feenfeuer
341 ["FAERIE_FIRE"] = {
342 ["Chance"] = 10,
343 "Brenne!",
344 "Ihr Feen, helft mir!",
345 "Deine Rüstung wird brennen!",
346 "Ihr Feen, leiht mir euer Feuer!",
347 "Ihr Feen, ich benötige euer Feuer!"
348 },
349
350 -- Heilende Berührung
351 ["HEALING_TOUCH"] = {
352 ["Chance"] = 2,
353 "Cenarius, heile diese Wunden.",
354 "Dein Leid möge vergessen sein.",
355 "Heile und entwachse dem Schmerz!",
356 "Die Natur wird dein Leid mindern."
357 },
358
359 -- Winterschlaf
360 ["HIBERNATE"] = {
361 ["Chance"] = 33,
362 "Schlafe!",
363 "Du wirst müde...",
364 "Und du schläfst ein...",
365 "Empfange den Schlaf...",
366 "Deine Augen werden schwer...",
367 "Schließe die Augen und schlafe."
368 },
369
370 -- Mal der Wildnis
371 ["MARK_OF_THE_WILD"] = {
372 ["Chance"] = 10,
373 "Geh mir der Kraft der Natur!",
374 "Empfange die Kräfte der Natur!",
375 "Geh mir der Kraft des Cenarius!"
376 },
377
378 -- Mondfeuer
379 ["MOONFIRE"] = {
380 ["Chance"] = 2,
381 "Cenarius Licht strafe dich!",
382 "Das Sternenlicht wird dich strafen!"
383 },
384
385 -- Wiedergeburt
386 ["REBIRTH"] = {
387 ["Chance"] = 33,
388 "Erstehe erneut!",
389 "Cenarius, errette diese Seele!",
390 "Cenarius, schenke uns deine Gunst!",
391 "Erwache und atme erneut die frische Luft!"
392 },
393
394 -- Nachwachsen
395 ["REGROTH"] = {
396 ["Chance"] = 2,
397 "Deine Kraft wird zurückkehren.",
398 "Empfange die Kraft des Cenarius!",
399 "Die Natur wird deine Wunden verschliessen."
400 },
401
402 -- Verjüngung
403 ["REJUVENATION"] = {
404 ["Chance"] = 2,
405 "Erhole dich.",
406 "Sammle Kraft."
407 },
408
409 -- Fluch aufheben
410 ["REMOVE_CURSE"] = {
411 ["Chance"] = 2,
412 "Der Fluch sei von dir Genommen.",
413 "Kein Fluch soll mehr Bestand haben!"
414 },
415
416 -- Tier besänftigen
417 ["SOOTH_ANIMAL"] = {
418 ["Chance"] = 100,
419 "Braaav.",
420 "Ruuuhig.",
421 "Bleibe ruhig.",
422 "Bleib Ruuuhig.",
423 "Wir sind keine Gefahr für dich."
424 },
425
426 -- Dornen
427 ["THORNS"] = {
428 ["Chance"] = 10,
429 "Die Natur sei dein Schild!",
430 "Die Natur wird dich schützen!",
431 "Dein Leid wird sein Leid sein!",
432 "Die Natur möge dein Schild sein!",
433 "Wer dir böses will, dem soll Schmerz widerfahren!"
434 },
435
436 -- Gelassenheit
437 ["TRANQUILITY"] = {
438 ["Chance"] = 25,
439 "Nur die Ruhe.",
440 "Nur mit der Ruhe.",
441 "Empfangt die Gelassenheit.",
442 "Keine Aufregung, nur Gelassenheit."
443 },
444
445 -- Zorn
446 ["WRATH"] = {
447 ["Chance"] = 2,
448 "Die Natur ist mit mir!",
449 "Spüre den Zorn des Cenarius!",
450 "Cenarius Zorn soll dich treffen!"
451 }
452
453 },
454
455 -- Jäger
456 ["HUNTER"] = {
457
458 ["CALL_PET"] = {
459 ["Chance"] = 100,
460 "Bei Fuß, petName!",
461 "Zeig dich, petName!",
462 "Komm raus, petName!",
463 },
464
465 ["DISMISS_PET"] = {
466 ["Chance"] = 100,
467 "Bis später, petName.",
468 "Ruh' dich aus, petName.",
469 "Wir sehen uns später, petName.",
470 },
471
472 ["FEED_PET"] = {
473 ["Chance"] = 33,
474 "Brav, petName.",
475 "Hier hast du was.",
476 "Hier, für dich, petName.",
477 "Lass es dir schmecken, petName",
478 },
479
480 ["FEIGN_DEATH"] = {
481 ["Chance"] = 100,
482 "Ahhhhrg!",
483 "Neeeeiiiiiiarg..!",
484 "Das war's für mich...",
485 "Ich. Steeerbe. Jetzt...",
486 "Adee du schnöde Weeeelt!",
487 "Dieser Schmeeeeerz...arg!",
488 "Nein, ich bin doch noch soo jung!",
489 "Ich. Hatte. Noch. So. Viel. Vor...",
490 },
491
492 ["HUNTERS_MARK"] = {
493 ["Chance"] = 33,
494 "Ziel erfasst.",
495 "targetName erfasst.",
496 "targetName im Visier!",
497 "Ich habe es im Visier!",
498 "targetName ist mein Ziel!",
499 },
500
501 ["REVIVE_PET"] = {
502 ["Chance"] = 3,
503 },
504
505 ["TAME_BEAST"] = {
506 ["Chance"] = 3,
507 },
508
509 },
510
511 -- Magier
512 ["MAGE"] = {
513
514 },
515
516 -- Paladin
517 ["PALADIN"] = {
518
519 -- Segen der Könige
520 ["BLESSING_OF_KINGS"] = {
521 ["Chance"] = 15,
522 "Die Könige segnen dich.",
523 "Geh mit dem Segen der Könige.",
524 "Der Segen der Könige erfülle dich."
525 },
526
527 -- Segen der Macht
528 ["BLESSING_OF_MIGHT"] = {
529 ["Chance"] = 15,
530 "Empfange die Macht des Lichts.",
531 "Die Macht des Lichts ist mit dir.",
532 "Sei gesegnet mit der Macht des Lichts.",
533 "Das Licht segne dich mit seiner Macht.",
534 "Geh mit der Macht, die das Licht schenkt.",
535 "Das Licht sei mit dir und schenke dir Macht."
536 },
537
538 -- Segen des Schutzes
539 ["BLESSING_OF_PROTECTION"] = {
540 ["Chance"] = 25,
541 "Licht, errette diese arme Seele.",
542 "Licht, beschütze diese arme Seele.",
543 "Das Licht möge deiner Seele gnädig sein!"
544 },
545
546 -- Segen der Rettung
547 ["BLESSING_OF_SALVATION"] = {
548 ["Chance"] = 25,
549 "Das Licht ist mit dir.",
550 "Das Licht verdeckt deine Absichten."
551 },
552
553 -- Segen der Weisheit
554 ["BLESSING_OF_WISDOM"] = {
555 ["Chance"] = 15,
556 "Spüre die Weisheit des Lichts.",
557 "Das Licht segne dich mit Weisheit.",
558 "Geh mit der Weisheit, die das Licht schenkt.",
559 "Das Licht sei mit dir und schenke dir Weisheit."
560 },
561
562 -- Göttlicher Schutz
563 ["DIVINE_PROTECTION"] = {
564 ["Chance"] = 10,
565 "Licht, beschütz mich!",
566 "Das Licht erfüllt mich!",
567 "Das Licht wacht über mich!",
568 "Licht, schütze deinen Diener."
569 },
570
571 -- Göttliches Eingreifen
572 ["DIVINE_INTERVENTION"] = {
573 ["Chance"] = 100,
574 "Nimm dieses Opfer und ahhhhh",
575 "Ich opfere mich, für die Allianz!",
576 "Nimm mein Leben und rette das Seine."
577 },
578
579 -- Exorzismus
580 ["EXORCISM"] = {
581 ["Chance"] = 3,
582 "Es werde Licht!",
583 "Weiche, Kreatur!",
584 "Klaatu, Verata, Nachahaha!",
585 "Zurück in die Schatten, targetName!",
586 "Das Licht wird dich bannen, targetName!",
587 "Das Licht wird dich richten, targetName!",
588 "Du hast hier nichts verloren, targetName!",
589 "Zurück in das Loch, aus dem du kamst!",
590 "Ich verbanne dich, zurück in die Schatten!"
591 },
592
593 -- Lichtblitz
594 ["FLASH_OF_LIGHT"] = {
595 ["Chance"] = 2,
596 "Halt durch!",
597 "Hilfe ist unterwegs!",
598 "Wird gleich wieder gut.",
599 "Heile, heile, Gänschen!",
600 "Gleich wirds kurz hell!",
601 "Achtung, es blitzt kurz.",
602 "Warte, ich rufe Hilfe! Ach, moment... Die bin ja ich."
603 },
604
605 -- Richturteil
606 ["JUDGEMENT"] = {
607 ["Chance"] = 2,
608 "Das Licht wird dich richten!",
609 "Schuldig, im Sinne der Anklage!",
610 "Ich bin dein Richter und Henker!",
611 "Das hohe Gericht hat entschieden: Tod!",
612 "Höre nun dein Urteil! Tod auf Bewährung!",
613 "Das hohe Gericht serviert heut Tiefschläge!",
614 "Du hast das Recht zu STERBEN! Ein für alle mal!",
615 "Empfange das Urteil: Tod im Sinne von ...naja, tot!"
616 },
617
618 -- Hammer der Gerechtigkeit
619 ["HAMMER_OF_JUSTICE"] = {
620 ["Chance"] = 15,
621 "Rumms!",
622 "Das gibt Kopfweh!",
623 "Gleich wirds dunkel!",
624 "Hier kommt der HAMMER!",
625 "Alles gute kommt von oben!"
626 },
627
628 -- Heiliges Licht
629 ["HOLY_LIGHT"] = {
630 ["Chance"] = 2,
631 "Heiliges Licht! Hilf uns!",
632 "Das heilige Licht ist mit dir!",
633 "Der Schmerz ist gleich vorbei.",
634 "Das heilige Licht gibt dir neue Kraft!",
635 "Heiliges Licht, errette diese Arme Seele!",
636 "Ist das deine Mils? Naja, ich bau sie erstmal wieder ein.",
637 "Da hängen ja schon die Gedärme raus, ich mach dich mal wieder zu."
638 },
639
640 -- Handauflegung
641 ["LAY_ON_HANDS"] = {
642 ["Chance"] = 100,
643 "Du stirbst heut' nich!",
644 "Hier wird nich' gestorben!",
645 "Nich, während meiner Wache!"
646 },
647
648 -- Läutern
649 ["PURIFY"] = {
650 ["Chance"] = 2,
651 "Ich nehme die Krankheit von dir!",
652 "Hier wird sich nich' krank gemeldet!",
653 "Verzage nicht, ich erlöse dich von dieser Krankheit."
654 },
655
656 -- Erlösung
657 ["REDEMPTION"] = {
658 ["Chance"] = 33,
659 "REANIMATION!",
660 "Reanimation! Das kann ich.",
661 "Das Licht erfülle dich erneut!",
662 "Empfange erneut das heilige Licht!",
663 "Stirb an einem anderen Tag, Freund.",
664 "Atme wieder die gute Luft mein Freund.",
665 "Kein Licht, kein Ton, ich komm' ja schon!"
666 },
667
668 -- Rechtschaffender Zorn
669 ["RIGHTEOUS_FURY"] = {
670 ["Chance"] = 100,
671 "Ich werde sie ablenken!",
672 "Ich werde euch beschützen!",
673 "Ich nehme ihren Zorn auf mich!"
674 },
675
676 -- Untote spüren
677 ["SENSE_UNDEAD"] = {
678 ["Chance"] = 100,
679 "Ich kann den Tod spüren!",
680 "Untote, ich kann Sie spüren.",
681 "Orks! Ah, ne, riecht nur so ähnlich.",
682 "Ich sehe untote Menschen...und anderes, was mir auch nich' richtig schmeckt."
683 }
684
685 },
686
687 -- Priester
688 ["PRIEST"] = {
689
690 },
691
692 -- Schurke
693 ["ROGUE"] = {
694
695 -- Hinterhalt
696 ["AMBUSH"] = {
697 ["Chance"] = 15,
698 "Ha-ha!",
699 "Erwischt!",
700 "Nimm das!",
701 "Da bin ich!",
702 "Überraschung!",
703 },
704
705 -- Entrinnen
706 ["EVASION"] = {
707 ["Chance"] = 100,
708 "1, 2, 3, Cha-Cha-Cha!",
709 "Tanzen wir eine Runde!",
710 "Mich triffst du nicht!",
711 "1, 2, 3, wieder vorbei!",
712 "Komm schon, zeig was du kannst!",
713 "Ich bin einfach zu schnell für dich!",
714 },
715
716 -- Finte
717 ["FEINT"] = {
718 ["Chance"] = 5,
719 "Kuck kuck!",
720 "War ich nicht!",
721 "Ich war's nicht!",
722 "Hier! Nein, hier!",
723 "Ich bin unschuldig!",
724 "Huch, Entschuldigung!",
725 "Rechts äh, links, äh ZACK!",
726 },
727
728 -- Tritt
729 ["KICK"] = {
730 ["Chance"] = 10,
731 "Ruhe!",
732 "Klappe!",
733 "Vergiss es!",
734 "Netter Versuch!",
735 "Bist du wohl ruhig!?",
736 "Hier wird nicht gezaubert!",
737 },
738
739 -- Nierenhieb
740 ["KIDNEY_SHOT"] = {
741 ["Chance"] = 10,
742 "Zack!",
743 "Und Haken!",
744 "Und jetzt der Haken!",
745 "Jetzt kommt der Schmerz!",
746 },
747
748 -- Schloss knacken
749 ["PICK_LOCK"] = {
750 ["Chance"] = 33,
751 "Kleinigkeit.",
752 "Kinderspiel.",
753 "Hab's gleich.",
754 "Gleich offen.",
755 "Zeig mal her...",
756 },
757
758 -- Verschwinden
759 ["VANISH"] = {
760 ["Chance"] = 100,
761 "Und weg.",
762 "Bis gleich.",
763 "Ich bin dann mal weg.",
764 "Ich verschwinde dann mal.",
765 "Jetzt siehst du mich...und jetzt nicht.",
766 "Was du nicht siehst, kannst du nicht bekämpfen.",
767 },
768
769 },
770
771 -- Schamane
772 ["SHAMAN"] = {
773
774 },
775
776 -- Krieger
777 ["WARRIOR"] = {
778
779 -- Schlachtruf
780 ["BATTLE_SHOUT"] = {
781 ["Chance"] = 100,
782 "Für Falstad!",
783 "Für Ironforge!",
784 "Für den König!",
785 "Für die Allianz",
786 "DER SIEG IST UNSER!",
787 "Für die Wildhammer!",
788 "Wir werden nicht wanken!",
789 "Für Bronzebart und Ironforge!",
790 "Für Falstad und die Wildhammer!",
791 },
792
793 -- Blutrausch
794 ["BLOODRAGE"] = {
795 ["Chance"] = 3,
796 "Roarrrr!",
797 "Aaaaargh!",
798 "Aggresssiooon!",
799 "Rrrrrraaaawww!",
800 "Ich bin sauer!",
801 "Aaargh, diese WUUUT!",
802 "Ich bin echt wütend!",
803 "Ne ordentliche Keilerei, wird auch Zeit!",
804 },
805
806 -- Berserkerwut
807 ["BERSERKER_RAGE"] = {
808 ["Chance"] = 3,
809 "Grooooarr!",
810 "Bluuuuuuuut!",
811 "Zeit auszurasten!",
812 "Bluuuutig, bluuutig halleluja!",
813 },
814
815 -- Sturmangriff
816 ["CHARGE"] = {
817 ["Chance"] = 15,
818 "ATTACKE!",
819 "Auf geht's!",
820 "Zum Angriff!",
821 "Und nu' zu uns!",
822 "Zwerg is daaaa!",
823 "Ich kooooommmmeee!",
824 "Damm-dadada-daaaaaaa!",
825 "Die ersten Zehn sind meine!",
826 "Die ersten 100 sind meine!",
827 "Bluuuutig, bluutig halleluja!",
828 },
829
830 -- Herausforderungsruf
831 ["CHALLENGING_SHOUT"] = {
832 ["Chance"] = 100,
833 "Kommt alle her!",
834 "Zu mir ihr Bastarde!",
835 "Hier spielt die Musik!",
836 "Ich nehm's mit euch allen auf!",
837 "Jeder kriegt was ab, versprochen!",
838 "Wer hat noch nich, wer will noch mal?!",
839 },
840
841 -- Entwaffnen
842 ["DISARM"] = {
843 ["Chance"] = 100,
844 "Her damit!",
845 "Zeig mal her, was hast'n da?!",
846 "Finger weg, von scharfen Sachen!",
847 "Gib' das her, sonst tust du dir noch weh!",
848 "Ich glaub' ich nehm das ma besser an mich!",
849 "Deine Mama hat dir doch verboten, damit zu spielen!",
850 "Schwerter, Kolben, Axt und Dolch, sind für dich nicht gut, du Strolch!",
851 },
852
853 -- Demoralisierungsruf
854 ["DEMORALIZING_SHOUT"] = {
855 ["Chance"] = 15,
856 "Oink, Oink!",
857 "Kommt nur her!",
858 "Wenig beeindruckend.",
859 "Spürt die irdene Kraft!",
860 "Ist das hier schon Alles?!",
861 "So, dann fangen wir mal an!",
862 "Die Vorfahren sind mit mir!",
863 "Endlich 'ne ordentliche Prügelei!",
864 "targetName? Was soll'n das sein?",
865 "targetName? Ich bin wenig beeindruckt.",
866 "targetName? Nie gehört, taugt wohl nix.",
867 "Nich dein Tag heute, targetName, sag ich dir gleich.",
868 "Ich hab' 'ne Posaune eingepflanzt un' es wurd' 'ne VUVUZELA!",
869 },
870
871 -- Hinrichten
872 ["EXECUTE"] = {
873 ["Chance"] = 25,
874 "Stirb!",
875 "Jetz' STIRB!",
876 "Und jetz' Stirb!",
877 "Fall. Endlich. Um!",
878 "Gleich ist's um dich geschehen!",
879 "Ich kann den Sieg schon schmecken!",
880 },
881
882 -- Drohruf
883 ["INTIMIDATING_SHOUT"] = {
884 ["Chance"] = 100,
885 "Buh!",
886 "Ahhh, Verstärkung!",
887 "Pfffffft. Huch, 'tschuldigung!",
888 "Kennst du den Witz vom Ork, der den Zwerg nach dem Weg fragte?",
889 },
890
891 -- Abfangen
892 ["INTERCEPT"] = {
893 ["Chance"] = 100,
894 "Kuck-kuck!",
895 "Hab ich dich!",
896 "Heyda, targetName!",
897 "Hiergeblieben, targetName!",
898 "Wo wollen wir denn so schnell hin?",
899 "Pfffffft. Mit dir war ich noch nich feritg!",
900 },
901
902 -- Letztes Gefecht
903 ["LAST_STAND"] = {
904 ["Chance"] = 100,
905 "Nicht so schnell!",
906 "Ich werde nicht fallen!",
907 "Ich werde nicht wanken!",
908 "Bis hier hin und nicht weiter!",
909 "So leicht mach' ich's dir nich!",
910 "So schnell wirst du mich nicht los!",
911 "Heute ist nicht der Tag, an dem ich sterbe!",
912 },
913
914 -- Heldenhafter Stoß
915 ["HEROIC_STRIKE"] = {
916 ["Chance"] = 3,
917 "Ha-ha!",
918 "Treffer!",
919 "Nimm das!",
920 "So geht das!",
921 "Hier kommt der Schmerz!",
922 },
923
924 -- Überwältigen
925 ["OVERPOWER"] = {
926 ["Chance"] = 25,
927 "Zack!",
928 "So nich!",
929 "Erwischt!",
930 "Dir zeig ich's!",
931 "Haste dir so gedacht!",
932 "So nicht, mein Freund!",
933 "Hier kommt der Schmerz!",
934 "Oink, Oink, targetName!",
935 "Hier kommt der Schmerz!",
936 "Na, wie schmeckt dir das?!",
937 "Haste gedacht, targetName!",
938 },
939
940 -- Zuschlagen
941 ["PUMMEL"] = {
942 ["Chance"] = 25,
943 "Bist du ruhig!",
944 "Nein, nein, nein!",
945 "Haste gedacht, targetName!",
946 "Pssst, targetName, Klappe!",
947 "Halt die Klappe, targetName!",
948 "Hier wird nich gezaubert, targetName!",
949 "Ich zauber dir gleich mal'n Ring um die Augen!",
950 },
951
952 -- Gegenschlag
953 ["RETALIATION"] = {
954 ["Chance"] = 100,
955 "Ha-ha-ha-ha-ha!",
956 "Lasst uns tanzen!",
957 "Je mehr desto besser!",
958 "Ist genug für Alle da!",
959 "Kommt nur her, jeder bekommt was ab!",
960 "Wer hat noch nich, wer will noch mal!",
961 },
962
963 -- Rache
964 ["REVENGE"] = {
965 ["Chance"] = 15,
966 "Zack!",
967 "So nich!",
968 "Erwischt!",
969 "Nich mit mir!",
970 "Dir zeig ich's!",
971 "Haste dir so gedacht!",
972 "So nicht, mein Freund!",
973 "Hier kommt der Schmerz!",
974 "Oink, Oink, targetName!",
975 "Hier kommt der Schmerz!",
976 "Haste gedacht, targetName!",
977 "Nich, solang ich noch atme!",
978 },
979
980 -- Schildhieb
981 ["SHIELD_BASH"] = {
982 ["Chance"] = 5,
983 "Bist du ruhig!",
984 "Nein, nein, nein!",
985 "Haste gedacht, targetName!",
986 "Pssst, targetName, Klappe!",
987 "Halt die Klappe, targetName!",
988 "Hier wird nich gezaubert, targetName!",
989 "Ich zauber dir gleich mal'n Ring um die Augen!",
990 },
991
992 -- Schildwall
993 ["SHIELD_WALL"] = {
994 ["Chance"] = 100,
995 "Schildwall!",
996 "Haltet Stand!",
997 "Verzagt nicht!",
998 "Endlich mal ein würdiger Gegner!",
999 "So leicht kommst du an mir nicht vorbei!",
1000 "Ein paar Tricks habe ich noch auf Lager!",
1001 },
1002
1003 -- Spott
1004 ["TAUNT"] = {
1005 ["Chance"] = 100,
1006 "He, Schweinenase?!",
1007 "Ich bin hier unten!",
1008 "Hier bin ich, targetName!",
1009 "Ich lache über dich, targetName!",
1010 "Du stinkst ganz schön, targetName!",
1011 "Wirst du wohl herkommen, targetName!?",
1012 "Hey targetName, hier gibts aufs Maul!",
1013 "Deine Nase passt mir nicht, targetName!",
1014 "Hey, targetName, deine Mutter lässt grüßen!",
1015 "Wir waren hier noch nich fertig, targetName!",
1016 "Mit dir bin ich noch nich fertig, targetName!",
1017 "Leg dich mit Jemand in deiner Größe an, targetName!",
1018 "Igitt, targetName, der Geruch deiner Füße ist unerträglich!",
1019 "Mein linker Zeh juckt und ich glaube DU hast Schuld, targetName!",
1020 }
1021
1022 },
1023
1024 -- Hexenmeister
1025 ["WARLOCK"] = {
1026
1027 }
1028
1029 }
1030
1031 }
1032
1033 -- Colors used to format the output text inside the ChatBox.
1034 local colors = {
1035 ["red"] = "|cffFF6969",
1036 ["orange"] = "|cffFFA369",
1037 ["yellow"] = "|cffFFEF2B",
1038 ["green"] = "|cff6BBD57",
1039 ["blue"] = "|cff4040F2";
1040 ["violet"] = "|cffBD6FBF",
1041 ["pink"] = "|cffFFB8F5",
1042 ["white"] = "|cffFFFFFF",
1043 ["gold"] = "|cffAD9E63",
1044 ["Druid"] = "|cffFFB04F",
1045 ["Hunter"] = "|cff8ECF63",
1046 ["Mage"] = "|cff80CAFF",
1047 ["Paladin"] = "|cffFAB6F7",
1048 ["Priest"] = "|cffFDFFFC",
1049 ["Rouge"] = "|cffFFEE03",
1050 ["Shaman"] = "|cff78F1FF",
1051 ["Warrior"] = "|cffCCB89B",
1052 ["Warlock"] = "|cffCA86DB"
1053 }
1054
1055 -- Create the main table for BattleCry Generator
1056 local BattleCryGenHud = BattleCryGenHud or {};
1057
1058 -- Create the frame that will be used for any events
1059 BattleCryGenHud.frame = CreateFrame("Frame", "BattleCryGenHud", UIParent);
1060 BattleCryGenHud.frame:SetFrameStrata("BACKGROUND");
1061
1062 -- Register all required events.
1063 BattleCryGenHud.frame:RegisterEvent("PLAYER_ENTERING_WORLD");
1064 BattleCryGenHud.frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
1065 BattleCryGenHud.frame:RegisterEvent("ADDON_LOADED");
1066
1067
1068 -- Fired, when the player has finally entered the world.
1069 function BattleCryGenHud.frame:PLAYER_ENTERING_WORLD(...)
1070 playerClass = translate(UnitClass("player"), 2); -- 1: CodeKey, 2: English, 3: German
1071 playerGUID = UnitGUID("player");
1072 playerName = UnitName("player");
1073 playerRace = translate(UnitRace("player"), 2); -- 1: CodeKey, 2: English, 3: German
1074
1075 if (playerClass ~= "Warrior") and (playerClass ~= "Paladin") and (playerClass ~= "Rogue") and (playerClass ~= "Druid") then
1076 BattleCryPerCharDB.Enabled = false;
1077 BattleCryPerCharDB.Debugger = false;
1078 Show_Msg (colors.gold .. "BattleCry Generator " .. colors.yellow .. "has been " .. colors.red .. "disabled" .. colors.yellow .. " for this character.");
1079 Show_Msg (colors.yellow .. "We're sorry, but your class " .. colors[playerClass] .. "[" .. playerClass .. "] " .. colors.yellow .. "is not yet supported!");
1080 else
1081 Show_Status();
1082 -- SETTINGs
1083 if (BattleCryPerCharDB ~= {}) then
1084 Show_Msg (colors.yellow .. "Settings loaded for" .. colors[inEnglish(playerClass)] .. " " .. playerName .. "" .. colors.yellow .. ".");
1085 else
1086 Show_Msg (colors.orange .. "Settings not found for" .. colors[inEnglish(playerClass)] .. " " .. playerName .. "" .. colors.orange .. ".");
1087 ResetSettings();
1088 end;
1089
1090 -- Store default cries
1091 if (BattleCryDB == {}) or (BattleCryDB == nil) then
1092 Show_Msg (colors.orange .. "Stored cries not found. Loading defaults.");
1093 BattleCryDB = copyTable (cries);
1094 else
1095 Show_Msg (colors.yellow .. "All cries loaded.");
1096 end;
1097
1098 local _classes = BattleCryDB["CLASS"];
1099 mySpells = _classes[playerClass];
1100 end;
1101 end
1102
1103 -- Fires on any event, non- or combat, registered by wow's combat log, from somewhere near the player.
1104 function BattleCryGenHud.frame:COMBAT_LOG_EVENT_UNFILTERED(...)
1105 -- If BattleCry Generator has been enabled and if the character is above water, otherwise, do nothing -> You can't cry with your lungs full of water.
1106 if (BattleCryPerCharDB.Enabled) then --and (IsSubmerged() == false) then
1107 -- Gather all event info required.
1108 local _, subevent, _, sourceGUID, sourceName, _, _, destGUID, destName, _, _ = CombatLogGetCurrentEventInfo();
1109 local spellId, spellName, spellSchool;
1110 local amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing, isOffHand;
1111 local chance = 0;
1112
1113 -- Check if the event should be ignored from the beginning.
1114 if (ignoreEvent(subevent) == false) then
1115 -- Check if the player or his actual target are involved, or a unit died... otherwise, ignore this event.
1116 if (sourceGUID == playerGUID) or (subevent == "PARTY_KILL") then
1117 -- Check if this is a non-spell MELEE or RANGE event?
1118 if(string.find(subevent, "SWING")) or (string.find(subevent, "RANGE")) or (subevent == "PARTY_KILL") then
1119 _, _, _, resisted, blocked, absorbed, critical, glancing, crushing, _ = select(12, CombatLogGetCurrentEventInfo());
1120 -- Non-spell event. Initialize spellName with empty string.
1121 spellName = subevent;
1122 -- Or is it a SPELL event?
1123 elseif(string.find(subevent, "SPELL")) then
1124 _, spellName, _, _, _, _, resisted, blocked, absorbed, critical, glancing, crushing, _ = select(12, CombatLogGetCurrentEventInfo());
1125 else
1126 -- It is neither SPELL, nor MELEE or RANGE event!
1127 if (BattleCryPerCharDB.Debugger) then Show_Msg (colors.orange .. ">> Event" .. colors.yellow .. " [" .. subevent .. "]" .. colors.orange .. " is neither SPELL, nor MELEE or RANGE!"); end;
1128 end;
1129
1130 -- Find the actual cry table for each spell/event, if there is one.
1131 local tble = GetCryTable ({subevent, spellName, destName});
1132
1133 -- Find actual cry chance for each spell/event, if there is one.
1134 if(tble ~= {}) then
1135 if(keyExists(tble, "Chance")) then
1136 chance = tble.Chance;
1137 if (BattleCryPerCharDB.Debugger) then Show_Msg (colors.yellow .. "Chance for [" .. spellName .. "] is ".. chance .. "%"); end;
1138 else
1139 chance = BattleCryPerCharDB.Chance;
1140 if (BattleCryPerCharDB.Debugger) then Show_Msg (colors.orange .. "Chance for" .. colors.yellow .. " [" .. spellName .. "]" .. colors.orange .. " not found! Using global cry chance: " .. BattleCryPerCharDB.Chance .. "%"); end;
1141 end;
1142 else
1143 if (BattleCryPerCharDB.Debugger) then Show_Msg (colors.red .. "Recieved empty table for" .. colors.yellow .. " [" .. spellName .. "]" .. colors.red .. "!"); end;
1144 end;
1145
1146 -- Now calculate chances for a cry to happen.
1147 local _rand = math.random( 100 );
1148
1149 if (BattleCryPerCharDB.Debugger) then Show_Msg (colors.blue .. "Rolled " .. _rand .. " against " .. (100-chance) .. " on " .. colors.yellow .. "[" .. spellName .. "]" .. colors.blue .. " from " .. sourceName .. "."); end;
1150
1151 -- If this was a critical hit, increase calculated cry chance by CritBonus from BattleCryPerCharDB settings.
1152 if (critical) then
1153 _rand = _rand + BattleCryPerCharDB.CritBonus;
1154 if (BattleCryPerCharDB.Debugger) then Show_Msg (colors.orange .. " Hit was a crit, so Chance for a cry was increased by " .. BattleCryPerCharDB.CritBonus .. " to " .. _rand .. "%"); end;
1155 end;
1156 -- If we hit the cry chance,...
1157 if (_rand >= 100-chance) then
1158 -- ...generate the cry.
1159 GenerateCry (tble);
1160 end;
1161 end;
1162 end;
1163 end;
1164 end
1165
1166 -- Returns the correct table to the actual subevent/spellName, if it exists.
1167 function GetCryTable (eventData)
1168 local subevent, spellName, destName = unpack(eventData);
1169 local tble = {};
1170
1171 -- Is this a spell action?
1172 if (spellName ~= nil) and (spellName ~= subevent) then
1173 -- Ensure that spellName is valid and not only some Number or spellId.
1174 if (string.len(spellName) > 3) then
1175 -- Try getting the cry from the characters, race specific, 'Racial' table.
1176 if (keyExists(BattleCryDB.Racial, translate(spellName, 1))) then
1177 tble = BattleCryDB.Racial[translate(spellName, 1)];
1178 if (BattleCryPerCharDB.Debugger) then Show_Msg (colors.green .. ">> Cry table found for" .. colors.yellow .. " [" .. spellName .. "]" .. colors.green .. " inside Racials."); end;
1179 -- Now try getting the cry from characters class specific 'mySpells' table.
1180 elseif (keyExists(mySpells, translate(spellName, 1))) then
1181 tble = mySpells[translate(spellName, 1)];
1182 if (BattleCryPerCharDB.Debugger) then Show_Msg (colors.green .. ">> Cry table found for" .. colors.yellow .. " [" .. spellName .. "]" .. colors.green .. " inside mySpells."); end;
1183 -- No table found!
1184 else
1185 if (BattleCryPerCharDB.Debugger) then Show_Msg (colors.red .. ">> No cry table found for" .. colors.yellow .. " [" .. spellName .. "]" .. colors.red .. "!"); end;
1186 end;
1187 end;
1188 -- It is a non-spell action.
1189 else
1190 -- Try getting the cry from the 'General' table by using the actual 'subevent' as lookup-key.
1191 if (keyExists(BattleCryDB.General, subevent)) then
1192 tble = BattleCryDB.General[subevent];
1193 -- subevent was no valid key, so use the 'Any' table.
1194 else
1195 tble = BattleCryDB.General["ANY"];
1196 end;
1197 end;
1198
1199 return tble;
1200 end
1201
1202 -- Sends the actual cry to the ChatBox, once the correct table was selected.
1203 function GenerateCry(tble)
1204 local chnl = "SAY";
1205 -- Replace active cry table with SUBMERGED if the character is under water.
1206 if (IsSubmerged()) then
1207 tble = BattleCryDB.General["SUBMERGED"];
1208 end;
1209 local tbleCnt = table.getn( tble );
1210
1211 -- There should be a non-empty table, else something went wrong.
1212 if(tble ~= nil) and (tble ~= {}) then
1213 -- Now select a random cry,...
1214 local _rand = math.random(table.getn( tble ));
1215 local _cry = tble[_rand];
1216
1217 -- Check if there is an actual cry.
1218 if (_cry ~= "") and (_cry ~= nil) then
1219 -- Check if the randomly selected cry uses the targetName.
1220 if (string.find(_cry, "targetName") or string.find(_cry, "%'targetName%'")) then
1221 -- Check if there IS an actual target.
1222 local tName = "";
1223
1224 if (UnitExists("target")) then
1225 if (BattleCryPerCharDB.Debugger) then Show_Msg (colors.green .. "Target: " .. UnitName("target")); end;
1226 tName = GetFirstOfStrg(UnitName("target"));
1227
1228 -- There is no target, but targetName should be used, try to use destName instead.
1229 elseif (destName ~= "") and (destName ~= nil) then
1230 if (BattleCryPerCharDB.Debugger) then Show_Msg (colors.red .. "Target: None"); end;
1231 tName = GetFirstOfStrg(destName);
1232 -- There is no actual target and also no destName, so delete the _cry.
1233 else
1234 _cry = nil;
1235 end;
1236
1237 -- Replace the targetName inside the cry with the actual target of the event/spell
1238 if(tName ~= "") then
1239 _cry = Replace(_cry, "'targetName'", tName);
1240 _cry = Replace(_cry, "targetName", tName);
1241 end;
1242 -- If selected cry requires a petName.
1243 elseif (string.find(_cry, "petName") or string.find(_cry, "%'petName%'")) then
1244 -- Check if there is an active pet.
1245 if (UnitExists("pet")) then
1246 if (BattleCryPerCharDB.Debugger) then Show_Msg (colors.green .. "Pet: " .. UnitName("pet")); end;
1247 _cry = Replace(_cry, "'petName'", UnitName("pet"));
1248 _cry = Replace(_cry, "petName", UnitName("pet"));
1249 else
1250 _cry = nil;
1251 end;
1252 end;
1253
1254 -- If cry has been deleted for whatever reason, don't send anything.
1255 if (_cry ~= nil) then
1256 -- Now send it to the selected chnl.
1257 SendChatMessage(_cry, chnl);
1258 end;
1259 end;
1260 else
1261 if (BattleCryPerCharDB.Debugger) then Show_Msg (colors.red .. ">> Cry table is empty!"); end;
1262 end;
1263 end
1264
1265 -- Replace the pattern inside the textIn with new
1266 function Replace (textIn, pattern, new)
1267 return textIn:gsub(pattern, new);
1268 end;
1269
1270 -- Recieved text command
1271 function TextCommand(_arg)
1272 -- Recieved command for turning Battlecry Generator on.
1273 if (string.lower(_arg) == "on") then
1274 BattleCryPerCharDB.Enabled = true;
1275 Show_Msg (colors.yellow .. "BattleCry Generator is now" .. colors.green .. " on" .. colors.yellow .. ".");
1276 -- Recieved command for turning Battlecry Generator off.
1277 elseif (string.lower(_arg) == "off") then
1278 BattleCryPerCharDB.Enabled = false;
1279 Show_Msg (colors.yellow .. "BattleCry Generator is now" .. colors.red .. " off" .. colors.yellow .. ".");
1280 -- Recieved command for turning Battlecry Generators Debugger on/off.
1281 elseif (string.lower(_arg) == "debug") then
1282 if (BattleCryPerCharDB.Debugger) then
1283 BattleCryPerCharDB.Debugger = false;
1284 Show_Msg (colors.yellow .. "BattleCry Debugger is now" .. colors.red .. " off" .. colors.yellow .. ".");
1285 else
1286 BattleCryPerCharDB.Debugger = true;
1287 Show_Msg (colors.yellow .. "BattleCry Debugger is now" .. colors.green .. " on" .. colors.yellow .. ".");
1288 end;
1289 -- Display status of BattleCry Generator on the ChatBox.
1290 elseif (string.lower(_arg) == "status") then
1291 Show_Status();
1292 elseif (string.lower(_arg) == "dbreset") then
1293 ResetDB();
1294 elseif (string.lower(_arg) == "reset") then
1295 ResetSettings();
1296 -- If anything else comes in, as a command, but is not valid, show the info again.
1297 else
1298 Show_Info();
1299 end;
1300 end
1301
1302 -- Restore default settings.
1303 function ResetSettings ()
1304 BattleCryPerCharDB = {};
1305
1306 if (BattleCryPerCharDB.Enabled == nil) then
1307 BattleCryPerCharDB.Enabled = defaultSettings.Enabled;
1308 end;
1309 if (BattleCryPerCharDB.Debugger == nil) then
1310 BattleCryPerCharDB.Debugger = defaultSettings.Debugger;
1311 end;
1312 if (BattleCryPerCharDB.Chance == nil) then
1313 BattleCryPerCharDB.Chance = defaultSettings.Chance;
1314 end;
1315 if (BattleCryPerCharDB.CritBonus == nil) then
1316 BattleCryPerCharDB.CritBonus = defaultSettings.CritBonus;
1317 end;
1318 Show_Msg (colors.orange .. "Stored BattleCry Generator settings deleted & reset to defaults.");
1319 Show_Status();
1320 end;
1321
1322 -- Reset all stored cries. ATTENTION! None of the ingame added cries will survive! Use with caution!
1323 function ResetDB ()
1324 BattleCryDB = {};
1325 BattleCryDB = copyTable (cries);
1326 Show_Msg (colors.red .. "All cries deleted from database and restored with defaults!");
1327 end
1328
1329 -- Copy a table with all its contents.
1330 function copyTable(source)
1331 local source_type = type(source)
1332 local dest
1333 if source_type == 'table' then
1334 dest = {}
1335 for source_key, source_value in next, source, nil do
1336 dest[copyTable(source_key)] = copyTable(source_value)
1337 end
1338 setmetatable(dest, copyTable(getmetatable(source)))
1339 else -- number, string, boolean, etc
1340 dest = source
1341 end
1342 return dest
1343 end
1344
1345 -- Ignores specific events, not supported or used (yet).
1346 function ignoreEvent(eventName)
1347 if (eventName == "-1") then
1348 return true;
1349 elseif (eventName == "SPELL_AURA_APPLIED") then
1350 return true;
1351 elseif (eventName == "SPELL_AURA_REMOVED") then
1352 return true;
1353 elseif (eventName == "SPELL_AURA_REFRESH") then
1354 return true;
1355 elseif (eventName == "ENCHANT_APPLIED") then
1356 return true;
1357 elseif (eventName == "ENCHANT_REMOVED") then
1358 return true;
1359 elseif (eventName == "SPELL_CAST_FAILED") then
1360 return true;
1361 elseif (eventName == "SPELL_PERIODIC_HEAL") then
1362 return true;
1363 elseif (eventName == "SPELL_ENERGIZE") then
1364 return true;
1365 elseif (eventName == "SPELL_PERIODIC_ENERGIZE") then
1366 return true;
1367 elseif (eventName == "SPELL_PERIODIC_DAMAGE") then
1368 return true;
1369 elseif (eventName == "DAMAGE_SHIELD") then
1370 return true;
1371 elseif (eventName == "ENVIRONMENTAL_DAMAGE") then
1372 return true;
1373 else
1374 return false;
1375 end;
1376 end;
1377
1378 local localization = {
1379 -- Classes
1380 -- [1]key , [2]Eng, [3]German
1381 {"DRUID" ,"Druid" ,"Druide" },
1382 {"HUNTER" ,"Hunter" ,"Jäger" },
1383 {"MAGE" ,"Mage" ,"Magier" },
1384 {"PALADIN" ,"Paladin" ,"Paladin" },
1385 {"PRIEST" ,"Priest" ,"Priester" },
1386 {"ROGUE" ,"Rogue" ,"Schurke" },
1387 {"SHAMAN" ,"Shaman" ,"Schamane" },
1388 {"WARRIOR" ,"Warrior" ,"Krieger" },
1389 {"WARLOCK" ,"Warlock" ,"Hexenmeister" },
1390
1391 -- Racial spells
1392 -- [1]key , [2]Eng, [3]German
1393 {"STONEFORM" ,"Stoneform" ,"Steingestalt" },
1394 {"ESCAPE_ARTIST" ,"Escape Artist" ,"Entfesselungskünstler" },
1395 {"SHADOWMELD" ,"Shadowmeld" ,"Schattenhaftigkeit" },
1396 {"BLOOD_FURY" ,"Blood Fury" ,"Kochendes Blut" },
1397 {"BERSERKING" ,"Berserking" ,"Berserker" },
1398 {"WAR_STOMP" ,"War Stomp" ,"Kriegsdonner" },
1399 {"CANNIBALIZE" ,"Cannibalize" ,"Kannibalismus" },
1400 {"WILL_OF_THE_FORSAKEN" ,"Will of the Forsaken" ,"Wille der Verlassenen" },
1401
1402 -- Druid spells
1403 -- [1]key , [2]Eng, [3]German
1404 {"ABOLISH_POISON" ,"Abolish Poison" ,"Vergiftung aufheben" },
1405 {"ENTANGELING_ROOTS" ,"Entangeling Roots" ,"Wucherwurzeln" },
1406 {"FAERIE_FIRE" ,"Faerie Fire" ,"Feenfeuer" },
1407 {"HEALING_TOUCH" ,"Healing Touch" ,"Heilende Berührung" },
1408 {"HIBERNATE" ,"Hibernate" ,"Kriegsdonner" },
1409 {"MARK_OF_THE_WILD" ,"Mark of the Wild" ,"Kochendes Blut" },
1410 {"MOONFIRE" ,"Moonfire" ,"Kannibalismus" },
1411 {"REBIRTH" ,"Rebirth" ,"Wiedergeburt" },
1412 {"REGROTH" ,"Regroth" ,"Nachwachsen" },
1413 {"REJUVENATION" ,"Rejuvenation" ,"Verjüngung" },
1414 {"REMOVE_CURSE" ,"Remove Curse" ,"Fluch aufheben" },
1415 {"SOOTH_ANIMAL" ,"Sooth Animal" ,"Tier besänftigen" },
1416 {"THORNS" ,"Thorns" ,"Dornen" },
1417 {"TRANQUILITY" ,"Tranquility" ,"Gelassenheit" },
1418 {"WRATH" ,"Wrath" ,"Zorn" },
1419
1420 -- Hunter spells
1421 -- [1]key , [2]Eng, [3]German
1422 {"FEIGN_DEATH" ,"Feign Death" ,"Totstellen" },
1423 {"TAME_BEAST" ,"Tame Beast" ,"Wildtier zähmen" },
1424 {"FEED_PET" ,"Feed Pet" ,"Tier füttern" },
1425 {"HUNTERS_MARK" ,"Hunter's Mark" ,"Mal des Jägers" },
1426 {"CALL_PET" ,"Call Pet" ,"Tier rufen" },
1427 {"DISMISS_PET" ,"Dismiss Pet" ,"Tier freigeben" },
1428 {"REVIVE_PET" ,"Revive Pet" ,"Tier wiederbeleben" },
1429
1430 -- Mage spells
1431 -- [1]key , [2]Eng, [3]German
1432
1433 -- Paladin spells
1434 -- [1]key , [2]Eng, [3]German
1435 {"BLESSING_OF_KINGS" ,"Blessing of Kings" ,"Segen der Könige" },
1436 {"BLESSING_OF_MIGHT" ,"Blessing of Might" ,"Segen der Macht" },
1437 {"BLESSING_OF_PROTECTION","Blessing of Protection" ,"Segen des Schutzes" },
1438 {"BLESSING_OF_SALVATION" ,"Blessing of Salvation" ,"Segen der Rettung" },
1439 {"BLESSING_OF_WISDOM" ,"Blessing of Wisdom" ,"Segen der Weisheit" },
1440 {"DIVINE_PROTECTION" ,"Divine Protection" ,"Göttlicher Schutz" },
1441 {"DIVINE_INTERVENTION" ,"Divine Intervention" ,"Göttliches Eingreifen" },
1442 {"EXORCISM" ,"Exorcism" ,"Exorzismus" },
1443 {"FLASH_OF_LIGHT" ,"Flash of Light" ,"Lichtblitz" },
1444 {"JUDGEMENT" ,"Judgement" ,"Richturteil" },
1445 {"HAMMER_OF_JUSTICE" ,"Hammer of Justice" ,"Hammer der Gerechtigkeit"},
1446 {"HOLY_LIGHT" ,"Holy Light" ,"Heiliges Licht" },
1447 {"LAY_ON_HANDS" ,"Lay on Hands" ,"Handauflegung" },
1448 {"PURIFY" ,"Purify" ,"Läutern" },
1449 {"REDEMPTION" ,"Redemption" ,"Erlösung" },
1450 {"RIGHTEOUS_FURY" ,"Righteous Fury" ,"Rechtschaffender Zorn" },
1451 {"SENSE_UNDEAD" ,"Sense Undead" ,"Untote spüren" },
1452
1453 -- Priest spells
1454 -- [1]key , [2]Eng, [3]German
1455
1456 -- Rogue spells
1457 -- [1]key , [2]Eng, [3]German
1458 {"AMBUSH" ,"Ambush" ,"Hinterhalt" },
1459 {"EVASION" ,"Evasion" ,"Entrinnen" },
1460 {"FEINT" ,"Feint" ,"Finte" },
1461 {"KICK" ,"Kick" ,"Tritt" },
1462 {"KIDNEY_SHOT" ,"Kidney Shot" ,"Nierenhieb" },
1463 {"PICK_LOCK" ,"Pick Lock" ,"Schloss knacken" },
1464 {"VANISH" ,"Vanish" ,"Verschwinden" },
1465
1466 -- Shaman spells
1467 -- [1]key , [2]Eng, [3]German
1468
1469 -- Warrior spells
1470 -- [1]key , [2]Eng, [3]German
1471 {"BATTLE_SHOUT" ,"Battle Shout" ,"Schlachtruf" },
1472 {"BLOODRAGE" ,"Bloodrage" ,"Blutrausch" },
1473 {"BERSERKER_RAGE" ,"Berserker Rage" ,"Berserkerwut" },
1474 {"CHARGE" ,"Charge" ,"Sturmangriff" },
1475 {"CHALLENGING_SHOUT" ,"Challenging Shout" ,"Herausforderungsruf" },
1476 {"DISARM" ,"Disarm" ,"Disarm" },
1477 {"DEMORALIZING_SHOUT" ,"Demoralizing Shout" ,"Demoralisierungsruf" },
1478 {"EXECUTE" ,"Execute" ,"Hinrichten" },
1479 {"INTIMIDATING_SHOUT" ,"Intimidating Shout" ,"Drohruf" },
1480 {"INTERCEPT" ,"Intercept" ,"Abfangen" },
1481 {"LAST_STAND" ,"Last Stand" ,"Letztes Gefecht" },
1482 {"HEROIC_STRIKE" ,"Heroic Strike" ,"Heldenhafter Stoß" },
1483 {"OVERPOWER" ,"Overpower" ,"Überwältigen" },
1484 {"PUMMEL" ,"Pummel" ,"Zuschlagen" },
1485 {"RETALIATION" ,"Retaliation" ,"Gegenschlag" },
1486 {"REVENGE" ,"Revenge" ,"Rache" },
1487 {"SHIELD_BASH" ,"Shield Bash" ,"Schildhieb" },
1488 {"SHIELD_BLOCK" ,"Shield Block" ,"Schildblock" },
1489 {"SHIELD_WALL" ,"Shield Wall" ,"Schildwall" },
1490 {"TAUNT" ,"Taunt" ,"Spott" },
1491
1492 -- Warlock spells
1493 -- [1]key , [2]Eng, [3]German
1494 }
1495
1496 -- Look-up whatever is passed-in and return its english translation, if it exists (and therefor matters).
1497 function translate(input, languageId)
1498 return deepSearch(localization, input, languageId);
1499 end
1500
1501 -- Search all tables & subtables for the passed-in input value.
1502 function deepSearch(tble, input, index)
1503 for key, value in pairs(tble) do
1504 -- If current table entry is again a table, look in THAT table for the passed-in input.
1505 if(type(value) == "table") do
1506 local dVal = deepSearch(value, input);
1507 if (string.lower(dVal) == string.lower(input)) then
1508 return dVal;
1509 end
1510 else
1511 -- If current table entry is the passed-in input value, return its english translation.
1512 if (string.lower(value) == string.lower(input)) then
1513 return tble[index];
1514 end
1515 end
1516 end
1517 -- If none has been found, return input unchanged.
1518 return input;
1519 end
1520
1521 -- Returns true, if the passed-in key exists inside the passed-in table set.
1522 function keyExists(set, key)
1523 return set[key] ~= nil
1524 end
1525
1526 -- Returns only the first strg of a longer strg (for exmpl. only the First NAME or TITLE of a mob, without the faction or other additional informations).
1527 function GetFirstOfStrg (str)
1528 local tbl = {}
1529 for substring in str:gmatch("%S+") do
1530 table.insert(tbl, substring)
1531 end
1532 return tbl[1] or "";
1533 end
1534
1535 -- Chat box debugger/printer
1536 function Show_Msg(_msg)
1537 if( DEFAULT_CHAT_FRAME ) then
1538 DEFAULT_CHAT_FRAME:AddMessage(_msg);
1539 end
1540 end
1541
1542 -- Displays the current status of BattleCry Generator on the ChatBox.
1543 function Show_Status()
1544 Show_Msg(colors.gold .. "BattleCry Generator " .. colors.white .. "" .. Version .. " " .. Client .. "" .. colors.yellow .. " - Status:");
1545
1546 local _state = colors.red .. "off";
1547 if (BattleCryPerCharDB.Enabled) then
1548 _state = colors.green .. "on";
1549 end;
1550
1551 Show_Msg(colors.yellow .. "Generator is " .. _state .. colors.yellow .. ".");
1552 if (BattleCryPerCharDB.Debugger) then
1553 _state = colors.green .. "on";
1554 else
1555 _state = colors.red .. "off";
1556 end;
1557 Show_Msg(colors.yellow .. "Debugger is " .. _state .. colors.yellow .. ".");
1558
1559 Show_Msg(colors.white .. "Welcome" .. colors[translate(playerClass, 2)] .. " " .. playerClass .. "" .. colors.white .. ".");
1560 Show_Msg(colors.white .. "The cry chance is " .. colors.orange .. "" .. BattleCryPerCharDB.Chance .. "" .. colors.white .. "% The critical hit bonus is " .. colors.orange .. "" .. BattleCryPerCharDB.CritBonus .. "" .. colors.white .. ".");
1561 Show_Msg(colors.white .. "To see the options menu, type" .. colors.green .. " /bcg" .. colors.white .. ".");
1562 end
1563
1564 -- Displays the tutorial/info for BattleCry Generator on the ChatBox.
1565 function Show_Info()
1566 Show_Msg(colors.gold .. "BattleCry Generator " .. colors.white .. "" .. Version .. " " .. Client .. "" .. colors.blue .. " " .. colors.yellow .. "Options:\n");
1567 Show_Msg(colors.white .. "/bcg status " .. colors.yellow .. " Show Status");
1568 Show_Msg(colors.white .. "/bcg debug " .. colors.yellow .. " Debugger On/Off");
1569 Show_Msg(colors.white .. "/bcg off " .. colors.red .. " Disable" .. colors.yellow .. " BattleCry Generator");
1570 Show_Msg(colors.white .. "/bcg on " .. colors.green .. " Enable" .. colors.yellow .. " BattleCry Generator");
1571 end
1572
1573 -- Override the OnEvent() method to dispatch events to our processing functions.
1574 BattleCryGenHud.frame:SetScript("OnEvent", function(self, event, ...) if self[event] then return self[event](self, ...) end end);
1575
1576 -- Slash command list
1577 SLASH_BCGEN1 = "/bcg";
1578 SLASH_BCGEN2 = "/bcgen";
1579 SlashCmdList["BCGEN"] = TextCommand;