-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLVBM_API.lua
2782 lines (2561 loc) · 99.9 KB
/
LVBM_API.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- ----------------------------------------------------------------------------------------------------- --
-- La Vendetta Boss Mods AddOn by Destiny|Tandanu @ EU-Aegwynn. GUI by La Vendetta|Nitram @ EU-Azshara --
-- http://www.destiny-gilde.de http://www.deadlyminds.net --
-- ----------------------------------------------------------------------------------------------------- --
-- ------- --
-- Changes --
-- ------- --
--
-- v1.92
-- optimized BossTemplate API with field "MinVersionToSync" to prevent old Version Syncs
--
-- fixed some bar problems
-- fixed Four Horsemen AddOn (Mark problem with Bars)
-- fixed Grand Widow Faerlina out of Range Problem (now sync Enrage)
-- fixed some missing Localization Strings
-- fixed GUI first time scroll bug
--
-- updated Grand Widow Faerlina for deDE Client (enrage Detection timers)
-- updated Four Horsemen AddOn Meteor Code
-- updated AQ20 Anubisath Mod
-- updated Localizations
--
-- added Gui Option to disable Sync with old Clients
-- added Gui Option to Hide Playernames in Raidgroups
-- added API Option in BossTemplate to handle old Version Syncs
-- added Slashcommand \"/lv ver2\" which informs users with outdated versions
-- added Slashcommand \"/pull <x>\" (x = sec)
--
--
-- v1.91
--
-- creating new bars no longer sets the status bars color to default
-- fixed some minor bugs in the combat detection system
-- fixed a bug in the Loatheb healer rotation sync system with /loatheb undelete
-- fixed Sapphiron emote, Blizzard forgot %s in their emote string
-- fixed Kel'Thuzad combat detection bug
--
-- optimized status bar code -> reduced bar memory usage by ~30%, fixed memory leak bug in PullBarsTogether function
-- optimized Loatheb sync code -> reduced channel spam
-- players without (A) or (L) can now set a healer rotation for Loatheb, but their settings can't be broadcasted
-- you can now disable the "status" whisper command
-- changed default bar design
-- improved Sapphiron mod
-- improved Kel'Thuzad mod
-- updated BG mod, it now uses colored bars
-- updated chinese localization (thanks 2 DiabloHu)
--
-- added support for Lua 5.1 (Burning Crusade)
-- status bars will now flash when they are about to expire
-- status bars will now change their color over time
-- added french translation (only GUI and Blackwing Lair, more coming soon) (thanks 2 Proreborn)
--
--
-- v1.90
--
-- fixed Buru %s bug
-- fixed Huhuran %s Frenzy bug
-- fuxed Moam stone form detection
-- fixed Ossirian curse
-- fixed battleground 5vs0 timer
-- fixed InfoFrame UI scale positioning bug
-- fixed InfoFrame:Delete(), it now removes script handlers
-- fixed some minor InfoFrame bugs
-- fixed compatibility issues with chat addons, whispers will now be properly hidden
-- the Yauj fear timer can no longer be started by other mobs in AQ40
-- fixed some sync issues
--
-- InfoFrames now save their positions by their title
-- Pizzatimers will now show a warning 10 seconds before they expire
-- slightly adjusted Anub'Rekhan timers, changed messages for first Locust Swarm
-- adjusted Gluth's Decimate timer
-- changed Razuvious timers to use repeating status bars, this will fix issues after a wipe
--
-- Warsong Gulch InfoFrame added
-- added Four Horseman support
-- added Thaddius phase 1 support (Kick and Power Surge)
-- added Azuregos support (beta)
-- added Sapphiron support (beta)
-- added Kel'Thuzad support (beta)
-- added Geddon Inferno warning
-- added Loatheb Spore spawn timers
-- added bug explode warning to the Twin Emperor mod
-- added stats for Patchwerk fights (Hateful Strikes: x Hits: y Misses: z Dodges: blah...etc)
-- added option to remove healers from the Loatheb heal rotation frame by setting their sort ID to 0, use /loa undelete to undelete them
-- added OnStop handlers for boss mods, they will be called if the boss mod is stopped by a "stop all" sync command or by the "stop AddOn" button/slash command
-- added function LVBM.SendHiddenWhisper(msg, target) do send hidden whisper messages
-- added option to announce timers to your raid group by shift + left-clicking on the status bar
-- added combat detection system, this allows many combat related features, like the auto respond function. You will also see how long you were in combat in the chat frame :)
-- added "auto respond to whisper" function while fighting bosses (only enabled for whispers from players who are not in your raid group)
-- added OnCombatStart and OnCombatEnd handlers to all boss mods. Since they will be synced, they will allow more accurate and dependable timers for the first use of some abilities
-- added function LVBM.StartColoredStatusBarTimer() to create colored status bars, this color will overwrite the color set be the user, see API documentation for details
-- added more designs for status bars, see options menu and screenshots :)
--
--
--
-- v1.80
-- *** you need to restart your game after installing Vendetta Boss Mods 1.80 ***
-- fixed LVBM.Rank bug
-- fixed ZG/AQ20 bugs
-- fixed Onyxia
-- fixed Thaddius phase 2
-- fixed Gothik timer repetitions
-- fixed some minor bugs
--
-- updated Patchwerk boss mod
-- updated Thaddius boss mod
-- updated Noth boss mod
-- updated Anub boss mod
-- updated Faerlina boss mod
-- updated battleground mod
-- changed battleground timer sync channel from "RAID" to "BATTLEGROUND"
-- adjusted frenzy timers
--
-- added "C'Thun pulled" and C'Thun phase 2 sync commands, this will fix "timer adjustment failed" and missing special warnings for dark glare
-- added a range check frame to the C'Thun boss mod
-- added cool Loatheb boss mod (see screenshot!)
-- added Kri/Yauj/Vem mod
-- added Lethon/Taerar/Ysondre/Emeriss boss mod
-- added option to resize the status bars
-- added option to resize the special warnings
-- added german localization
-- added chinese localization (simplified chinese by Killerking, traditional chinese by hmj1026)
-- added function LVBM.UpdateStatusBarTimer(name[, elapsed, timer, newName, noBroadcast])
-- added functions to create frames, see "Information for AddOn Developers"
--
--
-- v1.71
-- fixed Ahn'Qiraj 20 mods
-- fixed Zul'Gurub mods
-- fixed 1.12 emote strings
-- fixed C'Thun phase 2 detection
--
-- added option to copy and paste the URL when a newer version is available
-- added option to unequip bows and guns before Nefarian's class call
-- added auto turn-in function for Alterac Valley
-- added option to hide the local and/or raid warning frame
-- changed shake default setting to disabled
--
--
-- v1.70
-- *** german localization for options and mc, zg and aq20 is missing...coming soon! ***
-- fixed Viscidus mod
-- fixed hunter feign death bug, PLAYER_REGEN_DISABLED will now be ignored if player is a hunter and has feigned death in the last 20 seconds
-- fixed CastSpellByName() bug
-- fixed many minor bugs
--
-- changed "special warning" default color to blue
-- adjusted Nefarian phase 2 timer
-- adjusted Anub'Rekhan timers
-- reduced sync channel spam
-- optimized code
-- redesigned options frame
--
-- added support for SendAddonMessage/CHAT_MSG_ADDON, removed sync channel!
-- added Molten Core boss mods
-- added AQ20 boss mods (beta!)
-- added Zul'Gurub boss mods (beta!)
-- added Fankriss boss mod
-- added Options to customize the local warning frame
-- added variable LVBM.Rank which always contains your current rank (0 = nothing, 1 = promoted, 2 = leader). This variable is updated on RAID_ROSTER_UPDATE
-- added aggro alert
-- added a range check...use /range to see who is more than 30 yards away
-- added frenzy timers
-- added special warning for Faerlina's enrage if the player is currently mind controlling one the Worshippers
-- added function LVBM_Gui_AddTab(instance, text) to add a new tab, removed old hardcoded tabs
-- added support for battlegrounds (by LeoLeal - thank you!)
-- added option to block healing spells while Nefarian's priest call is active
--
--
-- v1.60
-- fixed Huhuran mod
-- fixed C'Thun whisper spam, whispers will only be sent if announce is enabled
-- fixed Ouros emerge timer when standing too far away from the Dirt Mounds
-- fixed Chromaggus Fenzy bug xD
-- fixed a bug that stopped status bars while the UI was hidden or the map was shown
-- fixed math.round function
--
-- changed Gothik mod to use the new repeating timers, this will fix bars that restarted in the first 0.5 seconds
-- changed Grobbulus addon to use other raid target icons if the skull set on another player with Mutating Injection
-- changed status bar tooltip to display the name of the boss mod instead of the internal used abbreviation
-- /lv stop will no longer kill "Pizza Timers" :)
--
-- added options to change the raid warning frame's position, font size and font color
-- added "special warnings"
-- added screen shake effect (default setting: enabled, you can disable it in the options tab)
-- added flash effect
-- added LVBM.AddSpecialWarning() to add a special warning, see "Information for AddOn developers" for details
-- added LVBM.StartRepeatingStatusBarTimer(timer, name[, repetitions, noBroadcast]) to start repeating bars, see "Information for AddOn developers" for details
-- added LVBM.EndRepeatingStatusBarTimer(name[, noBroadcast]) to end a repeating bar, see "Information for AddOn developers" for details.
-- added more options to some boss mods
-- added Thaddius boss mod
--
--
-- v1.50
-- fixed charge bug
-- fixed bloodrage bug
-- fixed spirit of redemption bug
-- fixed auto attack bug. If you still experience this bug, please try to disable other boss mods that use automatic combat start detection. I tested my new combat detection code for hours and this bug is definitely fixed.
-- fixed Sarturas Whirlwind timers
-- fixed Twin Emps enrage timer when player died in combat
-- fixed status bars with long names
--
-- re-enabled PLAYER_REGEN_DISABLED for Rogues and Warriors.
-- rewrote combat detection code
-- added functions LVBM.UnitExists and LVBM.DetectCombat, see "Information for AddOn developers" below
-- changed synchronization commands...so this version will not be able to sync with older clients!
-- status bars that belong to disabled boss mods are now longer shown, even if the bar is synced by another player
--
-- added LVBM.GetBuff() and LVBM.GetDebuff(), see "Information for AddOn developers" below
-- added german translation for GUI and most boss mods
-- added subtabs in the options tab
-- added a dialog (see options tab) to start your own timers
-- added a option to change the raid warning sound
-- added tooltips to the status bars
-- added Heigan the Unclean mod
-- added Gothik the Harvester mod
-- added Huhuran mod
-- added Anubisath Defender mod
-- added /lv stop, this stops all timers, status bars, scheduled tasks. You need to be the raid leader or promoted to use this command.
-- added option to download the patch notes from another player who got a newer version than you
-- ----------------- --
-- API Documentation --
-- ----------------- --
--
-- --------------- --
-- Timer Functions --
-- --------------- --
-- LVBM.Schedule(Delay, NameOrFunction[, Argument1, Argument2]);
-- Delay must be a number. NameOfFunction must be a string or a function. Argument1 & 2 can be strings, numbers, tables, functions etc.
-- Example: LVBM.Schedule(10, "SendChatMessage", "lol", "GUILD"); will write "lol" after 10 sec
--
-- LVBM.UnSchedule(NameOrFunction[, Argument1, Argument2]);
-- If you only specify the name of the function, all scheduled tasks which call this function will be deleted.
-- Example: LVBM.UnSchedule("SendChatMessage", "lol", "GUILD"); will delete the scheduled task of the example above.
-- LVBM.UnSchedule("SendChatMessage"); will delete all scheduled tasks which call SendChatMessage
--
-- timeLeft, timeElapsed = LVBM.GetScheduleTimeLeft(NameOrFunction[, Argument1, Argument2]);
-- Returns the time left until the scheduled function is executed and the time elapsed.
-- Example: timeLeft, timeElapsed = LVBM.GetSchedule("SendChatMessage", "lol", "GUILD")
-- timeLeft will be 9 and timeElapsed will be 1, if you call this function 1 second after the LVBM.Schedule example above
--
-- isScheduled = LVBM.FunctionIsScheduled(func);
-- Returns true if a given function is scheduled to be called
--
-- LVBM.StartTimer("name");
-- Starts a timer.
--
-- elapsed = LVBM.GetTimer("name");
-- Returns the elapsed time since LVBM.StartTimer
--
-- elapsed = LVBM.StopTimer("name");
-- Stops the timer and returns the elapsed time
--
-- elapsed = LVBM.ResumeTimer("name");
-- Resumes a stopped timer and returns the elapsed time
--
-- elapsed = LVBM.EndTimer("name");
-- Deletes a timer and returns the elapsed time
--
-- LVBM.StartStatusBarTimer(timer, "text"[, noBroadcast]);
-- Adds a status bar timer. If noBroadcast is set and is true, the timer won't be broadcasted to the raid group.
--
-- LVBM.StartColoredStatusBarTimer(timer, "text", r, g, b[, a, noBroadcast]);
-- Starts a status bar timer with a specific color, this color will overwrite the color set by the user
--
-- timeLeft, timeElapsed = LVBM.GetStatusBarTimerTimeLeft("text");
-- Returns the time left and the time elapsed of the status bar with the text "text"
--
-- LVBM.EndStatusBarTimer("text"[, noBroadcast]);
-- Removes the status bar timer with the text "text"
--
-- LVBM.StartRepeatingStatusBarTimer(timer, name[, repetitions, noBroadcast])
-- Starts a repeating status bar timer which will be shown "repetitions" times, if repetitions is not set it will be infinite.
--
-- LVBM.StartRepeatingColoredStatusBarTimer(timer, name[, repetitions], r, g, b[, a, noBroadcast]);
-- See StartColoredStatusBarTimer and StartRepeatingStatusBarTimer
--
-- LVBM.EndRepeatingStatusBarTimer(name[, noBroadcast]);
-- End a repeating status bar timer, calling LVBM.EndStatusBarTimer() on a repeating timer will just reset the timer and reduce the times it will be repeated by 1
--
-- LVBM.UpdateStatusBarTimer(name[, elapsed, timer, newName, noBroadcast]);
-- Updates a status bar timer
-- ----------------- --
-- Message Functions --
-- ----------------- --
-- LVBM.AddMsg("message"[, "addon"]);
-- Prints a message in the default chat frame, "addon" is used as prefix...if not set, the boss mod which called the function will be detected automatically and used as prefix
-- Example: LVBM.AddMsg("zomg!");
--
-- LVBM.Announce("message");
-- Announces a message to the raid, using Blizzard's "Raid Warning" chat
-- Example: LVBM.Announce("*** Locust Swarm in 3 sec ***");
--
-- LVBM.SendHiddenWhisper("message", "target");
-- Sends a whisper message which is not displayed in your chat frame
-- ------------------------- --
-- Special Warning Functions --
-- ------------------------- --
-- LVBM.AddSpecialWarning("text", shake, flash);
-- Adds a "Special Warning" with shake and/or flash effect
-- -------------- --
-- Buff Functions --
-- -------------- --
-- buffIndex = LVBM.GetBuff("unitID", "buff");
-- Returns the buff index of a buff on a unit. If the unit does not exist or doesn't have the buff this function will return nil.
--
-- buffIndex = LVBM.GetDebuff("unitID", "debuff");
-- Same as LVBM.GetBuff...just for debuffs
-- -------------- --
-- Icon Functions --
-- -------------- --
-- LVBM.SetIconByName(name, icon);
-- Sets a raid target icon an a player in your raid group
--
-- LVBM.ClearIconByName(name);
-- Removes a raid target icon an a player in your raid group
-- ---------------- --
-- Combat Functions --
-- ---------------- --
-- unitID = LVBM.DetectCombat("name");
-- Detects if a unit with a given name is in combat.
-- Returns nil if unit not found or not in combat, returns unitID if unit found and in combat.
-- This function does not change your target so it's absolute safe to use this.
-- But it will return nil if nobody in your raid group has the unit targeted, but this shouldn't be a problem since this function should be used a few seconds after the pull.
--
-- unitExists = LVBM.UnitExists("name");
-- Detects if a unit with a given name exists.
-- Returns true if unit can be targeted, returns nil if unit can't be targeted, returns nil and does not change targets if
-- -player is a warrior, rogue, druid or paladin and auto attack is enabled and unit is not the current target
-- -player is a priest and spirit of redemption is active (PLAYER_REGEN_DISABLED is fired when you die with the spirit of redemption talent)
-- -player has used charge, feral charge or bloodrage in the last 7.5 seconds
-- -player has combo points
-- So it is safe to use this function on PLAYER_REGEN_DISABLED.
-- ------------- --
-- GUI functions --
-- ------------- --
-- myInfoFrame = LVBMGui:CreateInfoFrame(title, text);
-- myInfoFrame:SetTitle(title);
-- myInfoFrame:SetText(text);
--
-- myInfoFrameStatusBar = myInfoFrame:CreateStatusBar(min, max, value, title, leftText, rightText);
-- myInfoFrameStatusBar:SetValue(value);
-- myInfoFrameStatusBar:SetTitle(title);
--
-- myInfoFrameTextField = myInfoFrame:CreateTextField(text);
-- myInfoFrameTextField:SetText(text);
--
-- these methods are also available for status bars and text fields
-- myInfoFrame:Show();
-- myInfoFrame:Hide();
-- myInfoFrame:GetObject(); - returns the frame object
-- myInfoFrame:Delete(); - you can not delete frames, but this function hides the frame and moves it to a "trash can"...the frame will be re-used next time you create a frame of this type
if not math.mod and math.fmod then --math.mod will be renamed in burning crusade
math.mod = math.fmod;
end
LVBM_SavedVars = {
["AddOns"] = {
},
["LVBM"] = {
},
}
LVBM = {}
LVBM.Version = "1.95"
LVBM.ScheduleData = {
}
LVBM.TimerData = {
}
LVBM.StatusBarData = {
}
LVBM.Hooks = {
}
LVBM.SpamProtection = {
}
LVBM.HideDNDAFKMessages = {
};
LVBM.InRaid = false;
LVBM.SyncInfo = {
["Clients"] = {},
};
LVBM.LongMsg = "";
LVBM.AddOns = {
};
LVBM.MsgQueue = {
};
LVBM.AggroUpdate = 0;
LVBM.MsgQueueElapsed = 0;
LVBM.SortedAddOns = { --table.sort sucks...
};
LVBM.HiddenWhisperMessages = {
};
LVBM.CombatUpdate = 0;
LVBM.Rank = 0;
LVBM.CombatStartTime = GetTime();
LVBM.HideWhispers = false;
LVBM.StatusBarCount = 0;
LVBM.Raid = {
};
LVBM.WhispersDuringCombat = {
};
LVBM.WhisperSpamProtection = {
};
LVBM.StatusSpamProtection = {
};
LVBM.LastCharge = GetTime();
LVBM.LastBloodrage = GetTime();
LVBM.LastFeignDeath = GetTime();
LVBM.AutoAttack = false;
LVBM.Options = {
["StatusBarColor"] = {
["r"] = 1.0,
["g"] = 0.7,
["b"] = 0.0,
["a"] = 0.8,
},
["StatusBarDesign"] = 2,
["MaxStatusBars"] = 10,
["StatusBarsFlippedOver"] = false,
["FillUpStatusBars"] = true,
["EnableStatusBars"] = true,
["EnableSync"] = true,
["AllowSyncFromOldVersions"] = true,
["MinimapButton"] = {
["Position"] = 225,
["Radius"] = 78.1,
["Enabled"] = true,
},
["SpecialWarningsEnabled"] = true,
["ShakeIntensity"] = 30,
["ShakeDuration"] = 0.5,
["SpecialWarningTextDuration"] = 5,
["SpecialWarningTextFadeTime"] = 3,
["SpecialWarningTextSize"] = 40,
["FlashDuration"] = 2,
["NumFlashes"] = 1,
["ShakeEnabled"] = false,
["FlashEnabled"] = true,
["FlashColor"] = "red",
["SpecialWarningTextColor"] = {
["r"] = 0.0,
["g"] = 0.0,
["b"] = 1.0,
["a"] = 1.0,
},
["FirstTimeLoaded191"] = true,
["StatusBarSize"] = {
["Scale"] = 1,
["Width"] = 205,
},
["FlashBars"] = true,
["BusyMessage"] = LVBM_DEFAULT_BUSY_MSG.." "..LVBM_SEND_STATUS_INFO,
["AutoRespond"] = true,
["ShowAutoRespondInfo"] = true,
["ShowWhispersDuringCombat"] = true,
["HideOutgoingInfoWhisper"] = true,
["EnableStatusCommand"] = true,
["ShowCombatInformations"] = true,
["AutoColorBars"] = true,
};
LVBM.Options.CharSettings = {
};
LVBM.Options.CharSettings[UnitName("player")] = {
};
if UnitClass("player") == LVBM_WARRIOR then
LVBM.Options.CharSettings[UnitName("player")].AggroAlert = false;
LVBM.Options.CharSettings[UnitName("player")].AggroSound = false;
LVBM.Options.CharSettings[UnitName("player")].AggroFlash = false;
LVBM.Options.CharSettings[UnitName("player")].AggroShake = false;
LVBM.Options.CharSettings[UnitName("player")].AggroSpecialWarning = false;
LVBM.Options.CharSettings[UnitName("player")].AggroLocalWarning = false;
else
LVBM.Options.CharSettings[UnitName("player")].AggroAlert = true;
LVBM.Options.CharSettings[UnitName("player")].AggroSound = false;
LVBM.Options.CharSettings[UnitName("player")].AggroFlash = true;
LVBM.Options.CharSettings[UnitName("player")].AggroShake = true;
LVBM.Options.CharSettings[UnitName("player")].AggroSpecialWarning = true;
LVBM.Options.CharSettings[UnitName("player")].AggroLocalWarning = false;
end
---------------------
--OnEvent Functions--
---------------------
function LVBM.OnLoad()
SLASH_LVNAXXRAMASBOSSMODS1 = "/vendetta";
SLASH_LVNAXXRAMASBOSSMODS2 = "/lv";
SLASH_LVNAXXRAMASBOSSMODS3 = "/bossmods";
SLASH_LVNAXXRAMASBOSSMODS4 = "/bm";
SLASH_LVNAXXRAMASBOSSMODS5 = "/lvbm";
SLASH_LVNAXXRAMASBOSSMODS6 = "/lvbossmods";
SlashCmdList["LVNAXXRAMASBOSSMODS"] = function(msg)
if string.lower(msg) == "unlock" then
LVBM_StatusBarTimerDrag:Show();
elseif string.lower(msg) == "lock" then
LVBM_StatusBarTimerDrag:Hide();
elseif string.lower(msg) == "ver" or string.lower(msg) == "version" then
local syncInfo = {};
for i = 1, GetNumRaidMembers() do
if (tonumber(LVBM.SyncInfo.Clients[UnitName("raid"..i)])) then
--bla table.sort bla
table.insert(syncInfo, {["Name"] = UnitName("raid"..i), ["Version"] = LVBM.SyncInfo.Clients[UnitName("raid"..i)]});
-- else
-- table.insert(syncInfo, {["Name"] = UnitName("raid"..i), ["Version"] = 0});
end
end
table.sort(syncInfo, function(v1, v2) return tonumber(v1.Version) > tonumber(v2.Version); end);
for index, value in pairs(syncInfo) do
LVBM.AddMsg(value.Name..": "..value.Version);
end
LVBM.AddMsg(string.format(LVBM_FOUND_CLIENTS, table.getn(syncInfo)));
elseif string.lower(msg) == "ver2" then
local syncInfo = {};
local msg = "";
local numClients = 0;
for i = 1, GetNumRaidMembers() do
msg = "raid"..i.." - ";
msg = msg.."Name: "..UnitName("raid"..i).." - ";
if (LVBM.SyncInfo.Clients[UnitName("raid"..i)] and LVBM.SyncInfo.Clients[UnitName("raid"..i)] == LVBM.Version) then
msg = msg.."Version: "..LVBM.SyncInfo.Clients[UnitName("raid"..i)];
numClients = numClients + 1;
elseif (LVBM.SyncInfo.Clients[UnitName("raid"..i)]) then
msg = msg.."Version: "..LVBM.SyncInfo.Clients[UnitName("raid"..i)].." OLD";
LVBM.SendHiddenWhisper("<Vendetta Boss Mods> "..LVBM_YOUR_VERSION_SUCKS, UnitName("raid"..i));
numClients = numClients + 1;
else
msg = msg.."Version: -none-";
end
LVBM.AddMsg(msg);
end
LVBM.AddMsg(string.format(LVBM_FOUND_CLIENTS, numClients));
elseif string.lower(msg) == "bars" or string.lower(msg) == "barinfo" or string.lower(msg) == "syncedby" or string.lower(msg) == "syncinfo" then
local syncedBars = false;
for index, value in pairs(LVBM.StatusBarData) do
if value.syncedBy then
LVBM.AddMsg(index..": "..value.syncedBy);
syncedBars = true;
end
end
if( syncedBars == false ) then
LVBM.AddMsg(LVBMGUI_SYNCBUTTONGETNOSYNCINFO);
end
elseif string.lower(msg) == "stop" then
if LVBM.Rank >= 1 then
LVBM.AddSyncMessage("ENDALL", true);
LVBM.AddMsg(LVBM_ALL_STOPPED);
else
LVBM.AddMsg(LVBM_NEED_LEADER_STOP_ALL);
end
else
if LVBMBossModFrame:IsShown() then
HideUIPanel(LVBMBossModFrame);
else
ShowUIPanel(LVBMBossModFrame);
end
end
end
SLASH_LVRANGECHECK1 = "/range";
SLASH_LVRANGECHECK2 = "/rangecheck";
SLASH_LVRANGECHECK3 = "/checkrange";
SlashCmdList["LVRANGECHECK"] = LVBM.RangeCheck;
SLASH_LVCLEANUP1 = "/cleanup";
SlashCmdList["LVCLEANUP"] = LVBM.CleanUp;
LVBM_API:RegisterEvent("VARIABLES_LOADED");
LVBM_API:RegisterEvent("PLAYER_LOGIN");
LVBM_API:RegisterEvent("PLAYER_LEAVING_WORLD");
LVBM_API:RegisterEvent("CHAT_MSG_WHISPER");
LVBM_API:RegisterEvent("RAID_ROSTER_UPDATE");
LVBM_API:RegisterEvent("PLAYER_ENTER_COMBAT");
LVBM_API:RegisterEvent("PLAYER_LEAVE_COMBAT");
LVBM_API:RegisterEvent("CHAT_MSG_ADDON");
LVBM_API:RegisterEvent("PLAYER_REGEN_DISABLED");
LVBM_API:RegisterEvent("ZONE_CHANGED_NEW_AREA");
LVBM_API:RegisterEvent("CHAT_MSG_COMBAT_HOSTILE_DEATH");
LVBM_API:RegisterEvent("PLAYER_DEAD");
end
function LVBM.RangeCheck()
local name, playersOutOfRange;
playersOutOfRange = "";
for i = 1, GetNumRaidMembers() do
name = GetRaidRosterInfo(i)
if name and (not CheckInteractDistance("raid"..i, 4)) then
playersOutOfRange = playersOutOfRange..UnitName("raid"..i)..", ";
end
end
LVBM.AddMsg(LVBM_RANGE_CHECK..string.sub(playersOutOfRange, 1, (string.len(playersOutOfRange) - 2)));
end
function LVBM.CleanUp()
if LVBM.Rank >= 1 then
for i = 1, GetNumRaidMembers() do
SetRaidTargetIcon("raid"..i, 0);
end
LVBM.AddMsg("Cleaned up raid icons!");
end
end
function LVBM.OnVarsLoaded()
local loadedAddOns = {};
LVBM.Register();
LVBM.AddMsg(string.format(LVBM_LOADED, LVBM.Version));
if not LVBM_SavedVars.LVBM then --if we update from v0.5 or lower, we dont have this field...
LVBM_SavedVars.LVBM = {} --...so we have to create it
end
for index, value in pairs(LVBM.Options) do --load saved vars
if LVBM_SavedVars.LVBM[index] == nil then
LVBM_SavedVars.LVBM[index] = value;
elseif type(LVBM_SavedVars.LVBM[index]) == "table" and type(LVBM.Options[index]) == "table" and index ~= "CharSettings" then
for index2, value2 in pairs(LVBM.Options[index]) do
if LVBM_SavedVars.LVBM[index][index2] == nil then
LVBM_SavedVars.LVBM[index][index2] = value;
elseif type(LVBM_SavedVars.LVBM[index][index2]) == "table" and type(LVBM.Options[index][index2]) == "table" then
for index3, value3 in pairs(LVBM.Options[index][index2]) do
if LVBM_SavedVars.LVBM[index][index2][index3] == nil then
LVBM_SavedVars.LVBM[index][index2][index3] = value;
else
LVBM.Options[index][index2][index3] = LVBM_SavedVars.LVBM[index][index2][index3];
end
end
else
LVBM.Options[index][index2] = LVBM_SavedVars.LVBM[index][index2];
end
end
elseif index == "CharSettings" then
for index2, value2 in pairs(LVBM.Options[index]) do
if LVBM_SavedVars.LVBM[index][index2] == nil then
LVBM_SavedVars.LVBM[index][index2] = LVBM.Options[index][index2];
else
LVBM.Options[index][index2] = LVBM_SavedVars.LVBM[index][index2];
end
end
for index2, value2 in pairs(LVBM_SavedVars.LVBM[index]) do
if LVBM.Options[index][index2] == nil then
LVBM.Options[index][index2] = LVBM_SavedVars.LVBM[index][index2];
else
LVBM_SavedVars.LVBM[index][index2] = LVBM.Options[index][index2];
end
end
else
LVBM.Options[index] = LVBM_SavedVars.LVBM[index];
end
end
LVBMMinimapButton_Move();
LVBMSpecialWarningFrameText:SetFont(STANDARD_TEXT_FONT, LVBM.Options.SpecialWarningTextSize, "THICKOUTLINE");
if not LVBM.Options.MinimapButton.Enabled then
LVBMMinimapButton:Hide();
else
LVBMMinimapButton:Show();
end
LVBMStatusBars_ChangeDesign(LVBM.Options.StatusBarDesign, true);
if GetNumRaidMembers() > 1 then
LVBM.AddSyncMessage("REQ VER "..LVBM.Version, true);
LVBM.InRaid = true;
local name, rank;
for i = 1, GetNumRaidMembers() do
name, rank = GetRaidRosterInfo(i);
if UnitName("player") == name then
LVBM.Rank = rank;
end
LVBM.Raid[name] = rank;
end
end
for index, value in pairs(LVBM.AddOns) do --load AddOn's saved variables/add new addons to the LVBM_SavedVars table/set default values for missing fields
if not value.Name then
LVBM.AddOns[index].Name = index;
end
if not value.Version then
LVBM.AddOns[index].Version = "1.0";
end
if not value.Author then
LVBM.AddOns[index].Author = LVBM.Capitalize(LVBM_UNKNOWN);
end
if not value.Description then
LVBM.AddOns[index].Description = LVBM_DEFAULT_DESCRIPTION;
end
if not value.Instance then
LVBM.AddOns[index].Instance = LVBM_OTHER;
end
if (value.Instance ~= LVBM_AQ40) and (value.Instance ~= LVBM_NAXX) and (value.Instance ~= LVBM_BWL) and (value.Instance ~= LVBM_MC) and (value.Instance ~= LVBM_ZG) and (value.Instance ~= LVBM_AQ20) and (value.Instance ~= LVBM_OTHER) then
LVBM.AddOns[index].Instance = LVBM_OTHER;
end
if not value.GUITab then
LVBM.AddOns[index].GUITab = LVBMGUI_TAB_OTHER
end
if not value.Sort then
value.Sort = 9999;
end
if not value.Options then
LVBM.AddOns[index].Options = {
["Enabled"] = true,
["Announce"] = false,
}
end
if value.Options.Enabled == nil then --not value.Options.Enabled would return true if the AddOn is disabled....and the next line would enable the addon
LVBM.AddOns[index].Options.Enabled = true;
end
if not value.Events then
LVBM.AddOns[index].Events = {};
end
if type(value.OnLoad) ~= "function" then
LVBM.AddOns[index].OnLoad = function() end;
end
if type(value.OnEvent) ~= "function" then
LVBM.AddOns[index].OnEvent = function() end;
end
if not value.UpdateInterval then
LVBM.AddOns[index].UpdateInterval = 0;
end
if not value.elapsed then
LVBM.AddOns[index].elapsed = 0;
end
if LVBM_SavedVars.AddOns[index] == nil then --load saved vars
LVBM_SavedVars.AddOns[index] = value.Options
else
for index2, value2 in pairs(value.Options) do
if LVBM_SavedVars.AddOns[index][index2] == nil then
LVBM_SavedVars.AddOns[index][index2] = value2;
else
LVBM.AddOns[index].Options[index2] = LVBM_SavedVars.AddOns[index][index2];
end
end
end
setglobal("SLASH_"..index.."1", "/"..string.gsub(value.Name, " ", "")); --register slash commands
for i = 1, 10 do
if value["Abbreviation"..i] then
setglobal("SLASH_"..index..(i+1), "/"..value["Abbreviation"..i]);
else
break;
end
end
loadstring("SlashCmdList["..string.format('%q', index).."] = function(msg)\n"..
"local abbrString = '';\n"..
"if string.lower(msg) == 'on' then\n"..
"LVBM.AddOns["..string.format('%q', index).."].Options.Enabled = true;\n"..
"LVBM.AddMsg(LVBM_MOD_ENABLED, "..string.format('%q', value.Name)..");\n"..
"elseif string.lower(msg) == 'off' then\n"..
"LVBM.AddOns["..string.format('%q', index).."].Options.Enabled = false;\n"..
"LVBM.UnSchedule('LVBM.AddOns."..index..".OnEvent');\n"..
"LVBM.AddMsg(LVBM_MOD_DISABLED, "..string.format('%q', value.Name)..");\n"..
"elseif string.lower(msg) == 'announce on' then\n"..
"LVBM.AddOns["..string.format('%q', index).."].Options.Announce = true;\n"..
"LVBM.AddMsg(LVBM_ANNOUNCE_ENABLED, "..string.format('%q', value.Name)..");\n"..
"elseif string.lower(msg) == 'announce off' then\n"..
"LVBM.AddOns["..string.format('%q', index).."].Options.Announce = false;\n"..
"LVBM.AddMsg(LVBM_ANNOUNCE_DISABLED, "..string.format('%q', value.Name)..");\n"..
"elseif string.lower(msg) == 'stop' then\n"..
"if type(LVBM.AddOns["..string.format('%q', index).."].OnStop) == 'function' then\n"..
"LVBM.AddOns["..string.format('%q', index).."].OnStop()\n"..
"end\n"..
"LVBM.UnSchedule('LVBM.AddOns."..index..".OnEvent');\n"..
"for index2, value2 in pairs(LVBM.StatusBarData) do\n"..
"if index2 then\n"..
"if LVBM.AddOns["..string.format('%q', index).."].Name == value2.startedBy then\n"..
"LVBM.EndRepeatingStatusBarTimer(index2)\n"..
"end\n"..
"end\n"..
"end\n"..
"LVBM.AddMsg(LVBM_MOD_STOPPED, "..string.format('%q', value.Name)..");\n"..
"else\n"..
"if type(LVBM.AddOns["..string.format('%q', index).."].OnSlashCommand) == 'function' then\n"..
"if LVBM.AddOns["..string.format('%q', index).."].OnSlashCommand(msg) then\n"..
"return;\n"..
"end\n"..
"end\n"..
"LVBM.AddMsg(string.format(LVBM_MOD_INFO, LVBM.AddOns["..string.format('%q', index).."].Version, LVBM.AddOns["..string.format('%q', index).."].Author), "..string.format('%q', value.Name)..");\n"..
"LVBM.AddMsg('/'..string.gsub(LVBM.AddOns["..string.format('%q', index).."].Name, ' ', '')..LVBM_SLASH_HELP1, "..string.format('%q', value.Name)..");\n"..
"LVBM.AddMsg('/'..string.gsub(LVBM.AddOns["..string.format('%q', index).."].Name, ' ', '')..LVBM_SLASH_HELP2, "..string.format('%q', value.Name)..");\n"..
"LVBM.AddMsg('/'..string.gsub(LVBM.AddOns["..string.format('%q', index).."].Name, ' ', '')..LVBM_SLASH_HELP3, "..string.format('%q', value.Name)..");\n"..
"if type(LVBM.AddOns["..string.format('%q', index).."].SlashCmdHelpText) == 'table' then\n"..
"for index, value in pairs(LVBM.AddOns["..string.format('%q', index).."].SlashCmdHelpText) do\n"..
"if type(value) == 'string' then\n"..
"LVBM.AddMsg(value, "..string.format('%q', value.Name)..");\n"..
"end\n"..
"end\n"..
"end\n"..
"if type(LVBM.AddOns["..string.format('%q', index).."].Abbreviation1) == 'string' then\n"..
"abbrString = '/'..LVBM.AddOns["..string.format('%q', index).."].Abbreviation1;\n"..
"end\n"..
"if type(LVBM.AddOns["..string.format('%q', index).."].Abbreviation2) == 'string' and (not type(LVBM.AddOns["..string.format('%q', index).."].Abbreviation3) == 'string') then\n"..
"abbrString = abbrString..' '..LVBM_OR..' /'..LVBM.AddOns["..string.format('%q', index).."].Abbreviation2;\n"..
"elseif type(LVBM.AddOns["..string.format('%q', index).."].Abbreviation3) == 'string' then\n"..
"abbrString = abbrString..', /'..LVBM.AddOns["..string.format('%q', index).."].Abbreviation2..' '..LVBM_OR..' /'..LVBM.AddOns["..string.format('%q', index).."].Abbreviation3;\n"..
"end\n"..
"if abbrString ~= '' then\n"..
"LVBM.AddMsg(string.format(LVBM_SLASH_HELP4, abbrString, string.gsub(LVBM.AddOns["..string.format('%q', index).."].Name, ' ', '')), "..string.format('%q', value.Name)..");\n"..
"end\n"..
"end\n"..
"end")();
if not loadedAddOns[value.Instance] then
loadedAddOns[value.Instance] = 1;
else
loadedAddOns[value.Instance] = loadedAddOns[value.Instance] + 1;
end
LVBM.AddOns[index].OnLoad();
table.insert(LVBM.SortedAddOns, index);
end
for index, value in pairs(loadedAddOns) do
LVBM.AddMsg(string.format(LVBM_MODS_LOADED, value, index));
end
table.sort(LVBM.SortedAddOns, function(v1, v2) return LVBM.AddOns[v1].Sort < LVBM.AddOns[v2].Sort; end);
if type(ForgottenChat_Blacklist) == "table" then
local foundLVBM, foundLVPN;
for index, value in pairs(ForgottenChat_Blacklist) do
if value == "LVBM" then
foundLVBM = true;
elseif value == "LVPN" then
foundLVPN = true;
end
end
if not foundLVBM then
table.insert(ForgottenChat_Blacklist, "LVBM")
end
if not foundLVPN then
table.insert(ForgottenChat_Blacklist, "LVPN");
end
end
if type(WIM_Filters) == "table" then
WIM_Filters["^LVBM"] = "Ignore";
WIM_Filters["^LVPN"] = "Ignore";
end
if LVBM.Options.FirstTimeLoaded191 then
LVBM.Options.Gui.RaidWarning_Font = STANDARD_TEXT_FONT;
LVBM.Options.Gui.SelfWarning_Font = STANDARD_TEXT_FONT;
LVBM.Options.StatusBarDesign = 2;
LVBM.Options.StatusBarColor = {
["r"] = 1.0,
["g"] = 0.7,
["b"] = 0.0,
["a"] = 0.8,
};
LVBM.Options.StatusBarSize = {
["Scale"] = 1,
["Width"] = 205,
};
LVBM.Options.BusyMessage = LVBM_DEFAULT_BUSY_MSG.." "..LVBM_SEND_STATUS_INFO;
LVBM.AddOns.FourHorsemen.Options.Enabled = true;
LVBM.AddOns.Sapphiron.Options.Enabled = true;
LVBM.AddOns.Kelthuzad.Options.Enabled = true;
LVBM.Options.FirstTimeLoaded191 = false;
end
end
function LVBM.LoadVariables(var)
end
function LVBM.OnEvent(event, arg1)
if (event == "VARIABLES_LOADED") then
LVBM.OnVarsLoaded();
elseif (event == "PLAYER_LOGIN") then
LVBM.SetHooks();
elseif (event == "PLAYER_LEAVING_WORLD") then
LVBM_SavedVars.LVBM = LVBM.Options; --save variables
for index, value in pairs(LVBM.AddOns) do
LVBM_SavedVars.AddOns[index] = value.Options; --save AddOn variables
end
elseif (event == "CHAT_MSG_ADDON") and ((arg1 == "LVBM") or (arg1 == "LVBM NSP")) and arg2 and (arg3 == "RAID" or arg3 == "BATTLEGROUND") and (LVBM.Options.EnableSync) then
if arg1 == "LVBM NSP" then
LVBM.OnSyncMessage(arg2, arg4, true);
elseif arg1 == "LVBM" then
LVBM.OnSyncMessage(arg2, arg4);
end
elseif (event == "CHAT_MSG_WHISPER") and ((string.sub(arg1, 1, 4) == "LVPN") or (string.sub(arg1, 1, 5) == "LVBM ")) then
if string.sub(arg1, 1, 5) == "LVPNS" then
LVBM.OnPatchnoteMessage(string.sub(arg1, 6), false);
elseif string.sub(arg1, 1, 5) == "LVPNL" then
LVBM.OnPatchnoteMessage(string.sub(arg1, 6), true);
elseif string.sub(arg1, 1, 7) == "LVPNREQ" then
local version, language;
_, _, version, language = string.find(arg1, "LVPNREQ ([^%s]+) (%w+)");
LVBM.SendPatchnotes(arg2, version, language);
elseif string.sub(arg1, 1, 5) == "LVBM " and string.sub(arg1, 6, 7) ~= "SC" then
LVBM.OnSyncMessage(string.sub(arg1, 6), arg2, true);
end
elseif (event == "RAID_ROSTER_UPDATE") then
local name, rank;
if GetNumRaidMembers() > 1 then
if not LVBM.InRaid then
LVBM.InRaid = true;
LVBM.AddSyncMessage("REQ VER "..LVBM.Version, true);
end
LVBM.Raid = {};
for i = 1, GetNumRaidMembers() do
name, rank = GetRaidRosterInfo(i);
if UnitName("player") == name then
LVBM.Rank = rank;
end
LVBM.Raid[name] = rank;
end
else
if LVBM.InRaid then
LVBM.InRaid = false;
end
end
elseif (event == "PLAYER_ENTER_COMBAT") then
LVBM.AutoAttack = true;
elseif (event == "PLAYER_LEAVE_COMBAT") then
LVBM.AutoAttack = false;
elseif (event == "PLAYER_REGEN_DISABLED") then
--LVBM.AddMsg("player regen disabled!");
if LVBM.Bosses[GetRealZoneText()] and not LVBM.InCombat then
local bossTable = {};
local bosses = {};
--[[
local target = UnitName("target");
LVBM.AddMsg(target);
]]--
for index, value in pairs(LVBM.Bosses[GetRealZoneText()]) do
if value.startMethod == "COMBAT" then
--[[
TargetByName(value.name);
if(UnitName("target") == value.name and UnitAffectingCombat("target")) then
LVBM.AddMsg("found " .. value.name);
else
LVBM.AddMsg("could not find " .. value.name);
end
]]--
bossTable[value.name] = {["index"] = index, ["value"] = value};
table.insert(bosses, value.name);
end
end
--[[
if(target != nil) then
TargetByName(target);
end
]]--
bosses = LVBM.UnitExists(bosses);
--LVBM.AddMsg(bosses);
if bosses then
for index, value in pairs(bosses) do