ESO Lua File v100015

ingame/centerscreenannounce/centerscreenannouncehandlers.lua

[◄ back to folders ]
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
-- Miscellaneous data
local OBJECTIVE_STATE_ALLIANCE_TO_SOUND_ID =
{
    [OBJECTIVE_CONTROL_EVENT_UNDER_ATTACK] =
    {
        [ALLIANCE_ALDMERI_DOMINION] = SOUNDS.FLAG_ATTACKED_ALLIANCE1,
        [ALLIANCE_EBONHEART_PACT] = SOUNDS.FLAG_ATTACKED_ALLIANCE2,
        [ALLIANCE_DAGGERFALL_COVENANT] = SOUNDS.FLAG_ATTACKED_ALLIANCE3,
    },
    [OBJECTIVE_CONTROL_EVENT_LOST] =
    {
        [ALLIANCE_ALDMERI_DOMINION] = SOUNDS.FLAG_LOST_ALLIANCE1,
        [ALLIANCE_EBONHEART_PACT] = SOUNDS.FLAG_LOST_ALLIANCE2,
        [ALLIANCE_DAGGERFALL_COVENANT] = SOUNDS.FLAG_LOST_ALLIANCE3,
    },
    [OBJECTIVE_CONTROL_EVENT_CAPTURED] =
    {
        [ALLIANCE_ALDMERI_DOMINION] = SOUNDS.FLAG_CAPUTURED_ALLIANCE1,
        [ALLIANCE_EBONHEART_PACT] = SOUNDS.FLAG_CAPUTURED_ALLIANCE2,
        [ALLIANCE_DAGGERFALL_COVENANT] = SOUNDS.FLAG_CAPUTURED_ALLIANCE3,
    },
    [OBJECTIVE_CONTROL_EVENT_ASSAULTED] =
    {
        [ALLIANCE_ALDMERI_DOMINION] = SOUNDS.FLAG_ASSAULTED_ALLIANCE1,
        [ALLIANCE_EBONHEART_PACT] = SOUNDS.FLAG_ASSAULTED_ALLIANCE2,
        [ALLIANCE_DAGGERFALL_COVENANT] = SOUNDS.FLAG_ASSAULTED_ALLIANCE3,
    },
}
local OBJECTIVE_EVENT_DESCRIPTIONS =
{
    [OBJECTIVE_CONTROL_EVENT_UNDER_ATTACK] =            function(objectiveName, keepId, objectiveId, param1, param2)
                                                            local soundId = OBJECTIVE_STATE_ALLIANCE_TO_SOUND_ID[OBJECTIVE_CONTROL_EVENT_UNDER_ATTACK][param1]
                                                            return zo_strformat(GetString(SI_BG_OBJECTIVE_UNDER_ATTACK), objectiveName), soundId
                                                        end,
    [OBJECTIVE_CONTROL_EVENT_CAPTURED] =                function(objectiveName, keepId, objectiveId, param1, param2)
                                                            local capturingAlliance
                                                            local isInBattleground = IsAvAObjectiveInBattleground(keepId, objectiveId, BGQUERY_LOCAL)
                                                            local _, objType, _, _, _ = GetAvAObjectiveInfo(keepId, objectiveId, BGQUERY_LOCAL)
                                                            if(isInBattleground or objType == OBJECTIVE_CAPTURE_AREA) then
                                                                if(not isInBattleground or GetGameType() == GAME_CAPTURE_AREA) then
                                                                    capturingAlliance = param1
                                                                else
                                                                    capturingAlliance = param2
                                                                end
                                                                local soundId = OBJECTIVE_STATE_ALLIANCE_TO_SOUND_ID[OBJECTIVE_CONTROL_EVENT_CAPTURED][capturingAlliance]
                                                                return zo_strformat(GetString(SI_BG_OBJECTIVE_CAPTURED), objectiveName, GetColoredAllianceName(capturingAlliance)), soundId
                                                            end
                                                        end,
    [OBJECTIVE_CONTROL_EVENT_LOST] =                    function(objectiveName, keepId, objectiveId, param1, param2)
                                                            local allianceName = GetColoredAllianceName(param2)
                                                            local soundId = OBJECTIVE_STATE_ALLIANCE_TO_SOUND_ID[OBJECTIVE_CONTROL_EVENT_LOST][param2]
                                                            return zo_strformat(GetString(SI_BG_OBJECTIVE_GAINING_CONTROL), allianceName, objectiveName), soundId
                                                        end,
    [OBJECTIVE_CONTROL_EVENT_ASSAULTED] =               function(objectiveName, keepId, objectiveId, param1, param2)
                                                            local soundId = OBJECTIVE_STATE_ALLIANCE_TO_SOUND_ID[OBJECTIVE_CONTROL_EVENT_ASSAULTED][param2]
                                                            return zo_strformat(GetString(SI_BG_OBJECTIVE_ASSAULTED), objectiveName), soundId
                                                        end,
    -- OBJECTIVE_CONTROL_EVENT_FLAG_TAKEN, OBJECTIVE_CONTROL_EVENT_FLAG_DROPPED, OBJECTIVE_CONTROL_EVENT_FLAG_RETURNED, OBJECTIVE_CONTROL_EVENT_FLAG_RETURNED_BY_TIMER
    -- These messages are incorrectly built and made obsolete by the artifact control state event generated messages. However, artifact change updates only
    -- come from a special message that may not be getting sent down in a battleground situation. When battlegrounds are reenabled, we should send this message
    -- on flag events, rather than use what's here, because we don't have enough information to format the message correctly (no player name)
    -- using just the objective control state event
    -- For now, these events types are skipped when they come from AvA
    [OBJECTIVE_CONTROL_EVENT_FLAG_TAKEN] =              function(objectiveName, keepId, objectiveId, param1, param2)
                                                            if(IsAvAObjectiveInBattleground(keepId, objectiveId, BGQUERY_LOCAL)) then
                                                                local holdingAllianceName = GetColoredAllianceName(param2)
                                                                return zo_strformat(GetString(SI_BG_FLAG_TAKEN), holdingAllianceName, objectiveName)
                                                            end
                                                        end,
    [OBJECTIVE_CONTROL_EVENT_FLAG_DROPPED] =            function(objectiveName, keepId, objectiveId, param1, param2)
                                                            if(IsAvAObjectiveInBattleground(keepId, objectiveId, BGQUERY_LOCAL)) then
                                                                local droppingAllianceName = GetColoredAllianceName(param2)
                                                                return zo_strformat(GetString(SI_BG_FLAG_DROPPED), objectiveName, droppingAllianceName)
                                                            end
                                                        end,
    [OBJECTIVE_CONTROL_EVENT_FLAG_RETURNED] =           function(objectiveName, keepId, objectiveId, param1, param2)
                                                            if(IsAvAObjectiveInBattleground(keepId, objectiveId, BGQUERY_LOCAL)) then
                                                                return zo_strformat(GetString(SI_BG_FLAG_RETURNED), objectiveName)
                                                            end
                                                        end,
    [OBJECTIVE_CONTROL_EVENT_FLAG_RETURNED_BY_TIMER] =  function(objectiveName, keepId, objectiveId, param1, param2)
                                                            if(IsAvAObjectiveInBattleground(keepId, objectiveId, BGQUERY_LOCAL)) then
                                                                return zo_strformat(GetString(SI_BG_FLAG_RETURNED), objectiveName)
                                                            end
                                                        end,
}
function GetAvAObjectiveEventDescription(keepId, objectiveId, objectiveName, objectiveType, event, param1, param2)
    local f = OBJECTIVE_EVENT_DESCRIPTIONS[event]
    if(f) then
        return f(objectiveName, keepId, objectiveId, param1, param2)
    end
