forked from BigWigsMods/BigWigs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Loader.lua
2038 lines (1895 loc) · 72.5 KB
/
Loader.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
local L = BigWigsAPI:GetLocale("BigWigs")
local mod, public = {}, {}
local bwFrame = CreateFrame("Frame")
local ldb = LibStub("LibDataBroker-1.1")
local ldbi = LibStub("LibDBIcon-1.0")
local strfind = string.find
-----------------------------------------------------------------------
-- Generate our version variables
--
local BIGWIGS_VERSION = 367
local BIGWIGS_RELEASE_STRING, BIGWIGS_VERSION_STRING
local versionQueryString, versionResponseString = "Q^%d^%s^%d^%s", "V^%d^%s^%d^%s"
local customGuildName = false
local BIGWIGS_GUILD_VERSION = 0
local guildWarnMessage = ""
local guildDisableContentWarnings = false
do
local _, tbl = ...
tbl.loaderPublic = public
tbl.loaderPrivate = mod
public.isRetail = tbl.isRetail
public.isClassic = tbl.isClassic
public.isVanilla = tbl.isVanilla
public.isSeasonOfDiscovery = tbl.isSeasonOfDiscovery
public.isTBC = tbl.isTBC
public.isWrath = tbl.isWrath
public.isCata = tbl.isCata
public.dbmPrefix = "D5"
public.littlewigsVersionString = L.missingAddOnPopup:format("LittleWigs")
-- START: MAGIC PACKAGER VOODOO VERSION STUFF
local REPO = "REPO"
local ALPHA = "ALPHA"
local releaseType
local myGitHash = "@project-abbreviated-hash@" -- The ZIP packager will replace this with the Git hash.
local releaseString
--@alpha@
-- The following code will only be present in alpha ZIPs.
releaseType = ALPHA
--@end-alpha@
-- If we find "@" then we're running from Git directly.
if strfind(myGitHash, "@", nil, true) then
myGitHash = "repo"
releaseType = REPO
public.usingBigWigsRepo = true
end
if releaseType == REPO then
releaseString = L.sourceCheckout:format(BIGWIGS_VERSION)
elseif releaseType == ALPHA then
releaseString = L.alphaRelease:format(BIGWIGS_VERSION, myGitHash)
else -- Release
releaseString = L.officialRelease:format(BIGWIGS_VERSION, myGitHash)
end
-- Format is "V:version^hash^guildVersion^guildName"
local isVersionNumber = type(tbl.guildVersion) == "number"
local isGuildString = type(tbl.guildName) == "string"
local isGuildWarnString = type(tbl.guildWarn) == "string"
if isVersionNumber and isGuildString and isGuildWarnString and tbl.guildVersion > 0 and tbl.guildName:gsub(" ", "") ~= "" then
customGuildName = tbl.guildName
BIGWIGS_GUILD_VERSION = tbl.guildVersion
guildWarnMessage = tbl.guildWarn
guildDisableContentWarnings = tbl.guildDisableContentWarnings
releaseString = L.guildRelease:format(BIGWIGS_GUILD_VERSION, BIGWIGS_VERSION)
versionQueryString = versionQueryString:format(BIGWIGS_VERSION, myGitHash, tbl.guildVersion, tbl.guildName)
versionResponseString = versionResponseString:format(BIGWIGS_VERSION, myGitHash, tbl.guildVersion, tbl.guildName)
BIGWIGS_VERSION_STRING = ("%d/%d-%s"):format(BIGWIGS_GUILD_VERSION, BIGWIGS_VERSION, myGitHash)
else
versionQueryString = versionQueryString:format(BIGWIGS_VERSION, myGitHash, 0, "")
versionResponseString = versionResponseString:format(BIGWIGS_VERSION, myGitHash, 0, "")
BIGWIGS_VERSION_STRING = ("%d-%s"):format(BIGWIGS_VERSION, myGitHash)
end
BIGWIGS_RELEASE_STRING = releaseString
-- END: MAGIC PACKAGER VOODOO VERSION STUFF
end
-----------------------------------------------------------------------
-- Locals
--
local tooltipFunctions = {}
local next, tonumber, type, strsplit, strsub = next, tonumber, type, strsplit, string.sub
local SendAddonMessage, RegisterAddonMessagePrefix, CTimerAfter, CTimerNewTicker = C_ChatInfo.SendAddonMessage, C_ChatInfo.RegisterAddonMessagePrefix, C_Timer.After, C_Timer.NewTicker
local GetInstanceInfo, GetBestMapForUnit, GetMapInfo = GetInstanceInfo, C_Map.GetBestMapForUnit, C_Map.GetMapInfo
local Ambiguate, UnitName, UnitGUID = Ambiguate, UnitNameUnmodified or UnitName, UnitGUID
local debugstack, print = debugstack, print
local myLocale = GetLocale()
-- Try to grab unhooked copies of critical funcs (hooked by some crappy addons)
public.date = date
public.Ambiguate = Ambiguate
public.CTimerAfter = CTimerAfter
public.CTimerNewTicker = CTimerNewTicker
public.DoCountdown = C_PartyInfo.DoCountdown
public.GetBestMapForUnit = GetBestMapForUnit
public.GetInstanceInfo = GetInstanceInfo
public.GetMapInfo = GetMapInfo
public.GetPlayerAuraBySpellID = C_UnitAuras and C_UnitAuras.GetPlayerAuraBySpellID
public.GetSpellCooldown = C_Spell and C_Spell.GetSpellCooldown or GetSpellCooldown
public.GetSpellDescription = C_Spell and C_Spell.GetSpellDescription or GetSpellDescription
public.GetSpellLink = C_Spell and C_Spell.GetSpellLink or GetSpellLink
public.GetSpellName = C_Spell and C_Spell.GetSpellName or GetSpellInfo
public.GetSpellTexture = C_Spell and C_Spell.GetSpellTexture or GetSpellTexture
public.IsItemInRange = C_Item and C_Item.IsItemInRange or IsItemInRange
public.PlaySoundFile = PlaySoundFile
public.RegisterAddonMessagePrefix = RegisterAddonMessagePrefix
public.SendAddonMessage = SendAddonMessage
public.SetRaidTarget = SetRaidTarget
public.SendChatMessage = SendChatMessage
public.UnitCanAttack = UnitCanAttack
public.UnitDetailedThreatSituation = UnitDetailedThreatSituation
public.UnitThreatSituation = UnitThreatSituation
public.UnitGUID = UnitGUID
public.UnitHealth = UnitHealth
public.UnitHealthMax = UnitHealthMax
public.UnitIsDeadOrGhost = UnitIsDeadOrGhost
public.UnitName = UnitName
public.UnitSex = UnitSex
public.UnitTokenFromGUID = UnitTokenFromGUID
public.isTestBuild = GetCurrentRegion() == 72 -- PTR/beta
do
local _, _, _, build = GetBuildInfo()
public.isBeta = build >= 120000
end
-- Version
local usersHash = {}
local usersVersion = {}
local usersGuildVersion = {}
local usersGuildName = {}
local usersDBM = {}
local highestFoundVersion = BIGWIGS_VERSION
local highestFoundGuildVersion = BIGWIGS_GUILD_VERSION
local dbmPrefix = public.dbmPrefix
-- Loading
local isMouseDown = false
local loadOnCoreEnabled = {} -- BigWigs modulepacks that should load when a hostile zone is entered or the core is manually enabled, this would be the default plugins Bars, Messages etc
local loadOnZone = {} -- BigWigs modulepack that should load on a specific zone
local loadOnSlash = {} -- BigWigs modulepacks that can load from a chat command
local menus = {} -- contains the menus for BigWigs, once the core is loaded they will get injected
local enableZones = {} -- contains the zones in which BigWigs will enable
local disabledZones -- contains the zones in which BigWigs will enable, but the user has disabled the addon
local worldBosses = {} -- contains the list of world bosses per zone that should enable the core
local fakeZones = { -- Fake zones used as GUI menus
[-101]=true, -- Outland
[-424]=true, -- Pandaria
[-572]=true, -- Draenor
[-619]=true, -- Broken Isles
[1716]=true, -- Broken Shore Mage Tower
[-947]=true, -- Azeroth
[-1647]=true, -- Shadowlands
[-1978]=true, -- Dragon Isles
[-2274]=true, -- Khaz Algar
}
do
local c = "BigWigs_Classic"
local bc = "BigWigs_BurningCrusade"
local wotlk = "BigWigs_WrathOfTheLichKing"
local cata = "BigWigs_Cataclysm"
local mop = "BigWigs_MistsOfPandaria"
local wod = "BigWigs_WarlordsOfDraenor"
local l = "BigWigs_Legion"
local bfa = "BigWigs_BattleForAzeroth"
local s = "BigWigs_Shadowlands"
local df = "BigWigs_Dragonflight"
local tww = "BigWigs_TheWarWithin"
local lw_c = "LittleWigs_Classic"
local lw_bc = "LittleWigs_BurningCrusade"
local lw_wotlk = "LittleWigs_WrathOfTheLichKing"
local lw_cata = "LittleWigs_Cataclysm"
local lw_mop = "LittleWigs_MistsOfPandaria"
local lw_wod = "LittleWigs_WarlordsOfDraenor"
local lw_l = "LittleWigs_Legion"
local lw_bfa = "LittleWigs_BattleForAzeroth"
local lw_s = "LittleWigs_Shadowlands"
local lw_df = "LittleWigs_Dragonflight"
local lw_tww = "LittleWigs_TheWarWithin"
local lw_delves = "LittleWigs_Delves"
local lw_cs = "LittleWigs_CurrentSeason"
local cap = "Capping"
if public.isVanilla then
public.currentExpansion = {
name = c,
bigWigsBundled = {},
littlewigsDefault = lw_c,
littleWigsBundled = {},
zones = {},
}
elseif public.isTBC then
public.currentExpansion = {
name = bc,
bigWigsBundled = {},
littlewigsDefault = lw_bc,
littleWigsBundled = {},
zones = {},
}
elseif public.isWrath then
public.currentExpansion = {
name = wotlk,
bigWigsBundled = {},
littlewigsDefault = lw_wotlk,
littleWigsBundled = {},
zones = {},
}
elseif public.isCata then
public.currentExpansion = {
name = cata,
bigWigsBundled = {},
littlewigsDefault = lw_cata,
littleWigsBundled = {},
zones = {},
}
--elseif public.isBeta and public.isTestBuild then -- Retail Beta
-- public.currentExpansion = { -- Change on new expansion releases
-- name = tww,
-- bigWigsBundled = {
-- [df] = true,
-- [tww] = true,
-- },
-- littlewigsDefault = lw_cs,
-- littleWigsBundled = {
-- [lw_df] = true,
-- [lw_tww] = true,
-- [lw_delves] = true,
-- [lw_cs] = true,
-- },
-- littleWigsExtras = {
-- lw_delves,
-- lw_cs,
-- },
-- zones = {
-- [2657] = "BigWigs_NerubarPalace",
-- }
-- }
else -- Retail
public.currentExpansion = { -- Change on new expansion releases
name = tww,
bigWigsBundled = {
[tww] = true,
},
littlewigsDefault = lw_cs,
littleWigsBundled = {
[lw_tww] = true,
[lw_delves] = true,
[lw_cs] = true,
},
littleWigsExtras = {
lw_delves,
lw_cs,
},
zones = {
[2657] = "BigWigs_NerubarPalace",
}
}
end
public.zoneTbl = {
[533] = public.isVanilla and c or wotlk, -- Naxxramas
[249] = public.isVanilla and c or wotlk, -- Onyxia's Lair
[568] = (public.isTBC or public.isWrath) and bc or lw_cata, -- Zul'Aman
[-947] = public.isClassic and c or bfa, -- Azeroth (Fake Menu)
--[[ BigWigs: Classic ]]--
[48] = public.isSeasonOfDiscovery and c or nil, -- Blackfathom Deeps [Classic Season of Discovery Only]
[90] = public.isSeasonOfDiscovery and c or nil, -- Gnomeregan [Classic Season of Discovery Only]
[109] = public.isSeasonOfDiscovery and c or nil, -- Sunken Temple [Classic Season of Discovery Only]
[309] = c, -- Zul'Gurub [Classic Only, dungeon has a different ID]
[409] = c, -- Molten Core
[469] = c, -- Blackwing Lair
[509] = c, -- Ruins of Ahn'Qiraj
[531] = c, -- Ahn'Qiraj Temple
[2789] = public.isSeasonOfDiscovery and c or nil, -- The Tainted Scar (Lord Kazzak) [Classic Season of Discovery Only]
[2791] = public.isSeasonOfDiscovery and c or nil, -- Storm Cliffs (Azuregos) [Classic Season of Discovery Only]
[2804] = public.isSeasonOfDiscovery and c or nil, -- The Crystal Vale (Thunderaan) [Classic Season of Discovery Only]
--[[ BigWigs: The Burning Crusade ]]--
[-101] = bc, -- Outland (Fake Menu)
[-1945] = bc, -- Outland (Fake Menu) [Classic Only]
[565] = bc, -- Gruul's Lair
[532] = bc, -- Karazhan
[548] = bc, -- Coilfang: Serpentshrine Cavern
[550] = bc, -- Tempest Keep
[544] = bc, -- Magtheridon's Lair
[534] = bc, -- The Battle for Mount Hyjal
[564] = bc, -- Black Temple
[580] = bc, -- The Sunwell
--[[ BigWigs: Wrath of the Lich King ]]--
[616] = wotlk, -- The Eye of Eternity
[603] = wotlk, -- Ulduar
[624] = wotlk, -- Vault of Archavon
[649] = wotlk, -- Trial of the Crusader
[724] = wotlk, -- The Ruby Sanctum
[631] = wotlk, -- Icecrown Citadel
[615] = wotlk, -- The Obsidian Sanctum
--[[ BigWigs: Cataclysm ]]--
[671] = cata, -- The Bastion of Twilight
[669] = cata, -- Blackwing Descent
[754] = cata, -- Throne of the Four Winds
[757] = cata, -- Baradin Hold
[720] = cata, -- Firelands
[967] = cata, -- Dragon Soul
--[[ BigWigs: Mists of Pandaria ]]--
[-424] = mop, -- Pandaria (Fake Menu)
[1009] = mop, -- Heart of Fear
[996] = mop, -- Terrace of Endless Spring
[1008] = mop, -- Mogu'shan Vaults
[1098] = mop, -- Throne of Thunder
[1136] = mop, -- Siege of Orgrimmar
--[[ BigWigs: Warlords of Draenor ]]--
[-572] = wod, -- Draenor (Fake Menu)
[1228] = wod, -- Highmaul
[1205] = wod, -- Blackrock Foundry
[1448] = wod, -- Hellfire Citadel
--[[ BigWigs: Legion ]]--
[-619] = l, -- Broken Isles (Fake Menu)
[1520] = l, -- The Emerald Nightmare
[1648] = l, -- Trial of Valor
[1530] = l, -- The Nighthold
[1676] = l, -- Tomb of Sargeras
[1712] = l, -- Antorus, the Burning Throne
[1779] = l, -- Invasion Points
--[[ BigWigs: Battle for Azeroth ]]--
[1861] = bfa, -- Uldir
[2070] = bfa, -- Battle Of Dazar'alor
[2096] = bfa, -- Crucible of Storms
[2164] = bfa, -- The Eternal Palace
[2217] = bfa, -- Ny'alotha, the Waking City
--[[ BigWigs: Shadowlands ]]--
[-1647] = s, -- Shadowlands (Fake Menu)
[2296] = s, -- Castle Nathria
[2450] = s, -- Sanctum of Domination
[2481] = s, -- Sepulcher of the First Ones
--[[ BigWigs: Dragonflight ]]--
[-1978] = df, -- Dragon Isles (Fake Menu)
[2522] = df, -- Vault of the Incarnate
[2569] = df, -- Aberrus, the Shadowed Crucible
[2549] = df, -- Amirdrassil, the Dream's Hope
--[[ BigWigs: The War Within ]]--
[-2274] = tww, -- Khaz Algar (Fake Menu)
[2657] = tww, -- Nerub'ar Palace
--[[ LittleWigs: Classic ]]--
[33] = not (public.isVanilla or public.isTBC or public.isWrath) and lw_cata or nil, -- Shadowfang Keep
--[34] = lw_c, -- The Stockade
[36] = not (public.isVanilla or public.isTBC or public.isWrath) and lw_cata or nil, -- Deadmines
--[43] = lw_c, -- Wailing Caverns
--[47] = lw_c, -- Razorfen Kraul
--[48] = lw_c, -- Blackfathom Deeps
--[70] = lw_c, -- Uldaman
--[90] = lw_c, -- Gnomeregan
--[109] = lw_c, -- Sunken Temple
--[129] = lw_c, -- Razorfen Downs
--[189] = lw_c, -- Scarlet Monastery
--[209] = lw_c, -- Zul'Farrak
[229] = lw_c, -- Blackrock Spire
--[230] = lw_c, -- Blackrock Depths
--[289] = lw_c, -- Scholomance
--[329] = lw_c, -- Stratholme
--[349] = lw_c, -- Maraudon
--[389] = lw_c, -- Ragefire Chasm
--[429] = lw_c, -- Dire Maul
[2784] = public.isSeasonOfDiscovery and lw_c or nil, -- Demon Fall Canyon [Classic Season of Discovery Only]
--[[ LittleWigs: The Burning Crusade ]]--
[540] = lw_bc, -- Hellfire Citadel: The Shattered Halls
[542] = lw_bc, -- Hellfire Citadel: The Blood Furnace
[543] = lw_bc, -- Hellfire Citadel: Ramparts
[546] = lw_bc, -- Coilfang: The Underbog
[545] = lw_bc, -- Coilfang: The Steamvault
[547] = lw_bc, -- Coilfang: The Slave Pens
[553] = lw_bc, -- Tempest Keep: The Botanica
[554] = lw_bc, -- Tempest Keep: The Mechanar
[552] = lw_bc, -- Tempest Keep: The Arcatraz
[556] = lw_bc, -- Auchindoun: Sethekk Halls
[555] = lw_bc, -- Auchindoun: Shadow Labyrinth
[557] = lw_bc, -- Auchindoun: Mana-Tombs
[558] = lw_bc, -- Auchindoun: Auchenai Crypts
[269] = lw_bc, -- Opening of the Dark Portal
[560] = lw_bc, -- The Escape from Durnholde
[585] = lw_bc, -- Magister's Terrace
--[[ LittleWigs: Wrath of the Lich King ]]--
[576] = lw_wotlk, -- The Nexus
[578] = lw_wotlk, -- The Oculus
[608] = lw_wotlk, -- Violet Hold
[595] = lw_wotlk, -- The Culling of Stratholme
[619] = lw_wotlk, -- Ahn'kahet: The Old Kingdom
[604] = lw_wotlk, -- Gundrak
[574] = lw_wotlk, -- Utgarde Keep
[575] = lw_wotlk, -- Utgarde Pinnacle
[602] = lw_wotlk, -- Halls of Lightning
[601] = lw_wotlk, -- Azjol-Nerub
[658] = lw_wotlk, -- Pit of Saron
[599] = lw_wotlk, -- Halls of Stone
[600] = lw_wotlk, -- Drak'Tharon Keep
[650] = lw_wotlk, -- Trial of the Champion
[668] = lw_wotlk, -- Halls of Reflection
[632] = lw_wotlk, -- The Forge of Souls
--[[ LittleWigs: Cataclysm ]]--
[859] = lw_cata, -- Zul'Gurub
[643] = lw_cata, -- Throne of the Tides
[644] = lw_cata, -- Halls of Origination
[645] = lw_cata, -- Blackrock Caverns
[755] = lw_cata, -- Lost City of the Tol'vir
[725] = lw_cata, -- The Stonecore
[938] = lw_cata, -- End Time
[939] = lw_cata, -- Well of Eternity
[940] = lw_cata, -- Hour of Twilight
[657] = lw_cata, -- The Vortex Pinnacle
[670] = public.isRetail and {lw_cata, lw_cs} or lw_cata, -- Grim Batol
--[[ LittleWigs: Mists of Pandaria ]]--
[959] = lw_mop, -- Shado-Pan Monastery
[960] = lw_mop, -- Temple of the Jade Serpent
[961] = lw_mop, -- Stormstout Brewery
[962] = lw_mop, -- Gate of the Setting Sun
[994] = lw_mop, -- Mogu'shan Palace
[1001] = lw_mop, -- Scarlet Halls
[1007] = lw_mop, -- Scholomance
[1011] = lw_mop, -- Siege of Niuzao Temple
[1112] = lw_mop, -- Pursuing the Black Harvest
[1004] = lw_mop, -- Scarlet Monastery
--[[ LittleWigs: Warlords of Draenor ]]--
[1209] = lw_wod, -- Skyreach
[1176] = lw_wod, -- Shadowmoon Burial Grounds
[1208] = lw_wod, -- Grimrail Depot
[1279] = lw_wod, -- The Everbloom
[1195] = lw_wod, -- Iron Docks
[1182] = lw_wod, -- Auchindoun
[1175] = lw_wod, -- Bloodmaul Slag Mines
[1358] = lw_wod, -- Upper Blackrock Spire
--[[ LittleWigs: Legion ]]--
[1716] = lw_l, -- Broken Shore Mage Tower (Fake Menu)
[1544] = lw_l, -- Assault on Violet Hold
[1677] = lw_l, -- Cathedral of Eternal Night
[1571] = lw_l, -- Court of Stars
[1651] = lw_l, -- Return to Karazhan
[1501] = lw_l, -- Black Rook Hold
[1516] = lw_l, -- The Arcway
[1466] = lw_l, -- Darkheart Thicket
[1458] = lw_l, -- Neltharion's Lair
[1456] = lw_l, -- Eye of Azshara
[1492] = lw_l, -- Maw of Souls
[1477] = lw_l, -- Halls of Valor
[1493] = lw_l, -- Vault of the Wardens
[1753] = lw_l, -- Seat of the Triumvirate
--[[ LittleWigs: Battle for Azeroth ]]--
[1763] = lw_bfa, -- Atal'Dazar
[1754] = lw_bfa, -- Freehold
[1762] = lw_bfa, -- King's Rest
[1864] = lw_bfa, -- Shrine of the Storm
[1822] = public.isRetail and {lw_bfa, lw_cs} or lw_bfa, -- Siege of Boralus
[1877] = lw_bfa, -- Temple of Sethraliss
[1594] = lw_bfa, -- The Undermine
[1771] = lw_bfa, -- Tol Dagor
[1841] = lw_bfa, -- Underrot
[1862] = lw_bfa, -- Waycrest Manor
[2097] = lw_bfa, -- Operation: Mechagon
[2212] = lw_bfa, -- Horrific Vision of Orgrimmar
[2213] = lw_bfa, -- Horrific Vision of Stormwind
--[[ LittleWigs: Shadowlands ]]--
[2284] = lw_s, -- Sanguine Depths
[2285] = lw_s, -- Spires of Ascension
[2286] = public.isRetail and {lw_s, lw_cs} or lw_s, -- The Necrotic Wake
[2287] = lw_s, -- Halls of Atonement
[2289] = lw_s, -- Plaguefall
[2290] = public.isRetail and {lw_s, lw_cs} or lw_s, -- Mists of Tirna Scithe
[2291] = lw_s, -- De Other Side
[2293] = lw_s, -- Theater of Pain
[2441] = lw_s, -- Tazavesh, the Veiled Market
--[[ LittleWigs: Dragonflight ]]--
[2451] = lw_df, -- Uldaman: Legacy of Tyr
[2515] = lw_df, -- The Azure Vault
[2516] = lw_df, -- The Nokhud Offensive
[2519] = lw_df, -- Neltharus
[2520] = lw_df, -- Brackenhide Hollow
[2521] = lw_df, -- Ruby Life Pools
[2526] = lw_df, -- Algeth'ar Academy
[2527] = lw_df, -- Halls of Infusion
[2579] = lw_df, -- Dawn of the Infinite
--[[ LittleWigs: The War Within ]]--
[2648] = lw_tww, -- The Rookery
[2649] = lw_tww, -- Priory of the Sacred Flame
[2651] = lw_tww, -- Darkflame Cleft
[2652] = public.isRetail and {lw_tww, lw_cs} or lw_tww, -- The Stonevault
[2660] = public.isRetail and {lw_tww, lw_cs} or lw_tww, -- Ara-Kara, City of Echoes
[2661] = lw_tww, -- Cinderbrew Meadery
[2662] = public.isRetail and {lw_tww, lw_cs} or lw_tww, -- The Dawnbreaker
[2669] = public.isRetail and {lw_tww, lw_cs} or lw_tww, -- City of Threads
[2710] = lw_tww, -- Awakening the Machine
--[[ LittleWigs: Delves ]]--
[2664] = lw_delves, -- Fungal Folly
[2679] = lw_delves, -- Mycomancer Cavern
[2680] = lw_delves, -- Earthcrawl Mines
[2681] = lw_delves, -- Kriegval's Rest
[2682] = lw_delves, -- Zekvir's Lair
[2683] = lw_delves, -- The Waterworks
[2684] = lw_delves, -- The Dread Pit
[2685] = lw_delves, -- Skittering Breach
[2686] = lw_delves, -- Nightfall Sanctum
[2687] = lw_delves, -- The Sinkhole
[2688] = lw_delves, -- The Spiral Weave
[2689] = lw_delves, -- Tak-Rethan Abyss
[2690] = lw_delves, -- The Underkeep
--[[ Capping ]]--
[30] = cap, -- Alterac Valley
[2197] = cap, -- Alterac Valley (Korrak's Revenge)
[2107] = cap, -- Arathi Basin
[1681] = cap, -- Arathi Basin (Snowy PvP Brawl)
[2177] = cap, -- Arathi Basin (Players vs AI Brawl)
[529] = cap, -- Arathi Basin (Classic)
[1191] = cap, -- Ashran
[2245] = cap, -- Deepwind Gorge
[566] = cap, -- Eye of the Storm
[968] = cap, -- Eye of the Storm (Rated BG)
[761] = cap, -- Gilneas
[628] = cap, -- Isle of Conquest
[726] = cap, -- Twin Peaks
[2106] = cap, -- Warsong Gulch
[489] = cap, -- Warsong Gulch (Classic)
[2118] = cap, -- Wintergrasp
}
public.zoneTblWorld = {
-- Classic
[-1447] = -947, [-1419] = -947, [-1425] = -947, [-1431] = -947, [-1440] = -947, [-1444] = -947, -- Azeroth
[-1948] = -1945, [-1944] = -1945, -- Outland
-- Retail
[-104] = -101, [-100] = -101, -- Outland
[-376] = -424, [-379] = -424, [-504] = -424, [-507] = -424, [-554] = -424, -- Pandaria
[-542] = -572, [-543] = -572, [-534] = -572, -- Draenor
[-630] = -619, [-634] = -619, [-641] = -619, [-650] = -619, [-680] = -619, -- Broken Isles
[-942] = -947, -- Azeroth/BfA
[-1536] = -1647, [-1565] = -1647, [-1525] = -1647, [-1533] = -1647, -- Shadowlands
[-2022] = -1978, [-2023] = -1978, [-2024] = -1978, [-2085] = -1978, -- Dragon Isles
[-2214] = -2274, [-2215] = -2274, [-2213] = -2274, [-2248] = -2274, -- Khaz Algar
}
end
-----------------------------------------------------------------------
-- Utility
--
local GetAddOnMetadata = C_AddOns.GetAddOnMetadata
local EnableAddOn = C_AddOns.EnableAddOn or EnableAddOn
local GetAddOnInfo = C_AddOns.GetAddOnInfo or GetAddOnInfo
local LoadAddOn = C_AddOns.LoadAddOn or LoadAddOn
local IsAddOnLoaded = C_AddOns.IsAddOnLoaded or IsAddOnLoaded
local GetAddOnDependencies = C_AddOns.GetAddOnDependencies or GetAddOnDependencies
local GetAddOnOptionalDependencies = C_AddOns.GetAddOnOptionalDependencies or GetAddOnOptionalDependencies
local GetNumAddOns = C_AddOns.GetNumAddOns or GetNumAddOns
local IsAddOnLoadOnDemand = C_AddOns.IsAddOnLoadOnDemand or IsAddOnLoadOnDemand
local IsInGroup, IsInRaid = IsInGroup, IsInRaid
public.EnableAddOn = EnableAddOn
local reqFuncAddons = {
BigWigs_Core = true,
BigWigs_Options = true,
BigWigs_Plugins = true,
}
local function sysprint(msg)
print("|cFF33FF99BigWigs|r: "..msg)
end
local function load(obj, index)
if obj then return true end
if loadOnSlash[index] then
if not IsAddOnLoaded(index) then -- Check if we need remove our slash handler stub.
for _, slash in next, loadOnSlash[index] do
hash_SlashCmdList[slash] = nil
end
end
loadOnSlash[index] = nil
end
if reqFuncAddons[index] then
reqFuncAddons[index] = nil
if index == "BigWigs_Core" then
reqFuncAddons.BigWigs_Plugins = nil
end
end
EnableAddOn(index) -- Make sure it wasn't left disabled for whatever reason
local loaded, reason = LoadAddOn(index)
if not loaded then
sysprint(ADDON_LOAD_FAILED:format(GetAddOnInfo(index), _G["ADDON_"..reason]))
end
return loaded
end
local function loadAddons(tbl)
if not tbl[1] then return end
for i = 1, #tbl do
local index = tbl[i]
if not IsAddOnLoaded(index) and load(nil, index) then
local name = GetAddOnInfo(index)
public:SendMessage("BigWigs_ModulePackLoaded", name)
end
end
for i = #tbl, 1, -1 do
tbl[i] = nil
end
end
local function loadZone(zone)
if loadOnZone[zone] then
loadAddons(loadOnZone[zone])
end
end
local function loadAndEnableCore()
local loaded = load(BigWigs, "BigWigs_Core")
if not BigWigs then return end
loadAddons(loadOnCoreEnabled)
BigWigs:Enable()
return loaded
end
local function loadCoreAndOptions()
loadAndEnableCore()
load(BigWigsOptions, "BigWigs_Options")
end
do
local _, tbl = ...
tbl.LoadCoreAndOptions = loadCoreAndOptions
end
local function loadCoreAndOpenOptions()
loadCoreAndOptions()
if BigWigsOptions then
BigWigsOptions:Open()
end
end
local function Popup(msg, focus)
local frame = CreateFrame("Frame")
frame:SetFrameStrata("DIALOG")
frame:SetToplevel(true)
frame:SetSize(400, 150)
frame:SetPoint("CENTER", "UIParent", "CENTER")
local text = frame:CreateFontString(nil, "ARTWORK", "GameFontRedLarge")
text:SetSize(380, 0)
text:SetJustifyH("CENTER")
text:SetJustifyV("TOP")
text:SetNonSpaceWrap(true)
text:SetPoint("TOP", 0, -16)
local border = CreateFrame("Frame", nil, frame, focus and "DialogBorderOpaqueTemplate" or "DialogBorderTemplate")
border:SetAllPoints(frame)
local button = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
button:SetSize(128, 32)
button:SetPoint("BOTTOM", 0, 16)
button:SetScript("OnClick", function(self)
self:GetParent():Hide()
end)
button:SetText(L.okay)
button:SetNormalFontObject("DialogButtonNormalText")
button:SetHighlightFontObject("DialogButtonHighlightText")
text:SetText(msg)
frame:Show()
end
C_PartyInfo.DoCountdown = function(num) -- Overwrite Blizz countdown
loadAndEnableCore()
if SlashCmdList.BIGWIGSPULL then
SlashCmdList.BIGWIGSPULL(num)
end
end
-----------------------------------------------------------------------
-- LDB Plugin
--
local dataBroker = ldb:NewDataObject("BigWigs",
{type = "launcher", label = "BigWigs", icon = "Interface\\AddOns\\BigWigs\\Media\\Icons\\minimap_disabled.tga"}
)
function dataBroker.OnClick(self, button)
-- If you are a dev and need the BigWigs options loaded to do something, please come talk to us on Discord about your use case
if button == "RightButton" then
--if isMouseDown then
loadCoreAndOpenOptions()
--else
-- local trace = debugstack(2)
-- public.mstack = trace
-- sysprint("|cFFff0000WARNING!|r")
-- sysprint("One of your addons was prevented from force loading the BigWigs options.")
-- sysprint("Contact us on the BigWigs Discord about this, it should not be happening.")
--end
end
end
function dataBroker.OnTooltipShow(tt)
tt:AddLine("BigWigs")
if BigWigs and BigWigs:IsEnabled() then
local added = false
for _, module in BigWigs:IterateBossModules() do
if module:IsEnabled() then
if not added then
tt:AddLine(L.activeBossModules, 1, 1, 1)
added = true
end
tt:AddLine(module.displayName)
end
end
end
for i = 1, #tooltipFunctions do
tooltipFunctions[i](tt)
end
tt:AddLine(L.tooltipHint, 0.2, 1, 0.2, true)
end
-----------------------------------------------------------------------
-- Version listing functions
--
tooltipFunctions[#tooltipFunctions+1] = function(tt)
for _, version in next, usersVersion do
if version < highestFoundVersion then
tt:AddLine(L.oldVersionsInGroup, 1, 1, 1, true)
break
end
end
end
-----------------------------------------------------------------------
-- Loader initialization
--
do
local loadOnInstanceAddons = {} -- Will contain all names of addons with an X-BigWigs-LoadOn-InstanceId directive
local loadOnWorldBoss = {} -- Addons that should load when targetting a specific mob
local extraMenus = {} -- Addons that contain extra zone menus to appear in the GUI
local noMenus = {} -- Addons that contain zones that shouldn't create a menu
local blockedMenus = {} -- Zones that shouldn't create a menu
for i = 1, GetNumAddOns() do
local name, _, _, _, addonState = GetAddOnInfo(i)
if reqFuncAddons[name] then
EnableAddOn(i) -- Make sure it wasn't left disabled for whatever reason
end
if addonState ~= "DISABLED" then
local meta = GetAddOnMetadata(i, "X-BigWigs-LoadOn-CoreEnabled")
if meta then
if name == "BigWigs_Plugins" then -- Always first
table.insert(loadOnCoreEnabled, 1, i)
else
loadOnCoreEnabled[#loadOnCoreEnabled + 1] = i
end
end
meta = GetAddOnMetadata(i, "X-BigWigs-LoadOn-InstanceId")
if meta then
loadOnInstanceAddons[#loadOnInstanceAddons + 1] = i
end
meta = GetAddOnMetadata(i, "X-BigWigs-ExtraMenu")
if meta then
extraMenus[#extraMenus + 1] = i
end
meta = GetAddOnMetadata(i, "X-BigWigs-NoMenu")
if meta then
noMenus[#noMenus + 1] = i
end
meta = GetAddOnMetadata(i, "X-BigWigs-LoadOn-WorldBoss")
if meta then
loadOnWorldBoss[#loadOnWorldBoss + 1] = i
end
local minVersion = GetAddOnMetadata(i, "X-BigWigs-Minimum")
if minVersion and GetAddOnDependencies(i) == "BigWigs" then -- Safety
local version = tonumber(minVersion)
if version and version > BIGWIGS_VERSION then
Popup(L.outOfDateContentPopup:format(name), true)
local msg = L.outOfDateContentRaidWarning:format(name, version, BIGWIGS_VERSION)
sysprint(msg)
RaidNotice_AddMessage(RaidWarningFrame, msg, {r=1,g=1,b=1}, 90)
end
end
meta = GetAddOnMetadata(i, "X-BigWigs-LoadOn-Slash")
if meta then
loadOnSlash[i] = {}
local tbl = {strsplit(",", meta)}
for j=1, #tbl do
local slash = tbl[j]:trim():upper()
local slashName = "BIGWIGS"..strsub(slash, 2) -- strip the "/"
_G["SLASH_"..slashName.."1"] = slash
SlashCmdList[slashName] = function(text)
if strfind(name, "BigWigs", nil, true) then
-- Attempting to be smart. Only load core & config if it's a BW plugin.
loadCoreAndOptions()
end
if load(nil, i) then -- Load the addon/plugin
-- Call the slash command again, which should have been set by the addon.
-- Authors, do NOT delay setting it in OnInitialize/OnEnable/etc.
ChatFrame_ImportListToHash(SlashCmdList, hash_SlashCmdList)
local func = hash_SlashCmdList[slash]
if func then
func(text)
return
end
end
-- Addon didn't register the slash command for whatever reason, print the default invalid slash message.
local info = ChatTypeInfo["SYSTEM"]
DEFAULT_CHAT_FRAME:AddMessage(HELP_TEXT_SIMPLE, info.r, info.g, info.b, info.id)
end
loadOnSlash[i][j] = slash
end
end
else
local meta = GetAddOnMetadata(i, "X-BigWigs-LoadOn-InstanceId")
if meta then -- Disabled content
for j = 1, select("#", strsplit(",", meta)) do
local rawId = select(j, strsplit(",", meta))
local id = tonumber(rawId:trim())
if id and id > 0 and public.zoneTbl[id] then
if not disabledZones then disabledZones = {} end
disabledZones[id] = name
end
end
end
end
-- check LittleWigs version
if name == "LittleWigs" then
if GetAddOnMetadata(i, "X-LittleWigs-Repo") then
public.usingLittleWigsRepo = true
public.littlewigsVersionString = L.littlewigsSourceCheckout
else
local version = GetAddOnMetadata(i, "Version")
if version then
local alpha = strfind(version, "-", nil, true)
if alpha then
public.littlewigsVersionString = L.littlewigsAlphaRelease:format(version)
else
public.littlewigsVersionString = L.littlewigsOfficialRelease:format(version)
end
end
end
end
if next(loadOnSlash) then
ChatFrame_ImportListToHash(SlashCmdList, hash_SlashCmdList) -- Add our slashes to the hash.
end
end
local function iterateInstanceIds(addon, ...)
for i = 1, select("#", ...) do
local rawId = select(i, ...)
local id = tonumber(rawId:trim())
if id then
local instanceName = GetRealZoneText(id)
-- register the instance id for enabling.
if instanceName and instanceName ~= "" then -- Protect live client from beta client ids
enableZones[id] = true
if not loadOnZone[id] then loadOnZone[id] = {} end
loadOnZone[id][#loadOnZone[id] + 1] = addon
if not menus[id] and not blockedMenus[id] then menus[id] = true end
end
else
local name = GetAddOnInfo(addon)
sysprint(("The instance ID %q from the addon %q was not parsable."):format(tostring(rawId), name))
end
end
end
local currentZone = nil
local function iterateWorldBosses(addon, ...)
for i = 1, select("#", ...) do
local rawZoneOrBoss = select(i, ...)
local zoneOrBoss = tonumber(rawZoneOrBoss:trim())
if zoneOrBoss then
if not currentZone then
currentZone = zoneOrBoss
-- register the zone for enabling.
enableZones[currentZone] = "world"
if not loadOnZone[currentZone] then loadOnZone[currentZone] = {} end
loadOnZone[currentZone][#loadOnZone[currentZone] + 1] = addon
else
worldBosses[zoneOrBoss] = currentZone
currentZone = nil
end
else
local name = GetAddOnInfo(addon)
sysprint(("The zone ID %q from the addon %q was not parsable."):format(tostring(rawZoneOrBoss), name))
end
end
end
local function addExtraMenus(addon, ...)
for i = 1, select("#", ...) do
local rawMenu = select(i, ...)
local id = tonumber(rawMenu:trim())
if id then
local name
if id < 0 then
local tbl = GetMapInfo(-id)
if tbl then
name = tbl.name
else
name = tostring(id)
end
else
name = GetRealZoneText(id)
end
if name and name ~= "" then -- Protect live client from beta client ids
if not loadOnZone[id] then loadOnZone[id] = {} end
loadOnZone[id][#loadOnZone[id] + 1] = addon
if not menus[id] then menus[id] = true end
end
else
local name = GetAddOnInfo(addon)
sysprint(("The extra menu ID %q from the addon %q was not parsable."):format(tostring(rawMenu), name))
end
end
end
local function blockMenus(addon, ...)
for i = 1, select("#", ...) do
local rawMenu = select(i, ...)
local id = tonumber(rawMenu:trim())
if id then
local name
if id < 0 then
local tbl = GetMapInfo(-id)
if tbl then
name = tbl.name
else
name = tostring(id)
end
else
name = GetRealZoneText(id)
end
if name and name ~= "" and not blockedMenus[id] then -- Protect live client from beta client ids
blockedMenus[id] = true
end
else
local name = GetAddOnInfo(addon)
sysprint(("The block menu ID %q from the addon %q was not parsable."):format(tostring(rawMenu), name))
end
end
end
for i = 1, #extraMenus do
local index = extraMenus[i]
local data = GetAddOnMetadata(index, "X-BigWigs-ExtraMenu")
if data then
addExtraMenus(index, strsplit(",", data))
end
end
for i = 1, #noMenus do
local index = noMenus[i]
local data = GetAddOnMetadata(index, "X-BigWigs-NoMenu")
if data then
blockMenus(index, strsplit(",", data))
end
end
for i = 1, #loadOnInstanceAddons do
local index = loadOnInstanceAddons[i]
local instancesIds = GetAddOnMetadata(index, "X-BigWigs-LoadOn-InstanceId")
if instancesIds then
iterateInstanceIds(index, strsplit(",", instancesIds))
end
end
for i = 1, #loadOnWorldBoss do
local index = loadOnWorldBoss[i]
local zones = GetAddOnMetadata(index, "X-BigWigs-LoadOn-WorldBoss")
if zones then
iterateWorldBosses(index, strsplit(",", zones))
end
end
end
function mod:ADDON_LOADED(addon)
if addon ~= "BigWigs" then
-- If you are a dev and need the BigWigs options loaded to do something, please come talk to us on Discord about your use case
--if reqFuncAddons[addon] then
-- local trace = debugstack(2)
-- public.lstack = trace