forked from Tercioo/Plater-Nameplates
/
Plater.lua
13693 lines (11528 loc) · 524 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
-- 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
--> blend nameplates with the worldframe
local AlphaBlending = ALPHA_BLEND_AMOUNT + 0.0654785
--> locals
local unpack = unpack
local ipairs = ipairs
--local rawset = rawset --200 locals limit
local rawget = rawget
local setfenv = setfenv
--local pcall = pcall --200 locals limit
local InCombatLockdown = InCombatLockdown
local UnitIsPlayer = UnitIsPlayer
local UnitClassification = UnitClassification
local UnitDetailedThreatSituation = UnitDetailedThreatSituation
local UnitCanAttack = UnitCanAttack
local IsSpellInRange = IsSpellInRange
local abs = math.abs
local format = string.format
local GetSpellInfo = GetSpellInfo
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 PixelUtil = PixelUtil or DFPixelUtil
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-2.0") -- https://www.curseforge.com/wow/addons/librangecheck-2-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 = ...
_ = nil
--localization
local LOC = DF.Language.GetLanguageTable(addonId)
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
--script namespace
platerInternal.Scripts = {}
platerInternal.Mods = {}
platerInternal.Events = {}
platerInternal.Defaults = {
dropdownStatusBarTexture = [[Interface\Tooltips\UI-Tooltip-Background]],
dropdownStatusBarColor = {.1, .1, .1, .8},
}
platerInternal.Comms = {}
platerInternal.Frames = {}
platerInternal.Data = {}
--> namespaces:
--resources
Plater.Resources = {}
Plater.Auras = {}
--store npcIds for npcs which flood the screen with nameplates and can be quickly processed
--search .isPerformanceUnit for locations where there code for improve performance
--unitFrame.isPerformanceUnit healthBar.isPerformanceUnit
Plater.PerformanceUnits = {
--[189706] = true, --chaotic essence (shadowlands season 4 raid affixes) --this is only one single orb which casts. no need for performance
[189707] = true, --chaotic essence (shadowlands season 4 raid affixes) --these are the multiple spawns from the above
[167999] = true, --Echo of Sin (shadowlands, Castle Nathria, Sire Denathrius)
[176920] = true, --Domination Arrow (shadowlands, Sanctum of Domination, Sylvanas)
[196642] = true, --Hungry Lasher (dragonflight, Algeth'ar Academy, Overgrown Ancient)
}
--setter
Plater.AddPerformanceUnits = function (npcID)
if type(npcID) == "number" then
Plater.PerformanceUnits[npcID] = true
end
end
Plater.RemovePerformanceUnits = function (npcID)
if type(npcID) == "number" then
Plater.PerformanceUnits[npcID] = nil
end
end
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
--all functions below can be overridden by scripts, hooks or any external code
--this allows the user to fully modify Plater at a high level
--how to override a function:
--create a script in the hooking tab, add a 'Constructor' and a 'Nameplate Created'
--copy the entire function from this file and paste in the constructor, hit save.
--then when the first nameplate appears in the screen the function get rewritten
--for fast debugging is recomended to paste the function in a 'Nameplate Updated' hook so just by saving the script (SHIFT + ENTER) you get the function to update immediately.
Plater.CanOverride_Functions = {
RefreshDBUpvalues = true, --refresh cache
RefreshDBLists = true, --refresh cache
UpdateAuraCache = true, --refresh cache
CreateShowAuraIconAnimation = true, --creates the animation for aura icons played when they are shown
GetHealthCutoffValue = true, --check if the character has a execute range and enable or disable the health cut off indicators
CheckRange = true, --check if the player is in range of the unit
GetSpellForRangeCheck = true, --get a spell to be used in the range check
SetFontOutlineAndShadow = true, --apply the outline and shadow of a text
UpdatePersonalBar = true, --update the personal bar
UpdateResourceFrame = true, --anchors the resource frame (soul shards, combo points, etc)
UpdateCastbarTargetText = true, --update the settings of the cast target (font color, size, etc)
UpdateSpellNameSize = true, --receive a fontString and set the length of the spell name size in the cast bar
QuickHealthUpdate = true, --update the health bar during NAMEPLATE_ADDED
OnUpdateHealth = true, --when the healthbar get a new health value
OnUpdateHealthMax = true, --when the maxhealth of the healthbar get updated
UpdateIconAspecRatio = true, --adjust the icon texcoords depending on its size
FormatTime = true, --get a number and return it formated into time, e.g. 63 return "1m" 1 minute
FormatTimeDecimal = true, --get a number and return it formated into time with decimals below 10sec, e.g. 9.5 return "9.5s"
GetAuraIcon = true, --return an icon to be use to show an aura
AddAura = true, --adds an aura into the nameplate, require all the aura data and an icon
AddExtraIcon = true, --adds an aura into the extra buff row of icons, require the aura data
HideNonUsedAuraIcons = true, --after an aura refresh, hide all non used icons in the aura container
ResetAuraContainer = true, --reset the aura container to be ready to a refresh
TrackSpecificAuras = true, --refresh the aura container using a list of auras to track
UpdateAuras_Manual = true, --start an aura refresh for manual aura tracking
UpdateAuras_Automatic = true, --start an aura refresh for automatic aura tracking
UpdateAuras_Self_Automatic = true, --start an aura refresh on the personal bar nameplate
ColorOverrider = true, --control which color que nameplate will have when the Override Default Colors are enabled
FindAndSetNameplateColor = true, --Plater tries to find a color for the nameplate
SetTextColorByClass = true, --adds the class color into a text with scape sequence
UpdatePlateSize = true, --control the size of health, cast, power bars
SetPlateBackground = true, --set the backdrop when showing the nameplate area
UpdateNameplateThread = true, --change the nameplate color based on threat
UpdateTargetHighlight = true, --adjust the highlight on the player target nameplate
UpdateTargetIndicator = true, --adjust the target indicator on the player target nameplate
UpdateLifePercentVisibility = true, --control when the life percent text is shown
UpdateLifePercentText = true, --update the health shown in the nameplate
AddGuildNameToPlayerName = true, --adds the guild name into the player name
UpdateUnitName = true, --update the unit name
UpdateUnitNameTextSize = true, --controls the length of the unit name text
UpdateBorderColor = true, --update the color of the border
UpdatePlateBorderThickness = true, --adjust how thick is the border around the health bar
UpdatePlateRaidMarker = true, --update the raid marker in the nameplate
UpdateIndicators = true, --check which indicators will be shown in the nameplate (rare, elite, etc)
AddIndicator = true, --adds an indicator
ClearIndicators = true, --clear all indicators in the nameplate
GetPlateAlpha = true, --get the absolute alpha amount for the nameplate (when in range)
CheckHighlight = true, --check if the mouse is over the nameplate and show the highlight
EnableHighlight = true, --enable the highlight check
DisableHighlight = true, --disable the highlight check
GetUnitType = true, --return if an unit is a pet, minor or regular
AnimateLeftWithAccel = true, --move the health bar to left when health animation is enabled
AnimateRightWithAccel = true, --move the health bar to right when health animation is enabled
IsQuestObjective = true, --check if the npc from the nameplate is a quest mob
}
--store functions and members which can be overridden by scripts
Plater.CanOverride_Members = {
TargetIndicators = true, --table with all options for target indicators
TargetHighlights = true, --table with all options for target highlight
SparkTextures = true, --table with all textures available for castbar sparks
CooldownEdgeTextures = true, --table with all textures available for cooldown edges
AurasHorizontalPadding = true, --space in pixels between each row of buffs
WideIconCoords = true, --used on buff special icons, are the texcoordinates when using wide icons
BorderLessIconCoords = true, --used on buff special icons, when not using wide icons
PlayerIsTank = true, --for aggro checks, if true the function will consider the player as tank
CombatTime = true, --GetTime() of when the player entered in combat, affect aggro animations
CurrentEncounterID = true, --store the current encounter ID if in combat and fighiting a boss
LatestEncounter = true, --store time() from the latest ENCOUNTER_END
ZoneInstanceType = true, --from GetInstanceInfo zone type, can be party, raid, arena, pvp, none
ZonePvpType = true, --from GetZonePVPInfo
PlayerGuildName = true, --name of the player's guild
SpellForRangeCheck = true, --spell name used for range check
PlayerGUID = true, --store the GUID of the player
PlayerClass = true, --store the name for the player (non localized)
}
--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 = {},
}
--store spell cache. spell cache is loaded when adding new auras to track
Plater.SpellHashTable = {}
Plater.SpellIndexTable = {}
--> export strings identification
Plater.Export_CastColors = "CastColor"
Plater.Export_NpcColors = "NpcColor"
--> types of codes for each script in the Scripting tab (do not change these inside scripts)
Plater.CodeTypeNames = { --private
[1] = "UpdateCode",
[2] = "ConstructorCode",
[3] = "OnHideCode",
[4] = "OnShowCode",
[5] = "Initialization",
}
--hook options
--> types of codes available to add in a script in the Hooking tab
Plater.HookScripts = { --private
"Initialization",
"Deinitialization",
"Constructor",
"Destructor",
"Nameplate Created",
"Nameplate Added",
"Nameplate Removed",
"Nameplate Updated",
"Cast Start",
"Cast Update",
"Cast Stop",
"Target Changed",
"Raid Target",
"Enter Combat",
"Leave Combat",
"Player Power Update",
"Player Talent Update",
"Health Update",
"Zone Changed",
"Name Updated",
"Load Screen",
"Player Logon",
"Receive Comm Message",
"Send Comm Message",
}
Plater.HookScriptsDesc = { --private
["Initialization"] = "Executed once for the mod every time it is loaded or compiled. Used to initialize the global mod environment 'modTable'.",
["Deinitialization"] = "Executed once for the mod every time it is unloaded. Used to de-initialize the global mod environment 'modTable' and the mod.",
["Constructor"] = "Executed once when the nameplate run the hook for the first time.\n\nUse to initialize configs in the environment.\n\nAlways receive unitFrame in 'self' parameter.",
["Destructor"] = "Run when the hook is Disabled or unloaded due to Load Conditions.\n\nUse to hide all frames created.\n\n|cFF44FF44Run on all nameplates shown in the screen|r.",
["Nameplate Created"] = "Executed when a nameplate is created.\n\nRequires a |cFFFFFF22/reload|r after changing the code.",
["Nameplate Added"] = "Run after a nameplate is added to the screen.",
["Nameplate Removed"] = "Run when the nameplate is removed from the screen.",
["Nameplate Updated"] = "Run after the nameplate gets an updated from Plater.\n\n|cFFFFFF22Important:|r doesn't run every frame.",
["Cast Start"] = "When the unit starts to cast a spell.\n\n|cFFFFFF22self|r is unitFrame.castBar",
["Cast Update"] = "When the cast bar receives an update from Plater.\n\n|cFFFFFF22Important:|r doesn't run every frame.\n\n|cFFFFFF22self|r is unitFrame.castBar",
["Cast Stop"] = "When the cast is finished for any reason or the nameplate has been removed from the screen.\n\n|cFFFFFF22self|r is unitFrame.castBar",
["Target Changed"] = "Run after the player selects a new target.\n\n|cFF44FF44Run on all nameplates shown in the screen|r.",
["Raid Target"] = "A raid target mark has added, modified or removed (skull, cross, etc).\n\n|cFF44FF44Run on all nameplates shown in the screen|r.",
["Enter Combat"] = "Executed shortly after the player enter combat.\n\n|cFF44FF44Run on all nameplates shown in the screen|r.",
["Leave Combat"] = "Executed shortly after the player leave combat.\n\n|cFF44FF44Run on all nameplates shown in the screen|r.",
["Player Power Update"] = "Run when the player power, such as combo points, gets an update.\n\n|cFF44FF44Run only on the nameplate of your current target|r.",
["Player Talent Update"] = "When the player changes a talent or specialization.\n\n|cFF44FF44Run on all nameplates shown in the screen|r.",
["Health Update"] = "When the health of the unit changes.",
["Zone Changed"] = "Run when the player enter into a new zone.\n\n|cFF44FF44Run on all nameplates already created, on screen or not|r.",
["Name Updated"] = "Executed when the name of the unit shown in the nameplate receives an update.",
["Load Screen"] = "Run when a load screen finishes.\n\nUse to change settings for a specific area or map.\n\n|cFF44FF44Do not run on nameplates|r.",
["Player Logon"] = "Run when the player login into the game.\n\nUse to register textures, indicators, etc.\n\n|cFF44FF44Do not run on nameplates,\nrun only once after login\nor /reload|r.",
["Receive Comm Message"] = "Executed when a comm is received, a comm can be sent using Plater.SendComm(payload) in 'Send Comm Message' hook.",
["Send Comm Message"] = "Executed on an internal timer for each mod. Used to send comm data via Plater.SendComm(payload).",
}
-- ~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_NAMEPLATE_DESTRUCTOR = {ScriptAmount = 0}
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>"
--> addon comm
Plater.COMM_PLATER_PREFIX = "PLT"
Plater.COMM_SCRIPT_GROUP_EXPORTED = "GE"
Plater.COMM_SCRIPT_MSG = "PLTM"
Plater.COMM_NPC_NAME_EXPORTED = "NN"
Plater.COMM_NPC_COLOR_EXPORTED = "NC"
Plater.COMM_NPC_OR_CAST_CUSTOMIZATION = "NCC"
--> cvars just to make them easier to read
local CVAR_ENABLED = "1"
local CVAR_DISABLED = "0"
--> unit reaction (saved 3 global locals)
Plater.UnitReaction = {
UNITREACTION_HOSTILE = 3,
UNITREACTION_NEUTRAL = 4,
UNITREACTION_FRIENDLY = 5,
}
--> 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"
--these tables store all bars created by boss mods
Plater.BossModsTimeBarDBM = {}
Plater.BossModsTimeBarBW = {}
--> icon texcoords
Plater.WideIconCoords = {.1, .9, .1, .6} --used in extra icons frame, constant, can be changed with scripts
Plater.BorderLessIconCoords = {.1, .9, .1, .9} --used in extra icons frame,constant, can be changed with scripts
--note: regular icons has their texcoords automatically adjusted
--> limit the cast bar text to this (this is dynamically adjusted at run time)
Plater.MaxCastBarTextLength = nil -- global overwrite
--> auras
Plater.MaxAurasPerRow = 10 --can change during runtime
--> textures used in the cooldown animation, scripts can add more values to it, profile holds only the path to it
Plater.CooldownEdgeTextures = {
[[Interface\AddOns\Plater\images\cooldown_edge_1]],
[[Interface\AddOns\Plater\images\cooldown_edge_2]],
"Interface\\Cooldown\\edge",
"Interface\\Cooldown\\edge-LoC",
"Interface\\GLUES\\loadingOld",
}
--> textures used in the castbar, scripts can add more values to it, profile holds only the path to it
Plater.SparkTextures = {
[[Interface\AddOns\Plater\images\spark1]],
[[Interface\AddOns\Plater\images\spark2]],
[[Interface\AddOns\Plater\images\spark3]],
[[Interface\AddOns\Plater\images\spark4]],
[[Interface\AddOns\Plater\images\spark5]],
[[Interface\AddOns\Plater\images\spark6]],
[[Interface\AddOns\Plater\images\spark7]],
[[Interface\AddOns\Plater\images\spark8]],
}
--> textures used to indicate which nameplate is the current target, scripts can add more values to it, profile holds only the path to it
Plater.TargetHighlights = {
[[Interface\AddOns\Plater\images\selection_indicator1]],
[[Interface\AddOns\Plater\images\selection_indicator2]],
[[Interface\AddOns\Plater\images\selection_indicator3]],
[[Interface\AddOns\Plater\images\selection_indicator4]],
[[Interface\AddOns\Plater\images\selection_indicator5]],
[[Interface\AddOns\Plater\images\selection_indicator6]],
[[Interface\AddOns\Plater\images\selection_indicator7]],
[[Interface\AddOns\Plater\images\selection_indicator8]],
}
--> icons available for any purpose
Plater.Media = {
Icons = {
[[Interface\AddOns\Plater\media\arrow_apple_64]],
[[Interface\AddOns\Plater\media\arrow_double_right_64]],
[[Interface\AddOns\Plater\media\arrow_right_64]],
[[Interface\AddOns\Plater\media\arrow_simple_right_64]],
[[Interface\AddOns\Plater\media\arrow_single_right_64]],
[[Interface\AddOns\Plater\media\arrow_thin_right_64]],
[[Interface\AddOns\Plater\media\blocked_center_64]],
[[Interface\AddOns\Plater\media\crown_64]],
[[Interface\AddOns\Plater\media\drop_64]],
[[Interface\AddOns\Plater\media\duck_64]],
[[Interface\AddOns\Plater\media\exclamation_64]],
[[Interface\AddOns\Plater\media\exclamation2_64]],
[[Interface\AddOns\Plater\media\fire_64]],
[[Interface\AddOns\Plater\media\glasses_64]],
[[Interface\AddOns\Plater\media\glow_horizontal_256]],
[[Interface\AddOns\Plater\media\glow_radial_128]],
[[Interface\AddOns\Plater\media\glow_square_64]],
[[Interface\AddOns\Plater\media\hat_64]],
[[Interface\AddOns\Plater\media\heart_center_64]],
[[Interface\AddOns\Plater\media\line_horizontal_256]],
[[Interface\AddOns\Plater\media\line_vertical_256]],
[[Interface\AddOns\Plater\media\radio_64]],
[[Interface\AddOns\Plater\media\skullbones_64]],
[[Interface\AddOns\Plater\media\stop_64]],
[[Interface\AddOns\Plater\media\star_empty_64]],
[[Interface\AddOns\Plater\media\star_full_64]],
[[Interface\AddOns\Plater\media\x_64]],
[[Interface\AddOns\Plater\media\checked_64]],
[[Interface\AddOns\Plater\media\sphere_full_64]],
[[Interface\AddOns\Plater\media\eye_64]],
[[Interface\AddOns\Plater\media\cross_64]],
},
}
--> these are the images shown in the nameplate of the current target, they are placed in the left and right side of the health bar, scripts can add more options
--> if the coords has 2 tables, it uses two textures attach in the left and right sides of the health bar
--> if the coords has 4 tables, it uses 4 textures attached in top left, bottom left, top right and bottom right corners
Plater.TargetIndicators = {
["NONE"] = {
path = [[Interface\ACHIEVEMENTFRAME\UI-Achievement-WoodBorder-Corner]],
coords = {{.9, 1, .9, 1}, {.9, 1, .9, 1}, {.9, 1, .9, 1}, {.9, 1, .9, 1}}, --texcoords, support 4 or 8 coords method
desaturated = false,
width = 10,
height = 10,
x = 1, --offset
y = 1, --offset
},
["Magneto"] = {
path = [[Interface\Artifacts\RelicIconFrame]],
coords = {{0, .5, 0, .5}, {0, .5, .5, 1}, {.5, 1, .5, 1}, {.5, 1, 0, .5}},
desaturated = false,
width = 8,
height = 10,
autoScale = true,
--scale = 1,
x = 2,
y = 2,
},
["Gray Bold"] = {
path = [[Interface\ContainerFrame\UI-Icon-QuestBorder]],
coords = {{0, .5, 0, .5}, {0, .5, .5, 1}, {.5, 1, .5, 1}, {.5, 1, 0, .5}},
desaturated = true,
width = 10,
height = 10,
autoScale = true,
--scale = 1,
x = 2,
y = 2,
},
["Pins"] = {
path = [[Interface\ITEMSOCKETINGFRAME\UI-ItemSockets]],
coords = {{145/256, 161/256, 3/256, 19/256}, {145/256, 161/256, 19/256, 3/256}, {161/256, 145/256, 19/256, 3/256}, {161/256, 145/256, 3/256, 19/256}},
desaturated = 1,
width = 4,
height = 4,
autoScale = false,
--scale = 1,
x = 2,
y = 2,
},
["Silver"] = {
path = [[Interface\PETBATTLES\PETBATTLEHUD]],
coords = {
{848/1024, 868/1024, 454/512, 474/512},
{848/1024, 868/1024, 474/512, 495/512},
{868/1024, 889/1024, 474/512, 495/512},
{868/1024, 889/1024, 454/512, 474/512}
}, --848 889 454 495
desaturated = false,
width = 6,
height = 6,
autoScale = true,
--scale = 1,
x = 1,
y = 1,
},
["Ornament"] = {
path = [[Interface\PETBATTLES\PETJOURNAL]],
coords = {
{124/512, 161/512, 71/1024, 99/1024},
{119/512, 156/512, 29/1024, 57/1024}
},
desaturated = false,
width = 18,
height = 12,
wscale = 1,
hscale = 1.2,
autoScale = true,
--scale = 1,
x = 14,
y = 0,
},
["Golden"] = {
path = [[Interface\Artifacts\Artifacts]],
coords = {
{137/1024, (137+29)/1024, 920/1024, 978/1024},
{(137+30)/1024, 195/1024, 920/1024, 978/1024},
},
desaturated = false,
width = 8,
height = 12,
wscale = 1,
hscale = 1.2,
autoScale = true,
--scale = 1,
x = 0,
y = 0,
},
["Ornament Gray"] = {
path = [[Interface\Challenges\challenges-besttime-bg]],
coords = {
{89/512, 123/512, 0, 1},
{123/512, 89/512, 0, 1},
},
desaturated = false,
width = 8,
height = 12,
alpha = 0.7,
wscale = 1,
hscale = 1.2,
autoScale = true,
--scale = 1,
x = 0,
y = 0,
color = "red",
},
["Epic"] = {
path = [[Interface\UNITPOWERBARALT\WowUI_Horizontal_Frame]],
coords = {
{30/256, 40/256, 15/64, 49/64},
{40/256, 30/256, 15/64, 49/64},
},
desaturated = false,
width = 6,
height = 12,
wscale = 1,
hscale = 1.2,
autoScale = true,
--scale = 1,
x = 3,
y = 0,
blend = "ADD",
},
["Arrow"] = {
path = [[Interface\AddOns\Plater\media\arrow_single_right_64]],
coords = {
{0, 1, 0, 1},
{1, 0, 0, 1}
},
desaturated = false,
width = 20,
height = 20,
x = 28,
y = 0,
wscale = 1.5,
hscale = 2,
autoScale = true,
--scale = 1,
blend = "ADD",
color = "white",
},
["Arrow Thin"] = {
path = [[Interface\AddOns\Plater\media\arrow_thin_right_64]],
coords = {
{0, 1, 0, 1},
{1, 0, 0, 1}
},
desaturated = false,
width = 20,
height = 20,
x = 28,
y = 0,
wscale = 1.5,
hscale = 2,
autoScale = true,
--scale = 1,
blend = "ADD",
color = "white",
},
["Double Arrows"] = {
path = [[Interface\AddOns\Plater\media\arrow_double_right_64]],
coords = {
{0, 1, 0, 1},
{1, 0, 0, 1}
},
desaturated = false,
width = 20,
height = 20,
x = 28,
y = 0,
wscale = 1.5,
hscale = 2,
autoScale = true,
--scale = 1,
blend = "ADD",
color = "white",
},
}
--> which specs each class has available
Plater.SpecList = { --private
["DEMONHUNTER"] = {
[577] = true,
[581] = true,
},
["DEATHKNIGHT"] = {
[250] = true,
[251] = true,
[252] = true,
},
["WARRIOR"] = {
[71] = true,
[72] = true,
[73] = true,
},
["MAGE"] = {
[62] = true,
[63] = true,
[64] = true,
},
["ROGUE"] = {
[259] = true,
[260] = true,
[261] = true,
},
["DRUID"] = {
[102] = true,
[103] = true,
[104] = true,
[105] = true,
},
["HUNTER"] = {
[253] = true,
[254] = true,
[255] = true,
},
["SHAMAN"] = {
[262] = true,
[263] = true,
[264] = true,
},
["PRIEST"] = {
[256] = true,
[257] = true,
[258] = true,
},
["WARLOCK"] = {
[265] = true,
[266] = true,
[267] = true,
},
["PALADIN"] = {
[65] = true,
[66] = true,
[70] = true,
},
["MONK"] = {
[268] = true,
[269] = true,
[270] = true,
},
["EVOKER"] = {
[1467] = true,
[1468] = true,
},
}
--> default ranges to use in the range check proccess against enemies, player can select a different range in the options panel
Plater.DefaultSpellRangeList = {
--classes
[1] = 10, --Warrior
[2] = 30, --Paladin
[3] = 30, --Hunter
[4] = 10, --Rogue
[5] = 30, --Priest
[6] = 10, --DeathKnight
[7] = 30, --Shaman
[8] = 30, --Mage
[9] = 30, --Warlock
[10] = 10, --Monk
[11] = 30, --Druid
[12] = 10, --DH
[577] = 30, --> havoc demon hunter
[581] = 30, --> vengeance demon hunter
[250] = 30, --> blood dk
[251] = 30, --> frost dk
[252] = 30, --> unholy dk
[102] = 45, --> druid balance
[103] = 40, --> druid feral
[104] = 30, --> druid guardian
[105] = 40, --> druid resto
[253] = 40, --> hunter bm - Cobra Shot
[254] = 40, --> hunter marks - Aimed Shot
[255] = 40, --> hunter survivor - Serpent Sting
[62] = 40, --> mage arcane
[63] = 40, --> mage fire
[64] = 40, --> mage frost
[268] = 30 , --> monk bm
[269] = 40, --> monk ww
[270] = 40, --> monk mw
[65] = 40, --> paladin holy
[66] = 30, --> paladin protect
[70] = 30, --> paladin ret
[256] = 40, --> priest disc
[257] = 40, --> priest holy
[258] = 40, --> priest shadow
[259] = 30, --> rogue assassination
[260] = 20, --> rogue outlaw
[261] = 30, --> rogue sub
[262] = 40, --> shaman elemental
[263] = 40, --> shaman enhancement
[264] = 40, --> shaman resto
[265] = 40, --> warlock aff
[266] = 40, --> warlock demo
[267] = 40, --> warlock destro
[71] = 30, --> warrior arms
[72] = 30, --> warrior fury
[73] = 30, --> warrior protect
[1467] = 25, --> evoker devastation
[1468] = 25, --> evoker preservation
-- low-level (without spec)
[1444] = 40, --> Initial SHAMAN
[1446] = 40, --> Initial WARRIOR
[1447] = 40, --> Initial DRUID
[1448] = 40, --> Initial HUNTER
[1449] = 40, --> Initial MAGE
[1450] = 40, --> Initial MONK
[1451] = 40, --> Initial PALADIN
[1452] = 40, --> Initial PRIEST
[1453] = 40, --> Initial ROGUE
[1454] = 40, --> Initial WARLOCK
[1455] = 40, --> Initial DK
[1456] = 40, --> Initial DH
}
--> default ranges to use in the range check proccess against friendlies, player can select a different range in the options panel
Plater.DefaultSpellRangeListF = {
--classes
[1] = 30, --Warrior
[2] = 40, --Paladin
[3] = 40, --Hunter
[4] = 30, --Rogue
[5] = 40, --Priest
[6] = 30, --DeathKnight
[7] = 40, --Shaman
[8] = 40, --Mage
[9] = 40, --Warlock
[10] = 40, --Monk
[11] = 40, --Druid
[12] = 30, --DH
[577] = 30, --> havoc demon hunter
[581] = 30, --> vengeance demon hunter
[250] = 30, --> blood dk
[251] = 30, --> frost dk
[252] = 30, --> unholy dk
[102] = 45, --> druid balance
[103] = 40, --> druid feral
[104] = 30, --> druid guardian
[105] = 40, --> druid resto
[253] = 40, --> hunter bm - Cobra Shot
[254] = 40, --> hunter marks - Aimed Shot
[255] = 40, --> hunter survivor - Serpent Sting
[62] = 40, --> mage arcane
[63] = 40, --> mage fire
[64] = 40, --> mage frost
[268] = 30 , --> monk bm
[269] = 40, --> monk ww
[270] = 40, --> monk mw
[65] = 40, --> paladin holy
[66] = 30, --> paladin protect
[70] = 30, --> paladin ret
[256] = 40, --> priest disc
[257] = 40, --> priest holy
[258] = 40, --> priest shadow
[259] = 30, --> rogue assassination
[260] = 20, --> rogue outlaw
[261] = 30, --> rogue sub
[262] = 40, --> shaman elemental
[263] = 40, --> shaman enhancement
[264] = 40, --> shaman resto
[265] = 40, --> warlock aff
[266] = 40, --> warlock demo
[267] = 40, --> warlock destro
[71] = 30, --> warrior arms
[72] = 30, --> warrior fury
[73] = 30, --> warrior protect
[1467] = 25, --> evoker devastation
[1468] = 25, --> evoker preservation
-- low-level (without spec)
[1444] = 40, --> Initial SHAMAN
[1446] = 40, --> Initial WARRIOR
[1447] = 40, --> Initial DRUID
[1448] = 40, --> Initial HUNTER
[1449] = 40, --> Initial MAGE
[1450] = 40, --> Initial MONK
[1451] = 40, --> Initial PALADIN
[1452] = 40, --> Initial PRIEST
[1453] = 40, --> Initial ROGUE
[1454] = 40, --> Initial WARLOCK
[1455] = 40, --> Initial DK
[1456] = 40, --> Initial DH
}
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
}
Plater.AnchorNames = {
LOC["OPTIONS_ANCHOR_TOPLEFT"],