end
local ARTIFACT_STATE_ALLIANCE_TO_SOUND_ID =
{
    [OBJECTIVE_CONTROL_EVENT_CAPTURED] =
    {
        [ALLIANCE_ALDMERI_DOMINION] = SOUNDS.ELDER_SCROLL_CAPTURED_BY_ALDMERI,
        [ALLIANCE_EBONHEART_PACT] = SOUNDS.ELDER_SCROLL_CAPTURED_BY_EBONHEART,
        [ALLIANCE_DAGGERFALL_COVENANT] = SOUNDS.ELDER_SCROLL_CAPTURED_BY_DAGGERFALL,
    },
}
local ARTIFACT_EVENT_DESCRIPTIONS =
{
    [OBJECTIVE_CONTROL_EVENT_FLAG_TAKEN] =              function(artifactName, keepId, playerName, alliance, allianceName, campaignId)
                                                            if(campaignId ~= 0) then
                                                                if(keepId ~= 0) then
                                                                    return zo_strformat(SI_CAMPAIGN_ARTIFACT_TAKEN, playerName, allianceName, artifactName, GetKeepName(keepId), GetCampaignName(campaignId))
                                                                else
                                                                    return zo_strformat(SI_CAMPAIGN_ARTIFACT_PICKED_UP, playerName, allianceName, artifactName, GetCampaignName(campaignId))
                                                                end
                                                            else
                                                                if(keepId ~= 0) then
                                                                    return zo_strformat(SI_ARTIFACT_TAKEN, playerName, allianceName, artifactName, GetKeepName(keepId))
                                                                else
                                                                    return zo_strformat(SI_ARTIFACT_PICKED_UP, playerName, allianceName, artifactName)
                                                                end
                                                            end
                                                        end,
    [OBJECTIVE_CONTROL_EVENT_CAPTURED] =                function(artifactName, keepId, playerName, alliance, allianceName, campaignId)
                                                            local soundId = ARTIFACT_STATE_ALLIANCE_TO_SOUND_ID[OBJECTIVE_CONTROL_EVENT_CAPTURED][alliance]
                                                            if(campaignId ~= 0) then
                                                                return zo_strformat(SI_CAMPAIGN_ARTIFACT_CAPTURED, playerName, allianceName, artifactName, GetKeepName(keepId), GetCampaignName(campaignId)), soundId
                                                            else
                                                                return zo_strformat(SI_ARTIFACT_CAPTURED, playerName, allianceName, artifactName, GetKeepName(keepId)), soundId
                                                            end
                                                        end,
    [OBJECTIVE_CONTROL_EVENT_FLAG_RETURNED] =           function(artifactName, keepId, playerName, alliance, allianceName, campaignId)
                                                            if(campaignId ~= 0) then
                                                                return zo_strformat(SI_CAMPAIGN_ARTIFACT_RETURNED, playerName, allianceName, artifactName, GetKeepName(keepId), GetCampaignName(campaignId))
                                                            else
                                                                return zo_strformat(SI_ARTIFACT_RETURNED, playerName, allianceName, artifactName, GetKeepName(keepId))
                                                            end
                                                        end,
    [OBJECTIVE_CONTROL_EVENT_FLAG_RETURNED_BY_TIMER] =  function(artifactName, keepId, playerName, alliance, allianceName, campaignId)
                                                            if(campaignId ~= 0) then
                                                                return zo_strformat(SI_CAMPAIGN_ARTIFACT_RETURNED_BY_TIMER, artifactName, GetKeepName(keepId), GetCampaignName(campaignId))
                                                            else
                                                                return zo_strformat(SI_ARTIFACT_RETURNED_BY_TIMER, artifactName, GetKeepName(keepId))
                                                            end
                                                        end,
    [OBJECTIVE_CONTROL_EVENT_FLAG_DROPPED] =            function(artifactName, keepId, playerName, alliance, allianceName, campaignId)
                                                            if(campaignId ~= 0) then
                                                                return zo_strformat(SI_CAMPAIGN_ARTIFACT_DROPPED, playerName, allianceName, artifactName, GetCampaignName(campaignId))
                                                            else
                                                                return zo_strformat(SI_ARTIFACT_DROPPED, playerName, allianceName, artifactName)
                                                            end
                                                        end,
}
function GetAvAArtifactEventDescription(artifactName, keepId, playerName, playerAlliance, event, campaignId)
    local f = ARTIFACT_EVENT_DESCRIPTIONS[event]
    if(f) then
        return f(artifactName, keepId, playerName, playerAlliance, GetColoredAllianceName(playerAlliance), campaignId)
    end
end
function GetKeepOwnershipChangedEventDescription(campaignId, keepId, oldOwner, newOwner)
    if(campaignId ~= 0) then
        return zo_strformat(SI_CAMPAIGN_KEEP_CAPTURED, GetColoredAllianceName(newOwner), GetKeepName(keepId), GetColoredAllianceName(oldOwner), GetCampaignName(campaignId))
    else
        return zo_strformat(SI_KEEP_CAPTURED, GetColoredAllianceName(newOwner), GetKeepName(keepId), GetColoredAllianceName(oldOwner))
    end
end
function GetGateStateChangedDescription(keepId, open)
    if(open) then
        return zo_strformat(SI_KEEP_CHANGE_GATE_OPENED, GetKeepName(keepId)), SOUNDS.AVA_GATE_OPENED
    else
        return zo_strformat(SI_KEEP_CHANGE_GATE_CLOSED, GetKeepName(keepId)), SOUNDS.AVA_GATE_CLOSED
    end
end
local CORONATION_SOUND =
{
    [ALLIANCE_ALDMERI_DOMINION] = SOUNDS.EMPEROR_CORONATED_ALDMERI,
    [ALLIANCE_EBONHEART_PACT] = SOUNDS.EMPEROR_CORONATED_EBONHEART,
    [ALLIANCE_DAGGERFALL_COVENANT] = SOUNDS.EMPEROR_CORONATED_DAGGERFALL,
}
local DEPOSED_SOUND =
{
    [ALLIANCE_ALDMERI_DOMINION] = SOUNDS.EMPEROR_DEPOSED_ALDMERI,
    [ALLIANCE_EBONHEART_PACT] = SOUNDS.EMPEROR_DEPOSED_EBONHEART,
    [ALLIANCE_DAGGERFALL_COVENANT] = SOUNDS.EMPEROR_DEPOSED_DAGGERFALL,
}
function GetCoronateEmperorEventDescription(campaignId, playerCharacterName, playerAlliance, playerDisplayName)
    local userFacingName = IsInGamepadPreferredMode() and ZO_FormatUserFacingDisplayName(playerDisplayName) or playerCharacterName
    return zo_strformat(SI_CAMPAIGN_CORONATE_EMPEROR, GetCampaignName(campaignId), userFacingName, GetColoredAllianceName(playerAlliance)), CORONATION_SOUND[playerAlliance]
end
function GetDeposeEmperorEventDescription(campaignId, playerCharacterName, playerAlliance, abdication, playerDisplayName)
    local userFacingName = IsInGamepadPreferredMode() and ZO_FormatUserFacingDisplayName(playerDisplayName) or playerCharacterName
    if(abdication) then
        return zo_strformat(SI_CAMPAIGN_ABDICATE_EMPEROR, GetCampaignName(campaignId), userFacingName, GetColoredAllianceName(playerAlliance)), SOUNDS.EMPEROR_ABDICATED
    else
        return zo_strformat(SI_CAMPAIGN_DEPOSE_EMPEROR, GetCampaignName(campaignId), userFacingName, GetColoredAllianceName(playerAlliance)), DEPOSED_SOUND[playerAlliance]
    end
end
local IMPERIAL_CITY_GAINED_SOUND =
{
    [ALLIANCE_ALDMERI_DOMINION] = SOUNDS.IMPERIAL_CITY_ACCESS_GAINED_ALDMERI,
    [ALLIANCE_EBONHEART_PACT] = SOUNDS.IMPERIAL_CITY_ACCESS_GAINED_EBONHEART,
    [ALLIANCE_DAGGERFALL_COVENANT] = SOUNDS.IMPERIAL_CITY_ACCESS_GAINED_DAGGERFALL,
}
local IMPERIAL_CITY_LOST_SOUND =
{
    [ALLIANCE_ALDMERI_DOMINION] = SOUNDS.IMPERIAL_CITY_LOST_SOUND_ALDMERI,
    [ALLIANCE_EBONHEART_PACT] = SOUNDS.IMPERIAL_CITY_LOST_SOUND_EBONHEART,
    [ALLIANCE_DAGGERFALL_COVENANT] = SOUNDS.IMPERIAL_CITY_LOST_SOUND_DAGGERFALL,
}
function GetImperialCityAccessGainedEventDescription(campaignId, alliance)
        return zo_strformat(SI_IMPERIAL_CITY_ACCESS_GAINED, GetCampaignName(campaignId), GetColoredAllianceName(alliance)), IMPERIAL_CITY_GAINED_SOUND[alliance]
