Back to Home

ESO Lua File v100032

ingame/interactwindow/interactwindow_shared.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
-- Prototyping global, so we can evaluate icons versus no icons...
USE_CHATTER_OPTION_ICON = false
local SHOW_BACK_TO_TOC_OPTION = true
local HIDE_BACK_TO_TOC_OPTION = false
local COST_OPTION_TO_PROMPT =
{
    [CHATTER_TALK_CHOICE_MONEY]      = GetString(SI_PAY_FOR_CONVERSATION_GIVE),
    [CHATTER_TALK_CHOICE_PAY_BOUNTY] = GetString(SI_PAY_FOR_CONVERSATION_GIVE),
}
local COST_OPTION_TO_PROMPT_TITLE =
{
    [CHATTER_TALK_CHOICE_MONEY]      = GetString(SI_PAY_FOR_CONVERSATION_GIVE_TITLE),
    [CHATTER_TALK_CHOICE_PAY_BOUNTY] = GetString(SI_PAY_FOR_CONVERSATION_GIVE_TITLE),
}
local CHATTER_OPTION_SHOWS_GOLD_COST =
{
    [CHATTER_TALK_CHOICE_MONEY]      = true,
    [CHATTER_TALK_CHOICE_PAY_BOUNTY] = true,
    [CHATTER_TALK_CHOICE_BEGIN_SKILL_RESPEC] = true,
    [CHATTER_TALK_CHOICE_ATTRIBUTE_RESPEC]   = true,
}
CHATTER_OPTION_ERROR =
{
    [CHATTER_TALK_CHOICE_MONEY] = SI_ERROR_CANT_AFFORD_OPTION,
    [CHATTER_TALK_CHOICE_INTIMIDATE_DISABLED] = SI_ERROR_NEED_INTIMIDATE,
    [CHATTER_TALK_CHOICE_PERSUADE_DISABLED] = SI_ERROR_NEED_PERSUADE,
    [CHATTER_GUILDKIOSK_IN_TRANSITION] = SI_INTERACT_TRADER_BIDDING_CLOSED_DURING_BID_TRANSITIONING_PERIOD,
    [CHATTER_TALK_CHOICE_PAY_BOUNTY] = SI_ERROR_CANT_AFFORD_OPTION,
    [CHATTER_TALK_CHOICE_CLEMENCY_DISABLED] = SI_ERROR_NEED_CLEMENCY,
    [CHATTER_TALK_CHOICE_CLEMENCY_COOLDOWN] = SI_ERROR_CLEMENCY_ON_COOLDOWN,
    [CHATTER_TALK_CHOICE_BEGIN_SKILL_RESPEC] = SI_ERROR_CANT_AFFORD_OPTION,
    [CHATTER_TALK_CHOICE_ATTRIBUTE_RESPEC] = SI_ERROR_CANT_AFFORD_OPTION,
}
--Event Handlers
----------------
    TriggerTutorial(TUTORIAL_TRIGGER_INVENTORY_FULL)
    ZO_Alert(UI_ALERT_CATEGORY_ERROR, SOUNDS.NEGATIVE_CLICK, GetString(SI_INVENTORY_ERROR_INVENTORY_FULL))
end
    TriggerTutorial(TUTORIAL_TRIGGER_INVENTORY_FULL)
    ZO_Alert(UI_ALERT_CATEGORY_ERROR, SOUNDS.NEGATIVE_CLICK, GetString(SI_INVENTORY_ERROR_INVENTORY_FULL))
end
local function OnConversationFailedUniqueItem()
    ZO_Alert(UI_ALERT_CATEGORY_ERROR, SOUNDS.NEGATIVE_CLICK, GetString(SI_INVENTORY_ERROR_UNIQUE_ITEM))
end
local function ShowInteractConfirmationPrompt(eventId, titleText, bodyText, acceptText, cancelText)
    ZO_Dialogs_ShowPlatformDialog("CONFIRM_INTERACTION", nil, { mainTextParams = { bodyText }, titleParams = { titleText }, buttonTextOverrides = { acceptText, cancelText } })
end
ZO_SharedInteraction = ZO_Object:Subclass()
function ZO_SharedInteraction:Initialize(control)
    self.control = control
