Back to Home

ESO Lua File v100031

ingame/guildfinder/keyboard/guildbrowser_guildlist_keyboard.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
------------------
-- Guild Finder --
------------------
ZO_GUILD_BROWSER_GUILD_LIST_KEYBOARD_ENTRY_HEIGHT = 170
local ALLIANCE_BUTTON_NAME_TABLE =
{
    "AD",
    "EP",
    "DC",
}
ZO_GuildBrowser_GuildList_Keyboard = ZO_GuildBrowser_GuildList_Shared:Subclass()
function ZO_GuildBrowser_GuildList_Keyboard:New(...)
    return ZO_GuildBrowser_GuildList_Shared.New(self, ...)
end
function ZO_GuildBrowser_GuildList_Keyboard:Initialize(control)
    ZO_GuildBrowser_GuildList_Shared.Initialize(self, control)
    self.filterManager = ZO_GuildBrowser_ManageFilters_Shared:New()
    self.traderCheckBox = control:GetNamedChild("TraderCheckBox")
    ZO_CheckButton_SetLabelText(self.traderCheckBox.checkButton, GetString(SI_GUILD_BROWSER_GUILD_LIST_FILTERS_GUILD_TRADER))
    local function OnFilterTraderToggled(checkButton, checked)
        GUILD_BROWSER_MANAGER:ExecuteSearch()
        self.filterManager:SetFilterValueIsDefaultByAttributeType(GUILD_META_DATA_ATTRIBUTE_KIOSK, not checked)
    end
    ZO_CheckButton_SetToggleFunction(self.traderCheckBox.checkButton, OnFilterTraderToggled)
    self.activitiesControl = control:GetNamedChild("Activites")
    self.activitiesDropdown = ZO_ComboBox_ObjectFromContainer(self.activitiesControl)
    self.activitiesDropdown:SetSortsItems(false)
    self.personalitiesControl = control:GetNamedChild("Personalities")
    self.personalitiesDropdown = ZO_ComboBox_ObjectFromContainer(self.personalitiesControl)
    self.personalitiesDropdown:SetSortsItems(false)
    self.additionalFiltersButton = control:GetNamedChild("AdditionalFilters")
    self.onCloseGuildInfoCallback = function()
        SCENE_MANAGER:AddFragment(self.fragment)
    end
    ZO_ScrollList_AddDataType(self.list, ZO_GUILD_BROWSER_GUILD_LIST_ENTRY_TYPE, "ZO_GuildBrowser_GuildList_Row_Keyboard", ZO_GUILD_BROWSER_GUILD_LIST_KEYBOARD_ENTRY_HEIGHT, function(control, data) self:SetupRow(control, data) end)
    local HIGHLIGHT_CALLBACK = nil
    local OVERRIDE_HIGHLIGHT_END_ALPHA = 0.7
    ZO_ScrollList_EnableHighlight(self.list, "ZO_ListEntryHighlight", HIGHLIGHT_CALLBACK, OVERRIDE_HIGHLIGHT_END_ALPHA)
    local function OnAreFiltersDefaultChanged()
        KEYBIND_STRIP:UpdateKeybindButtonGroup(self.keybindStripDescriptor)
    end
    self.filterManager:RegisterCallback("OnGuildBrowserFilterValueIsDefaultChanged", OnAreFiltersDefaultChanged)
end
function ZO_GuildBrowser_GuildList_Keyboard:BuildActivitiesDropdown()
    local function OnActivitiesDropdownHidden()
        self:RefreshActivitiesFilter()
        GUILD_BROWSER_MANAGER:ExecuteSearch()
    end
    self.activitiesDropdown:ClearItems()
    self.activitiesDropdown:SetNoSelectionText(GetString("SI_GUILDMETADATAATTRIBUTE", GUILD_META_DATA_ATTRIBUTE_ACTIVITIES))
    self.activitiesDropdown:SetMultiSelectionTextFormatter(SI_GUILD_BROWSER_GUILD_LIST_ACTIVITIES_DROPDOWN_TEXT)
    for i = GUILD_ACTIVITY_ATTRIBUTE_VALUE_ITERATION_BEGIN, GUILD_ACTIVITY_ATTRIBUTE_VALUE_ITERATION_END do
        local activityEntry = self.activitiesDropdown:CreateItemEntry(ZO_CachedStrFormat(SI_GUILD_FINDER_ATTRIBUTE_VALUE_FORMATTER, GetString("SI_GUILDACTIVITYATTRIBUTEVALUE", i)))
        activityEntry.activityValue = i
        self.activitiesDropdown:AddItem(activityEntry)
    end
