Back to Home

ESO Lua File v101038

ingame/guildfinder/keyboard/guildrecruitment_guildlistinginfo_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
------------------
-- Guild Finder --
------------------
ZO_GUILD_RECRUITMENT_GUILD_INFO_RECRUITMENT_MESSAGE_BASE_OFFSET_Y = 20
ZO_GuildRecruitment_GuildListingInfo_Keyboard = ZO_GuildRecruitment_GuildListingInfo_Shared:Subclass()
function ZO_GuildRecruitment_GuildListingInfo_Keyboard:New(...)
    return ZO_GuildRecruitment_GuildListingInfo_Shared.New(self, ...)
end
function ZO_GuildRecruitment_GuildListingInfo_Keyboard:Initialize(control)
    ZO_GuildRecruitment_GuildListingInfo_Shared.Initialize(self, control)
    self.topSection = control:GetNamedChild("TopSection")
    self.infoPanel = control:GetNamedChild("InfoPanel")
    self.alertControl = self.control:GetNamedChild("AlertContainerAlert")
    self.recruitmentStatusLabel = self.topSection:GetNamedChild("Status")
    self.primaryFocusLabel = self.topSection:GetNamedChild("PrimaryFocus")
    self.secondaryFocusLabel = self.topSection:GetNamedChild("SecondaryFocus")
    self.playtimeLabel = self.topSection:GetNamedChild("Playtime")
    self.personalitiesLabel = self.topSection:GetNamedChild("Personalities")
    self.languagesLabel = self.topSection:GetNamedChild("Languages")
    self.rolesLabel = self.topSection:GetNamedChild("Roles")
    self.minCPLabel = self.topSection:GetNamedChild("MinCP")
    local infoContainerControl = control:GetNamedChild("InfoPanelScrollChild")
    self.activitiesLabel = infoContainerControl:GetNamedChild("Activities")
    self.headerMessageLabel = infoContainerControl:GetNamedChild("HeaderMessage")
    self.recruitmentMessageLabel = infoContainerControl:GetNamedChild("RecruitmentMessage")
end
function ZO_GuildRecruitment_GuildListingInfo_Keyboard:InitializeKeybindDescriptors()
    self.keybindStripDescriptor =
    {
        alignment = KEYBIND_STRIP_ALIGN_CENTER,
        -- Link in Chat
        {
            name = GetString(SI_GUILD_RECRUITMENT_LINK_IN_CHAT),
            keybind = "UI_SHORTCUT_SECONDARY",
            enabled = function()
                local numMembers, _, _, numInvitees = GetGuildInfo(self.guildId)
                if numMembers + numInvitees >= MAX_GUILD_MEMBERS then
                    return false, GetString(SI_GUILD_RECRUITMENT_MAX_GUILDS_CANT_LINK)
                end
                return true
            end,
            visible = function()
                return GetGuildRecruitmentStatus(self.guildId) == GUILD_RECRUITMENT_STATUS_ATTRIBUTE_VALUE_LISTED
            end,
            callback = function()
                local link = GetGuildRecruitmentLink(self.guildId, LINK_STYLE_BRACKETS)
                ZO_LinkHandler_InsertLink(link)
            end,
        },
    }
end
function ZO_GuildRecruitment_GuildListingInfo_Shared:UpdateAlert()
    local numMembers, _, _, numInvitees = GetGuildInfo(self.guildId)
    local hideAlert = true
    if numMembers + numInvitees >= MAX_GUILD_MEMBERS then
        self.alertControl:SetText(GetString(SI_GUILD_RECRUITMENT_GUILD_LISTING_FULL_GUILD_ALERT))
        hideAlert = false
    elseif GetGuildFinderNumGuildApplications(self.guildId) >= MAX_PENDING_APPLICATIONS_PER_GUILD then
        self.alertControl:SetText(GetString(SI_GUILD_RECRUITMENT_GUILD_LISTING_APPLICATIONS_FULL_GUILD_ALERT))
        hideAlert = false
    end
    self.alertControl:SetHidden(hideAlert)
end
function ZO_GuildRecruitment_GuildListingInfo_Keyboard:OnShowing()
    ZO_GuildRecruitment_GuildListingInfo_Shared.OnShowing(self)
end
function ZO_GuildRecruitment_GuildListingInfo_Keyboard:OnHidden()
    ZO_GuildRecruitment_GuildListingInfo_Shared.OnHidden(self)
end
function ZO_GuildRecruitment_GuildListingInfo_Keyboard:ShowCategory()
    ZO_GuildRecruitment_GuildListingInfo_Shared.ShowCategory(self)
    KEYBIND_STRIP:AddKeybindButtonGroup(self.keybindStripDescriptor)
end
function ZO_GuildRecruitment_GuildListingInfo_Keyboard:HideCategory()
    ZO_GuildRecruitment_GuildListingInfo_Shared.HideCategory(self)
    KEYBIND_STRIP:RemoveKeybindButtonGroup(self.keybindStripDescriptor)