end
local function ContextFilter(object, callback)
    -- This will wrap the callback so that it gets called with the control
    return function(...)
        local obj = SYSTEMS:GetObject(ZO_INTERACTION_SYSTEM_NAME)
        if (obj == object) then
            callback(...)
        end
    end
end
function ZO_SharedInteraction:InitializeSharedEvents()
    local function OnQuestOffered()
        local dialog, response = GetOfferedQuestInfo()
        local _, farewell = GetChatterFarewell()
        if(farewell == "") then farewell = GetString(SI_GOODBYE) end
        self:InitializeInteractWindow(dialog)
        self.importantOptions = {}
        self:PopulateChatterOption(1, AcceptOfferedQuest, response, CHATTER_GENERIC_ACCEPT)
        self:PopulateChatterOption(2, function() self:CloseChatter() end, farewell, CHATTER_GOODBYE)
        self:FinalizeChatterOptions(2)
    end
    local function OnQuestComplete(_, journalQuestIndex)
        local _, endDialog, confirmComplete, declineComplete = GetJournalQuestEnding(journalQuestIndex)
        if(confirmComplete == "") then  confirmComplete = GetString(SI_DEFAULT_QUEST_COMPLETE_CONFIRM_TEXT) end
        if(declineComplete == "") then  declineComplete = GetString(SI_DEFAULT_QUEST_COMPLETE_DECLINE_TEXT) end
        self:InitializeInteractWindow(endDialog)
        
        local confirmError = self:ShowQuestRewards(journalQuestIndex)
        if confirmError then
            confirmComplete = zo_strformat(SI_QUEST_COMPLETE_FORMAT_STRING, confirmComplete, confirmError)
        end
        self.importantOptions = {}
        self:PopulateChatterOption(1, CompleteQuest, confirmComplete, CHATTER_COMPLETE_QUEST)
        self:PopulateChatterOption(2, function() self:CloseChatter() end, declineComplete, CHATTER_GOODBYE)
        self:FinalizeChatterOptions(2)
    end
    local function OnChatterBegin(_, chatterOptionCount)
        self:UpdateChatterOptions(chatterOptionCount, HIDE_BACK_TO_TOC_OPTION)
    end
    local function OnChatterEnd()
        self:CloseChatter()
    end
    local function OnPlayerDead()
        self:CloseChatter()
        -- hmm, this seems wrong; should it happen as part of closing interact?
        -- why would a dead party member not be able to accept a shared quest?
        ZO_Dialogs_ReleaseDialog("SHARE_QUEST")
        ZO_Dialogs_ReleaseDialog("RITUAL_OF_MARA_PROMPT")
    end
    local function OnPlayerDeactivated()
        self:CloseChatter()
    end
    local function OnConversationUpdated(_, bodyText, choiceCount)
        self:InitializeInteractWindow(bodyText)
        self:UpdateChatterOptions(choiceCount, SHOW_BACK_TO_TOC_OPTION)
    end
    local function OnScreenResized()
        self:OnScreenResized()
    end
    self.eventCallbacks = {
        [EVENT_CHATTER_BEGIN] = OnChatterBegin,
        [EVENT_CHATTER_END] = OnChatterEnd,
        [EVENT_CONVERSATION_UPDATED] = OnConversationUpdated,
        [EVENT_QUEST_OFFERED] = OnQuestOffered,
        [EVENT_QUEST_COMPLETE_DIALOG] = OnQuestComplete,
        [EVENT_QUEST_COMPLETE_ATTEMPT_FAILED_INVENTORY_FULL] = OnQuestCompleteFailedInventoryFull,
        [EVENT_CONVERSATION_FAILED_INVENTORY_FULL] = OnConversationFailedInventoryFull,
        [EVENT_CONVERSATION_FAILED_UNIQUE_ITEM] = OnConversationFailedUniqueItem,
        [EVENT_PLAYER_DEAD] = OnPlayerDead,
        [EVENT_PLAYER_DEACTIVATED] = OnPlayerDeactivated,
        [EVENT_CONFIRM_INTERACT] = ShowInteractConfirmationPrompt,
        -- Handle the layout of the interaction window proportional to the available space
        [EVENT_SCREEN_RESIZED] = OnScreenResized,
    }
    for event, callback in pairs(self.eventCallbacks) do
    end
