Back to Home

ESO Lua File v100016

ingame/zo_quest/gamepad/questjournal_gamepad.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
local QUEST_TEMPLATE = "ZO_QuestJournal_Gamepad_MenuEntryTemplate"
local QUEST_HEADER_TEMPLATE = "ZO_GamepadMenuEntryHeaderTemplate"
local SELECTED_QUEST_TEXTURE = "EsoUI/Art/Journal/Gamepad/gp_trackedQuestIcon.dds"
ZO_QuestJournal_Gamepad = ZO_Object.MultiSubclass(ZO_QuestJournal_Shared, ZO_Gamepad_ParametricList_Screen)
function ZO_QuestJournal_Gamepad:New(...)
    local questJournalManager = ZO_QuestJournal_Shared.New(self)
    questJournalManager:Initialize(...)
    return questJournalManager
end
function ZO_QuestJournal_Gamepad:Initialize(control)
    ZO_Gamepad_ParametricList_Screen.Initialize(self, control)
    self.control = control
    self.sceneName = "gamepad_quest_journal"
    self.optionsSceneName = "gamepad_quest_journal_options"
    self.questList = self:GetMainList()
    self.questList:SetNoItemText(GetString(SI_GAMEPAD_QUEST_JOURNAL_NO_QUESTS))
    self.optionsList = self:AddList("Options")
    self:SetupOptionsList(self.optionsList)
    self.rightPane = control:GetNamedChild("RightPane")
    self.middlePane = control:GetNamedChild("MiddlePane")
    self.contentHeader = self.middlePane:GetNamedChild("Container").header
    self.conditionTextLabel = control:GetNamedChild("ConditionTextLabel")
    self.hintTextLabel = control:GetNamedChild("HintTextLabel")
    self.hintTextBulletList = ZO_BulletList:New(control:GetNamedChild("HintTextBulletList"), "ZO_QuestJournal_HintBulletLabel_Gamepad")
    self.conditionTextBulletList = ZO_BulletList:New(control:GetNamedChild("ConditionTextBulletList"), "ZO_QuestJournal_ConditionBulletLabel_Gamepad", nil, "ZO_QuestJournal_CompletedTaskIcon_Gamepad")
    self.optionalStepTextBulletList = ZO_BulletList:New(control:GetNamedChild("OptionalStepTextBulletList"), "ZO_QuestJournal_ConditionBulletLabel_Gamepad")
    local LINE_PADDING_Y = 11
    self.hintTextBulletList:SetLinePaddingY(LINE_PADDING_Y)
    self.conditionTextBulletList:SetLinePaddingY(LINE_PADDING_Y)
    self.optionalStepTextBulletList:SetLinePaddingY(LINE_PADDING_Y)
    local BULLET_PADDING_X = 34
    self.hintTextBulletList:SetBulletPaddingX(BULLET_PADDING_X)
    self.conditionTextBulletList:SetBulletPaddingX(BULLET_PADDING_X)
    self.optionalStepTextBulletList:SetBulletPaddingX(BULLET_PADDING_X)
    GAMEPAD_QUEST_JOURNAL_OPTIONS_FRAGMENT = self:GetListFragment(self.optionsList)
    ZO_GamepadGenericHeader_Initialize(self.header, ZO_GAMEPAD_HEADER_TABBAR_DONT_CREATE, ZO_GAMEPAD_HEADER_LAYOUTS.DATA_PAIRS_SEPARATE)
    self.headerData =
    {
        titleText = GetString(SI_QUEST_JOURNAL_MENU_JOURNAL),
        data1HeaderText = GetString(SI_GAMEPAD_MAIN_MENU_JOURNAL_QUESTS),
        data1Text = function() return zo_strformat(SI_GAMEPAD_QUEST_JOURNAL_CURRENT_MAX, GetNumJournalQuests(), MAX_JOURNAL_QUESTS) end,
    }
    ZO_GamepadGenericHeader_Initialize(self.contentHeader, ZO_GAMEPAD_HEADER_TABBAR_DONT_CREATE, ZO_GAMEPAD_HEADER_LAYOUTS.CONTENT_HEADER_DATA_PAIRS_LINKED)
    local FORMATTED_SELECTED_QUEST_ICON = zo_iconFormat(SELECTED_QUEST_TEXTURE, 32, 32)
    self.contentHeaderData =
    {
        titleText = function()
            local questData = self:GetSelectedQuestData()
            if questData then
                local questName, _, _, _, _, _, _, _, _, questType, instanceDisplayType = GetJournalQuestInfo(questData.questIndex)
                local conColorDef = ZO_ColorDef:New(GetConColor(questData.level))
                questName = conColorDef:Colorize(questName)
                local questIcon = zo_iconFormat(self:GetIconTexture(questType, instanceDisplayType), 48, 48)
                if QUEST_JOURNAL_MANAGER:GetFocusedQuestIndex() == questData.questIndex then
                    questName = zo_strformat(SI_GAMEPAD_SELECTED_QUEST_JOURNAL_QUEST_NAME_FORMAT, FORMATTED_SELECTED_QUEST_ICON, questIcon, questName)
                else
                    questName = zo_strformat(SI_GAMEPAD_QUEST_JOURNAL_QUEST_NAME_FORMAT, questIcon, questName)
                end
                return questName
            end
        end,
        data1HeaderText = GetString(SI_GAMEPAD_QUEST_JOURNAL_QUEST_LEVEL),
        data1Text = function()
            local questData = self:GetSelectedQuestData()
            if questData then
                return tostring(questData.level)
            end
        end,
        data2Text = function()
            local repeatableText, instanceDisplayTypeText = self:GetQuestDataString()
            return repeatableText or instanceDisplayTypeText
        end,
        data3Text = function()
            local repeatableText, instanceDisplayTypeText = self:GetQuestDataString()
            if repeatableText == nil then
                return nil -- data2Text will already be showing the instance type info
            else
                return instanceDisplayTypeText
            end
        end,
    }
    --Quest tracker depends on this data for finding the next quest to focus.
    self.listDirty = true
    ZO_QuestJournal_Shared.Initialize(self, control)