end
function ZO_GuildBrowser_GuildList_Keyboard:BuildPersonalitiesDropdown()
    local function OnPersonalitiesDropdownHidden()
        self:RefreshPersonalitiesFilter()
        GUILD_BROWSER_MANAGER:ExecuteSearch()
    end
    self.personalitiesDropdown:ClearItems()
    self.personalitiesDropdown:SetNoSelectionText(GetString("SI_GUILDMETADATAATTRIBUTE", GUILD_META_DATA_ATTRIBUTE_PERSONALITIES))
    self.personalitiesDropdown:SetMultiSelectionTextFormatter(SI_GUILD_BROWSER_GUILD_LIST_PERSONALITIES_DROPDOWN_TEXT)
    for i = GUILD_PERSONALITY_ATTRIBUTE_VALUE_ITERATION_BEGIN, GUILD_PERSONALITY_ATTRIBUTE_VALUE_ITERATION_END do
        local personalityEntry = self.personalitiesDropdown:CreateItemEntry(ZO_CachedStrFormat(SI_GUILD_FINDER_ATTRIBUTE_VALUE_FORMATTER, GetString("SI_GUILDPERSONALITYATTRIBUTEVALUE", i)))
        personalityEntry.personalityValue = i
        self.personalitiesDropdown:AddItem(personalityEntry)
    end
end
function ZO_GuildBrowser_GuildList_Keyboard:InitializeKeybindStripDescriptor()
    self.keybindStripDescriptor =
    {
        alignment = KEYBIND_STRIP_ALIGN_RIGHT,
        -- Reset Filters
        {
            alignment = KEYBIND_STRIP_ALIGN_CENTER,
            name = GetString(SI_GUILD_BROWSER_RESET_FILTERS_KEYBIND),
            keybind = "UI_SHORTCUT_NEGATIVE",
            enabled = function()
                return not self.filterManager:AreFiltersSetToDefault()
            end,
            callback = function()
                PlaySound(SOUNDS.DIALOG_ACCEPT)
                self:ResetFilters()
                GUILD_BROWSER_MANAGER:ExecuteSearch()
            end,
        },
        -- Report
        {
            name = GetString(SI_GUILD_BROWSER_REPORT_GUILD_KEYBIND),
            keybind = "UI_SHORTCUT_REPORT_PLAYER",
            callback = function()
                local guildToReport = self.currentGuildId
                local function ReportCallback()
                    GUILD_BROWSER_MANAGER:AddReportedGuild(guildToReport)
                end
                local guildData = GUILD_BROWSER_MANAGER:GetGuildData(self.currentGuildId)
                ZO_HELP_GENERIC_TICKET_SUBMISSION_MANAGER:OpenReportGuildTicketScene(guildData.guildName, CUSTOMER_SERVICE_ASK_FOR_HELP_REPORT_GUILD_SUBCATEGORY_INAPPROPRIATE_LISTING, ReportCallback)
            end,
            visible = function()
                return self.currentGuildId ~= nil
            end
        },
        -- View Guild
        {
            name = GetString(SI_GUILD_BROWSER_GUILD_LIST_VIEW_GUILD_INFO_KEYBIND),
            keybind = "UI_SHORTCUT_PRIMARY",
            callback = function()
                self:ShowGuildInfo(self.currentGuildId)
            end,
            visible = function()
                return self.currentGuildId ~= nil
            end
        },
    }
end
function ZO_GuildBrowser_GuildList_Keyboard:UpdateFilterBar()
    local currentAnchorControl = self.activitiesControl
    self.traderCheckBox:ClearAnchors()
    self.traderCheckBox:SetAnchor(RIGHT, currentAnchorControl, LEFT, -10, 0)
    currentAnchorControl = self.traderCheckBox
    self.traderCheckBox:SetHidden(false)