end
function ZO_SharedInteraction:CreateInteractScene(name)
    local CONVERSATION_INTERACTION =
    {
        type = "Interact",
        interactTypes = { INTERACTION_CONVERSATION, INTERACTION_QUEST },
        OnInteractSwitch = function() self:SwitchInteraction() end,
    }
    self.sceneName = name
    return ZO_InteractScene:New(name, SCENE_MANAGER, CONVERSATION_INTERACTION)
end
function ZO_SharedInteraction:CloseChatter()
    SCENE_MANAGER:Hide(self.sceneName)
end
function ZO_SharedInteraction:CloseChatterAndDismissAssistant()
    self:CloseChatter()
    local activeAssistantId = GetActiveCollectibleByType(COLLECTIBLE_CATEGORY_TYPE_ASSISTANT)
    if activeAssistantId ~= 0 then
        local collectibleData = ZO_COLLECTIBLE_DATA_MANAGER:GetCollectibleDataById(activeAssistantId)
        collectibleData:Use()
    end
end
function ZO_SharedInteraction:InitializeInteractWindow(bodyText)
    self:ResetInteraction(bodyText)
    INTERACT_WINDOW:ShowInteractWindow()
end
function ZO_SharedInteraction:OnHidden()
    RemoveActionLayerByName("SceneChangeInterceptLayer")
    ZO_Dialogs_ReleaseDialog("PAY_FOR_CONVERSATION")
    INTERACT_WINDOW:FireCallbacks("Hidden")
end
do
    local function UpdatePlayerGold(control)
        ZO_CurrencyControl_SetSimpleCurrency(control, CURT_MONEY, GetCurrencyAmount(CURT_MONEY, CURRENCY_LOCATION_CHARACTER), ZO_GAMEPAD_CURRENCY_OPTIONS_LONG_FORMAT)
        return true
    end
    function ZO_SharedInteraction:HandleChatterOptionClicked(label)
        --if it's not enabled, report why it cant be used and return
        if(not label.enabled) then
            local errorStringId = CHATTER_OPTION_ERROR[label.optionType]
            if(errorStringId) then
                ZO_Alert(UI_ALERT_CATEGORY_ERROR, SOUNDS.NEGATIVE_CLICK, errorStringId)
            end
            return
        end
        if(label.optionIndex) then
            local oiType = type(label.optionIndex)
            if(oiType == "number") then
                --popup a dialog if it's an option with a cost and the cost is greater than free
                if(COST_OPTION_TO_PROMPT[label.optionType] and label.gold and label.gold > 0) then
                    ZO_Dialogs_ShowPlatformDialog(
                        "PAY_FOR_CONVERSATION", 
                        {
                            chatterOptionIndex = label.optionIndex,
                            data1 = {
                                        header = GetString(SI_GAMEPAD_PAY_FOR_CONVERSATION_AVAILABLE_FUNDS),
                                        value = UpdatePlayerGold,
                                    },
                        },
                        {
                            titleParams = { COST_OPTION_TO_PROMPT_TITLE[label.optionType] },
                            mainTextParams = { COST_OPTION_TO_PROMPT[label.optionType], ZO_Currency_FormatPlatform(CURT_MONEY, label.gold, ZO_CURRENCY_FORMAT_WHITE_AMOUNT_ICON) }
                        }
                    )
                --otherwise just do it
                else
                    SelectChatterOption(label.optionIndex)
                end
            elseif(oiType == "function") then
                label.optionIndex()
            end
        else
            self:CloseChatter()
        end
    end
