Back to Home

ESO Lua File v101043

ingame/guild/gamepad/guildroster_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
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
--Layout consts, defining the widths of the list's columns as provided by design--
ZO_GAMEPAD_GUILD_ROSTER_RANK_WIDTH = 90 - ZO_GAMEPAD_INTERACTIVE_FILTER_LIST_HEADER_DOUBLE_PADDING_X
ZO_GAMEPAD_GUILD_ROSTER_USER_FACING_NAME_WIDTH = 310 - ZO_GAMEPAD_INTERACTIVE_FILTER_LIST_HEADER_DOUBLE_PADDING_X
ZO_GAMEPAD_GUILD_ROSTER_CHARACTER_NAME_WIDTH = 165 - ZO_GAMEPAD_INTERACTIVE_FILTER_LIST_HEADER_DOUBLE_PADDING_X
ZO_GAMEPAD_GUILD_ROSTER_ZONE_WIDTH = 210 - ZO_GAMEPAD_INTERACTIVE_FILTER_LIST_HEADER_DOUBLE_PADDING_X
ZO_GAMEPAD_CONFIRM_REMOVE_GUILD_MEMBER_DIALOG_NAME = "GUILD_REMOVE_MEMBER_GAMEPAD"
-----------------
-- Guild Roster
-----------------
ZO_GamepadGuildRosterManager = ZO_GamepadSocialListPanel:Subclass()
function ZO_GamepadGuildRosterManager:New(...)
    return ZO_GamepadSocialListPanel.New(self, ...)
end
function ZO_GamepadGuildRosterManager:Initialize(control)
    ZO_GamepadSocialListPanel.Initialize(self, control, GUILD_ROSTER_MANAGER, "ZO_GamepadGuildRosterRow")
    --Need to call SetEmptyText so the empty text label is created and have the text be properly set by InteractiveSortFilterList the filters returns no result
    --GuildRoster will never be empty unless it was filtered out
    self:SetEmptyText("")
    self:SetupSort(GUILD_ROSTER_ENTRY_SORT_KEYS, "status", ZO_SORT_ORDER_UP)
    local function OnGuildMemberInfoChanged(eventId, guildId, displayName, note)
        if GUILD_ROSTER_GAMEPAD.listFragment:IsShowing() and GUILD_ROSTER_MANAGER:MatchesGuild(guildId) then
            self:RefreshTooltip()
        end
    end
    control:RegisterForEvent(EVENT_GUILD_MEMBER_NOTE_CHANGED, OnGuildMemberInfoChanged)
    control:RegisterForEvent(EVENT_GUILD_MEMBER_RANK_CHANGED, OnGuildMemberInfoChanged)
end
function ZO_GamepadGuildRosterManager:InitializeHeader()
    local contentHeaderData = 
    {
        titleText = GetString(SI_GAMEPAD_GUILD_ROSTER_HEADER),
        data1HeaderText = GetString(SI_GAMEPAD_GUILD_HUB_GUILD_NAME_HEADER),
        data2HeaderText = GetString(SI_GAMEPAD_GUILD_HEADER_GUILD_MASTER_LABEL),
    }
    ZO_GamepadInteractiveSortFilterList.InitializeHeader(self, contentHeaderData)
end
function ZO_GamepadGuildRosterManager:PerformDeferredInitialization()
    if self.initialized then return end
    self.initialized = true
    if GetUIPlatform() == UI_PLATFORM_XBOX then
        local keybind  =
        {
            alignment = KEYBIND_STRIP_ALIGN_LEFT,
            name = GetString(SI_GAMEPAD_GUILD_ADD_FRIEND),
            keybind = "UI_SHORTCUT_TERTIARY",
            callback = function() ZO_ShowConsoleInviteToGuildFromUserListSelector(GUILD_ROSTER_MANAGER:GetGuildId()) end,
            visible = function()
                return GetNumberConsoleFriends() > 0 and DoesPlayerHaveGuildPermission(GUILD_ROSTER_MANAGER:GetGuildId(), GUILD_PERMISSION_INVITE)
            end
        }
        self:AddUniversalKeybind(keybind)
    end
