-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathProfiles.lua
More file actions
815 lines (780 loc) · 27 KB
/
Copy pathProfiles.lua
File metadata and controls
815 lines (780 loc) · 27 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
local _, NSI = ...
function NSI:AddMissingDefaults()
local defaults = {
-- Saved data tables (user-populated, empty by default)
NickNames = {},
Reminders = {},
PersonalReminders = {},
InviteList = {},
AssignmentSettings = {},
CooldownList = {},
PASounds = {
UseDefaultPASounds = false,
UseDefaultMPlusPASounds = false,
},
PhaseTimings = {},
-- Active reminder persistence
ActiveReminder = nil,
ActivePersonalReminder = {},
StoredSharedReminder = nil,
StoredPersonalReminder = {},
-- NSUI / timeline window
NSUI = {
scale = 1,
timeline_window = {
scale = 1,
},
AutoComplete = {
Addon = {},
},
reminders_frame = {},
},
-- General Settings
Settings = {
Language = "Auto",
GlobalFont = "Expressway",
GlobalFontSize = 20,
GlobalEncounterFontSize = 20,
GlobalFontFlags = "OUTLINE",
MyNickName = nil,
ShareNickNames = 4,
AcceptNickNames = 4,
NickNamesSyncAccept = 2,
NickNamesSyncSend = 3,
GlobalNickNames = false,
TTS = true,
TTSVolume = 50,
TTSVoice = 1,
TTSOverlap = true,
Minimap = {hide = false},
VersionCheckPresets = {},
CooldownThreshold = 20,
MissingRaidBuffs = true,
CheckCooldowns = false,
UnreadyOnCooldown = false,
Debug = false,
GenericDisplay = {
Anchor = "CENTER",
relativeTo = "CENTER",
xOffset = -200,
yOffset = 400,
},
},
Alerts = {
ReloeReminders = false,
Groups = {},
},
-- Reminder Settings
ReminderSettings = {
enabled = true,
PersNote = true,
SpellTTS = true,
TextTTS = true,
TTSOverSoundfile = false,
SpellDuration = 10,
TextDuration = 10,
SpellCountdown = 0,
TextCountdown = 0,
SpellDisplayType = "Icon",
SpellName = true,
SpellTTSTimer = 5,
TextTTSTimer = 5,
AutoShare = false,
OnlyReceiveGuild = false,
NoteCountdown = false,
ClearOnKill = true,
PersonalReminderFrame = {
enabled = true,
Width = 500,
Height = 600,
Anchor = "TOPLEFT",
relativeTo = "TOPLEFT",
xOffset = 500,
yOffset = 0,
Font = "Expressway",
FontSize = 14,
BGcolor = { 0, 0, 0, 0.3 },
},
ReminderFrame = {
enabled = false,
Width = 500,
Height = 600,
Anchor = "TOPLEFT",
relativeTo = "TOPLEFT",
xOffset = 0,
yOffset = 0,
Font = "Expressway",
FontSize = 14,
BGcolor = { 0, 0, 0, 0.3 },
},
ExtraReminderFrame = {
enabled = false,
Width = 500,
Height = 600,
Anchor = "TOPLEFT",
relativeTo = "TOPLEFT",
xOffset = 0,
yOffset = 0,
Font = "Expressway",
FontSize = 14,
BGcolor = { 0, 0, 0, 0.3 },
},
IconSettings = {
GrowDirection = "Down",
Anchor = "CENTER",
relativeTo = "CENTER",
Sticky = 5,
textColors = { 1, 1, 1, 1 },
borderColors = { 0, 0, 0, 1 },
xOffset = -500,
yOffset = 400,
xTextOffset = 0,
yTextOffset = 0,
xTimer = 0,
yTimer = 0,
Font = "Expressway",
FontSize = 30,
TimerFontSize = 40,
Width = 80,
Height = 80,
Spacing = -1,
Glow = 0,
Zoom = 0,
HideTimerText = false,
HideSwipe = false,
Decimals = 3,
},
BarSettings = {
GrowDirection = "Up",
Anchor = "CENTER",
relativeTo = "CENTER",
Sticky = 5,
Width = 300,
Height = 40,
xIcon = 0,
yIcon = 0,
textColors = { 1, 1, 1, 1 },
barColors = { 1, 0, 0, 1 },
backgroundColors = { 0, 0, 0, 0.8 },
borderColors = { 0, 0, 0, 1 },
Texture = "Atrocity",
xOffset = -400,
yOffset = 0,
xTextOffset = 2,
yTextOffset = 0,
xTimer = -2,
yTimer = 0,
Font = "Expressway",
FontSize = 22,
TimerFontSize = 22,
Spacing = -1,
HideTimerText = false,
Decimals = 3,
},
TextSettings = {
textColors = { 1, 1, 1, 1 },
GrowDirection = "Up",
Anchor = "CENTER",
relativeTo = "CENTER",
Sticky = 0,
xOffset = 0,
yOffset = 200,
Font = "Expressway",
FontSize = 50,
Spacing = 1,
HideTimerText = false,
Decimals = 3,
},
CircleSettings = {
GrowDirection = "Up",
Anchor = "CENTER",
relativeTo = "CENTER",
Sticky = 0,
xOffset = 0,
yOffset = -200,
textColors = { 1, 1, 1, 1 },
ringColors = { 1, 1, 1, 1 },
Size = 80,
Texture = [[Interface\AddOns\NorthernSkyRaidTools\Media\Textures\circle_8px.png]],
Font = "Expressway",
FontSize = 18,
TextPosition = "Top",
xTextOffset = 0,
yTextOffset = 4,
Spacing = 5,
showBackground = false,
HideTimerText = false,
Decimals = 3,
},
UnitIconSettings = {
Position = "CENTER",
xOffset = 0,
yOffset = 0,
Width = 25,
Height = 25,
},
GlowSettings = {
colors = { 0, 1, 0, 1 },
Lines = 10,
Frequency = 0.2,
Length = 10,
Thickness = 4,
xOffset = 0,
yOffset = 0,
},
},
SharedNotes = {
},
PersonalNotes = {
},
-- Private Aura Settings
PASettings = {
Spacing = -1,
Limit = 5,
GrowDirection = "RIGHT",
enabled = false,
Width = 100,
Height = 100,
Anchor = "CENTER",
relativeTo = "CENTER",
xOffset = -450,
yOffset = -100,
PerRow = 10,
RowGrowDirection = "UP",
DebuffTypeBorder = false,
HideBorder = false,
StackScale = 2,
HideTooltip = false,
HideDurationText = false,
},
PATankSettings = {
Spacing = -1,
Limit = 5,
MultiTankGrowDirection = "UP",
GrowDirection = "LEFT",
enabled = false,
Width = 100,
Height = 100,
Anchor = "CENTER",
relativeTo = "CENTER",
xOffset = -549,
yOffset = -199,
HideBorder = false,
StackScale = 2,
HideTooltip = false,
HideDurationText = false,
},
PARaidSettings = {
PerRow = 3,
RowGrowDirection = "UP",
Spacing = -1,
Limit = 5,
GrowDirection = "RIGHT",
enabled = false,
Width = 25,
Height = 25,
Anchor = "BOTTOMLEFT",
relativeTo = "BOTTOMLEFT",
xOffset = 0,
yOffset = 0,
HideBorder = false,
StackScale = 1,
HideDurationText = false,
},
PATextSettings = {
Scale = 2.5,
xOffset = 0,
yOffset = -200,
enabled = false,
Anchor = "TOP",
relativeTo = "TOP",
},
-- Ready Check Settings
ReadyCheckSettings = {
RaidBuffCheck = false,
SoulstoneCheck = false,
CraftedCheck = false,
EnchantCheck = false,
GemCheck = false,
ItemLevelCheck = false,
RepairCheck = false,
TierCheck = false,
MissingItemCheck = false,
GatewayShardCheck = false,
SkipGatewayKeybindCheck = false,
SourceOfMagicCheck = false,
BlisteringScalesCheck = false,
SymbioticRelationshipCheck = false,
},
-- QoL Settings
QoL = {
GatewayUseableDisplay = false,
ResetBossDisplay = false,
LootBossReminder = false,
AutoRepair = false,
AutoInvite = false,
ConsumableNotificationDurationSeconds = 5,
TextDisplay = {
Anchor = "CENTER",
relativeTo = "CENTER",
xOffset = 0,
yOffset = 0,
FontSize = 30,
},
IconDisplay = {
Anchor = "TOP",
relativeTo = "TOP",
GrowDirection = "DOWN",
Scpaing = 5,
xOffset = 0,
yOffset = -350,
Width = 40,
Height = 40,
},
},
-- Encounter Alerts
EncounterAlerts = {
[3176] = {},
[3177] = {},
[3178] = {},
[3179] = {},
[3180] = {},
[3181] = {},
[3182] = {},
[3183] = {},
[3306] = {},
},
-- Interrupt Display
InterruptSettings = {
ShowBar = false,
Anchor = "CENTER",
relativeTo = "CENTER",
xOffset = -600,
yOffset = 400,
Width = 100,
Height = 100,
NumberxOffset = 0,
NumberyOffset = 0,
NumberAnchor = "CENTER",
NumberRelativeTo = "CENTER",
NamexOffset = 0,
NameyOffset = 10,
NameAnchor = "BOTTOM",
NameRelativeTo = "TOP",
NumberFont = "Expressway",
NumberFontFlags = "OUTLINE",
NumberFontSize = 60,
NameFont = "Expressway",
NameFontFlags = "OUTLINE",
NameFontSize = 30,
InterruptSound = "|cFF4BAAC8Interrupt|r",
InterruptNowColor = {0, 1, 0, 1},
InterruptNowTextColor = {1, 0, 0, 1},
InterruptNextColor = {1, 1, 0, 1},
InterruptNextTextColor = {1, 0, 0, 1},
InterruptDefaultColor = {1, 0, 0, 1},
InterruptDefaultTextColor = {1, 1, 1, 1},
},
Profiles = {},
ProfileKeys = {},
CurrentProfile = "default",
MainProfile = "default",
AutoLoadNote = {},
HasNewAlertStructure = true,
}
if not NSRT then
NSRT = {}
end
if not NSRT.HasNewAlertStructure then
NSRT.HasNewAlertStructure = true
NSRT.EncounterAlerts = {}
end
for k, v in pairs(NSRT.EncounterAlerts or {}) do
if v.enabled ~= nil then
v.enabled = nil
end
end
for k, v in pairs(defaults) do
if NSRT[k] == nil then
NSRT[k] = v
elseif type(v) == "table" then
if type(NSRT[k]) == "table" then
self:AddMissingTableDefaults(NSRT[k], v)
else
NSRT[k] = v
end
end
end
end
function NSI:AddMissingTableDefaults(NSRTTable, defaultsTable)
for k, v in pairs(defaultsTable) do
if NSRTTable[k] == nil then
NSRTTable[k] = v
elseif type(v) == "table" then
if type(NSRTTable[k]) == "table" then
self:AddMissingTableDefaults(NSRTTable[k], v)
else
NSRTTable[k] = v
end
end
end
end
local ignored = {
["Profiles"] = true,
["ProfileKeys"] = true,
["CurrentProfile"] = true,
["MainProfile"] = true,
["EncounterAlerts"] = true,
}
function NSI:GetProfileKey()
local CharName, Realm = UnitFullName("player")
if not Realm then
Realm = GetNormalizedRealmName()
end
return Realm and CharName.."-"..Realm
end
function NSI:SetMainProfile(name)
if NSRT.Profiles[name] then
NSRT.MainProfile = name
end
end
function NSI:CreateProfile(name, init)
if not name then
name = "default"
end
NSRT.Profiles = NSRT.Profiles or {}
NSRT.ProfileKeys = NSRT.ProfileKeys or {}
if NSRT.Profiles[name] then
self:LoadProfile(name)
return
end
NSRT.Profiles[name] = {}
self:SaveProfile()
if not name == "default" then
for k, v in pairs(NSRT) do
if not ignored[k] then
NSRT[k] = nil
end
end
end
self:AddMissingDefaults()
local ProfileKey = self:GetProfileKey()
NSRT.ProfileKeys[ProfileKey] = name
NSRT.CurrentProfile = name
if not init then self:SetReminder(NSRT.StoredPersonalReminder[ProfileKey], true) end
self:SaveProfile()
end
function NSI:LoadProfile(name, skipsave, init)
if not skipsave then self:SaveProfile() end
if NSRT.Profiles[name] then
for k, v in pairs(NSRT.Profiles[name]) do
if not ignored[k] then
NSRT[k] = type(v) == "table" and CopyTable(v) or v
end
end
local ProfileKey = self:GetProfileKey()
NSRT.ProfileKeys[ProfileKey] = name
NSRT.CurrentProfile = name
if not init then self:SetReminder(NSRT.StoredPersonalReminder[ProfileKey], true) end
self:AddMissingDefaults()
self:SaveProfile()
end
end
function NSI:SaveProfile()
if NSRT.CurrentProfile then
NSRT.Profiles[NSRT.CurrentProfile] = {}
for k, v in pairs(NSRT) do
if not ignored[k] then
NSRT.Profiles[NSRT.CurrentProfile][k] = type(v) == "table" and CopyTable(v) or v
end
end
end
end
function NSI:DeleteProfile(name, allowdefault)
if name == "default" and not allowdefault then return end
if NSRT.Profiles[name] then
print("|cFF00FFFFNSRT:|r deleting profile", name)
NSRT.Profiles[name] = nil
end
for k, profileName in pairs(NSRT.ProfileKeys) do
if profileName == name then
NSRT.ProfileKeys[k] = nil
end
end
if name == NSRT.CurrentProfile then
NSRT.CurrentProfile = nil
self:LoadMyProfile()
end
end
function NSI:ResetProfile(name)
self:DeleteProfile(name, true)
self:CreateProfile(name)
end
function NSI:CopyFromProfile(name)
if not NSRT.CurrentProfile then return end
if NSRT.Profiles[name] then
NSRT.Profiles[NSRT.CurrentProfile] = CopyTable(NSRT.Profiles[name])
self:LoadProfile(NSRT.CurrentProfile, true)
end
end
function NSI:ExportProfileString()
local LibSerialize = LibStub("LibSerialize")
local LibDeflate = LibStub("LibDeflate")
local profileData = NSRT.Profiles[NSRT.CurrentProfile]
if not profileData then return nil end
local exportTable = {
profileName = NSRT.CurrentProfile,
data = profileData,
}
local serialized = LibSerialize:Serialize(exportTable)
local compressed = LibDeflate:CompressDeflate(serialized)
local encoded = LibDeflate:EncodeForPrint(compressed)
return encoded
end
function NSAPI:ImportProfileString(importString, name) -- name is optional
local LibSerialize = LibStub("LibSerialize")
local LibDeflate = LibStub("LibDeflate")
if not importString or importString == "" then return nil end
local decoded = LibDeflate:DecodeForPrint(importString)
if not decoded then return nil end
local decompressed = LibDeflate:DecompressDeflate(decoded)
if not decompressed then return nil end
local success, exportTable = LibSerialize:Deserialize(decompressed)
if not success or type(exportTable) ~= "table" then return nil end
local name = name or exportTable.profileName or "Imported"
local function EnsureUniqueName(name)
if NSRT.Profiles[name] then
name = name .. " 2"
return EnsureUniqueName(name)
end
return name
end
name = EnsureUniqueName(name)
NSRT.Profiles[name] = type(exportTable.data) == "table" and CopyTable(exportTable.data) or {}
NSI:LoadProfile(name)
return name
end
function NSI:ExportAlertsString(encID, diffID)
local LibSerialize = LibStub("LibSerialize")
local LibDeflate = LibStub("LibDeflate")
local source = encID and NSRT.EncounterAlerts[encID] or NSRT.EncounterAlerts
local encounterAlerts
if diffID then
encounterAlerts = {}
if encID then
local diffTable = source and source[diffID]
if diffTable then
encounterAlerts[encID] = { [diffID] = diffTable }
end
else
for eid, encTable in pairs(source or {}) do
if type(encTable) == "table" and encTable[diffID] then
encounterAlerts[eid] = { [diffID] = encTable[diffID] }
end
end
end
else
encounterAlerts = source or {}
end
local exportTable = {
version = 1,
type = "alerts",
encID = encID,
diffID = diffID,
encounterAlerts = encounterAlerts,
}
local serialized = LibSerialize:Serialize(exportTable)
local compressed = LibDeflate:CompressDeflate(serialized)
return LibDeflate:EncodeForPrint(compressed)
end
function NSI:ExportSingleAlertString(alertType, encID, diffID, alertKey, data)
local LibSerialize = LibStub("LibSerialize")
local LibDeflate = LibStub("LibDeflate")
local exportTable = {
version = 1,
type = "single_alert",
alertType = alertType,
encID = encID,
diffID = diffID,
alertKey = alertKey,
data = data,
}
local serialized = LibSerialize:Serialize(exportTable)
local compressed = LibDeflate:CompressDeflate(serialized)
return LibDeflate:EncodeForPrint(compressed)
end
function NSI:ExportGroupString(encID, groupName, diffID)
if not encID or not groupName then return nil end
local LibSerialize = LibStub("LibSerialize")
local LibDeflate = LibStub("LibDeflate")
local encounterAlerts = {}
local encTable = encID and NSRT.EncounterAlerts and NSRT.EncounterAlerts[encID]
if not encTable then return nil end
for did, diffTable in pairs(encTable) do
if (not diffID) or did == diffID then
for key, alert in pairs(diffTable or {}) do
if alert.group and alert.group == groupName then
encounterAlerts[encID] = encounterAlerts[encID] or {}
encounterAlerts[encID][did] = encounterAlerts[encID][did] or {}
encounterAlerts[encID][did][key] = alert
end
end
end
end
local gk = tostring(encID) .. "|" .. groupName
local exportTable = {
version = 1,
type = "alert_group",
groupName = groupName,
groupEncID = encID,
diffID = diffID,
groupMeta = (NSRT.Alerts and NSRT.Alerts.Groups and NSRT.Alerts.Groups[gk]) or {},
encounterAlerts = encounterAlerts,
}
local serialized = LibSerialize:Serialize(exportTable)
local compressed = LibDeflate:CompressDeflate(serialized)
return LibDeflate:EncodeForPrint(compressed)
end
function NSAPI:ImportAlertsString(importString)
local LibSerialize = LibStub("LibSerialize")
local LibDeflate = LibStub("LibDeflate")
if not importString or importString == "" then return nil end
local decoded = LibDeflate:DecodeForPrint(importString)
if not decoded then return nil end
local decompressed = LibDeflate:DecompressDeflate(decoded)
if not decompressed then return nil end
local success, t = LibSerialize:Deserialize(decompressed)
if not success or type(t) ~= "table" then return nil end
if t.type == "alerts" then
local count = 0
NSRT.EncounterAlerts = NSRT.EncounterAlerts or {}
if t.encID then
if t.encounterAlerts then
NSRT.EncounterAlerts[t.encID] = NSRT.EncounterAlerts[t.encID] or {}
for diffID, diffData in pairs(t.encounterAlerts[t.encID] or t.encounterAlerts or {}) do
if (not t.diffID) or diffID == t.diffID then
NSRT.EncounterAlerts[t.encID][diffID] = NSRT.EncounterAlerts[t.encID][diffID] or {}
local destDiff = NSRT.EncounterAlerts[t.encID][diffID]
for k, a in pairs(destDiff) do
if type(a) == "table" and a.ReloeReminder then destDiff[k] = nil end
end
for alertKey, alert in pairs(diffData) do
if type(alert) == "table" then
if alert.ReloeReminder then
destDiff[alertKey] = alert
else
alert.ReloeReminder = nil
local newKey = NSI:UniqueAlertID(destDiff, false)
destDiff[newKey] = alert
end
count = count + 1
end
end
end
end
end
NSI:FireCallback("NSRT_ALERT_ENCOUNTER_UPDATE", t.encID)
return count
end
if t.encounterAlerts then
local overwritecount = 0
for encID, encData in pairs(t.encounterAlerts or {}) do
NSRT.EncounterAlerts[encID] = NSRT.EncounterAlerts[encID] or {}
for diffID, diffData in pairs(encData) do
if (not t.diffID) or diffID == t.diffID then
NSRT.EncounterAlerts[encID][diffID] = NSRT.EncounterAlerts[encID][diffID] or {}
local destDiff = NSRT.EncounterAlerts[encID][diffID]
for k, a in pairs(destDiff) do
if type(a) == "table" and a.ReloeReminder then destDiff[k] = nil end
end
for alertKey, alert in pairs(diffData) do
if type(alert) == "table" then
if alert.ReloeReminder then
destDiff[alertKey] = alert
else
alert.ReloeReminder = nil
local newKey = NSI:UniqueAlertID(destDiff, false)
destDiff[newKey] = alert
end
count = count + 1
end
end
end
end
end
NSI:FireCallback("NSRT_ALERT_FULL_UPDATE")
return count, overwritecount
end
NSI:FireCallback("NSRT_ALERT_FULL_UPDATE")
return count
elseif t.type == "single_alert" then
NSRT.EncounterAlerts = NSRT.EncounterAlerts or {}
if t.encID and t.diffID then
NSRT.EncounterAlerts[t.encID] = NSRT.EncounterAlerts[t.encID] or {}
NSRT.EncounterAlerts[t.encID][t.diffID] = NSRT.EncounterAlerts[t.encID][t.diffID] or {}
local diffTable = NSRT.EncounterAlerts[t.encID][t.diffID]
local importKey
if t.alertKey then
-- Keep the original key for both Reloe and user alerts so re-imports update in place
importKey = t.alertKey
else
importKey = NSI:UniqueAlertID(diffTable, false)
end
if t.data then t.data.ReloeReminder = t.alertType == "encounter" and t.data.ReloeReminder or nil end
diffTable[importKey] = t.data
NSI:FireCallback("NSRT_ALERT_CHANGED", t.encID, t.diffID, importKey)
return 1
end
elseif t.type == "alert_group" then
local count = 0
NSRT.EncounterAlerts = NSRT.EncounterAlerts or {}
NSRT.Alerts = NSRT.Alerts or {}
NSRT.Alerts.Groups = NSRT.Alerts.Groups or {}
if t.groupName then
NSRT.Alerts.Groups[t.groupName] = t.groupMeta or { collapsed = false }
end
local encID = t.groupEncID
local encData = encID and t.encounterAlerts and t.encounterAlerts[encID]
if encID and encData then
NSRT.EncounterAlerts[encID] = NSRT.EncounterAlerts[encID] or {}
for diffID, diffData in pairs(encData) do
if (not t.diffID) or diffID == t.diffID then
NSRT.EncounterAlerts[encID][diffID] = NSRT.EncounterAlerts[encID][diffID] or {}
local destDiff = NSRT.EncounterAlerts[encID][diffID]
for alertKey, alert in pairs(diffData) do
if type(alert) == "table" then
if alert.ReloeReminder then
destDiff[alertKey] = alert
else
alert.ReloeReminder = nil
local importKey = alertKey or NSI:UniqueAlertID(destDiff, false)
destDiff[importKey] = alert
end
count = count + 1
end
end
end
end
NSI:FireCallback("NSRT_ALERT_ENCOUNTER_UPDATE", encID)
end
return count
end
return nil
end
function NSI:LoadMyProfile()
local ProfileKey = self:GetProfileKey()
local ProfileToLoad = "default"
self:AddMissingDefaults()
if NSRT.ProfileKeys and NSRT.ProfileKeys[ProfileKey] then
ProfileToLoad = NSRT.ProfileKeys[ProfileKey]
elseif NSRT.MainProfile then
ProfileToLoad = NSRT.MainProfile
elseif NSRT.CurrentProfile then
ProfileToLoad = NSRT.CurrentProfile
end
if NSRT.Profiles and NSRT.Profiles[ProfileToLoad] then
self:LoadProfile(ProfileToLoad, true, true)
else
self:CreateProfile("default", true)
end
end