end
function ZO_QuestJournal_Gamepad:RegisterIcons()
    self:RegisterIconTexture(QUEST_TYPE_AVA,        ZO_ANY_INSTANCE_DISPLAY_TYPE,       "EsoUI/Art/Journal/Gamepad/gp_questTypeIcon_AvA.dds")
    self:RegisterIconTexture(QUEST_TYPE_AVA_GRAND,  ZO_ANY_INSTANCE_DISPLAY_TYPE,       "EsoUI/Art/Journal/Gamepad/gp_questTypeIcon_normal.dds")
    self:RegisterIconTexture(QUEST_TYPE_AVA_GROUP,  ZO_ANY_INSTANCE_DISPLAY_TYPE,       "EsoUI/Art/Journal/Gamepad/gp_questTypeIcon_AvAGroup.dds")
    self:RegisterIconTexture(QUEST_TYPE_CLASS,      ZO_ANY_INSTANCE_DISPLAY_TYPE,       "EsoUI/Art/Journal/Gamepad/gp_questTypeIcon_normal.dds")
    self:RegisterIconTexture(QUEST_TYPE_CRAFTING,   ZO_ANY_INSTANCE_DISPLAY_TYPE,       "EsoUI/Art/Journal/Gamepad/gp_questTypeIcon_crafting.dds")
    self:RegisterIconTexture(QUEST_TYPE_GROUP,      ZO_ANY_INSTANCE_DISPLAY_TYPE,       "EsoUI/Art/Journal/Gamepad/gp_questTypeIcon_group.dds")
    self:RegisterIconTexture(QUEST_TYPE_GUILD,      ZO_ANY_INSTANCE_DISPLAY_TYPE,       "EsoUI/Art/Journal/Gamepad/gp_questTypeIcon_guild.dds")
    self:RegisterIconTexture(QUEST_TYPE_MAIN_STORY, ZO_ANY_INSTANCE_DISPLAY_TYPE,       "EsoUI/Art/Journal/Gamepad/gp_questTypeIcon_mainStory.dds")
    self:RegisterIconTexture(QUEST_TYPE_NONE,       ZO_ANY_INSTANCE_DISPLAY_TYPE,       "EsoUI/Art/Journal/Gamepad/gp_questTypeIcon_normal.dds")
    self:RegisterIconTexture(QUEST_TYPE_QA_TEST,    ZO_ANY_INSTANCE_DISPLAY_TYPE,       "EsoUI/Art/Journal/Gamepad/gp_questTypeIcon_normal.dds")
    self:RegisterIconTexture(QUEST_TYPE_RAID,       ZO_ANY_INSTANCE_DISPLAY_TYPE,       "EsoUI/Art/Journal/Gamepad/gp_questTypeIcon_raid.dds")
    
    -- Ensure that we display the correct dungeon icon based on the type of instance it is
    self:RegisterIconTexture(QUEST_TYPE_DUNGEON,    INSTANCE_DISPLAY_TYPE_NONE,         "EsoUI/Art/Journal/Gamepad/gp_questTypeIcon_dungeon.dds")
    self:RegisterIconTexture(QUEST_TYPE_DUNGEON,    INSTANCE_DISPLAY_TYPE_SOLO,         "EsoUI/Art/Journal/Gamepad/gp_questTypeIcon_dungeon.dds")
    self:RegisterIconTexture(QUEST_TYPE_DUNGEON,    INSTANCE_DISPLAY_TYPE_GROUP,        "EsoUI/Art/Journal/Gamepad/gp_questTypeIcon_groupDungeon.dds")
    self:RegisterIconTexture(QUEST_TYPE_DUNGEON,    INSTANCE_DISPLAY_TYPE_GROUP_DELVE,  "EsoUI/Art/Journal/Gamepad/gp_questTypeIcon_groupDungeon.dds")
    self:RegisterIconTexture(QUEST_TYPE_DUNGEON,    INSTANCE_DISPLAY_TYPE_RAID,         "EsoUI/Art/Journal/Gamepad/gp_questTypeIcon_raid.dds")    