end
function ZO_GamepadGuildRosterManager:GetAddKeybind()
    local keybind  =  {
        alignment = KEYBIND_STRIP_ALIGN_LEFT,
        name = GetString(SI_GUILD_INVITE_ACTION),
        keybind = "UI_SHORTCUT_SECONDARY",
        callback = function()
            local guildId = GUILD_ROSTER_MANAGER:GetGuildId()
            if ZO_IsPlaystationPlatform() then
                ZO_ShowConsoleInviteToGuildFromUserListSelector(guildId)
            else
                local name = GetGuildName(guildId)
                local dialogData = {guildId = guildId} 
                ZO_Dialogs_ShowGamepadDialog("GAMEPAD_GUILD_INVITE_DIALOG", dialogData, {mainTextParams = {name}})
            end
        end,
        enabled = function()
            local numMembers, _, _, numInvitees = GetGuildInfo(GUILD_ROSTER_MANAGER:GetGuildId())
            local totalPlayers = numMembers + numInvitees
            if totalPlayers >= MAX_GUILD_MEMBERS then
                return false, GetString("SI_SOCIALACTIONRESULT", SOCIAL_RESULT_GUILD_IS_FULL)
            end
            return true
        end,
        visible = function()
            return DoesPlayerHaveGuildPermission(GUILD_ROSTER_MANAGER:GetGuildId(), GUILD_PERMISSION_INVITE)
        end
    }
    return keybind
end
function ZO_GamepadGuildRosterManager:ShouldShowData(data)
    return ZO_GamepadSocialListPanel.ShouldShowData(self, data) or data.rankId == DEFAULT_INVITED_RANK
end
function ZO_GamepadGuildRosterManager:GetBackKeybindCallback()
    return function()
        GAMEPAD_GUILD_HUB:SetEnterInSingleGuildList(true)
        SCENE_MANAGER:HideCurrentScene()
    end
end
function ZO_GamepadGuildRosterManager:RefreshTooltip()
    local data = self:GetSelectedData()
    if data and (zo_strlen(data.characterName) > 0 or data.rankId == DEFAULT_INVITED_RANK) then
        GAMEPAD_TOOLTIPS:ClearTooltip(GAMEPAD_RIGHT_TOOLTIP)
        self:LayoutTooltip(GAMEPAD_TOOLTIPS, GAMEPAD_RIGHT_TOOLTIP, data)
        GAMEPAD_TOOLTIPS:ShowBg(GAMEPAD_RIGHT_TOOLTIP)
    else
        self:ClearTooltip()
    end
end
function ZO_GamepadGuildRosterManager:LayoutTooltip(tooltipManager, tooltip, data)
    local guildId = GUILD_ROSTER_MANAGER:GetGuildId()
    if data.rankId == DEFAULT_INVITED_RANK then
        tooltipManager:LayoutGuildInvitee(tooltip, ZO_FormatUserFacingDisplayName(data.displayName), data.characterName)
    else
        tooltipManager:LayoutGuildMember(tooltip, ZO_FormatUserFacingDisplayName(data.displayName), data.characterName, data.class, data.gender, guildId, data.rankIndex, data.note, data.level, data.championPoints, data.formattedAllianceName, data.formattedZone, not data.online, data.secsSinceLogoff, data.timeStamp)
    end
end
function ZO_GamepadGuildRosterManager:ColorRow(control, data, selected)
    local textColor, iconColor, textColor2 = self:GetRowColors(data, selected)
    GUILD_ROSTER_MANAGER:ColorRow(control, data, textColor, iconColor, textColor2)
end
function ZO_GamepadGuildRosterManager:OnShowing()
    GAMEPAD_GUILD_HOME:SetHeaderHidden(true)
    GAMEPAD_GUILD_HOME:SetContentHeaderHidden(true)
    self:Activate()
    ZO_GamepadSocialListPanel.OnShowing(self)
end
function ZO_GamepadGuildRosterManager:OnHidden()
    GAMEPAD_GUILD_HOME:SetHeaderHidden(false)
    GAMEPAD_GUILD_HOME:SetContentHeaderHidden(false)
    ZO_GamepadSocialListPanel.OnHidden(self)