end
CHATTER_GENERIC_ACCEPT = 42
CHATTER_COMPLETE_QUEST = 43
local OPTION_TO_ICON =
{
    [CHATTER_START_TALK]                        = "EsoUI/Art/Interaction/ConversationAvailable.dds",
    [CHATTER_TALK_CHOICE]                       = "EsoUI/Art/Interaction/ConversationAvailable.dds",
    [CHATTER_TALK_CHOICE_MONEY]                 = "EsoUI/Art/Interaction/ConversationWithCost.dds",
    [CHATTER_TALK_CHOICE_INTIMIDATE_DISABLED]   = "EsoUI/Art/Interaction/ConversationAvailable.dds",
    [CHATTER_TALK_CHOICE_PERSUADE_DISABLED]     = "EsoUI/Art/Interaction/ConversationAvailable.dds",
    [CHATTER_TALK_CHOICE_CLEMENCY_DISABLED]     = "EsoUI/Art/Interaction/ConversationAvailable.dds",
    [CHATTER_TALK_CHOICE_CLEMENCY_COOLDOWN]     = "EsoUI/Art/Interaction/ConversationAvailable.dds",
    [CHATTER_TALK_CHOICE_BEGIN_SKILL_RESPEC]    = "EsoUI/Art/Interaction/ConversationWithCost.dds",
    [CHATTER_TALK_CHOICE_ATTRIBUTE_RESPEC]      = "EsoUI/Art/Interaction/ConversationWithCost.dds",
    [CHATTER_START_NEW_QUEST_BESTOWAL]          = "EsoUI/Art/Interaction/ConversationAvailable.dds",
    [CHATTER_START_COMPLETE_QUEST]              = "EsoUI/Art/Interaction/QuestCompleteAvailable.dds",
    [CHATTER_START_GIVE_ITEM]                   = "EsoUI/Art/Interaction/ConversationAvailable.dds",
    [CHATTER_GUILDKIOSK_IN_TRANSITION]          = "EsoUI/Art/Interaction/ConversationAvailable.dds",
    [CHATTER_START_SHOP]                        = "EsoUI/Art/Interaction/StoreAvailable.dds",
    [CHATTER_GOODBYE]                           = "EsoUI/Art/Interaction/Goodbye.dds",
    [CHATTER_GENERIC_ACCEPT]                    = "EsoUI/Art/Interaction/Accept.dds",
    [CHATTER_COMPLETE_QUEST]                    = "EsoUI/Art/Interaction/Accept.dds",
}
local function UpdateFleeChatterOption(self)
    self:SetText(zo_strformat(SI_INTERACT_OPTION_FLEE_ARREST, GetSecondsUntilArrestTimeout()))
end
function ZO_SharedInteraction:UpdateClemencyChatterOption(control, data)
    local clemencyTimeRemaningSeconds = GetTimeToClemencyResetInSeconds()
    if clemencyTimeRemaningSeconds == 0 and not data.optionUsable then
    elseif clemencyTimeRemaningSeconds > 0 then
        local formattedString = zo_strformat(SI_INTERACT_OPTION_USE_CLEMENCY_COOLDOWN, control.optionText, ZO_FormatTimeLargestTwo(clemencyTimeRemaningSeconds, TIME_FORMAT_STYLE_DESCRIPTIVE_MINIMAL))
        control:SetText(formattedString)
    end
end
function ZO_SharedInteraction:UpdateShadowyConnectionsChatterOption(control, data)
    local timeRemaining = GetTimeToShadowyConnectionsResetInSeconds()
    if timeRemaining == 0 and not data.optionUsable then
    elseif timeRemaining > 0 then
        local formattedString = zo_strformat(SI_INTERACT_OPTION_USE_SHADOWY_CONNECTIONS_COOLDOWN, control.optionText, ZO_FormatTimeLargestTwo(timeRemaining, TIME_FORMAT_STYLE_DESCRIPTIVE_MINIMAL))
        control:SetText(formattedString)
    end