end
function ZO_QuestJournal_Gamepad:RegisterTooltips()
    local ICON_SIZE = 48
    local groupIcon = zo_iconFormat("EsoUI/Art/Journal/Gamepad/gp_questTypeIcon_group.dds", ICON_SIZE, ICON_SIZE)
    local raidIcon = zo_iconFormat("EsoUI/Art/Journal/Gamepad/gp_questTypeIcon_raid.dds", ICON_SIZE, ICON_SIZE)
    local soloIcon = zo_iconFormat("EsoUI/Art/Journal/Gamepad/gp_questTypeIcon_normal.dds", ICON_SIZE, ICON_SIZE)
    local publicDungeonIcon = zo_iconFormat("EsoUI/Art/Journal/Gamepad/gp_questTypeIcon_dungeon.dds", ICON_SIZE, ICON_SIZE)
    self:RegisterTooltipText(ZO_ANY_QUEST_TYPE,     INSTANCE_DISPLAY_TYPE_SOLO,     zo_strformat(SI_GAMEPAD_QUEST_JOURNAL_INSTANCE_TYPE_SOLO, soloIcon))
    self:RegisterTooltipText(ZO_ANY_QUEST_TYPE,     INSTANCE_DISPLAY_TYPE_GROUP,    zo_strformat(SI_GAMEPAD_QUEST_JOURNAL_INSTANCE_TYPE_GROUP, groupIcon))
    self:RegisterTooltipText(ZO_ANY_QUEST_TYPE,     INSTANCE_DISPLAY_TYPE_RAID,     zo_strformat(SI_GAMEPAD_QUEST_JOURNAL_INSTANCE_TYPE_RAID, raidIcon))
    self:RegisterTooltipText(QUEST_TYPE_DUNGEON,    INSTANCE_DISPLAY_TYPE_NONE,     zo_strformat(SI_GAMEPAD_QUEST_JOURNAL_PUBLIC_DUNGEON, publicDungeonIcon))
end
function ZO_QuestJournal_Gamepad:GetQuestDataString()
    local repeatableText, instanceDisplayTypeText
    local questData = self:GetSelectedQuestData()
    if questData then
        local repeatableType = GetJournalQuestRepeatType(questData.questIndex)
        if repeatableType ~= QUEST_REPEAT_NOT_REPEATABLE then
            repeatableText = GetString(SI_GAMEPAD_QUEST_JOURNAL_REPEATABLE_TEXT)
        end
        if questData.dataSource then
            instanceDisplayTypeText = self:GetTooltipText(questData.dataSource.questType, questData.dataSource.displayType)
        end
    end
    return repeatableText, instanceDisplayTypeText