end
function ZO_GamepadGuildRosterManager:GetSelectedNarrationText()
    local ROW_ENTRY_PAUSE_TIME_MS = 100
    local narration = {}
    local entryData = self:GetSelectedData()
    if entryData then
        --Do not include online status for pending invites
        if entryData.status and entryData.rankId ~= DEFAULT_INVITED_RANK then
            local narrationStrings = { GetString(SI_GAMEPAD_CONTACTS_LIST_HEADER_STATUS), GetString("SI_PLAYERSTATUS", entryData.status) }
            table.insert(narration, SCREEN_NARRATION_MANAGER:CreateNarratableObject(narrationStrings, ROW_ENTRY_PAUSE_TIME_MS))
        end
        local guildId = GUILD_ROSTER_MANAGER:GetGuildId()
        if guildId and entryData.rankIndex then
            local narrationStrings = { GetString(SI_GAMEPAD_GUILD_ROSTER_RANK_HEADER), GetFinalGuildRankName(guildId, entryData.rankIndex) }
            table.insert(narration, SCREEN_NARRATION_MANAGER:CreateNarratableObject(narrationStrings, ROW_ENTRY_PAUSE_TIME_MS))
        end
        if entryData.displayName then
            local narrationStrings = { ZO_GetPlatformAccountLabel(), ZO_FormatUserFacingDisplayName(entryData.displayName) }
            table.insert(narration, SCREEN_NARRATION_MANAGER:CreateNarratableObject(narrationStrings, ROW_ENTRY_PAUSE_TIME_MS))
        end
        local hideCharacterFields = not entryData.hasCharacter or (zo_strlen(entryData.characterName) <= 0)
        if not hideCharacterFields then
            local characterNarration = self:GetCharacterFieldsNarration(entryData)
            ZO_CombineNumericallyIndexedTables(narration, characterNarration)
        elseif entryData.rankId == DEFAULT_INVITED_RANK then
            --If the invite is pending read this instead of the character fields
            table.insert(narration, SCREEN_NARRATION_MANAGER:CreateNarratableObject(GetString(SI_GUILD_INVITED_PLAYER_LOCATION)))
        end
    end
    return narration
end
-----------------
-- Options
-----------------
function ZO_GamepadGuildRosterManager:SetupOptions(socialData)
    ZO_SocialOptionsDialogGamepad.SetupOptions(self, socialData)
    self.playerData = GUILD_ROSTER_MANAGER:GetPlayerData()
    self.guildId = GUILD_ROSTER_MANAGER:GetGuildId()
    self.guildName = GUILD_ROSTER_MANAGER:GetGuildName()
    self.guildAlliance = GUILD_ROSTER_MANAGER:GetGuildAlliance()
    self.noteChangedCallback = GUILD_ROSTER_MANAGER:GetNoteEditedFunction()