end
function ZO_GuildBrowser_GuildList_Keyboard:RefreshActivitiesFilter()
    local activityItems = self.activitiesDropdown:GetItems()
    for _, item in ipairs(activityItems) do
        SetGuildFinderActivityFilterValue(item.activityValue, self.activitiesDropdown:IsItemSelected(item))
    end
    self.filterManager:SetFilterValueIsDefaultByAttributeType(GUILD_META_DATA_ATTRIBUTE_ACTIVITIES, self.activitiesDropdown:GetNumSelectedEntries() <= 0)
end
function ZO_GuildBrowser_GuildList_Keyboard:RefreshPersonalitiesFilter()
    local personalityItems = self.personalitiesDropdown:GetItems()
    for _, item in ipairs(personalityItems) do
        SetGuildFinderPersonalityFilterValue(item.personalityValue, self.personalitiesDropdown:IsItemSelected(item))
    end
    self.filterManager:SetFilterValueIsDefaultByAttributeType(GUILD_META_DATA_ATTRIBUTE_PERSONALITIES, self.personalitiesDropdown:GetNumSelectedEntries() <= 0)
end
local function IsLanguageFilterComboBoxSetToDefault(comboBox)
    for _, item in ipairs(comboBox:GetItems()) do
        local isCurrentItemDefault = ZO_GuildBrowser_IsGuildAttributeLanguageFilterDefault(item.value)
        if isCurrentItemDefault ~= comboBox:IsItemSelected(item) then
            return false
        end
    end
    return true
end
function ZO_GuildBrowser_GuildList_Keyboard:RefreshAdditionalFilters()
    local dialog = ZO_GuildFinderAdditionalFiltersDialog
    local languageItems = dialog.languagesComboBox:GetItems()
    for _, item in ipairs(languageItems) do
        SetGuildFinderLanguageFilterValue(item.value, dialog.languagesComboBox:IsItemSelected(item))
    end
    self.filterManager:SetFilterValueIsDefaultByAttributeType(GUILD_META_DATA_ATTRIBUTE_LANGUAGES, IsLanguageFilterComboBoxSetToDefault(dialog.languagesComboBox))
    local sizeItems = dialog.sizeComboBox:GetItems()
    for _, item in ipairs(sizeItems) do
        SetGuildFinderSizeFilterValue(item.value, dialog.sizeComboBox:IsItemSelected(item))
    end
    self.filterManager:SetFilterValueIsDefaultByAttributeType(GUILD_META_DATA_ATTRIBUTE_SIZE, dialog.sizeComboBox:GetNumSelectedEntries() <= 0)
    local allianceButtons = dialog.allianceButtons
    local isAnyAllianceChecked = false
    for i, buttonName in pairs(ALLIANCE_BUTTON_NAME_TABLE) do
        local button = allianceButtons:GetNamedChild(buttonName)
        local isButtonChecked = ZO_CheckButton_IsChecked(button)
        SetGuildFinderAllianceFilterValue(i, isButtonChecked)
        isAnyAllianceChecked = isAnyAllianceChecked or isButtonChecked
    end
    self.filterManager:SetFilterValueIsDefaultByAttributeType(GUILD_META_DATA_ATTRIBUTE_ALLIANCE, not isAnyAllianceChecked)
    local isAnyRoleChecked = false
    local roleButtons = dialog.roleSelector.roleButtons
    for _, button in pairs(roleButtons) do
        local isButtonChecked = ZO_CheckButton_IsChecked(button)
        SetGuildFinderRoleFilterValue(button.role, isButtonChecked)
        isAnyRoleChecked = isAnyRoleChecked or isButtonChecked
    end
    self.filterManager:SetFilterValueIsDefaultByAttributeType(GUILD_META_DATA_ATTRIBUTE_ROLES, not isAnyRoleChecked)
    local minCP = tonumber(dialog.minCPEditBox:GetText())
    local maxCP = tonumber(dialog.maxCPEditBox:GetText())
    local isMinMaxCPDefault = minCP == self.filterManager:GetMinCPDefault() and maxCP == self.filterManager:GetMaxCPDefault()
    self.filterManager:SetFilterValueIsDefaultByAttributeType(GUILD_META_DATA_ATTRIBUTE_MINIMUM_CP, isMinMaxCPDefault)
    local startTimeData = dialog.startTimeComboBox:GetSelectedItemData()
    local startTimeHour = startTimeData.value
    local endTimeData = dialog.endTimeComboBox:GetSelectedItemData()
    local endTimeHour = endTimeData.value
    SetGuildFinderPlayTimeFilters(startTimeHour, endTimeHour)
    local defaultHour = self.filterManager:GetTimeDefault()
    self.filterManager:SetFilterValueIsDefaultByAttributeType(GUILD_META_DATA_ATTRIBUTE_START_TIME, startTimeHour == defaultHour)
    self.filterManager:SetFilterValueIsDefaultByAttributeType(GUILD_META_DATA_ATTRIBUTE_END_TIME, endTimeHour == defaultHour)
    if ZO_Dialogs_IsShowing("GUILD_BROWSER_ADDITIONAL_FILTERS") then
    end
