-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathArenaSpectator.lua
2360 lines (2097 loc) · 86.1 KB
/
ArenaSpectator.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
--------------------------- ARENA SPECTATOR -----------------------------
-- Author: Kerhong --
-- Description: Allows better arena spectator experience --
-- Dependencies: Server side required (closed source) --
-- if you are interested in getting server side --
-- contact kerhong of Arena-Tournament --
-- Special thanks: Midna (Made me port this to TBC and did TBC tests) --
-- Bigpwn & Malaco (For Arena-Torunament.com) --
-- Remake Saqirmdev for Proximus --
-------------------------------------------------------------------------
local TimeFrame = CreateFrame("frame", nil, WorldFrame)
TimeFrame.text = TimeFrame:CreateFontString("OVERLAY")
TimeFrame.text:SetPoint("BOTTOM", WorldFrame, "BOTTOM", 0, 0)
TimeFrame.text:SetFont(STANDARD_TEXT_FONT, 20, "OUTLINE")
TimeFrame.text:SetText("00:00")
TimeFrame:Hide()
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'
local ignoreAuras = {
6277, -- Bind Sight
2479, -- Honorless Target
32724, -- Gold team
32725, -- Green team
35774, -- Gold team
35775 -- Green team
}
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\\BarTexture"
-- 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.9, 1.0, 0.0, 1.0},
["CASTBAR_BG"] = {0.0, 0.0, 0.0, 1.0},
["CASTBAR_TEXT"] = {1.0, 1.0, 1.0, 1.0},
["CASTBAR_SUCCESS"] = {0.0, 1.0, 0.0, 1.0},
["CASTBAR_SUCCESS_TEXT"] = {1.0, 1.0, 1.0, 1.0},
["CASTBAR_INTERRUPT"] = {1.0, 0.0, 0.0, 1.0},
["CASTBAR_INTERRUPT_TEXT"] = {1.0, 1.0, 1.0, 1.0},
["MANA"] = {0.0, 0.0, 1.0, 1.0},
["MANA_BG"] = {0.0, 0.0, 0.2, 0.9},
["RAGE"] = {1.0, 0.0, 0.0, 1.0},
["RAGE_BG"] = {0.2, 0, 0, 0.9},
["ENERGY"] = {1.0, 1.0, 0.0, 1.0},
["ENERGY_BG"] = {0.2, 0.2, 0.0, 0.9},
["RUNICPOWER"] = {0.0, 0.8, 1.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
["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
["CASTBARHEIGHT"] = 15, -- 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
}
}
--------------------------------------------------
-- --
-- DO NOT MODIFY BELOW THIS POINT --
-- --
--------------------------------------------------
-- Saved variables
teamname = {[0]="Use /teamname1 to set name", [1]="Use /teamname2 to set name"}
teamscore = {[0]=0, [1]=0}
tournamentMode = 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},
}
-- Scoreboard Frame
local scoreFrame
local teamOneScoreBox
local teamOneNameBox
local teamTwoScoreBox
local teamTwoNameBox
-- Table with all player data
local players = {}
-- Table with all player data ever created
local allPlayers = {}
-- Current watched target
local watch
-- All bar names that share same properties (for easier updates)
local ALLBARS = { "fsmall", "fself", "ftarget" }
-- 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 showAuras = {
-- Druid
-- ---------------------------------------------------------
48451, -- Lifebloom
22812, -- Barkskin
770, -- Faerie Fire
53312, -- Natures Grasp
48443, -- Regrowth
48441, -- Rejuvenation
29166, -- Innervate
33786, -- Cyclone
339, -- Entangling Roots
33891, -- Tree of Life
17007, -- Leader of the Pack
1126, -- Mark of the Wild
-- Rogue
-- ---------------------------------------------------------
51713, -- Shadow Dance
57934, -- Tricks of the Trade
11305, -- Sprint
31224, 65961, -- Cloak of Shadows
5277, -- Evasion
1856, -- Vanish
31230, -- Cheat Death
51690, -- Killing Spree
-- Priest
-- ---------------------------------------------------------
6346, -- Fear Ward
33206, -- Pain Suppression
10060, -- Power Infusion
48066, -- Power Word: Shield
6788, -- Weakened Soul
48113, -- Prayer of Mending
48068, -- Renew
48300, -- Devouring Plague
48125, -- Shadow Word: Pain
48160, -- Vampiric Touch
47585, -- Dispersion
21562, -- Power Word: Fortitude
-- Warlock
-- ---------------------------------------------------------
47813, -- Corruption
47864, -- Curse of Agony
18223, -- Curse of Exhaustion
47865, -- Curse of the Elements
11719, -- Curse of Tongues
47857, -- Drain Life
5138, -- Drain Mana
47855, -- Drain Soul
59164, -- Haunt
47843, -- Unstable Affliction
47889, -- Demon Armor
47893, -- Fel Armor
47811, -- Immolate
-- Paladin
-- ---------------------------------------------------------
54428, -- Divine Plea
53601, -- Sacred Shield
25771, -- Forbearance
1044, -- Hand of Freedom
10278, -- Hand of Protection
6940, -- Hand of Sacrifice
1038, -- Hand of Salvation
31884, -- Avenging Wrath
31821, -- Aura Mastery
53563, -- Beacon of Light
642, -- Divine Shield
20217, -- Blessing of Kings
56521, -- Blessing of Wisdom
19740, -- Blessing of Might
32223, -- Cursader Aura
79963, -- Concentration Aura
43223, -- Greater Kings
43940, -- Greater Might
48938, -- Greater Wisdom
-- Mage
-- ---------------------------------------------------------
45052, -- Evocation
43024, -- Mage Armor
43039, -- Ice Barrier
12472, -- Icy Veins
12042, -- Arcane Power
7301, -- Frost Armor
45438, -- Ice Block
1459, -- Arcane Brilliance
11129, -- Combustion
44457, -- Living Bomb
54749, -- Burning Determination
-- Warrior
-- ---------------------------------------------------------
47486, -- Mortal Strike
47465, -- Rend
65932, -- Retaliation
46924, -- Bladestorm
1719, -- Recklessness
41104, -- Shield Wall
55694, -- Enraged Regeneration
1715, -- Hamstring
12323, -- Piercing Howl
23920, -- Spell Reflection
-- Shaman
-- ---------------------------------------------------------
49284, -- Earth Shield
32182, -- Heroism
2825, -- Bloodlust
16166, -- Elemental Mastery
52127, -- Water Shield
324, -- Lightning Shield
-- Hunter
-- ---------------------------------------------------------
19574, -- Bestial Wrath
53271, -- Master's Call
19263, -- Deterrence
3045, -- Rapid Fire
19506, -- Trueshot Aura
34074,
19263, -- deterrence
54216, -- master's call
53480, -- roar of sacrifice
3045, -- rapid fire
34026, -- kill command
54517, -- roar of recovery
5384, -- feign death
-- Death Knight
-- ---------------------------------------------------------
49222, -- Bone sheild
48266, -- blood presence
48265, -- unholy presence
48263, -- frost presence
61777, -- Summon gargoyle (unfrienly aura)
48707, -- anti-magic shell
50461, -- anti-magic zone
48792, -- icebound fortitude
45524, -- chains of ice
}
-- Takes class ID (id) and gives text for texture positioning
local 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
-- Realigns all small frames
local function RealignFrames()
local team0 = SIZE.SMALL.FRAMEPOSITION
local team1 = SIZE.SMALL.FRAMEPOSITION
local team0cd = 0
local team1cd = 0
for _, p in pairs(players) do
local diffx
local diffy
local side
local opposite
local sidemod
local enemy = false
local cdside
local cdoffset
if (p.team == 67) then
team0 = team0 + SIZE.SMALL.FRAMEINCREMENT
diffy = team0
diffx = SIZE.SMALL.FRAMEFROMBORDER + SIZE.SMALL.HEIGHT
side = "TOPLEFT"
opposite = "TOPRIGHT"
cdside = "BOTTOMLEFT"
cdoffset = team0cd
team0cd = team0cd + 60
sidemod = 1
enemy = false
else
team1 = team1 + SIZE.SMALL.FRAMEINCREMENT
diffy = team1
diffx = -SIZE.SMALL.FRAMEFROMBORDER - SIZE.SMALL.HEIGHT
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:SetSize(p.fsmall.main:GetHeight()-4, p.fsmall.main:GetHeight()-4)
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
for i = 0, 3, 1 do
p.fsmall.spells[i]:ClearAllPoints()
p.fsmall.spells[i]:SetPoint(side, p.fsmall.main, opposite, sidemod * (2 + (2 + SIZE.SMALL.SPELLSIZE) * i), 0)
end
end
end
-- Change's spectators viewpoint to player with frame (frame)
local function SetViewPoint(frame)
SendChatMessage(".spectate view " .. frame.text:GetText(), "GUILD");
if (watch ~= nil) then
players[watch].fself.main:Hide()
if (players[watch].target ~= nil) then
players[players[watch].target].ftarget.main:Hide()
end
end
watch = frame.text:GetText()
if (watch ~= nil) then
players[watch].fself.main:Show()
if (players[watch].target ~= nil) then
players[players[watch].target].ftarget.main:Show()
end
end
end
-- PlayerFrame update function, called before every UI redraw
local function UpdateFrame(self, elapsed)
local target = self.text:GetText()
for i = 0, 3, 1 do
players[target].spells[i].tim = players[target].spells[i].tim - elapsed
if (players[target].spells[i].tim < 0) then
players[target].spells[i].tim = 0
end
local newalpha = players[target].spells[i].tim / SPELLDISPLAYTIME
local newialpha = 0
if ((players[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
players[target][barname].spells[i].texture:SetAlpha(newalpha)
players[target][barname].spells[i].interrupttexture:SetAlpha(newialpha)
end
end
end
-- Global castbar update function, updates castbars for all players, called before every UI redraw
local function UpdateCastBar(self, elapsed)
for _, p in pairs(players) do
local a, b = p.fsmall.cast:GetMinMaxValues()
if (p.fsmall.cast:GetValue() < b) then
local newvalue = p.fsmall.cast:GetValue() + elapsed
for _, barname in pairs(ALLBARS) do
p[barname].cast:SetValue(newvalue)
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:SetMinMaxValues(0, 0.4)
p[barname].cast:SetValue(0)
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:SetSize(icons.size or 24, icons.size or 24)
local cd = _G[button:GetName().."Cooldown"] or CreateFrame("Cooldown", button:GetName().."Cooldown", button)
cd:SetAllPoints(button)
cd:SetReverse()
local icon = _G[button:GetName().."Icon"] or button:CreateTexture(button:GetName().."Icon", "BORDER")
icon:SetAllPoints(button)
icon:SetTexCoord(.1,.9,.1,.9)
local count = _G[button:GetName().."count"] or button:CreateFontString(button:GetName().."count", "OVERLAY")
count:SetFontObject(NumberFont_OutlineThick_Mono_Small)
count:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 2, -2)
local overlayframe = _G[button:GetName().."OverlayFrame"] or CreateFrame("frame", button:GetName().."OverlayFrame", button)
overlayframe:SetAllPoints(button)
local overlay = _G[button:GetName().."Overlay"] or 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:SetCooldown(GetTime() - (duration - expiration) / 1000, duration/1000)
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:SetID(index)
icon:SetScript("OnUpdate", function(self, elapsed)
self:SetAlpha(self:GetAlpha() + .03)
if self:GetAlpha() == 1 then self:SetScript("OnUpdate", nil) end
end)
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:SetScript("OnUpdate", function(self, elapsed)
self:SetAlpha(self:GetAlpha() - .03)
if self:GetAlpha() == 0 then self:SetScript("OnUpdate", nil) end
end)
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:SetSize(object:GetWidth(), object:GetWidth())
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 UpdateAuras = function(unit, aurastack, framename, removeaura, count, expiration, duration, spellId, debufftype, isDebuff, caster)
for _, value in pairs(ignoreAuras) do
if value == spellId then
return
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:SetScript("OnUpdate", function(self, elapsed)
self:SetAlpha(self:GetAlpha() - .03)
if self:GetAlpha() == 0 then self:SetScript("OnUpdate", nil) end
end)
aurastack[index].icon.on = 0
end
found = false
end
else
if not found then
table.insert(aurastack, {spellId = spellId, caster = caster } )
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 f = CreateFrame("Button", nil, WorldFrame)
f:SetWidth(SIZE.SMALL.WIDTH)
f:SetHeight(SIZE.SMALL.HEIGHT)
f:SetPoint("CENTER", 0, 0)
f.texture = f:CreateTexture()
f.texture:SetAllPoints(f)
f.texture:SetTexture(unpack(COLOR.BACKGROUND))
f:SetFrameStrata("BACKGROUND")
f.text = f:CreateFontString()
f.text:SetFont(STANDARD_TEXT_FONT, SIZE.SMALL.NAMETEXTSIZE, "OUTLINE")
f.text:SetText(p.name)
f:SetScript("OnClick", SetViewPoint)
f.unit = p.unit
f.CombatFeedbackText = f:CreateFontString(nil, "OVERLAY")
f.CombatFeedbackText:SetPoint("BOTTOM", 0, -SIZE.SMALL.CASTBARHEIGHT-4)
f.CombatFeedbackText:SetFont(DAMAGE_TEXT_FONT, 18, 'OUTLINE')
addCombatFeedback(f)
local cla = CreateFrame("Button", nil, f)
cla:SetWidth(SIZE.SMALL.HEIGHT)
cla:SetHeight(SIZE.SMALL.HEIGHT)
cla:SetPoint("LEFT", f, "LEFT", 2, -2)
cla.texture = cla:CreateTexture("ARTWORK")
cla.texture:SetAllPoints(cla)
cla.texture:SetTexture("Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Classes")
cla.texture:SetTexCoord(unpack(_CLASS_ICON_TCOORDS["WARRIOR"]))
local hp = CreateFrame("StatusBar", nil, f)
hp:SetWidth(SIZE.SMALL.WIDTH - SIZE.SMALL.HEIGHT - 2)
hp:SetHeight(SIZE.SMALL.HEALTHHEIGHT)
hp:SetPoint("TOPLEFT", cla, "TOPRIGHT", 0, 0)
-- hp.texture = hp:CreateTexture("ARTWORK")
-- hp.texture:SetAllPoints(hp)
-- hp.texture:SetTexture(unpack(COLOR.HEALTH_BG))
local hptx = hp:CreateTexture("ARTWORK")
hptx:SetAllPoints(hp)
hptx:SetTexture(BAR_TEXTURE)
hp:SetStatusBarTexture(hptx, "ARTWORK")
hp:SetStatusBarColor(unpack(COLOR.HEALTH))
hp:GetStatusBarTexture():SetHorizTile(false)
hp:GetStatusBarTexture():SetVertTile(false)
hp.text = hp:CreateFontString()
hp.text:SetFont(STANDARD_TEXT_FONT, SIZE.SMALL.HEALTHTEXTSIZE, "OUTLINE")
hp.text:SetPoint("CENTER", 0, 0)
hp.text:SetText("100%")
f.text:SetPoint("BOTTOM", hp, "TOP", 0, 2)
local mp = CreateFrame("StatusBar", nil, f)
mp:SetWidth(SIZE.SMALL.WIDTH - SIZE.SMALL.HEIGHT - 2)
mp:SetHeight(SIZE.SMALL.HEIGHT - SIZE.SMALL.HEALTHHEIGHT - 6)
mp:SetPoint("TOPLEFT", hp, "BOTTOMLEFT", 0, -2)
mp:SetPoint("BOTTOMLEFT", f, "BOTTOMRIGHT", -2, 2)
mp.texture = mp:CreateTexture("ARTWORK")
mp.texture:SetAllPoints(mp)
mp.texture:SetTexture(1, 1, 1, 0.2)
local mptx = mp:CreateTexture("ARTWORK")
mptx:SetAllPoints(mp)
mptx:SetTexture(1, 1, 1, 1)
mp:SetStatusBarTexture(mptx, "ARTWORK")
mp:SetStatusBarColor(1, 1, 1, 1)
mp.text = mp:CreateFontString()
mp.text:SetFont(STANDARD_TEXT_FONT, SIZE.SMALL.POWERTEXTSIZE, "OUTLINE")
mp.text:SetPoint("CENTER", 0, 0)
mp.text:SetText("100")
local castbg = CreateFrame("frame", nil, f)
castbg:SetSize(SIZE.SMALL.WIDTH, SIZE.SMALL.CASTBARHEIGHT)
castbg:SetPoint("TOP", f, "BOTTOM", 0, -2)
castbg.tex = castbg:CreateTexture(nil, "BACKGROUND")
castbg.tex:SetTexture(unpack(COLOR.CASTBAR_BG))
castbg.tex:SetAllPoints()
local cast = CreateFrame("StatusBar", nil, castbg)
cast:SetPoint("TOPLEFT", castbg, "TOPLEFT", 2, -2)
cast:SetPoint("BOTTOMRIGHT", castbg, "BOTTOMRIGHT", -2, 2)
cast.texture = cast:CreateTexture("BACKGROUND")
cast.texture:SetAllPoints(cast)
cast.texture:SetTexture(unpack(COLOR.CASTBAR_BG))