Repository navigation
Expand file tree
/
Copy pathEllesmereUI.lua
More file actions
4661 lines (4358 loc) · 225 KB
/
Copy pathEllesmereUI.lua
File metadata and controls
4661 lines (4358 loc) · 225 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
if EUI_CLIENT_BLOCKED then return end -- pre-12.1 client failsafe (EllesmereUI_ClientGate.lua)
-------------------------------------------------------------------------------
-- EllesmereUI.lua - Custom Options Panel, shared across the whole EUI suite.
-- Scaffold: background, sidebar, header, content area, controls.
-------------------------------------------------------------------------------
-- EUI_NS is this addon's private namespace (the TOC vararg): shared by the core
-- files, unreachable from any other addon. Navigation state that must not be
-- writable by third-party code (module registry, sidebar model, page cache)
-- lives here instead of on the global EllesmereUI table.
local EUI_HOST_ADDON, EUI_NS = ...
-- Build renames "EllesmereUI" -> "EUICoreStandalone<Module>" but never the word
-- "Standalone", so host name contains it iff standalone; false in the suite (branches inert).
local IS_STANDALONE = type(EUI_HOST_ADDON) == "string" and EUI_HOST_ADDON:find("Standalone") ~= nil
-- A standalone build is ONE addon: its module files share this vararg table
-- and publish it through _ModuleNS. So there the core's private state lives in
-- a table of its own, handed to the later core files through __euiCoreNS until
-- the first module publish removes that slot (see _ModuleNS).
if IS_STANDALONE then
local shared = EUI_NS
EUI_NS = {}
shared.__euiCoreNS = EUI_NS
end
-------------------------------------------------------------------------------
-- Constants & Colours (BURNE STAY AWAY FROM THIS SECTION)
-------------------------------------------------------------------------------
-- Visual Settings (edit these to adjust the look -- values only, no tables)
-------------------------------------------------------------------------------
-- Accent colour -- canonical default: #0CD29D teal. The Forever client opens
-- on #DCA77F (soft bronze) instead; a chosen accent always wins over this.
local DEFAULT_ACCENT_R, DEFAULT_ACCENT_G, DEFAULT_ACCENT_B = 12/255, 210/255, 157/255
if EUI_CLIENT_FOREVER == true then
DEFAULT_ACCENT_R, DEFAULT_ACCENT_G, DEFAULT_ACCENT_B = 220/255, 167/255, 127/255
end
-- Theme presets: { accentR, accentG, accentB, bgFile }
-- bgFile is relative to MEDIA_PATH (resolved later after MEDIA_PATH is defined)
local THEME_PRESETS = {
["EllesmereUI"] = { r = 12/255, g = 210/255, b = 157/255 }, -- #0CD29D
["EllesmereUI Original"] = { r = 12/255, g = 210/255, b = 157/255 }, -- #0CD29D
["EllesmereUI Forever"] = { r = 220/255, g = 167/255, b = 127/255 }, -- #DCA77F soft bronze
["Horde"] = { r = 255/255, g = 90/255, b = 31/255 }, -- #FF5A1F
["Alliance"] = { r = 63/255, g = 167/255, b = 255/255 }, -- #3FA7FF
["Faction (Auto)"] = nil, -- resolved at runtime to Horde or Alliance
["Midnight"] = { r = 120/255, g = 65/255, b = 200/255 }, -- #7841C8 deep purple void
["Dark"] = { r = 1, g = 1, b = 1 }, -- white accent
["Pixels"] = { r = 1, g = 1, b = 1 }, -- white accent
["Class Colored"] = nil, -- resolved at runtime from player class
["Custom Color"] = nil, -- user-chosen via color picker
}
local THEME_ORDER = { "EllesmereUI", "EllesmereUI Original", "EllesmereUI Forever", "Horde", "Alliance", "Faction (Auto)", "Midnight", "Dark", "Pixels", "Class Colored", "Custom Color" }
-- The theme in force when none was chosen: the Forever client opens on its own
-- backdrop, every other client on the house one. A chosen theme always wins.
EllesmereUI.DEFAULT_THEME = (EUI_CLIENT_FOREVER == true) and "EllesmereUI Forever" or "EllesmereUI"
-- Background file paths per theme (relative to MEDIA_PATH, in backgrounds/ subfolder)
local THEME_BG_FILES = {
["EllesmereUI"] = "backgrounds\\eui-bg-new.png",
["EllesmereUI Original"] = "backgrounds\\eui-bg-old.png",
["EllesmereUI Forever"] = "backgrounds\\eui-bg-forever-compressed.png",
["Horde"] = "backgrounds\\eui-bg-horde-compressed.png",
["Alliance"] = "backgrounds\\eui-bg-alliance-compressed.png",
["Midnight"] = "backgrounds\\eui-bg-midnight-compressed.png",
["Dark"] = "backgrounds\\eui-bg-dark-compressed.png",
["Pixels"] = "backgrounds\\eui-bg-pixels-compressed.png",
["Class Colored"] = "backgrounds\\eui-bg-old.png",
["Custom Color"] = "backgrounds\\eui-bg-old.png",
}
-- Theme art kept out of the file-load VRAM preload below (fields: the main chunk
-- sits at its local cap). It loads on its first pick (the crossfade starts the new
-- layer at alpha 0, so nothing flashes), or at PLAYER_LOGIN for the player whose
-- saved theme it is (EllesmereUI._PreloadLazyThemeBG).
EllesmereUI._THEME_BG_LAZY = { ["Pixels"] = true }
-- Accent overlay per theme: its accent-coloured pieces (logo mark, rules, close X)
-- as white art, cropped to their band of the 1500x1154 canvas (x, y = top-left
-- offset; w, h = size, all in canvas units). Drawn above the theme art and tinted
-- with the live UI accent; built on the theme's first apply (CreateMainFrame).
EllesmereUI.THEME_ACCENT_OVERLAYS = {
["Pixels"] = { file = "backgrounds\\eui-bg-pixels-accent.png", x = 102, y = 127, w = 1295, h = 110 },
}
-- The close box painted into each theme art file, in canvas units: x, y, w, h =
-- tight rect around its border; bx, by, bw, bh = outer rect of the border line
-- itself and bd = its depth (the hover glow lights only that ring); gx, gy =
-- centre of its X; gs = glyph size drawn over a copy (16 when absent); r, g, b =
-- the X colour; sh = alpha of the dark rim under a glyph; acc = alpha of a
-- live-accent glyph stacked on top (art whose X comes from its accent overlay);
-- ex, ey = top-left of the 76 unit square around the painted logo emblem; rr, rg,
-- rb = the logo badge ring colour. The collapse button and the collapsed mini
-- window rebuild their boxes and badge from these rects of the art on screen.
EllesmereUI.THEME_CLOSE_BOX = {
["backgrounds\\eui-bg-new.png"] = { x = 1346, y = 114, w = 43, h = 41, gx = 1368, gy = 134,
bx = 1348, by = 116, bw = 40, bh = 38, bd = 3,
r = 0.894, g = 0.788, b = 0.617, sh = 0.5, ex = 119, ey = 110, rr = 0.417, rg = 0.311, rb = 0.231 },
["backgrounds\\eui-bg-forever-compressed.png"] = { x = 1346, y = 114, w = 43, h = 41, gx = 1368, gy = 134,
bx = 1348, by = 116, bw = 40, bh = 38, bd = 3,
r = 0.894, g = 0.788, b = 0.617, sh = 0.5, ex = 122, ey = 109, rr = 0.417, rg = 0.311, rb = 0.231 },
["backgrounds\\eui-bg-old.png"] = { x = 1347, y = 117, w = 40, h = 39, gx = 1367, gy = 136,
bx = 1348, by = 118, bw = 38, bh = 37, bd = 2,
r = 0.685, g = 0.719, b = 0.715, sh = 0.5, ex = 118, ey = 110, rr = 0.324, rg = 0.345, rb = 0.363 },
["backgrounds\\eui-bg-midnight-compressed.png"] = { x = 1347, y = 117, w = 40, h = 39, gx = 1367, gy = 136,
bx = 1348, by = 118, bw = 38, bh = 37, bd = 2,
r = 0.738, g = 0.617, b = 0.834, sh = 0.5, ex = 118, ey = 110, rr = 0.335, rg = 0.296, rb = 0.440 },
["backgrounds\\eui-bg-dark-compressed.png"] = { x = 1347, y = 117, w = 40, h = 39, gx = 1367, gy = 136,
bx = 1348, by = 118, bw = 38, bh = 37, bd = 2,
r = 0.502, g = 0.502, b = 0.502, sh = 0.5, ex = 118, ey = 110, rr = 0.258, rg = 0.258, rb = 0.258 },
["backgrounds\\eui-bg-horde-compressed.png"] = { x = 1348, y = 116, w = 39, h = 40, gx = 1367, gy = 135,
bx = 1349, by = 117, bw = 37, bh = 38, bd = 2, gs = 20,
r = 0.467, g = 0.357, b = 0.323, sh = 0, ex = 118, ey = 110, rr = 0.354, rg = 0.225, rb = 0.182 },
["backgrounds\\eui-bg-alliance-compressed.png"] = { x = 1345, y = 115, w = 43, h = 43, gx = 1367, gy = 136,
bx = 1347, by = 117, bw = 39, bh = 39, bd = 2, gs = 18,
r = 1, g = 1, b = 1, sh = 0.5, ex = 118, ey = 110, rr = 0.323, rg = 0.377, rb = 0.483 },
["backgrounds\\eui-bg-pixels-compressed.png"] = { x = 1344, y = 115, w = 43, h = 42, gx = 1366, gy = 136,
bx = 1346, by = 117, bw = 39, bh = 38, bd = 3, gs = 18,
r = 0.604, g = 0.608, b = 0.604, sh = 0.9, acc = 0.70, ex = 105, ey = 110, rr = 0.371, rg = 0.363, rb = 0.374 },
}
--- Resolve "Faction (Auto)" to Horde/Alliance by player faction; other themes unchanged.
local function ResolveFactionTheme(theme)
if theme == "Faction (Auto)" then
local faction = UnitFactionGroup("player")
return (faction == "Horde") and "Horde" or "Alliance"
end
return theme
end
-- Hidden 1x1 frame preloads bg textures into VRAM: no 1-frame bg flash on first open.
do
local mp = "Interface\\AddOns\\EllesmereUI\\media\\"
local preload = CreateFrame("Frame")
preload:SetSize(1, 1)
preload:SetPoint("TOPLEFT", UIParent, "TOPLEFT", -10000, 10000)
preload:Show()
local lazy = EllesmereUI._THEME_BG_LAZY
for theme, file in pairs(THEME_BG_FILES) do
if not lazy[theme] then
local tex = preload:CreateTexture()
tex:SetTexture(mp .. file)
tex:SetAllPoints()
end
end
local baseTex = preload:CreateTexture()
baseTex:SetTexture(mp .. "backgrounds\\eui-bg.png")
baseTex:SetAllPoints()
-- The saved theme is known only once SavedVariables load, so the PLAYER_LOGIN
-- theme block calls this (once): a lazy theme's own player then opens the
-- panel with its art, and its accent overlay, already resident.
function EllesmereUI._PreloadLazyThemeBG(theme)
if not lazy[theme] then return end
local tex = preload:CreateTexture()
tex:SetTexture(mp .. THEME_BG_FILES[theme])
tex:SetAllPoints()
local ov = EllesmereUI.THEME_ACCENT_OVERLAYS[theme]
if ov then
local ovTex = preload:CreateTexture()
ovTex:SetTexture(mp .. ov.file)
ovTex:SetAllPoints()
end
end
end
-- EllesmereUIDB arrives from SavedVariables at ADDON_LOADED. Do NOT create it here --
-- that overwrites saved data. (Stale child SV copy guard lives in EllesmereUI_Lite.lua.)
-- Widget style constants, one table instead of ~75 file-scope locals, which
-- would push this main chunk past Lua 5.1's 200-active-locals limit. Read them
-- as STYLE.X here; other files get them through the EllesmereUI.X exports below.
local STYLE = {
-- The dark surfaces below (and the options' popups) share one faint warm
-- tint, that of #100d0a, each at its own lightness.
-- Panel background
PANEL_BG_R = 0.069, PANEL_BG_G = 0.058, PANEL_BG_B = 0.047,
-- Global border (white + alpha -- adapts to any background tint)
BORDER_R = 1, BORDER_G = 1, BORDER_B = 1,
BORDER_A = 0.05,
-- Text (white + alpha -- adapts to any background tint)
TEXT_WHITE_R = 1, TEXT_WHITE_G = 1, TEXT_WHITE_B = 1,
TEXT_DIM_R = 1, TEXT_DIM_G = 1, TEXT_DIM_B = 1,
TEXT_DIM_A = 0.53,
TEXT_SECTION_R = 1, TEXT_SECTION_G = 1, TEXT_SECTION_B = 1,
TEXT_SECTION_A = 0.41,
-- Row alternating background alpha (black overlay on option rows)
ROW_BG_ODD = 0.1,
ROW_BG_EVEN = 0.2,
-- Slider (white + alpha for track -- adapts to any background tint)
SL_TRACK_R = 1, SL_TRACK_G = 1, SL_TRACK_B = 1, -- track bg (white + alpha)
SL_TRACK_A = 0.16, -- track bg alpha
SL_FILL_A = 0.75, -- filled portion alpha (colour = accent)
SL_INPUT_R = 0.030, SL_INPUT_G = 0.023, SL_INPUT_B = 0.018, -- input box background (darker than bg, stays as-is)
SL_INPUT_A = 0.25, -- input box alpha (all sliders)
SL_INPUT_BRD_A = 0.02, -- input box border alpha (white)
-- Multi-widget slider overrides (applied additively in BuildSliderCore)
MW_INPUT_ALPHA_BOOST = 0.15, -- additive alpha boost for multi-widget input fields
MW_TRACK_ALPHA_BOOST = 0.06, -- additive alpha boost for multi-widget slider track
-- Toggle (white + alpha for off states -- adapts to any background tint)
TG_OFF_R = 0.267, TG_OFF_G = 0.267, TG_OFF_B = 0.267, -- track when OFF (#444)
TG_OFF_A = 0.65, -- track OFF alpha
TG_ON_A = 0.75, -- track alpha at full ON (colour = accent)
TG_KNOB_OFF_R = 1, TG_KNOB_OFF_G = 1, TG_KNOB_OFF_B = 1, -- knob when OFF (white + alpha)
TG_KNOB_OFF_A = 0.5, -- knob OFF alpha
TG_KNOB_ON_R = 1, TG_KNOB_ON_G = 1, TG_KNOB_ON_B = 1, -- knob when ON
TG_KNOB_ON_A = 1, -- knob ON alpha
-- Checkbox
CB_BOX_R = 0.112, CB_BOX_G = 0.105, CB_BOX_B = 0.098, -- box background
CB_BRD_A = 0.05, CB_ACT_BRD_A = 0.15, -- box border alpha / checked border alpha
-- Button / WideButton
BTN_BG_R = 0.089, BTN_BG_G = 0.080, BTN_BG_B = 0.072, -- background
BTN_BG_A = 0.6,
BTN_BG_HA = 0.65, -- background alpha hovered
BTN_BRD_A = 0.3, -- border alpha (colour = white)
BTN_BRD_HA = 0.45, -- border alpha hovered
BTN_TXT_A = 0.55, -- text alpha (colour = white)
BTN_TXT_HA = 0.70, -- text alpha hovered
-- Dropdown
DD_BG_R = 0.103, DD_BG_G = 0.095, DD_BG_B = 0.088, -- background
DD_BG_A = 0.9,
DD_BG_HA = 0.98, -- background alpha hovered
DD_BRD_A = 0.20, -- border alpha (colour = white)
DD_BRD_HA = 0.30, -- border alpha hovered
DD_TXT_A = 0.50, -- selected value text alpha (colour = white)
DD_TXT_HA = 0.60, -- selected value text alpha hovered
DD_ITEM_HL_A = 0.08, -- menu item highlight alpha (hover)
DD_ITEM_SEL_A = 0.04, -- menu item highlight alpha (active selection)
-- Multi-widget layout (dual = 2-up, triple = 3-up -- shared by all widget types)
DUAL_ITEM_W = 350, -- width of each item in a 2-up row
DUAL_GAP = 42, -- gap between 2-up items
TRIPLE_ITEM_W = 180, -- width of each item in a 3-up row
TRIPLE_GAP = 50, -- gap between 3-up items
}
-- Color swatch border (packed into table)
local CS = {
BRD_THICK = 1, SAT_THRESH = 0.25, CHROMA_MIN = 0.15,
SOLID_R = 1, SOLID_G = 1, SOLID_B = 1, SOLID_A = 1,
}
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- Derived / Internal (built from visual settings -- no need to edit below)
-------------------------------------------------------------------------------
local ELLESMERE_GREEN
do
-- CLASS_COLOR_MAP is defined below: parse time resolves presets only; Class/Custom resolve at PLAYER_LOGIN.
local db = EllesmereUIDB or {}
local theme = ResolveFactionTheme(db.activeTheme or EllesmereUI.DEFAULT_THEME)
local r, g, b
if theme == "Custom Color" then
local sa = db.accentColor
r, g, b = sa and sa.r or DEFAULT_ACCENT_R, sa and sa.g or DEFAULT_ACCENT_G, sa and sa.b or DEFAULT_ACCENT_B
else
local preset = THEME_PRESETS[theme]
if preset then
r, g, b = preset.r, preset.g, preset.b
else
r, g, b = DEFAULT_ACCENT_R, DEFAULT_ACCENT_G, DEFAULT_ACCENT_B
end
end
ELLESMERE_GREEN = { r = r, g = g, b = b, _themeEnabled = true }
end
-- Registry of accent-colored elements (sidebar indicators, glows, tab underlines,
-- footer buttons, popup confirm). Entry = { type="solid"|"gradient"|"font"|"callback", obj=... }
local _accentElements = { _idx = {} } -- _idx: obj -> index, prevents duplicates
local function RegAccent(entry)
local key = entry.obj or entry.fn
if key and _accentElements._idx[key] then
_accentElements[_accentElements._idx[key]] = entry
else
_accentElements[#_accentElements + 1] = entry
if key then _accentElements._idx[key] = #_accentElements end
end
end
local DARK_BG = { r = STYLE.PANEL_BG_R, g = STYLE.PANEL_BG_G, b = STYLE.PANEL_BG_B }
local BORDER_COLOR = { r = STYLE.BORDER_R, g = STYLE.BORDER_G, b = STYLE.BORDER_B, a = STYLE.BORDER_A }
local TEXT_WHITE = { r = STYLE.TEXT_WHITE_R, g = STYLE.TEXT_WHITE_G, b = STYLE.TEXT_WHITE_B }
local TEXT_DIM = { r = STYLE.TEXT_DIM_R, g = STYLE.TEXT_DIM_G, b = STYLE.TEXT_DIM_B, a = STYLE.TEXT_DIM_A }
local TEXT_SECTION = { r = STYLE.TEXT_SECTION_R, g = STYLE.TEXT_SECTION_G, b = STYLE.TEXT_SECTION_B, a = STYLE.TEXT_SECTION_A }
-- Dropdown widget colours: widgets reference DD_BG_*, DD_BRD_*, DD_TXT_* directly
local CONTENT_PAD = 45
local CONTENT_HEADER_TOP_PAD = 10 -- extra top padding on scroll content when header is present
-- Paths (media lives in EllesmereUI/media inside the parent addon folder)
local ADDON_PATH = "Interface\\AddOns\\" .. EUI_HOST_ADDON .. "\\"
local MEDIA_PATH = "Interface\\AddOns\\EllesmereUI\\media\\"
local _, playerClass = UnitClass("player")
local CLASS_ART_MAP = {
DEATHKNIGHT = "dk.png",
DEMONHUNTER = "dh.png",
DRUID = "druid.png",
EVOKER = "evoker.png",
HUNTER = "hunter.png",
MAGE = "mage.png",
MONK = "monk.png",
PALADIN = "paladin.png",
PRIEST = "priest.png",
ROGUE = "rogue.png",
SHAMAN = "shaman.png",
WARLOCK = "warlock.png",
WARRIOR = "warrior.png",
}
-- Official WoW class colors (from RAID_CLASS_COLORS)
local CLASS_COLOR_MAP = {
DEATHKNIGHT = { r = 0.77, g = 0.12, b = 0.23 }, -- #C41E3A
DEMONHUNTER = { r = 0.64, g = 0.19, b = 0.79 }, -- #A330C9
DRUID = { r = 1.00, g = 0.49, b = 0.04 }, -- #FF7C0A
EVOKER = { r = 0.20, g = 0.58, b = 0.50 }, -- #33937F
HUNTER = { r = 0.67, g = 0.83, b = 0.45 }, -- #AAD372
MAGE = { r = 0.25, g = 0.78, b = 0.92 }, -- #3FC7EB
MONK = { r = 0.00, g = 1.00, b = 0.60 }, -- #00FF98
PALADIN = { r = 0.96, g = 0.55, b = 0.73 }, -- #F48CBA
PRIEST = { r = 1.00, g = 1.00, b = 1.00 }, -- #FFFFFF
ROGUE = { r = 1.00, g = 0.96, b = 0.41 }, -- #FFF468
SHAMAN = { r = 0.00, g = 0.44, b = 0.87 }, -- #0070DD
WARLOCK = { r = 0.53, g = 0.53, b = 0.93 }, -- #8788EE
WARRIOR = { r = 0.78, g = 0.61, b = 0.43 }, -- #C69B6D
}
-- Class icon sprite-sheet UV grid (4-column sheet; left/right/top/bottom). Shared by
-- every module's class-icon rendering; TEXTURE path stays per consumer. Read-only.
EllesmereUI.CLASS_ICON_SPRITE_COORDS = {
WARRIOR = { 0, 0.125, 0, 0.125 },
MAGE = { 0.125, 0.25, 0, 0.125 },
ROGUE = { 0.25, 0.375, 0, 0.125 },
DRUID = { 0.375, 0.5, 0, 0.125 },
EVOKER = { 0.5, 0.625, 0, 0.125 },
HUNTER = { 0, 0.125, 0.125, 0.25 },
SHAMAN = { 0.125, 0.25, 0.125, 0.25 },
PRIEST = { 0.25, 0.375, 0.125, 0.25 },
WARLOCK = { 0.375, 0.5, 0.125, 0.25 },
PALADIN = { 0, 0.125, 0.25, 0.375 },
DEATHKNIGHT = { 0.125, 0.25, 0.25, 0.375 },
MONK = { 0.25, 0.375, 0.25, 0.375 },
DEMONHUNTER = { 0.375, 0.5, 0.25, 0.375 },
}
-- Font (Expressway lives in EllesmereUI/media)
local EXPRESSWAY = MEDIA_PATH .. "fonts\\Expressway.ttf"
-- Locale system-font fallback for glyphs our fonts lack (CJK, Cyrillic). Resolved by
-- EllesmereUI_Locale.lua from the EFFECTIVE locale (client or override); nil = Expressway.
local LOCALE_FONT_FALLBACK = _G.EllesmereUI and _G.EllesmereUI._localeFont or nil
-------------------------------------------------------------------------------
-- Addon Roster -- per-addon display name + search alias from EllesmereUI/media
-------------------------------------------------------------------------------
local ICONS_PATH = MEDIA_PATH .. "icons\\"
-------------------------------------------------------------------------------
-- Season M+ Portals -- single source of truth for every portal/teleport list in
-- the suite (Chat flyout, Minimap flyout, QoL /keys resolver, DataBars tooltip).
-- Update ONCE here each season. Order = flyout grid order (top-left to bottom-right).
-- spellID - primary teleport spell id
-- short - abbreviated label used by the flyout buttons
-- dungeonID - LFG dungeonID (GetLFGDungeonInfo name lookup)
-- names - lowercase dungeon names + localized aliases (name -> spell)
-- altSpellIDs - optional variant teleport spell ids
-------------------------------------------------------------------------------
EllesmereUI.SEASON_PORTALS = {
{ spellID = 1286801, short = "BV", dungeonID = 3102, names = { "the blinding vale", "blinding vale", "слепящая долина" } },
{ spellID = 1286804, short = "VA", dungeonID = 3106, names = { "voidscar arena", "арена шрама бездны" } },
{ spellID = 1286807, short = "DoN", dungeonID = 3051, names = { "den of nalorakk", "den of nalorak", "берлога налоракка" } },
{ spellID = 1286809, short = "MR", dungeonID = 3090, names = { "murder row", "закоулок душегубов" } },
{ spellID = 1286812, short = "AoF", dungeonID = 3191, names = { "altar of fangs", "алтарь клыков" } },
{ spellID = 393256, short = "RLP", dungeonID = 2361, names = { "ruby life pools", "рубиновые омуты жизни" } },
{ spellID = 1286828, short = "ToS", dungeonID = 1694, names = { "temple of sethraliss", "храм сетралисс" } },
{ spellID = 1286831, short = "KR", dungeonID = 1785, names = { "kings' rest", "king's rest", "гробница королей" } },
}
-- Great Vault shortcut (Minimap button, Data Bars block, character sheet
-- season panel): loads Blizzard's vault on first use and toggles it directly,
-- so opening it closes no other panel (the UIPanel fit check would close the
-- character sheet). Escape still closes it (RegisterEscapeClose, notOwned).
function EllesmereUI.ToggleGreatVault()
if not C_AddOns.IsAddOnLoaded("Blizzard_WeeklyRewards") then
C_AddOns.LoadAddOn("Blizzard_WeeklyRewards")
end
local vault = _G.WeeklyRewardsFrame
if vault then vault:SetShown(not vault:IsShown()) end
end
-- Portal flyout (Chat sidebar and Minimap): SEASON_PORTALS spell buttons plus a
-- hearthstone column, all secure. Build lazily, never in combat; the caller
-- caches the frame and owns anchoring. opts: name (frame name prefix), bg
-- ({r,g,b}), labelFont, labelFlags, clamp (clamp to screen), unitEvents
-- (register the cast events for "player" only).
function EllesmereUI.CreatePortalFlyout(opts)
if InCombatLockdown() then return nil end
local floor = math.floor
local PP = EllesmereUI.PP
local BTN_SIZE = 32
local SPACING = 1
local PADDING = 2
local COLS = 4
local ROWS = math.ceil(#EllesmereUI.SEASON_PORTALS / COLS)
local flyH = PADDING * 2 + BTN_SIZE * ROWS + SPACING * (ROWS - 1)
local HS_COUNT = 3
local HS_H = floor((flyH - PADDING * 2 - SPACING * (HS_COUNT - 1)) / HS_COUNT)
local hsX = PADDING + COLS * BTN_SIZE + (COLS - 1) * SPACING + SPACING
local flyW = hsX + HS_H + PADDING
local flyout = CreateFrame("Frame", opts.name .. "PortalFlyout", UIParent)
flyout:SetSize(flyW, flyH)
flyout:SetFrameStrata("DIALOG")
flyout:SetFrameLevel(100)
if opts.clamp then flyout:SetClampedToScreen(true) end
flyout:Hide()
local bg = flyout:CreateTexture(nil, "BACKGROUND")
bg:SetAllPoints()
bg:SetColorTexture(opts.bg[1], opts.bg[2], opts.bg[3], 0.95)
if PP and PP.CreateBorder then
PP.CreateBorder(flyout, 1, 1, 1, 0.06, 1, "OVERLAY", 7)
end
-- Close in combat
local guard = CreateFrame("Frame")
guard:RegisterEvent("PLAYER_REGEN_DISABLED")
guard:SetScript("OnEvent", function() flyout:Hide() end)
local function NewButton(name, size)
local btn = CreateFrame("Button", name, flyout, "SecureActionButtonTemplate")
btn:SetSize(size, size)
local icon = btn:CreateTexture(nil, "ARTWORK")
icon:SetAllPoints()
icon:SetTexCoord(6/64, 58/64, 6/64, 58/64)
btn.icon = icon
if PP and PP.CreateBorder then
PP.CreateBorder(btn, 0, 0, 0, 1, 1, "OVERLAY", 7)
end
local cd = CreateFrame("Cooldown", nil, btn, "CooldownFrameTemplate")
cd:SetAllPoints()
cd:SetHideCountdownNumbers(true)
cd:SetDrawSwipe(true)
cd:SetDrawBling(false)
cd:SetDrawEdge(false)
btn.cooldown = cd
return btn, cd
end
local function AddHighlights(btn)
local hover = btn:CreateTexture(nil, "HIGHLIGHT")
hover:SetAllPoints()
hover:SetColorTexture(1, 1, 1, 0.20)
-- Casting highlight overlay
local castHL = btn:CreateTexture(nil, "OVERLAY", nil, 1)
castHL:SetAllPoints()
castHL:SetColorTexture(1, 1, 1, 0.4)
castHL:Hide()
btn._castHL = castHL
end
local portalBtns = {}
for i, e in ipairs(EllesmereUI.SEASON_PORTALS) do
local spellID = e.spellID
local col = (i - 1) % COLS
local row = floor((i - 1) / COLS)
local btn, cd = NewButton(opts.name .. "Portal" .. i, BTN_SIZE)
btn:SetPoint("TOPLEFT", flyout, "TOPLEFT",
PADDING + col * (BTN_SIZE + SPACING),
-(PADDING + row * (BTN_SIZE + SPACING)))
btn.spellID = spellID
local spellInfo = C_Spell.GetSpellInfo(spellID)
if spellInfo then btn.icon:SetTexture(spellInfo.iconID) end
local short = e.short
if short then
local labelFrame = CreateFrame("Frame", nil, btn)
labelFrame:SetAllPoints()
labelFrame:SetFrameLevel(cd:GetFrameLevel() + 2)
local label = labelFrame:CreateFontString(nil, "OVERLAY", nil)
if EllesmereUI.PrimeFontShadow then EllesmereUI.PrimeFontShadow(label, true) end
label:SetFont(opts.labelFont, 8, opts.labelFlags)
label:SetPoint("BOTTOM", btn, "BOTTOM", 0, 2)
label:SetTextColor(1, 1, 1, 0.9)
label:SetText((EllesmereUI.L(short)) or short)
end
AddHighlights(btn)
btn:RegisterForClicks("AnyUp", "AnyDown")
btn:SetAttribute("type", "spell")
btn:SetAttribute("spell", spellID)
btn:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
GameTooltip:SetSpellByID(self.spellID)
GameTooltip:Show()
end)
btn:SetScript("OnLeave", function() GameTooltip:Hide() end)
portalBtns[i] = btn
end
-- Hearthstone column: 3 icons stacked vertically as a 5th column
local hearthBtns = {}
for i = 1, HS_COUNT do
local btn = NewButton(opts.name .. "Hearth" .. i, HS_H)
btn:SetPoint("TOPLEFT", flyout, "TOPLEFT",
hsX,
-(PADDING + (i - 1) * (HS_H + SPACING)))
AddHighlights(btn)
btn:RegisterForClicks("AnyUp", "AnyDown")
btn:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
if self._hsType == "spell" then
GameTooltip:SetSpellByID(self._hsID)
elseif self._hsType == "item" then
if self._hsID ~= 6948 and PlayerHasToy and PlayerHasToy(self._hsID) then
GameTooltip:SetToyByItemID(self._hsID)
else
GameTooltip:SetItemByID(self._hsID)
end
elseif self._hsType == "housing" then
GameTooltip:AddLine(EllesmereUI.L("Housing Dashboard"))
end
GameTooltip:Show()
end)
btn:SetScript("OnLeave", function() GameTooltip:Hide() end)
btn:HookScript("PostClick", function(self)
if self._hsType == "housing" then
if HousingFramesUtil and HousingFramesUtil.ToggleHousingDashboard then
HousingFramesUtil.ToggleHousingDashboard()
end
flyout:Hide()
else
self._castHL:Show()
end
end)
hearthBtns[i] = btn
end
local function RefreshPortalButtons()
for _, btn in ipairs(portalBtns) do
local spellID = btn.spellID
local known = IsPlayerSpell(spellID)
if btn._lastKnown ~= known then
btn._lastKnown = known
btn.icon:SetDesaturated(not known)
btn.icon:SetAlpha(known and 1 or 0.4)
end
if known then
local cdInfo = C_Spell.GetSpellCooldown(spellID)
if cdInfo and cdInfo.startTime and cdInfo.duration and cdInfo.duration > 0 then
btn.cooldown:SetCooldown(cdInfo.startTime, cdInfo.duration)
else
btn.cooldown:Clear()
end
else
btn.cooldown:Clear()
end
end
end
-- Swipe-only refresh (SPELL_UPDATE_COOLDOWN); never re-resolves toys.
local function RefreshHearthCooldowns()
for _, btn in ipairs(hearthBtns) do
local aType, id = btn._hsType, btn._hsID
if aType == "spell" and C_Spell and C_Spell.GetSpellCooldown then
local cdInfo = C_Spell.GetSpellCooldown(id)
if cdInfo and cdInfo.startTime and cdInfo.duration and cdInfo.duration > 0 then
btn.cooldown:SetCooldown(cdInfo.startTime, cdInfo.duration)
else
btn.cooldown:Clear()
end
-- The namespaced call (as IsHearthOnCD uses): the global only exists
-- behind Blizzard's deprecation fallbacks, and never on Forever.
elseif aType == "item" and C_Container and C_Container.GetItemCooldown then
local ok, start, dur = pcall(C_Container.GetItemCooldown, id)
if ok and start and dur and dur > 0 then
btn.cooldown:SetCooldown(start, dur)
else
btn.cooldown:Clear()
end
else
btn.cooldown:Clear()
end
end
end
-- Full resolve (random toy, icon/macro/attributes). Show only, never on
-- cooldown events; attribute writes are combat-illegal, hence the gate.
local function ResolveHearthButtons()
if InCombatLockdown() then return end
local resolvers = {
EllesmereUI.ResolveHearthSlot,
EllesmereUI.ResolveDalaranSlot,
EllesmereUI.ResolveHousingSlot,
}
for i, btn in ipairs(hearthBtns) do
local aType, id, iconTex = resolvers[i]()
btn._hsType = aType
btn._hsID = id
btn.icon:SetTexture(iconTex)
btn.icon:SetTexCoord(aType == "housing" and 0 or 6/64,
aType == "housing" and 1 or 58/64,
aType == "housing" and 0 or 6/64,
aType == "housing" and 1 or 58/64)
if aType == "housing" then
btn:SetAttribute("type", nil)
btn:SetAttribute("macrotext", nil)
elseif aType == "spell" then
btn:SetAttribute("type", "macro")
local info = C_Spell and C_Spell.GetSpellInfo and C_Spell.GetSpellInfo(id)
local name = info and info.name or ""
btn:SetAttribute("macrotext", "/cast " .. name)
else
btn:SetAttribute("type", "macro")
if id == 6948 then
btn:SetAttribute("macrotext", "/use item:" .. id)
else
local toyName
if C_ToyBox and C_ToyBox.GetToyInfo then
local _, tn = C_ToyBox.GetToyInfo(id)
toyName = tn
end
btn:SetAttribute("macrotext", toyName and ("/use " .. toyName) or ("/use item:" .. id))
end
end
end
RefreshHearthCooldowns()
end
-- Events live only while shown: cooldown + cast highlight refresh.
local CAST_EVENTS = { "UNIT_SPELLCAST_START", "UNIT_SPELLCAST_STOP", "UNIT_SPELLCAST_SUCCEEDED",
"UNIT_SPELLCAST_FAILED", "UNIT_SPELLCAST_INTERRUPTED" }
flyout:SetScript("OnShow", function(self)
self:RegisterEvent("SPELL_UPDATE_COOLDOWN")
for _, ev in ipairs(CAST_EVENTS) do
if opts.unitEvents then self:RegisterUnitEvent(ev, "player") else self:RegisterEvent(ev) end
end
RefreshPortalButtons()
ResolveHearthButtons()
-- Controller cursor: a window the player opened brings the gamepad pointer up.
if EllesmereUI.PadNative() then EllesmereUI.RaiseGamePadCursor() end
end)
flyout:SetScript("OnHide", function(self)
self:UnregisterAllEvents()
for _, btn in ipairs(portalBtns) do
if btn._castHL then btn._castHL:Hide() end
end
for _, btn in ipairs(hearthBtns) do
if btn._castHL then btn._castHL:Hide() end
end
end)
flyout:SetScript("OnEvent", function(self, event, unit, castGUID, spellID)
if event == "SPELL_UPDATE_COOLDOWN" then
RefreshPortalButtons()
RefreshHearthCooldowns()
elseif unit == "player" then
local casting = (event == "UNIT_SPELLCAST_START") and spellID or nil
for _, btn in ipairs(portalBtns) do
if btn._castHL then
btn._castHL:SetShown(casting and casting == btn.spellID)
end
end
-- Cast end clears hearthstone highlights
if not casting then
for _, btn in ipairs(hearthBtns) do
if btn._castHL then btn._castHL:Hide() end
end
end
end
end)
-- Escape to close
EllesmereUI.RegisterEscapeClose(flyout)
return flyout
end
local ADDON_ROSTER = {
{ folder = "EllesmereUIActionBars", display = "Action Bars", search_name = "EllesmereUI Action Bars" },
{ folder = "EllesmereUINameplates", display = "Nameplates", search_name = "EllesmereUI Nameplates" },
{ folder = "EllesmereUIUnitFrames", display = "Unit Frames", search_name = "EllesmereUI Unit Frames" },
{ folder = "EllesmereUIRaidFrames", display = "Raid Frames", search_name = "EllesmereUI Raid Frames" },
{ folder = "EllesmereUICooldownManager", display = "Cooldown Manager", search_name = "EllesmereUI Cooldown Manager" },
{ folder = "EllesmereUIResourceBars", display = "Resource & Cast Bars", search_name = "EllesmereUI Resource Bars Cast Bars" },
{ folder = "EllesmereUIAuraBuffReminders", display = "AuraBuff Reminders", search_name = "EllesmereUI AuraBuff Reminders" },
{ folder = "EllesmereUIQoL", display = "Quality of Life", search_name = "EllesmereUI Quality of Life" },
{ folder = "EllesmereUIForeverEssentials", display = "Forever Essentials", search_name = "EllesmereUI Forever Essentials" },
{ folder = "EllesmereUIBlizzardSkin", display = "Blizzard Skins+", search_name = "EllesmereUI Blizzard Skins+", syncFolder = "EllesmereUIDragonRiding", syncDisplay = "Dragon Riding" },
{ folder = "EllesmereUIFriends", display = "Friends List", search_name = "EllesmereUI Friends List" },
{ folder = "EllesmereUIMythicTimer", display = "Mythic+ Tools", search_name = "EllesmereUI Mythic+ Tools Timer" },
{ folder = "EllesmereUIQuestTracker", display = "Quest Tracker", search_name = "EllesmereUI Quest Tracker" },
{ folder = "EllesmereUIMinimap", display = "Minimap", search_name = "EllesmereUI Minimap" },
{ folder = "EllesmereUIChat", display = "Chat", search_name = "EllesmereUI Chat" },
{ folder = "EllesmereUIDamageMeters", display = "Damage Meters", search_name = "EllesmereUI Damage Meters" },
{ folder = "EllesmereUIBags", display = "Bags", search_name = "EllesmereUI Bags" },
{ folder = "EllesmereUIDataBars", display = "DataBars", search_name = "EllesmereUI DataBars" },
{ folder = "EllesmereUIQuickdraw", display = "Quickdraw", search_name = "EllesmereUI Quickdraw" },
{ folder = "EllesmereUILoadoutManager", display = "Loadout Manager", search_name = "EllesmereUI Loadout Manager" },
{ folder = "EllesmereUIPartyMode", display = "Party Mode", search_name = "EllesmereUI Party Mode", alwaysLoaded = true },
}
-------------------------------------------------------------------------------
-- Addon Groups -- ordered sidebar categories (group = text header, no toggle; members
-- = child rows, order authoritative, coming-soon last). On EllesmereUI, not a file
-- local, to stay under the 200-local / CreateMainFrame 60-upvalue caps.
-------------------------------------------------------------------------------
EllesmereUI.ADDON_GROUPS = {
{
key = "core",
label = "Core Addons",
members = {
"EllesmereUIActionBars",
"EllesmereUINameplates",
"EllesmereUIUnitFrames",
"EllesmereUICooldownManager",
"EllesmereUIResourceBars",
"EllesmereUIRaidFrames",
},
},
{
key = "qol",
label = "QoL Addons",
members = {
"EllesmereUIQoL",
"EllesmereUIForeverEssentials",
"EllesmereUIAuraBuffReminders",
"EllesmereUIDataBars",
"EllesmereUIQuickdraw",
"EllesmereUILoadoutManager",
"EllesmereUIPartyMode",
},
},
{
key = "reskin",
label = "UI Reskin Addons",
members = {
"EllesmereUIBlizzardSkin",
"EllesmereUIDamageMeters",
"EllesmereUIMythicTimer",
"EllesmereUIQuestTracker",
"EllesmereUIFriends",
"EllesmereUIMinimap",
"EllesmereUIChat",
"EllesmereUIBags",
},
},
}
-- STANDALONE: the bundled module is the only roster entry containing "Standalone"
-- (rename yields "EUICoreStandalone<X>" refs; installed folder is "EUIStandalone<X>").
-- Keep the full sidebar, prepend a "Standalone" category with this module, and remove
-- it from its normal category so it is not listed twice. Inert in the suite.
if IS_STANDALONE then
local selfFolder
for _, info in ipairs(ADDON_ROSTER) do
-- Exclude "Core": the renamed core token is "EUICoreStandalone<X>".
if info.folder:find("Standalone") and not info.folder:find("Core") then
selfFolder = info.folder
break
end
end
if selfFolder then
for _, group in ipairs(EllesmereUI.ADDON_GROUPS) do
for mi = #group.members, 1, -1 do
if group.members[mi] == selfFolder then
table.remove(group.members, mi)
end
end
end
table.insert(EllesmereUI.ADDON_GROUPS, 1, {
key = "standalone",
label = "Standalone",
members = { selfFolder },
})
end
end
-- WoW Forever: addons switched off for the whole client (TOC
-- "## AllowLoadGameType: standard") leave every list built from the roster
-- and the groups -- sidebar, install picker, font and texture cards -- rather
-- than sit in them disabled. Extend the set whenever a TOC gets that line.
EllesmereUI.FOREVER_HIDDEN_ADDONS = {
EllesmereUIMythicTimer = true, EllesmereUIFriends = true,
EllesmereUILoadoutManager = true,
-- Not an addon: the Dragon Riding profile pseudo-folder (its file returns at
-- load on Forever), listed so the profile import/export checklists drop it.
EllesmereUIDragonRiding = true,
}
-- The mirror: addons that load on WoW Forever alone (TOC
-- "## AllowLoadGameType: camelot") leave the same lists on every other client.
EllesmereUI.FOREVER_ONLY_ADDONS = {
EllesmereUIForeverEssentials = true,
}
-- Modules held back from the current release on every client: they leave the
-- same lists, their runtime stops at its top, and neither the packager nor
-- the tester zip ships their folder (.pkgmeta ignore, package-for-testers.ps1).
-- To ship one, drop it here and restore its .pkgmeta move-folders line and
-- the tester zip.
EllesmereUI.HELD_BACK_ADDONS = {
EllesmereUILoadoutManager = true,
}
-- The set the running client leaves out.
do
local hidden = {}
for folder in pairs((EUI_CLIENT_FOREVER == true) and EllesmereUI.FOREVER_HIDDEN_ADDONS
or EllesmereUI.FOREVER_ONLY_ADDONS) do
hidden[folder] = true
end
for folder in pairs(EllesmereUI.HELD_BACK_ADDONS) do hidden[folder] = true end
EllesmereUI._CLIENT_HIDDEN_ADDONS = hidden
end
-- The profile import/export checklists read the profile data map, which stays
-- complete (it drives the data itself); they list through this view instead.
function EllesmereUI.VisibleProfileAddons(map)
if type(map) ~= "table" then return map end
local hidden = EllesmereUI._CLIENT_HIDDEN_ADDONS
local out = {}
for _, entry in ipairs(map) do
if not hidden[entry.folder] then out[#out + 1] = entry end
end
return out
end
do
local hidden = EllesmereUI._CLIENT_HIDDEN_ADDONS
for i = #ADDON_ROSTER, 1, -1 do
if hidden[ADDON_ROSTER[i].folder] then table.remove(ADDON_ROSTER, i) end
end
for _, group in ipairs(EllesmereUI.ADDON_GROUPS) do
for mi = #group.members, 1, -1 do
if hidden[group.members[mi]] then table.remove(group.members, mi) end
end
end
end
-- Icon file ids the Forever client does not ship (its art set predates them),
-- each with the vanilla-era icon that stands in for it there. Resolved where
-- an icon is painted (a stored custom icon gets the same treatment), never in
-- the default tables; every other client gets the id back as it is. Extend
-- the map whenever a tester reports a green square.
EllesmereUI._FOREVER_ICON = {
[7548911] = 133975, -- Bags "Consumables" default: an apple
[7549094] = 136249, -- Bags "Gear Enhancements": classic enchantment icon
[7548925] = 134332, -- Bags "Professions": classic trade-skill icon
}
function EllesmereUI.ClientIcon(icon)
if EUI_CLIENT_FOREVER ~= true then return icon end
return EllesmereUI._FOREVER_ICON[icon] or icon
end
-- The trash can on a delete button: Blizzard's atlas where the client has it,
-- else the bundled glyph (the Forever client has no common-icon-delete).
function EllesmereUI.SetDeleteIcon(tex)
local ok = EllesmereUI._deleteAtlasOK
if ok == nil then
ok = C_Texture.GetAtlasInfo("common-icon-delete") ~= nil
EllesmereUI._deleteAtlasOK = ok
end
if ok then
tex:SetAtlas("common-icon-delete")
else
tex:SetTexture(EllesmereUI.ICONS_PATH .. "common-icon-delete.png")
end
end
-- Flat folder -> roster-info lookup for the grouped sidebar builder. On EllesmereUI
-- (not a local): CreateMainFrame is up against the Lua 5.1 60-upvalue limit.
EllesmereUI._addonInfoByFolder = {}
for _, info in ipairs(ADDON_ROSTER) do
EllesmereUI._addonInfoByFolder[info.folder] = info
end
-------------------------------------------------------------------------------
-- Private navigation model
-- The sidebar is built ONLY from these copies, taken once the roster and groups
-- above are final. ADDON_ROSTER / ADDON_GROUPS / _addonInfoByFolder stay public
-- as read-only data for other files, but writes to them no longer reach the
-- sidebar: third-party code cannot add rows to the suite's sections, reorder
-- them, or relabel them. Plugin sections (see the Plugin API section) are held
-- in separate lists and can only sit above or below the whole suite block.
-------------------------------------------------------------------------------
do
local navInfo = {}
for _, info in ipairs(ADDON_ROSTER) do
local copy = {}
for k, v in pairs(info) do copy[k] = v end
navInfo[info.folder] = copy
end
local coreGroups = {}
for _, group in ipairs(EllesmereUI.ADDON_GROUPS) do
local members = {}
for i, folder in ipairs(group.members) do members[i] = folder end
coreGroups[#coreGroups + 1] = { key = group.key, label = group.label, members = members }
end
EUI_NS.navInfo = navInfo
EUI_NS.coreGroups = coreGroups
EUI_NS.pluginGroupsTop = {}
EUI_NS.pluginGroupsBottom = {}
EUI_NS.navGroups = {}
-- Sidebar group header frames, keyed by group key.
EUI_NS.sidebarGroupButtons = {}
-- Final sidebar order: top plugin sections, the suite's own groups as one
-- contiguous block, then bottom plugin sections.
function EUI_NS.RebuildNavGroups()
local out = EUI_NS.navGroups
for i = #out, 1, -1 do out[i] = nil end
for _, g in ipairs(EUI_NS.pluginGroupsTop) do out[#out + 1] = g end
for _, g in ipairs(coreGroups) do out[#out + 1] = g end
for _, g in ipairs(EUI_NS.pluginGroupsBottom) do out[#out + 1] = g end
end
EUI_NS.RebuildNavGroups()
-- Module keys starting with this prefix belong to the plugin registry.
local PLUGIN_PREFIX = "plugin:"
EUI_NS.PLUGIN_PREFIX = PLUGIN_PREFIX
function EUI_NS.IsPluginKey(key)
return type(key) == "string" and key:sub(1, #PLUGIN_PREFIX) == PLUGIN_PREFIX
end
-- Suite registration window (see RegisterModule). Open while the options
-- addon loads (whoever loads it: its files register as they run), while the
-- core drains its deferred inits, and from a pre-login load of the options
-- addon until just after PLAYER_LOGIN (its files register from their
-- PLAYER_LOGIN handlers in that case).
local regDepth, loginWindow = 0, false
local IsAddOnLoaded = C_AddOns.IsAddOnLoaded
function EUI_NS.CoreRegistrationOpen()
if regDepth > 0 or loginWindow then return true end
local loadedOrLoading, loaded = IsAddOnLoaded("EllesmereUIOptions")
return loadedOrLoading and not loaded
end
-- The suite's pages always register through the real RegisterModule. An
-- addon that replaced or hooked the public one (to slip pages into the
-- suite's modules) is taken out of the path first, so it can never stop
-- them registering, and is named in the panel's update notice.
local rawget, rawset = rawget, rawset
local function ReclaimRegisterModule()
local real = EUI_NS.CoreRegisterModule
if not real or rawget(EllesmereUI, "RegisterModule") == real then return end
local by = EUI_NS.WriterOf(EllesmereUI, "RegisterModule")
rawset(EllesmereUI, "RegisterModule", real)
if by then EUI_NS.RecordLegacyOffender(by) end
end
-- Errors are reported through the error handler (keeping their traceback)
-- rather than rethrown, so a failing callee can never leave the window open.
local function ReportError(err) return geterrorhandler()(err) end
EUI_NS.ReportError = ReportError -- shared with the plugin registry (EllesmereUI_Panel.lua)
function EUI_NS.RunCoreRegistration(fn, ...)
ReclaimRegisterModule()
regDepth = regDepth + 1
local ok, a, b = xpcall(fn, ReportError, ...)
regDepth = regDepth - 1
if ok then return a, b end
end
local f = CreateFrame("Frame")
f:RegisterEvent("ADDON_LOADED")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent", function(self, event, name)
if event == "PLAYER_LOGIN" then
self:UnregisterEvent("PLAYER_LOGIN")
-- Before the options files' own PLAYER_LOGIN registrations (a
-- pre-login options load, standalone builds).
ReclaimRegisterModule()
if loginWindow then
C_Timer.After(0, function() loginWindow = false end)
end
elseif name == "EllesmereUIOptions" then
self:UnregisterEvent("ADDON_LOADED")
-- Loaded before login: its files register from their PLAYER_LOGIN handlers.
if not IsLoggedIn() then loginWindow = true end
end
end)
end
local IsAddonLoaded = C_AddOns.IsAddOnLoaded
-------------------------------------------------------------------------------
-- Forward declarations
-------------------------------------------------------------------------------
local EllesmereUI = _G.EllesmereUI or {}
_G.EllesmereUI = EllesmereUI
EllesmereUI.GLOBAL_KEY = "_EUIGlobal"
EllesmereUI.ADDON_ROSTER = ADDON_ROSTER
EllesmereUI.LOCALE_FONT_FALLBACK = LOCALE_FONT_FALLBACK
-- Script the fallback stands in for: "cyrillic" | "cjk" | nil. Table field, not a
-- file-scope local: this file sits on the Lua 5.1 200-local cap.
EllesmereUI.LOCALE_SCRIPT = EllesmereUI._localeScript
EllesmereUI.EXPRESSWAY = LOCALE_FONT_FALLBACK or EXPRESSWAY
-- Re-sync once the override-aware effective locale is known (the values above
-- are captured before EllesmereUIDB's displayLocale override is readable).
function EllesmereUI.RefreshLocaleFontFallback()
LOCALE_FONT_FALLBACK = EllesmereUI._localeFont
EllesmereUI.LOCALE_FONT_FALLBACK = LOCALE_FONT_FALLBACK
EllesmereUI.LOCALE_SCRIPT = EllesmereUI._localeScript
EllesmereUI.EXPRESSWAY = LOCALE_FONT_FALLBACK or EXPRESSWAY
EllesmereUI.InvalidateFontCache()