end
function ZO_GuildBrowser_GuildList_Keyboard:RefreshSearchFilters()
end
local function SetLanguageFiltersComboBoxToDefault(comboBox)
    comboBox:ClearAllSelections()
    for _, item in ipairs(comboBox:GetItems()) do
            comboBox:AddItemToSelected(item)
        end
    end
    comboBox:RefreshSelectedItemText()
end
function ZO_GuildBrowser_GuildList_Keyboard:ResetFilters()
    ZO_CheckButton_SetCheckState(self.traderCheckBox.checkButton, false)
    self.personalitiesDropdown:ClearAllSelections()
    self.activitiesDropdown:ClearAllSelections()
    local dialog = ZO_GuildFinderAdditionalFiltersDialog
    SetLanguageFiltersComboBoxToDefault(dialog.languagesComboBox)
    dialog.sizeComboBox:ClearAllSelections()
    local allianceButtons = dialog.allianceButtons
    for i, buttonName in pairs(ALLIANCE_BUTTON_NAME_TABLE) do
        local button = allianceButtons:GetNamedChild(buttonName)
        ZO_CheckButton_SetCheckState(button, false)
    end
    local roleButtons = dialog.roleSelector.roleButtons
    for _, button in pairs(roleButtons) do
        ZO_CheckButton_SetCheckState(button, false)
    end
    dialog.minCPEditBox:SetText(self.filterManager:GetMinCPDefault())
    dialog.maxCPEditBox:SetText(self.filterManager:GetMaxCPDefault())
    local defaultHour = self.filterManager:GetTimeDefault()
    dialog.startTimeComboBox:SelectFirstItem()
    dialog.endTimeComboBox:SelectFirstItem()
    SetGuildFinderPlayTimeFilters(defaultHour, defaultHour)
end
function ZO_GuildBrowser_GuildList_Keyboard:GuildRow_OnMouseUp(control, button, upInside)
    if upInside then
        self:ShowGuildInfo(control.data.guildId)
        PlaySound(SOUNDS.GUILD_FINDER_SELECT_GUILD)
    end
end
function ZO_GuildBrowser_GuildList_Keyboard:ShowGuildInfo(guildId)
    SCENE_MANAGER:RemoveFragment(self.fragment)
    GUILD_BROWSER_KEYBOARD:SetCategoryTreeHidden(true)
    GUILD_BROWSER_GUILD_INFO_KEYBOARD:ShowWithGuild(guildId, self.onCloseGuildInfoCallback)
end
function ZO_GuildBrowser_GuildList_Keyboard:SetupRow(control, data)
    ZO_GuildBrowser_GuildList_Shared.SetupRow(self, control, data)
    control.guildSizeLabel:SetText(zo_strformat(SI_GUILD_FINDER_GUILD_INFO_ATTRIBUTE_FORMATTER, GetString("SI_GUILDMETADATAATTRIBUTE", GUILD_META_DATA_ATTRIBUTE_SIZE), ZO_SELECTED_TEXT:Colorize(data.size)))
end
function ZO_GuildBrowser_GuildList_Keyboard:SetupRowContextualInfo(control, data)
    local contextualInfoHeader, contextualInfoValue = self:GetRowContextualInfo(data)
    control.guildContextualInfoLabel:SetText(zo_strformat(SI_GUILD_FINDER_GUILD_INFO_ATTRIBUTE_FORMATTER, contextualInfoHeader, ZO_SELECTED_TEXT:Colorize(contextualInfoValue)))
end
function ZO_GuildBrowser_GuildList_Keyboard:OnAdditionalFiltersClicked()
    ZO_Dialogs_ShowDialog("GUILD_BROWSER_ADDITIONAL_FILTERS")