end
function ZO_GamepadGuildRosterManager:BuildOptionsList()
    local groupId = self:AddOptionTemplateGroup(ZO_SocialOptionsDialogGamepad.GetDefaultHeader)
    local function WouldPromoteToGuildMaster()
        local theirNewRankIndex = self.socialData.rankIndex - 1
        return IsGuildRankGuildMaster(self.guildId, theirNewRankIndex)
    end
    local function ShouldAddPromoteOption()
        return not WouldPromoteToGuildMaster() and ZO_GuildRosterManager.CanPromotePlayer(self.guildId, self.playerData.rankIndex, self.socialData.rankIndex, self.socialData.rankId)
    end
    local function ShouldAddPromoteToGuildMasterOption()
        return WouldPromoteToGuildMaster() and ZO_GuildRosterManager.CanPromotePlayer(self.guildId, self.playerData.rankIndex, self.socialData.rankIndex, self.socialData.rankId)
    end
    self:AddOptionTemplate(groupId, ZO_GamepadGuildRosterManager.BuildPromoteOption, ShouldAddPromoteOption)
    
    local function ShouldAddDemoteOption()
        return ZO_GuildRosterManager.CanDemotePlayer(self.guildId, self.playerData.rankIndex, self.socialData.rankIndex, self.socialData.rankId)
    end
    self:AddOptionTemplate(groupId, ZO_GamepadGuildRosterManager.BuildDemoteOption, ShouldAddDemoteOption)
    local function ShouldAddSetRankOption()
        return ZO_GuildRosterManager.CanSetPlayerRank(self.guildId, self.playerData.rankIndex, self.socialData.rankIndex, self.socialData.rankId)
    end
    self:AddOptionTemplate(groupId, ZO_GamepadGuildRosterManager.BuildSetRankOption, ShouldAddSetRankOption)
    local function ShouldAddRemoveOption()
        local socialData = self.socialData
        local playerData = self.playerData
        return DoesPlayerHaveGuildPermission(self.guildId, GUILD_PERMISSION_REMOVE) and 
                playerData.rankIndex < socialData.rankIndex and 
                playerData.index ~= socialData.index and
                socialData.rankId ~= DEFAULT_INVITED_RANK
    end
    self:AddOptionTemplate(groupId, ZO_GamepadGuildRosterManager.BuildRemoveOption, ShouldAddRemoveOption)
    local function ShouldAddUninviteOption()
        local socialData = self.socialData
        return DoesPlayerHaveGuildPermission(self.guildId, GUILD_PERMISSION_REMOVE) and
                socialData.rankId == DEFAULT_INVITED_RANK
    end
    self:AddOptionTemplate(groupId, ZO_GamepadGuildRosterManager.BuildUninviteOption, ShouldAddUninviteOption)
    local function ShouldAddEditNoteOption()
        return DoesPlayerHaveGuildPermission(self.guildId, GUILD_PERMISSION_NOTE_EDIT) and self.socialData.rankId ~= DEFAULT_INVITED_RANK
    end
    self:AddOptionTemplate(groupId, ZO_GamepadGuildRosterManager.BuildEditNoteOption, ShouldAddEditNoteOption)
    local function SelectedIndexIsPlayerIndex()
        return self.socialData.index == self.playerData.index
    end
    self:AddOptionTemplate(groupId, ZO_GamepadGuildRosterManager.BuildLeaveGuildOption, SelectedIndexIsPlayerIndex)
    self:AddOptionTemplate(groupId, ZO_SocialOptionsDialogGamepad.BuildWhisperOption, ZO_SocialOptionsDialogGamepad.ShouldAddWhisperOption)
    self:AddOptionTemplate(groupId, ZO_SocialOptionsDialogGamepad.BuildInviteToGroupOption, ZO_SocialOptionsDialogGamepad.ShouldAddInviteToGroupOptionAndCanSelectedDataBeInvited)
    local function BuildTravelToGuildPlayerOption()
        if self.socialData.rankId ~= DEFAULT_INVITED_RANK then
            return self:BuildTravelToPlayerOption(JumpToGuildMember)
        end
    end
    local function CanJumpToPlayerHouse()
       return not self:SelectedDataIsPlayer() and self.socialData.rankId ~= DEFAULT_INVITED_RANK
    end
    self:AddOptionTemplate(groupId, BuildTravelToGuildPlayerOption, ZO_SocialOptionsDialogGamepad.SelectedDataIsLoggedIn)
    self:AddOptionTemplate(groupId, ZO_SocialOptionsDialogGamepad.BuildVisitPlayerHouseOption, CanJumpToPlayerHouse)
    self:AddOptionTemplate(groupId, ZO_SocialOptionsDialogGamepad.BuildInviteToTributeOption, ZO_SocialOptionsDialogGamepad.SelectedDataIsLoggedIn)
    self:AddOptionTemplate(groupId, ZO_SocialOptionsDialogGamepad.BuildSendMailOption, function() return not SelectedIndexIsPlayerIndex() and self.socialData.rankId ~= DEFAULT_INVITED_RANK end)
    self:AddOptionTemplate(groupId, ZO_SocialOptionsDialogGamepad.BuildAddFriendOption, ZO_SocialOptionsDialogGamepad.ShouldAddFriendOption)
    self:AddOptionTemplate(groupId, ZO_GamepadGuildRosterManager.BuildShowGamerCardOption, IsConsoleUI)