end
function ZO_SharedInteraction:GetChatterOptionData(optionIndex, optionText, optionType, optionalArg, isImportant, chosenBefore)
    optionType = optionType or CHATTER_START_TALK
    local chatterData = {
        optionIndex = optionIndex,
        optionType = optionType,
        optionText = optionText,
        isImportant = isImportant,
        chosenBefore = chosenBefore,
        gold = nil,
        iconFile = nil,
        isChatterOption = true,
        optionEnabled = false,
        optionUsable = false,
        recolorIfUnusable = false,
        labelUpdateFunction = nil,
    }
    if optionText and optionType then
        chatterData.optionsEnabled = true
        chatterData.optionUsable = true
        chatterData.recolorIfUnusable = true
        if optionType == CHATTER_GOODBYE and IsUnderArrest() then
            chatterData.labelUpdateFunction = UpdateFleeChatterOption
        end
        if CHATTER_OPTION_SHOWS_GOLD_COST[optionType] then
            --optional arg is the cost in gold
            chatterData.gold = optionalArg
            if optionalArg > 0 then
                if GetCurrencyAmount(CURT_MONEY, CURRENCY_LOCATION_CHARACTER) < optionalArg then
                    chatterData.optionUsable = false
                end
                --Determine rules for suppressing the cost suffix
                local suppressCostSuffix = (optionType == CHATTER_TALK_CHOICE_PAY_BOUNTY)
                if not suppressCostSuffix then
                    local currencyText
                    if chatterData.optionUsable then
                        currencyText = ZO_Currency_FormatPlatform(CURT_MONEY, chatterData.gold, ZO_CURRENCY_FORMAT_WHITE_AMOUNT_ICON)
                    else
                        currencyText = ZO_Currency_FormatPlatform(CURT_MONEY, chatterData.gold, ZO_CURRENCY_FORMAT_ERROR_AMOUNT_ICON)
                    end
                    chatterData.optionText = zo_strformat(SI_INTERACT_OPTION_COST, optionText, currencyText)
                end
            end
        elseif optionType == CHATTER_TALK_CHOICE_INTIMIDATE_DISABLED
            or optionType == CHATTER_TALK_CHOICE_PERSUADE_DISABLED
            or optionType == CHATTER_TALK_CHOICE_CLEMENCY_DISABLED
            or optionType == CHATTER_GUILDKIOSK_IN_TRANSITION then
            chatterData.optionUsable = false
            chatterData.recolorIfUnusable = false
        elseif optionType == CHATTER_TALK_CHOICE_CLEMENCY_COOLDOWN then
            local clemencyTimeRemaningSeconds = GetTimeToClemencyResetInSeconds()
            if clemencyTimeRemaningSeconds <= 0 then
                chatterData.optionUsable = true
            else
                chatterData.labelUpdateFunction = function(control)
                                                    self:UpdateClemencyChatterOption(control, chatterData)
                                                  end
                chatterData.optionUsable = false
            end
        elseif optionType == CHATTER_TALK_CHOICE_SHADOWY_CONNECTIONS_UNAVAILABLE then
            local timeRemaining = GetTimeToShadowyConnectionsResetInSeconds()
            if timeRemaining <= 0 then
                -- We're not on cooldown, but the option is otherwise unusable (most likely, the player hasn't unlocked this passive)
                chatterData.optionUsable = false
            else
                chatterData.labelUpdateFunction = function(control)
                                                    self:UpdateShadowyConnectionsChatterOption(control, chatterData)
                                                  end
                chatterData.optionUsable = false
            end
        end
        chatterData.iconFile = OPTION_TO_ICON[optionType]
    end
    return chatterData
end
function ZO_SharedInteraction:PopulateChatterOptions(optionCount, backToTOCOption)
    local importantOptions = {}
    for i=1, optionCount do
        local optionString, optionType, optionalArg, isImportant, chosenBefore = GetChatterOption(i)
        local controlID = i
        self:PopulateChatterOption(controlID, i, optionString, optionType, optionalArg, isImportant, chosenBefore, importantOptions)
    end
    local backToTOC, farewell, isImportant = GetChatterFarewell()
    if(backToTOCOption == SHOW_BACK_TO_TOC_OPTION and backToTOC ~= "") then
        optionCount = optionCount + 1
        self:PopulateChatterOption(optionCount, ResetChatter, backToTOC, CHATTER_TALK_CHOICE)
    end
    if(farewell == "") then farewell = GetString(SI_GOODBYE) end
    optionCount = optionCount + 1
    self:PopulateChatterOption(optionCount, function() self:CloseChatter() end, farewell, CHATTER_GOODBYE, nil, isImportant, nil, importantOptions)
    
    if IsInteractingWithMyAssistant() then
        local collectibleData = ZO_COLLECTIBLE_DATA_MANAGER:GetCollectibleDataById(GetActiveCollectibleByType(COLLECTIBLE_CATEGORY_TYPE_ASSISTANT))
        farewell = zo_strformat(SI_INTERACT_OPTION_DISMISS_ASSISTANT, collectibleData:GetName())
        optionCount = optionCount + 1
        self:PopulateChatterOption(optionCount, function() self:CloseChatterAndDismissAssistant() end, farewell, CHATTER_GOODBYE, nil, isImportant, nil, importantOptions)
    end
    self:FinalizeChatterOptions(optionCount)
    return optionCount, importantOptions