end
function ZO_GuildBrowser_GuildList_Keyboard:GetAllianceIcon(alliance)
    return GetAllianceSymbolIcon(alliance)
end
function ZO_GuildBrowser_GuildList_Keyboard:OnShowing()
    ZO_GuildBrowser_GuildList_Shared.OnShowing(self)
    GUILD_BROWSER_KEYBOARD:SetCategoryTreeHidden(false)
    KEYBIND_STRIP:AddKeybindButtonGroup(self.keybindStripDescriptor)
end
function ZO_GuildBrowser_GuildList_Keyboard:OnHiding()
    KEYBIND_STRIP:RemoveKeybindButtonGroup(self.keybindStripDescriptor)
end
function ZO_GuildBrowser_GuildList_Keyboard:OnHidden()
    ZO_GuildBrowser_GuildList_Shared.OnHidden(self)
    self.currentGuildId = nil
end
function ZO_GuildBrowser_GuildList_Keyboard:ShowCategory()
    ZO_GuildBrowser_GuildList_Shared.ShowCategory(self)
end
function ZO_GuildBrowser_GuildList_Keyboard:HideCategory()
    GUILD_BROWSER_GUILD_INFO_KEYBOARD:Close()
    ZO_GuildBrowser_GuildList_Shared.HideCategory(self)
    self.focusType = nil
end
function ZO_GuildBrowser_GuildList_Keyboard:SetSubcategoryValue(newValue)
    if self.focusType ~= newValue then
        self.focusType = newValue
        SetGuildFinderFocusSearchFilter(self.focusType)
        self:UpdateFilterBar()
        GUILD_BROWSER_MANAGER:ExecuteSearch()
    end
end
function ZO_GuildBrowser_GuildList_Keyboard:Row_OnMouseEnter(control)
    self.currentGuildId = control.data.guildId
    KEYBIND_STRIP:UpdateKeybindButtonGroup(self.keybindStripDescriptor)
end
function ZO_GuildBrowser_GuildList_Keyboard:Row_OnMouseExit(control)
    self.currentGuildId = nil
    KEYBIND_STRIP:UpdateKeybindButtonGroup(self.keybindStripDescriptor)
end
function ZO_GuildBrowser_GuildList_Keyboard:OnAdditionalFiltersDialogClose()
    GUILD_BROWSER_MANAGER:ExecuteSearch()
end
-- XML Functions
-----------------
    GUILD_BROWSER_GUILD_LIST_KEYBOARD:OnAdditionalFiltersClicked()
end
    InitializeTooltip(InformationTooltip, control, BOTTOM, 0, 0)
    SetTooltipText(InformationTooltip, GetString(SI_GUILD_BROWSER_GUILD_LIST_ADDITIONAL_FILTERS))
end
    ClearTooltip(InformationTooltip)
end
    GUILD_BROWSER_GUILD_LIST_KEYBOARD:Row_OnMouseEnter(control)
end
    GUILD_BROWSER_GUILD_LIST_KEYBOARD:Row_OnMouseExit(control)
end
    GUILD_BROWSER_GUILD_LIST_KEYBOARD:GuildRow_OnMouseUp(control, button, upInside)
end
    local row = control:GetParent()
    local data = ZO_ScrollList_GetData(row)
    if data.alliance then
        InitializeTooltip(InformationTooltip, control, BOTTOM, 0, 0)
        SetTooltipText(InformationTooltip, data.formattedAllianceName)
    end
end
    ClearTooltip(InformationTooltip)
end
    GUILD_BROWSER_GUILD_LIST_KEYBOARD = ZO_GuildBrowser_GuildList_Keyboard:New(control)
end
-- Additional Filters Dialog XML Functions
------------------------------------------
    if control.alliance then
        InitializeTooltip(InformationTooltip, control, BOTTOM, 0, 0)
        SetTooltipText(InformationTooltip, ZO_CachedStrFormat(SI_ALLIANCE_NAME, GetAllianceName(control.alliance)))
    end
end
    ClearTooltip(InformationTooltip)