end
function ZO_GamepadGuildRosterManager:BuildPromoteOption()
    local callback = function()
        GuildPromote(self.guildId, self.socialData.displayName)
        PlaySound(SOUNDS.GUILD_ROSTER_PROMOTE)
    end
    return self:BuildOptionEntry(nil, SI_GUILD_PROMOTE, callback)
end
function ZO_GamepadGuildRosterManager:BuildPromoteToGuildMasterOption()
    local callback = function()
        local guildInfo = ZO_AllianceIconNameFormatter(self.guildAlliance, self.guildName)
        local rankName = GetFinalGuildRankName(self.guildId, 2)
        ZO_Dialogs_ShowGamepadDialog("PROMOTE_TO_GUILDMASTER", { guildId = self.guildId, displayName = self.socialData.displayName }, { mainTextParams = { ZO_FormatUserFacingDisplayName(self.socialData.displayName), "", guildInfo, rankName } })
    end
    return self:BuildOptionEntry(nil, SI_GUILD_PROMOTE, callback)
end
function ZO_GamepadGuildRosterManager:BuildDemoteOption()
    local callback = function()
        GuildDemote(self.guildId, self.socialData.displayName)
        PlaySound(SOUNDS.GUILD_ROSTER_DEMOTE)
    end
    return self:BuildOptionEntry(nil, SI_GUILD_DEMOTE, callback)
end
function ZO_GamepadGuildRosterManager:BuildSetRankOption()
    local callback = function()
        ZO_Dialogs_ShowGamepadDialog("GUILD_SET_RANK_GAMEPAD", { guildId = self.guildId, targetData = self.socialData, playerData = self.playerData })
    end
    return self:BuildOptionEntry(nil, SI_GUILD_SET_RANK, callback)
end
function ZO_GamepadGuildRosterManager:BuildRemoveOption()
    local callback = function()
        ZO_Dialogs_ShowGamepadDialog(ZO_GAMEPAD_CONFIRM_REMOVE_GUILD_MEMBER_DIALOG_NAME, { guildId = self.guildId,  displayName = self.socialData.displayName }, { mainTextParams = { ZO_FormatUserFacingDisplayName(self.socialData.displayName) }})
    end
    return self:BuildOptionEntry(nil, SI_GUILD_REMOVE, callback)
end
function ZO_GamepadGuildRosterManager:BuildUninviteOption()
    local callback = function()
        local guildInfo = ZO_AllianceIconNameFormatter(self.guildAlliance, self.guildName)
        ZO_Dialogs_ShowGamepadDialog("UNINVITE_GUILD_PLAYER", {guildId = self.guildId,  displayName = self.socialData.displayName}, { mainTextParams = { ZO_FormatUserFacingDisplayName(self.socialData.displayName), "", guildInfo }})
    end
    return self:BuildOptionEntry(nil, SI_GUILD_UNINVITE, callback)
end
function ZO_GamepadGuildRosterManager:BuildLeaveGuildOption()
    local callback = function()
        local data = {
            hideSceneOnLeave = true
        }   
        local IS_GAMEPAD = true
        ZO_ShowLeaveGuildDialog(self.guildId, data, IS_GAMEPAD)
    end
    return self:BuildOptionEntry(nil, SI_GUILD_LEAVE, callback)
end
function ZO_GamepadGuildRosterManager:BuildAddFriendOption()
    local callback = function()      
        if IsConsoleUI() then
             ZO_ShowConsoleAddFriendDialogFromDisplayNameOrFallback(self.socialData.displayName, ZO_ID_REQUEST_TYPE_GUILD_INFO, self.guildId, self.socialData.index)
        else
            local data = { displayName = self.socialData.displayName, }
            ZO_Dialogs_ShowGamepadDialog("GAMEPAD_SOCIAL_ADD_FRIEND_DIALOG", data)
        end
    end
    local HEADER = nil
    return self:BuildOptionEntry(HEADER, SI_SOCIAL_MENU_ADD_FRIEND, callback)
