Back to Home

ESO Lua File v100034

pregame/tooltip/characterselecttooltips.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
function ZO_Tooltip:LayoutServiceTokenTooltip(tokenType)
    local tokenTypeString = GetString("SI_SERVICETOKENTYPE", tokenType)
    local headerSection = self:AcquireSection(self:GetStyle("bodyHeader"))
    local title = zo_strformat(SI_SERVICE_TOOLTIP_HEADER_FORMATTER, tokenTypeString)
    headerSection:AddLine(title, self:GetStyle("title"))
    self:AddSection(headerSection)
    local descriptionSection = self:AcquireSection(self:GetStyle("bodySection"))
    local tokenDescription = GetServiceTokenDescription(tokenType)
    descriptionSection:AddLine(tokenDescription, self:GetStyle("bodyDescription"))
    self:AddSection(descriptionSection)
    if tokenType == SERVICE_TOKEN_ALLIANCE_CHANGE then
        local anyRaceCollectibleId = GetAnyRaceAnyAllianceCollectibleId()
        local collectibleName = GetCollectibleName(anyRaceCollectibleId)
        local categoryName = GetCollectibleCategoryNameByCollectibleId(anyRaceCollectibleId)
        local tokensAvailableText = zo_strformat(SI_SERVICE_TOOLTIP_REQUIRES_COLLECTIBLE_TO_USE, collectibleName, categoryName)
        local meetsRequirementTextStyle
        local numTokens = GetNumServiceTokens(tokenType)
        if CanPlayAnyRaceAsAnyAlliance() then
            meetsRequirementTextStyle = self:GetStyle("succeeded")
        else
            meetsRequirementTextStyle = self:GetStyle("failed")
        end
        local requiredCollectibleSection = self:AcquireSection(self:GetStyle("bodySection"))
        requiredCollectibleSection:AddLine(tokensAvailableText, self:GetStyle("bodyDescription"), meetsRequirementTextStyle)
        self:AddSection(requiredCollectibleSection)
    end
    local tokensAvailableText
    local tokensAvailableTextStyle
    local numTokens = GetNumServiceTokens(tokenType)
    if numTokens ~= 0 then
        tokensAvailableText = zo_strformat(SI_SERVICE_TOOLTIP_SERVICE_TOKENS_AVAILABLE, numTokens, tokenTypeString)
        tokensAvailableTextStyle = self:GetStyle("succeeded")
    else
        tokensAvailableText = zo_strformat(SI_SERVICE_TOOLTIP_NO_SERVICE_TOKENS_AVAILABLE, tokenTypeString)
        tokensAvailableTextStyle = self:GetStyle("failed")
    end
    local tokenSection = self:AcquireSection(self:GetStyle("bodySection"))
    tokenSection:AddLine(tokensAvailableText, self:GetStyle("bodyDescription"), tokensAvailableTextStyle)
    self:AddSection(tokenSection)
end