end
function GetImperialCityAccessLostEventDescription(campaignId, alliance)
        return zo_strformat(SI_IMPERIAL_CITY_ACCESS_LOST, GetCampaignName(campaignId), GetColoredAllianceName(alliance)), IMPERIAL_CITY_LOST_SOUND[alliance]
end
-- TODO: real sounds
function GetClaimKeepCampaignEventDescription(campaignId, keepId, guildName, playerName)
    return zo_strformat(SI_CAMPAIGN_CLAIM_KEEP_EVENT, GetCampaignName(campaignId), GetKeepName(keepId), guildName, playerName), SOUNDS.GUILD_KEEP_CLAIMED
end
function GetReleaseKeepCampaignEventDescription(campaignId, keepId, guildName, playerName)
    return zo_strformat(SI_CAMPAIGN_RELEASE_KEEP_EVENT, GetCampaignName(campaignId), GetKeepName(keepId), guildName, playerName), SOUNDS.GUILD_KEEP_RELEASED
end
function GetLostKeepCampaignEventDescription(campaignId, keepId, guildName)
    return zo_strformat(SI_CAMPAIGN_LOST_KEEP_EVENT, GetCampaignName(campaignId), GetKeepName(keepId), guildName), SOUNDS.GUILD_KEEP_LOST
end
-- Return format is
-- Category - The alert category to send the alert to
-- SoundId - An optional sound id to play along with the message
-- Message - The message to alert (either a string or a function that returns a string that will be called every frame)
-- (Optional) Message2 - For combined text, the secondary text to display (either a string or a function that returns a string that will be called every frame)
-- (Optional) icon - An icon to be displayed with the announcement
-- (Optional) expiringCallback - A callback to be called when the announcement has begun fading out
-- (optional) bar params
-- (optional) lifespan of the message to be on the screen in milliseconds
--
-- NOTE: If a later optional return is used, the previous optional returns must be used as well (even if they return nil)
-- If Category or Message is nil, then nothing will be shown. Simply not returning anything tells the system to not do anything.
local CSH = { }
CSH[EVENT_QUEST_ADDED] = function(journalIndex, questName, objectiveName)
    return CSA_EVENT_LARGE_TEXT, SOUNDS.QUEST_ACCEPTED, zo_strformat(SI_NOTIFYTEXT_QUEST_ACCEPT, questName)
end
local function GetRelevantBarParams(level, previousExperience, currentExperience, championPoints)
    local championXpToNextPoint
    if CanUnitGainChampionPoints("player") then
        championXpToNextPoint = GetNumChampionXPInChampionPoint(championPoints)
    end  
    if(championXpToNextPoint ~= nil and currentExperience > previousExperience) then
        return CENTER_SCREEN_ANNOUNCE:CreateBarParams(PPB_CP, championPoints, previousExperience, currentExperience)
    else
        local levelSize
        if(level) then
            levelSize = GetNumExperiencePointsInLevel(level)
        end
        if(levelSize ~= nil and currentExperience >  previousExperience) then
            return CENTER_SCREEN_ANNOUNCE:CreateBarParams(PPB_XP, level, previousExperience, currentExperience)
        end
    end
end
CSH[EVENT_QUEST_COMPLETE] = function(questName, level, previousExperience, currentExperience, championPoints)
    local barParams = GetRelevantBarParams(level, previousExperience, currentExperience, championPoints)
    return CSA_EVENT_LARGE_TEXT, SOUNDS.QUEST_COMPLETED, zo_strformat(SI_NOTIFYTEXT_QUEST_COMPLETE, questName), nil, nil, nil, nil, barParams
end
CSH[EVENT_OBJECTIVE_COMPLETED] = function(zoneIndex, poiIndex, level, previousExperience, currentExperience, championPoints) 
    local barParams = GetRelevantBarParams(level, previousExperience, currentExperience, championPoints)
    local name, _, _, finishedDescription = GetPOIInfo(zoneIndex, poiIndex)
    return CSA_EVENT_COMBINED_TEXT, SOUNDS.OBJECTIVE_COMPLETED, zo_strformat(SI_NOTIFYTEXT_OBJECTIVE_COMPLETE, name), finishedDescription, nil, nil, nil, barParams
end
CSH[EVENT_QUEST_CONDITION_COUNTER_CHANGED] = function(journalIndex, questName, conditionText, conditionType, currConditionVal, newConditionVal, conditionMax, isFailCondition, stepOverrideText, isPushed, isComplete, isConditionComplete, isStepHidden)
    if(isStepHidden or (isPushed and isComplete) or (currConditionVal >= newConditionVal)) then
        return
    end
    local sound
    if(newConditionVal ~= currConditionVal and not isFailCondition) then
        if(isConditionComplete) then
            sound = SOUNDS.QUEST_OBJECTIVE_COMPLETE
        else
            sound = SOUNDS.QUEST_OBJECTIVE_INCREMENT
        end
    end
    if isConditionComplete and conditionType == QUEST_CONDITION_TYPE_GIVE_ITEM then
        return CSA_EVENT_SMALL_TEXT, sound, zo_strformat(SI_TRACKED_QUEST_STEP_DONE, conditionText)
    end
    if stepOverrideText == "" then
        if isFailCondition then
            if conditionMax > 1 then
                return CSA_EVENT_SMALL_TEXT, sound, zo_strformat(SI_ALERTTEXT_QUEST_CONDITION_FAIL, conditionText, newConditionVal, conditionMax)
            else
                return CSA_EVENT_SMALL_TEXT, sound, zo_strformat(SI_ALERTTEXT_QUEST_CONDITION_FAIL_NO_COUNT, conditionText)
            end
        else
            if conditionMax > 1 and newConditionVal < conditionMax then
                return CSA_EVENT_SMALL_TEXT, sound, zo_strformat(SI_ALERTTEXT_QUEST_CONDITION_UPDATE, conditionText, newConditionVal, conditionMax)
            else
                return CSA_EVENT_SMALL_TEXT, sound, zo_strformat(SI_ALERTTEXT_QUEST_CONDITION_UPDATE_NO_COUNT, conditionText)
            end
        end
    else
        if isFailCondition then
            return CSA_EVENT_SMALL_TEXT, sound, zo_strformat(SI_ALERTTEXT_QUEST_CONDITION_FAIL_NO_COUNT, stepOverrideText)
        else
            return CSA_EVENT_SMALL_TEXT, sound, zo_strformat(SI_ALERTTEXT_QUEST_CONDITION_UPDATE_NO_COUNT, stepOverrideText)
        end
    end
end
CSH[EVENT_QUEST_OPTIONAL_STEP_ADVANCED] = function(text)
    if(text ~= "") then
        return CSA_EVENT_SMALL_TEXT, SOUNDS.QUEST_OBJECTIVE_COMPLETE, zo_strformat(SI_ALERTTEXT_QUEST_CONDITION_UPDATE_NO_COUNT, text)
    end
end
CSH[EVENT_ACHIEVEMENT_AWARDED] = function(name, points, id)
    local icon = select(4, GetAchievementInfo(id))
    return CSA_EVENT_COMBINED_TEXT, SOUNDS.ACHIEVEMENT_AWARDED, GetString(SI_ACHIEVEMENT_AWARDED_CENTER_SCREEN), zo_strformat(name), icon, "EsoUI/Art/Achievements/achievements_iconBG.dds"
end
CSH[EVENT_BROADCAST] = function(message)
    return CSA_EVENT_SMALL_TEXT, SOUNDS.MESSAGE_BROADCAST, string.format("|cffff00%s|r", message) -- TODO: Proper colorization
