Back to Home

ESO Lua File v101043

ingame/lfg/keyboard/tributerewards_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
--------------------------
-- Tribute Rewards List --
--------------------------
ZO_TributeRewardsList_Keyboard = ZO_SortFilterList:Subclass()
function ZO_TributeRewardsList_Keyboard:Initialize(control, ...)
    ZO_SortFilterList.Initialize(self, control, ...)
    local function RowSetup(control, data, list)
        control.data = data
        local iconTexture = control:GetNamedChild("Icon")
        local nameLabel = control:GetNamedChild("Name")
        local rewardsNameLabel = control:GetNamedChild("RewardsName")
        iconTexture:SetTexture(data:GetTierIcon())
        nameLabel:SetText(data:GetTierName())
        rewardsNameLabel:SetText(data:GetRewardListName())
        rewardsNameLabel:SetColor(data:GetRewardsTierColor())
        local statusHighlight = control:GetNamedChild("StatusHighlight")
        statusHighlight:SetHidden(not data:IsAttained())
    end
    local function RowHide(control)
        local statusHighlight = control:GetNamedChild("StatusHighlight")
        statusHighlight:SetHidden(true)
    end
    ZO_ScrollList_AddDataType(self.list, 1, "ZO_TributeRewards_Keyboard_Row", ZO_TRIBUTE_REWARD_KEYBOARD_ROW_HEIGHT, RowSetup, RowHide)
    self.automaticallyColorRows = false
    self.currentRewardsType = ZO_TRIBUTE_REWARD_TYPES.SEASON_REWARDS
end
function ZO_TributeRewardsList_Keyboard:SetRewardsType(rewardsTypeId)
    self.currentRewardsType = rewardsTypeId
end
function ZO_TributeRewardsList_Keyboard:GetRewardsType()
    return self.currentRewardsType
end
function ZO_TributeRewardsList_Keyboard:GetNumTiersForTributeRewardsType()
    return TRIBUTE_REWARDS_DATA_MANAGER:GetNumTiersForTributeRewardsType(self.currentRewardsType)
end
function ZO_TributeRewardsList_Keyboard:BuildMasterList()
    -- Update Header
    local rewardsTypeData = TRIBUTE_REWARDS_DATA_MANAGER:GetTributeRewardsTypeData(self.currentRewardsType)
    local tierHeaderLabel = self.control:GetNamedChild("HeadersTierName")
    tierHeaderLabel:SetText(rewardsTypeData:GetTierHeader())
    -- Build list content
    local scrollData = ZO_ScrollList_GetDataList(self.list)
    for _, tributeRewardsData in TRIBUTE_REWARDS_DATA_MANAGER:TributeRewardsTypeIterator(self.currentRewardsType) do
        table.insert(scrollData, ZO_ScrollList_CreateDataEntry(1, tributeRewardsData))
    end
end
function ZO_TributeRewardsList_Keyboard:FilterScrollList()
    -- Must be overridden
    -- TODO Tribute: Determine if data needs to be filtered
end
function ZO_TributeRewardsList_Keyboard:SortScrollList()
    -- Must be overridden
    -- TODO Tribute: Determine if data needs to be sorted
end
function ZO_TributeRewardsList_Keyboard:EnterRow(row)
    ZO_SortFilterList.EnterRow(self, row)
    local rewardType = row.data:GetRewardsType()
    local rewardListId = row.data:GetRewardListId()
    if rewardListId ~= 0 then
        InitializeTooltip(InformationTooltip, row, RIGHT, 0, 0, LEFT)
        if rewardType:GetRewardsTypeId() == ZO_TRIBUTE_REWARD_TYPES.SEASON_REWARDS then
            InformationTooltip:SetTributeSeasonRewardList(row.data:GetRewardsTierId(), rewardListId)
        else
            InformationTooltip:SetTributeLeaderboardRewardList(rewardListId)
        end
    end
end
function ZO_TributeRewardsList_Keyboard:ExitRow(row)
    ZO_SortFilterList.ExitRow(self, row)
    local iconTexture = row:GetNamedChild("Icon")
    ClearTooltip(InformationTooltip)
end
----------------------------
-- Tribute Rewards Dialog --
----------------------------
    local function Factory(objectPool)
        local listControl = ZO_ObjectPool_CreateControl("ZO_TributeRewardListTemplate_Keyboard", objectPool, control)
        local listObject = ZO_TributeRewardsList_Keyboard:New(listControl, control, canSelectLocked)
        listObject.control = listControl
        return listObject
    end
    local function Reset(listObject)
        ZO_ObjectPool_DefaultResetControl(listObject.control)
    end
    control.tributeRewardsDialogListPool = ZO_ObjectPool:New(Factory, Reset)
    control.tributeRewardsDialogDividerPool = ZO_ControlPool:New("ZO_DialogDivider", control, "Divider")
    local function TributeRewardsDialogSetup(dialog)
        control.tributeRewardsDialogListPool:ReleaseAllObjects()
        control.tributeRewardsDialogDividerPool:ReleaseAllObjects()
        local insertDivider = false
        local parentControl = control:GetNamedChild("Container")
        local anchorControl = parentControl
        for i, type in ipairs(ZO_TRIBUTE_REWARD_TYPE_LIST) do
            if insertDivider then
                local dividerControl = control.tributeRewardsDialogDividerPool:AcquireObject()
                dividerControl:ClearAnchors()
                dividerControl:SetAnchor(TOPLEFT, anchorControl, BOTTOMLEFT)
                dividerControl:SetAnchor(TOPRIGHT, anchorControl, BOTTOMRIGHT, 0, 10)
                anchorControl = dividerControl
            end
            local listObject = control.tributeRewardsDialogListPool:AcquireObject()
            listObject.control:SetHidden(false)
            listObject.control:SetParent(parentControl)
            listObject.control:ClearAnchors()
            listObject.control:SetAnchor(TOP, anchorControl, TOP, 0, insertDivider and 20 or 0)
            anchorControl = listObject.control
            insertDivider = true
            listObject:SetRewardsType(type)
            local count = listObject:GetNumTiersForTributeRewardsType()
            local listObjectListControl = listObject.control:GetNamedChild("List")
            listObjectListControl:SetHeight(count * ZO_TRIBUTE_REWARD_KEYBOARD_ROW_HEIGHT)
            listObject:BuildMasterList()
            listObject:RefreshData()
        end
    end
    ZO_Dialogs_RegisterCustomDialog("TRIBUTE_REWARDS_VIEW",
    {
        customControl = control,
        setup = TributeRewardsDialogSetup,
        title =
        {
            text = SI_TRIBUTE_FINDER_REWARDS_TITLE,
        },
        buttons =
        {
            {
                control = control:GetNamedChild("Close"),
                text = SI_DIALOG_CLOSE,
            },
        }
    })
end
    local listObject = control:GetParent():GetParent():GetParent().object
    listObject:Row_OnMouseEnter(control)
end
    local listObject = control:GetParent():GetParent():GetParent().object
    listObject:Row_OnMouseExit(control)
end
    local rewardsType = control:GetParent():GetParent().object:GetRewardsType()
    local rewardsTypeData = TRIBUTE_REWARDS_DATA_MANAGER:GetTributeRewardsTypeData(rewardsType)
    InitializeTooltip(InformationTooltip, control, RIGHT, 0, 0, LEFT)
    InformationTooltip:AddLine(rewardsTypeData:GetDescription(), "", ZO_NORMAL_TEXT:UnpackRGB())
end
   ClearTooltip(InformationTooltip)
end