end
--Reward Creator
local USE_LOWERCASE_NUMBER_SUFFIXES = false
local function SetupBasicReward(control, name, stackSize, icon, meetsUsageRequirement, r, g, b)
    local nameControl = GetControl(control, "Name")
    local iconControl = GetControl(control, "Icon")
    local stackControl = GetControl(control, "StackSize")
    control:SetHidden(false)
    nameControl:SetText(zo_strformat(SI_TOOLTIP_ITEM_NAME, name))
    iconControl:SetTexture(icon)
    iconControl:SetHidden(false)
    if meetsUsageRequirement then
        nameControl:SetColor(r or 1, g or 1, b or 1, 1)
        iconControl:SetColor(1, 1, 1, 1)
    else
        nameControl:SetColor(ZO_ERROR_COLOR:UnpackRGBA())
        iconControl:SetColor(ZO_ERROR_COLOR:UnpackRGBA())
    end
    if stackSize > 1 then
        local stackSizeString = zo_strformat(SI_NUMBER_FORMAT, ZO_AbbreviateNumber(stackSize, NUMBER_ABBREVIATION_PRECISION_TENTHS, USE_LOWERCASE_NUMBER_SUFFIXES))
        stackControl:SetText(stackSizeString)
        stackControl:SetHidden(false)
    else
        stackControl:SetHidden(true)
    end
    control.allowTooltip = true
end
local function SetupCurrencyReward(control, currencyType, amount, currencyOptions)
    ZO_CurrencyControl_SetSimpleCurrency(control, currencyType, amount, currencyOptions)
    control:SetHidden(false)
end
function ZO_QuestReward_GetSkillPointText(numPartialSkillPoints)
    if numPartialSkillPoints >= NUM_PARTIAL_SKILL_POINTS_FOR_FULL then
        local fullSkillPoints = zo_floor(numPartialSkillPoints / NUM_PARTIAL_SKILL_POINTS_FOR_FULL)
        local remainingPartialSkillPoints = numPartialSkillPoints % NUM_PARTIAL_SKILL_POINTS_FOR_FULL
        if remainingPartialSkillPoints == 0 then
            return zo_strformat(SI_QUEST_REWARD_SKILL_POINTS, fullSkillPoints)
        end
        return zo_strformat(SI_QUEST_REWARD_SKILL_POINTS_MIXED, fullSkillPoints, remainingPartialSkillPoints)
    end
    return zo_strformat(SI_QUEST_REWARD_PARTIAL_SKILL_POINTS, numPartialSkillPoints)
end
local function SetupPartialSkillPointReward(control, amount)
    local nameControl = GetControl(control, "Name")
    GetControl(control, "Icon"):SetHidden(true)
    GetControl(control, "StackSize"):SetHidden(true)
    nameControl:SetText(ZO_QuestReward_GetSkillPointText(amount))
    nameControl:SetColor(GetInterfaceColor(INTERFACE_COLOR_TYPE_TEXT_COLORS, INTERFACE_TEXT_COLOR_SELECTED))
    control.allowTooltip = false
    control:SetHidden(false)
end
local function SetupSkillLineReward(control, name, icon)
    local nameControl = GetControl(control, "Name")
    local iconTexture = GetControl(control, "Icon")
    iconTexture:SetHidden(false)
    iconTexture:SetTexture(icon)
    GetControl(control, "StackSize"):SetHidden(true)
    nameControl:SetColor(GetInterfaceColor(INTERFACE_COLOR_TYPE_TEXT_COLORS, INTERFACE_TEXT_COLOR_SELECTED))
    control.allowTooltip = false
    control:SetHidden(false)
end
function ZO_QuestReward_GetSkillLineEarnedText(skillLineName)
    return zo_strformat(SI_QUEST_REWARD_SKILL_LINE, skillLineName)