end
do
    local allianceFileNamePrefix =
    {
        [ALLIANCE_ALDMERI_DOMINION] = "aldmeri",
        [ALLIANCE_EBONHEART_PACT] = "ebonheart",
        [ALLIANCE_DAGGERFALL_COVENANT] = "daggerfall",
    }
    function ZO_FilterAllianceButton_OnInitialized(control, alliance)
        local allianceFileName = allianceFileNamePrefix[alliance]
        control:SetNormalTexture(string.format("EsoUI/Art/CharacterCreate/CharacterCreate_%sIcon_up.dds", allianceFileName))
        control:SetPressedTexture(string.format("EsoUI/Art/CharacterCreate/CharacterCreate_%sIcon_down.dds", allianceFileName))
        control:SetMouseOverTexture(string.format("EsoUI/Art/CharacterCreate/CharacterCreate_%sIcon_over.dds", allianceFileName))
        control:SetPressedMouseOverTexture(string.format("EsoUI/Art/CharacterCreate/CharacterCreate_%sIcon_over.dds", allianceFileName))
        control.alliance = alliance
        local function OnAllianceFilterToggled(checkButton, checked)
            SetGuildFinderAllianceFilterValue(checkButton.alliance, checked)
        end
    end
end
local function SetupLanguageFiltersComboBox(comboBox, iterBegin, iterEnd, extraValues, stringBase, defaultText, multiSelectText)
    comboBox:ClearItems()
    comboBox:SetNoSelectionText(defaultText)
    comboBox:SetMultiSelectionTextFormatter(multiSelectText)
    local function AddEntry(value)
        local entry = comboBox:CreateItemEntry(ZO_CachedStrFormat(SI_GUILD_FINDER_ATTRIBUTE_VALUE_FORMATTER, GetString(stringBase, value)))
        entry.value = value
        comboBox:AddItem(entry)
    end
    for i = iterBegin, iterEnd do
        AddEntry(i)
    end
    if extraValues then
        for _, value in ipairs(extraValues) do
            AddEntry(value)
        end
    end
end
local function SetupSizeFilterComboBox(comboBox)
    comboBox:ClearItems()
    comboBox:SetNoSelectionText(GetString(SI_GUILD_BROWSER_GUILD_LIST_FILTERS_DEFAULT_SIZE))
    comboBox:SetMultiSelectionTextFormatter(SI_GUILD_BROWSER_GUILD_LIST_SIZE_DROPDOWN_TEXT)
    for i = GUILD_SIZE_ATTRIBUTE_VALUE_ITERATION_BEGIN, GUILD_SIZE_ATTRIBUTE_VALUE_ITERATION_END do
        local min, max = GetGuildSizeAttributeRangeValues(i)
        local entry = comboBox:CreateItemEntry(zo_strformat(SI_GUILD_BROWSER_GUILD_LIST_SIZE_DROPDOWN_ENTRY_TEXT, min, max))
        entry.value = i
        comboBox:AddItem(entry)
    end
end
local function SetupTimeBasedComboBox(comboBox)
    local function OnSelectedCallback(_, entryText, entry)
        comboBox:SetSelectedItemText(entry.name)
    end
    local IGNORE_CALLBACK = true
    comboBox:SelectItemByIndex(1, IGNORE_CALLBACK)