end
-- Overridden
function ZO_GuildRecruitment_GuildListingInfo_Keyboard:RefreshInfoPanel()
    ZO_GuildRecruitment_GuildListingInfo_Shared.RefreshInfoPanel(self)
    local currentData = self.currentData
    if currentData then
        ZO_GuildFinder_Manager.SetTextForMetaDataAttributeKeyboard(self.recruitmentStatusLabel, GUILD_META_DATA_ATTRIBUTE_RECRUITMENT_STATUS, "SI_GUILDRECRUITMENTSTATUSATTRIBUTEVALUE", currentData.recruitmentStatus)
        if currentData.recruitmentStatus == GUILD_RECRUITMENT_STATUS_ATTRIBUTE_VALUE_LISTED then
            ZO_GuildFinder_Manager.SetTextForMetaDataAttributeKeyboard(self.primaryFocusLabel, GUILD_META_DATA_ATTRIBUTE_PRIMARY_FOCUS, "SI_GUILDFOCUSATTRIBUTEVALUE", currentData.primaryFocus)
            ZO_GuildFinder_Manager.SetTextForMetaDataAttributeKeyboard(self.secondaryFocusLabel, GUILD_META_DATA_ATTRIBUTE_SECONDARY_FOCUS, "SI_GUILDFOCUSATTRIBUTEVALUE", currentData.secondaryFocus)
            ZO_GuildFinder_Manager.SetTextForMetaDataAttributeKeyboard(self.personalitiesLabel, GUILD_META_DATA_ATTRIBUTE_PERSONALITIES, "SI_GUILDPERSONALITYATTRIBUTEVALUE", currentData.personality)
            ZO_GuildFinder_Manager.SetTextForMetaDataAttributeKeyboard(self.languagesLabel, GUILD_META_DATA_ATTRIBUTE_LANGUAGES, "SI_GUILDLANGUAGEATTRIBUTEVALUE", currentData.language)
            local rolesText = ZO_GuildFinder_Manager.GetRoleIconsText(currentData.roles)
            ZO_GuildFinder_Manager.SetTextForValuePairKeyboard(self.rolesLabel, zo_strformat(SI_GUILD_FINDER_GUILD_INFO_HEADER_FORMATTER, GetString("SI_GUILDMETADATAATTRIBUTE", GUILD_META_DATA_ATTRIBUTE_ROLES)), rolesText)
            ZO_GuildFinder_Manager.SetTextForValuePairKeyboard(self.minCPLabel, zo_strformat(SI_GUILD_FINDER_GUILD_INFO_HEADER_FORMATTER, GetString("SI_GUILDMETADATAATTRIBUTE", GUILD_META_DATA_ATTRIBUTE_MINIMUM_CP)), currentData.minimumCP)
            local formattedTimeRange = ZO_GuildFinder_Manager.CreatePlaytimeRangeText(currentData)
            ZO_GuildFinder_Manager.SetTextForValuePairKeyboard(self.playtimeLabel, zo_strformat(SI_GUILD_FINDER_GUILD_INFO_HEADER_FORMATTER, GetString(SI_GUILD_FINDER_GUILD_INFO_PLAYTIME_HEADER)), formattedTimeRange)
            ZO_GuildFinder_Manager.SetTextForNoGrammarValuePairKeyboard(self.headerMessageLabel, ZO_NORMAL_TEXT:Colorize(zo_strformat(SI_GUILD_FINDER_GUILD_INFO_HEADER_FORMATTER, GetString("SI_GUILDMETADATAATTRIBUTE", GUILD_META_DATA_ATTRIBUTE_HEADER_MESSAGE))), EscapeMarkup(currentData.recruitmentHeadline, ALLOW_MARKUP_TYPE_COLOR_ONLY))
            ZO_GuildFinder_Manager.SetTextForValuePairKeyboard(self.activitiesLabel,  ZO_NORMAL_TEXT:Colorize(zo_strformat(SI_GUILD_FINDER_GUILD_INFO_HEADER_FORMATTER, GetString("SI_GUILDMETADATAATTRIBUTE", GUILD_META_DATA_ATTRIBUTE_ACTIVITIES))), currentData.activitiesText)
            ZO_GuildFinder_Manager.SetTextForValuePairKeyboard(self.recruitmentMessageLabel,  ZO_NORMAL_TEXT:Colorize(zo_strformat(SI_GUILD_FINDER_GUILD_INFO_HEADER_FORMATTER, GetString("SI_GUILDMETADATAATTRIBUTE", GUILD_META_DATA_ATTRIBUTE_RECRUITMENT_MESSAGE))), currentData.description)
            self.primaryFocusLabel:SetHidden(false)
            self.secondaryFocusLabel:SetHidden(false)
            self.personalitiesLabel:SetHidden(false)
            self.languagesLabel:SetHidden(false)
            self.rolesLabel:SetHidden(false)
            self.minCPLabel:SetHidden(false)
            self.playtimeLabel:SetHidden(false)
            self.infoPanel:SetHidden(false)
        else
            self.primaryFocusLabel:SetHidden(true)
            self.secondaryFocusLabel:SetHidden(true)
            self.personalitiesLabel:SetHidden(true)
            self.languagesLabel:SetHidden(true)
            self.rolesLabel:SetHidden(true)
            self.minCPLabel:SetHidden(true)
            self.playtimeLabel:SetHidden(true)
            self.infoPanel:SetHidden(true)
        end
    end
    KEYBIND_STRIP:UpdateKeybindButtonGroup(self.keybindStripDescriptor)
end
-- XML functions
----------------
    GUILD_RECRUITMENT_GUILD_LISTING_INFO_KEYBOARD = ZO_GuildRecruitment_GuildListingInfo_Keyboard:New(control)
end