end
function ZO_GamepadGuildRosterManager:BuildShowGamerCardOption()
    if(IsConsoleUI()) then
        local callback = function()
            ZO_ShowGamerCardFromDisplayNameOrFallback(self.socialData.displayName, ZO_ID_REQUEST_TYPE_GUILD_INFO, self.guildId, self.socialData.index)
        end
        return self:BuildOptionEntry(nil, ZO_GetGamerCardStringId(), callback)
    end
end
function ZO_GamepadGuildRosterManager:InitializeConfirmRemoveDialog()
    local function ReleaseDialog()
        GAMEPAD_TOOLTIPS:ClearLines(GAMEPAD_LEFT_TOOLTIP)
        ZO_Dialogs_ReleaseDialogOnButtonPress(ZO_GAMEPAD_CONFIRM_REMOVE_GUILD_MEMBER_DIALOG_NAME)
    end
    local function OnGuildPermissionChangedCallback(guildId)
        if guildId == self.guildId then
            if not DoesPlayerHaveGuildPermission(self.guildId, GUILD_PERMISSION_REMOVE) then
                ReleaseDialog()
            elseif self.canAddToBlacklist and not DoesPlayerHaveGuildPermission(self.guildId, GUILD_PERMISSION_MANAGE_BLACKLIST) then
                ReleaseDialog()
            end
        end
    end
    ZO_Dialogs_RegisterCustomDialog(ZO_GAMEPAD_CONFIRM_REMOVE_GUILD_MEMBER_DIALOG_NAME,
    {
        blockDialogReleaseOnPress = true,
        canQueue = true,
        gamepadInfo = {
            dialogType = GAMEPAD_DIALOGS.PARAMETRIC,
            allowRightStickPassThrough = true,
        },
        setup = function(dialog)
            self.canAddToBlacklist = DoesPlayerHaveGuildPermission(self.guildId, GUILD_PERMISSION_MANAGE_BLACKLIST)
            self.addToBlacklist = false
            self.blacklistNote = nil
            GUILD_RECRUITMENT_MANAGER:RegisterCallback("GuildPermissionsChanged", OnGuildPermissionChangedCallback)
            dialog:setupFunc()
            -- Select Remove button if no blacklist permissions
            if not DoesPlayerHaveGuildPermission(self.guildId, GUILD_PERMISSION_MANAGE_BLACKLIST) then
                local REMOVE_ENTRY_INDEX = 2
                dialog.entryList:SetSelectedIndex(REMOVE_ENTRY_INDEX)
            end
        end,
        finishedCallback = function(dialog)
            GUILD_RECRUITMENT_MANAGER:UnregisterCallback("GuildPermissionsChanged", OnGuildPermissionChangedCallback)
        end,
        title =
        {
            text = SI_PROMPT_TITLE_GUILD_REMOVE_MEMBER,
        },
        mainText = 
        {
            text = SI_GUILD_REMOVE_MEMBER_WARNING,
        },
        parametricList =
        {
            -- Backlist checkbox
            {
                template = "ZO_CheckBoxTemplate_WithoutIndent_Gamepad",
                templateData = {
                    text = GetString(SI_GUILD_RECRUITMENT_ADD_TO_BLACKLIST_ACTION),
                    setup = function(control, data, selected, reselectingDuringRebuild, enabled, active)
                        data.enabled = self.canAddToBlacklist
                        ZO_SharedGamepadEntry_OnSetup(control, data, selected, reselectingDuringRebuild, enabled, active)
                        local checkboxControl = control.checkBox
                        if self.addToBlacklist then
                            ZO_CheckButton_SetChecked(checkboxControl)
                        else
                            ZO_CheckButton_SetUnchecked(checkboxControl)
                        end
                        if self.canAddToBlacklist then
                            ZO_CheckButton_Enable(checkboxControl)
                        else
                            ZO_CheckButton_Disable(checkboxControl)
                            if selected then
                                local NO_TOOLTIP_TITLE = nil
                                GAMEPAD_TOOLTIPS:LayoutTitleAndDescriptionTooltip(GAMEPAD_LEFT_TOOLTIP, NO_TOOLTIP_TITLE, GetString(SI_GUILD_RECRUITMENT_NO_BLACKLIST_PERMISSION))
                            else
                                GAMEPAD_TOOLTIPS:ClearLines(GAMEPAD_LEFT_TOOLTIP)
                            end
                        end
                    end,
                    callback = function(dialog)
                        local targetControl = dialog.entryList:GetTargetControl()
                        ZO_GamepadCheckBoxTemplate_OnClicked(targetControl)
                        self.addToBlacklist = ZO_GamepadCheckBoxTemplate_IsChecked(targetControl)
                        local RESELECT_ENTRY = true
                        ZO_GenericParametricListGamepadDialogTemplate_RebuildEntryList(dialog, nil, RESELECT_ENTRY)
                        SCREEN_NARRATION_MANAGER:QueueDialog(dialog)
                    end,
                    narrationText = ZO_GetDefaultParametricListToggleNarrationText,
                },
            },
            -- Blacklist Note
            {
                template = "ZO_Gamepad_GenericDialog_Parametric_TextFieldItem_Multiline",
                templateData = {
                    textChangedCallback = function(control)
                        local blacklistNote = control:GetText()
                        self.blacklistNote = blacklistNote
                    end,
                    setup = function(control, data, selected, reselectingDuringRebuild, enabled, active)
                        control.highlight:SetHidden(not selected)
                        control.editBoxControl.textChangedCallback = data.textChangedCallback
                        data.control = control
                        control.editBoxControl:SetDefaultText(GetString(SI_GUILD_RECRUITMENT_BLACKLIST_NOTE_DEFAULT_TEXT))
                        control.editBoxControl:SetMaxInputChars(MAX_GUILD_BLACKLIST_MESSAGE_LENGTH)
                        if self.blacklistNote then
                            control.editBoxControl:SetText(self.blacklistNote)
                        end
                    end,
                    visible = function()
                        return self.addToBlacklist
                    end,
                    callback = function(dialog)
                        local targetControl = dialog.entryList:GetTargetControl()
                        targetControl.editBoxControl:TakeFocus()
                    end,
                    narrationText = ZO_GetDefaultParametricListEditBoxNarrationText,
                },
            },
            -- Remove applicant
            {
                template = "ZO_GamepadTextFieldSubmitItem",
                templateData = {
                    text = GetString(SI_DIALOG_REMOVE),
                    setup = ZO_SharedGamepadEntry_OnSetup,
                    callback = function(dialog)
                        if self.addToBlacklist then
                            local blacklistResult = AddToGuildBlacklistByDisplayName(dialog.data.guildId, dialog.data.displayName, self.blacklistNote)
                            if not ZO_GuildRecruitment_Manager.IsAddedToBlacklistSuccessful(blacklistResult) then
                                ZO_Dialogs_ShowPlatformDialog("GUILD_FINDER_BLACKLIST_FAILED", nil, { mainTextParams = { blacklistResult } })
                            end
                        else
                            GuildRemove(dialog.data.guildId, dialog.data.displayName)
                        end
                        ReleaseDialog()
                    end,
                },
            },
        },
        buttons =
        {
            {
                keybind = "DIALOG_PRIMARY",
                text = SI_GAMEPAD_SELECT_OPTION,
                callback =  function(dialog)
                    local data = dialog.entryList:GetTargetData()
                    data.callback(dialog)
                end,
            },
            {
                keybind = "DIALOG_NEGATIVE",
                text = SI_DIALOG_CANCEL,
                callback = function(dialog)
                    ReleaseDialog()
                end,
            },
        }
    })