end
function ZO_QuestJournal_Gamepad:PerformDeferredInitialization()
    if self.initialized then return end
    -- TODO.
    self.initialized = true
end
function ZO_QuestJournal_Gamepad:OnTargetChanged(...)
    KEYBIND_STRIP:UpdateKeybindButtonGroup(self.mainKeybindStripDescriptor)
    self:RefreshDetails()
end
function ZO_QuestJournal_Gamepad:SetupList(list)
    local function QuestEntryTemplateSetup(control, data, selected, selectedDuringRebuild, enabled, activated)
        ZO_SharedGamepadEntry_OnSetup(control, data, selected, selectedDuringRebuild, enabled, activated)
        local conColorDef = ZO_ColorDef:New(GetConColor(data.level))
        control.label:SetColor(conColorDef:UnpackRGBA())
        control.selectedIcon:SetTexture(SELECTED_QUEST_TEXTURE)
        control.selectedIcon:SetHidden(QUEST_JOURNAL_MANAGER:GetFocusedQuestIndex() ~= data.questIndex)
    end
    list:AddDataTemplateWithHeader(QUEST_TEMPLATE, QuestEntryTemplateSetup, ZO_GamepadMenuEntryTemplateParametricListFunction, nil, QUEST_HEADER_TEMPLATE, nil, "HeaderEntry")
end
function ZO_QuestJournal_Gamepad:SetupOptionsList(list)
    list:SetOnTargetDataChangedCallback(function(list, selectedData)
        KEYBIND_STRIP:UpdateKeybindButtonGroup(self.optionsKeybindStripDescriptor)
    end)
    list:AddDataTemplate("ZO_GamepadSubMenuEntryTemplate", ZO_SharedGamepadEntry_OnSetup)
end
function ZO_QuestJournal_Gamepad:InitializeKeybindStripDescriptors()
    -- Main keybind strip
    self.mainKeybindStripDescriptor =
    {
        alignment = KEYBIND_STRIP_ALIGN_LEFT,
        -- Select
        {
            name = GetString(SI_GAMEPAD_SELECT_OPTION),
            keybind = "UI_SHORTCUT_PRIMARY",
            callback = function()
                local selectedQuestIndex = self:GetSelectedQuestIndex()
                self:FocusQuestWithIndex(selectedQuestIndex)
            end,
            visible = function()
                local selectedQuestIndex = self:GetSelectedQuestIndex()
                if selectedQuestIndex then
                    return true
                end
                return false
            end
        },
        -- Map
        {
            name = GetString(SI_QUEST_JOURNAL_SHOW_ON_MAP),
            keybind = "UI_SHORTCUT_SECONDARY",
            callback = function()
                local selectedQuestIndex = self:GetSelectedQuestIndex()
                if selectedQuestIndex then
                    self:ShowOnMap(selectedQuestIndex)
                end
            end,
            visible = function()
                local selectedQuestIndex = self:GetSelectedQuestIndex()
                if selectedQuestIndex then
                    return true
                end
                return false
            end
        },
        -- Options
        {
            name = GetString(SI_GAMEPAD_QUEST_JOURNAL_OPTIONS),
            keybind = "UI_SHORTCUT_TERTIARY",
            callback = function()
                self:DeactivateCurrentList()
                SCENE_MANAGER:Push(self.optionsSceneName)
            end,
            visible = function()
                local selectedQuestIndex = self:GetSelectedQuestIndex()
                if selectedQuestIndex and (self:CanAbandonQuest() or self:CanShareQuest()) then
                    return true
                end
                return false
            end
        },
    }
    ZO_Gamepad_AddListTriggerKeybindDescriptors(self.mainKeybindStripDescriptor, self.questList)
    ZO_Gamepad_AddBackNavigationKeybindDescriptors(self.mainKeybindStripDescriptor, GAME_NAVIGATION_TYPE_BUTTON)
    -- Options keybind strip
    self.optionsKeybindStripDescriptor =
    {
        alignment = KEYBIND_STRIP_ALIGN_LEFT,
        -- Do action
        {
            keybind = "UI_SHORTCUT_PRIMARY",
            name = function()
                return GetString(SI_GAMEPAD_SELECT_OPTION)
            end,
            
            callback = function()
                local selectedData = self.optionsList:GetTargetData()
                if selectedData then
                    selectedData.action()
                end
            end,
            visible = function()
                local selectedData = self.optionsList:GetTargetData()
                return selectedData ~= nil
            end
        },
    }
    ZO_Gamepad_AddListTriggerKeybindDescriptors(self.optionsKeybindStripDescriptor, self.optionsList)
    ZO_Gamepad_AddBackNavigationKeybindDescriptors(self.optionsKeybindStripDescriptor, GAME_NAVIGATION_TYPE_BUTTON)
