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