end
CSH[EVENT_DISCOVERY_EXPERIENCE] = function(subzoneName, level, previousExperience, currentExperience, championPoints)
    if(not INTERACT_WINDOW:IsShowingInteraction()) then
        if currentExperience > previousExperience then
            local barParams = GetRelevantBarParams(level, previousExperience, currentExperience, championPoints)
        end
        return CSA_EVENT_LARGE_TEXT, SOUNDS.OBJECTIVE_DISCOVERED, zo_strformat(SI_SUBZONE_NOTIFICATION_DISCOVER, subzoneName), nil, nil, nil, nil, barParams
    end
end
CSH[EVENT_POI_DISCOVERED] = function(zoneIndex, poiIndex)
    local name, _, startDescription = GetPOIInfo(zoneIndex, poiIndex)
    return CSA_EVENT_COMBINED_TEXT, SOUNDS.OBJECTIVE_ACCEPTED, zo_strformat(SI_NOTIFYTEXT_OBJECTIVE_DISCOVERED, name), startDescription
end
local XP_GAIN_SHOW_REASONS =
{
    [PROGRESS_REASON_PVP_EMPEROR] = true,
    [PROGRESS_REASON_DUNGEON_CHALLENGE] = true,
    [PROGRESS_REASON_OVERLAND_BOSS_KILL] = true,
    [PROGRESS_REASON_SCRIPTED_EVENT] = true,
    [PROGRESS_REASON_LOCK_PICK] = true,
    [PROGRESS_REASON_LFG_REWARD] = true,
}
local XP_GAIN_SHOW_SOUNDS =
{
    [PROGRESS_REASON_OVERLAND_BOSS_KILL] = SOUNDS.OVERLAND_BOSS_KILL,
    [PROGRESS_REASON_LOCK_PICK] = SOUNDS.LOCKPICKING_SUCCESS_CELEBRATION,
}
CSH[EVENT_EXPERIENCE_GAIN] = function(reason, level, previousExperience, currentExperience, championPoints)
    if(XP_GAIN_SHOW_REASONS[reason]) then
        local barParams = GetRelevantBarParams(level, previousExperience, currentExperience, championPoints)
        if(barParams) then
            local sound = XP_GAIN_SHOW_SOUNDS[reason]
            barParams:SetSound(sound)
            CENTER_SCREEN_ANNOUNCE:AddMessage(EVENT_EXPERIENCE_GAIN, CSA_EVENT_NO_TEXT, nil, nil, nil, nil, nil, nil, barParams)
        end
    end
    local levelSize = GetNumExperiencePointsInLevel(level)
    if levelSize ~= nil and currentExperience >= levelSize then
        local barParams = CENTER_SCREEN_ANNOUNCE:CreateBarParams(PPB_XP, level + 1, currentExperience - levelSize, currentExperience - levelSize)
        barParams:SetShowNoGain(true)
        CENTER_SCREEN_ANNOUNCE:AddMessage(EVENT_EXPERIENCE_GAIN, CSA_EVENT_LARGE_TEXT, SOUNDS.LEVEL_UP, GetString(SI_LEVEL_UP_NOTIFICATION), nil, nil, nil, nil, barParams)
    end
end
    local championPoints = GetPlayerChampionPointsEarned()
    local currentChampionXP = GetPlayerChampionXP()
    local barParams = CENTER_SCREEN_ANNOUNCE:CreateBarParams(PPB_CP, championPoints, currentChampionXP, currentChampionXP)
    barParams:SetShowNoGain(true)
    return barParams
end
    local barParams = GetCurrentChampionPointsBarParams()
    local headerText = zo_strformat(SI_ENLIGHTENED_STATE_HEADER_FORMAT, GetString(SI_ENLIGHTENED_STATE_GAINED_HEADER))
    return CSA_EVENT_COMBINED_TEXT, SOUNDS.ENLIGHTENED_STATE_GAINED, headerText, GetString(SI_ENLIGHTENED_STATE_GAINED_DESCRIPTION), nil, nil, nil, barParams
end
CSH[EVENT_ENLIGHTENED_STATE_GAINED] = function()
        return GetEnlightenedGainedAnnouncement()
    end
end
CSH[EVENT_ENLIGHTENED_STATE_LOST] = function()
        local barParams = GetCurrentChampionPointsBarParams()
        local headerText = zo_strformat(SI_ENLIGHTENED_STATE_HEADER_FORMAT, GetString(SI_ENLIGHTENED_STATE_LOST_HEADER))
        return CSA_EVENT_LARGE_TEXT, SOUNDS.ENLIGHTENED_STATE_LOST, headerText, nil, nil, nil, nil, barParams
    end
end
local firstActivation = true
CSH[EVENT_PLAYER_ACTIVATED] = function()
    if firstActivation then
        firstActivation = false
        if IsEnlightenedAvailableForCharacter() and GetEnlightenedPool() > 0 then
            return GetEnlightenedGainedAnnouncement()
        end
    end
end
CSH[EVENT_SKILL_RANK_UPDATE] = function(skillType, lineIndex, rank)
    -- crafting skill updates get deferred if they're increased while crafting animations are in progress
    -- ZO_Skills_TieSkillInfoHeaderToCraftingSkill handles triggering the deferred center screen announce in that case
    if skillType ~= SKILL_TYPE_RACIAL and (skillType ~= SKILL_TYPE_TRADESKILL or not ZO_CraftingUtils_IsPerformingCraftProcess()) then
        local lineName = GetSkillLineInfo(skillType, lineIndex)
        return CSA_EVENT_LARGE_TEXT, SOUNDS.SKILL_LINE_LEVELED_UP, zo_strformat(SI_SKILL_RANK_UP, lineName, rank)
    end
end
local GUILD_SKILL_SHOW_REASONS =
{
    [PROGRESS_REASON_DARK_ANCHOR_CLOSED] = true,
    [PROGRESS_REASON_DARK_FISSURE_CLOSED] = true,
    [PROGRESS_REASON_BOSS_KILL] = true,
}
local GUILD_SKILL_SHOW_SOUNDS =
{
    [PROGRESS_REASON_DARK_ANCHOR_CLOSED] = SOUNDS.SKILL_XP_DARK_ANCHOR_CLOSED,
    [PROGRESS_REASON_DARK_FISSURE_CLOSED] = SOUNDS.SKILL_XP_DARK_FISSURE_CLOSED,
    [PROGRESS_REASON_BOSS_KILL] = SOUNDS.SKILL_XP_BOSS_KILLED,
}
CSH[EVENT_SKILL_XP_UPDATE] = function(skillType, skillIndex, reason, rank, previousXP, currentXP)
    if((skillType == SKILL_TYPE_GUILD and GUILD_SKILL_SHOW_REASONS[reason]) or reason == PROGRESS_REASON_JUSTICE_SKILL_EVENT) then
        local barType = PLAYER_PROGRESS_BAR:GetBarType(PPB_CLASS_SKILL, skillType, skillIndex)
        local rankStartXP, nextRankStartXP = GetSkillLineRankXPExtents(skillType, skillIndex, rank)
        local sound = GUILD_SKILL_SHOW_SOUNDS[reason]
        local barParams = CENTER_SCREEN_ANNOUNCE:CreateBarParams(barType, rank, previousXP - rankStartXP, currentXP - rankStartXP, sound)
        return CSA_EVENT_NO_TEXT, nil, nil, nil, nil, nil, nil, barParams
    end
end
CSH[EVENT_ABILITY_PROGRESSION_RANK_UPDATE] = function(progressionIndex, rank, maxRank, morph)
    local _, _, _, atMorph = GetAbilityProgressionXPInfo(progressionIndex)
    local name = GetAbilityProgressionAbilityInfo(progressionIndex, morph, rank)
    if(atMorph) then
        return CSA_EVENT_LARGE_TEXT, SOUNDS.ABILITY_MORPH_AVAILABLE, zo_strformat(SI_MORPH_AVAILABLE_ANNOUNCEMENT, name)
    else
        return CSA_EVENT_SMALL_TEXT, SOUNDS.ABILITY_RANK_UP, zo_strformat(SI_ABILITY_RANK_UP, name, rank)
    end
