-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBattlegroundTargets.lua
More file actions
6059 lines (5186 loc) · 278 KB
/
BattlegroundTargets.lua
File metadata and controls
6059 lines (5186 loc) · 278 KB
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
-- -------------------------------------------------------------------------- --
-- BattlegroundTargets by kunda --
-- -------------------------------------------------------------------------- --
-- --
-- BattlegroundTargets is a 'Enemy Unit Frame' for battlegrounds. --
-- BattlegroundTargets is not a 'real' (Enemy) Unit Frame. --
-- BattlegroundTargets simply generates buttons with target macros. --
-- --
-- Features: --
-- # Shows all battleground enemies with role, class and name. --
-- - Left-click : set target --
-- - Right-click: set focus --
-- # Independent settings for '10 vs 10', '15 vs 15' and '40 vs 40'. --
-- # Target --
-- # Main Assist Target --
-- # Focus --
-- # Enemy Flag Carrier --
-- # Target Count --
-- # Health --
-- # Range Check --
-- --
-- -------------------------------------------------------------------------- --
-- --
-- These events are always registered: --
-- - PLAYER_REGEN_DISABLED --
-- - PLAYER_REGEN_ENABLED --
-- - ZONE_CHANGED_NEW_AREA (to determine if current zone is a battleground) --
-- - PLAYER_LEVEL_UP (only registered if player level < level cap) --
-- --
-- In Battleground: --
-- # If enabled: ------------------------------------------------------------ --
-- - UPDATE_BATTLEFIELD_SCORE --
-- - PLAYER_DEAD --
-- - PLAYER_UNGHOST --
-- - PLAYER_ALIVE --
-- --
-- # Range Check: --------------------------------------- VERY HIGH CPU USAGE --
-- - Events: --
-- 1) Combat Log: --- COMBAT_LOG_EVENT_UNFILTERED --
-- 2) Class: -------- PLAYER_TARGET_CHANGED --
-- - UNIT_HEALTH_FREQUENT --
-- - UPDATE_MOUSEOVER_UNIT --
-- - UNIT_TARGET --
-- 3/4) Mix: ---------- COMBAT_LOG_EVENT_UNFILTERED --
-- - PLAYER_TARGET_CHANGED --
-- - UNIT_HEALTH_FREQUENT --
-- - UPDATE_MOUSEOVER_UNIT --
-- - UNIT_TARGET --
-- - The data to determine the distance to an enemy is not always available.--
-- This is restricted by the WoW API. --
-- - This feature is a compromise between CPU usage (FPS), lag/network --
-- bandwidth (no SendAdd0nMessage), fast and easy visual recognition and --
-- suitable data. --
-- --
-- # Health: ------------------------------------------------- HIGH CPU USAGE --
-- - Events: - UNIT_TARGET --
-- - UNIT_HEALTH_FREQUENT --
-- - UPDATE_MOUSEOVER_UNIT --
-- - The health from an enemy is not always available. --
-- This is restricted by the WoW API. --
-- - A raidmember/raidpet MUST target(focus/mouseover) an enemy OR --
-- you/yourpet MUST target/focus/mouseover an enemy to get the health. --
-- --
-- # Target Count: ------------------------------------ HIGH MEDIUM CPU USAGE --
-- - Event: - UNIT_TARGET --
-- --
-- # Main Assist Target: ------------------------------- LOW MEDIUM CPU USAGE --
-- - Events: - RAID_ROSTER_UPDATE --
-- - UNIT_TARGET --
-- --
-- # Leader: ------------------------------------------- LOW MEDIUM CPU USAGE --
-- - Event: - UNIT_TARGET --
-- --
-- # Level: (only if player level < level cap) ---------------- LOW CPU USAGE --
-- - Event: - UNIT_TARGET --
-- --
-- # Target: -------------------------------------------------- LOW CPU USAGE --
-- - Event: - PLAYER_TARGET_CHANGED --
-- --
-- # Focus: --------------------------------------------------- LOW CPU USAGE --
-- - Event: - PLAYER_FOCUS_CHANGED --
-- --
-- # Enemy Flag Carrier: --------------------------------- VERY LOW CPU USAGE --
-- - Events: - CHAT_MSG_BG_SYSTEM_HORDE --
-- - CHAT_MSG_BG_SYSTEM_ALLIANCE --
-- Flag detection in case of disconnect, UI reload or mid-battle-joins: --
-- (temporarily registered until each enemy is scanned) --
-- - UNIT_TARGET --
-- - UPDATE_MOUSEOVER_UNIT --
-- - PLAYER_TARGET_CHANGED --
-- --
-- # No SendAdd0nMessage(): ------------------------------------------------- --
-- This AddOn does not use/need SendAdd0nMessage(). SendAdd0nMessage() --
-- increases the available data by transmitting information to other --
-- players. This has certain pros and cons. I may include (opt-in) such --
-- functionality in some future release. maybe. dontknow. --
-- --
-- -------------------------------------------------------------------------- --
-- --
-- slash commands: /bgt - /bgtargets - /battlegroundtargets --
-- --
-- -------------------------------------------------------------------------- --
-- --
-- Thanks to all who helped with the localization. --
-- --
-- Special thanks to Roma. --
-- --
-- -------------------------------------------------------------------------- --
-- ---------------------------------------------------------------------------------------------------------------------
BattlegroundTargets_Options = {};
local BattlegroundTargets = CreateFrame("Frame");
local L = BattlegroundTargets_Localization;
local BGN = BattlegroundTargets_BGNames;
local FLG = BattlegroundTargets_Flag;
local RNA = BattlegroundTargets_RaceNames;
local GVAR = {};
local TEMPLATE = {};
local OPT = {};
local AddonIcon = "Interface\\AddOns\\BattlegroundTargets\\BattlegroundTargets-texture-button";
local _G = _G;
local GetTime = _G.GetTime;
local InCombatLockdown = _G.InCombatLockdown;
local IsInInstance = _G.IsInInstance;
local IsRatedBattleground = _G.IsRatedBattleground;
local GetBattlefieldArenaFaction = _G.GetBattlefieldArenaFaction;
local GetRealZoneText = _G.GetRealZoneText;
local GetMaxBattlefieldID = _G.GetMaxBattlefieldID;
local GetBattlefieldStatus = _G.GetBattlefieldStatus;
local GetNumBattlefieldScores = _G.GetNumBattlefieldScores;
local GetBattlefieldScore = _G.GetBattlefieldScore;
local SetBattlefieldScoreFaction = _G.SetBattlefieldScoreFaction;
local UnitName = _G.UnitName;
local UnitLevel = _G.UnitLevel;
local UnitHealthMax = _G.UnitHealthMax;
local UnitHealth = _G.UnitHealth;
local UnitIsPartyLeader = _G.UnitIsPartyLeader;
local UnitBuff = _G.UnitBuff;
local UnitDebuff = _G.UnitDebuff;
local GetSpellInfo = _G.GetSpellInfo;
local IsSpellInRange = _G.IsSpellInRange;
local CheckInteractDistance = _G.CheckInteractDistance;
local GetNumRaidMembers = _G.GetNumRaidMembers;
local GetRaidRosterInfo = _G.GetRaidRosterInfo;
local math_min = _G.math.min;
local math_max = _G.math.max;
local math_floor = _G.math.floor;
local math_random = _G.math.random;
local string_find = _G.string.find;
local string_match = _G.string.match;
local string_format = _G.string.format;
local table_sort = _G.table.sort;
local table_wipe = _G.table.wipe;
local pairs = _G.pairs;
local tonumber = _G.tonumber;
local inWorld;
local inBattleground;
local inCombat;
local reCheckBG;
local reCheckScore;
local reSizeCheck = 0;
local reSetLayout;
local isConfig;
local testDataLoaded;
local isTarget = 0;
local hasFlag;
local isDeadUpdateStop;
local isLeader;
local isAssistName;
local isAssistUnitId;
local rangeSpellName, rangeMin, rangeMax;
local flags = 0;
local isFlagBG = 0;
local flagCHK;
local flagflag;
-- THROTTLE (reduce CPU usage) -----------------------------------------------------------------------------------------
local scoreUpdateThrottle = GetTime(); -- scoreupdate: B.attlefieldScoreUpdate()
local scoreUpdateFrequency = 1; -- scoreupdate: 0-20 updates = 1 second | 21+ updates = 5 seconds
local scoreUpdateCount = 0; -- scoreupdate: (reason: later score updates are less relevant and 5 seconds is still very high)
local range_SPELL_Frequency = 0.2; -- rangecheck: [class-spell]: the 0.2 second freq is per enemy (variable: ENEMY_Name2Range[enemyname])
local range_CL_Throttle = 0; -- rangecheck: [combatlog] C.ombatLogRangeCheck()
local range_CL_Frequency = 3; -- rangecheck: [combatlog] 50/50 or 66/33 or 75/25 (%Yes/%No) => 64/36 = 36% combatlog messages filtered (36% vs overhead: two variables, one addition, one number comparison and if filtered one math_random)
local range_CL_DisplayThrottle = GetTime(); -- rangecheck: [combatlog] display update
local range_CL_DisplayFrequency = 0.33; -- rangecheck: [combatlog] display update
local leaderThrottle = 0; -- leader: C.heckUnitTarget()
local leaderFrequency = 5; -- leader: if isLeader is true then pause 5 times(events) until next check (reason: leader does not change often in a bg, irrelevant info anyway)
-- FORCE UPDATE (precise results) --------------------------------------------------------------------------------------
local assistForceUpdate = GetTime(); -- assist: C.heckUnitTarget()
local assistFrequency = 0.5; -- assist: immediate assist target check (reason: target loss and I don't know why... -> brute force)
local targetCountForceUpdate = GetTime(); -- targetcount: C.heckUnitTarget()
local targetCountFrequency = 30; -- targetcount: a complete raid/raidtarget check every 30 seconds (reason: target loss and I don't know why... -> brute force)
-- WARNING -------------------------------------------------------------------------------------------------------------
local latestScoreUpdate = GetTime(); -- scoreupdate: B.attlefieldScoreUpdate()
local latestScoreWarning = 60; -- scoreupdate: inCombat-warning icon if latest score update is >= 60 seconds
-- MISC ----------------------------------------------------------------------------------------------------------------
local range_DisappearTime = 8; -- rangecheck: display update - clears range display if an enemy was not seen for 8 seconds
local playerLevel = UnitLevel("player");
local isLowLevel;
local maxLevel = 80;
local playerName = UnitName("player");
local playerClass, playerClassEN = UnitClass("player");
local targetName, targetRealm;
local focusName, focusRealm;
local assistTargetName, assistTargetRealm;
local playerFactionDEF = 0; -- player faction (DEFAULT)
local oppositeFactionDEF = 0; -- opposite faction (DEFAULT)
local playerFactionBG = 0; -- player faction (in battleground)
local oppositeFactionBG = 0; -- opposite faction (in battleground)
local oppositeFactionREAL; -- real opposite faction
local ENEMY_Data = {}; -- numerical | all data
local ENEMY_Names = {}; -- key/value | key = enemyName, value = count
local ENEMY_Names4Flag = {}; -- key/value | key = enemyName without realm, value = button number
local ENEMY_Name2Button = {}; -- key/value | key = enemyName, value = button number
local ENEMY_Name2Percent = {}; -- key/value | key = enemyName, value = health in percent
local ENEMY_Name2Range = {}; -- key/value | key = enemyName, value = time of last contact
local ENEMY_Name2Level = {}; -- key/value | key = enemyName, value = level
local ENEMY_FirstFlagCheck = {}; -- key/value | key = enemyName, value = 1
local FRIEND_Names = {}; -- key/value | key = friendName, value = 1
local TARGET_Names = {}; -- key/value | key = friendName, value = enemyName
local SPELL_Range = {}; -- key/value | key = spellId, value = maxRange
local testSize = 10;
local testIcon1 = 2;
local testIcon2 = 5;
local testIcon3 = 3;
local testIcon4 = 4;
local testHealth = {};
local testRange = {};
local testLeader = 4;
local testGroupNum = {};
local healthBarWidth = 0.01;
local sizeOffset = 5;
local sizeBarHeight = 14;
local fontPath = _G["GameFontNormal"]:GetFont();
local currentSize = 10;
local bgSize = {
["Alterac Valley"] = 40,
["Warsong Gulch"] = 10,
["Arathi Basin"] = 15,
["Eye of the Storm"] = 15,
["Strand of the Ancients"] = 15,
["Isle of Conquest"] = 40,
["The Battle for Gilneas"] = 10,
["Twin Peaks"] = 10,
};
local bgSizeINT = {
[1] = 10,
[2] = 15,
[3] = 40
};
local flagBG = {
["Warsong Gulch"] = 1
};
local flagIDs = {
[23333] = 1,
[23335] = 1
};
local sortBy = {
[1] = CLASS.."* / "..NAME,
[2] = NAME
};
local locale = GetLocale();
local sortDetail = {
[1] = "*"..CLASS.." ("..locale..")",
[2] = "*"..CLASS.." (english)",
[3] = "*"..CLASS.." (Blizzard)"
};
local classcolors = {};
for class, color in pairs(RAID_CLASS_COLORS) do
classcolors[class] = { r = color.r, g = color.g, b = color.b }
end
local classes = {
DEATHKNIGHT = { 0.265625, 0.484375, 0.515625, 0.734375 },
DRUID = { 0.7578125, 0.9765625, 0.015625, 0.234375 },
HUNTER = { 0.01953125, 0.23828125, 0.265625, 0.484375 },
MAGE = { 0.265625, 0.484375, 0.015625, 0.234375 },
PALADIN = { 0.01953125, 0.23828125, 0.515625, 0.734375 },
PRIEST = { 0.51171875, 0.73046875, 0.265625, 0.484375 },
ROGUE = { 0.51171875, 0.73046875, 0.015625, 0.234375 },
SHAMAN = { 0.265625, 0.484375, 0.265625, 0.484375 },
WARLOCK = { 0.7578125, 0.9765625, 0.265625, 0.484375 },
WARRIOR = { 0.01953125, 0.23828125, 0.015625, 0.234375 },
ZZZFAILURE = { 0, 0, 0, 0 }
};
local class_LocaSort = {};
FillLocalizedClassList(class_LocaSort, false);
local class_BlizzSort = {};
for i = 1, #CLASS_SORT_ORDER do
class_BlizzSort[ CLASS_SORT_ORDER[i] ] = i;
end
local class_IntegerSort = {
[1] = { cid = "DEATHKNIGHT", blizz = class_BlizzSort.DEATHKNIGHT or 2, eng = "Death Knight", loc = class_LocaSort.DEATHKNIGHT or "Death Knight" },
[2] = { cid = "DRUID", blizz = class_BlizzSort.DRUID or 7, eng = "Druid", loc = class_LocaSort.DRUID or "Druid" },
[3] = { cid = "HUNTER", blizz = class_BlizzSort.HUNTER or 10, eng = "Hunter", loc = class_LocaSort.HUNTER or "Hunter" },
[4] = { cid = "MAGE", blizz = class_BlizzSort.MAGE or 9, eng = "Mage", loc = class_LocaSort.MAGE or "Mage"},
[5] = { cid = "PALADIN", blizz = class_BlizzSort.PALADIN or 3, eng = "Paladin", loc = class_LocaSort.PALADIN or "Paladin" },
[6] = { cid = "PRIEST", blizz = class_BlizzSort.PRIEST or 5, eng = "Priest", loc = class_LocaSort.PRIEST or "Priest" },
[7] = { cid = "ROGUE", blizz = class_BlizzSort.ROGUE or 8, eng = "Rogue", loc = class_LocaSort.ROGUE or "Rogue" },
[8] = { cid = "SHAMAN", blizz = class_BlizzSort.SHAMAN or 6, eng = "Shaman", loc = class_LocaSort.SHAMAN or "Shaman" },
[9] = { cid = "WARLOCK", blizz = class_BlizzSort.WARLOCK or 9, eng = "Warlock", loc = class_LocaSort.WARLOCK or "Warlock" },
[10] = { cid = "WARRIOR", blizz = class_BlizzSort.WARRIOR or 1, eng = "Warrior", loc = class_LocaSort.WARRIOR or "Warrior" }
};
local ranges = {
DEATHKNIGHT = 49895,
DRUID = 5176,
HUNTER = 75,
MAGE = 133,
PALADIN = 62124,
PRIEST = 589,
ROGUE = 6770,
SHAMAN = 403,
WARLOCK = 686,
WARRIOR = 100
};
local rangeTypeName = {
[1] = "1) CombatLog |cffffff79(0-73)|r",
[2] = "2) ...",
[3] = "3) ...",
[4] = "4) ..."
};
local rangeDisplay = {
[1] = "STD 100",
[2] = "STD 100 mono",
[3] = "STD 50",
[4] = "STD 50 mono",
[5] = "STD 10",
[6] = "STD 10 mono",
[7] = "X 100 mono",
[8] = "X 50 mono",
[9] = "X 10",
[10] = "X 10 mono"
};
local function rt(H, E, M, P) return E, P, E, M, H, P, H, M; end
local Textures = {
BattlegroundTargetsIcons = { path = "Interface\\AddOns\\BattlegroundTargets\\BattlegroundTargets-texture-icons.tga" },
SliderKnob = { coords = { 19/64, 30/64, 1/64, 18/64 } },
SliderBG = {
coordsL = { 19/64, 24/64, 27/64, 33/64 },
coordsM = { 25/64, 26/64, 27/64, 33/64 },
coordsR = { 26/64, 31/64, 27/64, 33/64 },
coordsLdis = { 19/64, 24/64, 19/64, 25/64 },
coordsMdis = { 25/64, 26/64, 19/64, 25/64 },
coordsRdis = { 26/64, 31/64, 19/64, 25/64 }
},
Expand = { coords = { 1/64, 18/64, 1/64, 18/64 } },
Collapse = { coords = { rt( 1/64, 18/64, 1/64, 18/64) } },
Close = { coords = { 1/64, 18/64, 19/64, 36/64 } },
l40_18 = { coords = {36/64, 41/64, 37/64, 51/64 }, width = 5*2, height = 14*2 },
l40_24 = { coords = {27/64, 36/64, 37/64, 47/64 }, width = 9*2, height = 10*2 },
l40_42 = { coords = { 14/64, 27/64, 37/64, 44/64 }, width = 13*2, height = 7*2 },
l40_81 = { coords = { 0/64, 14/64, 37/64, 42/64 }, width = 14*2, height = 5*2 },
UpdateWarning = {coords = { 0/64, 35/64, 47/64, 63/64 }, width = 35/1.5, height = 16/1.5 }
};
local raidUnitID = {};
for i = 1, 40 do
raidUnitID["raid"..i] = 1;
raidUnitID["raidpet"..i] = 1;
end
local playerUnitID = {};
playerUnitID["target"] = 1;
playerUnitID["pettarget"] = 1;
playerUnitID["focus"] = 1;
playerUnitID["mouseover"] = 1;
local function Print(...)
print("|cffffff7fBattlegroundTargets:|r", ...);
end
local function ClassHexColor(class)
local hex;
if(classcolors[class]) then
hex = string_format("%.2x%.2x%.2x", classcolors[class].r*255, classcolors[class].g*255, classcolors[class].b*255);
end
return hex or "cccccc";
end
local function NOOP() end
local function Desaturation(texture, desaturation)
local shaderSupported = texture:SetDesaturated(desaturation);
if(not shaderSupported) then
if(desaturation) then
texture:SetVertexColor(0.5, 0.5, 0.5);
else
texture:SetVertexColor(1.0, 1.0, 1.0);
end
end
end
local function SortByPullDownFunc(value)
BattlegroundTargets_Options.ButtonSortBy[currentSize] = value;
OPT.ButtonSortBy[currentSize] = value;
BattlegroundTargets:EnableConfigMode();
end
local function SortDetailPullDownFunc(value)
BattlegroundTargets_Options.ButtonSortDetail[currentSize] = value;
OPT.ButtonSortDetail[currentSize] = value;
BattlegroundTargets:EnableConfigMode();
end
local function RangeCheckTypePullDownFunc(value)
BattlegroundTargets_Options.ButtonTypeRangeCheck[currentSize] = value;
OPT.ButtonTypeRangeCheck[currentSize] = value;
end
local function RangeDisplayPullDownFunc(value)
BattlegroundTargets_Options.ButtonRangeDisplay[currentSize] = value;
OPT.ButtonRangeDisplay[currentSize] = value;
BattlegroundTargets:EnableConfigMode();
end
local function Range_Display(state, GVAR_TargetButton, display)
if(state) then
GVAR_TargetButton.Background:SetAlpha(1);
GVAR_TargetButton.TargetCountBackground:SetAlpha(1);
GVAR_TargetButton.ClassColorBackground:SetAlpha(1);
GVAR_TargetButton.RangeTexture:SetAlpha(1);
GVAR_TargetButton.HealthBar:SetAlpha(1);
GVAR_TargetButton.ClassTexture:SetAlpha(1);
GVAR_TargetButton.ClassColorBackground:SetTexture(GVAR_TargetButton.colR5, GVAR_TargetButton.colG5, GVAR_TargetButton.colB5, 1);
GVAR_TargetButton.HealthBar:SetTexture(GVAR_TargetButton.colR, GVAR_TargetButton.colG, GVAR_TargetButton.colB, 1);
else
if(display == 1) then -- Default 100
GVAR_TargetButton.Background:SetAlpha(1);
GVAR_TargetButton.TargetCountBackground:SetAlpha(1);
GVAR_TargetButton.ClassColorBackground:SetAlpha(1);
GVAR_TargetButton.RangeTexture:SetAlpha(0);
GVAR_TargetButton.HealthBar:SetAlpha(1);
GVAR_TargetButton.ClassTexture:SetAlpha(1);
elseif(display == 2) then -- Default 100 m
GVAR_TargetButton.Background:SetAlpha(1);
GVAR_TargetButton.TargetCountBackground:SetAlpha(1);
GVAR_TargetButton.ClassColorBackground:SetAlpha(1);
GVAR_TargetButton.RangeTexture:SetAlpha(0);
GVAR_TargetButton.HealthBar:SetAlpha(1);
GVAR_TargetButton.ClassTexture:SetAlpha(1);
GVAR_TargetButton.ClassColorBackground:SetTexture(0.2, 0.2, 0.2, 1);
GVAR_TargetButton.HealthBar:SetTexture(0.4, 0.4, 0.4, 1);
elseif(display == 3) then -- Default 50
GVAR_TargetButton.Background:SetAlpha(0.5);
GVAR_TargetButton.TargetCountBackground:SetAlpha(0.1);
GVAR_TargetButton.ClassColorBackground:SetAlpha(0.5);
GVAR_TargetButton.RangeTexture:SetAlpha(0);
GVAR_TargetButton.HealthBar:SetAlpha(0.5);
GVAR_TargetButton.ClassTexture:SetAlpha(0.5);
elseif(display == 4) then -- Default 50 m
GVAR_TargetButton.Background:SetAlpha(0.5);
GVAR_TargetButton.TargetCountBackground:SetAlpha(0.1);
GVAR_TargetButton.ClassColorBackground:SetAlpha(0.5);
GVAR_TargetButton.RangeTexture:SetAlpha(0);
GVAR_TargetButton.HealthBar:SetAlpha(0.5);
GVAR_TargetButton.ClassTexture:SetAlpha(0.5);
GVAR_TargetButton.ClassColorBackground:SetTexture(0.2, 0.2, 0.2, 1);
GVAR_TargetButton.HealthBar:SetTexture(0.4, 0.4, 0.4, 1);
elseif(display == 5) then -- Default 10
GVAR_TargetButton.Background:SetAlpha(0.3);
GVAR_TargetButton.TargetCountBackground:SetAlpha(0.1);
GVAR_TargetButton.ClassColorBackground:SetAlpha(0.25);
GVAR_TargetButton.RangeTexture:SetAlpha(0);
GVAR_TargetButton.HealthBar:SetAlpha(0.1);
GVAR_TargetButton.ClassTexture:SetAlpha(0.25);
elseif(display == 6) then -- Default 10 m
GVAR_TargetButton.Background:SetAlpha(0.3);
GVAR_TargetButton.TargetCountBackground:SetAlpha(0.1);
GVAR_TargetButton.ClassColorBackground:SetAlpha(0.25);
GVAR_TargetButton.RangeTexture:SetAlpha(0);
GVAR_TargetButton.HealthBar:SetAlpha(0.1);
GVAR_TargetButton.ClassTexture:SetAlpha(0.25);
GVAR_TargetButton.ClassColorBackground:SetTexture(0.2, 0.2, 0.2, 1);
GVAR_TargetButton.HealthBar:SetTexture(0.4, 0.4, 0.4, 1);
elseif(display == 7) then -- X 100 m
GVAR_TargetButton.Background:SetAlpha(1);
GVAR_TargetButton.TargetCountBackground:SetAlpha(1);
GVAR_TargetButton.ClassColorBackground:SetAlpha(1);
GVAR_TargetButton.RangeTexture:SetAlpha(0);
GVAR_TargetButton.HealthBar:SetAlpha(1);
GVAR_TargetButton.ClassTexture:SetAlpha(1);
GVAR_TargetButton.ClassColorBackground:SetTexture(0.2, 0.2, 0.2, 1);
GVAR_TargetButton.HealthBar:SetTexture(0.4, 0.4, 0.4, 1);
elseif(display == 8) then -- X 50 m
GVAR_TargetButton.Background:SetAlpha(0.5);
GVAR_TargetButton.TargetCountBackground:SetAlpha(0.1);
GVAR_TargetButton.ClassColorBackground:SetAlpha(0.5);
GVAR_TargetButton.RangeTexture:SetAlpha(0);
GVAR_TargetButton.HealthBar:SetAlpha(0.5);
GVAR_TargetButton.ClassTexture:SetAlpha(0.5);
GVAR_TargetButton.ClassColorBackground:SetTexture(0.2, 0.2, 0.2, 1);
GVAR_TargetButton.HealthBar:SetTexture(0.4, 0.4, 0.4, 1);
elseif(display == 9) then -- X 10
GVAR_TargetButton.Background:SetAlpha(0.3);
GVAR_TargetButton.TargetCountBackground:SetAlpha(0.1);
GVAR_TargetButton.ClassColorBackground:SetAlpha(0.25);
GVAR_TargetButton.RangeTexture:SetAlpha(0);
GVAR_TargetButton.HealthBar:SetAlpha(0.1);
GVAR_TargetButton.ClassTexture:SetAlpha(0.25);
else -- X 10 m
GVAR_TargetButton.Background:SetAlpha(0.3);
GVAR_TargetButton.TargetCountBackground:SetAlpha(0.1);
GVAR_TargetButton.ClassColorBackground:SetAlpha(0.25);
GVAR_TargetButton.RangeTexture:SetAlpha(0);
GVAR_TargetButton.HealthBar:SetAlpha(0.1);
GVAR_TargetButton.ClassTexture:SetAlpha(0.25);
GVAR_TargetButton.ClassColorBackground:SetTexture(0.2, 0.2, 0.2, 1);
GVAR_TargetButton.HealthBar:SetTexture(0.4, 0.4, 0.4, 1);
end
end
end
TEMPLATE.BorderTRBL = function(frame)
frame.FrameBorder = frame:CreateTexture(nil, "BORDER");
frame.FrameBorder:SetPoint("TOPLEFT", 1, -1);
frame.FrameBorder:SetPoint("BOTTOMRIGHT", -1, 1);
frame.FrameBorder:SetTexture(0, 0, 0, 1);
frame.FrameBackground = frame:CreateTexture(nil, "BACKGROUND");
frame.FrameBackground:SetPoint("TOPLEFT", 0, 0);
frame.FrameBackground:SetPoint("BOTTOMRIGHT", 0, 0);
frame.FrameBackground:SetTexture(0.8, 0.2, 0.2, 1);
end
TEMPLATE.DisableTextButton = function(button)
button.Border:SetTexture(0.4, 0.4, 0.4, 1);
button:Disable();
end
TEMPLATE.EnableTextButton = function(button, action)
local buttoncolor;
if(action == 1) then
bordercolor = { 0.73, 0.26, 0.21, 1 };
elseif(action == 2) then
bordercolor = { 0.43, 0.32, 0.68, 1 };
elseif(action == 3) then
bordercolor = { 0.24, 0.46, 0.21, 1 };
elseif(action == 4) then
bordercolor = { 0.73, 0.26, 0.21, 1 };
else
bordercolor = { 1, 1, 1, 1 };
end
button.Border:SetTexture(bordercolor[1], bordercolor[2], bordercolor[3], bordercolor[4]);
button:Enable();
end
TEMPLATE.TextButton = function(button, text, action)
local buttoncolor;
local bordercolor;
if(action == 1) then
button:SetNormalFontObject("GameFontNormal");
button:SetDisabledFontObject("GameFontDisable");
buttoncolor = { 0.38, 0, 0, 1 };
bordercolor = { 0.73, 0.26, 0.21, 1 };
elseif(action == 2) then
button:SetNormalFontObject("GameFontNormalSmall");
button:SetDisabledFontObject("GameFontDisableSmall");
buttoncolor = { 0, 0, 0.5, 1 };
bordercolor = { 0.43, 0.32, 0.68, 1 };
elseif(action == 3) then
button:SetNormalFontObject("GameFontNormalSmall");
button:SetDisabledFontObject("GameFontDisableSmall");
buttoncolor = { 0, 0.2, 0, 1 };
bordercolor = { 0.24, 0.46, 0.21, 1 };
elseif(action == 4) then
button:SetNormalFontObject("GameFontNormalSmall");
button:SetDisabledFontObject("GameFontDisableSmall");
buttoncolor = { 0.38, 0, 0, 1 };
bordercolor = { 0.73, 0.26, 0.21, 1 };
else
button:SetNormalFontObject("GameFontNormal");
button:SetDisabledFontObject("GameFontDisable");
buttoncolor = { 0, 0, 0, 1 };
bordercolor = { 1, 1, 1, 1 };
end
button.Background = button:CreateTexture(nil, "BORDER");
button.Background:SetPoint("TOPLEFT", 1, -1);
button.Background:SetPoint("BOTTOMRIGHT", -1, 1);
button.Background:SetTexture(0, 0, 0, 1);
button.Border = button:CreateTexture(nil, "BACKGROUND");
button.Border:SetPoint("TOPLEFT", 0, 0);
button.Border:SetPoint("BOTTOMRIGHT", 0, 0);
button.Border:SetTexture(bordercolor[1], bordercolor[2], bordercolor[3], bordercolor[4]);
button.Normal = button:CreateTexture(nil, "ARTWORK");
button.Normal:SetPoint("TOPLEFT", 2, -2);
button.Normal:SetPoint("BOTTOMRIGHT", -2, 2);
button.Normal:SetTexture(buttoncolor[1], buttoncolor[2], buttoncolor[3], buttoncolor[4]);
button:SetNormalTexture(button.Normal);
button.Disabled = button:CreateTexture(nil, "OVERLAY");
button.Disabled:SetPoint("TOPLEFT", 3, -3);
button.Disabled:SetPoint("BOTTOMRIGHT", -3, 3);
button.Disabled:SetTexture(0.6, 0.6, 0.6, 0.2);
button:SetDisabledTexture(button.Disabled);
button.Highlight = button:CreateTexture(nil, "OVERLAY");
button.Highlight:SetPoint("TOPLEFT", 3, -3);
button.Highlight:SetPoint("BOTTOMRIGHT", -3, 3);
button.Highlight:SetTexture(0.6, 0.6, 0.6, 0.2);
button:SetHighlightTexture(button.Highlight);
button:SetPushedTextOffset(1, -1);
button:SetText(text);
end
TEMPLATE.IconButton = function(button, cut)
button.Back = button:CreateTexture(nil, "BORDER");
button.Back:SetPoint("TOPLEFT", 1, -1);
button.Back:SetPoint("BOTTOMRIGHT", -1, 1);
button.Back:SetTexture(0, 0, 0, 1);
button.Border = button:CreateTexture(nil, "BACKGROUND");
button.Border:SetPoint("TOPLEFT", 0, 0);
button.Border:SetPoint("BOTTOMRIGHT", 0, 0);
button.Border:SetTexture(0.8, 0.2, 0.2, 1);
button.Highlight = button:CreateTexture(nil, "OVERLAY");
button.Highlight:SetPoint("TOPLEFT", 3, -3);
button.Highlight:SetPoint("BOTTOMRIGHT", -3, 3);
button.Highlight:SetTexture(0.6, 0.6, 0.6, 0.2);
button:SetHighlightTexture(button.Highlight);
button.Normal = button:CreateTexture(nil, "ARTWORK");
button.Normal:SetPoint("TOPLEFT", 3, -3);
button.Normal:SetPoint("BOTTOMRIGHT", -3, 3);
button.Normal:SetTexture(Textures.BattlegroundTargetsIcons.path);
button.Normal:SetTexCoord(unpack(Textures.Close.coords));
button:SetNormalTexture(button.Normal);
button.Push = button:CreateTexture(nil, "ARTWORK");
button.Push:SetPoint("TOPLEFT", 4, -4);
button.Push:SetPoint("BOTTOMRIGHT", -4, 4);
button.Push:SetTexture(Textures.BattlegroundTargetsIcons.path);
button.Push:SetTexCoord(unpack(Textures.Close.coords));
button:SetPushedTexture(button.Push);
button.Disabled = button:CreateTexture(nil, "ARTWORK");
button.Disabled:SetPoint("TOPLEFT", 3, -3);
button.Disabled:SetPoint("BOTTOMRIGHT", -3, 3);
button.Disabled:SetTexture(Textures.BattlegroundTargetsIcons.path);
button.Disabled:SetTexCoord(unpack(Textures.Close.coords));
button:SetDisabledTexture(button.Disabled);
Desaturation(button.Disabled, true);
end
TEMPLATE.DisableCheckButton = function(button)
if(button.Text) then
button.Text:SetTextColor(0.5, 0.5, 0.5);
elseif(button.Icon) then
Desaturation(button.Icon, true);
end
button.Border:SetTexture(0.4, 0.4, 0.4, 1);
button:Disable();
end
TEMPLATE.EnableCheckButton = function(button)
if(button.Text) then
button.Text:SetTextColor(1, 1, 1);
elseif(button.Icon) then
Desaturation(button.Icon, false);
end
button.Border:SetTexture(0.8, 0.2, 0.2, 1);
button:Enable();
end
TEMPLATE.CheckButton = function(button, size, space, text, icon)
button.Border = button:CreateTexture(nil, "BACKGROUND");
button.Border:SetWidth(size);
button.Border:SetHeight(size);
button.Border:SetPoint("LEFT", 0, 0);
button.Border:SetTexture(0.4, 0.4, 0.4, 1);
button.Background = button:CreateTexture(nil, "BORDER");
button.Background:SetPoint("TOPLEFT", button.Border, "TOPLEFT", 1, -1);
button.Background:SetPoint("BOTTOMRIGHT", button.Border, "BOTTOMRIGHT", -1, 1);
button.Background:SetTexture(0, 0, 0, 1);
button.Normal = button:CreateTexture(nil, "ARTWORK");
button.Normal:SetPoint("TOPLEFT", button.Border, "TOPLEFT", 1, -1);
button.Normal:SetPoint("BOTTOMRIGHT", button.Border, "BOTTOMRIGHT", -1, 1);
button.Normal:SetTexture(0, 0, 0, 1);
button:SetNormalTexture(button.Normal);
button.Push = button:CreateTexture(nil, "ARTWORK");
button.Push:SetPoint("TOPLEFT", button.Border, "TOPLEFT", 4, -4);
button.Push:SetPoint("BOTTOMRIGHT", button.Border, "BOTTOMRIGHT", -4, 4);
button.Push:SetTexture(0.4, 0.4, 0.4, 0.5);
button:SetPushedTexture(button.Push);
button.Disabled = button:CreateTexture(nil, "ARTWORK");
button.Disabled:SetPoint("TOPLEFT", button.Border, "TOPLEFT", 3, -3);
button.Disabled:SetPoint("BOTTOMRIGHT", button.Border, "BOTTOMRIGHT", -3, 3);
button.Disabled:SetTexture(0.4, 0.4, 0.4, 0.5);
button:SetDisabledTexture(button.Disabled);
button.Checked = button:CreateTexture(nil, "ARTWORK");
button.Checked:SetWidth(size);
button.Checked:SetHeight(size);
button.Checked:SetPoint("LEFT", 0, 0);
button.Checked:SetTexture("Interface\\Buttons\\UI-CheckBox-Check");
button:SetCheckedTexture(button.Checked);
if(icon) then
if(icon == "default") then
button.Icon = button:CreateTexture(nil, "BORDER");
button.Icon:SetWidth(20);
button.Icon:SetHeight(20);
button.Icon:SetPoint("LEFT", button.Normal, "RIGHT", space, 0);
button.Icon:SetTexture("Interface\\AddOns\\BattlegroundTargets\\Target");
button:SetWidth(size + space + 20 + space);
button:SetHeight(size);
elseif(icon == "bgt") then
button.Icon = button:CreateTexture(nil, "BORDER");
button.Icon:SetWidth(20);
button.Icon:SetHeight(20);
button.Icon:SetPoint("LEFT", button.Normal, "RIGHT", space, 0);
button.Icon:SetTexture(AddonIcon);
button:SetWidth(size + space + 20 + space);
button:SetHeight(size);
else
button.Icon = button:CreateTexture(nil, "BORDER");
button.Icon:SetWidth(Textures[icon].width);
button.Icon:SetHeight(Textures[icon].height);
button.Icon:SetPoint("LEFT", button.Normal, "RIGHT", space, 0);
button.Icon:SetTexture(Textures.BattlegroundTargetsIcons.path);
button.Icon:SetTexCoord(unpack(Textures[icon].coords));
button:SetWidth(size + space + Textures[icon].width + space);
button:SetHeight(size);
end
else
button.Text = button:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall");
button.Text:SetHeight(size);
button.Text:SetPoint("LEFT", button.Normal, "RIGHT", space, 0);
button.Text:SetJustifyH("LEFT");
button.Text:SetText(text);
button.Text:SetTextColor(1, 1, 1, 1);
button:SetWidth(size + space + button.Text:GetStringWidth() + space);
button:SetHeight(size);
end
button.Highlight = button:CreateTexture(nil, "OVERLAY");
button.Highlight:SetPoint("TOPLEFT", button, "TOPLEFT", 0, 0);
button.Highlight:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 0, 0);
button.Highlight:SetTexture(1, 1, 1, 0.1);
button.Highlight:Hide();
button:SetScript("OnEnter", function() button.Highlight:Show(); end);
button:SetScript("OnLeave", function() button.Highlight:Hide(); end);
end
TEMPLATE.SetTabButton = function(button, show)
if(show) then
button.TextureBottom:SetTexture(0, 0, 0, 1);
button.TextureBorder:SetTexture(0.8, 0.2, 0.2, 1);
button.show = true;
else
button.TextureBottom:SetTexture(0.8, 0.2, 0.2, 1);
button.TextureBorder:SetTexture(0.4, 0.4, 0.4, 0.4);
button.show = false;
end
end
TEMPLATE.DisableTabButton = function(button)
if(button.TabText) then
button.TabText:SetTextColor(0.5, 0.5, 0.5, 1);
elseif button.TabTexture then
Desaturation(button.TabTexture, true);
end
button:Disable();
end
TEMPLATE.EnableTabButton = function(button, active)
if(button.TabText) then
if(active) then
button.TabText:SetTextColor(0, 0.75, 0, 1);
else
button.TabText:SetTextColor(1, 0, 0, 1);
end
elseif(button.TabTexture) then
Desaturation(button.TabTexture, false);
end
button:Enable();
end
TEMPLATE.TabButton = function(button, text, active)
button.Texture = button:CreateTexture(nil, "BORDER");
button.Texture:SetPoint("TOPLEFT", 1, -1);
button.Texture:SetPoint("BOTTOMRIGHT", -1, 1);
button.Texture:SetTexture(0, 0, 0, 1);
button.TextureBorder = button:CreateTexture(nil, "BACKGROUND");
button.TextureBorder:SetPoint("TOPLEFT", 0, 0);
button.TextureBorder:SetPoint("BOTTOMRIGHT", -1, 1);
button.TextureBorder:SetPoint("TOPRIGHT" ,0, 0);
button.TextureBorder:SetPoint("BOTTOMLEFT" ,1, 1);
button.TextureBorder:SetTexture(0.8, 0.2, 0.2, 1);
button.TextureBottom = button:CreateTexture(nil, "ARTWORK");
button.TextureBottom:SetPoint("TOPLEFT", button, "BOTTOMLEFT" ,1, 2);
button.TextureBottom:SetPoint("BOTTOMLEFT" ,1, 1);
button.TextureBottom:SetPoint("TOPRIGHT", button, "BOTTOMRIGHT" ,-1, 2);
button.TextureBottom:SetPoint("BOTTOMRIGHT" ,-1, 1);
button.TextureBottom:SetTexture(0.8, 0.2, 0.2, 1);
button.TextureHighlight = button:CreateTexture(nil, "ARTWORK");
button.TextureHighlight:SetPoint("TOPLEFT", 3, -3);
button.TextureHighlight:SetPoint("BOTTOMRIGHT", -3, 3);
button.TextureHighlight:SetTexture(1, 1, 1, 0.1);
button:SetHighlightTexture(button.TextureHighlight);
if(text) then
button.TabText = button:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall");
button.TabText:SetText(text);
button.TabText:SetWidth( button.TabText:GetStringWidth() + 10);
button.TabText:SetHeight(12);
button.TabText:SetPoint("CENTER", button, "CENTER", 0, 0);
button.TabText:SetJustifyH("CENTER");
button.TabText:SetTextColor(1, 1, 1, 1);
if(active) then
button.TabText:SetTextColor(0, 0.75, 0, 1);
else
button.TabText:SetTextColor(1, 0, 0, 1);
end
else
button.TabTexture = button:CreateTexture(nil, "OVERLAY");
button.TabTexture:SetPoint("CENTER", 0, 0);
button.TabTexture:SetWidth(17);
button.TabTexture:SetHeight(17);
button.TabTexture:SetTexture(AddonIcon);
end
button:SetScript("OnEnter", function() if(not button.show) then button.TextureBorder:SetTexture(0.4, 0.4, 0.4, 0.8); end end);
button:SetScript("OnLeave", function() if(not button.show) then button.TextureBorder:SetTexture(0.4, 0.4, 0.4, 0.4); end end);
end
TEMPLATE.DisableSlider = function(slider)
slider.textMin:SetTextColor(0.5, 0.5, 0.5, 1);
slider.textMax:SetTextColor(0.5, 0.5, 0.5, 1);
slider.sliderBGL:SetTexCoord(unpack(Textures.SliderBG.coordsLdis));
slider.sliderBGM:SetTexCoord(unpack(Textures.SliderBG.coordsMdis));
slider.sliderBGR:SetTexCoord(unpack(Textures.SliderBG.coordsRdis));
slider.thumb:SetTexCoord(0, 0, 0, 0);
slider.Background:SetTexture(0, 0, 0, 0);
slider:SetScript("OnEnter", NOOP);
slider:SetScript("OnLeave", NOOP);
slider:Disable();
end
TEMPLATE.EnableSlider = function(slider)
slider.textMin:SetTextColor(0.8, 0.8, 0.8, 1);
slider.textMax:SetTextColor(0.8, 0.8, 0.8, 1);
slider.sliderBGL:SetTexCoord(unpack(Textures.SliderBG.coordsL));
slider.sliderBGM:SetTexCoord(unpack(Textures.SliderBG.coordsM));
slider.sliderBGR:SetTexCoord(unpack(Textures.SliderBG.coordsR));
slider.thumb:SetTexCoord(unpack(Textures.SliderKnob.coords))
slider:SetScript("OnEnter", function() slider.Background:SetTexture(1, 1, 1, 0.1); end);
slider:SetScript("OnLeave", function() slider.Background:SetTexture(0, 0, 0, 0); end);
slider:Enable();
end
TEMPLATE.Slider = function(slider, width, step, minVal, maxVal, curVal, func, measure)
slider:SetWidth(width);
slider:SetHeight(16);
slider:SetValueStep(step);
slider:SetMinMaxValues(minVal, maxVal);
slider:SetValue(curVal);
slider:SetOrientation("HORIZONTAL");
slider.Background = slider:CreateTexture(nil, "BACKGROUND");
slider.Background:SetWidth(width);
slider.Background:SetHeight(16);
slider.Background:SetPoint("LEFT", 0, 0);
slider.Background:SetTexture(0, 0, 0, 0);
slider.textMin = slider:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall");
slider.textMin:SetPoint("TOP", slider, "BOTTOM", 0, -1);
slider.textMin:SetPoint("LEFT", slider, "LEFT", 0, 0);
slider.textMin:SetJustifyH("CENTER");
slider.textMin:SetTextColor(0.8, 0.8, 0.8, 1);
if(measure == "%") then
slider.textMin:SetText(minVal.."%");
elseif(measure == "K") then
slider.textMin:SetText((minVal/1000).."k");
elseif(measure == "H") then
slider.textMin:SetText((minVal/100));
elseif(measure == "px") then
slider.textMin:SetText(minVal.."px");
elseif(measure == "blank") then
slider.textMin:SetText("");
else
slider.textMin:SetText(minVal);
end
slider.textMax = slider:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall");
slider.textMax:SetPoint("TOP", slider, "BOTTOM", 0, -1);
slider.textMax:SetPoint("RIGHT", slider, "RIGHT", 0, 0);
slider.textMax:SetJustifyH("CENTER");
slider.textMax:SetTextColor(0.8, 0.8, 0.8, 1);
if(measure == "%") then
slider.textMax:SetText(maxVal.."%");
elseif(measure == "K") then
slider.textMax:SetText((maxVal/1000).."k");
elseif(measure == "H") then
slider.textMax:SetText((maxVal/100));
elseif(measure == "px") then
slider.textMax:SetText(maxVal.."px");
elseif(measure == "blank") then
slider.textMax:SetText("");
else
slider.textMax:SetText(maxVal);
end
slider.sliderBGL = slider:CreateTexture(nil, "BACKGROUND");
slider.sliderBGL:SetWidth(5);
slider.sliderBGL:SetHeight(6);
slider.sliderBGL:SetPoint("LEFT", slider, "LEFT", 0, 0);
slider.sliderBGL:SetTexture(Textures.BattlegroundTargetsIcons.path);
slider.sliderBGL:SetTexCoord(unpack(Textures.SliderBG.coordsL));
slider.sliderBGM = slider:CreateTexture(nil, "BACKGROUND");
slider.sliderBGM:SetWidth(width - 5 - 5);
slider.sliderBGM:SetHeight(6);
slider.sliderBGM:SetPoint("LEFT", slider.sliderBGL, "RIGHT", 0, 0);
slider.sliderBGM:SetTexture(Textures.BattlegroundTargetsIcons.path);
slider.sliderBGM:SetTexCoord(unpack(Textures.SliderBG.coordsM));
slider.sliderBGR = slider:CreateTexture(nil, "BACKGROUND");
slider.sliderBGR:SetWidth(5);
slider.sliderBGR:SetHeight(6);
slider.sliderBGR:SetPoint("LEFT", slider.sliderBGM, "RIGHT", 0, 0);
slider.sliderBGR:SetTexture(Textures.BattlegroundTargetsIcons.path);
slider.sliderBGR:SetTexCoord(unpack(Textures.SliderBG.coordsR));
slider.thumb = slider:CreateTexture(nil, "BORDER");
slider.thumb:SetWidth(11);
slider.thumb:SetHeight(17);
slider.thumb:SetTexture(Textures.BattlegroundTargetsIcons.path);
slider.thumb:SetTexCoord(unpack(Textures.SliderKnob.coords));
slider:SetThumbTexture(slider.thumb);
slider:SetScript("OnValueChanged", function(self, value)
if(not slider:IsEnabled()) then return; end
if(func) then
func(self, value);
end
end);
slider:SetScript("OnEnter", function() slider.Background:SetTexture(1, 1, 1, 0.1); end);
slider:SetScript("OnLeave", function() slider.Background:SetTexture(0, 0, 0, 0); end);
end
TEMPLATE.DisablePullDownMenu = function(button)
button.PullDownMenu:Hide();
button.PullDownButtonBorder:SetTexture(0.4, 0.4, 0.4, 1);
button:Disable();
end