Back to Home

ESO Lua File v100029

ingame/guildfinder/guildbrowser_guildinfo_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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
------------------
-- Guild Finder --
------------------
ZO_GuildBrowser_GuildInfo_Shared = ZO_Object:Subclass()
function ZO_GuildBrowser_GuildInfo_Shared:New(...)
    local object = ZO_Object.New(self)
    object:Initialize(...)
    return object
end
function ZO_GuildBrowser_GuildInfo_Shared:Initialize(control)
    self.control = control
    self.currentGuildId = 0
    self.guildRequested = nil
    local function OnGuildDataReady(guildId)
        local guildRequested = self.guildRequested
        if guildRequested then
            if guildId == guildRequested then
                self.guildRequested = nil
                self:RefreshInfoPanel()
            end
        end
    end
    GUILD_BROWSER_MANAGER:RegisterCallback("OnGuildDataReady", OnGuildDataReady)
end
function ZO_GuildBrowser_GuildInfo_Shared:SetGuildToShow(guildId)
    self.currentGuildId = guildId
    local guildData = GUILD_BROWSER_MANAGER:GetGuildData(guildId)
    if not guildData then
        if GUILD_BROWSER_MANAGER:RequestGuildData(guildId) then
            self.guildRequested = guildId
        else
            internalassert(false, "can't have no data and can't fetch data simultaneously")
        end
    end
end
function ZO_GuildBrowser_GuildInfo_Shared:RefreshInfoPanel()
    local guildData = GUILD_BROWSER_MANAGER:GetGuildData(self.currentGuildId)
    if guildData then
        local guildId = self.currentGuildId
        GUILD_BROWSER_MANAGER:BuildGuildHeraldryControl(self.heraldry, guildData)
        self.guildNameLabel:SetText(guildData.guildName)
        self.allianceIcon:SetTexture(self:GetAllianceIcon(guildData.alliance))
        self.headerMessageLabel:SetText(guildData.headerMessage)
        self.recruitmentMessageLabel:SetText(guildData.recruitmentMessage)
    end
    local isListed = GetGuildRecruitmentStatusAttribute(self.currentGuildId) == GUILD_RECRUITMENT_STATUS_ATTRIBUTE_VALUE_LISTED
    local shouldHide = not isListed
    self:UpdateRefreshMessage(guildData ~= nil)
end
function ZO_GuildBrowser_GuildInfo_Shared:UpdateRefreshMessage(hasGuildData)
    if hasGuildData and GetGuildRecruitmentStatusAttribute(self.currentGuildId) == GUILD_RECRUITMENT_STATUS_ATTRIBUTE_VALUE_NOT_LISTED then
        self.refreshMessageLabel:SetText(GetString(SI_GUILD_INFO_DATA_UNAVAILABLE))
    else
        self.refreshMessageLabel:SetText(GetString(SI_GUILD_INFO_FETCHING_DATA))
    end
end
function ZO_GuildBrowser_GuildInfo_Shared:GetCurrentGuildId()
    return self.currentGuildId
end
function ZO_GuildBrowser_GuildInfo_Shared:ShowWithGuild(guildId, closeCallback)
    assert(false) -- must be overridden
end
function ZO_GuildBrowser_GuildInfo_Shared:GetAllianceIcon(alliance)
    assert(false) -- must be overridden
end
function ZO_GuildBrowser_GuildInfo_Shared:SetInLoadingMode(shouldHide)
    assert(false) -- must be overridden
end
function ZO_GuildBrowser_GuildInfo_Shared:OnShowing()
end
function ZO_GuildBrowser_GuildInfo_Shared:OnHidden()
    self.currentGuildId = 0
end