Repository navigation
Expand file tree
/
Copy pathMasterUI.lua
More file actions
4604 lines (4125 loc) · 195 KB
/
Copy pathMasterUI.lua
File metadata and controls
4604 lines (4125 loc) · 195 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
-- Master menu for the main Softcore UI.
local SC = Softcore
local function SavePosition(key, frame)
SoftcoreDB = SoftcoreDB or {}
SoftcoreDB.ui = SoftcoreDB.ui or {}
SoftcoreDB.ui[key] = { x = frame:GetLeft(), y = frame:GetTop() }
end
local function RestorePosition(key, frame, defaultX, defaultY)
local pos = SoftcoreDB and SoftcoreDB.ui and SoftcoreDB.ui[key]
frame:ClearAllPoints()
if pos and pos.x and pos.y then
frame:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", pos.x, pos.y)
else
frame:SetPoint("CENTER", UIParent, "CENTER", defaultX or 0, defaultY or 0)
end
end
local TAB_RUN = "RUN"
local TAB_OVERVIEW = "OVERVIEW"
local TAB_VIOLATIONS = "VIOLATIONS"
local TAB_LOG = "LOG"
local TAB_ACHIEVEMENTS = "ACHIEVEMENTS"
local DISALLOWED_OUTCOME = "WARNING"
local PANEL_WIDTH = 710
local PANEL_HEIGHT = 560
local RUN_FOOTER_BOTTOM = 24
local RUN_FOOTER_LEFT_INSET = 32
local RUN_FOOTER_RIGHT_INSET = 32
local RUN_LAYOUT = {
CONTENT_WIDTH = 690,
SECTION_GAP = 14,
COLUMN_GAP = 32,
ROW_HEIGHT = 31,
SECTION_CONTENT_TOP = 32,
SECTION_ROW_CONTROL_HEIGHT = 28,
DROPDOWN_X_OFFSET = -16,
CHECKBOX_LABEL_GAP = 4,
INLINE_FIELD_GAP = 10,
}
RUN_LAYOUT.COLUMN_WIDTH = math.floor((RUN_LAYOUT.CONTENT_WIDTH - RUN_LAYOUT.COLUMN_GAP) / 2)
RUN_LAYOUT.RIGHT_COLUMN_X = RUN_LAYOUT.COLUMN_WIDTH + RUN_LAYOUT.COLUMN_GAP
SC.MasterUIRunLayout = RUN_LAYOUT
local AUDIT_LIST_LAYOUT = {
CONTENT_WIDTH = 690,
SUMMARY_TOP = -34,
COLUMN_TOP = -58,
DIVIDER_TOP = -72,
ROW_TOP = -86,
ROW_HEIGHT = 34,
FOOTER_HEIGHT = 36,
ROW_TEXT_INSET = 10,
SCROLL_RIGHT_INSET = 24,
}
AUDIT_LIST_LAYOUT.TYPE_X = 10
AUDIT_LIST_LAYOUT.TYPE_WIDTH = 108
AUDIT_LIST_LAYOUT.ACTOR_X = 136
AUDIT_LIST_LAYOUT.ACTOR_WIDTH = 92
AUDIT_LIST_LAYOUT.TIME_X = 246
AUDIT_LIST_LAYOUT.TIME_WIDTH = 134
AUDIT_LIST_LAYOUT.MESSAGE_X = 398
AUDIT_LIST_LAYOUT.MESSAGE_WIDTH = AUDIT_LIST_LAYOUT.CONTENT_WIDTH - AUDIT_LIST_LAYOUT.MESSAGE_X - 28
AUDIT_LIST_LAYOUT.ACTION_MESSAGE_WIDTH = AUDIT_LIST_LAYOUT.CONTENT_WIDTH - AUDIT_LIST_LAYOUT.MESSAGE_X - 96
AUDIT_LIST_LAYOUT.VISIBLE_ROWS = math.floor((PANEL_HEIGHT + AUDIT_LIST_LAYOUT.ROW_TOP - AUDIT_LIST_LAYOUT.FOOTER_HEIGHT - 8) / AUDIT_LIST_LAYOUT.ROW_HEIGHT)
local LOG_UI_MAX_ENTRIES = 1000
local LOG_ROWS = AUDIT_LIST_LAYOUT.VISIBLE_ROWS
local LOG_ROW_TOP = AUDIT_LIST_LAYOUT.ROW_TOP
local LOG_ROW_HEIGHT = AUDIT_LIST_LAYOUT.ROW_HEIGHT
local VIOLATION_ROWS = AUDIT_LIST_LAYOUT.VISIBLE_ROWS
local VIOLATION_ROW_TOP = AUDIT_LIST_LAYOUT.ROW_TOP
local VIOLATION_ROW_HEIGHT = AUDIT_LIST_LAYOUT.ROW_HEIGHT
local OVERVIEW_PARTY_ROWS = 5
local OVERVIEW_LAYOUT = {
CONTENT_WIDTH = 690,
HERO_HEIGHT = 78,
HERO_GAP = 10,
METRIC_HEIGHT = 74,
METRIC_GAP = 10,
LEDGER_TOP_GAP = 18,
ACTIVITY_HEIGHT = 90,
ACTIVITY_GAP = 14,
ACTIVITY_ROWS = 3,
SECTION_INSET = 12,
SECTION_TITLE_TOP = -9,
SECTION_DIVIDER_TOP = -30,
SECTION_HEADER_HEIGHT = 36,
LEDGER_INSET = 12,
LEDGER_HEADER_HEIGHT = 36,
LEDGER_ROW_HEIGHT = 44,
LEDGER_ROW_GAP = 6,
LEDGER_BADGE_WIDTH = 136,
LEDGER_BADGE_HEIGHT = 24,
LEDGER_BADGE_GAP = 12,
}
OVERVIEW_LAYOUT.LEDGER_MAX_ROWS_HEIGHT = (OVERVIEW_PARTY_ROWS * OVERVIEW_LAYOUT.LEDGER_ROW_HEIGHT)
+ ((OVERVIEW_PARTY_ROWS - 1) * OVERVIEW_LAYOUT.LEDGER_ROW_GAP)
local ACHIEVEMENT_LAYOUT = {
CONTENT_WIDTH = 690,
SUMMARY_TOP = -34,
SUMMARY_HEIGHT = 62,
SUMMARY_GAP = 10,
SCROLL_TOP = -112,
SCROLL_HEIGHT = PANEL_HEIGHT - 128,
SECTION_GAP = 8,
SECTION_HEADER_HEIGHT = 38,
SECTION_ROW_TOP_GAP = 6,
SECTION_BOTTOM_INSET = 8,
ROW_HEIGHT = 72,
ROW_GAP = 6,
ROW_INSET = 10,
ICON_SIZE = 42,
BADGE_WIDTH = 74,
BADGE_HEIGHT = 20,
PROGRESS_WIDTH = 170,
}
-- Achievements list: bottom margin above panel edge (keeps height in sync with SCROLL_TOP + SCROLL_HEIGHT).
ACHIEVEMENT_LAYOUT.SCROLL_BOTTOM_INSET = PANEL_HEIGHT + ACHIEVEMENT_LAYOUT.SCROLL_TOP - ACHIEVEMENT_LAYOUT.SCROLL_HEIGHT
local BODY_TEXT = { r = 0.94, g = 0.86, b = 0.68 }
local MUTED_TEXT = { r = 0.68, g = 0.56, b = 0.38 }
local GOLD_TEXT = { r = 1.00, g = 0.82, b = 0.20 }
local GREEN_TEXT = { r = 0.42, g = 1.00, b = 0.54 }
local RED_TEXT = { r = 1.00, g = 0.30, b = 0.25 }
local BLUE_TEXT = { r = 0.38, g = 0.66, b = 1.00 }
local PURPLE_TEXT = { r = 0.78, g = 0.58, b = 1.00 }
local ORANGE_TEXT = { r = 1.00, g = 0.58, b = 0.22 }
local MENU_LOGO_TEXTURE = "Interface\\AddOns\\Softcore\\Assets\\SoftcoreLogoMenu"
local CLASS_COLORS = {
DEATHKNIGHT = { r = 0.77, g = 0.12, b = 0.23 },
DEMONHUNTER = { r = 0.64, g = 0.19, b = 0.79 },
DRUID = { r = 1.00, g = 0.49, b = 0.04 },
EVOKER = { r = 0.20, g = 0.58, b = 0.50 },
HUNTER = { r = 0.67, g = 0.83, b = 0.45 },
MAGE = { r = 0.25, g = 0.78, b = 0.92 },
MONK = { r = 0.00, g = 1.00, b = 0.60 },
PALADIN = { r = 0.96, g = 0.55, b = 0.73 },
PRIEST = { r = 1.00, g = 1.00, b = 1.00 },
ROGUE = { r = 1.00, g = 0.96, b = 0.41 },
SHAMAN = { r = 0.00, g = 0.44, b = 0.87 },
WARLOCK = { r = 0.53, g = 0.53, b = 0.93 },
WARRIOR = { r = 0.78, g = 0.61, b = 0.43 },
}
local CLASS_LABELS = {
DEATHKNIGHT = "Death Knight",
DEMONHUNTER = "Demon Hunter",
}
local ACHIEVEMENT_CATEGORY_ORDER = {
"Award",
"Level Milestones",
"Max Level Runs",
"Preset Challenges",
"Rules: Access",
"Rules: Travel",
"Rules: Gear & Items",
"Rules: Party And Instances",
"Class Mastery",
}
local ACHIEVEMENT_CATEGORY_META = {
Award = { label = "Completion Award", icon = "Interface\\Icons\\INV_Letter_18", color = GOLD_TEXT },
["Level Milestones"] = { label = "Level Milestones", icon = "Interface\\Icons\\Achievement_Level_10", color = GREEN_TEXT },
["Max Level Runs"] = { label = "Max Level Runs", icon = "Interface\\Icons\\INV_Misc_Trophy_Argent", color = GOLD_TEXT },
["Preset Challenges"] = { label = "Preset Challenges", icon = "Interface\\Icons\\INV_Misc_Food_15", color = PURPLE_TEXT },
["Rules: Access"] = { label = "Rules: Access", icon = "Interface\\Icons\\INV_Misc_Coin_02", color = ORANGE_TEXT },
["Rules: Travel"] = { label = "Rules: Travel", icon = "Interface\\Icons\\Ability_Mount_Gryphon_01", color = BLUE_TEXT },
["Rules: Gear & Items"] = { label = "Rules: Gear & Items", icon = "Interface\\Icons\\INV_Chest_Cloth_17", color = GREEN_TEXT },
["Rules: Party And Instances"] = { label = "Rules: Party & Instances", icon = "Interface\\Icons\\Achievement_GuildPerk_EverybodysFriend", color = GOLD_TEXT },
["Class Mastery"] = { label = "Class Mastery", icon = "Interface\\Icons\\Achievement_Character_Human_Male", color = PURPLE_TEXT },
Rules = { label = "Rules", icon = "Interface\\Icons\\INV_Misc_Note_03", color = ORANGE_TEXT },
}
local ACHIEVEMENT_CLASS_ICONS = {
DEATHKNIGHT = "Interface\\Icons\\Spell_Deathknight_ClassIcon",
DEMONHUNTER = "Interface\\Icons\\Ability_DemonHunter_SpectralSight",
DRUID = "Interface\\Icons\\Ability_Druid_Maul",
EVOKER = "Interface\\Icons\\ClassIcon_Evoker",
HUNTER = "Interface\\Icons\\INV_Weapon_Bow_07",
MAGE = "Interface\\Icons\\Spell_Frost_FrostBolt02",
MONK = "Interface\\Icons\\Class_Monk",
PALADIN = "Interface\\Icons\\Ability_Paladin_BeaconofLight",
PRIEST = "Interface\\Icons\\Spell_Holy_PowerWordShield",
ROGUE = "Interface\\Icons\\Ability_Stealth",
SHAMAN = "Interface\\Icons\\Spell_Nature_BloodLust",
WARLOCK = "Interface\\Icons\\Spell_Shadow_CurseOfTounges",
WARRIOR = "Interface\\Icons\\Ability_Warrior_InnerRage",
}
local ACHIEVEMENT_RULE_ICONS = {
actionCam = "Interface\\Icons\\INV_Misc_Spyglass_02",
auctionHouse = "Interface\\Icons\\INV_Misc_Coin_02",
bank = "Interface\\Icons\\INV_Misc_Bag_08",
consumables = "Interface\\Icons\\INV_Potion_54",
dungeonRepeat = "Interface\\Icons\\Achievement_Dungeon_GloryoftheRaider",
enchants = "Interface\\Icons\\Trade_Engraving",
explorerMode = "Interface\\Icons\\INV_Misc_Map_01",
flightPaths = "Interface\\Icons\\Ability_Mount_Gryphon_01",
flying = "Interface\\Icons\\Ability_Mount_Wyvern_01",
gearQuality = "Interface\\Icons\\INV_Chest_Cloth_17",
guildBank = "Interface\\Icons\\INV_Misc_Gem_Variety_01",
heirlooms = "Interface\\Icons\\INV_Misc_Cape_18",
instancedPvP = "Interface\\Icons\\Achievement_BG_winWSG",
mailbox = "Interface\\Icons\\INV_Letter_15",
maxLevelGap = "Interface\\Icons\\Achievement_GuildPerk_WorkingOvertime_Rank2",
mounts = "Interface\\Icons\\Ability_Mount_RidingHorse",
trade = "Interface\\Icons\\INV_Misc_Bag_10",
unsyncedMembers = "Interface\\Icons\\Achievement_GuildPerk_EverybodysFriend",
warbandBank = "Interface\\Icons\\INV_Misc_EngGizmos_17",
WHITE_GRAY_ONLY = "Interface\\Icons\\INV_Chest_Cloth_17",
}
local ACHIEVEMENT_KIND_ICONS = {
BINARY = "Interface\\Icons\\Achievement_General",
CAMERA_BRONZE_VIGIL_NO_FLIGHT_PATHS_MAX = "Interface\\Icons\\INV_Shield_05",
CAMERA_MAX = "Interface\\Icons\\INV_Misc_Spyglass_02",
CHEF_SPECIAL_MAX = "Interface\\Icons\\INV_Misc_Food_15",
CLEAN_MAX = "Interface\\Icons\\INV_Misc_Rune_01",
COMPLETION_AWARD = "Interface\\Icons\\INV_Letter_18",
GEAR_QUALITY_CRAFTED_MAX = "Interface\\Icons\\Trade_BlackSmithing",
GEAR_QUALITY_MAX = "Interface\\Icons\\INV_Chest_Cloth_17",
GROUPED_MAX = "Interface\\Icons\\Achievement_GuildPerk_HastyHearth",
BRONZEMAN_MAX = "Interface\\Icons\\INV_Ingot_02",
MAX_LEVEL = "Interface\\Icons\\INV_Misc_Trophy_Argent",
RULE_UNCHANGED_MAX = "Interface\\Icons\\INV_Misc_Note_05",
}
local ACHIEVEMENT_CLEAN_LEVEL_ICONS = {
[10] = "Interface\\Icons\\INV_Misc_Rune_10",
[20] = "Interface\\Icons\\INV_Misc_Rune_11",
}
local GROUPING_OPTIONS = {
{ text = "Group", value = "SYNCED_GROUP_ALLOWED" },
{ text = "Solo Only", value = "SOLO_SELF_FOUND" },
}
local GEAR_OPTIONS = {
{ text = "White/gray only", value = "WHITE_GRAY_ONLY" },
{ text = "Green or lower", value = "GREEN_OR_LOWER" },
{ text = "Blue or lower", value = "BLUE_OR_LOWER" },
}
local ECONOMY_RULES = {
{ label = "Allow Auction House", key = "auctionHouse" },
{ label = "Allow Mailbox", key = "mailbox" },
{ label = "Allow Trade", key = "trade" },
{ label = "Allow Bank", key = "bank" },
{ label = "Allow Warband Bank", key = "warbandBank" },
{ label = "Allow Guild Bank", key = "guildBank" },
}
local MOVEMENT_RULES = {
{
label = "Allow Mounts",
key = "mounts",
tooltip = "Allows ground mount-style travel. Worgen Running Wild and Druid land Travel/Mount Form count as ground mounts.",
},
{
label = "Allow Flying Mounts",
key = "flying",
tooltip = "Allows player-controlled flying. Druid Flight Form and Dracthyr Soar count as flying mounts.",
},
{ label = "Allow Flight Paths", key = "flightPaths" },
}
local UNSYNCED_PARTY_TOOLTIP = "Checked: You may gain XP, level, and enter dungeons with players outside your Softcore run. They stay outside your run unless you use Party Sync.\n\nUnchecked: XP, leveling, and dungeons require synced run members. Follower dungeon NPCs do not count."
local EDITABLE_RULE_ORDER = {
"groupingMode",
"unsyncedMembers",
"instanceWithUnsyncedPlayers",
"auctionHouse",
"mailbox",
"trade",
"bank",
"warbandBank",
"guildBank",
"mounts",
"flying",
"flightPaths",
"gearQuality",
"selfCraftedGearAllowed",
"heirlooms",
"enchants",
"maxLevelGap",
"maxLevelGapValue",
"dungeonRepeat",
"consumables",
"instancedPvP",
"actionCam",
"explorerMode",
}
local function Print(message)
DEFAULT_CHAT_FRAME:AddMessage("|cff4ade80Softcore:|r " .. tostring(message))
end
local function FormatTime(timestamp)
if not timestamp then return "never" end
return date("%Y-%m-%d %H:%M:%S", timestamp)
end
local function FormatClock(timestamp)
if not timestamp then return "never" end
return date("%H:%M", timestamp)
end
local function FormatElapsed(startTime)
if not startTime then return "" end
local elapsed = time() - startTime
if elapsed < 0 then elapsed = 0 end
local h = math.floor(elapsed / 3600)
local m = math.floor((elapsed % 3600) / 60)
if h > 0 then
return string.format("%dh %02dm", h, m)
end
return string.format("%dm", m)
end
local function FormatDuration(seconds)
if SC.FormatDuration then
return SC:FormatDuration(seconds)
end
seconds = tonumber(seconds or 0) or 0
local h = math.floor(seconds / 3600)
local m = math.floor((seconds % 3600) / 60)
if h > 0 then
return string.format("%dh %02dm", h, m)
end
return string.format("%dm", m)
end
local function Trunc(str, maxLen)
str = tostring(str or "")
if #str <= maxLen then return str end
return string.sub(str, 1, maxLen - 2) .. ".."
end
local function FormatPlayerLabel(playerKey)
if SC.FormatPlayerLabel then
return SC:FormatPlayerLabel(playerKey)
end
local name = string.match(tostring(playerKey or "Unknown"), "^([^-]+)")
return name or tostring(playerKey or "Unknown")
end
local function SetLine(fontString, label, value)
fontString:SetText(label .. ": " .. tostring(value))
end
local LOG_EVENT_GROUP_COLORS = {
achievement = GOLD_TEXT,
character = GREEN_TEXT,
failure = RED_TEXT,
party = BLUE_TEXT,
proposal = ORANGE_TEXT,
rules = PURPLE_TEXT,
run = GREEN_TEXT,
system = MUTED_TEXT,
violation = GOLD_TEXT,
world = BODY_TEXT,
}
local LOG_HIDDEN_EVENTS = {
GROUP_ROSTER = true,
ZONE_CHANGED = true,
}
local LOG_EVENT_DISPLAY = {
ACHIEVEMENT_EARNED = { label = "Achievement", group = "achievement" },
DEATH = { label = "Death", group = "failure" },
EXPLORER_MODE_ENABLED = { label = "Explorer Mode", group = "system" },
EXPLORER_MODE_RESTORED = { label = "Explorer Mode", group = "system" },
FORCED_MOVEMENT = { label = "Forced Movement", group = "system" },
FORCED_MOVEMENT_ENDED = { label = "Forced Movement ..", group = "system" },
GROUP_ROSTER = { label = "Group Changed", group = "party" },
INSTANCE_ENTERED = { label = "Instance", group = "world" },
LEVEL_GAP_EXCEEDED = { label = "Level Gap", group = "party" },
LEVEL_UP = { label = "Level Up", group = "character" },
PARTICIPANT_ADDED = { label = "Joined Run", group = "party" },
PARTICIPANT_DISCOVERED = { label = "Party Synced", group = "party" },
PARTICIPANT_FAILED = { label = "Member Failed", group = "failure" },
PARTICIPANT_OUT_OF_PARTY = { label = "Left Party", group = "party" },
PARTICIPANT_RETIRED = { label = "Retired", group = "failure" },
PROPOSAL_ACCEPT_SYNC = { label = "Accepted", group = "proposal" },
PROPOSAL_ACCEPTED = { label = "Accepted", group = "proposal" },
PROPOSAL_BUSY_DECLINED = { label = "Proposal Busy", group = "proposal" },
PROPOSAL_CANCELLED = { label = "Cancelled", group = "proposal" },
PROPOSAL_CONFIRMED = { label = "Confirmed", group = "proposal" },
PROPOSAL_CREATED = { label = "Proposal", group = "proposal" },
PROPOSAL_DECLINED = { label = "Declined", group = "proposal" },
PROPOSAL_DECLINE_SYNC = { label = "Declined", group = "proposal" },
PROPOSAL_EXPIRED = { label = "Expired", group = "proposal" },
PROPOSAL_HASH_MISMATCH = { label = "Rules Mismatch", group = "proposal" },
PROPOSAL_OBSERVED = { label = "Proposal Seen", group = "proposal" },
PROPOSAL_RESPONSE_UNKNOWN = { label = "Unknown Reply", group = "proposal" },
PROPOSAL_VERSION_MISMATCH = { label = "Version Mismatch", group = "proposal" },
PVP_ADVISORY = { label = "PvP Advisory", group = "world" },
RULE_AMENDMENT_ACCEPTED = { label = "Rule Accepted", group = "rules" },
RULE_AMENDMENT_APPLIED = { label = "Rules Applied", group = "rules" },
RULE_AMENDMENT_DECLINED = { label = "Rule Declined", group = "rules" },
RULE_AMENDMENT_PROPOSED = { label = "Rule Proposal", group = "rules" },
RULE_AMENDMENT_RECEIVED = { label = "Rule Proposal", group = "rules" },
RULE_AMENDMENT_SUMMARY = { label = "Rules Amended", group = "rules" },
RULE_CHANGED = { label = "Rule Changed", group = "rules" },
RULE_LOG = { label = "Rule Notice", group = "rules" },
RULE_UNKNOWN_OUTCOME = { label = "Rule Notice", group = "rules" },
RUN_RESET = { label = "Run Reset", group = "run" },
RUN_START = { label = "Run Started", group = "run" },
RUN_COMPLETED = { label = "Run Completed", group = "run" },
RUN_SYNCED = { label = "Run Synced", group = "run" },
VIOLATION_ADDED = { label = "Violation", group = "violation" },
VIOLATION_CLEARED = { label = "Cleared", group = "violation" },
ZONE_CHANGED = { label = "Zone", group = "world" },
}
local function HumanizeEventKind(kind)
local text = string.gsub(string.lower(tostring(kind or "")), "_", " ")
text = string.gsub(text, "(%a)([%w']*)", function(first, rest)
return string.upper(first) .. rest
end)
return text ~= "" and text or "Event"
end
local function FormatLogEvent(entry)
local kind = tostring(entry and entry.kind or "")
local display = LOG_EVENT_DISPLAY[kind]
if display then
return display.label, LOG_EVENT_GROUP_COLORS[display.group] or BODY_TEXT
end
return HumanizeEventKind(kind), LOG_EVENT_GROUP_COLORS.system
end
local function ShouldShowLogEntry(entry)
local kind = tostring(entry and entry.kind or "")
if LOG_HIDDEN_EVENTS[kind] then
return false
end
if SC.ShouldDisplayLogEntryInUI and not SC:ShouldDisplayLogEntryInUI(entry) then
return false
end
return true
end
local function GetVisibleLogEntries(log, maxEntries)
local entries = {}
local totalVisible = 0
for index = #log, 1, -1 do
local entry = log[index]
if ShouldShowLogEntry(entry) then
totalVisible = totalVisible + 1
if not maxEntries or #entries < maxEntries then
table.insert(entries, entry)
end
end
end
return entries, totalVisible
end
local LOG_VIOLATION_LABELS = {
auctionHouse = "Auction House",
bank = "Bank",
consumables = "Consumable",
death = "Death",
enchants = "Enchant",
flying = "Flying",
failedMemberBlocksParty = "Failed Party Member",
gearQuality = "Gear",
guildBank = "Guild Bank",
mailbox = "Mailbox",
mounts = "Mount",
trade = "Trade",
warbandBank = "Warband Bank",
}
local function FormatViolationLogLabel(violationType)
local raw = tostring(violationType or "")
return LOG_VIOLATION_LABELS[raw] or HumanizeEventKind(raw)
end
local function ExtractItemLink(text)
local raw = tostring(text or "")
return string.match(raw, "(|c.-|Hitem:.-|h%[.-%]|h|r)")
or string.match(raw, "(|Hitem:.-|h%[.-%]|h)")
end
local function FindViolationById(violationId)
if not violationId then return nil end
local db = SC.db or SoftcoreDB
for _, violation in ipairs((db and db.violations) or {}) do
if violation.id == violationId or violation.violationId == violationId then
return violation
end
end
return nil
end
local function SetCompactText(fontString, message, maxLen)
if string.find(tostring(message or ""), "|Hitem:", 1, true) then
fontString:SetText(message)
return
end
fontString:SetText(Trunc(message, maxLen))
end
local function FormatViolationDetail(violation)
local detail = violation and violation.detail
local itemLink = ExtractItemLink(detail)
if itemLink then
return "Item: " .. itemLink
end
return tostring(detail or "")
end
local function FormatViolationLogMessage(kind, violationType, violationDetail, entry)
local label = FormatViolationLogLabel(violationType)
local sourceViolation = entry and FindViolationById(entry.violationId)
local itemLink = ExtractItemLink(violationDetail)
or ExtractItemLink(entry and entry.message)
or ExtractItemLink(sourceViolation and sourceViolation.detail)
if itemLink then
return label .. " Violation: " .. itemLink
end
if violationType == "gearQuality" then
if kind == "VIOLATION_CLEARED" then
return "Cleared gear violation."
end
return "Gear violation."
end
if kind == "VIOLATION_CLEARED" then
return "Cleared " .. label .. "."
end
if violationDetail and violationDetail ~= "" then
return label .. ": " .. tostring(violationDetail)
end
return label .. " violation."
end
local function FormatLogMessage(entry)
local kind = tostring(entry and entry.kind or "")
local violationType = entry and entry.violationType
local violationDetail = entry and (entry.violationDetail or entry.message)
if kind == "VIOLATION_ADDED" and violationType then
return FormatViolationLogMessage(kind, violationType, violationDetail, entry)
end
if kind == "VIOLATION_CLEARED" and violationType then
return FormatViolationLogMessage(kind, violationType, violationDetail, entry)
end
if kind == "RUN_START" then
local level = string.match(tostring(entry and entry.message or ""), "level (%d+)")
if level then
return "Started at level " .. level .. "."
end
end
return tostring(entry and entry.message or "")
end
local function IsActiveRun()
local db = SC.db or SoftcoreDB
return db and db.run and db.run.active
end
local function GetDefaultTab()
return IsActiveRun() and TAB_OVERVIEW or TAB_RUN
end
local function NormalizeTab(tab)
if tab == "START" or tab == "RULES" then
return TAB_RUN
end
if tab == "STATUS" or tab == "PARTY" then
return TAB_OVERVIEW
end
if tab == TAB_LOG or tab == TAB_RUN or tab == TAB_OVERVIEW or tab == TAB_VIOLATIONS or tab == TAB_ACHIEVEMENTS then
return tab
end
return GetDefaultTab()
end
local function CreateButton(parent, label, width, height)
local button = CreateFrame("Button", nil, parent, "UIPanelButtonTemplate")
button:SetSize(width or 90, height or 24)
button:SetText(label)
return button
end
local function CreatePanel(parent)
local panel = CreateFrame("Frame", nil, parent)
panel:SetSize(PANEL_WIDTH, PANEL_HEIGHT)
panel:SetPoint("TOPLEFT", parent, "TOPLEFT", 24, -110)
return panel
end
local function CenteredOffset(containerWidth, childWidth)
return math.floor(((containerWidth or 0) - (childWidth or 0)) / 2)
end
local function ApplyParchmentBackdrop(frame)
frame:SetBackdrop({
bgFile = "Interface\\Buttons\\WHITE8X8",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Gold-Border",
tile = false, edgeSize = 32,
insets = { left = 4, right = 4, top = 4, bottom = 4 },
})
frame:SetBackdropColor(0.12, 0.075, 0.035, 0.98)
frame:SetBackdropBorderColor(0.72, 0.56, 0.22, 1)
end
local function CreateDivider(parent, x, y, width)
local divider = parent:CreateTexture(nil, "ARTWORK")
divider:SetHeight(1)
divider:SetPoint("TOPLEFT", parent, "TOPLEFT", x, y)
divider:SetWidth(width or PANEL_WIDTH)
divider:SetColorTexture(0.72, 0.49, 0.18, 0.42)
return divider
end
local function CreateSectionHeader(parent, text, x, y, width)
local header = CreateFrame("Frame", nil, parent)
header:SetPoint("TOPLEFT", parent, "TOPLEFT", x, y)
header:SetSize(width or 260, 22)
local fs = header:CreateFontString(nil, "OVERLAY", "GameFontNormal")
fs:SetPoint("TOPLEFT", header, "TOPLEFT", 0, 0)
fs:SetWidth(width or 260)
fs:SetJustifyH("LEFT")
fs:SetText("|cffffd100" .. text .. "|r")
CreateDivider(header, 0, -18, width or 260)
return header
end
local function CreateField(parent, x, y, width)
local fs = parent:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
fs:SetPoint("TOPLEFT", parent, "TOPLEFT", x, y)
fs:SetWidth(width or (PANEL_WIDTH - 40))
fs:SetJustifyH("LEFT")
fs:SetTextColor(BODY_TEXT.r, BODY_TEXT.g, BODY_TEXT.b)
fs:SetText("")
return fs
end
local function CreateLabel(parent, text, x, y, template, width)
local fs = CreateField(parent, x, y, width or 220)
fs:SetFontObject(_G[template or "GameFontNormalSmall"])
if template == "GameFontNormal" then
fs:SetTextColor(GOLD_TEXT.r, GOLD_TEXT.g, GOLD_TEXT.b)
else
fs:SetTextColor(BODY_TEXT.r, BODY_TEXT.g, BODY_TEXT.b)
end
fs:SetText(text)
return fs
end
local function CreateAuditColumn(parent, text, x, width)
local label = CreateLabel(parent, text, x, AUDIT_LIST_LAYOUT.COLUMN_TOP, "GameFontNormalSmall", width)
label:SetTextColor(MUTED_TEXT.r, MUTED_TEXT.g, MUTED_TEXT.b)
return label
end
local function CreateAuditListFooter(parent)
local footer = CreateFrame("Frame", nil, parent)
footer:SetPoint("BOTTOMLEFT", parent, "BOTTOMLEFT", 0, 0)
footer:SetPoint("BOTTOMRIGHT", parent, "BOTTOMRIGHT", 0, 0)
footer:SetHeight(AUDIT_LIST_LAYOUT.FOOTER_HEIGHT)
local divider = footer:CreateTexture(nil, "ARTWORK")
divider:SetHeight(1)
divider:SetPoint("TOPLEFT", footer, "TOPLEFT", 0, 0)
divider:SetPoint("TOPRIGHT", footer, "TOPRIGHT", -AUDIT_LIST_LAYOUT.SCROLL_RIGHT_INSET, 0)
divider:SetColorTexture(0.72, 0.49, 0.18, 0.30)
footer.text = CreateField(footer, 0, -11, 500)
footer.text:SetTextColor(MUTED_TEXT.r, MUTED_TEXT.g, MUTED_TEXT.b)
return footer
end
local function CreateAuditRow(parent, index)
local row = CreateFrame("Frame", nil, parent)
row:SetSize(AUDIT_LIST_LAYOUT.CONTENT_WIDTH, AUDIT_LIST_LAYOUT.ROW_HEIGHT)
row:SetPoint("TOPLEFT", parent, "TOPLEFT", 0, AUDIT_LIST_LAYOUT.ROW_TOP - ((index - 1) * AUDIT_LIST_LAYOUT.ROW_HEIGHT))
row:EnableMouse(true)
row.bg = row:CreateTexture(nil, "BACKGROUND")
row.bg:SetAllPoints(row)
row.bg:SetColorTexture(0.82, 0.58, 0.22, index % 2 == 0 and 0.08 or 0.035)
row.accent = row:CreateTexture(nil, "ARTWORK")
row.accent:SetPoint("TOPLEFT", row, "TOPLEFT", 0, -3)
row.accent:SetPoint("BOTTOMLEFT", row, "BOTTOMLEFT", 0, 3)
row.accent:SetWidth(3)
row.accent:SetColorTexture(GOLD_TEXT.r, GOLD_TEXT.g, GOLD_TEXT.b, 0.85)
return row
end
local function SetAuditRowAccent(row, color)
if not row or not row.accent then return end
color = color or BODY_TEXT
row.accent:SetColorTexture(color.r, color.g, color.b, 0.85)
end
local function SetAuditRowTooltip(row, title, body)
if not row then return end
if (not title or title == "") and (not body or body == "") then
row:SetScript("OnEnter", nil)
row:SetScript("OnLeave", nil)
return
end
row:SetScript("OnEnter", function(self)
if not GameTooltip then return end
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
if title and title ~= "" then
GameTooltip:AddLine(title, GOLD_TEXT.r, GOLD_TEXT.g, GOLD_TEXT.b)
end
if body and body ~= "" then
GameTooltip:AddLine(body, BODY_TEXT.r, BODY_TEXT.g, BODY_TEXT.b, true)
end
GameTooltip:Show()
end)
row:SetScript("OnLeave", function()
if GameTooltip then
GameTooltip:Hide()
end
end)
end
function RUN_LAYOUT:SectionHeight(rowCount, extraHeight)
rowCount = math.max(tonumber(rowCount or 1) or 1, 1)
return self.SECTION_CONTENT_TOP + ((rowCount - 1) * self.ROW_HEIGHT) + self.SECTION_ROW_CONTROL_HEIGHT + (extraHeight or 0)
end
function RUN_LAYOUT:CreateRow(parent, x, y, width)
local row = CreateFrame("Frame", nil, parent)
row:SetPoint("TOPLEFT", parent, "TOPLEFT", x or 0, y or 0)
row:SetSize(width or self.COLUMN_WIDTH, self.ROW_HEIGHT)
return row
end
function RUN_LAYOUT:PlaceRowLabel(row, label, x, width)
if not row or not label then return end
label:ClearAllPoints()
label:SetPoint("LEFT", row, "LEFT", x or 0, 0)
label:SetWidth(width or 120)
label:SetJustifyH("LEFT")
end
function RUN_LAYOUT:PlaceRowDropdown(row, dropdown, x)
if not row or not dropdown then return end
dropdown:ClearAllPoints()
dropdown:SetPoint("LEFT", row, "LEFT", (x or 0) + self.DROPDOWN_X_OFFSET, 0)
end
function RUN_LAYOUT:PlaceRowCheckbox(row, checkbox, x)
if not row or not checkbox then return end
checkbox:ClearAllPoints()
checkbox:SetPoint("LEFT", row, "LEFT", x or 0, 0)
end
function RUN_LAYOUT:PlaceCheckboxText(checkbox, width)
if not checkbox or not checkbox.label then return end
checkbox.label:ClearAllPoints()
checkbox.label:SetPoint("LEFT", checkbox, "RIGHT", self.CHECKBOX_LABEL_GAP, 0)
checkbox.label:SetWidth(width or 0)
checkbox.label:SetJustifyH("LEFT")
end
-- Place the label to the LEFT of the checkbox (right-justified into it). Use for inline checkbox groups
-- where the label must precede the checkbox so the association is unambiguous.
function RUN_LAYOUT:PlaceCheckboxTextLeft(checkbox, width)
if not checkbox or not checkbox.label then return end
checkbox.label:ClearAllPoints()
checkbox.label:SetPoint("RIGHT", checkbox, "LEFT", -self.CHECKBOX_LABEL_GAP, 0)
checkbox.label:SetWidth(width or 0)
checkbox.label:SetJustifyH("RIGHT")
end
-- Place a dropdown immediately after a label, accounting for the dropdown frame's internal x offset.
function RUN_LAYOUT:PlaceDropdownAfterLabel(label, dropdown, gap)
if not label or not dropdown then return end
dropdown:ClearAllPoints()
dropdown:SetPoint("LEFT", label, "RIGHT", (gap or self.INLINE_FIELD_GAP) + self.DROPDOWN_X_OFFSET, 0)
end
function RUN_LAYOUT:PlaceInlineField(anchor, label, box)
if not anchor or not label or not box then return end
label:ClearAllPoints()
label:SetPoint("LEFT", anchor, "RIGHT", self.INLINE_FIELD_GAP, 0)
label:SetJustifyH("LEFT")
box:ClearAllPoints()
box:SetPoint("LEFT", label, "RIGHT", 4, 0)
end
local function CreateOverviewCard(parent, title, x, y, width, height, options)
options = options or {}
local card = CreateFrame("Frame", nil, parent, "BackdropTemplate")
card:SetPoint("TOPLEFT", parent, "TOPLEFT", x, y)
card:SetSize(width or 160, height or 86)
if card.SetBackdrop then
card:SetBackdrop({
bgFile = "Interface\\Buttons\\WHITE8X8",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true,
tileSize = 16,
edgeSize = 12,
insets = { left = 3, right = 3, top = 3, bottom = 3 },
})
card:SetBackdropColor(0.08, 0.045, 0.018, 0.82)
card:SetBackdropBorderColor(0.68, 0.48, 0.18, 0.95)
end
card.title = card:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
card.title:SetPoint("TOPLEFT", card, "TOPLEFT", 12, -9)
card.title:SetTextColor(GOLD_TEXT.r, GOLD_TEXT.g, GOLD_TEXT.b)
card.title:SetText(title)
card.value = card:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
card.value:SetPoint("TOPLEFT", card.title, "BOTTOMLEFT", 0, -8)
card.value:SetWidth((width or 160) - 24)
card.value:SetJustifyH("LEFT")
card.value:SetTextColor(BODY_TEXT.r, BODY_TEXT.g, BODY_TEXT.b)
if options.valueFont and _G[options.valueFont] then
card.value:SetFontObject(_G[options.valueFont])
end
if options.centerValue then
card.value:ClearAllPoints()
card.value:SetPoint("LEFT", card, "LEFT", 12, -8)
card.value:SetPoint("RIGHT", card, "RIGHT", -12, -8)
card.value:SetJustifyH("CENTER")
end
card.detail = card:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
card.detail:SetPoint("TOPLEFT", card.value, "BOTTOMLEFT", 0, -8)
card.detail:SetWidth((width or 160) - 24)
card.detail:SetJustifyH("LEFT")
card.detail:SetTextColor(MUTED_TEXT.r, MUTED_TEXT.g, MUTED_TEXT.b)
if options.hideDetail then
card.detail:Hide()
end
return card
end
local function SetOverviewCardTone(card, color)
if not card or not color then return end
if card.SetBackdropColor then
card:SetBackdropColor(color.r * 0.10, color.g * 0.075, color.b * 0.045, 0.86)
card:SetBackdropBorderColor(color.r, color.g, color.b, 0.88)
end
end
local function CreateOverviewMetricGrid(parent, specs, x, y, width, height, gap)
local cards = {}
local order = {}
local count = #specs
local cardWidth = math.floor(((width or OVERVIEW_LAYOUT.CONTENT_WIDTH) - ((count - 1) * (gap or 0))) / count)
for index, spec in ipairs(specs) do
local left = x + ((index - 1) * (cardWidth + (gap or 0)))
local card = CreateOverviewCard(parent, spec.title, left, y, cardWidth, height, {
centerValue = true,
hideDetail = true,
valueFont = "GameFontNormalLarge",
})
card.metricKey = spec.key
cards[spec.key] = card
table.insert(order, card)
end
return cards, order
end
local function CreateRunSection(parent, title, x, y, width, height)
local section = CreateFrame("Frame", nil, parent)
section:SetPoint("TOPLEFT", parent, "TOPLEFT", x, y)
section:SetSize(width, height)
section.fixedHeight = height
section.children = {}
section.title = section:CreateFontString(nil, "OVERLAY", "GameFontNormal")
section.title:SetPoint("TOPLEFT", section, "TOPLEFT", 0, 0)
section.title:SetWidth(width)
section.title:SetJustifyH("LEFT")
section.title:SetTextColor(GOLD_TEXT.r, GOLD_TEXT.g, GOLD_TEXT.b)
section.title:SetText(title)
section.divider = section:CreateTexture(nil, "ARTWORK")
section.divider:SetHeight(1)
section.divider:SetPoint("TOPLEFT", section, "TOPLEFT", 0, -18)
section.divider:SetPoint("TOPRIGHT", section, "TOPRIGHT", 0, -18)
section.divider:SetColorTexture(0.72, 0.49, 0.18, 0.42)
section.content = CreateFrame("Frame", nil, section)
section.content:SetPoint("TOPLEFT", section, "TOPLEFT", 0, -RUN_LAYOUT.SECTION_CONTENT_TOP)
section.content:SetPoint("BOTTOMRIGHT", section, "BOTTOMRIGHT", 0, 0)
function section:Refresh()
self:SetHeight(self.fixedHeight)
self.content:Show()
self.divider:Show()
for _, child in ipairs(self.children) do
child:SetShown(child.softcoreDesiredShown ~= false)
end
end
section:Refresh()
return section
end
local function RegisterRunControl(start, control, section)
table.insert(start.controls, control)
if section then
table.insert(section.children, control)
control.softcoreRunSection = section
end
return control
end
local function SetRunControlShown(control, shown)
if not control then return end
control.softcoreDesiredShown = shown
control:SetShown(shown)
end
local function RefreshRunSections(start)
if not start or not start.sections then return end
for _, section in ipairs(start.sections) do
section:Refresh()
end
if start.charterSection then
local function place(section, x, y)
if not section then return y end
section:ClearAllPoints()
section:SetPoint("TOPLEFT", start.panel, "TOPLEFT", x, y)
return y - section:GetHeight() - RUN_LAYOUT.SECTION_GAP
end
start.charterSection:ClearAllPoints()
start.charterSection:SetPoint("TOPLEFT", start.panel, "TOPLEFT", 0, 0)
local bodyY = -start.charterSection:GetHeight() - RUN_LAYOUT.SECTION_GAP
local leftY = bodyY
leftY = place(start.accessSection, 0, leftY)
place(start.travelSection, 0, leftY)
local rightY = bodyY
rightY = place(start.gearSection, RUN_LAYOUT.RIGHT_COLUMN_X, rightY)
place(start.partyDungeonSection, RUN_LAYOUT.RIGHT_COLUMN_X, rightY)
end
end
local function SetCardValue(card, value, detail, color)
if not card then return end
card.value:SetText(tostring(value or ""))
if card.detail then
card.detail:SetText(tostring(detail or ""))
if detail and detail ~= "" then
card.detail:Show()
else
card.detail:Hide()
end
end
color = color or BODY_TEXT
card.value:SetTextColor(color.r, color.g, color.b)
SetOverviewCardTone(card, color)
end
local completionAwardFrame
local function CleanAwardText(fontString)
if not fontString then return fontString end
if fontString.SetShadowColor then
fontString:SetShadowColor(0, 0, 0, 0)
end
if fontString.SetShadowOffset then
fontString:SetShadowOffset(0, 0)