-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathReminders.lua
More file actions
2018 lines (1928 loc) · 86.1 KB
/
Copy pathReminders.lua
File metadata and controls
2018 lines (1928 loc) · 86.1 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
local _, NSI = ... -- Internal namespace
local symbols = {
star = 1,
circle = 2,
diamond = 3,
triangle = 4,
moon = 5,
square = 6,
cross = 7,
skull = 8,
}
local allowedTypes = {
["Text"] = true,
["Bar"] = true,
["Icon"] = true,
["Circle"] = true,
}
local settingsRef = {
Icon = "IconSettings",
Bar = "BarSettings",
Text = "TextSettings",
Circle = "CircleSettings",
}
local ClassToTauntID = {
[1] = 355, -- Warrior
[2] = 62124, -- Paladin
[6] = 56222, -- Death Knight
[10] = 115546, -- Monk
[11] = 6795, -- Druid
[12] = 185245, -- Demon Hunter
}
local Taunts = {
[115546] = true, -- Provoke
[56222] = true, -- Dark Command
[185245] = true, -- Torrent
[6795] = true, -- Growl
[355] = true, -- Taunt
[62124] = true, -- Hand of Reckoning
[49576] = true, -- Death Grip
}
function NSI:AddToReminder(reminderInfo)
local info = self:CreateReminder(reminderInfo)
if not info then return end
table.insert(self.ProcessedReminder[info.encID][info.phase], info)
end
function NSI:CreateReminder(info, preview)
info = CopyTable(info)
if preview or not info.encID then
info.time = info.dur or 60
info.encID = info.encID or 0
end
self.ProcessedReminder = self.ProcessedReminder or {}
self.ProcessedReminder[info.encID] = self.ProcessedReminder[info.encID] or {}
if info.IsAssignment and self:IsUsingTLAssignments() and not preview then
table.insert(self.TLAlerts, info)
return nil
end
if ((info.IsAlert and self:IsUsingTLAlerts()) or (self:IsUsingTLReminders() and not (info.IsAlert or info.IsAssignment))) and not preview then
return nil
end
if info.isTaunt then
local class = select(3, UnitClass("player"))
info.spellID = ClassToTauntID[class] or info.spellID
end
info.spellID = info.spellID and tonumber(info.spellID)
if (info.DisplayType and not allowedTypes[info.DisplayType]) or not info.DisplayType then
local spellDisplayType = NSRT.ReminderSettings.SpellDisplayType
info.DisplayType = info.spellID and spellDisplayType or "Text"
end
if info.textColors and type(info.textColors) == "string" then
local colors = {}
for color in info.textColors:gmatch("([^%s:]+)") do
table.insert(colors, tonumber(color))
end
if info.DisplayType == "Bar" then
info.barColors = colors
info.textColors = nil
elseif info.DisplayType == "Circle" then
info.ringColors = colors
info.textColors = nil
else
info.textColors = colors
end
end
-- convert to booleans
if info.TTS == "true" then info.TTS = true end
if info.TTS == "false" then info.TTS = false end
-- default to user settings if not overwritten by the reminders
if info.TTS == nil then
info.TTS = (info.spellID and NSRT.ReminderSettings.SpellTTS) or ((not info.spellID) and NSRT.ReminderSettings.TextTTS)
end
if info.TTSTimer == nil then
-- set TTS timer to the specified duration or if no duration was specified, set it to the default value
info.TTSTimer = info.dur or ((info.spellID and NSRT.ReminderSettings.SpellTTSTimer) or NSRT.ReminderSettings.TextTTSTimer)
end
if info.dur == nil then
info.dur = info.spellID and NSRT.ReminderSettings.SpellDuration or NSRT.ReminderSettings.TextDuration
end
if info.countdown == nil then
info.countdown = info.spellID and NSRT.ReminderSettings.SpellCountdown or NSRT.ReminderSettings.TextCountdown
if info.countdown == 0 then info.countdown = false end
end
info.dur = tonumber(info.dur)
info.time = tonumber(info.time)
info.TTSTimer = tonumber(info.TTSTimer)
info.countdown = tonumber(info.countdown)
if info.dur > info.time then info.dur = info.time end -- force duration to be equal to time if an alert is set very early into the phase
if info.TTSTimer > info.time then info.TTSTimer = info.time end -- same for TTSTimer
if info.countdown and info.countdown > info.time then info.countdown = info.time end -- same for countdown
info.phase = info.phase and tonumber(info.phase)
if not info.phase then info.phase = 1 end
local rawtext = info.text
if info.text then
info.text = info.text:gsub("{(%a*%d*)}", function(token) -- convert {star}/{rt1} etc. to raid target icons
local id = symbols[token] or (token:match("^rt(%d)$") and tonumber(token:match("^rt(%d)$")))
if id then return "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_"..id..":0|t" end
end)
end
if (NSRT.ReminderSettings.SpellName or NSRT.ReminderSettings.SpellNameTTS) and info.spellID and not info.text then -- display spellname if text is empty, also make TTS that spellname
local spell = C_Spell.GetSpellInfo(info.spellID)
if spell then
info.text = NSRT.ReminderSettings.SpellName and spell.name or "" -- set text to SpellName
info.TTS = info.TTS and type(info.TTS) ~= "string" and spell.name or info.TTS -- Set TTS to SpellName
end
end
if info.TTS and info.text and type(info.TTS) == "boolean" then -- if tts is "true" convert it to the rawtext, which is the text before converting it to display raid-icons
info.TTS = rawtext
end
if info.TTS and type(info.TTS) == "string" and ((NSRT.ReminderSettings.AnnounceSpellDuration and info.spellID) or (NSRT.ReminderSettings.AnnounceTextDuration and not info.spellID)) and not (info.IsAlert or info.IsAssignment) then
info.TTS = info.TTS.." in "..info.TTSTimer
end
if info.glowunit then
local glowtable = {}
for name in info.glowunit:gmatch("([^%s:]+)") do
if name ~= "glowunit" then
table.insert(glowtable, name)
end
end
info.glowunit = glowtable
end
-- play default sound if enabled and no TTS/Sound was specified
if NSRT.ReminderSettings.PlayDefaultSound and info.spellID and (type(info.TTS) == "boolean" or not info.TTS) and (not info.sound) and (not (info.IsAlert or info.IsAssignment)) then
info.sound = NSRT.ReminderSettings.DefaultSound
end
self.ProcessedReminder[info.encID][info.phase] = self.ProcessedReminder[info.encID][info.phase] or {}
info.name = info.name or info.internalID
info.id = #self.ProcessedReminder[info.encID][info.phase]+1
info.countdown = info.countdown and tonumber(info.countdown)
info.dur = info.dur or 8
if info.HideTimer == nil then info.HideTimer = NSRT.ReminderSettings[settingsRef[info.DisplayType]].HideTimerText end
info.id = #self.ProcessedReminder[info.encID][info.phase]+1
info.sticky = info.sticky or NSRT.ReminderSettings[settingsRef[info.DisplayType]].Sticky
info.glowColors = info.glowColors or NSRT.ReminderSettings.GlowSettings.colors
if info.Decimals == nil then info.Decimals = NSRT.ReminderSettings[settingsRef[info.DisplayType]].Decimals end
if info.DisplayType == "Icon" and info.HideSwipe == nil then info.HideSwipe = NSRT.ReminderSettings.IconSettings.HideSwipe end
return info
end
function NSI:ProcessReminder()
local str = ""
self.ProcessedReminder = {}
local remindertable = {}
local addedreminders = {}
local personalremindertable = {}
local addedpersonalreminders = {}
self.DisplayedReminder = ""
self.DisplayedPersonalReminder = ""
self.DisplayedExtraReminder = ""
local pers = NSRT.ReminderSettings.PersonalReminderFrame.enabled
local shared = NSRT.ReminderSettings.ReminderFrame.enabled
-- self:IsUsingTLReminders() makes it process the note but then stops the display at a later point. This allows still displaying the note.
if (NSRT.ReminderSettings.enabled or self:IsUsingTLReminders()) and self.Reminder then str = self.Reminder end
if NSRT.ReminderSettings.MRTNote or (self:IsUsingTLReminders() and LiquidRemindersSaved.settings.timeline.mrtNote) then
local note = VMRT and VMRT.Note and VMRT.Note.Text1 or ""
note = strtrim(note)
str = (note == "" and str) or (str ~= "" and note.."\n"..str) or note
local persnote = VMRT and VMRT.Note and VMRT.Note.SelfText or ""
persnote = strtrim(persnote)
str = (persnote == "" and str) or (str ~= "" and persnote.."\n"..str) or persnote
end
if NSRT.ReminderSettings.PersNote or self:IsUsingTLReminders() then
local note = self.PersonalReminder or ""
str = (note == "" and str) or (str ~= "" and note.."\n"..str) or note
end
if str ~= "" then
local subgroup = self:GetSubGroup("player")
if not subgroup then subgroup = 1 end
subgroup = "group"..subgroup
local specid = self:GetMySpecID()
local pos = self.spectable[specid]
local encID = 0
local mynickname = strlower(NSAPI:GetName("player", "GlobalNickNames"))
local myname = strlower(UnitName("player"))
local myrole = strlower(UnitGroupRolesAssigned("player"))
local myclass = select(3, UnitClass("player"))
pos = (self.meleetable[specid] or myrole == "tank") and "melee" or "ranged"
local extranote = ""
if not str:match('\n$') then
str = str..'\n'
end
for line in str:gmatch('([^\n]*)\n') do
local firstline = false
if line:find("EncounterID:") then
encID = line:match("EncounterID:(%d+)")
if encID then
encID = tonumber(encID)
firstline = true
end
end
local tag = line:match("tag:([^;]+)")
local DisplayType = line:match("DisplayType:([^;]+)")
local time = line:match("time:(%d*%.?%d+)")
local text = line:match("text:([^;]+)")
local spellID = line:match("spellid:(%d+)")
local phase = line:match("ph:(%d*%.?%d+)")
local dur = line:match("dur:(%d+)")
local TTS = line:match("TTS:([^;]+)")
local TTSTimer = line:match("TTSTimer:(%d+)")
local countdown = line:match("countdown:(%d+)")
local sound = line:match("sound:([^;]+)")
local rawSound = sound
--FIX Remove color codes
if sound then
local soundPath = self.LSM:Fetch("sound", rawSound)
if ((not soundPath) or soundPath == 1) then
local cleanSound = sound:gsub("|c%x%x%x%x%x%x%x%x", "")
:gsub("|r", "")
:match("^[%s|]*(.-)[%s|]*$")
sound = cleanSound
end
end
local glowunit = line:match("glowunit:([^;]+)")
local bossSpellID = line:match("bossSpell:(%d+)")
local colors = line:match("colors:([^;]+)")
if time and tag and (text or spellID) and encID and encIDs ~= 0 and not firstline then
local displayLine = line
local phaseText = phase
phase = phase and tonumber(phase) or 1
local key = encID..phase..time..tag..(text or spellID)
if (pers or shared) and (spellID or not NSRT.ReminderSettings.OnlySpellReminders) then -- only insert this if it's a spell or user wants to see text-reminders as well
-- remove phase as we add it back later
if phaseText then
local phasePattern = phaseText:gsub("(%W)", "%%%1")
displayLine = displayLine:gsub("ph:"..phasePattern, "")
end
-- convert to MM:SS format
local timeNum = tonumber(time)
if timeNum then
local minutes = math.floor(timeNum / 60)
local seconds = math.floor(timeNum % 60)
local timeFormatted = string.format("%d:%02d", minutes, seconds)
displayLine = displayLine:gsub("time:"..time, timeFormatted.." ")
end
if text then
local displayText = text:gsub("{(%a*%d*)}", function(token) -- convert {star}/{rt1} etc. to raid target icons
local id = symbols[token] or (token:match("^rt(%d)$") and tonumber(token:match("^rt(%d)$")))
if id then return "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_"..id..":0|t" end
end)
local s, e = displayLine:find("text:"..text, 1, true)
if s then displayLine = displayLine:sub(1, s-1).."- "..displayText.." "..displayLine:sub(e+1) end
end
-- convert to icon
if spellID then
local iconID = C_Spell.GetSpellTexture(tonumber(spellID))
if iconID then
local iconString = "\124T"..iconID..":12:12:0:0:64:64:4:60:4:60\124t"
displayLine = displayLine:gsub("spellid:%d+", iconString.. " ")
end
end
if bossSpellID then
local iconID = C_Spell.GetSpellTexture(tonumber(bossSpellID))
if iconID then
local iconString = "\124T"..iconID..":12:12:0:0:64:64:4:60:4:60\124t"
displayLine = displayLine:gsub("bossSpell:%d+", iconString.. " ")
end
end
-- cleanup stuff we don't want to have displayed
if glowunit then
displayLine = displayLine:gsub("glowunit:"..glowunit, "")
end
if countdown then
displayLine = displayLine:gsub("countdown:"..countdown, "")
end
if TTS then
displayLine = displayLine:gsub("TTS:"..TTS, "")
end
if TTSTimer then
displayLine = displayLine:gsub("TTSTimer:"..TTSTimer, "")
end
if sound then
displayLine = displayLine:gsub("sound:"..rawSound, "")
end
if dur then
displayLine = displayLine:gsub("dur:"..dur, "")
end
if colors then
displayLine = displayLine:gsub("colors:"..colors, "")
end
if DisplayType then
displayLine = displayLine:gsub("DisplayType:"..DisplayType, "")
end
-- convert names to nicknames and color code them
local tagNames = ""
if not NSRT.ReminderSettings.HidePlayerNames then
for name in tag:gmatch("(%S+)") do
tagNames = tagNames..NSAPI:Shorten(NSAPI:GetChar(strtrim(name), true), 12, false, "GlobalNickNames").." "
end
end
tagNames = strtrim(tagNames)
displayLine = NSRT.ReminderSettings.HidePlayerNames and displayLine:gsub("tag:([^;]+)", "") or displayLine:gsub("tag:([^;]+)", tagNames.." ")
-- remove remaining semicolons
displayLine = displayLine:gsub(";", "")
if shared and not addedreminders[key] then
table.insert(remindertable, {str = displayLine, time = tonumber(time), phase = phase})
addedreminders[key] = true
end
end
local tags = {}
tag = strlower(tag)
for name in tag:gmatch("(%S+)") do
tags[strtrim(name)] = true
end
specid = specid and tostring(specid)
myclass = myclass and strlower(myclass)
local mematch =
(tag == "everyone" and not NSRT.ReminderSettings.IgnoreEveryone) or
tags[myname] or
tags[mynickname] or
tags[myrole] or
tags[specid] or
tags[myclass] or
tags[subgroup] or
(pos and tags[pos])
if NSRT.ReminderSettings.ShowAllReminders or mematch then
if not addedpersonalreminders[key] then
addedpersonalreminders[key] = true
if pers then
if mematch and (spellID or not NSRT.ReminderSettings.OnlySpellReminders) then -- only insert this if it's a spell or user wants to see text-reminders as well
table.insert(personalremindertable, {str = displayLine, time = tonumber(time), phase = phase})
end
end
self:AddToReminder({DisplayType = DisplayType, text = text, phase = phase, textColors = colors, countdown = countdown, glowunit = glowunit, sound = sound, time = time, spellID = spellID, dur = dur, TTS = TTS, TTSTimer = TTSTimer, encID = encID})
end
end
else
if (not firstline) and (not line:find("invitelist:")) then
-- Restore WoW color and icon escape sequences that get doubled when passing through an EditBox
line = line:gsub("||c(%x%x%x%x%x%x%x%x)", "|c%1"):gsub("||r", "|r"):gsub("||T", "|T"):gsub("||t", "|t")
line = line:gsub("{(%a*%d*)}", function(token) -- convert {star}/{rt1} etc. to raid target icons
local id = symbols[token] or (token:match("^rt(%d)$") and tonumber(token:match("^rt(%d)$")))
if id then return "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_"..id..":0|t" end
end)
local words = {}
for word in line:gmatch("[^%s]+") do
local prefix, core, suffix = word:match("^([%p]*)(.-)([%p]*)$")
if core and core ~= "" and #core >= 2 and #core <= 36 then
local unit = NSAPI:GetChar(core, true)
local shortened = NSAPI:Shorten(unit, 12, false, "GlobalNickNames")
table.insert(words, prefix .. shortened .. suffix)
else
table.insert(words, word)
end
end
extranote = extranote..table.concat(words, " ").."\n"
end
end
end
if shared then
local phasedisplayed = {}
table.sort(remindertable, function(a, b)
if a.phase == b.phase then
return a.time < b.time
else
return a.phase < b.phase
end
end)
for _, data in ipairs(remindertable) do
if not phasedisplayed[data.phase] then
data.str = "Phase "..data.phase.."\n"..data.str
phasedisplayed[data.phase] = true
end
self.DisplayedReminder = self.DisplayedReminder..data.str.."\n"
end
end
if pers then
local phasedisplayed = {}
table.sort(personalremindertable, function(a, b)
if a.phase == b.phase then
return a.time < b.time
else
return a.phase < b.phase
end
end)
for _, data in ipairs(personalremindertable) do
if not phasedisplayed[data.phase] then
data.str = "Phase "..data.phase.."\n"..data.str
phasedisplayed[data.phase] = true
end
self.DisplayedPersonalReminder = self.DisplayedPersonalReminder..data.str.."\n"
end
end
extranote = extranote:gsub("^%s*\n+", "")
self.DisplayedExtraReminder = extranote
end
if self.TimelineWindow and self.TimelineWindow:IsShown() then
self:RefreshTimelineForMode()
end
end
local DefaultCircleTexture = [[Interface\AddOns\NorthernSkyRaidTools\Media\Textures\circle_2px.png]]
local function GetCircleTexture(info)
if info and info.Texture then return info.Texture end
local s = NSRT.ReminderSettings and NSRT.ReminderSettings.CircleSettings
return (s and s.Texture) or DefaultCircleTexture
end
local function PositionCircleText(text, F, s)
text:ClearAllPoints()
local position = s.TextPosition
local x, y = s.xTextOffset, s.yTextOffset
if position == "Bottom" then
text:SetPoint("TOP", F, "BOTTOM", x, y)
text:SetJustifyH("CENTER")
elseif position == "Center" then
text:SetPoint("CENTER", F, "CENTER", x, y)
text:SetJustifyH("CENTER")
elseif position == "Left" then
text:SetPoint("RIGHT", F, "LEFT", x, y)
text:SetJustifyH("RIGHT")
elseif position == "Right" then
text:SetPoint("LEFT", F, "RIGHT", x, y)
text:SetJustifyH("LEFT")
else
text:SetPoint("BOTTOM", F, "TOP", x, y)
text:SetJustifyH("CENTER")
end
end
function NSI:UpdateExistingFrames() -- called when user changes settings to not require a reload
if self._uefPending then return end
self._uefPending = true
C_Timer.After(0, function() self._uefPending = false end)
local parent = self.ReminderText or {}
for i=1, #parent do
local F = parent[i]
if F then
local s = NSRT.ReminderSettings.TextSettings
F.Text:SetFont(self.LSM:Fetch("font", s.Font), s.FontSize, "OUTLINE")
local anchor = s.CenterAligned and "CENTER" or "LEFT"
F.Text:ClearAllPoints()
F.Text:SetPoint(anchor, F, anchor, 0, 0)
end
end
self:ArrangeStates("Texts")
self:MoveFrameSettings(self.TextMover, NSRT.ReminderSettings.TextSettings, true, true)
parent = self.ReminderIcon or {}
for i=1, #parent do
local F = parent[i]
if F then
local s = NSRT.ReminderSettings.IconSettings
F:SetSize(s.Width, s.Height)
F.Icon:SetAllPoints(F)
local z = ((s.Zoom) * 0.5) / 100
F.Icon:SetTexCoord(z, 1 - z, z, 1 - z)
F.Border:SetAllPoints(F)
F.Border:SetBackdropBorderColor(unpack(s.borderColors))
local anchor = s.RightAlignedText and "RIGHT" or "LEFT"
local relativePoint = s.RightAlignedText and "LEFT" or "RIGHT"
F.Text:ClearAllPoints()
F.Text:SetPoint(anchor, F, relativePoint, s.xTextOffset, s.yTextOffset)
F.Text:SetFont(self.LSM:Fetch("font", s.Font), s.FontSize, "OUTLINE")
if s.HideTimerText then
F.TimerText:Hide()
else
F.TimerText:Show()
end
F.TimerText:SetPoint("CENTER", F, "CENTER", s.xTimer, s.yTimer)
F.TimerText:SetFont(self.LSM:Fetch("font", s.Font), s.TimerFontSize, "OUTLINE")
end
end
self:ArrangeStates("Icons")
self:MoveFrameSettings(self.IconMover, NSRT.ReminderSettings.IconSettings, nil, true)
parent = self.UnitIcon or {}
for i=1, #parent do
local F = parent[i]
if F then
local s = NSRT.ReminderSettings.UnitIconSettings
F:SetSize(s.Width, s.Height) -- not setting points in this one because this is repeated every time the frame is shown as it needs a new frame to anchor to anyway
end
end
parent = self.ReminderBar or {}
for i=1, #parent do
local F = parent[i]
if F then
local s = NSRT.ReminderSettings.BarSettings
F:SetSize(s.Width, s.Height)
F:SetStatusBarTexture(self.LSM:Fetch("statusbar", s.Texture))
F:SetStatusBarColor(unpack(s.barColors))
F:SetBackdropColor(unpack(s.backgroundColors))
F.Border:SetBackdropBorderColor(unpack(s.borderColors))
if F.Text then F.Text:SetTextColor(unpack(s.textColors)) end
F.Icon:SetPoint("RIGHT", F, "LEFT", s.xIcon, s.yIcon)
F.Icon:SetSize(s.Height, s.Height)
F.Text:SetPoint("LEFT", F.Icon, "RIGHT", s.xTextOffset, s.yTextOffset)
F.Text:SetFont(self.LSM:Fetch("font", s.Font), s.FontSize, "OUTLINE")
if s.HideTimerText then
F.TimerText:Hide()
else
F.TimerText:Show()
end
F.TimerText:SetPoint("RIGHT", F, "RIGHT", s.xTimer, s.yTimer)
F.TimerText:SetFont(self.LSM:Fetch("font", s.Font), s.TimerFontSize, "OUTLINE")
end
end
self:ArrangeStates("Bars")
self:MoveFrameSettings(self.BarMover, NSRT.ReminderSettings.BarSettings, false, true)
parent = self.ReminderCircle or {}
for i=1, #parent do
local F = parent[i]
if F and F:IsShown() then
local s = NSRT.ReminderSettings.CircleSettings
local info = F.info or {}
F:SetSize(s.Size, s.Size)
local texture = GetCircleTexture(info)
if F.ring then
F.ring:SetTexture(texture)
F.ring:SetShown(info.showBackground == nil and s.showBackground or info.showBackground)
end
if F.Swipe then
F.Swipe:SetSwipeTexture(texture)
F.Swipe:SetSwipeColor(unpack(info.ringColors or s.ringColors))
end
F.Text:SetFont(self.LSM:Fetch("font", s.Font), s.FontSize, "OUTLINE")
PositionCircleText(F.Text, F, s)
F.Text:SetTextColor(unpack(info.textColors or s.textColors))
end
end
self:ArrangeStates("Circles")
if self.CircleMover then
self:MoveFrameSettings(self.CircleMover, NSRT.ReminderSettings.CircleSettings, nil, true)
end
end
function NSI:ArrangeStates(DisplayType)
local F = (DisplayType == "Texts" and self.ReminderText)
or (DisplayType == "Icons" and self.ReminderIcon)
or (DisplayType == "Bars" and self.ReminderBar)
or (DisplayType == "Circles" and self.ReminderCircle)
if not F then return end
local s = (DisplayType == "Texts" and NSRT.ReminderSettings.TextSettings)
or (DisplayType == "Icons" and NSRT.ReminderSettings.IconSettings)
or (DisplayType == "Bars" and NSRT.ReminderSettings.BarSettings)
or (DisplayType == "Circles" and NSRT.ReminderSettings.CircleSettings)
local pos = {}
for i=1, #F do
if F[i] and F[i]:IsShown() then
table.insert(pos, {Frame = F[i], id = F[i].info.id, expires = F[i].info.expires})
end
end
table.sort(pos, function(a, b)
if a.expires == b.expires then return a.id < b.id else return a.expires < b.expires end
end)
local ANCHOR_PAD = 8
for i, v in ipairs(pos) do
local Spacing = s.Spacing or 0
v.Frame:ClearAllPoints()
if DisplayType == "Texts" then
local textHeight = issecretvalue(v.Frame.Text:GetStringHeight()) and (s.FontSize or 14) or v.Frame.Text:GetStringHeight()
-- Texts stretch to anchor width, so double-point from anchor edges = centered
local h = v.Frame.Text and textHeight or s.FontSize or 14
if s.GrowDirection == "Up" then
v.Frame:SetPoint("BOTTOMLEFT", "NSUIReminderTextMover", "TOPLEFT", 0, ANCHOR_PAD + (i-1)*(h+Spacing))
v.Frame:SetPoint("TOPRIGHT", "NSUIReminderTextMover", "TOPRIGHT", 0, ANCHOR_PAD + (i-1)*(h+Spacing) + h)
else -- Down
v.Frame:SetPoint("BOTTOMLEFT", "NSUIReminderTextMover", "BOTTOMLEFT", 0, -(ANCHOR_PAD + (i-1)*(h+Spacing) + h))
v.Frame:SetPoint("TOPRIGHT", "NSUIReminderTextMover", "BOTTOMRIGHT", 0, -(ANCHOR_PAD + (i-1)*(h+Spacing)))
end
elseif DisplayType == "Icons" then
local w, h = s.Width, s.Height
v.Frame:SetSize(w, h)
if s.GrowDirection == "Up" then
v.Frame:SetPoint("BOTTOM", "NSUIReminderIconMover", "TOP", 0, ANCHOR_PAD + (i-1)*(h+Spacing))
elseif s.GrowDirection == "Down" then
v.Frame:SetPoint("TOP", "NSUIReminderIconMover", "BOTTOM", 0, -(ANCHOR_PAD + (i-1)*(h+Spacing)))
elseif s.GrowDirection == "Right" then
v.Frame:SetPoint("LEFT", "NSUIReminderIconMover", "RIGHT", ANCHOR_PAD + (i-1)*(w+Spacing), 0)
elseif s.GrowDirection == "Left" then
v.Frame:SetPoint("RIGHT", "NSUIReminderIconMover", "LEFT", -(ANCHOR_PAD + (i-1)*(w+Spacing)), 0)
end
elseif DisplayType == "Bars" then
local w, h = s.Width, s.Height
v.Frame:SetSize(w, h)
if s.GrowDirection == "Up" then
v.Frame:SetPoint("BOTTOM", "NSUIReminderBarMover", "TOP", 0, ANCHOR_PAD + (i-1)*(h+Spacing))
else -- Down
v.Frame:SetPoint("TOP", "NSUIReminderBarMover", "BOTTOM", 0, -(ANCHOR_PAD + (i-1)*(h+Spacing)))
end
elseif DisplayType == "Circles" then
local sz = s.Size or 80
v.Frame:SetSize(sz, sz)
if s.GrowDirection == "Up" then
v.Frame:SetPoint("BOTTOM", "NSUIReminderCircleMover", "TOP", 0, ANCHOR_PAD + (i-1)*(sz+Spacing))
elseif s.GrowDirection == "Down" then
v.Frame:SetPoint("TOP", "NSUIReminderCircleMover", "BOTTOM", 0, -(ANCHOR_PAD + (i-1)*(sz+Spacing)))
elseif s.GrowDirection == "Right" then
v.Frame:SetPoint("LEFT", "NSUIReminderCircleMover", "RIGHT", ANCHOR_PAD + (i-1)*(sz+Spacing), 0)
elseif s.GrowDirection == "Left" then
v.Frame:SetPoint("RIGHT", "NSUIReminderCircleMover", "LEFT", -(ANCHOR_PAD + (i-1)*(sz+Spacing)), 0)
end
else
print("NSRT: Reminder anchoring issue @ NSI:ArrangeStates (unknown type: "..tostring(DisplayType)..")")
end
end
end
function NSI:SetProperties(F, info, skipsound, s)
F:SetScript("OnUpdate", function(self, elapsed)
self.elapsed = (self.elapsed or 0) + elapsed
if self.elapsed < 0.025 then return end
self.elapsed = 0
NSI:UpdateReminderDisplay(info, F, skipsound)
end)
F.info = info
F:SetScript("OnHide", function()
if not F.IsUnitFrameIcon and info.glowunit then
self:HideGlows(info.glowunit, "p"..info.phase.."id"..info.id)
end
if F.Swipe and info.DisplayType == "Icon" and NSRT.ReminderSettings.IconSettings.Glow > 0 then
self:HideGlows(nil, nil, F)
end
if not F.IsUnitFrameIcon then
NSI:ArrangeStates(F.DisplayType)
end
F:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED")
if F.Ticks then
for _, tick in ipairs(F.Ticks) do
tick:Hide()
end
end
end)
local spellInfo = info.spellID and C_Spell.GetSpellInfo(info.spellID)
if F.IsUnitFrameIcon then
F.Icon:SetTexture(spellInfo and spellInfo.iconID or 134400)
elseif info.DisplayType == "Text" then
F.SpellText = spellInfo and "|T"..spellInfo.iconID..":0:0:0:0:64:64:4:60:4:60|t " or ""
F.Text:SetTextColor(unpack(info.textColors or s.textColors))
elseif info.DisplayType == "Circle" then
local s = NSRT.ReminderSettings.CircleSettings
local r, g, b, a = unpack(info.textColors or s.textColors)
F.Text:SetFont(self.LSM:Fetch("font", s.Font), s.FontSize, "OUTLINE")
PositionCircleText(F.Text, F, s)
F.Text:SetTextColor(r, g, b, a)
local texture = GetCircleTexture(info)
if F.ring then
F.ring:SetTexture(texture)
local shouldShow = info.showBackground == nil and s.showBackground or info.showBackground
F.ring:SetShown(shouldShow)
end
F.Swipe:SetCooldown(info.startTime, info.dur)
F.Swipe:SetSwipeTexture(texture)
F.Swipe:SetSwipeColor(unpack(info.ringColors or s.ringColors))
F.SpellText = spellInfo and "|T"..spellInfo.iconID..":0:0:0:0:64:64:4:60:4:60|t " or ""
elseif info.DisplayType == "Icon" then
if not spellInfo then spellInfo = { iconID = 134400 } end
F.Icon:SetTexture(spellInfo.iconID)
if info.HideSwipe then
if F.Swipe then F.Swipe:SetCooldown(0, 0) end
else
if F.Swipe then F.Swipe:SetCooldown(GetTime(), info.dur) end
end
if F.TimerText then
F.TimerText:SetTextColor(1, 1, 0, 1)
if info.HideTimer then
F.TimerText:Hide()
else
F.TimerText:Show()
end
end
if F.Border and s.borderColors then F.Border:SetBackdropBorderColor(unpack(s.borderColors)) end
if F.Text then F.Text:SetTextColor(unpack(info.textColors or s.textColors)) end
elseif info.DisplayType == "Bar" then
if spellInfo then
F.Icon:SetTexture(spellInfo.iconID)
F.Icon:Show()
else
F.Icon:Hide()
end
if F.SetStatusBarColor then
F:SetStatusBarColor(unpack(info.barColors or s.barColors or {1,0,0,1}))
end
if F.SetBackdropColor then
F:SetBackdropColor(unpack(s.backgroundColors))
end
if F.Border then F.Border:SetBackdropBorderColor(unpack(s.borderColors)) end
if F.Text then F.Text:SetTextColor(unpack(info.textColors or s.textColors or {1,1,1,1})) end
if F.TimerText then
F.TimerText:SetTextColor(unpack(info.textColors or s.textColors or {1,1,1,1}))
if info.HideTimer then
F.TimerText:Hide()
else
F.TimerText:Show()
end
end
end
if info.isTaunt then
F:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED", "player")
F:SetScript("OnEvent", function(self, e, ...)
local _, _, spellID = ...
if Taunts[spellID] and self:IsShown() then
F:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED")
F:Hide()
end
end)
return
end
if info.ReloeReminder or not info.spellID then return end
F:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED", "player")
F:SetScript("OnEvent", function(self, e, ...)
-- only registered for player so spellID is never secret
local _, _, spellID = ...
if (not issecretvalue(info.spellID)) and spellID == info.spellID and self:IsShown() then
local rem = info.dur - (GetTime() - info.startTime)
local hideThreshold = NSRT.ReminderSettings.HideThreshold or 5
if rem and rem <= hideThreshold then
F:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED")
F:Hide()
end
end
end)
end
function NSI:CreateText(info)
self.ReminderText = self.ReminderText or {}
local s = NSRT.ReminderSettings.TextSettings
for i=1, #self.ReminderText+1 do
if self.ReminderText[i] and not self.ReminderText[i]:IsShown() then
self:SetProperties(self.ReminderText[i], info, false, s)
return self.ReminderText[i]
end
if not self.ReminderText[i] then
local F = CreateFrame("Frame", 'NSUIReminderText' .. i, UIParent, "BackdropTemplate")
local offset = s.GrowDirection == "Up" and (i-1) * s.FontSize or -(i-1) * s.FontSize
F:SetPoint("BOTTOMLEFT", "NSUIReminderTextMover", "BOTTOMLEFT", 0, 0 + offset)
F:SetPoint("TOPRIGHT", "NSUIReminderTextMover", "TOPRIGHT", 0, 0 + offset)
F:SetFrameStrata("HIGH")
F:SetFrameLevel(10)
F.Text = F:CreateFontString(nil, "OVERLAY", "GameFontNormal")
local anchor = s.CenterAligned and "CENTER" or "LEFT"
F.Text:SetPoint(anchor, F, anchor, 0, 0)
F.Text:SetFont(self.LSM:Fetch("font", s.Font), s.FontSize, "OUTLINE")
F.Text:SetShadowColor(0, 0, 0, 1)
F.Text:SetShadowOffset(0, 0)
F.Text:SetTextColor(unpack(info.textColors or s.textColors))
self:SetProperties(F, info, false, s)
self.ReminderText[i] = F
return F
end
end
end
function NSI:CreateIcon(info)
self.ReminderIcon = self.ReminderIcon or {}
local s = NSRT.ReminderSettings.IconSettings
for i=1, #self.ReminderIcon+1 do
if self.ReminderIcon[i] and not self.ReminderIcon[i]:IsShown() then
self:SetProperties(self.ReminderIcon[i], info, false, s)
return self.ReminderIcon[i]
end
if not self.ReminderIcon[i] then
local F = CreateFrame("Frame", 'NSUIReminderIcon' .. i, UIParent, "BackdropTemplate")
local yoffset = (s.GrowDirection == "Up" and (i-1) * s.Height) or (s.GrowDirection == "Down" and -(i-1) * s.Height) or 0
local xoffset = (s.GrowDirection == "Right" and (i-1) * s.Width) or (s.GrowDirection == "Left" and -(i-1) * s.Width) or 0
F:SetPoint("BOTTOMLEFT", "NSUIReminderIconMover", "BOTTOMLEFT", 0 + xoffset, 0 + yoffset)
F:SetPoint("TOPRIGHT", "NSUIReminderIconMover", "TOPRIGHT", 0 + xoffset, 0 + yoffset)
F:SetFrameStrata("HIGH")
F:SetFrameLevel(10)
F.Icon = F:CreateTexture(nil, "ARTWORK")
F.Icon:SetAllPoints(F)
local z = ((s.Zoom) * 0.5) / 100
F.Icon:SetTexCoord(z, 1 - z, z, 1 - z)
F.Border = CreateFrame("Frame", nil, F, "BackdropTemplate")
F.Border:SetAllPoints(F)
F.Border:SetBackdrop({
edgeFile = "Interface\\Buttons\\WHITE8x8",
edgeSize = 1
})
F.Border:SetBackdropBorderColor(unpack(s.borderColors))
F.Text = F:CreateFontString(nil, "OVERLAY", "GameFontNormal")
local anchor = NSRT.ReminderSettings.IconSettings.RightAlignedText and "RIGHT" or "LEFT"
local relativePoint = NSRT.ReminderSettings.IconSettings.RightAlignedText and "LEFT" or "RIGHT"
F.Text:SetPoint(anchor, F, relativePoint, s.xTextOffset, s.yTextOffset)
F.Text:SetFont(self.LSM:Fetch("font", s.Font), s.FontSize, "OUTLINE")
F.Text:SetShadowColor(0, 0, 0, 1)
F.Text:SetShadowOffset(0, 0)
F.Text:SetTextColor(unpack(info.textColors or s.textColors))
F.Swipe = CreateFrame("Cooldown", nil, F, "CooldownFrameTemplate")
F.Swipe:SetAllPoints()
F.Swipe:SetDrawBling(false)
F.Swipe:SetDrawEdge(false)
F.Swipe:SetReverse(true)
F.Swipe:SetHideCountdownNumbers(true)
F.TimerOverlay = CreateFrame("Frame", nil, F)
F.TimerOverlay:SetAllPoints(F)
F.TimerOverlay:SetFrameLevel(F.Swipe:GetFrameLevel() + 1)
F.TimerText = F.TimerOverlay:CreateFontString(nil, "OVERLAY", "GameFontNormal")
F.TimerText:SetPoint("CENTER", F, "CENTER", s.xTimer, s.yTimer)
F.TimerText:SetFont(self.LSM:Fetch("font", s.Font), s.TimerFontSize, "OUTLINE")
F.TimerText:SetShadowColor(0, 0, 0, 1)
F.TimerText:SetShadowOffset(0, 0)
self:SetProperties(F, info, false, s)
self.ReminderIcon[i] = F
return F
end
end
end
function NSI:CreateUnitFrameIcon(info, name)
self.UnitIcon = self.UnitIcon or {}
local spellInfo = info.spellID and C_Spell.GetSpellInfo(info.spellID)
if not spellInfo then return end
local unit = NSAPI:GetChar(name, true)
if (not UnitExists(unit)) then return end
local UnitFrame = self.LGF.GetUnitFrame(unit)
if not UnitFrame then return end
local s = NSRT.ReminderSettings.UnitIconSettings
for i=1, #self.UnitIcon+1 do
if self.UnitIcon[i] and not self.UnitIcon[i]:IsShown() then
self.UnitIcon[i]:ClearAllPoints()
self.UnitIcon[i]:SetPoint(s.Position, UnitFrame, s.Position, s.xOffset, s.yOffset)
self.UnitIcon[i].IsUnitFrameIcon = true
self:SetProperties(self.UnitIcon[i], info, true, s)
return self.UnitIcon[i]
end
if not self.UnitIcon[i] then
local F = CreateFrame("Frame", nil, UIParent, "BackdropTemplate")
F:SetSize(s.Width, s.Height)
F:SetPoint(s.Position, UnitFrame, s.Position, s.xOffset, s.yOffset)
F.Icon = F:CreateTexture(nil, "ARTWORK")
F.Icon:SetAllPoints(F)
F:SetFrameStrata("TOOLTIP")
F.Icon:SetTexture(spellInfo.iconID)
F.Border = CreateFrame("Frame", nil, F, "BackdropTemplate")
F.Border:SetAllPoints(F)
F.Border:SetBackdrop({
edgeFile = "Interface\\Buttons\\WHITE8x8",
edgeSize = 1
})
F.Border:SetBackdropBorderColor(0, 0, 0, 1)
F.IsUnitFrameIcon = true
self:SetProperties(F, info, true, s)
self.UnitIcon[i] = F
return F
end
end
end
function NSI:CreateBar(info)
self.ReminderBar = self.ReminderBar or {}
local s = NSRT.ReminderSettings.BarSettings
for i=1, #self.ReminderBar+1 do
if self.ReminderBar[i] and not self.ReminderBar[i]:IsShown() then
self:SetProperties(self.ReminderBar[i], info, false, s)
return self.ReminderBar[i]
end
if not self.ReminderBar[i] then
local F = CreateFrame("StatusBar", 'NSUIReminderBar' .. i, UIParent, "BackdropTemplate")
F:SetBackdrop({
bgFile = "Interface\\Buttons\\WHITE8x8",
tileSize = 0,
})
F:SetStatusBarTexture(self.LSM:Fetch("statusbar", s.Texture))
F:SetStatusBarColor(unpack(info.barColors or s.barColors))
F:SetBackdropColor(unpack(s.backgroundColors))
local offset = s.GrowDirection == "Up" and (i-1) * s.Height or -(i-1) * s.Height
F:SetPoint("BOTTOMLEFT", "NSUIReminderBarMover", "BOTTOMLEFT", 0, 0 + offset)
F:SetPoint("TOPRIGHT", "NSUIReminderBarMover", "TOPRIGHT", 0, 0 + offset)
F:SetFrameStrata("HIGH")
F:SetFrameLevel(10)
F.Border = CreateFrame("Frame", nil, F, "BackdropTemplate")
F.Border:SetAllPoints(F)
F.Border:SetBackdrop({
edgeFile = "Interface\\Buttons\\WHITE8x8",
edgeSize = 1
})
F.Border:SetBackdropBorderColor(unpack(s.borderColors))
F.Icon = F:CreateTexture(nil, "ARTWORK")
F.Icon:SetPoint("RIGHT", F, "LEFT", s.xIcon, s.yIcon)
F.Icon:SetSize(s.Height, s.Height)
F.Text = F:CreateFontString(nil, "OVERLAY", "GameFontNormal")
F.Text:SetPoint("LEFT", F.Icon, "RIGHT", s.xTextOffset, s.yTextOffset)
F.Text:SetFont(self.LSM:Fetch("font", s.Font), s.FontSize, "OUTLINE")
F.Text:SetShadowColor(0, 0, 0, 1)
F.Text:SetShadowOffset(0, 0)
F.Text:SetTextColor(unpack(info.textColors or s.textColors))
F.TimerText = F:CreateFontString(nil, "OVERLAY", "GameFontNormal")
F.TimerText:SetPoint("RIGHT", F, "RIGHT", s.xTimer, s.yTimer)
F.TimerText:SetFont(self.LSM:Fetch("font", s.Font), s.TimerFontSize, "OUTLINE")
F.TimerText:SetShadowColor(0, 0, 0, 1)
F.TimerText:SetShadowOffset(0, 0)
self:SetProperties(F, info, false, s)
self.ReminderBar[i] = F
return F
end
end
end
function NSI:CreateCircle(info)
self.ReminderCircle = self.ReminderCircle or {}
local s = NSRT.ReminderSettings.CircleSettings
for i = 1, #self.ReminderCircle + 1 do
if self.ReminderCircle[i] and not self.ReminderCircle[i]:IsShown() then
self:SetProperties(self.ReminderCircle[i], info, false, s)
return self.ReminderCircle[i]
end
if not self.ReminderCircle[i] then
local F = CreateFrame("Frame", nil, UIParent, "BackdropTemplate")
F.IsCircle = true
F:SetSize(s.Size, s.Size)
F:SetFrameStrata("HIGH")
F:SetFrameLevel(10)
local circleTexture = GetCircleTexture(info)
F.ring = F:CreateTexture(nil, "ARTWORK")
F.ring:SetTexture(circleTexture)
F.ring:SetAllPoints(F)
F.ring:SetVertexColor(0, 0, 0, 0.85)
local shouldShow = info.showBackground == nil and s.showBackground or info.showBackground
F.ring:SetShown(shouldShow)
F.Swipe = CreateFrame("Cooldown", nil, F, "CooldownFrameTemplate")
F.Swipe:SetAllPoints(F)
F.Swipe:SetDrawBling(false)
F.Swipe:SetDrawEdge(false)
F.Swipe:SetReverse(false)
F.Swipe:SetHideCountdownNumbers(true)
F.Swipe:SetSwipeTexture(circleTexture)
F.Swipe:SetSwipeColor(unpack(info.ringColors or s.ringColors))
F.Text = F:CreateFontString(nil, "OVERLAY", "GameFontNormal")
PositionCircleText(F.Text, F, s)
F.Text:SetFont(self.LSM:Fetch("font", s.Font), s.FontSize, "OUTLINE")
F.Text:SetShadowColor(0, 0, 0, 1)
F.Text:SetShadowOffset(0, 0)
F.Text:SetTextColor(unpack(info.textColors or s.textColors))
local xoff = (s.GrowDirection == "Right" and (i-1)*(s.Size+s.Spacing)) or (s.GrowDirection == "Left" and -(i-1)*(s.Size+s.Spacing)) or 0
local yoff = (s.GrowDirection == "Up" and (i-1)*(s.Size+s.Spacing)) or (s.GrowDirection == "Down" and -(i-1)*(s.Size+s.Spacing)) or 0
F:SetPoint("BOTTOMLEFT", "NSUIReminderCircleMover", "BOTTOMLEFT", xoff, yoff)
F:SetPoint("TOPRIGHT", "NSUIReminderCircleMover", "TOPRIGHT", xoff, yoff)
self.ReminderCircle[i] = F
self:SetProperties(F, info, false, s)
return F
end
end
end
function NSI:AddTickToBar(F, percent, HideTimer)
if (not F) or F:GetObjectType() ~= "StatusBar" or (not percent) or percent > 1 or percent < 0 then return end
local s = NSRT.ReminderSettings.BarSettings
local width = s.Width * percent
local height = s.Height
F.Ticks = F.Ticks or {}
for i=1, #F.Ticks+1 do
if F.Ticks[i] and not F.Ticks[i]:IsShown() then
F.Ticks[i]:ClearAllPoints()
F.Ticks[i]:SetPoint("LEFT", F, "LEFT", width, 0)
F.Ticks[i]:Show()
F.Ticks[i].HideTimer = HideTimer
return
end
if not F.Ticks[i] then
F.Ticks[i] = F:CreateTexture(nil, "OVERLAY")
F.Ticks[i]:SetColorTexture(1, 1, 1, 1)
F.Ticks[i]:SetSize(2, height)
F.Ticks[i]:SetPoint("LEFT", F, "LEFT", width, 0)
F.Ticks[i]:Show()
F.Ticks[i].HideTimer = HideTimer
return
end
end
end
function NSI:CheckReminderLogic(info)
local condition = info and info.isConditional
if condition then
local func = type(condition) == "table" and condition.func or condition
if type(func) == "string" and func ~= "" then
local chunk, err = loadstring(func)