end
CSH[EVENT_SKILL_POINTS_CHANGED] = function(oldPoints, newPoints, oldPartialPoints, newPartialPoints)
    if oldPartialPoints ~= newPartialPoints then
        local smallString
        if newPartialPoints == 0 then
            if newPoints <= oldPoints then
                return
            end
            smallString = zo_strformat(SI_SKILL_POINT_GAINED, newPoints - oldPoints)
        else
            smallString = zo_strformat(SI_SKYSHARD_GAINED_POINTS, newPartialPoints, NUM_PARTIAL_SKILL_POINTS_FOR_FULL)
        end
        return CSA_EVENT_COMBINED_TEXT, SOUNDS.SKYSHARD_GAINED, GetString(SI_SKYSHARD_GAINED), smallString
    elseif newPoints > oldPoints then
        return CSA_EVENT_COMBINED_TEXT, SOUNDS.SKILL_GAINED, zo_strformat(SI_SKILL_POINT_GAINED, newPoints - oldPoints)
    end
end
CSH[EVENT_SKILL_LINE_ADDED] = function(skillType, lineIndex)
    local lineName = GetSkillLineInfo(skillType, lineIndex)
    return CSA_EVENT_SMALL_TEXT, SOUNDS.SKILL_LINE_ADDED, zo_strformat(SI_SKILL_LINE_ADDED, lineName)
end
CSH[EVENT_LORE_BOOK_LEARNED] = function(categoryIndex, collectionIndex, bookIndex, guildReputationIndex, isMaxRank)
    if(guildReputationIndex == 0 or isMaxRank) then
        -- We only want to fire this event if a player is not part of the guild or if they've reached max level in the guild.
        -- Otherwise, the _SKILL_EXPERIENCE version of this event will send a center screen message instead.
        local hidden = select(5, GetLoreCollectionInfo(categoryIndex, collectionIndex))
        if(not hidden) then
            return CSA_EVENT_LARGE_TEXT, SOUNDS.BOOK_ACQUIRED, GetString(SI_LORE_LIBRARY_ANNOUNCE_BOOK_LEARNED)
        end
    end
end
CSH[EVENT_LORE_BOOK_LEARNED_SKILL_EXPERIENCE] = function(categoryIndex, collectionIndex, bookIndex, guildReputationIndex, skillType, skillIndex, rank, previousXP, currentXP)
    if(guildReputationIndex > 0) then
        local barType = PLAYER_PROGRESS_BAR:GetBarType(PPB_CLASS_SKILL, skillType, skillIndex)
        local rankStartXP, nextRankStartXP = GetSkillLineRankXPExtents(skillType, skillIndex, rank)
        local barParams = CENTER_SCREEN_ANNOUNCE:CreateBarParams(barType, rank, previousXP - rankStartXP, currentXP - rankStartXP)
        return CSA_EVENT_LARGE_TEXT, SOUNDS.BOOK_ACQUIRED, GetString(SI_LORE_LIBRARY_ANNOUNCE_BOOK_LEARNED), nil, nil, nil, nil, barParams
    end
end
CSH[EVENT_LORE_COLLECTION_COMPLETED] = function(categoryIndex, collectionIndex, bookIndex, guildReputationIndex, isMaxRank)
    if(guildReputationIndex == 0 or isMaxRank) then
        -- Only fire this message if we're not part of the guild or at max level within the guild.
        local collectionName, description, numKnownBooks, totalBooks, hidden = GetLoreCollectionInfo(categoryIndex, collectionIndex)
        if(not hidden) then
            return CSA_EVENT_COMBINED_TEXT, SOUNDS.BOOK_COLLECTION_COMPLETED, GetString(SI_LORE_LIBRARY_COLLECTION_COMPLETED_LARGE), zo_strformat(SI_LORE_LIBRARY_COLLECTION_COMPLETED_SMALL, collectionName)
        end
    end
end
CSH[EVENT_LORE_COLLECTION_COMPLETED_SKILL_EXPERIENCE] = function(categoryIndex, collectionIndex, guildReputationIndex, skillType, skillIndex, rank, previousXP, currentXP)
    if(guildReputationIndex > 0) then
        local collectionName, description, numKnownBooks, totalBooks, hidden = GetLoreCollectionInfo(categoryIndex, collectionIndex)
        if(not hidden) then
            local barType = PLAYER_PROGRESS_BAR:GetBarType(PPB_CLASS_SKILL, skillType, skillIndex)
            local rankStartXP, nextRankStartXP = GetSkillLineRankXPExtents(skillType, skillIndex, rank)
            local barParams = CENTER_SCREEN_ANNOUNCE:CreateBarParams(barType, rank, previousXP - rankStartXP, currentXP - rankStartXP)
            return CSA_EVENT_COMBINED_TEXT, SOUNDS.BOOK_COLLECTION_COMPLETED, GetString(SI_LORE_LIBRARY_COLLECTION_COMPLETED_LARGE), zo_strformat(SI_LORE_LIBRARY_COLLECTION_COMPLETED_SMALL, collectionName), nil, nil, nil, barParams
        end
    end        
end
CSH[EVENT_PLEDGE_OF_MARA_RESULT] = function(result, characterName, displayName)
    if(result == PLEDGE_OF_MARA_RESULT_PLEDGED) then
        return CSA_EVENT_COMBINED_TEXT, nil, GetString(SI_RITUAL_OF_MARA_COMPLETION_ANNOUNCE_LARGE), zo_strformat(SI_RITUAL_OF_MARA_COMPLETION_ANNOUNCE_SMALL, ZO_FormatUserFacingDisplayName(displayName), characterName)
    end
end
CSH[EVENT_MEDAL_AWARDED] = function(name, icon, condition)
    return CSA_EVENT_COMBINED_TEXT, SOUNDS.MEDAL_AWARDED, zo_strformat(SI_MEDAL_NOTIFIER_MESSAGE, name), condition -- todo: icon?
end
CSH[EVENT_OBJECTIVE_CONTROL_STATE] = function(keepId, objectiveId, bgContext, objectiveName, objectiveType, event, state, param1, param2)
    --[[
if(IsPlayerInAvAWorld()) then
if objectiveType ~= OBJECTIVE_ARTIFACT_OFFENSIVE and objectiveType ~= OBJECTIVE_ARTIFACT_DEFENSIVE then
local description, soundId = GetAvAObjectiveEventDescription(keepId, objectiveId, objectiveName, objectiveType, event, param1, param2)
return CSA_EVENT_SMALL_TEXT, soundId, description
end
end
--]]
end
CSH[EVENT_ARTIFACT_CONTROL_STATE] = function(artifactName, keepId, characterName, playerAlliance, controlEvent, controlState, campaignId, displayName)
    local nameToShow = IsInGamepadPreferredMode() and ZO_FormatUserFacingDisplayName(displayName) or characterName
    local description, soundId = GetAvAArtifactEventDescription(artifactName, keepId, nameToShow, playerAlliance, controlEvent, campaignId)
    return CSA_EVENT_SMALL_TEXT, soundId, description
end
CSH[EVENT_KEEP_GATE_STATE_CHANGED] = function(keepId, open)
    local description, soundId = GetGateStateChangedDescription(keepId, open)
    return CSA_EVENT_SMALL_TEXT, soundId, description
end
CSH[EVENT_KEEP_OWNERSHIP_CHANGED_NOTIFICATION] = function(campaignId, keepId, oldOwner, newOwner)
    --[[
local description = GetKeepOwnershipChangedEventDescription(campaignId, keepId, oldOwner, newOwner)
return CSA_EVENT_SMALL_TEXT, SOUNDS.AVA_KEEP_CAPTURED, description
--]]
end
CSH[EVENT_CORONATE_EMPEROR_NOTIFICATION] = function(campaignId, playerCharacterName, playerAlliance, playerDisplayName)
    local description, soundId = GetCoronateEmperorEventDescription(campaignId, playerCharacterName, playerAlliance, playerDisplayName)
    return CSA_EVENT_SMALL_TEXT, soundId, description, nil, nil, nil, nil, nil, 5000