end
local REWARD_CREATORS =
{
    [REWARD_TYPE_AUTO_ITEM] =
        function(control, name, amount, icon, meetsUsageRequirement, itemQuality, itemType)
            --Collectibles should display as the default text color, white.
            if itemType == REWARD_ITEM_TYPE_COLLECTIBLE then
                SetupBasicReward(control, name, amount, icon, meetsUsageRequirement)
            else
                local r, g, b = GetInterfaceColor(INTERFACE_COLOR_TYPE_ITEM_QUALITY_COLORS, itemQuality)
                SetupBasicReward(control, name, amount, icon, meetsUsageRequirement, r, g, b)
            end
        end,
    [REWARD_TYPE_INSPIRATION] =
        function(control, name, amount, icon)
            local MEETS_USAGE_REQUIREMENTS = true
            SetupBasicReward(control, name, amount, icon, MEETS_USAGE_REQUIREMENTS)
        end,
    [REWARD_TYPE_ALLIANCE_POINTS] =
        function(control, name, amount, currencyOptions)
            SetupCurrencyReward(control, CURT_ALLIANCE_POINTS, amount, currencyOptions)
        end,
    [REWARD_TYPE_TELVAR_STONES] =
        function(control, name, amount, currencyOptions)
            SetupCurrencyReward(control, CURT_TELVAR_STONES, amount, currencyOptions)
        end,
    [REWARD_TYPE_EVENT_TICKETS] =
        function(control, name, amount, currencyOptions)
            SetupCurrencyReward(control, CURT_EVENT_TICKETS, amount, currencyOptions)
        end,
    [REWARD_TYPE_MONEY] =
        function(control, name, amount, currencyOptions)
            SetupCurrencyReward(control, CURT_MONEY, amount, currencyOptions)
        end,
    [REWARD_TYPE_PARTIAL_SKILL_POINTS] =
        function(control, name, amount)
            SetupPartialSkillPointReward(control, amount)
        end,
    [REWARD_TYPE_WRIT_VOUCHERS] =
        function(control, name, amount, currencyOptions)
            SetupCurrencyReward(control, CURT_WRIT_VOUCHERS, amount, currencyOptions)
        end,
    [REWARD_TYPE_SKILL_LINE] = 
        function(control, name, amount, icon)
            SetupSkillLineReward(control, name, icon)
        end,
    [REWARD_TYPE_CHAOTIC_CREATIA] =
        function(control, name, amount, currencyOptions)
            SetupCurrencyReward(control, CURT_CHAOTIC_CREATIA, amount, currencyOptions)
        end,
    [REWARD_TYPE_STYLE_STONES] =
        function(control, name, amount, currencyOptions)
            SetupCurrencyReward(control, CURT_STYLE_STONES, amount, currencyOptions)
        end,
    [REWARD_TYPE_UNDAUNTED_KEYS] =
        function(control, name, amount, currencyOptions)
            SetupCurrencyReward(control, CURT_UNDAUNTED_KEYS, amount, currencyOptions)
        end,
}
local currencyRewards =
{
    [REWARD_TYPE_MONEY] = true,
    [REWARD_TYPE_ALLIANCE_POINTS] = true,
    [REWARD_TYPE_TELVAR_STONES] = true,
    [REWARD_TYPE_WRIT_VOUCHERS] = true,
    [REWARD_TYPE_CHAOTIC_CREATIA] = true,
    [REWARD_TYPE_STYLE_STONES] = true,
    [REWARD_TYPE_EVENT_TICKETS] = true,
    [REWARD_TYPE_UNDAUNTED_KEYS] = true,
}
function ZO_SharedInteraction:IsCurrencyReward(rewardType)
    return currencyRewards[rewardType]
end
local currencyRewardToCurrencyType =
{
    [REWARD_TYPE_MONEY] = CURT_MONEY,
    [REWARD_TYPE_ALLIANCE_POINTS] = CURT_ALLIANCE_POINTS,
    [REWARD_TYPE_TELVAR_STONES] = CURT_TELVAR_STONES,
    [REWARD_TYPE_WRIT_VOUCHERS] = CURT_WRIT_VOUCHERS,
    [REWARD_TYPE_CHAOTIC_CREATIA] = CURT_CHAOTIC_CREATIA,
    [REWARD_TYPE_STYLE_STONES] = CURT_STYLE_STONES,
    [REWARD_TYPE_EVENT_TICKETS] = CURT_EVENT_TICKETS,
    [REWARD_TYPE_UNDAUNTED_KEYS] = CURT_UNDAUNTED_KEYS,
}
function ZO_SharedInteraction:GetCurrencyTypeFromReward(rewardType)
    return currencyRewardToCurrencyType[rewardType]
