-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMageGate.lua
2402 lines (2216 loc) · 98.3 KB
/
MageGate.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
-- ====================================================================================================== --
------------------------------------------------MageGate----------------------------------------------------
-- ====================================================================================================== --
-- Written by: Endar_Ren --
-- ====================================================================================================== --
----------------------------------------------Change History------------------------------------------------
-- ====================================================================================================== --
-- Version 1.1 Changes 8/25/2010 --
-- * Fixed use of addon when a target or a group member is casting a portal. --
-- * Corrected GateGroup function so that the Party channel is used outside of an instance. --
-- * Corrected spelling error: "Dailing". --
-- ====================================================================================================== --
-- Version 1.2 Changes 10/5/10 --
-- * Fixed the nothing happening in Party group type. (I think) --
-- ====================================================================================================== --
-- Version 1.3 Changes 10/13/2010 --
-- * Now usable in 4.0.1. --
-- ====================================================================================================== --
-- Version 1.4 Changes 11/3/2010 --
-- * Add in Slash Command to turn the addon on and off. (Does not disable or enable the addon) --
-- ====================================================================================================== --
-- Version 1.4.1 Changes 11/18/2010 --
-- * Added Confirm Summons event and "Incoming traveller" message. Need to test. FAILED --
-- * Changed GateGroup to use number in the party to see if you are alone. Need to test. FAILED --
-- * Added version number field. --
-- ====================================================================================================== --
-- Version 1.4.2 Changed 1/3/2011 --
-- * Adding in sound effects. Sounds given to me by Ricardo58. Thank you. --
-- ====================================================================================================== --
-- Version 1.4.3 Changed 4/26/2011 --
-- * TOC version number changed to 40100. --
-- ====================================================================================================== --
-- Version 2 Changed 7/1/2011 --
-- * TOC version number changed to 40200. --
-- * Ace3 Library implemented. --
-- * New Slash commands: sfx & autosum. --
-- * New Sound Effect for summon --
-- * Stargate Atlantis Dialing abort sound effect option added. --
-- ====================================================================================================== --
-- Version 2.1 Changed 3/5/2012 --
-- * TOC AUTOSUMM saved variable renamed to self.db.profile.AutoSumm. --
-- * self.db.profile.AutoSumm is set to false by default now. --
-- * Fixed get for abortfx to actually return self.db.profile.AbortStyle. --
-- ====================================================================================================== --
-- Version 3.0 Changed 5/2/2012 --
-- * Changes made by Daimanu. --
-- * Portal identification method changed to deal with other languages. --
-- * Chevron count up added, with customizable chevron number range. --
-- * French translation added. --
-- ====================================================================================================== --
-- Version 3.1 Changed 5/17/2012 --
-- * Added option to disable the chevron count text. --
-- * Added sound effects of ring turning start and continue turning. --
-- ====================================================================================================== --
-- Version 6.0 Changed 6/12/2012 --
-- * Added play command to have sound effects play on request. --
-- ** play command without value will list the names of all the sound effects. --
-- * Changed self.db.profile.SoundFx to an integer: 0 =off, 1=on, 2 = on & --
-- * master (will be heard when WoW sound off. --
-- * Added caster command to allow player to toogle whether portals casted by others will trigger fx. --
-- * Hooks added for detection of using any portal. --
-- * SG exit sound fx added. --
-- * Added Astrolabe library. --
-- * Table of the IDs of all teleport spells. --
-- * Portal Tracking added on minimap. --
-- * UI Added. --
-- * Added Star Gate:Atlantis Ring turning sound. --
-- * self.db.profile.RingTurning value holds which ring turning to use. "sg1" or "sga". --
-- * self.db.profile.TeleRing for basic teleport sfx on/off. --
-- * Chevron count fixed. --
-- * Moved all saved variables into an AceDB. --
-- ====================================================================================================== --
-- Version 7 changes. --
-- * Completely moved saved variables to AceDB. --
-- * Switched to Configuration window in Interface. --
-- * Made it so that each teleport and portal can have different sounds. --
-- * Modified database to have each teleport and portal setting. --
-- * Added StarGate Universe gate sounds. --
-- * Added Asguard Teleport sound. --
-- * Added Star Trek TOS Transporter sound. --
-- ====================================================================================================== --
-- Version 7.1 changes. 8/21/2012+ --
-- * Minimap icons of portals can now be hidden and shown. --
-- * AcceptBattlefieldPort has been hooked for BG Teleport effect. --
-- * BGTeleport table added to database. --
-- * Modified the portalID table be have tables with a name and a continent number. --
-- ====================================================================================================== --
-- Version 7.2 changes. 8/30/12 --
-- * Fixed portal watcher? --
-- * Testing StopSound. --
-- * Removed following functions: --
-- ** MageGate:ChangeAbortSFX. --
-- ** MageGate:SoundEffects --
-- ** MageGate:AutoSummon --
-- * Removed following database elements: --
-- ** AbortStyle --
-- ** RingTurning --
-- ====================================================================================================== --
-- Version 7.3.1 --
-- * Added Lorewalker's Lodestone to localization as LORESTONE. Its spell ID was added to --
-- teleportsID as 126956. --
-- --
-- ====================================================================================================== --
-- Verson 7.4.1 --
-- * Fixed compatibility bug with Sexymaps. Notified by Cleopandra on Curse. --
-- ====================================================================================================== --
-- Version 7.4.2 --
-- 10/18/2012 --
-- * Added teleport and portal for Vale of Eternal Blossoms. --
-- ====================================================================================================== --
-- Version 7.4.3 --
-- 11/29/2012 --
-- * Modified TOC for 5.1. --
-- * Added INSTANCE_CHAT for gategroup function for groups in an instance. --
-- * Added Shard Portals as a new group of portals?? --
-- ====================================================================================================== --
-- Version 7.4.4 --
-- 1/11/2013 --
-- * Added Ancient Teleport and Portal: Dalaran --
-- ====================================================================================================== --
-- Version 7.4.7 --
-- 3/25/2013 --
-- * Added Kirin Tor Beacon
-- * Added Sunreaver Beacon
-- * Added The Schools of Arcane Magic - Mastery --
-- ====================================================================================================== --
-- Version 7.5 --
-- 8/7/2013 --
-- * Added icon for Ancient Dalaran Portal --
-- * Added honest option on whether to say you are dialing Ancient Dalaran or not. --
-- ====================================================================================================== --
-- ====================================================================================================== --
-- Version 8 --
-- 12/29/2015 --
-- * Added Admiral's Compass --
-- * Fixed portal dialing sequence. --
-- ====================================================================================================== --
-- Version 9 --
-- 9/24/2016 --
-- * Added new library. --
-- ====================================================================================================== --
-- Version 9.1
-- 10/23/2018
-- Updated version number.
-- Removed spell name and spell rank from events.
-- Updated libraries.
-- Added BFA Teleports and Portals.
-- ====================================================================================================== --
-- Version 11.0.2.1
-- 09/12/2024
-- Updated version number.
-- Updated libraries.
-- Add War Within teleports and portals.
-- ====================================================================================================== --
local G = getfenv(0)
local protX, protY = nil,nil;
MageGate = LibStub("AceAddon-3.0"):NewAddon("MageGate","AceConsole-3.0","AceComm-3.0", "AceEvent-3.0", "AceTimer-3.0","AceHook-3.0")
local L = LibStub("AceLocale-3.0"):GetLocale("MageGate")
local HBD = LibStub("HereBeDragons-2.0")
local HBDpin = LibStub("HereBeDragons-Pins-2.0")
local settingMenu = LibStub("AceConfigDialog-3.0")
local AceConfig = LibStub("AceConfig-3.0")
-- ========================================================================================================================================================= --
-- Fields
-- ========================================================================================================================================================= --
--local ringCount = 0;
local tooltip = CreateFrame("GameTooltip", "MGTooltip", UIParent, "GameTooltipTemplate")
tooltip.lines = {}
local channeling = false;
local goingThroughPortal = false
local openPortalList = {} --Used to store opened portals for tracking.
local ActiveEffect = {}
local EndEffectConditions = {}
local DHDScroll = nil
local portalButtons = {}
local glyphButtons = {}
local currentPortal = 0
local GateSpinTimer = nil
-- ========================================================================================================================================================= --
-- Teleport
-- ========================================================================================================================================================= --
local teleportsID = {}
teleportsID[120145] = L["Ancient_Teleport:_Dalaran"]
teleportsID[556] = L["Astral_Recall"]
teleportsID[48020] = L["Demonic_Circle"]
teleportsID[53140] = L["Teleport:_Dalaran"]
teleportsID[18960] = L["Teleport:_Moonglade"]
teleportsID[3565] = L["Teleport:_Darnassus"]
teleportsID[32271] = L["Teleport:_Exodar"]
teleportsID[3562] = L["Teleport:_Ironforge"]
teleportsID[32272] = L["Teleport:_Silvermoon"]
teleportsID[49358] = L["Teleport:_Stonard"]
teleportsID[3561] = L["Teleport:_Stormwind"]
teleportsID[49359] = L["Teleport:_Theramore"]
teleportsID[3566] = L["Teleport:_Thunder_Bluff"]
teleportsID[88342] = L["Teleport:_Tol_Barad_(Alliance)"]
teleportsID[88344] = L["Teleport:_Tol_Barad_(Horde)"]
teleportsID[3563] = L["Teleport:_Undercity"]
teleportsID[3567] = L["Teleport:_Orgrimmar"]
teleportsID[33690] = L["Teleport:_Shattrath_(Alliance)"]
teleportsID[35715] = L["Teleport:_Shattrath_(Horde)"]
teleportsID[132621] = L["Teleport:_Vale_of_Eternal_BlossomsA"]
teleportsID[132627] = L["Teleport:_Vale_of_Eternal_BlossomsH"]
teleportsID[36941] = L["Toshley's_Station"]
teleportsID[23453] = L["Gadgetzan"]
teleportsID[71436] = L["Boots_of_the_Bay"]
teleportsID[39937] = L["Ruby_Slippers"]
teleportsID[8690] = L["Hearthstone"]
teleportsID[94719] = L["The_Innkeeper's_Daughter"]
teleportsID[48129] = L["Scroll_of_Recall"]
teleportsID[60320] = L["Scroll_of_Recall_II"]
teleportsID[60321] = L["Scroll_of_Recall_III"]
teleportsID[66238] = L["Argent_Crusader's_Tabard"]
teleportsID[89157] = L["Wrap_of_UnityA"]
teleportsID[89158] = L["Wrap_of_UnityH"]
teleportsID[89597] = L["Baradin's_Wardens_Tabard"]
teleportsID[89598] = L["Hellscream's_Reach_Tabard"]
teleportsID[54406] = L["Dalaran_Signet"]
teleportsID[82674] = L["The_Last_Relic_of_Argus"]
teleportsID[23442] = L["Everlook"]
teleportsID[36890] = L["Area_52"]
teleportsID[22564] = L["Stormpike_Insignia"]
teleportsID[22563] = L["Frostwolf_Insignia"]
teleportsID[75136] = L["Ethereal_Portal"]
teleportsID[41234] = L["Blessed_Medallion_of_Karabor"]
teleportsID[46149] = L["Darnarian_Scroll_of_Teleportation"]
teleportsID[80256] = L["Potion_of_Deepholm"]
teleportsID[126956] = L["LORESTONE"]
teleportsID[140295] = L["KIRIN_TOR_BEACON"]
teleportsID[140300] = L["SUNREAVER_BEACON"]
teleportsID[59317] = L["SCHOOL_ARCANE_MASTERY"]
teleportsID[139437] = L["Bizmo_Brewpub"]
teleportsID[139432] = L["Brawlgar_Arena"]
teleportsID[147985] = L["Curious_Bronze_Timepiece_Alundra"]
teleportsID[147988] = L["Curious_Bronze_Timepiece_Lara"]
teleportsID[128832] = L["Teleport_Jade_Serpent"]
teleportsID[145430] = L["Timelost artifact"]
teleportsID[176248] = L["Teleport_Stormshield"]
teleportsID[176242] = L["Teleport_Warspear"]
teleportsID[171253] = L["Garrison_Hearthstone"]
teleportsID[147988] = L["Curious_Bronze_Timepiece_Lara"]
teleportsID[128832] = L["Teleport_Jade_Serpent"]
teleportsID[168487] =L["Home_Away_from_Home"]
teleportsID[145430] = L["Timelost artifact"]
teleportsID[189838] = L["Admirals_Compass"]
teleportsID[224869] = L["Teleport: Dalaran - Broken Isles"]
teleportsID[281403] = L["Teleport_Boralus"]
teleportsID[281404] = L["Teleport_Daz"]
teleportsID[344587] = L["Teleport_Oribos"]
teleportsID[395277] = L["Teleport_Valdrakken"]
teleportsID[446540] = L["Teleport_Dornogal"]
--teleportsID[64024] = L["Teleport_Conservatory"]
--teleportsID[120145] = L["Ancient_Dalaran"]
-- ========================================================================================================================================================= --
-- Teleport Objects IDs
-- ========================================================================================================================================================= --
-- Halls of Origination Transit Device
-- ========================================================================================================================================================= --
-- Portal IDs
-- ========================================================================================================================================================= --
--Remake table with elements {Name = , Continenint = }
local portalsID = {}
portalsID[120146] = L["Ancient_Portal:_Dalaran"]
portalsID[10059] = L["Stormwind"]
portalsID[11416] = L["Ironforge"]
portalsID[11417] = L["Orgrimmar"]
portalsID[11418] = L["Undercity"]
portalsID[11419] = L["Darnassus"]
portalsID[11420] = L["Thunder_Bluff"]
portalsID[32266] = L["Exodar"]
portalsID[32267] = L["Silvermoon"]
portalsID[33691] = L["Shattrath(Alliance)"]
portalsID[35717] = L["Shattrath(Horde)"]
portalsID[49360] = L["Theramore"]
portalsID[49361] = L["Stonard"]
portalsID[53142] = L["Dalaran"]
portalsID[88345] = L["Tol Barad(Alliance)"]
portalsID[88346] = L["Tol Barad(Horde)"]
portalsID[73324] = L["Jania's_Locket_Dalaran"]
portalsID[28148] = L["Karazhan"]
portalsID[132626] = L["Vale_of_Eternal_BlossomsH"]
portalsID[132620] = L["Vale_of_Eternal_BlossomsA"]
portalsID[67833] = L["Wormhole_Northrend"]
portalsID[126755] = L["Wormhole_Pandaria"]
portalsID[224871] = L["Dalaran_Broken"]
portalsID[176246] = L["Portal_Stormshield"]
portalsID[176244] = L["Portal_Warspear"]
portalsID[224871] = L["Portal_DalaranBroken"]
portalsID[281400] = L["Portal_Boralus"]
portalsID[281402] = L["Portal_Daz"]
portalsID[344597] = L["Portal_Oribos"]
portalsID[395289] = L["Portal_Valdrakken"]
portalsID[446534] = L["Portal_Dornogal"]
wormholeDestinations = {}
wormholeDestinations[67833] = "Northrend"
wormholeDestinations[126755] = "Pandaria"
-- ========================================================================================================================================================= --
-- Dropdown Menu Values
-- ========================================================================================================================================================= --
local PortalValues = {"SG-1", "SG-A", "SG-U"}
local soundLevels = {"FX", "Music", "Ambience" , "Master"}
-- ========================================================================================================================================================= --
-- Sound Effect List
-- ========================================================================================================================================================= --
local soundEffectTable = {}
soundEffectTable["ring-start-1"] = {fileName = "Interface\\AddOns\\MageGate\\Sound Files\\SG-1 Ring Starts Turning.ogg", length = 3.6870}
soundEffectTable["ring-turning-1"] = {fileName = "Interface\\AddOns\\MageGate\\Sound Files\\SG Ring Turning without start.ogg", length = 2.5890}
soundEffectTable["ring-turning-2"] = {fileName = "Interface\\AddOns\\MageGate\\Sound Files\\Atlantis Ring Turn.ogg", length = 2.1590}
soundEffectTable["open"] = {fileName = "Interface\\AddOns\\MageGate\\Sound Files\\Kawoosh 1.ogg", length = 6.4750}
soundEffectTable["abort1"] = {fileName = "Interface\\AddOns\\MageGate\\Sound Files\\SG-1 Dial Abort.ogg", length = 2.0310}
soundEffectTable["abort2"] = {fileName = "Interface\\AddOns\\MageGate\\Sound Files\\Atlantis Dial Abort.ogg", length = 1.6300}
soundEffectTable["rings"] = {fileName = "Interface\\AddOns\\MageGate\\Sound Files\\Rings 1.ogg", length = 5.7920}
soundEffectTable["chrono"] = {fileName = "Interface\\AddOns\\MageGate\\Sound Files\\chronosphere.ogg", length = 2.0430}
soundEffectTable["asguard-tele"] = {fileName = "Interface\\AddOns\\MageGate\\Sound Files\\Asguard Teleporter.ogg", length = 3.2150}
soundEffectTable["sgu-start"] = {fileName = "Interface\\AddOns\\MageGate\\Sound Files\\SGU Gate Start.ogg", length = 2.8300}
soundEffectTable["sgu-abort"] = {fileName = "Interface\\AddOns\\MageGate\\Sound Files\\SGU Abort.ogg", length = 2.2450}
soundEffectTable["sgu-turning"] = {fileName = "Interface\\AddOns\\MageGate\\Sound Files\\SGU Ring Loop.ogg", length = 3.9770}
soundEffectTable["st-tos-trans"] = {fileName = "Interface\\AddOns\\MageGate\\Sound Files\\Star Trek TOS Transporter.ogg", length = 5.6306}
soundEffectTable["close"] = {fileName = "Interface\\AddOns\\MageGate\\Sound Files\\Close.ogg", length = 2.6250}
-- ========================================================================================================================================================= --
-- startSoundSchemes
-- ========================================================================================================================================================= --
local startSoundSchemes = {}
startSoundSchemes[1] = {{Sound = "ring-start-1", Count = 1}, {Sound = "ring-turning-1", Count = 4} }
startSoundSchemes[2] = {{Sound = "ring-turning-2", Count = 5} }
startSoundSchemes[3] = {{Sound = "sgu-start", Count = 1}, {Sound = "sgu-turning", Count = 4} }
startSoundSchemes[4] = {{Sound = "abort1", Count = 1} }
startSoundSchemes[5] = {{Sound = "abort2", Count = 1} }
startSoundSchemes[6] = {{Sound = "sgu-abort", Count = 1} }
startSoundSchemes[7] = {{Sound = "open", Count = 1} }
startSoundSchemes[8] = {{Sound = "rings", Count = 1} }
startSoundSchemes[9] = {{Sound = "asguard-tele", Count = 1} }
startSoundSchemes[10] = {{Sound = "st-tos-trans", Count = 1} }
startSoundSchemes[11] = {{Sound = "chrono", Count = 1} }
-- ========================================================================================================================================================= --
-- Command Line Option Table
-- ========================================================================================================================================================= --
NeooptionTable = {
name = "MageGate",
handler = MageGate,
type = 'group',
args = {
dhd = { name = "Show Gate Settings",
desc = "Show Gate Settings",
type = "execute",
func = function () MageGateDHD:Show() end
},
play = {
name = "Play a sound effect",
desc = L["PLAY_DESC"],
type = "input",
set = "PlayFX",
get = function () return nil end
},
show = {
name = "Show control frame",
desc = L["SHOW"] ,
type = "execute",
func = function () InterfaceOptionsFrame_OpenToCategory(MageGate.optionFrames.main) end
}
-- sfx = {
-- name = "Sound Effects",
-- desc = L["SOUND_FX_DESC"],
-- type = "execute",
-- func = "SoundEffects"
-- },
-- settings = {
-- name = "MageGate Settings",
-- desc = L["PRINT_SETTINGS"],
-- type = "execute",
-- func = "PrintSettings"
-- },
-- autosum = {
-- name = "Auto Summon",
-- desc = L["AUTO_SUMMON_DESC"],
-- type = "execute",
-- func = "AutoSummon"
-- },
-- abortfx = {
-- name = "Abort Effect",
-- desc = string.format(L["ABORT_FX_DESC"], "sg1", "sga", "sgu"),
-- type = "toggle",
-- set = function(info, val)
-- if val == "sg1" then
-- MageGate.db.profile.AbortStyle = 1
-- end
-- if val == "sga" then
-- MageGate.db.profile.AbortStyle = 2
-- end
-- if val == "sgu" then
-- MageGate.db.profile.AbortStyle = 3
-- end
-- end,
-- get = function() return MageGate.db.profile.AbortStyle end
-- },
-- marker = {
-- name = "Marker Toggle",
-- desc = L["MARKER_TOGGLE"],
-- type = "toggle",
-- set = "MarkerToggle",
-- get = function () return MARKER end
-- },
-- chevcount = {
-- name = "Print chevron count",
-- desc = string.format(L["CHEV_COUNT_TOGGLE"]),
-- type = "toggle",
-- set = "ChangeChevronCounter",
-- get = function () return self.db.profile.ChevronCounter end
-- },
-- wormexit = {
-- name = "Toggle Worm exit sfx",
-- desc = string.format(L["WORM_EXIT_DESC"]),
-- type = "toggle",
-- set = "toggleWormExit",
-- get = function () return self.db.profile.WormExit end
-- },
-- caster = {
-- name = "Toggle caster requirement",
-- desc = L["CASTER_TOGGLE"],
-- type = "toggle",
-- set = "ToogleJustYou",
-- get = function () return self.db.profile.JustYou end
-- },
---,
-- chevrons = {
-- name = "Number of chevrons",
-- desc = L["CHEVRONS_COUNT_DESC"],
-- type = "range",
-- min = 7,
-- max = 9,
-- step = 1,
-- set = "SetChevronCount",
-- get = function () return self.db.profile.ChevronCount end
-- },
}
}
LibStub("AceConfig-3.0"):RegisterOptionsTable("MageGate", NeooptionTable, {"mgate"})
-- ========================================================================================================================================================== --
-- DEFAULTS
-- ========================================================================================================================================================== --
--------------------------------------------------------------------------------------------------------------------------------------
--- Structure of defaults table.
-- * profile
-- ** PortalClose = { On = [true, false],
-- *** Level = [1,2,3,4]}
-- ** Classic = [true, false]. Value determines if the addon will be in classic mode or not.
-- ** AbortStyle = [1,2,3] Sets the abort style in classic.
-- ** JustYou = [true,false] Sets if sound effects go off for others or just you in classic.
-- ** SoundFx = [1,2,3] Sets if sound effects are off, on, or on master in classic.
-- ** ChevronCount = [7,8,9] Sets the highest chevron to use in classic.
-- ** ChevronCounter = [true,false] Sets whether the full chevron count is done in classic.
-- ** TeleSound = [1,2,3]. Sets what the teleport sound for all teleports in classic.
-- ** TeleRing = [true, false] Sets if teleport spells have sound effect in classic.
-- ** Marker = [true, false]. Set is portal tracking is on in classic.
-- ** RingTurning = [1,2,3]. Set the ring turning style when using classic mode.
-- ** On = [true,false] Sets whether all function are on or off in classic.
-- ** Teleports[string of spellID] = {Sound = [1,2,3,4],
-- *** JustYou = [true,false],
-- *** Level = [1,2,3,4]}
-- ** Portal[spellID] = {Abort =[1,2,3], The abort setting for a particuler portal.
-- *** RingTurning = [1,2,3], The ring turning sound effect for a particular portal.
-- *** ChevronCount = [7,8,9],
-- *** ChevronCall = [true,false],
-- *** Level = [1,2,3,4],
-- *** AnnounceDialing = [true, false],
-- *** AnnounceLock = [true, false],
-- *** AnnounceAbort = [true, false] }
-- ** InstanceTeleport = { Active = [true, false],
-- *** Level = [1,2,3,4]
-- *** Sound = [1,2,3,4]}
-- ** SummonSFX = { Active = [true, false],
-- *** Level = [1,2,3,4]
-- *** Sound = [1,2,3,4]}
-- ** PortalTracking = {Active = [true, false],
-- *** Alpha = [0.0 - 1.0],
-- *** WorldMap =[true,false],
-- *** Minimap = [true, false]}
-- ** AutoSumm = [true,false]
-- ** Traveller = [true, false]
-- ** WormExit = [true, false]
--------------------------------------------------------------------------------------------------------------------------------------
local defaults = {
profile={
PortalClose = { Active = true,
Level = 4
},
JustYou = true, --Classic setting
SoundFx = 1, --Classic setting
AutoSumm = false,
ChevronCount = 7, --Classic setting
ChevronCounter = false, --Classic setting
SingleTeleportSetting = { Active = false,
Sound = 2,
Level = 4,
JustYou = true
},
SinglePortalSetting = { Active = false,
Abort = 1,
RingTurning = 1,
Level = 4,
JustYou = true,
FullChev = false,
ChevMax = 7,
AnnAbort = true,
AnnDial = true,
AnnLock = true
},
WormExit = true,
Honest = true,
Traveller = true,
TeleSound = 2,
TeleRing = true, --Classic setting
Marker = true, --Classic setting
-- RingTurning = 1, --Classic setting
On = true,
Teleports = { -- Teleports[string of spellID] = { Sound = [true,false],
-- JustYou = [true,false],
-- Level = [1,2,3,4]
-- }
},
Portal = { -- Portal[spellID] = { Abort = [1,2,3],
-- RingTurning = [1,2,3],
-- ChevronCount = [7,8,9],
-- ChevronCall = [true,false],
-- Level = [1,2,3,4],
-- UncanonChev = [true, false],
-- GateCastBar = {
-- Enabled = true,
-- NumChevrons = 7,
-- Glyphs = {}
-- }
-- }
},
InstanceTeleport = { Active = true,
Level = 4,
Sound = 2
},
BGTeleport = { Active = true,
Level = 4,
Sound = 2
},
SummonSFX = { Active = true,
Level = 4,
Sound = 2
},
PortalTracking = { Alpha = 1.0,
WorldMap = false,
Minimap = true
},
Classic = false
}}
---This function is used to fill the default values for each teleport spell.
--It does not effect the saved values.
function MageGate:FillTeleDefaults()
for key, val in pairs(teleportsID) do
--teleoptions.args[val
defaults.profile.Teleports[tostring(key)] = {Sound = 2, JustYou = true,Level =4}
end
end
---This function is used to fill the default values for each portal spell.
--It does not effect the saved values.
function MageGate:FillPortalDefaults()
for key, val in pairs(portalsID) do
defaults.profile.Portal[key] = {Abort = 1, RingTurning = 1, ChevronCount = 7, ChevronCall = false, Level = 4, UncanonChev = false,
AnnounceDialing = true, AnnounceLock = true, AnnounceAbort = true,
GateCastBar = {
Enabled = true,
NumChevrons = 7,
Glyphs = {}
}
}
end
end
-- ========================================================================================================================================================== --
---Option Tables
-- ========================================================================================================================================================== --
local main = {
name = "MageGate",
type = "group",
handler = MageGate,
args = {
confgendesc = {
order = 1,
type = "description",
name = C_AddOns.GetAddOnMetadata("MageGate", "Notes").."\n\n",
cmdHidden = true
},
confinfodesc = {
name = "",
type = "group", inline = true,
args = {
confversiondesc = {
order = 1,
type = "description",
name = "|cffffd700".."version "..": "
..G["GREEN_FONT_COLOR_CODE"]..tostring(C_AddOns.GetAddOnMetadata("MageGate", "Version")).."\n",
cmdHidden = true
},
confauthordesc = {
order = 2,
type = "description",
name = "|cffffd700".."Author "..": "
..G["ORANGE_FONT_COLOR_CODE"]..C_AddOns.GetAddOnMetadata("MageGate", "Author").."\n",
cmdHidden = true
},
}
}
},
}
-- ========================================================================================================================================================= --
-- GateFxOptions
-- ========================================================================================================================================================= --
local GateFxOptions = { name = L["GATE_SOUND_OP"],
type = "group",
handler = MageGate,
args = {
Single = {
type = "toggle",
name = L["SINGLE_STYLE"] ,
desc = L["SINGLE_STYLE_DESC_PORTAL"],
order = 1,
set = function (info, value) MageGate.db.profile.SinglePortalSetting.Active = value
MageGate:PortalToggle(value)
end,
get = function () return MageGate.db.profile.SinglePortalSetting.Active end
},
RingTurning = {
type = "select",
style = "dropdown",
name = L["RING_TURNING_SOUND"] ,
desc = L["RING_TURNING_SOUND_DESC"],
order = 2,
set = function(info,value) MageGate.db.profile.SinglePortalSetting.RingTurning = value end,
get = function () return MageGate.db.profile.SinglePortalSetting.RingTurning end,
values = PortalValues},
Abort = {type = "select",
style = "dropdown",
name = L["RING_ABORT_SOUND"],
desc = L["RING_ABORT_SOUND_DESC"],
order = 2,
set = function(info,value) MageGate.db.profile.SinglePortalSetting.Abort = value end,
get = function () return MageGate.db.profile.SinglePortalSetting.Abort end,
values = PortalValues},
GateSoundLevel = {type = "select",
style = "dropdown",
name = L["TELE_SOUND_LEVEL"],
desc = L["TELE_SOUND_LEVEL_DESC"],
order = 2,
set = function(info,value) MageGate.db.profile.SinglePortalSetting.Level = value end,
get = function () return MageGate.db.profile.SinglePortalSetting.Level end,
values = {"FX", "Music", "Ambience" , "Master"}
},
ChevronCount = {
type = "range",
name = L["CHEV_RANGE"],
desc = L["CHEV_RANGE_DESC"] ,
order = 4,
min = 7,
max = 9,
step = 1,
set = function(info, val) MageGate.db.profile.SinglePortalSetting.ChevMax = val end,
get = function() return MageGate.db.profile.SinglePortalSetting.ChevMax end
},
ChevronCall = {
type = "toggle",
name = L["FULL_CHEV"],
desc = string.format(L["CHEV_COUNT_TOGGLE"]),
order = 4,
set = function(info, val) MageGate.db.profile.SinglePortalSetting.FullChev = val end,
get = function() return MageGate.db.profile.SinglePortalSetting.FullChev end
},
annDialing = {
type = "toggle",
name = L["ANNOUNCE_DIALING"],
desc = L["ANNOUNCE_DIALING_DESC"],
order = 6,
set = function(info, val) MageGate.db.profile.SinglePortalSetting.AnnDial = val end,
get = function() return MageGate.db.profile.SinglePortalSetting.AnnDial end
},annLock = {
type = "toggle",
name = L["ANNOUNCE_LOCK"],
desc = L["ANNOUNCE_LOCK_DESC"],
order = 6,
set = function(info, val) MageGate.db.profile.SinglePortalSetting.AnnLock = val end,
get = function() return MageGate.db.profile.SinglePortalSetting.AnnLock end
},
annAbort = {
type = "toggle",
name = L["ANNOUNCE_ABORT"],
desc = L["ANNOUNCE_ABORT_DESC"],
order = 6,
set = function(info, val) MageGate.db.profile.SinglePortalSetting.AnnAbort = val end,
get = function() return MageGate.db.profile.SinglePortalSetting.AnnAbort end
}
}
--SinglePortalSetting = {Active = false, Abort = 1, RingTurning = 1, Level = 4, JustYou = true, FullChev = false, ChevMax = 7},
};
-- Plays portal sound when clicking on a portal.
local function OnMouseDown(self, button)
if button == "RightButton" then
local text = GameTooltipTextLeft1:GetText()
if text and (text:find("Portal") or text:find("Teleport")) then
-- Player clicked on a mage portal
print("Departing!")
MageGate:DoFx("Interface\\AddOns\\MageGate\\Sound Files\\Exit-Enter 1.ogg", "Master")
end
end
end
WorldFrame:HookScript("OnMouseDown", OnMouseDown)
---This function fills the group GateFxOptions with a sub group for each portal.
function MageGate:PortalToggle(value)
for key, val in pairs(portalsID) do
GateFxOptions.args[tostring(val)].disabled = value
end
end
function MageGate:FillRingStyles ()
--defaults.profile.Portal[key]
for key, val in pairs(portalsID) do
GateFxOptions.args[tostring(val)] = {
name = val,
type = "group",
handler = MageGate,
disabled = MageGate.db.profile.SinglePortalSetting.Active,
args = {
GateHeader = {
type = "header",
name = L["GATE_SOUNDS"],
order = 1},
RingTurning = {
type = "select",
style = "dropdown",
name = L["RING_TURNING_SOUND"] ,
desc = L["RING_TURNING_SOUND_DESC"],
order = 2,
set = function(info,value) MageGate.db.profile.Portal[key].RingTurning = value end,
get = function () return MageGate.db.profile.Portal[key].RingTurning end,
values = PortalValues},
Abort = {type = "select",
style = "dropdown",
name = L["RING_ABORT_SOUND"],
desc = L["RING_ABORT_SOUND_DESC"],
order = 2,
set = function(info,value) MageGate.db.profile.Portal[key].Abort = value end,
get = function () return MageGate.db.profile.Portal[key].Abort end,
values = PortalValues},
GateSoundLevel = {type = "select",
style = "dropdown",
name = L["TELE_SOUND_LEVEL"],
desc = L["TELE_SOUND_LEVEL_DESC"],
order = 2,
set = function(info,value) MageGate.db.profile.Portal[key].Level = value end,
get = function () return MageGate.db.profile.Portal[key].Level end,
values = {"FX", "Music", "Ambience" , "Master"}
},
GateHeader2 = {
type = "header",
name = L["CHEV_SETTINGS"], order = 3},
ChevronCount = {
type = "range",
name = L["CHEV_RANGE"],
desc = L["CHEV_RANGE_DESC"] ,
order = 4,
min = 7,
max = 9,
step = 1,
set = function(info, val) MageGate.db.profile.Portal[key].ChevronCount = val end,
get = function() return MageGate.db.profile.Portal[key].ChevronCount end
},
ChevronCall = {
type = "toggle",
name = L["FULL_CHEV"],
desc = string.format(L["CHEV_COUNT_TOGGLE"]),
order = 4,
set = function(info, val) MageGate.db.profile.Portal[key].ChevronCall = val end,
get = function() return MageGate.db.profile.Portal[key].ChevronCall end
},
GateHeader3 = {
type = "header",
name = L["MESSAGE_SETTINGS"], order = 4},
annDialing = {
type = "toggle",
name = L["ANNOUNCE_DIALING"],
desc = L["ANNOUNCE_DIALING_DESC"],
order = 6,
set = function(info, val) MageGate.db.profile.Portal[key].AnnounceDialing = val end,
get = function() return MageGate.db.profile.Portal[key].AnnounceDialing end
},annLock = {
type = "toggle",
name = L["ANNOUNCE_LOCK"],
desc = L["ANNOUNCE_LOCK_DESC"],
order = 6,
set = function(info, val) MageGate.db.profile.Portal[key].AnnounceLock = val end,
get = function() return MageGate.db.profile.Portal[key].AnnounceLock end
},
annAbort = {
type = "toggle",
name = L["ANNOUNCE_ABORT"],
desc = L["ANNOUNCE_ABORT_DESC"],
order = 6,
set = function(info, val) MageGate.db.profile.Portal[key].AnnounceAbort = val end,
get = function() return MageGate.db.profile.Portal[key].AnnounceAbort end
}
}
}
end
end
--AnnounceDialing = true, AnnounceLock = true, AnnounceAbort = true
-- ========================================================================================================================================================= --
--
-- ========================================================================================================================================================= --
local FeatureOptions = {
name = L["FEATURE_SETTINGS"],
type = "group",
handler = MageGate,
-- get = function(item) return MageGate.db.profile.PortalTracking[item[#item]] end,
-- set = function(item, value) MageGate.db.profile.PortalTracking[item[#item]] = value end,
args = {
ADHonest = {type = "toggle", name = L["HONEST"], desc = L["HONEST_DEC"] ,order = 1,set = function (info, val) MageGate.db.profile.Honest = val; end, get = function (info) return MageGate.db.profile.Honest end },
PortalHeader = {
type = "header",
name = L["PORTAL_TRACKING_SETTINGS"] ,
order = 1},
-- WorldMap = {type = "toggle",
-- name = L["ON_WORLD_MAP"],
-- desc = L["ON_WORLD_DESC"] ,
-- order = 2,
-- set = function (info, val) MageGate.db.profile.PortalTracking.WorldMap = val end,
-- get = function () return MageGate.db.profile.PortalTracking.WorldMap end},
Minimap = {type = "toggle",
name = L["ON_MINIMAP"],
desc = L["ON_MINIMAP_DESC"] ,
order = 2,
set = function (info, val) MageGate.db.profile.PortalTracking.Minimap = val; MageGate:TogglePortalHide(val) end,
get = function () return MageGate.db.profile.PortalTracking.Minimap end},
Alpha = {
type = "range",
name = L["ALPHA"],
desc = L["ALPHA_DESC"],
order = 3,
min = 0,
max = 1,
step = 0.1,
set = function (info,val)MageGate.db.profile.PortalTracking.Alpha = val end,
get = function() return MageGate.db.profile.PortalTracking.Alpha end
},
spacer1 = {
order = 3,
type = "description",
name = "\n",
},
SummonHeader = {
type = "header",
name = L["SUMMONING_SETTINGS"],
order = 4},
AutoSumm = {type = "toggle",
name = L["AUTO_SUMM"],
desc = L["AUTO_SUMMON_DESC"],
order = 5,
set = function (info, val) MageGate.db.profile.AutoSumm = val end,
get = function () return MageGate.db.profile.AutoSumm end},
SummonSFXAct = {type = "toggle",
name = L["SUMMON_SOUND_ON"],
desc = L["SUMMON_SOUND_ON_DESC"],
order = 5,
set = function (info, val) MageGate.db.profile.SummonSFX.Active = val end,
get = function () return MageGate.db.profile.SummonSFX.Active end},
SummonSound= {
type = "select",
style = "dropdown",
name = L["SUMMON_SOUND"],
desc = L["SUMMON_SOUND_DESC"],
order = 5,
set = function(info,value) MageGate.db.profile.SummonSFX.Sound = value end,
get = function () return MageGate.db.profile.SummonSFX.Sound end,
values = {"Rings","Asguard","Star Trek TOS","Chrono"}
},
SummonSoundLevel= {
type = "select",
style = "dropdown",
name = L["TELE_SOUND_LEVEL"],
desc = L["TELE_SOUND_LEVEL_DESC"],
order = 5,
set = function(info,value) MageGate.db.profile.SummonSFX.Sound = value end,
get = function () return MageGate.db.profile.SummonSFX.Sound end,
values = soundLevels
},
Traveller = {type = "toggle",
name = L["TRAVELLER_UI"],
desc = L["TRAVELLER_DESC"],
order = 5,
set = function (info, val) MageGate.db.profile.Traveller = val end,
get = function () return MageGate.db.profile.Traveller end},
InstanceHeader = {
type = "header",
name = L["INST_TELE"],
order = 6},
InstanceActive = {type = "toggle",
name = L["ENABLED"],
desc =L["ENABLED_INST_TELE_DESC"],
order = 7,
set = function (info, val) MageGate.db.profile.InstanceTeleport.Active = val end,
get = function () return MageGate.db.profile.InstanceTeleport.Active end},
InstanceSound= {
type = "select",
style = "dropdown",
name = L["SOUNDS"] ,
desc = L["INST_TELE_SOUND_DESC"],
order = 7,
set = function(info,value) MageGate.db.profile.InstanceTeleport.Sound = value end,
get = function () return MageGate.db.profile.InstanceTeleport.Sound end,
values = {"Rings","Asguard","Star Trek TOS","Chrono"}
},
InstanceSoundLevel= {
type = "select",
style = "dropdown",
name = L["TELE_SOUND_LEVEL"],
desc = L["TELE_SOUND_LEVEL_DESC"],
order = 7,
set = function(info,value) MageGate.db.profile.InstanceTeleport.Level = value end,
get = function () return MageGate.db.profile.InstanceTeleport.Level end,
values = soundLevels
},
BGHeader = {
type = "header",
name = L["BG_HEADER"],
order = 8},
BGActive = {type = "toggle",
name = L["ENABLED"],
desc =L["ENABLED_BG_TELE_DESC"],
order = 9,
set = function (info, val) MageGate.db.profile.BGTeleport.Active = val end,
get = function () return MageGate.db.profile.BGTeleport.Active end},
BGSound= {
type = "select",
style = "dropdown",
name = L["SOUNDS"] ,
desc = L["BG_TELE_SOUND_DESC"],
order = 9,
set = function(info,value) MageGate.db.profile.BGTeleport.Sound = value end,
get = function () return MageGate.db.profile.BGTeleport.Sound end,
values = {"Rings","Asguard","Star Trek TOS","Chrono"}
},
BGSoundLevel= {
type = "select",
style = "dropdown",
name = L["TELE_SOUND_LEVEL"],
desc = L["TELE_SOUND_LEVEL_DESC"],
order = 9,
set = function(info,value) MageGate.db.profile.BGTeleport.Level = value end,
get = function () return MageGate.db.profile.BGTeleport.Level end,
values = soundLevels
},
--BGTeleport
ExitHeader = {
type = "header",