forked from ornfelt/azerothcore_lua_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArenaSpectator.lua
More file actions
2599 lines (2309 loc) · 93.6 KB
/
ArenaSpectator.lua
File metadata and controls
2599 lines (2309 loc) · 93.6 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
--------------------------- ARENA SPECTATOR -----------------------------
-- Author: Kerhong --
-- Description: Allows better arena spectator experience --
-- Dependencies: Server side required (closed source) --
-- Special thanks: Midna (Made me port this to TBC and did TBC tests) --
-- Bigpwn & Malaco (For Arena-Tournament.com) --
-- Credit to Binny the Love Fool for TidyPlates
-------------------------------------------------------------------------
local TimeFrame = CreateFrame("frame", nil, WorldFrame)
TimeFrame.text = TimeFrame:CreateFontString("OVERLAY")
TimeFrame.text:SetPoint("TOP", WorldFrame, "TOP", 0, -85)
TimeFrame.text:SetFont(STANDARD_TEXT_FONT, 20, "OUTLINE")
TimeFrame.text:SetText("00:00")
TimeFrame:Hide()
-- Slash commands
SLASH_TEAMNAME_ONE1 = '/teamname1'
SLASH_TEAMNAME_TWO1 = '/teamname2'
SLASH_UPDATE_SCORE1 = '/score'
SLASH_RESET_SCORE1 = '/resetscore'
SLASH_TOURNAMENT1 = '/tournament'
SLASH_TEAMSWITCH1 = '/teamswitch'
SLASH_TEAMSWITCH2 = '/switchteams'
SLASH_DEBUG1 = '/asdebug'
local dtable = {
[0]="none",
[1]="magic",
[2]="curse",
[3]="disease",
[4]="poison"
}
-- Texts
local TEXT = {
["TOGGLEUI"] = "Toggle UI",
["SUCCESS"] = "SUCCESS",
["INTERRUPTED"] = "INTERRUPTED"
}
local DTC = {
["none"] = { r = 0.80, g = 0, b = 0 },
["magic"] = { r = 0.20, g = 0.60, b = 1.00 },
["curse"] = { r = 0.60, g = 0.00, b = 1.00 },
["disease"] = { r = 0.60, g = 0.40, b = 0 },
["poison"] = { r = 0.00, g = 0.60, b = 0 },
}
local BAR_TEXTURE = "Interface\\Addons\\ArenaSpectator\\BarTexture2"
-- Colors (format: { Red, Green, Blue, Alpha }), values from 0.0 to 1.0
local COLOR = {
["BACKGROUND"] = {0.0, 0.0, 0.0, 1.0},
["HEALTH"] = {0.1, 0.8, 0.2, 1.0},
["HEALTH_BG"] = {0.0, 0.16, 0.0, 0.4},
["CASTBAR"] = {0.70, 0.70, 0.40, 1.0},
["CASTBAR_BG"] = {0.16, 0.17, 0.19, 1.0},
["CASTBAR_TEXT"] = {1.0, 1.0, 1.0, 1.0},
["CASTBAR_SUCCESS"] = {0.3, 0.8, 0.3, 0.8},
["CASTBAR_SUCCESS_TEXT"] = {1.0, 1.0, 1.0, 1.0},
["CASTBAR_INTERRUPT"] = {0.8, 0.3, 0.3, 0.8},
["CASTBAR_INTERRUPT_TEXT"] = {1.0, 1.0, 1.0, 1.0},
["MANA"] = {0.27, 0.17, 0.98, 1.0},
["MANA_BG"] = {0.0, 0.0, 0.2, 0.9},
["RAGE"] = {0.81, 0.01, 0.10, 1.0},
["RAGE_BG"] = {0.2, 0, 0, 0.9},
["ENERGY"] = {0.80, 0.80, 0.0, 1.0},
["ENERGY_BG"] = {0.2, 0.2, 0.0, 0.9},
["RUNICPOWER"] = {0.0, 0.7, 9.0, 1.0},
["RUNICPOWER_BG"] = {0.0, 0.16, 0.2, 0.9},
}
local CLASS_COLORS = {
["WARRIOR"] = {.78, .61, .43, 1},
["WARLOCK"] = {.58, .51, .79, 1},
["SHAMAN"] = {0, .44, .87, 1},
["ROGUE"] = {1, .96, .41, 1},
["PRIEST"] = {1, 1, 1, 1},
["PALADIN"] = {1, .65, .8, 1},
["MAGE"] = {.41, .8, .94, 1},
["HUNTER"] = {.67, .83, .45, 1},
["DRUID"] = {1, .6, .04, 1},
["DEATHKNIGHT"] = {.77, .12, .23, 1}
}
-- Frame sizes
local SIZE = {
["SMALL"] = { -- Small (team) frame
["HEIGHT"] = 40, -- Frame height
["WIDTH"] = 230, -- Frame width
["NAMETEXTSIZE"] = 16, -- Player name font size
["HEALTHHEIGHT"] = 25, -- Healthbar height
["HEALTHTEXTSIZE"] = 16, -- Health text size
["POWERTEXTSIZE"] = 10, -- Power bar text size
["CASTBARHEIGHT"] = 15, -- Castbar height
["CASTBARTEXTSIZE"] = 12, -- Castbar text size
["TRINKETSIZE"] = 25, -- Trinket display size
["TRINKETOFFSET"] = 5, -- Trinket from corner of class icon
["FRAMEPOSITION"] = -200, -- 1st team frame initial position, relative to center Y of screen
["FRAMEPOSITION4V4"] = -350, -- 1st team frame initial position, relative to center Y of screen
["FRAMEINCREMENT"] = 150, -- Increment of FRAMEPOSITION for each next frame
["FRAMEFROMBORDER"] = 10, -- Frame spacing from edge of screen
["SPELLSIZE"] = 32 -- Spell display size
},
["BIG"] = { -- Big frames (current POV, POV's target)
["HEIGHT"] = 60, -- Frame height
["WIDTH"] = 300, -- Frame width
["NAMETEXTSIZE"] = 16, -- Player name font size
["HEALTHHEIGHT"] = 40, -- Healthbar height
["HEALTHTEXTSIZE"] = 25, -- Health text size
["POWERTEXTSIZE"] = 10, -- Power bar text size
["CASTBARPOSITIONY"] = -76, -- Position Y for castbars of bottom frames
["CASTBARHEIGHT"] = 20, -- Castbar height
["CASTBARTEXTSIZE"] = 14, -- Castbar text size
["FRAMEPOSITION"] = 3, -- Frame offset from centerX on screen
["FRAMEFROMBORDER"] = 30, -- Frame spacing from bottom of screen
["SPELLSIZE"] = 50 -- Spell display size
},
["PET"] = { -- Pet frames (current POV, POV's target)
["HEIGHT"] = 36, -- Frame height
["WIDTH"] = 36, -- Frame width
["NAMETEXTSIZE"] = 12, -- Player name font size
["POSITIONY"] = 0, -- Frame offset from centerY on screen
["FRAMEFROMBORDER"] = 242, -- Frame spacing from bottom of screen
}
}
local PLAYERPETS = {
[0] = "inv_misc_questionmark",
[1] = "Ability_Hunter_Pet_Wolf",
[2] = "Ability_Hunter_Pet_Cat",
[3] = "Ability_Hunter_Pet_Spider",
[4] = "Ability_Hunter_Pet_Bear",
[5] = "Ability_Hunter_Pet_Boar",
[6] = "Ability_Hunter_Pet_Crocolisk",
[7] = "Ability_Hunter_Pet_Vulture",
[8] = "Ability_Hunter_Pet_Crab",
[9] = "Ability_Hunter_Pet_Gorilla",
[11] = "Ability_Hunter_Pet_Raptor",
[12] = "Ability_Hunter_Pet_TallStrider",
[15] = "spell_shadow_summonfelhunter", -- Not hunter pet
[16] = "spell_shadow_summonvoidwalker", -- Not hunter pet
[17] = "spell_shadow_summonsuccubus", -- Not hunter pet
[19] = "spell_shadow_summonimp", -- Not hunter pet *correct?*
[20] = "Ability_Hunter_Pet_Scorpid",
[21] = "Ability_Hunter_Pet_Turtle",
[23] = "spell_shadow_summonimp", -- Not hunter pet
[24] = "Ability_Hunter_Pet_Bat",
[25] = "Ability_Hunter_Pet_Hyena",
[26] = "Ability_Hunter_Pet_Owl",
[27] = "Ability_Hunter_Pet_WindSerpent",
[28] = "inv_misc_questionmark", -- Not hunter pet (WTF IS THIS? - Remote Control)
[29] = "spell_shadow_summonfelguard", -- Not hunter pet
[30] = "Ability_Hunter_Pet_DragonHawk",
[31] = "Ability_Hunter_Pet_Ravager",
[32] = "Ability_Hunter_Pet_WarpStalker",
[33] = "Ability_Hunter_Pet_Sporebat",
[34] = "Ability_Hunter_Pet_NetherRay",
[35] = "Spell_Nature_GuardianWard",
[37] = "Ability_Hunter_Pet_Moth",
[38] = "Ability_Hunter_Pet_Chimera",
[39] = "Ability_Hunter_Pet_Devilsaur",
[40] = "spell_shadow_animatedead", -- Not hunter pet *correct?*
[41] = "Ability_Hunter_Pet_Silithid",
[42] = "Ability_Hunter_Pet_Worm",
[43] = "Ability_Hunter_Pet_Rhino",
[44] = "Ability_Hunter_Pet_Wasp",
[45] = "Ability_Hunter_Pet_CoreHound",
[46] = "Ability_Druid_PrimalPrecision"
}
--------------------------------------------------
-- --
-- DO NOT MODIFY BELOW THIS POINT --
-- --
--------------------------------------------------
function GetTableSize(table)
if (table ~= nil) then
local i = 0
for _ in pairs(table) do
i = i + 1
end
return i
end
return 0
end
math.round = function(number, precision)
precision = precision or 0
local decimal = string.find(tostring(number), ".", nil, true);
if ( decimal ) then
local power = 10 ^ precision;
if ( number >= 0 ) then
number = math.floor(number * power + 0.5) / power;
else
number = math.ceil(number * power - 0.5) / power;
end
-- convert number to string for formatting
number = tostring(number);
-- set cutoff
local cutoff = number:sub(decimal + 1 + precision);
-- delete everything after the cutoff
number = number:gsub(cutoff, "");
else
-- number is an integer
if ( precision > 0 ) then
number = tostring(number);
number = number .. ".";
for i = 1,precision
do
number = number .. "0";
end
end
end
return number;
end
-- Player Classes Global for Colored Nameplates
classes = {}
-- Saved variables
teamname = {[0]="Use /teamname1 to set name", [1]="Use /teamname2 to set name"}
teamscore = {[0]=0, [1]=0}
tournamentMode = false
debugMode = false
-- Each class icon coordinates in Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Classes
local _CLASS_ICON_TCOORDS = {
["WARRIOR"] = {0, 0.25, 0, 0.25},
["MAGE"] = {0.25, 0.49609375, 0, 0.25},
["ROGUE"] = {0.49609375, 0.7421875, 0, 0.25},
["DRUID"] = {0.7421875, 0.98828125, 0, 0.25},
["HUNTER"] = {0, 0.25, 0.25, 0.5},
["SHAMAN"] = {0.25, 0.49609375, 0.25, 0.5},
["PRIEST"] = {0.49609375, 0.7421875, 0.25, 0.5},
["WARLOCK"] = {0.7421875, 0.98828125, 0.25, 0.5},
["PALADIN"] = {0, 0.25, 0.5, 0.75},
["DEATHKNIGHT"] = {0.25, 0.49609375, 0.5, 0.75},
}
-- Table with all player data
ATPlayers = {}
-- Toggle UI button
local toggle
-- Scoreboard Frame
local scoreFrame
local logoFrame
local teamOneScoreBox
local teamOneNameBox
local teamTwoScoreBox
local teamTwoNameBox
-- Current watched target
watch = nil
-- All bar names that share same properties (for easier updates)
local ALLBARS = { "fsmall", "fself", "ftarget" }
local globalCastbar = 0
-- Holds bool that makes default UI visible/hidden
local hideui
-- Time in seconds for ability to fade fully
local SPELLDISPLAYTIME = 5
-- Aura levels (aura with highest level gets shown on portret frame)
local ROOT = 1
local STUN = 4
local SILENCE = 2 -- also disarm
local CROWDC = 3
local IMMUNITY = 5
-- List of PVP trinket spells and cooldowns
local pvptrinket
if (select(4, GetBuildInfo()) < 30000) then
-- TBC IDs
pvptrinket = {
[42292] = 120,
}
else
-- WOTLK IDs
pvptrinket = {
[65547] = 120,
[42292] = 120,
[59752] = 120,
[7744] = 45
}
end
-- List of all CC auras
local auralist
if (select(4, GetBuildInfo()) < 30000) then
-- TBC AURAS
auralist = {
-- Crowd control
[33786] = STUN, -- Cyclone
[2637] = CROWDC, -- Hibernate
[18657] = CROWDC, -- Hibernate
[18658] = CROWDC, -- Hibernate
[14309] = CROWDC, -- Freezing Trap Effect
[6770] = CROWDC, -- Sap
[2094] = CROWDC, -- Blind
[5782] = CROWDC, -- Fear
[27223] = CROWDC, -- Death Coil Warlock
[6358] = CROWDC, -- Seduction (Succubus)
[5484] = CROWDC, -- Howl of Terror
[17928] = CROWDC, -- Howl of Terror
[5246] = CROWDC, -- Intimidating Shout
[8122] = CROWDC, -- Psychic Scream
[8124] = CROWDC, -- Psychic Scream
[10888] = CROWDC, -- Psychic Scream
[10890] = CROWDC, -- Psychic Scream
[12826] = CROWDC, -- Polymorph
[28272] = CROWDC, -- Polymorph pig
[28271] = CROWDC, -- Polymorph turtle
[710] = CROWDC, -- Banish
[18647] = CROWDC, -- Banish
-- Roots
[339] = ROOT, -- Entangling Roots
[9853] = ROOT, -- Entangling Roots
[27088] = ROOT, -- Frost Nova
[45334] = ROOT, -- Feral Charge effect
-- Stuns and incapacitates
[8983] = STUN, -- Bash
[1833] = STUN, -- Cheap Shot
[8643] = STUN, -- Kidney Shot
[1776] = CROWDC, -- Gouge
[19503] = CROWDC, -- Scatter Shot
[10308] = STUN, -- Hammer of Justice
[20066] = CROWDC, -- Repentance
-- Silences
[18469] = SILENCE, -- Improved Counterspell
[15487] = SILENCE, -- Silence
[34490] = SILENCE, -- Silencing Shot
[18425] = SILENCE, -- Improved Kick
[19647] = SILENCE, -- Spell Lock (Felhunter)
[1330] = SILENCE, -- Garrote - Silence
-- Immunities
[34692] = IMMUNITY, -- The Beast Within
[45438] = IMMUNITY, -- Ice Block
[642] = IMMUNITY, -- Divine Shield
}
else
-- WOTLK AURAS
auralist = {
-- Death Knight
[47481] = STUN, -- Gnaw (Ghoul)
[51209] = CROWDC, -- Hungering Cold
[47476] = SILENCE, -- Strangulate
-- Druid
[8983] = STUN, -- Bash (also Shaman Spirit Wolf ability)
[33786] = STUN, -- Cyclone
[18658] = CROWDC, -- Hibernate (works against Druids in most forms and Shamans using Ghost Wolf)
[49802] = STUN, -- Maim
[49803] = STUN, -- Pounce
[53308] = ROOT, -- Entangling Roots
[53313] = ROOT, -- Entangling Roots (Nature's Grasp)
[45334] = ROOT, -- Feral Charge Effect (immobilize with interrupt [spell lockout, not silence])
-- Hunter
[60210] = CROWDC, -- Freezing Arrow Effect
[14309] = CROWDC, -- Freezing Trap Effect
[24394] = STUN, -- Intimidation
[14327] = CROWDC, -- Scare Beast (works against Druids in most forms and Shamans using Ghost Wolf)
[19503] = CROWDC, -- Scatter Shot
[49012] = CROWDC, -- Wyvern Sting
[34490] = SILENCE, -- Silencing Shot
[53359] = SILENCE, -- Chimera Shot - Scorpid
[19306] = ROOT, -- Counterattack
[64804] = ROOT, -- Entrapment
-- Hunter Pets
[53568] = STUN, -- Sonic Blast (Bat)
[53543] = SILENCE, -- Snatch (Bird of Prey)
[53548] = ROOT, -- Pin (Crab)
[53562] = STUN, -- Ravage (Ravager)
[55509] = ROOT, -- Venom Web Spray (Silithid)
[4167] = ROOT, -- Web (Spider)
-- Mage
[44572] = STUN, -- Deep Freeze
[31661] = CROWDC, -- Dragon's Breath
[12355] = CROWDC, -- Impact
[12826] = CROWDC, -- Polymorph
[55021] = SILENCE, -- Silenced - Improved Counterspell
[64346] = SILENCE, -- Fiery Payback
[33395] = ROOT, -- Freeze (Water Elemental)
[42917] = ROOT, -- Frost Nova
[12494] = ROOT, -- Frostbite
[55080] = ROOT, -- Shattered Barrier
-- Paladin
[10308] = STUN, -- Hammer of Justice
[48817] = CROWDC, -- Holy Wrath (works against Warlocks using Metamorphasis and Death Knights using Lichborne)
[20066] = CROWDC, -- Repentance
[20170] = STUN, -- Stun (Seal of Justice proc)
[10326] = CROWDC, -- Turn Evil (works against Warlocks using Metamorphasis and Death Knights using Lichborne)
[63529] = SILENCE, -- Shield of the Templar
-- Priest
[605] = CROWDC, -- Mind Control
[64044] = STUN, -- Psychic Horror
[10890] = CROWDC, -- Psychic Scream
[10955] = CROWDC, -- Shackle Undead (works against Death Knights using Lichborne)
[15487] = SILENCE, -- Silence
[64058] = SILENCE, -- Psychic Horror (duplicate debuff names not allowed atm, need to figure out how to support this later)
-- Rogue
[2094] = CROWDC, -- Blind
[1833] = STUN, -- Cheap Shot
[1776] = CROWDC, -- Gouge
[8643] = STUN, -- Kidney Shot
[51724] = CROWDC, -- Sap
[1330] = SILENCE, -- Garrote - Silence
[18425] = SILENCE, -- Silenced - Improved Kick
[51722] = SILENCE, -- Dismantle
-- Shaman
[39796] = STUN, -- Stoneclaw Stun
[51514] = CROWDC, -- Hex (although effectively a silence+disarm effect, it is conventionally thought of as a CROWDC, plus you can trinket out of it)
[64695] = ROOT, -- Earthgrab (Storm, Earth and Fire)
[63685] = ROOT, -- Freeze (Frozen Power)
-- Warlock
[18647] = STUN, -- Banish (works against Warlocks using Metamorphasis and Druids using Tree Form)
[47860] = STUN, -- Death Coil
[6215] = CROWDC, -- Fear
[17928] = CROWDC, -- Howl of Terror
[6358] = CROWDC, -- Seduction (Succubus)
[47847] = STUN, -- Shadowfury
[24259] = SILENCE, -- Spell Lock (Felhunter)
-- Warrior
[7922] = STUN, -- Charge Stun
[12809] = STUN, -- Concussion Blow
[20253] = STUN, -- Intercept (also Warlock Felguard ability)
[20511] = CROWDC, -- Intimidating Shout
[5246] = CROWDC, -- Intimidating Shout
[12798] = STUN, -- Revenge Stun
[46968] = STUN, -- Shockwave
[18498] = SILENCE, -- Silenced - Gag Order
[676] = SILENCE, -- Disarm
[58373] = ROOT, -- Glyph of Hamstring
[23694] = ROOT, -- Improved Hamstring
-- Other
[20549] = STUN, -- War Stomp
[28730] = SILENCE, -- Arcane Torrent
-- Immunities
[46924] = IMMUNITY, -- Bladestorm (Warrior)
[642] = IMMUNITY, -- Divine Shield (Paladin)
[45438] = IMMUNITY, -- Ice Block (Mage)
[34471] = IMMUNITY, -- The Beast Within (Hunter)
[12051] = IMMUNITY, -- Evocation (Mage)
[47585] = IMMUNITY -- Dispersion (Priest)
}
end
local notShownAuras = {
2479, -- Honorless Target
32724, -- Gold team
32725, -- Green team
35774, -- Gold team
35775 -- Green team
}
-- Takes class ID (id) and gives text for texture positioning
function ClassToTexture(id)
if (id == 1) then -- warrior
return "WARRIOR"
elseif (id == 2) then -- paladin
return "PALADIN"
elseif (id == 3) then -- hunter
return "HUNTER"
elseif (id == 4) then -- rogue
return "ROGUE"
elseif (id == 5) then -- priest
return "PRIEST"
elseif (id == 6) then -- dk
return "DEATHKNIGHT"
elseif (id == 7) then -- sham
return "SHAMAN"
elseif (id == 8) then -- mage
return "MAGE"
elseif (id == 9) then -- lock
return "WARLOCK"
elseif (id == 11) then -- druid
return "DRUID"
else
return "WARRIOR"
end
end
local function IsPlayerGUID(guid)
return tonumber(guid:sub(5,5)) == 0
end
local function GetUnitByName(value)
for _, p in pairs(ATPlayers) do
if p.name == value then
return p
end
end
return false
end
local function GetPlayerByName(value)
for _, p in pairs(ATPlayers) do
if p.name == value and IsPlayerGUID(p.guid) then
return p
end
end
return false
end
-- Realigns all small frames
local function RealignFrames()
local tableSize = GetTableSize(ATPlayers)
local team0 = tableSize == 8 and SIZE.SMALL.FRAMEPOSITION4V4 or SIZE.SMALL.FRAMEPOSITION
local team1 = tableSize == 8 and SIZE.SMALL.FRAMEPOSITION4V4 or SIZE.SMALL.FRAMEPOSITION
local team0cd = 0
local team1cd = 0
for _, p in pairs(ATPlayers) do
local diffy
local diffypet
local side
local opposite
local sidemod
local enemy = false
local cdside
local cdoffset
p.fsmall.main:SetBackdrop({
bgFile = "",
edgeFile = "Interface\\ChatFrame\\ChatFrameBackground",
tile = true,
tileSize = 2,
edgeSize = 2
})
p.fself.main:SetBackdrop({
bgFile = "",
edgeFile = "Interface\\ChatFrame\\ChatFrameBackground",
tile = true,
tileSize = 2,
edgeSize = 2
})
p.ftarget.main:SetBackdrop({
bgFile = "",
edgeFile = "Interface\\ChatFrame\\ChatFrameBackground",
tile = true,
tileSize = 2,
edgeSize = 2
})
p.fsmall.pet1:SetBackdrop({
bgFile = "",
edgeFile = "Interface\\ChatFrame\\ChatFrameBackground",
tile = true,
tileSize = 2,
edgeSize = 2,
})
if (p.team == 67) then
p.fsmall.main:SetBackdropBorderColor(1.0, 0.0, 0.0, 0.75)
p.fself.main:SetBackdropBorderColor(1.0, 0.0, 0.0, 0.75)
p.ftarget.main:SetBackdropBorderColor(1.0, 0.0, 0.0, 0.75)
p.fsmall.pet1:SetBackdropBorderColor(1.0, 0.0, 0.0, 0.75)
team0 = team0 + SIZE.SMALL.FRAMEINCREMENT
diffy = team0
diffypet = team0 + SIZE.PET.POSITIONY
side = "TOPLEFT"
opposite = "TOPRIGHT"
cdside = "BOTTOMLEFT"
cdoffset = team0cd
team0cd = team0cd + 60
sidemod = 1
enemy = false
else
p.fsmall.main:SetBackdropBorderColor(0.0, 0.5, 1.0, 0.75)
p.fself.main:SetBackdropBorderColor(0.0, 0.5, 1.0, 0.75)
p.ftarget.main:SetBackdropBorderColor(0.0, 0.5, 1.0, 0.75)
p.fsmall.pet1:SetBackdropBorderColor(0.0, 0.5, 1.0, 0.75)
team1 = team1 + SIZE.SMALL.FRAMEINCREMENT
diffy = team1
diffypet = team1 + SIZE.PET.POSITIONY
side = "TOPRIGHT"
opposite = "TOPLEFT"
cdside = "BOTTOMRIGHT"
cdoffset = team1cd
team1cd = team1cd + 60
sidemod = -1
enemy = true
end
p.fsmall.main:ClearAllPoints()
p.fsmall.main:SetPoint(enemy and "RIGHT" or "LEFT", enemy and -SIZE.SMALL.FRAMEFROMBORDER or SIZE.SMALL.FRAMEFROMBORDER, diffy)
p.fsmall.class:ClearAllPoints()
p.fsmall.class:SetPoint(enemy and "TOPRIGHT" or "TOPLEFT", p.fsmall.main, enemy and -2 or 2, -2)
p.fsmall.class:SetWidth(p.fsmall.main:GetHeight()-4)
p.fsmall.class:SetHeight(p.fsmall.main:GetHeight()-4)
p.fsmall.pet:ClearAllPoints()
p.fsmall.pet:SetPoint(enemy and "RIGHT" or "LEFT", enemy and -SIZE.PET.FRAMEFROMBORDER or SIZE.PET.FRAMEFROMBORDER, diffypet)
p.fsmall.castbg:ClearAllPoints()
p.fsmall.castbg:SetPoint("TOP", p.fsmall.main, "BOTTOM", 0, -2)
p.fsmall.castbg:SetPoint(enemy and "LEFT" or "RIGHT", p.fsmall.main, 2, -2)
p.fsmall.health:ClearAllPoints()
p.fsmall.health:SetPoint(enemy and "TOPRIGHT" or "TOPLEFT", p.fsmall.class, enemy and "TOPLEFT" or "TOPRIGHT", enemy and -2 or 2, 0)
p.fsmall.trinket:ClearAllPoints()
p.fsmall.trinket:SetPoint("CENTER", p.fsmall.class, side=="TOPLEFT" and "BOTTOMLEFT" or "BOTTOMRIGHT", sidemod * SIZE.SMALL.TRINKETOFFSET, SIZE.SMALL.TRINKETOFFSET)
p.cooldowns:ClearAllPoints()
p.cooldowns:SetPoint(cdside, WorldFrame, cdside, 0, cdoffset)
p.cooldowns.growdir = sidemod
p.fsmall.main.CombatFeedbackText:SetPoint("CENTER", enemy and -84 or 80, 2)
local temp = 0
if (p.pet > "0") then
if (sidemod == 1) then
temp = SIZE.PET.WIDTH + 5
else
temp = -SIZE.PET.WIDTH - 5
end
end
for i = 0, 3, 1 do
p.fsmall.spells[i]:ClearAllPoints()
p.fsmall.spells[i]:SetPoint(side, p.fsmall.main, opposite, temp + sidemod * (2 + (2 + SIZE.SMALL.SPELLSIZE) * i), 0)
end
end
end
-- Change's spectators viewpoint to player with frame (frame)
local function SetViewPoint(frame)
local target = GetPlayerByName(frame.text:GetText())
if target == false or target.name == "UNNAMED" then
return
end
SendChatMessage(".spec watch " .. frame.text:GetText(), "GUILD");
if (watch ~= nil) then
ATPlayers[watch].fself.main:Hide()
if (ATPlayers[watch].target ~= nil) then
if (ATPlayers[ATPlayers[watch].target] ~= nil) then
ATPlayers[ATPlayers[watch].target].ftarget.main:Hide()
end
end
end
watch = target.guid
if (watch ~= nil) then
ATPlayers[watch].fself.main:Show()
if (ATPlayers[watch].target ~= nil) then
if (ATPlayers[ATPlayers[watch].target] ~= nil) then
ATPlayers[ATPlayers[watch].target].ftarget.main:Show()
end
end
end
end
-- PlayerFrame update function, called before every UI redraw
local function UpdateFrame(self, elapsed)
local target = self.guid
for i = 0, 3, 1 do
ATPlayers[target].spells[i].tim = ATPlayers[target].spells[i].tim - elapsed
if (ATPlayers[target].spells[i].tim < 0) then
ATPlayers[target].spells[i].tim = 0
end
local newalpha = ATPlayers[target].spells[i].tim / SPELLDISPLAYTIME
local newialpha = 0
if ((ATPlayers[target].spells[i].interrupted == true) and (newalpha ~= 0)) then
newialpha = 2 * newalpha
if (newialpha > 1) then
newialpha = 1
end
end
for _, barname in pairs(ALLBARS) do
ATPlayers[target][barname].spells[i].texture:SetAlpha(newalpha)
ATPlayers[target][barname].spells[i].interrupttexture:SetAlpha(newialpha)
end
end
end
-- Global castbar update function, updates castbars for all ATPlayers, called before every UI redraw
local function UpdateCastBar(self, elapsed)
for _, p in pairs(ATPlayers) do
local goal = select(2, p.fsmall.cast:GetMinMaxValues())
local current = p.fsmall.cast:GetValue()
local direction = p.fsmall.cast.direction
if direction < 0 then
goal = 0
end
local change = elapsed * direction
if (direction > 0 and current < goal) or (direction < 0 and current > goal) then
if ((p.fsmall.cast.text:GetText() == TEXT.SUCCESS) or (p.fsmall.cast.text:GetText() == TEXT.INTERRUPTED)) then
for _, barname in pairs(ALLBARS) do
p[barname].cast.text2:SetText("")
end
else
for _, barname in pairs(ALLBARS) do
if (direction > 0) then
p[barname].cast.text2:SetText(math.round(current, 2) .. "/" .. math.round(goal, 2))
else
p[barname].cast.text2:SetText(math.round(current, 2))
end
end
end
for _, barname in pairs(ALLBARS) do
p[barname].cast:SetValue(current + change)
end
else
if ((p.fsmall.cast.text:GetText() == TEXT.SUCCESS) or (p.fsmall.cast.text:GetText() == TEXT.INTERRUPTED)) then
for _, barname in pairs(ALLBARS) do
p[barname].cast:SetAlpha(0)
p[barname].castbg:SetAlpha(0)
end
else
for _, barname in pairs(ALLBARS) do
p[barname].cast.texture:SetTexture(unpack(COLOR.CASTBAR_SUCCESS))
p[barname].cast:SetStatusBarColor(unpack(COLOR.CASTBAR_SUCCESS))
p[barname].cast:GetStatusBarTexture():SetTexture(unpack(COLOR.CASTBAR_SUCCESS))
p[barname].cast.text:SetTextColor(unpack(COLOR.CASTBAR_SUCCESS_TEXT))
p[barname].cast.text:SetText(TEXT.SUCCESS)
p[barname].cast.direction = 1
p[barname].cast:SetMinMaxValues(0, 0.7)
p[barname].cast:SetValue(0)
p[barname].cast.icon:Hide()
end
end
end
end
end
local SetPosition = function(icons, x)
if(icons and x > 0) then
local col = 0
local row = 0
local gap = true
local sizex = (icons.size or 24) + (icons['spacing-x'] or icons.spacing or 0)
local sizey = (icons.size or 24) + (icons['spacing-y'] or icons.spacing or 0)
local anchor = icons.initialAnchor or "BOTTOMLEFT"
local growthx = (icons["growth-x"] == "LEFT" and -1) or 1
local growthy = (icons["growth-y"] == "DOWN" and -1) or 1
local cols = math.floor(icons:GetWidth() / sizex + .5)
local rows = math.floor(icons:GetHeight() / sizey + .5)
for i = 1, #icons do
local button = icons[i].icon
if(button and button.on == 1 and button.debuff == 1) then
if(col >= cols) then
col = 0
row = row + 1
end
button:ClearAllPoints()
button:SetPoint(anchor, icons, anchor, col * sizex * growthx, row * sizey * growthy)
col = col + 1
elseif(not button) then
break
end
end
for i = 1, #icons do
local button = icons[i].icon
if(button and button.on == 1 and button.debuff == 0) then
if (gap and button:GetAlpha()==1) then
if(col > 0) then
row = row + 1
col = 0
end
gap = false
end
if(col >= cols) then
col = 0
row = row + 1
end
button:ClearAllPoints()
button:SetPoint(anchor, icons, anchor, col * sizex * growthx, row * sizey * growthy)
col = col + 1
elseif(not button) then
break
end
end
end
end
local createAuraIcon = function(unit, framename, icons, index)
local button = CreateFrame("Button", "aura"..framename..unit..index, icons)
button:SetWidth(icons.size or 24)
button:SetHeight(icons.size or 24)
local cd = CreateFrame("Cooldown", button:GetName().."Cooldown", button)
cd:SetAllPoints(button)
cd:SetReverse()
local icon = button:CreateTexture(button:GetName().."Icon", "BORDER")
icon:SetAllPoints(button)
icon:SetTexCoord(.1,.9,.1,.9)
local count = button:CreateFontString(button:GetName().."count", "OVERLAY")
count:SetFont(STANDARD_TEXT_FONT, 10, "OUTLINE")
count:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 1, 1)
local overlayframe = CreateFrame("frame", button:GetName().."OverlayFrame", button)
overlayframe:SetAllPoints(button)
local overlay = overlayframe:CreateTexture(button:GetName().."Overlay", "OVERLAY")
overlay:SetTexture("Interface\\AddOns\\ArenaSpectator\\border")
overlay:SetPoint("TOPLEFT", -2, 2)
overlay:SetPoint("BOTTOMRIGHT", 2, -2)
button.overlay = overlay
button.overlayframe = overlayframe
button.parent = icons
button.icon = icon
button.count = count
button.cd = cd
button.debuff = 1
return button
end
local updateIcon = function(unit, framename, icons, index, spellId, count, expiration, duration, debufftype, isDebuff)
local name, _, texture = GetSpellInfo(spellId)
local icon = icons[index].icon or createAuraIcon(unit, framename, icons, index)
icon.debuff = isDebuff
if texture then
local cd = icon.cd
if(cd and not icons.disableCooldown) then
if (duration and duration > 0) then
cd.cdStart = GetTime() - (duration - expiration) / 1000
cd.cdDuration = duration / 1000
cd:SetCooldown(cd.cdStart, cd.cdDuration)
cd:Show()
else
cd:Hide()
end
end
if debufftype and isDebuff==0 then
local color = DTC[dtable[debufftype]] or DTC.none
icon.overlay:SetVertexColor(color.r, color.g, color.b)
else
icon.overlay:SetVertexColor(0,0,0)
end
icon.icon:SetTexture(texture)
icon.count:SetText((count > 1 and count))
icon:SetScript("OnEnter", function(...)
if (debugMode) then
print(name .. " (" .. spellId .. ")")
end
end)
icon:SetID(index)
icon:SetAlpha(1)
icon.on = 1
end
icons[index].icon = icon
end
local ResetAuras = function(aurastack)
for index=1, #aurastack do
if aurastack[index].icon then
aurastack[index].icon:SetAlpha(0)
aurastack[index].icon.on = 0
end
end
end
local getFree = function(object)
for i=1,#object.spells do
if object.spells[i].busy == false then
object.spells[i].busy = true
object.spells[i].timestamp = 0
return object.spells[i]
end
end
local frm = CreateFrame("frame", nil, object)
frm:SetWidth(object:GetWidth())
frm:SetHeight(object:GetHeight())
frm:SetPoint("BOTTOM")
frm.icon = frm:CreateTexture(nil, "OVERLAY")
frm.icon:SetAllPoints()
frm.cooldownFrame = CreateFrame("Cooldown", nil, frm)
frm.cooldownFrame:SetAllPoints(frm)
frm.cooldownFrame:SetReverse()
frm.busy = true
frm.timestamp = 0
tinsert(object.spells, frm)
return frm
end
local Resort = function(object)
local tbl = {}
local cols = 1
local iconsize = 28
for i=1,#object.spells do
if object.spells[i].busy==true then
table.insert(tbl, object.spells[i])
end
end
table.sort(tbl, function(a,b) return a.cdtime > b.cdtime end)
for i=1,#tbl do
tbl[i]:ClearAllPoints()
if i==1 then
tbl[i]:SetPoint("BOTTOM")
else
if (math.floor(math.floor((i-1)/cols)/2) == 1) then
tbl[i]:SetPoint("BOTTOM", cols * iconsize * object.growdir, 0)
cols = cols + 1
else
tbl[i]:SetPoint("BOTTOM", tbl[i-1], "TOP", 0, 0)
end
end
end
end
local function UpdateAuras(unit, aurastack, framename, removeaura, count, expiration, duration, spellId, debufftype, isDebuff, caster)
if auralist[spellId] == nil then
for _, value in pairs(notShownAuras) do
if value == spellId then
return
end
end
end
local found, index = false, nil
for i,v in ipairs(aurastack) do
if v.spellId == spellId and v.caster == caster then
found = true
index = i
end
end
if removeaura == 1 then
if found then
if aurastack[index].icon then
aurastack[index].icon:SetAlpha(0)
aurastack[index].icon.on = 0
aurastack[index].active = false
end
found = false
end
else
if not found then
table.insert(aurastack, {spellId = spellId, caster = caster, active = true } )
updateIcon(unit, framename, aurastack, #aurastack, spellId, count, expiration, duration, debufftype, isDebuff)
else
updateIcon(unit, framename, aurastack, index, spellId, count, expiration, duration, debufftype, isDebuff)
end
end
SetPosition(aurastack, aurastack.num or 64)
end
-- Creates all frames for player (p)
local function CreateFrameForPlayer(p)
local fpet = CreateFrame("Frame", nil, WorldFrame)
fpet:SetWidth(SIZE.PET.WIDTH + 1)
fpet:SetHeight(SIZE.PET.HEIGHT + 1)
fpet:SetPoint("CENTER", 0, 0)
local fpet1 = fpet:CreateTexture(nil, "BORDER")
fpet1:SetAllPoints(fpet)
fpet1:SetTexCoord(.1,.9,.1,.9)
fpet1:SetTexture("Interface\\Icons\\" .. PLAYERPETS[0])