end
function ZO_SharedInteraction:TryGetMaxCurrencyWarningText(rewardType, rewardAmount)
    local currencyType = currencyRewardToCurrencyType[rewardType]
    if currencyType and (GetCurrencyAmount(currencyType, CURRENCY_LOCATION_CHARACTER) + rewardAmount >= MAX_PLAYER_CURRENCY) then
        return zo_strformat(SI_QUEST_REWARD_MAX_CURRENCY_ERROR, GetString("SI_CURRENCYTYPE", currencyType))
    end        
end
function ZO_SharedInteraction:GetRewardCreateFunc(rewardType)
    return REWARD_CREATORS[rewardType]
end
function ZO_SharedInteraction:GetRewardData(journalQuestIndex, isGamepad)
    local data = {}
    local numRewards = GetJournalQuestNumRewards(journalQuestIndex)
    for i = 1, numRewards do
        local rewardType, name, amount, icon, meetsUsageRequirement, itemDisplayQuality, itemType = GetJournalQuestRewardInfo(journalQuestIndex, i)
        --We don't want to show a collectible if we already own it
        local isCollectible = rewardType == REWARD_TYPE_AUTO_ITEM and itemType == REWARD_ITEM_TYPE_COLLECTIBLE
        local hideOwnedCollectible = isCollectible and not meetsUsageRequirement
        if not hideOwnedCollectible then
            local rewardData = 
            {
                rewardType = rewardType,
                name = name,
                amount = amount,
                icon = icon,
                meetsUsageRequirement = meetsUsageRequirement,
                displayQuality = itemDisplayQuality,
                --This value is deprecated. Keeping it here to maintain backwards compatibility for add-ons
                quality = itemDisplayQuality,
                index = i,
                itemType = itemType
            }
            if rewardType == REWARD_TYPE_SKILL_LINE then
                local skillType = GetJournalQuestRewardSkillLine(journalQuestIndex, i)
                local skillTypeData = SKILLS_DATA_MANAGER:GetSkillTypeData(skillType)
                local announce = skillTypeData:GetAnnounceIcon()
                rewardData.icon = announce
            elseif rewardType == REWARD_TYPE_INSPIRATION then
                if isGamepad then
                    rewardData.icon = "EsoUI/Art/currency/gamepad/gp_inspiration.dds"
                else
                    rewardData.icon = "EsoUI/Art/currency/currency_inspiration.dds"
                end
            end
            table.insert(data, rewardData)
        end
    end
    return data
end
-- Functions needing to be overridden
-------------------------------------
function ZO_SharedInteraction:OnScreenResized()
    -- Should be overridden
end
function ZO_SharedInteraction:InitInteraction()
    -- Should be overridden
end
function ZO_SharedInteraction:ResetInteraction(bodyText)
    -- Should be overridden
end
function ZO_SharedInteraction:SwitchInteraction()
    -- Should be overridden
end
function ZO_SharedInteraction:SelectChatterOptionByIndex(optionIndex)
    -- Should be overridden
end
function ZO_SharedInteraction:UpdateChatterOptions(optionCount, backToTOCOption)
    -- Should be overridden
end
function ZO_SharedInteraction:PopulateChatterOption(optionCount, backToTOCOption)
    -- Should be overridden
end
function ZO_SharedInteraction:FinalizeChatterOptions(optionCount)
    -- Should be overridden
end
function ZO_SharedInteraction:ShowQuestRewards(journalQuestIndex)
    -- Should be overridden
end
function ZO_SharedInteraction:UpdateClemencyOnTimeComplete(control, data)
    --Should be overridden
end
function ZO_SharedInteraction:UpdateShadowyConnectionsOnTimeComplete(control, data)
    --Should be overridden
end