end
CSH[EVENT_DEPOSE_EMPEROR_NOTIFICATION] = function(campaignId, playerCharacterName, playerAlliance, abdication, playerDisplayName)
    local description, soundId = GetDeposeEmperorEventDescription(campaignId, playerCharacterName, playerAlliance, abdication, playerDisplayName)
    return CSA_EVENT_SMALL_TEXT, soundId, description, nil, nil, nil, nil, nil, 5000
end
CSH[EVENT_IMPERIAL_CITY_ACCESS_GAINED_NOTIFICATION] = function(campaignId, alliance)
    local description, soundId = GetImperialCityAccessGainedEventDescription(campaignId, alliance)
    return CSA_EVENT_SMALL_TEXT, soundId, description
end
CSH[EVENT_IMPERIAL_CITY_ACCESS_LOST_NOTIFICATION] = function(campaignId, alliance)
    local description, soundId = GetImperialCityAccessLostEventDescription(campaignId, alliance)
    return CSA_EVENT_SMALL_TEXT, soundId, description
end
CSH[EVENT_REVENGE_KILL] = function(killedCharacterName, killedDisplayName)
    if(IsPlayerInAvAWorld()) then
        local killedName = IsInGamepadPreferredMode() and ZO_FormatUserFacingDisplayName(killedDisplayName) or killedCharacterName
        local description = zo_strformat(SI_REVENGE_KILL, killedName)
        local soundId = nil -- needs sound?
        return CSA_EVENT_SMALL_TEXT, soundId, description
    end
end
CSH[EVENT_AVENGE_KILL] = function(avengedCharacterName, killedCharacterName, avengedDisplayName, killedDisplayName)
    if(IsPlayerInAvAWorld()) then
        local avengedName = avengedCharacterName
        local killedName = killedCharacterName
        if IsInGamepadPreferredMode() then
            avengedName = ZO_FormatUserFacingDisplayName(avengedDisplayName)
            killedName = ZO_FormatUserFacingDisplayName(killedDisplayName)
        end
        local description = zo_strformat(SI_AVENGE_KILL, avengedName, killedName)
        local soundId = nil -- needs sound?
        return CSA_EVENT_SMALL_TEXT, soundId, description
    end
end
--[[
CSH[EVENT_GUILD_CLAIM_KEEP_CAMPAIGN_NOTIFICATION] = function(campaignId, keepId, guildName, playerName)
local description, soundId = GetClaimKeepCampaignEventDescription(campaignId, keepId, guildName, playerName)
return CSA_EVENT_SMALL_TEXT, soundId, description
end
CSH[EVENT_GUILD_RELEASE_KEEP_CAMPAIGN_NOTIFICATION] = function(campaignId, keepId, guildName, playerName)
local description, soundId = GetReleaseKeepCampaignEventDescription(campaignId, keepId, guildName, playerName)
return CSA_EVENT_SMALL_TEXT, soundId, description
end
CSH[EVENT_GUILD_LOST_KEEP_CAMPAIGN_NOTIFICATION] = function(campaignId, keepId, guildName)
local description, soundId = GetLostKeepCampaignEventDescription(campaignId, keepId, guildName)
return CSA_EVENT_SMALL_TEXT, soundId, description
end]]
--
CSH[EVENT_DISPLAY_ANNOUNCEMENT] = function(title, description)
    if(title ~= "" and description ~= "") then
        return CSA_EVENT_COMBINED_TEXT, SOUNDS.DISPLAY_ANNOUNCEMENT, title, description
    elseif(title ~= "") then
        return CSA_EVENT_LARGE_TEXT, SOUNDS.DISPLAY_ANNOUNCEMENT, title
    elseif(description ~= "") then
        return CSA_EVENT_SMALL_TEXT, SOUNDS.DISPLAY_ANNOUNCEMENT, description
    end
end
CSH[EVENT_RAID_TRIAL_STARTED] = function(raidName, isWeekly)
    return CSA_EVENT_COMBINED_TEXT, SOUNDS.RAID_TRIAL_STARTED, zo_strformat(SI_TRIAL_STARTED, raidName)
end
do
    local TRIAL_COMPLETE_LIFESPAN_MS = 10000
    CSH[EVENT_RAID_TRIAL_COMPLETE] = function(raidName, score, totalTime)
        local wasUnderTargetTime = GetRaidDuration() <= GetRaidTargetTime()
        local formattedTime = ZO_FormatTimeMilliseconds(totalTime, TIME_FORMAT_STYLE_COLONS, TIME_FORMAT_PRECISION_SECONDS)
        local vitalityBonus = GetCurrentRaidLifeScoreBonus()
        local currentCount = GetRaidReviveCountersRemaining()
        local maxCount = GetCurrentRaidStartingReviveCounters()
        return CSA_EVENT_RAID_COMPLETE_TEXT, SOUNDS.RAID_TRIAL_COMPLETED, zo_strformat(SI_TRIAL_COMPLETED_LARGE, raidName), { score, formattedTime, wasUnderTargetTime, vitalityBonus, zo_strformat(SI_REVIVE_COUNTER_REVIVES_USED, currentCount, maxCount) }, nil, nil, nil, nil, TRIAL_COMPLETE_LIFESPAN_MS
    end
end
CSH[EVENT_RAID_TRIAL_FAILED] = function(raidName, score)
    return CSA_EVENT_LARGE_TEXT, SOUNDS.RAID_TRIAL_FAILED, zo_strformat(SI_TRIAL_FAILED, raidName)
end
CSH[EVENT_RAID_TRIAL_NEW_BEST_SCORE] = function(raidName, score, isWeekly)
    return CSA_EVENT_SMALL_TEXT, SOUNDS.RAID_TRIAL_NEW_BEST, zo_strformat(isWeekly and SI_TRIAL_NEW_BEST_SCORE_WEEKLY or SI_TRIAL_NEW_BEST_SCORE_LIFETIME, raidName)
end
CSH[EVENT_RAID_REVIVE_COUNTER_UPDATE] = function(currentCount, countDelta)
-- TODO: revisit this once there is a way to properly handle this in client/server code
    if not IsRaidInProgress() then
        return
    end
    if countDelta < 0 then
        return CSA_EVENT_LARGE_TEXT, SOUNDS.RAID_TRIAL_COUNTER_UPDATE, zo_strformat(SI_REVIVE_COUNTER_UPDATED_LARGE, "EsoUI/Art/Trials/VitalityDepletion.dds")
    end
end
do
    local COLLECTIBLE_EMERGENCY_BACKGROUND = "EsoUI/Art/Guild/guildRanks_iconFrame_selected.dds"
    local function AddCollectibleMessage(collectibleName, iconFile, categoryName, subcategoryName)
        local titleText = GetString(SI_COLLECTIONS_UPDATED_ANNOUNCEMENT_TITLE)
        local displayedCategory = subcategoryName and subcategoryName or categoryName
        local bodyText = zo_strformat(SI_COLLECTIONS_UPDATED_ANNOUNCEMENT_BODY, collectibleName, displayedCategory)
        CENTER_SCREEN_ANNOUNCE:AddMessage(EVENT_COLLECTIBLE_UPDATED, CSA_EVENT_COMBINED_TEXT, SOUNDS.COLLECTIBLE_UNLOCKED, titleText, bodyText, iconFile, COLLECTIBLE_EMERGENCY_BACKGROUND)
    end
    CSH[EVENT_COLLECTIBLE_UPDATED] = function(collectibleId, justUnlocked)
        if not justUnlocked then
            return
        end
        local collectibleName, _, iconFile = GetCollectibleInfo(collectibleId)
        local isPlaceholder = IsCollectiblePlaceholder(collectibleId)
        if not isPlaceholder then
            local categoryIndex, subcategoryIndex = GetCategoryInfoFromCollectibleId(collectibleId)
            local categoryName = GetCollectibleCategoryInfo(categoryIndex)
            local subcategoryName = subcategoryIndex and GetCollectibleSubCategoryInfo(categoryIndex, subcategoryIndex) or nil
            AddCollectibleMessage(collectibleName, iconFile, categoryName, subcategoryName)
        end
    end