end
    self.confirmButton = self:GetNamedChild("Confirm")
    self.resetButton = self:GetNamedChild("Reset")
    ZO_Dialogs_RegisterCustomDialog("GUILD_BROWSER_ADDITIONAL_FILTERS",
    {
        customControl = self,
        canQueue = true,
        title =
        {
            text = SI_GUILD_BROWSER_GUILD_LIST_ADDITIONAL_FILTERS,
        },
        buttons =
        {
            {
                keybind = "DIALOG_PRIMARY",
                control = self.confirmButton,
                text = SI_DIALOG_CONFIRM,
                callback = function(dialog)
                    GUILD_BROWSER_GUILD_LIST_KEYBOARD:OnAdditionalFiltersDialogClose()
                end
            },
            {
                keybind = "DIALOG_RESET",
                control = self.resetButton,
                text = SI_GUILD_BROWSER_RESET_FILTERS_KEYBIND,
                noReleaseOnClick = true,
                enabled = function(dialog)
                    return not GUILD_BROWSER_GUILD_LIST_KEYBOARD.filterManager:AreFiltersSetToDefault()
                end,
                callback = function(dialog)
                    GUILD_BROWSER_GUILD_LIST_KEYBOARD:ResetFilters()
                end
            },
        },
    })
    self.allianceButtons = self:GetNamedChild("AllianceButtons")
    self.allianceHeaderLabel = self:GetNamedChild("AllianceHeader")
    self.allianceHeaderLabel:SetText(zo_strformat(SI_GUILD_BROWSER_GUILD_LIST_ADDITIONAL_FILTERS_HEADER_FORMATTER, GetString("SI_GUILDMETADATAATTRIBUTE", GUILD_META_DATA_ATTRIBUTE_ALLIANCE)))
    local function OnAllianceButtonToggled(button, isSelected)
        GUILD_BROWSER_GUILD_LIST_KEYBOARD:RefreshAdditionalFilters()
    end
    for i, buttonName in pairs(ALLIANCE_BUTTON_NAME_TABLE) do
        local button = self.allianceButtons:GetNamedChild(buttonName)
    end
    self.roleSelectorControl = self:GetNamedChild("RoleSelector")
    self.roleSelector = ZO_RoleMultiSelector_GetObjectFromControl(self.roleSelectorControl)
    self.rolesHeaderLabel = self:GetNamedChild("RolesHeader")
    self.rolesHeaderLabel:SetText(zo_strformat(SI_GUILD_BROWSER_GUILD_LIST_ADDITIONAL_FILTERS_HEADER_FORMATTER, GetString("SI_GUILDMETADATAATTRIBUTE", GUILD_META_DATA_ATTRIBUTE_ROLES)))
    local function OnRoleSelectorToggled(button, isSelected)
        SetGuildFinderRoleFilterValue(button.role, isSelected)
        GUILD_BROWSER_GUILD_LIST_KEYBOARD:RefreshAdditionalFilters()
    end
    self.languageHeaderLabel = self:GetNamedChild("LanguageHeader")
    self.languageHeaderLabel:SetText(zo_strformat(SI_GUILD_BROWSER_GUILD_LIST_ADDITIONAL_FILTERS_HEADER_FORMATTER, GetString("SI_GUILDMETADATAATTRIBUTE", GUILD_META_DATA_ATTRIBUTE_LANGUAGES)))
    self.sizeHeaderLabel = self:GetNamedChild("SizeHeader")
    self.sizeHeaderLabel:SetText(zo_strformat(SI_GUILD_BROWSER_GUILD_LIST_ADDITIONAL_FILTERS_HEADER_FORMATTER, GetString("SI_GUILDMETADATAATTRIBUTE", GUILD_META_DATA_ATTRIBUTE_SIZE)))
    self.timeHeaderLabel = self:GetNamedChild("TimeHeader")
    self.timeHeaderLabel:SetText(zo_strformat(SI_GUILD_BROWSER_GUILD_LIST_ADDITIONAL_FILTERS_HEADER_FORMATTER, GetString(SI_GUILD_FINDER_CORE_HOURS_LABEL)))
    local function OnComboboxSelectionChanged()
        GUILD_BROWSER_GUILD_LIST_KEYBOARD:RefreshAdditionalFilters()
    end
    self.languagesComboBox = ZO_ComboBox_ObjectFromContainer(self:GetNamedChild("LanguageSelector"))
    self.languagesComboBox:SetSortsItems(false)
    SetupLanguageFiltersComboBox(self.languagesComboBox, GUILD_LANGUAGE_ATTRIBUTE_VALUE_ITERATION_BEGIN, GUILD_LANGUAGE_ATTRIBUTE_VALUE_ITERATION_END, { GUILD_LANGUAGE_ATTRIBUTE_VALUE_OTHER }, "SI_GUILDLANGUAGEATTRIBUTEVALUE", GetString(SI_GUILD_BROWSER_GUILD_LIST_FILTERS_DEFAULT_LANGUAGE), SI_GUILD_BROWSER_GUILD_LIST_LANGUAGES_DROPDOWN_TEXT)
    self.sizeComboBox = ZO_ComboBox_ObjectFromContainer(self:GetNamedChild("SizeSelector"))
    self.sizeComboBox:SetSortsItems(false)
    SetupSizeFilterComboBox(self.sizeComboBox)
    self.startTimeComboBox = ZO_ComboBox_ObjectFromContainer(self:GetNamedChild("StartTimeSelector"))
    self.startTimeComboBox:SetSortsItems(false)
    SetupTimeBasedComboBox(self.startTimeComboBox)
    self.endTimeComboBox = ZO_ComboBox_ObjectFromContainer(self:GetNamedChild("EndTimeSelector"))
    self.endTimeComboBox:SetSortsItems(false)
    SetupTimeBasedComboBox(self.endTimeComboBox)
    self.minCPHeaderLabel = self:GetNamedChild("CPHeader")
    self.minCPHeaderLabel:SetText(zo_strformat(SI_GUILD_BROWSER_GUILD_LIST_ADDITIONAL_FILTERS_HEADER_FORMATTER, GetString(SI_GUILD_BROWSER_CHAMPION_POINT_RANGE_HEADER)))
    self.minCPControl = self:GetNamedChild("MinCP")
    self.minCPEditBox = self.minCPControl:GetNamedChild("BackdropEdit")
    self.minCPEditBox:SetText(GUILD_BROWSER_GUILD_LIST_KEYBOARD.filterManager:GetMinCPDefault())
    self.maxCPControl = self:GetNamedChild("MaxCP")
    self.maxCPEditBox = self.maxCPControl:GetNamedChild("BackdropEdit")
    self.maxCPEditBox:SetText(GUILD_BROWSER_GUILD_LIST_KEYBOARD.filterManager:GetMaxCPDefault())
    local function OnMinCPTextEditFocusLost(...)
        local maxAllowedValue = ZO_GuildFinder_Manager.GetMaxCPAllowedForInput()
        local minCP = tonumber(self.minCPEditBox:GetText())
        local maxCP = tonumber(self.maxCPEditBox:GetText())
        if minCP == nil then
            local defaultMin = GUILD_BROWSER_GUILD_LIST_KEYBOARD.filterManager:GetMinCPDefault()
            self.minCPEditBox:SetText(defaultMin)
            SetGuildFinderChampionPointsFilterValues(defaultMin, maxCP)
        elseif minCP > maxCP then
            minCP = maxCP
            self.minCPEditBox:SetText(minCP)
            SetGuildFinderChampionPointsFilterValues(minCP, maxCP)
        elseif minCP > maxAllowedValue then
            minCP = maxAllowedValue
            self.minCPEditBox:SetText(minCP)
            SetGuildFinderChampionPointsFilterValues(minCP, maxCP)
        end
        GUILD_BROWSER_GUILD_LIST_KEYBOARD:RefreshAdditionalFilters()
    end
    local function OnMaxCPTextEditFocusLost(...)
        local maxAllowedValue = ZO_GuildFinder_Manager.GetMaxCPAllowedForInput()
        local minCP = tonumber(self.minCPEditBox:GetText())
        local maxCP = tonumber(self.maxCPEditBox:GetText())
        if maxCP == nil then
            local defaultMax = GUILD_BROWSER_GUILD_LIST_KEYBOARD.filterManager:GetMaxCPDefault()
            self.maxCPEditBox:SetText(defaultMax)
            SetGuildFinderChampionPointsFilterValues(minCP, defaultMax)
        elseif maxCP < minCP then
            maxCP = minCP
            self.maxCPEditBox:SetText(maxCP)
            SetGuildFinderChampionPointsFilterValues(minCP, maxCP)
        elseif maxCP > maxAllowedValue then
            maxCP = maxAllowedValue
            self.maxCPEditBox:SetText(maxCP)
            SetGuildFinderChampionPointsFilterValues(minCP, maxCP)
        end
        GUILD_BROWSER_GUILD_LIST_KEYBOARD:RefreshAdditionalFilters()
    end
    local function OnTextChanged(...)
        local minCP = tonumber(self.minCPEditBox:GetText())
        local maxCP = tonumber(self.maxCPEditBox:GetText())
        SetGuildFinderChampionPointsFilterValues(minCP, maxCP)
    end
    self.minCPEditBox:SetHandler("OnFocusLost", OnMinCPTextEditFocusLost)
    self.minCPEditBox:SetHandler("OnTextChanged", OnTextChanged)
    self.maxCPEditBox:SetHandler("OnFocusLost", OnMaxCPTextEditFocusLost)
    self.maxCPEditBox:SetHandler("OnTextChanged", OnTextChanged)
end