end
function ZO_QuestJournal_Gamepad:InitializeScenes()
    local returningFromOptions = false
    
    GAMEPAD_QUEST_JOURNAL_ROOT_SCENE = ZO_Scene:New(self.sceneName, SCENE_MANAGER)
    GAMEPAD_QUEST_JOURNAL_ROOT_SCENE:RegisterCallback("StateChange", function(oldState, newState)
        if newState == SCENE_SHOWING then
            self:PerformDeferredInitialization()
            
            if self.listDirty then
                self:RefreshQuestCount()
                self:RefreshQuestMasterList()
                self:RefreshQuestList()
            end
            
            self:FocusQuestWithIndex(QUEST_JOURNAL_MANAGER:GetFocusedQuestIndex())
            self:SetCurrentList(self.questList)
            ZO_GamepadGenericHeader_Refresh(self.header, self.headerData)
            ZO_GamepadGenericHeader_Refresh(self.contentHeader, self.contentHeaderData)
            if not returningFromOptions then
                local questListEmpty = self.questList:IsEmpty()
                if questListEmpty then
                    self:RefreshDetails()
                elseif QUEST_JOURNAL_MANAGER:GetFocusedQuestIndex() then
                    self:SelectFocusedQuest()
                elseif not questListEmpty then
                    self.questList:SetSelectedIndexWithoutAnimation(1)
                end
            else
                returningFromOptions = false
            end
            self:SetKeybindButtonGroup(self.mainKeybindStripDescriptor)
        elseif newState == SCENE_HIDDEN then
            self.questList:Deactivate()
            self:SetKeybindButtonGroup(nil)
        end
    end)
    GAMEPAD_QUEST_JOURNAL_OPTIONS_SCENE = ZO_Scene:New(self.optionsSceneName, SCENE_MANAGER)
    GAMEPAD_QUEST_JOURNAL_OPTIONS_SCENE:RegisterCallback("StateChange", function(oldState, newState)
        if newState == SCENE_SHOWING then
            self:RefreshOptionsList()
            self:SetCurrentList(self.optionsList)
            self:SetKeybindButtonGroup(self.optionsKeybindStripDescriptor)
        elseif newState == SCENE_HIDDEN then
            if SCENE_MANAGER:IsShowingNext(self.sceneName) then
                returningFromOptions = true
            end
            self.optionsList:Deactivate()
            self:SetKeybindButtonGroup(nil)
        end
    end)
end
function ZO_QuestJournal_Gamepad:GetSceneName()
    return self.sceneName
end
function ZO_QuestJournal_Gamepad:GetSelectedQuestData()
    return self.questList:GetTargetData()
end
function ZO_QuestJournal_Gamepad:SelectFocusedQuest()
    self.questList:EnableAnimation(false)
    self.questList:SetSelectedDataByEval(function(data)
        return data.questIndex == QUEST_JOURNAL_MANAGER:GetFocusedQuestIndex()
    end)
    self.questList:EnableAnimation(true)
end
function ZO_QuestJournal_Gamepad:PerformUpdate()
    self.dirty = false
end
function ZO_QuestJournal_Gamepad:RefreshQuestCount()
    self:Update()
end
local function UpdateListAnchors(control, attachedTo)
    control:SetAnchor(TOPLEFT, attachedTo, BOTTOMLEFT, 50, yOffset)
    control:SetAnchor(TOPRIGHT, attachedTo, BOTTOMRIGHT, 0, 21)