end
do
    local TRIAL_SCORE_REASON_TO_ASSETS =
    {
        [RAID_POINT_REASON_KILL_MINIBOSS]           = { icon = "EsoUI/Art/Trials/trialPoints_normal.dds", soundId = SOUNDS.RAID_TRIAL_SCORE_ADDED_NORMAL },
        [RAID_POINT_REASON_KILL_BOSS]               = { icon = "EsoUI/Art/Trials/trialPoints_veryHigh.dds", soundId = SOUNDS.RAID_TRIAL_SCORE_ADDED_VERY_HIGH },
        [RAID_POINT_REASON_BONUS_ACTIVITY_LOW]      = { icon = "EsoUI/Art/Trials/trialPoints_veryLow.dds", soundId = SOUNDS.RAID_TRIAL_SCORE_ADDED_VERY_LOW },
        [RAID_POINT_REASON_BONUS_ACTIVITY_MEDIUM]   = { icon = "EsoUI/Art/Trials/trialPoints_low.dds", soundId = SOUNDS.RAID_TRIAL_SCORE_ADDED_LOW },
        [RAID_POINT_REASON_BONUS_ACTIVITY_HIGH]     = { icon = "EsoUI/Art/Trials/trialPoints_high.dds", soundId = SOUNDS.RAID_TRIAL_SCORE_ADDED_HIGH },
        [RAID_POINT_REASON_SOLO_ARENA_PICKUP_ONE]   = { icon = "EsoUI/Art/Trials/trialPoints_veryLow.dds", soundId = SOUNDS.RAID_TRIAL_SCORE_ADDED_VERY_LOW },
        [RAID_POINT_REASON_SOLO_ARENA_PICKUP_TWO]   = { icon = "EsoUI/Art/Trials/trialPoints_low.dds", soundId = SOUNDS.RAID_TRIAL_SCORE_ADDED_LOW },
        [RAID_POINT_REASON_SOLO_ARENA_PICKUP_THREE] = { icon = "EsoUI/Art/Trials/trialPoints_normal.dds", soundId = SOUNDS.RAID_TRIAL_SCORE_ADDED_NORMAL },
        [RAID_POINT_REASON_SOLO_ARENA_PICKUP_FOUR]  = { icon = "EsoUI/Art/Trials/trialPoints_high.dds", soundId = SOUNDS.RAID_TRIAL_SCORE_ADDED_HIGH },
        [RAID_POINT_REASON_SOLO_ARENA_COMPLETE]     = { icon = "EsoUI/Art/Trials/trialPoints_veryHigh.dds", soundId = SOUNDS.RAID_TRIAL_SCORE_ADDED_VERY_HIGH },
    }
    CSH[EVENT_RAID_TRIAL_SCORE_UPDATE] = function(scoreType, scoreAmount, totalScore)
        local reasonAssets = TRIAL_SCORE_REASON_TO_ASSETS[scoreType]
        if reasonAssets then
            return CSA_EVENT_LARGE_TEXT,
                reasonAssets.soundId,
                zo_strformat(SI_TRIAL_SCORE_UPDATED_LARGE, reasonAssets.icon, scoreAmount)
        end
    end
end
do
    local CHAMPION_UNLOCKED_LIFESPAN_MS = 12000
    CSH[EVENT_CHAMPION_LEVEL_ACHIEVED] = function(wasChampionSystemUnlocked)
        local barParams
        local formattedIcon = zo_iconFormat(GetChampionPointsIcon(), "100%", "100%")
        if wasChampionSystemUnlocked then
            local championPoints = GetPlayerChampionPointsEarned()
            local currentChampionXP = GetPlayerChampionXP()
            barParams = CENTER_SCREEN_ANNOUNCE:CreateBarParams(PPB_CP, championPoints, currentChampionXP, currentChampionXP)
            barParams:SetShowNoGain(true)
            return  CSA_EVENT_LARGE_TEXT, SOUNDS.CHAMPION_POINT_GAINED, zo_strformat(SI_CHAMPION_ANNOUNCEMENT_UNLOCKED, formattedIcon), nil, nil, nil, nil, barParams
        else
            local totalChampionPoints = GetPlayerChampionPointsEarned()
            local championXPGained = 0;
            for i = 0, (totalChampionPoints - 1) do
                championXPGained = championXPGained + GetNumChampionXPInChampionPoint(i)
            end
            barParams =  CENTER_SCREEN_ANNOUNCE:CreateBarParams(PPB_CP, 0, 0, championXPGained)
            return  CSA_EVENT_LARGE_TEXT, SOUNDS.CHAMPION_POINT_GAINED, zo_strformat(SI_CHAMPION_ANNOUNCEMENT_UNLOCKED, formattedIcon), nil, nil, nil, nil, barParams, CHAMPION_UNLOCKED_LIFESPAN_MS
        end
    end
end
CSH[EVENT_CHAMPION_POINT_GAINED] = function(pointDelta)
    -- adding one so that we are starting from the first gained point instead of the starting champion points
    local endingPoints = GetPlayerChampionPointsEarned()
    local startingPoints = endingPoints - pointDelta + 1
    local championPointsByType = { 0, 0, 0 }
    while startingPoints <= endingPoints do
        local pointType = GetChampionPointAttributeForRank(startingPoints)
        championPointsByType[pointType] = championPointsByType[pointType] + 1
        startingPoints = startingPoints + 1
    end
    local secondLine = ""
    for pointType,amount in pairs(championPointsByType) do
        if amount > 0 then
            local icon = GetChampionPointAttributeHUDIcon(pointType)
            local constellationGroupName = ZO_Champion_GetUnformattedConstellationGroupNameFromAttribute(pointType)
            secondLine = secondLine .. zo_strformat(SI_CHAMPION_POINT_TYPE, amount, icon, constellationGroupName) .. "\n"
        end
    end
    return CSA_EVENT_COMBINED_TEXT, SOUNDS.CHAMPION_POINT_GAINED, zo_strformat(SI_CHAMPION_POINT_EARNED, pointDelta), secondLine, nil, nil, nil, nil, nil, CSA_OPTION_SUPPRESS_ICON_FRAME
end
CSH[EVENT_INVENTORY_BAG_CAPACITY_CHANGED] = function(previousCapacity, currentCapacity, previousUpgrade, currentUpgrade)
    if previousCapacity > 0 and previousCapacity ~= currentCapacity and previousUpgrade ~= currentUpgrade then
        return CSA_EVENT_COMBINED_TEXT, nil, GetString(SI_INVENTORY_BAG_UPGRADE_ANOUNCEMENT_TITLE), zo_strformat(SI_INVENTORY_BAG_UPGRADE_ANOUNCEMENT_DESCRIPTION, previousCapacity, currentCapacity)
    end
end
CSH[EVENT_INVENTORY_BANK_CAPACITY_CHANGED] = function(previousCapacity, currentCapacity, previousUpgrade, currentUpgrade)
    if previousCapacity > 0 and previousCapacity ~= currentCapacity and previousUpgrade ~= currentUpgrade then
        return CSA_EVENT_COMBINED_TEXT, nil, GetString(SI_INVENTORY_BANK_UPGRADE_ANOUNCEMENT_TITLE), zo_strformat(SI_INVENTORY_BANK_UPGRADE_ANOUNCEMENT_DESCRIPTION, previousCapacity, currentCapacity)
    end
end
CSH[EVENT_ATTRIBUTE_FORCE_RESPEC] = function(note)
    return CSA_EVENT_COMBINED_TEXT, nil, GetString(SI_ATTRIBUTE_FORCE_RESPEC_TITLE), zo_strformat(SI_ATTRIBUTE_FORCE_RESPEC_PROMPT, note)
end
CSH[EVENT_SKILL_FORCE_RESPEC] = function(note)
    return CSA_EVENT_COMBINED_TEXT, nil, GetString(SI_SKILLS_FORCE_RESPEC_TITLE), zo_strformat(SI_SKILLS_FORCE_RESPEC_PROMPT, note)
end
CSH[EVENT_ACTIVITY_FINDER_ACTIVITY_COMPLETE] = function()
    return CSA_EVENT_LARGE_TEXT, SOUNDS.LFG_COMPLETE_ANNOUNCEMENT, GetString(SI_ACTIVITY_FINDER_ACTIVITY_COMPLETE_ANNOUNCEMENT_TEXT)
