Back to Home

ESO Lua File v100035

ingame/guildfinder/guildrecruitment_applicationslist_shared.lua

[◄ back to folders ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
------------------
-- Guild Finder --
------------------
ZO_GUILD_RECRUITMENT_APPLICATIONS_ENTRY_SORT_KEYS =
{
    ["name"] = { },
    ["levelPlusChampionPoints"] = { tiebreaker = "name" },
    ["durationS"] = { tiebreaker = "name" },
}
ZO_GuildRecruitment_ApplicationsList_Shared = ZO_GuildRecruitment_Shared:Subclass()
function ZO_GuildRecruitment_ApplicationsList_Shared:New(...)
    return ZO_GuildRecruitment_Shared.New(self, ...)
end
function ZO_GuildRecruitment_ApplicationsList_Shared:Initialize(control)
    ZO_GuildRecruitment_Shared.Initialize(self, control)
    local function OnGuildApplicationResultsReady()
        if self:GetFragment():IsShowing() then
            self:RefreshData()
        end
    end
    GUILD_RECRUITMENT_MANAGER:RegisterCallback("GuildApplicationResultsReady", OnGuildApplicationResultsReady)
end
function ZO_GuildRecruitment_ApplicationsList_Shared:SetGuildId(guildId)
    self.guildId = guildId
end
function ZO_GuildRecruitment_ApplicationsList_Shared:OnShowing()
    self:RefreshData()
end
function ZO_GuildRecruitment_ApplicationsList_Shared:FilterScrollList()
    local scrollData = ZO_ScrollList_GetDataList(self.list)
    ZO_ClearNumericallyIndexedTable(scrollData)
    local numApplications = GetGuildFinderNumGuildApplications(self.guildId)
    for i = 1, numApplications do
        local level, championPoints, alliance, classId, accountName, characterName, achievementPoints, applicationMessage = GetGuildFinderGuildApplicationInfoAt(self.guildId, i)
        local timeRemainingS = GetGuildFinderGuildApplicationDuration(self.guildId, i)
        local data =
        {
            guildId = self.guildId,
            index = i,
            name = accountName,
            characterName = characterName,
            level = level,
            class = classId,
            alliance = alliance,
            championPoints = championPoints,
            achievementPoints = achievementPoints,
            message = applicationMessage,
            durationS = timeRemainingS,
            levelPlusChampionPoints = level + championPoints,
        }
        table.insert(scrollData, ZO_ScrollList_CreateDataEntry(ZO_GUILD_FINDER_APPLICATION_ENTRY_TYPE, data))
    end
end
function ZO_GuildRecruitment_ApplicationsList_Shared:SetupRow(control, data)
    local nameLabel = control:GetNamedChild("Name")
    local levelLabel = control:GetNamedChild("Level")
    local expirationLabel = control:GetNamedChild("Expires")
    nameLabel:SetText(data.name)
    local levelText = GetLevelOrChampionPointsString(data.level, data.championPoints, data.iconSize)
    levelLabel:SetText(levelText)
    local timeRemainingS = GetGuildFinderGuildApplicationDuration(self.guildId, data.index)
    expirationLabel:SetText(ZO_FormatCountdownTimer(timeRemainingS))
end