end
function ZO_QuestJournal_Gamepad:RefreshDetails()
    if not SCENE_MANAGER:IsShowing(self.sceneName) then
        self.listDirty = true
        return
    end
    
    ZO_GamepadGenericHeader_Refresh(self.contentHeader, self.contentHeaderData)
    local questData = self:GetSelectedQuestData()
    local hasQuestData = (questData ~= nil)
    if hasQuestData then
        GAMEPAD_QUEST_JOURNAL_ROOT_SCENE:AddFragment(GAMEPAD_NAV_QUADRANT_2_3_BACKGROUND_FRAGMENT)
        GAMEPAD_QUEST_JOURNAL_ROOT_SCENE:AddFragment(GAMEPAD_NAV_QUADRANT_4_BACKGROUND_FRAGMENT)
    else
        GAMEPAD_QUEST_JOURNAL_ROOT_SCENE:RemoveFragment(GAMEPAD_NAV_QUADRANT_2_3_BACKGROUND_FRAGMENT)
        GAMEPAD_QUEST_JOURNAL_ROOT_SCENE:RemoveFragment(GAMEPAD_NAV_QUADRANT_4_BACKGROUND_FRAGMENT)
    end
    local hideWindows = not hasQuestData
    self.rightPane:SetHidden(hideWindows)
    self.middlePane:SetHidden(hideWindows)
    self.questInfoContainer:SetHidden(hideWindows)
    self.questStepContainer:SetHidden(hideWindows)
    if hasQuestData then
        local _, bgText, stepText, stepType, stepOverrideText, completed = GetJournalQuestInfo(questData.questIndex)
        self.conditionTextBulletList:Clear()
        self.optionalStepTextBulletList:Clear()
        self.hintTextBulletList:Clear()
        local questIndex = questData.questIndex
        local questStrings = self.questStrings
        ZO_ClearNumericallyIndexedTable(questStrings)
        if completed then
            local goalCondition, _, _, _, goalBackgroundText, goalDescription = GetJournalQuestEnding(questIndex)
       
            self.bgText:SetText(goalBackgroundText)
            self.stepText:SetText(goalDescription)
            self.conditionTextBulletList:AddLine(goalCondition)
            self.optionalStepTextLabel:SetHidden(true)
            if self.hintTextLabel then
                self.hintTextLabel:SetHidden(true)
            end
        else
            self.bgText:SetText(bgText)
            self.stepText:SetText(stepText)
            local showMultipleOrSteps = QUEST_JOURNAL_MANAGER:DoesShowMultipleOrSteps(stepOverrideText, stepType, questIndex)
            self.conditionTextLabel:SetText(showMultipleOrSteps and GetString(SI_GAMEPAD_QUEST_JOURNAL_QUEST_OR_DESCRIPTION) or GetString(SI_QUEST_JOURNAL_QUEST_TASKS))
            QUEST_JOURNAL_MANAGER:BuildTextForTasks(stepOverrideText, questIndex, questStrings)
            for k, v in ipairs(questStrings) do
                self.conditionTextBulletList:AddLine(v.name, v.isComplete)
            end
            ZO_ClearNumericallyIndexedTable(questStrings)
            self:BuildTextForStepVisibility(questIndex, QUEST_STEP_VISIBILITY_OPTIONAL)
            self.optionalStepTextLabel:SetHidden(#questStrings == 0)
            for i = 1, #questStrings do
                self.optionalStepTextBulletList:AddLine(questStrings[i])
            end
            ZO_ClearNumericallyIndexedTable(questStrings)
            local anchorToControl = self.optionalStepTextLabel:IsControlHidden() and self.conditionTextBulletList.control or self.optionalStepTextBulletList.control
            UpdateListAnchors(self.hintTextLabel, anchorToControl, 0)
            self:BuildTextForStepVisibility(questIndex, QUEST_STEP_VISIBILITY_HINT)
            if self.hintTextLabel then
                self.hintTextLabel:SetHidden(#questStrings == 0)
            end
            for i = 1, #questStrings do
                self.hintTextBulletList:AddLine(questStrings[i])
            end
        end
    end
    self.listDirty = false
end
function ZO_QuestJournal_Gamepad:RefreshOptionsList()
    self.optionsList:Clear()
    local options = {}
    if self:CanShareQuest() then
        local shareQuest = ZO_GamepadEntryData:New(GetString(SI_QUEST_JOURNAL_SHARE))
        shareQuest.action = function()
                    local selectedQuestIndex = self:GetSelectedQuestIndex()
                    if selectedQuestIndex then
                        QUEST_JOURNAL_MANAGER:ShareQuest(selectedQuestIndex)
                    end
                end
        table.insert(options, shareQuest)
    end
    
    if self:CanAbandonQuest() then
        local abandonQuest = ZO_GamepadEntryData:New(GetString(SI_QUEST_JOURNAL_ABANDON))
        abandonQuest.action = function()
                    local selectedQuestIndex = self:GetSelectedQuestIndex()
                    if selectedQuestIndex then
                        QUEST_JOURNAL_MANAGER:ConfirmAbandonQuest(selectedQuestIndex)
                    end
                end
        table.insert(options, abandonQuest)
    end
    local reportQuest = ZO_GamepadEntryData:New(GetString(SI_ITEM_ACTION_REPORT_ITEM))
    reportQuest.action =    function()
                                local selectedQuestIndex = self:GetSelectedQuestIndex()
                                if selectedQuestIndex then
                                    local questName = GetJournalQuestInfo(selectedQuestIndex)
                                    self:SetKeybindButtonGroup(nil)
                                    ZO_Help_Customer_Service_Gamepad_SetupQuestIssueTicket(questName)
                                    SCENE_MANAGER:Push("helpCustomerServiceGamepad")
                                end
                            end
    table.insert(options, reportQuest)
    for _, option in pairs(options) do
        self.optionsList:AddEntry("ZO_GamepadSubMenuEntryTemplate", option)
    end
    self.optionsList:Commit()
    self.options = options
end
function ZO_QuestJournal_Gamepad:RefreshQuestMasterList()
    self.questMasterList = QUEST_JOURNAL_MANAGER:GetQuestListData()
    -- If we're showing the options menu, make sure we still have the quest that we're viewing options for
    if SCENE_MANAGER:IsShowing(self.optionsSceneName) then
        local hasQuest = false
        for i, quest in ipairs(self.questMasterList) do
            if quest.questIndex == self:GetSelectedQuestIndex() then
                hasQuest = true
            end
        end
        if not hasQuest then
            -- Quest is no longer available...back out of the options menu
            SCENE_MANAGER:HideCurrentScene()
        end
    end
end
function ZO_QuestJournal_Gamepad:RefreshQuestList()
    self.questList:Clear()
    local lastCategoryName
    for i, quest in ipairs(self.questMasterList) do
        local entry = ZO_GamepadEntryData:New(quest.name, self:GetIconTexture(quest.questType, quest.displayType))
        entry:SetDataSource(quest)
        entry:SetIconTintOnSelection(true)
        if quest.categoryName ~= lastCategoryName then
            lastCategoryName = quest.categoryName
            entry:SetHeader(quest.categoryName)
            self.questList:AddEntryWithHeader(QUEST_TEMPLATE, entry)
        else
            self.questList:AddEntry(QUEST_TEMPLATE, entry)
        end
    end
    self.questList:Commit()
    self:RefreshDetails()
end
function ZO_QuestJournal_Gamepad:GetNextSortedQuestForQuestIndex(questIndex)
    if self.questMasterList then
        for i, quest in ipairs(self.questMasterList) do
            if quest.questIndex == questIndex then
                local nextQuest = (i == #self.questMasterList) and 1 or (i + 1)
                return self.questMasterList[nextQuest].questIndex
            end
        end
    end
end
function ZO_QuestJournal_Gamepad:FocusQuestWithIndex(index)
    self:FireCallbacks("QuestSelected", index)
    -- The quest tracker performs focus logic on quest/remove/update, only force focus if the player has clicked on the quest through the journal UI
    if SCENE_MANAGER:IsShowing(self.sceneName) then
        QUEST_TRACKER:ForceAssist(index)
    end
end
function ZO_QuestJournal_Gamepad:SetKeybindButtonGroup(descriptor)
    if self.currentKeybindButtonGroup then
        KEYBIND_STRIP:RemoveKeybindButtonGroup(self.currentKeybindButtonGroup)
    end
    if descriptor then
        KEYBIND_STRIP:AddKeybindButtonGroup(descriptor)
    end
    self.currentKeybindButtonGroup = descriptor
end
    QUEST_JOURNAL_GAMEPAD = ZO_QuestJournal_Gamepad:New(control)
    SYSTEMS:RegisterGamepadObject("questJournal", QUEST_JOURNAL_GAMEPAD)
end