end
    return CSH
end
    return CSH[eventId]
end
    -- Lower-priority events
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_MEDAL_AWARDED)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_PLEDGE_OF_MARA_RESULT)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_ACHIEVEMENT_AWARDED)
    --ZO_CenterScreenAnnounce_SetEventPriority(EVENT_OBJECTIVE_CONTROL_STATE)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_ARTIFACT_CONTROL_STATE)
    --ZO_CenterScreenAnnounce_SetEventPriority(EVENT_KEEP_GATE_STATE_CHANGED)
    --ZO_CenterScreenAnnounce_SetEventPriority(EVENT_KEEP_OWNERSHIP_CHANGED_NOTIFICATION)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_CORONATE_EMPEROR_NOTIFICATION)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_DEPOSE_EMPEROR_NOTIFICATION)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_IMPERIAL_CITY_ACCESS_GAINED_NOTIFICATION)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_IMPERIAL_CITY_ACCESS_LOST_NOTIFICATION)
    --ZO_CenterScreenAnnounce_SetEventPriority(EVENT_GUILD_LOST_KEEP_CAMPAIGN_NOTIFICATION)
    --ZO_CenterScreenAnnounce_SetEventPriority(EVENT_GUILD_RELEASE_KEEP_CAMPAIGN_NOTIFICATION)
    --ZO_CenterScreenAnnounce_SetEventPriority(EVENT_GUILD_CLAIM_KEEP_CAMPAIGN_NOTIFICATION)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_REVENGE_KILL)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_AVENGE_KILL)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_ABILITY_PROGRESSION_RANK_UPDATE)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_SKILL_LINE_ADDED)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_SKILL_RANK_UPDATE)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_SKILL_XP_UPDATE)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_LORE_COLLECTION_COMPLETED)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_LORE_COLLECTION_COMPLETED_SKILL_EXPERIENCE)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_LORE_BOOK_LEARNED)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_LORE_BOOK_LEARNED_SKILL_EXPERIENCE)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_SKILL_POINTS_CHANGED)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_RAID_TRIAL_NEW_BEST_SCORE)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_RAID_TRIAL_COMPLETE)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_RAID_TRIAL_FAILED)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_RAID_TRIAL_SCORE_UPDATE)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_RAID_TRIAL_STARTED)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_DISCOVERY_EXPERIENCE)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_CHAMPION_POINT_GAINED)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_LEVEL_UPDATE)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_CHAMPION_LEVEL_ACHIEVED)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_EXPERIENCE_GAIN)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_OBJECTIVE_COMPLETED)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_DISPLAY_ANNOUNCEMENT)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_QUEST_COMPLETE)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_QUEST_OPTIONAL_STEP_ADVANCED)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_QUEST_CONDITION_COUNTER_CHANGED)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_QUEST_ADDED)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_POI_DISCOVERED)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_JUSTICE_NOW_KOS)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_JUSTICE_NO_LONGER_KOS)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_COLLECTIBLE_UPDATED)
    ZO_CenterScreenAnnounce_SetEventPriority(EVENT_RIDING_SKILL_IMPROVEMENT)
    -- Higher-priority events
    -- Miscellaneous event handlers
    local function OnQuestRemoved(eventId, isCompleted, journalIndex, questName, zoneIndex, poiIndex)
        if not isCompleted then
            PlaySound(SOUNDS.QUEST_ABANDONED)
        end
    end
    -- Quest Advancement displays all the "appropriate" conditions that the player needs to do to advance the current step
    local function OnQuestAdvanced(eventId, questIndex, questName, isPushed, isComplete, mainStepChanged)
        if(not mainStepChanged) then return end
        local announceObject = CENTER_SCREEN_ANNOUNCE
        local sound = SOUNDS.QUEST_OBJECTIVE_STARTED
        for stepIndex = QUEST_MAIN_STEP_INDEX, GetJournalQuestNumSteps(questIndex) do
            local _, visibility, stepType, stepOverrideText, conditionCount = GetJournalQuestStepInfo(questIndex, stepIndex)
            if((visibility == nil) or (visibility == QUEST_STEP_VISIBILITY_OPTIONAL)) then
                if(stepOverrideText ~= "") then
                    announceObject:AddMessage(eventId, CSA_EVENT_SMALL_TEXT, sound, stepOverrideText)
                    sound = nil -- no longer needed, we played it once
                else
                    for conditionIndex = 1, conditionCount do
                        local conditionText, curCount, maxCount, isFailCondition, isConditionComplete, _, isVisible  = GetJournalQuestConditionInfo(questIndex, stepIndex, conditionIndex)
                        if(not (isFailCondition or isConditionComplete) and isVisible) then
                            announceObject:AddMessage(eventId, CSA_EVENT_SMALL_TEXT, sound, conditionText)
                            sound = nil -- no longer needed, we played it once
                        end
                    end
                end
            end
        end
    end
    local function OnQuestAdded(eventId, questIndex)
        OnQuestAdvanced(EVENT_QUEST_ADVANCED, questIndex, nil, nil, nil, true)
    end
    EVENT_MANAGER:RegisterForEvent("CSA_MiscellaneousHandlers", EVENT_QUEST_REMOVED, OnQuestRemoved)
    EVENT_MANAGER:RegisterForEvent("CSA_MiscellaneousHandlers", EVENT_QUEST_ADVANCED, OnQuestAdvanced)
    EVENT_MANAGER:RegisterForEvent("CSA_MiscellaneousHandlers", EVENT_QUEST_ADDED, OnQuestAdded)
end
-- Center Screen Queueable Handlers
-- Usage: Whenever there is an event type that occurs multiple times within a short timeframe
-- add another table entry with data to help facilitate the combining of the multiple events into a single call
-- updateTimeDelaySeconds: The time delay from when an event that is marked as queueable is recieved to when the event enters into the regular event queue.
-- The system will restart the time after each new event is recieved
-- updateParameters: A table of parameter positions that should be overwritten with the latest data from the newest event recieved.
-- The position is derived from the parameters in the event callback function defined in the CSH table for the same event.
-- conditionParameters: A table of parameter positions that should be unique amoung any given number of eventIds. For example, if you kill a monster that gives
-- exp and guild rep, they will both come down as skill xp update events, but their skilltype and skillindex values are different, so they should be added the to system independently
-- and not added together for updating
local CSQH = {}
do
    local PARAMETER_SKILL_TYPE          = 1
    local PARAMETER_SKILL_INDEX         = 2
    local PARAMETER_CURRENT_CAPACITY    = 2
    local PARAMETER_CURRENT_UPGRADE     = 4
    local PARAMETER_CURRENT_XP          = 6
    local LONG_UPDATE_INTERVAL_SECONDS = 2.5
    local EXTRA_LONG_UPDATE_INTERVAL_SECONDS = 3.1
    CSQH[EVENT_SKILL_XP_UPDATE] =
    {
        updateTimeDelaySeconds = LONG_UPDATE_INTERVAL_SECONDS,
        updateParameters = {PARAMETER_CURRENT_XP},
        conditionParameters = {PARAMETER_SKILL_TYPE, PARAMETER_SKILL_INDEX}
    }
    CSQH[EVENT_RAID_REVIVE_COUNTER_UPDATE] =
    {
        updateTimeDelaySeconds = LONG_UPDATE_INTERVAL_SECONDS,
    }
    CSQH[EVENT_INVENTORY_BAG_CAPACITY_CHANGED] =
    {
        updateTimeDelaySeconds = EXTRA_LONG_UPDATE_INTERVAL_SECONDS,
        updateParameters = {PARAMETER_CURRENT_CAPACITY, PARAMETER_CURRENT_UPGRADE}
    }
    CSQH[EVENT_INVENTORY_BANK_CAPACITY_CHANGED] =
    {
        updateTimeDelaySeconds = EXTRA_LONG_UPDATE_INTERVAL_SECONDS,
        updateParameters = {PARAMETER_CURRENT_CAPACITY, PARAMETER_CURRENT_UPGRADE}
    }
end
    return CSQH
end
    return CSQH[eventId]
end