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