-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathPlater.lua
12927 lines (10926 loc) · 507 KB
/
Plater.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
--Plater main software file
--Calls with : are functions imported from the framework
--whenever a variable or function has a --private comment attached to it, means scripts cannot access it (read, write, override), anything else can be overriden with scripts
--with that, you can make your own version of Plater by modifying and overriding functions entirelly using a hooking script, them you can export the script and upload to wago.io (have fun :)
--check the list of available functions and members to override at 'Plater.CanOverride_Functions' and 'Plater.CanOverride_Members'
--Weakauras Scripters: if you need to attach something to Plater nameplates:
-- local namePlate = C_NamePlate.GetNamePlateForUnit (unitID)
-- local unitFrame = namePlate.unitFrame --unitFrame is the main frame where all things is attached, it has SetAllPoints() on the namePlate frame.
-- local healthBar = unitFrame.healthBar
-- local castBar = unitFrame.castBar
-- update localization
-- navigate within the code using search tags: ~color ~border, etc...
if (true) then
--return
--but not today
end
--> details! framework
local DF = _G ["DetailsFramework"]
if (not DF) then
print ("|cFFFFAA00Plater: framework not found, if you just installed or updated the addon, please restart your client.|r")
return
end
--/run UIErrorsFrame:HookScript ("OnEnter", function() UIErrorsFrame:EnableMouse (false);Plater:Msg("UIErrorsFrame had MouseEnabled, its disabled now.") end)
--> some WA or addon are enabling the mouse on the error frame making nameplates unclickable
if (UIErrorsFrame) then
UIErrorsFrame:HookScript ("OnEnter", function()
--safe disable the mouse on error frame avoiding mouse interactions and warn the user
UIErrorsFrame:EnableMouse (false)
Plater:Msg ("something enabled the mouse on UIErrorsFrame, Plater disabled.")
end)
UIErrorsFrame:EnableMouse (false)
end
--> locals
local unpack = unpack
local ipairs = ipairs
local rawset = rawset
--local rawget = rawget --200 locals limit
--local setfenv = setfenv --200 locals limit
local xpcall = xpcall
local InCombatLockdown = InCombatLockdown
local UnitIsPlayer = UnitIsPlayer
local UnitClassification = UnitClassification
local UnitDetailedThreatSituation = UnitDetailedThreatSituation
local UnitCanAttack = UnitCanAttack
--local IsSpellInRange = IsSpellInRange --200 locals limit
local abs = math.abs
local format = string.format
local GetSpellInfo = GetSpellInfo or function(spellID) if not spellID then return nil end local si = C_Spell.GetSpellInfo(spellID) if si then return si.name, nil, si.iconID, si.castTime, si.minRange, si.maxRange, si.spellID, si.originalIconID end end
local UnitIsUnit = UnitIsUnit
local type = type
local select = select
local UnitGUID = UnitGUID
local strsplit = strsplit
local lower = string.lower
local floor = floor
local max = math.max
local min = math.min
local IS_WOW_PROJECT_MAINLINE = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE
local IS_WOW_PROJECT_NOT_MAINLINE = WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE
local IS_WOW_PROJECT_CLASSIC_ERA = WOW_PROJECT_ID == WOW_PROJECT_CLASSIC
local IS_WOW_PROJECT_CLASSIC_WRATH = IS_WOW_PROJECT_NOT_MAINLINE and ClassicExpansionAtLeast and LE_EXPANSION_WRATH_OF_THE_LICH_KING and ClassicExpansionAtLeast(LE_EXPANSION_WRATH_OF_THE_LICH_KING)
--local IS_WOW_PROJECT_CLASSIC_CATACLYSM = IS_WOW_PROJECT_NOT_MAINLINE and ClassicExpansionAtLeast and LE_EXPANSION_CATACLYSM and ClassicExpansionAtLeast(LE_EXPANSION_CATACLYSM)
local PixelUtil = PixelUtil or DFPixelUtil
local parserFunctions --reference needed
local LibSharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0") -- https://www.curseforge.com/wow/addons/libsharedmedia-3-0
local LCG = LibStub:GetLibrary("LibCustomGlow-1.0") -- https://github.com/Stanzilla/LibCustomGlow
local LibRangeCheck = LibStub:GetLibrary ("LibRangeCheck-3.0") -- https://github.com/WeakAuras/LibRangeCheck-3.0
local LibTranslit = LibStub:GetLibrary ("LibTranslit-1.0") -- https://github.com/Vardex/LibTranslit
local LDB = LibStub ("LibDataBroker-1.1", true)
local LDBIcon = LDB and LibStub ("LibDBIcon-1.0", true)
local addonId, platerInternal = ...
local _ = nil
--localization
local LOC = DF.Language.GetLanguageTable(addonId)
---@type plater
local Plater = DF:CreateAddOn ("Plater", "PlaterDB", PLATER_DEFAULT_SETTINGS, InterfaceOptionsFrame and { --options table --TODO: DISABLED FOR DRAGONFLIGHT FOR NOW!
name = "Plater Nameplates",
type = "group",
args = {
openOptions = {
name = "Open Plater Options",
desc = "Opens the Plater Options Menu.",
type = "execute",
func = function()
if InterfaceOptionsFrame then
InterfaceOptionsFrame:Hide()
elseif SettingsPanel then
SettingsPanel:Hide()
end
HideUIPanel(GameMenuFrame)
Plater.OpenOptionsPanel()
end,
},
}
})
local GetAddOnMetadata = C_AddOns and C_AddOns.GetAddOnMetadata or GetAddOnMetadata
Plater.versionString = GetAddOnMetadata("Plater", "Version")
Plater.fullVersionInfo = Plater.versionString .. " - DF v" .. select(2,LibStub:GetLibrary("DetailsFramework-1.0")) .. " - " .. GetBuildInfo()
function Plater.GetVersionInfo(printOut)
-- update, just in case...
Plater.versionString = GetAddOnMetadata("Plater", "Version")
Plater.fullVersionInfo = Plater.versionString .. " - DF v" .. select(2,LibStub:GetLibrary("DetailsFramework-1.0")) .. " - " .. GetBuildInfo()
if printOut then print("Plater version info:\n" .. Plater.fullVersionInfo) end
return Plater.fullVersionInfo
end
--> when a hook script is compiled, it increases the build version, so the handler for running scripts will notice in the change and update the script in real time
local PLATER_HOOK_BUILD = 1
function Plater.IncreaseHookBuildID() --private
PLATER_HOOK_BUILD = PLATER_HOOK_BUILD + 1
end
--> if a widget has a RefreshID lower than the addon, it needs to be updated
local PLATER_REFRESH_ID = 1
function Plater.IncreaseRefreshID() --private
PLATER_REFRESH_ID = PLATER_REFRESH_ID + 1
Plater.IncreaseRefreshID_Auras()
end
platerInternal.CreateDataTables(Plater)
Plater.ForceBlizzardNameplateUnits = {
--
}
Plater.AddForceBlizzardNameplateUnits = function(npcID)
if type(npcID) == "number" then
Plater.ForceBlizzardNameplateUnits[npcID] = true
end
end
Plater.RemoveForceBlizzardNameplateUnits = function(npcID)
if type(npcID) == "number" then
Plater.ForceBlizzardNameplateUnits[npcID] = nil
end
end
--store npc names and spell names from the current/latest combat
--used to sort data in the options panel: Spell List, Spell Colors and Npc Colors
Plater.LastCombat = {
npcNames = {},
spellNames = {},
}
Plater.MDTSettings = {
button_width = 18, --button and icon width
button_height = 18,
enemyinfo_button_point = {"topright", "topright", 4.682, -21.361},
spellinfo_button_point = {"bottomright", "bottomright", -12, 2},
icon_texture = [[Interface\Buttons\UI-Panel-BiggerButton-Up]],
icon_coords = {0.2, 0.8, 0.2, 0.8},
alpha = 0.834, --button alpha
}
-- ~hook (hook scripts are cached in the indexed part of these tales, for performance the member ScriptAmount caches the amount of scripts inside the indexed table)
local HOOK_NAMEPLATE_ADDED = {ScriptAmount = 0}
local HOOK_NAMEPLATE_CREATED = {ScriptAmount = 0}
local HOOK_NAMEPLATE_REMOVED = {ScriptAmount = 0}
local HOOK_NAMEPLATE_UPDATED = {ScriptAmount = 0}
local HOOK_TARGET_CHANGED = {ScriptAmount = 0}
local HOOK_CAST_START = {ScriptAmount = 0}
local HOOK_CAST_UPDATE = {ScriptAmount = 0}
local HOOK_CAST_STOP = {ScriptAmount = 0}
local HOOK_RAID_TARGET = {ScriptAmount = 0}
local HOOK_COMBAT_ENTER = {ScriptAmount = 0}
local HOOK_COMBAT_LEAVE = {ScriptAmount = 0}
local HOOK_NAMEPLATE_CONSTRUCTOR = {ScriptAmount = 0}
local HOOK_PLAYER_POWER_UPDATE = {ScriptAmount = 0}
local HOOK_PLAYER_TALENT_UPDATE = {ScriptAmount = 0}
local HOOK_HEALTH_UPDATE = {ScriptAmount = 0}
local HOOK_ZONE_CHANGED = {ScriptAmount = 0}
local HOOK_UNITNAME_UPDATE = {ScriptAmount = 0}
local HOOK_LOAD_SCREEN = {ScriptAmount = 0}
local HOOK_PLAYER_LOGON = {ScriptAmount = 0}
local HOOK_MOD_INITIALIZATION = {ScriptAmount = 0}
local HOOK_MOD_DEINITIALIZATION = {ScriptAmount = 0}
local HOOK_COMM_RECEIVED_MESSAGE = {ScriptAmount = 0}
local HOOK_COMM_SEND_MESSAGE = {ScriptAmount = 0}
local HOOK_OPTION_CHANGED = {ScriptAmount = 0}
local HOOK_MOD_OPTION_CHANGED = {ScriptAmount = 0}
local HOOK_NAMEPLATE_DESTRUCTOR = {ScriptAmount = 0}
platerInternal.HOOK_MOD_OPTION_CHANGED = HOOK_MOD_OPTION_CHANGED --triggered from Plater.ScriptingOptions.lua
local PLATER_GLOBAL_MOD_ENV = {} -- contains modEnv for each mod, identified by "<mod name>"
local PLATER_GLOBAL_SCRIPT_ENV = {} -- contains modEnv for each script, identified by "<script name>"
--> cvars just to make them easier to read
local CVAR_ENABLED = "1"
local CVAR_DISABLED = "0"
--> cache some common used member strings for better reading
local MEMBER_UNITID = "namePlateUnitToken"
local MEMBER_GUID = "namePlateUnitGUID"
local MEMBER_NPCID = "namePlateNpcId"
local MEMBER_QUEST = "namePlateIsQuestObjective"
local MEMBER_REACTION = "namePlateUnitReaction"
local MEMBER_RANGE = "namePlateInRange"
local MEMBER_NOCOMBAT = "namePlateNoCombat"
local MEMBER_NAME = "namePlateUnitName"
local MEMBER_NAMELOWER = "namePlateUnitNameLower"
local MEMBER_TARGET = "namePlateIsTarget"
--> cache nameplate types for better reading the code
local ACTORTYPE_FRIENDLY_PLAYER = "friendlyplayer"
local ACTORTYPE_FRIENDLY_NPC = "friendlynpc"
local ACTORTYPE_ENEMY_PLAYER = "enemyplayer"
local ACTORTYPE_ENEMY_NPC = "enemynpc"
local ACTORTYPE_PLAYER = "player"
local class_specs_coords = {
[577] = {128/512, 192/512, 256/512, 320/512}, --> havoc demon hunter
[581] = {192/512, 256/512, 256/512, 320/512}, --> vengeance demon hunter
[250] = {0, 64/512, 0, 64/512}, --> blood dk
[251] = {64/512, 128/512, 0, 64/512}, --> frost dk
[252] = {128/512, 192/512, 0, 64/512}, --> unholy dk
[102] = {192/512, 256/512, 0, 64/512}, --> druid balance
[103] = {256/512, 320/512, 0, 64/512}, --> druid feral
[104] = {320/512, 384/512, 0, 64/512}, --> druid guardian
[105] = {384/512, 448/512, 0, 64/512}, --> druid resto
[253] = {448/512, 512/512, 0, 64/512}, --> hunter bm
[254] = {0, 64/512, 64/512, 128/512}, --> hunter marks
[255] = {64/512, 128/512, 64/512, 128/512}, --> hunter survivor
[62] = {(128/512) + 0.001953125, 192/512, 64/512, 128/512}, --> mage arcane
[63] = {192/512, 256/512, 64/512, 128/512}, --> mage fire
[64] = {256/512, 320/512, 64/512, 128/512}, --> mage frost
[268] = {320/512, 384/512, 64/512, 128/512}, --> monk bm
[269] = {448/512, 512/512, 64/512, 128/512}, --> monk ww
[270] = {384/512, 448/512, 64/512, 128/512}, --> monk mw
[65] = {0, 64/512, 128/512, 192/512}, --> paladin holy
[66] = {64/512, 128/512, 128/512, 192/512}, --> paladin protect
[70] = {(128/512) + 0.001953125, 192/512, 128/512, 192/512}, --> paladin ret
[256] = {192/512, 256/512, 128/512, 192/512}, --> priest disc
[257] = {256/512, 320/512, 128/512, 192/512}, --> priest holy
[258] = {(320/512) + (0.001953125 * 4), 384/512, 128/512, 192/512}, --> priest shadow
[259] = {64/512, 128/512, 384/512, 448/512}, --> rogue assassination
[260] = {0, 64/512, 384/512, 448/512}, --> rogue outlaw
[261] = {0, 64/512, 192/512, 256/512}, --> rogue sub
[262] = {64/512, 128/512, 192/512, 256/512}, --> shaman elemental
[263] = {128/512, 192/512, 192/512, 256/512}, --> shamel enhancement
[264] = {192/512, 256/512, 192/512, 256/512}, --> shaman resto
[265] = {256/512, 320/512, 192/512, 256/512}, --> warlock aff
[266] = {320/512, 384/512, 192/512, 256/512}, --> warlock demo
[267] = {384/512, 448/512, 192/512, 256/512}, --> warlock destro
[71] = {448/512, 512/512, 192/512, 256/512}, --> warrior arms
[72] = {0, 64/512, 256/512, 320/512}, --> warrior fury
[73] = {64/512, 128/512, 256/512, 320/512}, --> warrior protect
[1467] = {256/512, 320/512, 256/512, 320/512}, --> evoker devastation
[1468] = {320/512, 384/512, 256/512, 320/512}, --> evoker preservation
[1473] = {384/512, 448/512, 256/512, 320/512}, --> evoker augmentation
}
--localization
Plater.AnchorNames = {
LOC["OPTIONS_ANCHOR_TOPLEFT"],
LOC["OPTIONS_ANCHOR_LEFT"],
LOC["OPTIONS_ANCHOR_BOTTOMLEFT"],
LOC["OPTIONS_ANCHOR_BOTTOM"],
LOC["OPTIONS_ANCHOR_BOTTOMRIGHT"],
LOC["OPTIONS_ANCHOR_RIGHT"],
LOC["OPTIONS_ANCHOR_TOPRIGHT"],
LOC["OPTIONS_ANCHOR_TOP"],
LOC["OPTIONS_ANCHOR_CENTER"],
LOC["OPTIONS_ANCHOR_INNERLEFT"],
LOC["OPTIONS_ANCHOR_INNERRIGHT"],
LOC["OPTIONS_ANCHOR_INNERTOP"],
LOC["OPTIONS_ANCHOR_INNERBOTTOM"],
}
Plater.AnchorNamesByPhraseId = {
"OPTIONS_ANCHOR_TOPLEFT",
"OPTIONS_ANCHOR_LEFT",
"OPTIONS_ANCHOR_BOTTOMLEFT",
"OPTIONS_ANCHOR_BOTTOM",
"OPTIONS_ANCHOR_BOTTOMRIGHT",
"OPTIONS_ANCHOR_RIGHT",
"OPTIONS_ANCHOR_TOPRIGHT",
"OPTIONS_ANCHOR_TOP",
"OPTIONS_ANCHOR_CENTER",
"OPTIONS_ANCHOR_INNERLEFT",
"OPTIONS_ANCHOR_INNERRIGHT",
"OPTIONS_ANCHOR_INNERTOP",
"OPTIONS_ANCHOR_INNERBOTTOM",
}
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> cached value ~cache
--Plater allocate several values in memory to save performance (cpu), this may increase memory usage
--example: intead of querying Plater.db.profile.tank it just hold a pointer to that table in the variable DB_AGGRO_TANK_COLORS, and this pointer is updated when the user changes something in the options panel
local DB_NUMBER_REGION_EAST_ASIA
local DB_TICK_THROTTLE
local DB_LERP_COLOR
local DB_LERP_COLOR_SPEED
local DB_PLATE_CONFIG
local DB_HOVER_HIGHLIGHT
local DB_CLASS_COLORS
--auras
local DB_AURA_ENABLED
local DB_AURA_ALPHA
local DB_AURA_SEPARATE_BUFFS
local DB_USE_UIPARENT
local DB_UNITCOLOR_CACHE = {}
local DB_UNITCOLOR_SCRIPT_CACHE = {}
local IS_USING_DETAILS_INTEGRATION
local DB_TRACK_METHOD
local DB_BORDER_COLOR_R
local DB_BORDER_COLOR_G
local DB_BORDER_COLOR_B
local DB_BORDER_COLOR_A
local DB_BORDER_THICKNESS
local DB_AGGRO_CHANGE_HEALTHBAR_COLOR
local DB_AGGRO_CHANGE_NAME_COLOR
local DB_AGGRO_CHANGE_BORDER_COLOR
local DB_AGGRO_CAN_CHECK_NOTANKAGGRO
local DB_TARGET_SHADY_ENABLED
local DB_TARGET_SHADY_ALPHA
local DB_TARGET_SHADY_COMBATONLY
local DB_NAME_NPCENEMY_ANCHOR
local DB_NAME_NPCFRIENDLY_ANCHOR
local DB_NAME_PLAYERENEMY_ANCHOR
local DB_NAME_PLAYERFRIENDLY_ANCHOR
local DB_DO_ANIMATIONS
local DB_ANIMATION_TIME_DILATATION
local DB_USE_RANGE_CHECK
local DB_USE_NON_TARGETS_ALPHA
local DB_USE_FOCUS_TARGET_ALPHA
local DB_USE_ALPHA_FRIENDLIES
local DB_USE_ALPHA_ENEMIES
local DB_USE_QUICK_HIDE
local DB_SHOW_HEALTHBARS_FOR_NOT_ATTACKABLE
local DB_TEXTURE_CASTBAR
local DB_TEXTURE_CASTBAR_BG
local DB_TEXTURE_HEALTHBAR
local DB_TEXTURE_HEALTHBAR_BG
local DB_CASTBAR_HIDE_ENEMIES
local DB_CASTBAR_HIDE_FRIENDLY
---@type plater_spelldata[]
local DB_CAPTURED_SPELLS = {}
---@type plater_spelldata[]
local DB_CAPTURED_CASTS = {}
--store the aggro color table for tanks and dps
local DB_AGGRO_TANK_COLORS
local DB_AGGRO_DPS_COLORS
--store if the no combat alpha is enabled
local DB_NOT_COMBAT_ALPHA_ENABLED
local DB_USE_HEALTHCUTOFF = false
local DB_HEALTHCUTOFF_AT = 0.2
local DB_HEALTHCUTOFF_AT_UPPER = 0.8
--store translit option
local DB_USE_NAME_TRANSLIT = false
local TRANSLIT_MARK = "*"
--store the npc id cache
local DB_NPCIDS_CACHE = {}
Plater.ScriptAura = {}
local SCRIPT_AURA_TRIGGER_CACHE = Plater.ScriptAura
Plater.ScriptCastBar = {}
local SCRIPT_CASTBAR_TRIGGER_CACHE = Plater.ScriptCastBar
Plater.ScriptUnit = {}
local SCRIPT_UNIT_TRIGGER_CACHE = Plater.ScriptUnit
--spell animations - store a table with information about animation for spells
local SPELL_WITH_ANIMATIONS = {}
--cache this inside plater object to access it from the animation editor
Plater.SPELL_WITH_ANIMATIONS = SPELL_WITH_ANIMATIONS
--store players which have the tank role in the group
local TANK_CACHE = {}
--store pet GUIDs
---@type plater_petinfo[]
local PET_CACHE = {}
--store pets summoned by the player it self
Plater.PlayerPetCache = {}
--store if the player is in combat (not reliable, toggled at regen switch)
local PLAYER_IN_COMBAT
--store if the player is not inside an instance
local IS_IN_OPEN_WORLD = true
--store if the player is inside a instance (raid or dungeon)
local IS_IN_INSTANCE = false
--if true, the animation will update its settings before play
local IS_EDITING_SPELL_ANIMATIONS = false
local HOOKED_BLIZZARD_PLATEFRAMES = {}
local ENABLED_BLIZZARD_PLATEFRAMES = {}
local SUPPORT_BLIZZARD_PLATEFRAMES = false
local NUM_NAMEPLATES_ON_SCREEN = 0
local NAMEPLATES_ON_SCREEN_CACHE = {}
local CLASS_INFO_CACHE = {}
--store a list of friendly players in the player friends list
Plater.FriendsCache = {}
--store quests the player is in
Plater.QuestCache = {}
--store only campaign quests
Plater.QuestCacheCampaign = {}
--cache the profile settings for each actor type on this table, so scripts can have access to profile
Plater.ActorTypeSettingsCache = { --private
RefreshID = -1,
--plate holder tables, they will be overriden when updating the cache
[ACTORTYPE_FRIENDLY_PLAYER] = {},
[ACTORTYPE_FRIENDLY_NPC] = {},
[ACTORTYPE_ENEMY_PLAYER] = {},
[ACTORTYPE_ENEMY_NPC] = {},
[ACTORTYPE_PLAYER] = {},
}
--update the settings cache for scritps
--this is a table with a copy of the settings from the profile so can be safelly accessed by scripts
function Plater.UpdateSettingsCache() --private
if (Plater.ActorTypeSettingsCache.RefreshID >= PLATER_REFRESH_ID) then
return
end
local namePlateConfig = Plater.db.profile.plate_config
Plater.ActorTypeSettingsCache [ACTORTYPE_FRIENDLY_PLAYER] = DF.table.copy ({}, namePlateConfig [ACTORTYPE_FRIENDLY_PLAYER])
Plater.ActorTypeSettingsCache [ACTORTYPE_FRIENDLY_NPC] = DF.table.copy ({}, namePlateConfig [ACTORTYPE_FRIENDLY_NPC])
Plater.ActorTypeSettingsCache [ACTORTYPE_ENEMY_PLAYER] = DF.table.copy ({}, namePlateConfig [ACTORTYPE_ENEMY_PLAYER])
Plater.ActorTypeSettingsCache [ACTORTYPE_ENEMY_NPC] = DF.table.copy ({}, namePlateConfig [ACTORTYPE_ENEMY_NPC])
Plater.ActorTypeSettingsCache [ACTORTYPE_PLAYER] = DF.table.copy ({}, namePlateConfig [ACTORTYPE_PLAYER])
Plater.ActorTypeSettingsCache.RefreshID = PLATER_REFRESH_ID
end
function Plater.InitLDB()
if LDB then
local databroker = LDB:NewDataObject ("Plater", {
type = "data source",
icon = [[Interface\AddOns\Plater\images\cast_bar]],
text = "Plater",
showInCompartment = true,
HotCornerIgnore = true,
OnClick = function (self, button)
if (button == "LeftButton") then
if (PlaterOptionsPanelFrame and PlaterOptionsPanelFrame:IsShown()) then
PlaterOptionsPanelFrame:Hide()
return true
end
Plater.OpenOptionsPanel()
elseif (button == "RightButton") then
GameTooltip:Hide()
local GameCooltip = GameCooltip2
GameCooltip:Reset()
GameCooltip:SetType ("menu")
GameCooltip:SetOption ("ButtonsYMod", -5)
GameCooltip:SetOption ("HeighMod", 5)
GameCooltip:SetOption ("TextSize", 10)
--> disable minimap icon
local toggle_minimap = function()
PlaterDBChr.minimap.hide = not PlaterDBChr.minimap.hide
if (PlaterDBChr.minimap.hide) then
LDBIcon:Hide ("Plater")
else
LDBIcon:Show ("Plater")
end
LDBIcon:Refresh ("Plater", PlaterDBChr.minimap)
end
local toggle_compartment = function()
if LDBIcon:IsButtonInCompartment("Plater") then
LDBIcon:RemoveButtonFromCompartment("Plater")
else
LDBIcon:AddButtonToCompartment("Plater")
end
end
GameCooltip:AddMenu (1, function() Plater.EnableProfiling(true) end, true, nil, nil, "Start profiling", nil, true)
GameCooltip:AddIcon ([[Interface\Addons\Plater\media\sphere_full_64]], 1, 1, 14, 14, 0, 1, 0, 1, "red")
GameCooltip:AddMenu (1, function() Plater.DisableProfiling() end, true, nil, nil, "Stop profiling", nil, true)
GameCooltip:AddIcon ([[Interface\Addons\Plater\media\square_64]], 1, 1, 14, 14, 0, 1, 0, 1, "blue")
GameCooltip:AddMenu (1, function() Plater.ShowPerfData() end, true, nil, nil, "Show profiling data", nil, true)
GameCooltip:AddIcon ([[Interface\Addons\Plater\media\eye_64]], 1, 1, 14, 14, 0, 1, 0, 1, "green")
GameCooltip:AddLine ("$div")
GameCooltip:AddMenu (1, toggle_minimap, true, nil, nil, "Hide/Show Minimap Icon", nil, true)
GameCooltip:AddIcon ([[Interface\Buttons\UI-Panel-HideButton-Disabled]], 1, 1, 14, 14, 7/32, 24/32, 8/32, 24/32, "gray")
GameCooltip:AddMenu (1, toggle_compartment, true, nil, nil, "Hide/Show Compartment Entry", nil, true)
GameCooltip:AddIcon ([[Interface\Buttons\UI-Panel-HideButton-Disabled]], 1, 1, 14, 14, 7/32, 24/32, 8/32, 24/32, "gray")
--GameCooltip:SetBackdrop (1, _detalhes.tooltip_backdrop, nil, _detalhes.tooltip_border_color)
GameCooltip:SetWallpaper (1, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0.64453125, 0}, {.8, .8, .8, 0.2}, true)
GameCooltip:SetOwner (self, "topright", "bottomleft")
GameCooltip:ShowCooltip()
end
end,
OnTooltipShow = function (tooltip)
tooltip:AddLine ("Plater Nameplates", 1, 1, 1)
tooltip:AddLine ("|cFFCFCFCFLeft click|r: Show/Hide Options Window")
tooltip:AddLine ("|cFFCFCFCFRight click|r: Quick Menu")
end,
})
if (databroker and not LDBIcon:IsRegistered ("Plater")) then
PlaterDBChr.minimap = PlaterDBChr.minimap or {}
LDBIcon:Register ("Plater", databroker, PlaterDBChr.minimap)
if not PlaterDBChr.minimap.showInCompartment == true then
--LDBIcon:AddButtonToCompartment("Plater") -- this is opt-in in LDBIcon (for now)
end
end
Plater.databroker = databroker
end
end
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> character specific abilities and spells ~spells
-- ~execute
---update if can use execute indicators - this function needs to be updated when a new execute spell is added, removed, modified
---in scripts you can use Plater.SetExecuteRange or override this function completelly
function Plater.GetHealthCutoffValue(getOnly)
Plater.SetExecuteRange (false)
local lowerEnabled, upperEnabled = Plater.db.profile.health_cutoff, Plater.db.profile.health_cutoff_upper
if (not (lowerEnabled or upperEnabled)) then
if not getOnly then
return
end
end
local lowExecute, highExecute = nil, nil
if IS_WOW_PROJECT_MAINLINE then
--retail
--small helper
local isTalentLearned = function(nodeID)
local talentConfig = C_ClassTalents.GetActiveConfigID()
local nodeInfo = talentConfig and nodeID and C_Traits.GetNodeInfo(talentConfig, nodeID)
return nodeInfo and nodeInfo.entryIDsWithCommittedRanks and nodeInfo.entryIDsWithCommittedRanks[1] and true or false
end
local classLoc, class = UnitClass ("player")
local spec = GetSpecialization()
if (spec and class) then
if (class == "PRIEST") then
-- SW:D is available to all priest specs
if IsPlayerSpell(32379) then
lowExecute = 0.20
end
elseif (class == "MAGE") then
if IsPlayerSpell(2948) then -- Scorch
lowExecute = 0.3
if isTalentLearned(449349) then --Sunfury Execution (for Scorch)
lowExecute = 0.35
end
end
if IsPlayerSpell(205026) then --Firestarter
highExecute = 0.9
end
if IsPlayerSpell(384581) then -- Arcane Bombardment
lowExecute = 0.35
end
elseif (class == "WARRIOR") then
-- Execute is baseline
if IsPlayerSpell(163201) then
local using_Massacre = IsPlayerSpell(281001) or IsPlayerSpell(206315)
lowExecute = using_Massacre and 0.35 or 0.2
--local using_Condemn = IsPlayerSpell(317320) -- that's not really used anymore...
--highExecute = using_Condemn and 0.8 or nil
end
elseif (class == "HUNTER") then
if IsPlayerSpell(53351) or IsPlayerSpell(320976) then -- Kill Shot
lowExecute = 0.2
end
if isTalentLearned(94987) then --IsPlayerSpell(466930) then --> Black Arrow
lowExecute = 0.2
highExecute = 0.8
end
if IsPlayerSpell(273887) then --> is using killer instinct?
lowExecute = 0.35
end
if IsPlayerSpell(260228) then --> Careful Aim
highExecute = 0.7
end
elseif (class == "PALADIN") then
-- hammer of wrath
if IsPlayerSpell(24275) then
lowExecute = 0.2
end
elseif (class == "MONK") then
--Touch of Death
if IsPlayerSpell(322113) then
lowExecute = 0.15
end
elseif (class == "WARLOCK") then
if IsPlayerSpell(17877) then --Shadowburn
if IsPlayerSpell(456939) then -- Blistering Atrophy
lowExecute = 0.30
else
lowExecute = 0.20
end
elseif IsSpellKnownOrOverridesKnown(198590) then --Drain Soul
lowExecute = 0.20
end
elseif (class == "ROGUE") then
if IsPlayerSpell(328085) then --Blindside
lowExecute = 0.35
end
elseif (class == "DEATHKNIGHT") then
if IsPlayerSpell(343294) then --Soul Reaper
lowExecute = 0.35
end
end
end
else
-- WotLK and classic
local classLoc, class = UnitClass ("player")
if (class) then
if (class == "WARRIOR") then
-- Execute
if GetSpellInfo(GetSpellInfo(5308)) then
lowExecute = 0.2
end
elseif (class == "PALADIN") then
-- Hammer of Wrath
if GetSpellInfo(GetSpellInfo(24275)) then
lowExecute = 0.2
end
elseif (class == "WARLOCK") then
-- Decimation
if IsPlayerSpell(63156) or IsPlayerSpell(63158) then
lowExecute = 0.25
else
lowExecute = 0.25
end
elseif (class == "HUNTER") then
-- Kill Shot
if GetSpellInfo(GetSpellInfo(53351)) then
lowExecute = 0.2
end
elseif (class == "PRIEST") then
if IS_WOW_PROJECT_CLASSIC_WRATH then -- why wrath again?... can't remember
for i = 1, 6 do
local enabled, _, glyphSpellID = GetGlyphSocketInfo(i)
if enabled and glyphSpellID then
if glyphSpellID == 55682 then --Glyph of Shadow Word: Death
lowExecute = 0.35
break
end
end
end
end
-- SW:D is available to all priest specs
if IsPlayerSpell(32379) then
lowExecute = 0.25
end
end
end
end
if not getOnly then
Plater.SetExecuteRange (true, lowerEnabled and lowExecute or nil, upperEnabled and highExecute or nil)
end
return lowerEnabled and lowExecute or nil, upperEnabled and highExecute or nil
end
---range check ~range
---@param plateFrame plateframe
---@param onAdded boolean
function Plater.CheckRange (plateFrame, onAdded)
Plater.StartLogPerformanceCore("Plater-Core", "Update", "CheckRange")
local profile = Plater.db.profile
local unitFrame = plateFrame.unitFrame
local castBarFade = unitFrame.castBar.fadeOutAnimation:IsPlaying() --and profile.cast_statusbar_use_fade_effects
local nameplateAlpha = 1
local occlusionAlpha = tonumber(GetCVar ("nameplateOccludedAlphaMult")) or 1
if DB_USE_UIPARENT and profile.honor_blizzard_plate_alpha then
--if DB_USE_UIPARENT end
nameplateAlpha = plateFrame:GetAlpha()
end
unitFrame.IsInRange = nil
--if is using the no combat alpha and the unit isn't in combat, ignore the range check, no combat alpha is disabled by default
if (unitFrame.IsSelf) then
unitFrame.IsInRange = true --player plate is always in range
unitFrame:SetAlpha (nameplateAlpha)
unitFrame.healthBar:SetAlpha (1)
if not castBarFade then
unitFrame.castBar:SetAlpha (1)
end
unitFrame.powerBar:SetAlpha (1)
unitFrame.BuffFrame:SetAlpha (DB_AURA_ALPHA)
unitFrame.BuffFrame2:SetAlpha (DB_AURA_ALPHA)
Plater.EndLogPerformanceCore("Plater-Core", "Update", "CheckRange")
return
elseif (plateFrame [MEMBER_NOCOMBAT] or unitFrame.isWidgetOnlyMode) then
if unitFrame.isWidgetOnlyMode then
unitFrame:SetAlpha (1)
elseif nameplateAlpha < profile.not_affecting_combat_alpha and nameplateAlpha >= occlusionAlpha then
unitFrame:SetAlpha (nameplateAlpha)
else
unitFrame:SetAlpha (profile.not_affecting_combat_alpha)
end
--unitFrame:SetAlpha (profile.not_affecting_combat_alpha) -- already set if necessary
unitFrame.healthBar:SetAlpha (1)
if not castBarFade then
unitFrame.castBar:SetAlpha (1)
end
unitFrame.powerBar:SetAlpha (1)
unitFrame.BuffFrame:SetAlpha (DB_AURA_ALPHA)
unitFrame.BuffFrame2:SetAlpha (DB_AURA_ALPHA)
Plater.EndLogPerformanceCore("Plater-Core", "Update", "CheckRange")
return
--the unit is friendly or not using range check and non targets alpha
elseif ((not DB_USE_ALPHA_FRIENDLIES and plateFrame [MEMBER_REACTION] >= 5) or (not DB_USE_ALPHA_ENEMIES and plateFrame [MEMBER_REACTION] < 5) or (not DB_USE_RANGE_CHECK and not DB_USE_NON_TARGETS_ALPHA)) then
unitFrame:SetAlpha (nameplateAlpha)
unitFrame.healthBar:SetAlpha (1)
if not castBarFade then
unitFrame.castBar:SetAlpha (1)
end
unitFrame.powerBar:SetAlpha (1)
unitFrame.BuffFrame:SetAlpha (DB_AURA_ALPHA)
unitFrame.BuffFrame2:SetAlpha (DB_AURA_ALPHA)
plateFrame [MEMBER_RANGE] = true
unitFrame [MEMBER_RANGE] = true
Plater.EndLogPerformanceCore("Plater-Core", "Update", "CheckRange")
return
end
--alpha values
local inRangeAlpha
local overallRangeCheckAlpha
local healthBar_rangeCheckAlpha
local castBar_rangeCheckAlpha
local buffFrames_rangeCheckAlpha
local powerBar_rangeCheckAlpha
local rangeChecker
local rangeCheckRange
if plateFrame [MEMBER_REACTION] < 5 then
-- enemy
inRangeAlpha = profile.range_check_in_range_or_target_alpha
overallRangeCheckAlpha = profile.range_check_alpha
healthBar_rangeCheckAlpha = profile.range_check_health_bar_alpha
castBar_rangeCheckAlpha = profile.range_check_cast_bar_alpha
buffFrames_rangeCheckAlpha = profile.range_check_buffs_alpha
powerBar_rangeCheckAlpha = profile.range_check_power_bar_alpha
rangeChecker = Plater.RangeCheckFunctionEnemy or LibRangeCheck:GetHarmMaxChecker(Plater.RangeCheckRangeEnemy or 40, true)
rangeCheckRange = Plater.RangeCheckRangeEnemy
else
-- friendly
inRangeAlpha = profile.range_check_in_range_or_target_alpha_friendlies
overallRangeCheckAlpha = profile.range_check_alpha_friendlies
healthBar_rangeCheckAlpha = profile.range_check_health_bar_alpha_friendlies
castBar_rangeCheckAlpha = profile.range_check_cast_bar_alpha_friendlies
buffFrames_rangeCheckAlpha = profile.range_check_buffs_alpha_friendlies
powerBar_rangeCheckAlpha = profile.range_check_power_bar_alpha_friendlies
rangeChecker = Plater.RangeCheckFunctionFriendly or LibRangeCheck:GetFriendMaxChecker(Plater.RangeCheckRangeFriendly or 40, true)
rangeCheckRange = Plater.RangeCheckRangeFriendly
end
if not rangeChecker then
rangeChecker = function (unit)
local minRange, maxRange = (LibRangeCheck:GetRange(unit, nil, true) or 0)
maxRange = maxRange or minRange or 0
return maxRange <= (rangeCheckRange or 40)
end
Plater.GetSpellForRangeCheck()
end
--this unit is target
local unitIsTarget = unitFrame.isSoftInteract -- default to softinteract
local notTheTarget = false
--when the unit is out of range and isnt target, alpha is multiplied by this amount
local alphaMultiplier = 0.70
local healthBar = unitFrame.healthBar
local castBar = unitFrame.castBar
local powerBar = unitFrame.powerBar
local buffFrame1 = unitFrame.BuffFrame
local buffFrame2 = unitFrame.BuffFrame2
--if "units which is not target" is enabled and the player is targetting something else than the player it self
if ((DB_USE_NON_TARGETS_ALPHA and Plater.PlayerHasTargetNonSelf) or (DB_USE_FOCUS_TARGET_ALPHA and Plater.PlayerHasFocusTargetNonSelf)) then
if (plateFrame [MEMBER_TARGET]) then
unitIsTarget = true
elseif (DB_USE_FOCUS_TARGET_ALPHA and unitFrame.IsFocus) then
unitIsTarget = true
else
notTheTarget = true
if (profile.transparency_behavior_use_division) then
alphaMultiplier = 0.5
end
end
end
--is using the range check by ability
if (DB_USE_RANGE_CHECK and rangeChecker) then
--check when the unit just has been added to the screen
local isInRange = rangeChecker (plateFrame [MEMBER_UNITID])
if (isInRange) then
--unit is in rage
unitFrame.IsInRange = true
if (onAdded) then
--plateFrame.FadedIn = true
unitFrame:SetAlpha (nameplateAlpha * inRangeAlpha * (notTheTarget and overallRangeCheckAlpha or 1))
healthBar:SetAlpha (inRangeAlpha * (notTheTarget and healthBar_rangeCheckAlpha or 1))
if not castBarFade then
castBar:SetAlpha (inRangeAlpha * (notTheTarget and castBar_rangeCheckAlpha or 1))
end
powerBar:SetAlpha (inRangeAlpha * (notTheTarget and powerBar_rangeCheckAlpha or 1))
buffFrame1:SetAlpha (inRangeAlpha * (notTheTarget and buffFrames_rangeCheckAlpha or 1))
buffFrame2:SetAlpha (inRangeAlpha * (notTheTarget and buffFrames_rangeCheckAlpha or 1))
plateFrame [MEMBER_RANGE] = true
plateFrame.unitFrame [MEMBER_RANGE] = true
else
local newAlpha = nameplateAlpha * inRangeAlpha * (notTheTarget and overallRangeCheckAlpha or 1)
if (not DF:IsNearlyEqual (unitFrame:GetAlpha(), newAlpha, 0.01)) then
--play animations (animation aren't while in development)
unitFrame:SetAlpha (nameplateAlpha * inRangeAlpha * (notTheTarget and overallRangeCheckAlpha or 1))
healthBar:SetAlpha (inRangeAlpha * (notTheTarget and healthBar_rangeCheckAlpha or 1))
if not castBarFade then
castBar:SetAlpha (inRangeAlpha * (notTheTarget and castBar_rangeCheckAlpha or 1))
end
powerBar:SetAlpha (inRangeAlpha * (notTheTarget and powerBar_rangeCheckAlpha or 1))
buffFrame1:SetAlpha (inRangeAlpha * (notTheTarget and buffFrames_rangeCheckAlpha or 1))
buffFrame2:SetAlpha (inRangeAlpha * (notTheTarget and buffFrames_rangeCheckAlpha or 1))
end
plateFrame [MEMBER_RANGE] = true
plateFrame.unitFrame [MEMBER_RANGE] = true
end
else
--unit is out of range
unitFrame.IsInRange = false
if (onAdded) then
plateFrame.FadedIn = nil
-- unitFrame:SetAlpha (overallRangeCheckAlpha * (notTheTarget and overallRangeCheckAlpha or 1))
-- healthBar:SetAlpha (healthBar_rangeCheckAlpha * (notTheTarget and healthBar_rangeCheckAlpha or 1))
-- castBar:SetAlpha (castBar_rangeCheckAlpha * (notTheTarget and castBar_rangeCheckAlpha or 1))
-- powerBar:SetAlpha (powerBar_rangeCheckAlpha * (notTheTarget and powerBar_rangeCheckAlpha or 1))
-- buffFrame1:SetAlpha (buffFrames_rangeCheckAlpha * (notTheTarget and buffFrames_rangeCheckAlpha or 1))
-- buffFrame2:SetAlpha (buffFrames_rangeCheckAlpha * (notTheTarget and buffFrames_rangeCheckAlpha or 1))
unitFrame:SetAlpha ((unitIsTarget and inRangeAlpha or overallRangeCheckAlpha) * nameplateAlpha * (notTheTarget and alphaMultiplier or 1))
healthBar:SetAlpha ((unitIsTarget and inRangeAlpha or healthBar_rangeCheckAlpha) * (notTheTarget and alphaMultiplier or 1))
if not castBarFade then
castBar:SetAlpha ((unitIsTarget and inRangeAlpha or castBar_rangeCheckAlpha) * (notTheTarget and alphaMultiplier or 1))
end
powerBar:SetAlpha ((unitIsTarget and inRangeAlpha or powerBar_rangeCheckAlpha) * (notTheTarget and alphaMultiplier or 1))
buffFrame1:SetAlpha ((unitIsTarget and inRangeAlpha or buffFrames_rangeCheckAlpha) * (notTheTarget and alphaMultiplier or 1))
buffFrame2:SetAlpha ((unitIsTarget and inRangeAlpha or buffFrames_rangeCheckAlpha) * (notTheTarget and alphaMultiplier or 1))
plateFrame [MEMBER_RANGE] = false
plateFrame.unitFrame [MEMBER_RANGE] = false
else
local newAlpha = nameplateAlpha * overallRangeCheckAlpha * (notTheTarget and alphaMultiplier or 1)
if (not DF:IsNearlyEqual (unitFrame:GetAlpha(), newAlpha, 0.01)) then
--play animations (animation aren't while in development)
-- unitFrame:SetAlpha (overallRangeCheckAlpha * (notTheTarget and overallRangeCheckAlpha or 1))
-- healthBar:SetAlpha (healthBar_rangeCheckAlpha * (notTheTarget and healthBar_rangeCheckAlpha or 1))
-- castBar:SetAlpha (castBar_rangeCheckAlpha * (notTheTarget and castBar_rangeCheckAlpha or 1))
-- powerBar:SetAlpha (powerBar_rangeCheckAlpha * (notTheTarget and powerBar_rangeCheckAlpha or 1))
-- buffFrame1:SetAlpha (buffFrames_rangeCheckAlpha * (notTheTarget and buffFrames_rangeCheckAlpha or 1))
-- buffFrame2:SetAlpha (buffFrames_rangeCheckAlpha * (notTheTarget and buffFrames_rangeCheckAlpha or 1))
unitFrame:SetAlpha ((unitIsTarget and inRangeAlpha or overallRangeCheckAlpha) * nameplateAlpha * (notTheTarget and alphaMultiplier or 1))
healthBar:SetAlpha ((unitIsTarget and inRangeAlpha or healthBar_rangeCheckAlpha) * (notTheTarget and alphaMultiplier or 1))
if not castBarFade then
castBar:SetAlpha ((unitIsTarget and inRangeAlpha or castBar_rangeCheckAlpha) * (notTheTarget and alphaMultiplier or 1))
end
powerBar:SetAlpha ((unitIsTarget and inRangeAlpha or powerBar_rangeCheckAlpha) * (notTheTarget and alphaMultiplier or 1))
buffFrame1:SetAlpha ((unitIsTarget and inRangeAlpha or buffFrames_rangeCheckAlpha) * (notTheTarget and alphaMultiplier or 1))
buffFrame2:SetAlpha ((unitIsTarget and inRangeAlpha or buffFrames_rangeCheckAlpha) * (notTheTarget and alphaMultiplier or 1))
end
plateFrame [MEMBER_RANGE] = false
plateFrame.unitFrame [MEMBER_RANGE] = false
end
end
--range check isnt enabled, check is no target alpha is
elseif (DB_USE_NON_TARGETS_ALPHA) then
--player has a target other than him self?
if (Plater.PlayerHasTargetNonSelf) then
--is this unit is the current player target?
if (unitIsTarget) then
if (not DF:IsNearlyEqual (unitFrame:GetAlpha(), nameplateAlpha * inRangeAlpha, 0.01)) then
unitFrame:SetAlpha (nameplateAlpha * inRangeAlpha)
healthBar:SetAlpha (inRangeAlpha)
if not castBarFade then
castBar:SetAlpha (inRangeAlpha)
end
powerBar:SetAlpha (inRangeAlpha)
buffFrame1:SetAlpha (DB_AURA_ALPHA)
buffFrame2:SetAlpha (DB_AURA_ALPHA)
end
plateFrame.FadedIn = true
else
--this unit isnt the current player target
if (not DF:IsNearlyEqual (unitFrame:GetAlpha(), nameplateAlpha * inRangeAlpha * overallRangeCheckAlpha, 0.01)) then
unitFrame:SetAlpha (nameplateAlpha * inRangeAlpha * overallRangeCheckAlpha)
healthBar:SetAlpha (inRangeAlpha * healthBar_rangeCheckAlpha)
if not castBarFade then
castBar:SetAlpha (inRangeAlpha * castBar_rangeCheckAlpha)
end
powerBar:SetAlpha (inRangeAlpha * powerBar_rangeCheckAlpha)
buffFrame1:SetAlpha (inRangeAlpha * buffFrames_rangeCheckAlpha)
buffFrame2:SetAlpha (inRangeAlpha * buffFrames_rangeCheckAlpha)
end
plateFrame.FadedIn = nil
end