end
function ZO_GamepadGuildRosterManager:InitializeSetRankDialog()
    local function OnRankSelected(dialog, entry)
        local data = dialog.data
        local newRankIndex = entry.rankIndex
        if newRankIndex ~= data.targetData.rankIndex then
            if newRankIndex == 1 then
                local guildInfo = ZO_AllianceIconNameFormatter(self.guildAlliance, self.guildName)
                local rankName = GetFinalGuildRankName(self.guildId, data.targetData.rankIndex)
                ZO_Dialogs_ShowGamepadDialog("PROMOTE_TO_GUILDMASTER", { guildId = self.guildId, displayName = data.targetData.displayName }, { mainTextParams = { ZO_FormatUserFacingDisplayName(data.targetData.displayName), "", guildInfo, rankName } })
            else
                if newRankIndex < data.targetData.rankIndex then
                    PlaySound(SOUNDS.GUILD_ROSTER_PROMOTE)
                else
                    PlaySound(SOUNDS.GUILD_ROSTER_DEMOTE)
                end
                GuildSetRank(data.guildId, data.targetData.displayName, newRankIndex)
            end
        end
    end
    local function GetRankNarrationText(entryData, entryControl)
        local currentRankIndex = entryData.dialog.data.targetData.rankIndex
        return ZO_FormatRadioButtonNarrationText(entryData.text, currentRankIndex == entryData.rankIndex)
    end
    ZO_Dialogs_RegisterCustomDialog("GUILD_SET_RANK_GAMEPAD",
    {
        canQueue = true,
        gamepadInfo = {
            dialogType = GAMEPAD_DIALOGS.PARAMETRIC,
        },
        setup = function(dialog, data)
            EVENT_MANAGER:RegisterForEvent("SetRankDialogGamepad", EVENT_GUILD_MEMBER_RANK_CHANGED, function(_, guildId, displayName)
                if guildId == data.guildId and displayName == data.targetData.displayName or displayName == data.playerData.displayName then
                    ZO_Dialogs_ReleaseDialog("GUILD_SET_RANK_GAMEPAD")
                end
            end)
            EVENT_MANAGER:RegisterForEvent("SetRankDialogGamepad", EVENT_GUILD_RANK_CHANGED, function(_, guildId)
                if guildId == data.guildId then
                    ZO_Dialogs_ReleaseDialog("GUILD_SET_RANK_GAMEPAD")
                end
            end)
            dialog.info.parametricList = {}
            local targetRankIndex = data.targetData.rankIndex
            local IS_GAMEPAD = true
            local entries = ZO_GuildRosterManager.ComputeSetRankEntries(data.guildId, data.playerData.rankIndex, targetRankIndex, IS_GAMEPAD)
            for rankIndex, entry in ipairs(entries) do
                local rankEntry = ZO_GamepadEntryData:New(entry.rankName, entry.rankIcon)
                rankEntry:SetEnabled(entry.enabled)
                if rankIndex == targetRankIndex then
                    rankEntry:SetSelected(true)
                end
                rankEntry.rankIndex = rankIndex
                rankEntry.setup = ZO_SharedGamepadEntry_OnSetup
                rankEntry.callback = OnRankSelected
                rankEntry.narrationText = GetRankNarrationText
                
                table.insert(dialog.info.parametricList,
                {
                    template = "ZO_GamepadSubMenuEntryTemplateWithStatus",
                    entryData = rankEntry,
                })
            end
            
            dialog:setupFunc()
            dialog.entryList:SetSelectedIndexWithoutAnimation(targetRankIndex)
        end,
        finishedCallback = function(dialog)
            EVENT_MANAGER:UnregisterForEvent("SetRankDialogGamepad", EVENT_GUILD_MEMBER_RANK_CHANGED)
            EVENT_MANAGER:UnregisterForEvent("SetRankDialogGamepad", EVENT_GUILD_RANK_CHANGED)
        end,
        title =
        {
            text = SI_GUILD_SET_RANK_DIALOG_TITLE,
        },
        buttons =
        {
            {
                keybind = "DIALOG_PRIMARY",
                text = SI_GAMEPAD_SELECT_OPTION,
                enabled = function(dialog)
                    local entry = dialog.entryList:GetTargetData()
                    return entry.enabled
                end,
                callback =  function(dialog)
                    local entry = dialog.entryList:GetTargetData()
                    entry.callback(dialog, entry)
                end,
            },
            {
                keybind = "DIALOG_NEGATIVE",
                text = SI_DIALOG_CANCEL,
            },
        }
    })
end
function ZO_GamepadGuildRosterManager:GetFooterNarration()
    return GAMEPAD_GUILD_HOME:GetFooterNarrationText()
end
    GUILD_ROSTER_GAMEPAD = ZO_GamepadGuildRosterManager:New(control)
end