ESOUI SVN HyperToxicsLeaderboard

[/] [trunk/] [HyperToxicsLeaderboard.lua] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 HyperToxic-7971
 
2 HyperToxic-7971
htLeaderboard = {}
3 HyperToxic-7971
htLeaderboard.name = "HyperToxicsLeaderboard"
4 10 HyperToxic-7971
htLeaderboard.version = 1.0
5 5 HyperToxic-7971
 
6 HyperToxic-7971
htLeaderboard.inCombat = false
7 HyperToxic-7971
 
8 HyperToxic-7971
htLeaderboard.WEEKLY = "Weekly"
9 HyperToxic-7971
htLeaderboard.HEL_RA_CITADEL = "Hel Ra Citadel"
10 HyperToxic-7971
htLeaderboard.AETHERIAN_ARCHIVE = "Aetherian Archive"
11 HyperToxic-7971
htLeaderboard.SANCTUM_OPHIDIA = "Sanctum Ophidia"
12 HyperToxic-7971
htLeaderboard.DRAGONSTAR_ARENA = "Dragonstar Arena (Veteran)"
13 HyperToxic-7971
 
14 HyperToxic-7971
htLeaderboard.boards = {htLeaderboard.WEEKLY, htLeaderboard.HEL_RA_CITADEL, htLeaderboard.AETHERIAN_ARCHIVE, htLeaderboard.SANCTUM_OPHIDIA, htLeaderboard.DRAGONSTAR_ARENA}
15 HyperToxic-7971
 
16 HyperToxic-7971
htLeaderboard.raidLeaderboardData = {}
17 HyperToxic-7971
 
18 HyperToxic-7971
-- Tooltip hooks
19 HyperToxic-7971
 
20 HyperToxic-7971
function ZO_FriendsListRowDisplayName_OnMouseEnter(control)
21 HyperToxic-7971
        local parent = control:GetParent()
22 HyperToxic-7971
        local data = ZO_ScrollList_GetData(parent)
23 HyperToxic-7971
        htLeaderboard:ShowTooltip(control, data.characterName)
24 HyperToxic-7971
end
25 HyperToxic-7971
 
26 HyperToxic-7971
function ZO_FriendsListRowDisplayName_OnMouseExit(control)
27 HyperToxic-7971
    ClearTooltip(InformationTooltip)
28 HyperToxic-7971
end
29 HyperToxic-7971
 
30 HyperToxic-7971
function ZO_GroupListRow_OnMouseEnter(control)
31 HyperToxic-7971
        local data = ZO_ScrollList_GetData(control)
32 13 HyperToxic-7971
 
33 HyperToxic-7971
        htLeaderboard:ShowTooltip(control.nameLabel, data.characterName)
34 5 HyperToxic-7971
end
35 HyperToxic-7971
 
36 HyperToxic-7971
function ZO_GroupListRow_OnMouseExit(control)
37 HyperToxic-7971
        ClearTooltip(InformationTooltip)
38 HyperToxic-7971
end
39 HyperToxic-7971
 
40 13 HyperToxic-7971
function ZO_KeyboardGuildRosterRowDisplayName_OnMouseEnter(control)
41 5 HyperToxic-7971
        local parent = control:GetParent()
42 HyperToxic-7971
        local data = ZO_ScrollList_GetData(parent)
43 HyperToxic-7971
        htLeaderboard:ShowTooltip(control, data.characterName)
44 HyperToxic-7971
end
45 HyperToxic-7971
 
46 13 HyperToxic-7971
function ZO_KeyboardGuildRosterRowDisplayName_OnMouseExit(control)
47 5 HyperToxic-7971
        ClearTooltip(InformationTooltip)
48 HyperToxic-7971
end
49 HyperToxic-7971
 
50 HyperToxic-7971
-- End tooltip hooks
51 HyperToxic-7971
 
52 HyperToxic-7971
-- Initialize our addon
53 HyperToxic-7971
function htLeaderboard.OnAddOnLoaded(eventCode, addOnName)
54 HyperToxic-7971
        if (addOnName == htLeaderboard.name) then
55 HyperToxic-7971
                htLeaderboard:Initialize()
56 HyperToxic-7971
        end
57 HyperToxic-7971
end
58 HyperToxic-7971
 
59 HyperToxic-7971
function htLeaderboard:Initialize()
60 HyperToxic-7971
        self.inCombat = IsUnitInCombat("player")
61 HyperToxic-7971
 
62 HyperToxic-7971
        EVENT_MANAGER:RegisterForEvent(self.name, EVENT_PLAYER_COMBAT_STATE, self.OnPlayerCombatState)
63 HyperToxic-7971
 
64 HyperToxic-7971
        --self.savedVariables = ZO_SavedVars:New("HyperToxicsLeaderboardSavedVariables", 1, nil, {})
65 HyperToxic-7971
        self.savedVariables = ZO_SavedVars:NewAccountWide("HyperToxicsLeaderboardSavedVariables", 1, nil, {})
66 HyperToxic-7971
 
67 HyperToxic-7971
        htLeaderboardIndicatorBG:SetAlpha(0)
68 HyperToxic-7971
 
69 13 HyperToxic-7971
        --htLeaderboardIndicator:SetWidth( 350 )
70 HyperToxic-7971
        --htLeaderboardIndicator:SetHeight( 175 )
71 5 HyperToxic-7971
 
72 HyperToxic-7971
    htLeaderboardIndicatorW:ClearAnchors();
73 HyperToxic-7971
    htLeaderboardIndicatorW:SetAnchor(TOP, htLeaderboardIndicator, TOP, 0, 0)
74 13 HyperToxic-7971
    --htLeaderboardIndicatorW:SetWidth( 350 )
75 5 HyperToxic-7971
        htLeaderboardIndicatorW:SetHeight( 25 )
76 HyperToxic-7971
        htLeaderboardIndicatorW:SetHorizontalAlignment(1)
77 HyperToxic-7971
 
78 HyperToxic-7971
    htLeaderboardIndicatorHRC:ClearAnchors();
79 HyperToxic-7971
    htLeaderboardIndicatorHRC:SetAnchor(TOP, htLeaderboardIndicatorW, BOTTOM, 0, 0)
80 13 HyperToxic-7971
    --htLeaderboardIndicatorHRC:SetWidth( 350 )
81 5 HyperToxic-7971
        htLeaderboardIndicatorHRC:SetHeight( 25 )
82 HyperToxic-7971
        htLeaderboardIndicatorHRC:SetHorizontalAlignment(1)
83 HyperToxic-7971
 
84 HyperToxic-7971
    htLeaderboardIndicatorAA:ClearAnchors();
85 HyperToxic-7971
    htLeaderboardIndicatorAA:SetAnchor(TOP, htLeaderboardIndicatorHRC, BOTTOM, 0, 0)
86 13 HyperToxic-7971
    --htLeaderboardIndicatorAA:SetWidth( 350 )
87 5 HyperToxic-7971
        htLeaderboardIndicatorAA:SetHeight( 25 )
88 HyperToxic-7971
        htLeaderboardIndicatorAA:SetHorizontalAlignment(1)
89 HyperToxic-7971
 
90 HyperToxic-7971
    htLeaderboardIndicatorSO:ClearAnchors();
91 HyperToxic-7971
    htLeaderboardIndicatorSO:SetAnchor(TOP, htLeaderboardIndicatorAA, BOTTOM, 0, 0)
92 13 HyperToxic-7971
    --htLeaderboardIndicatorSO:SetWidth( 350 )
93 5 HyperToxic-7971
        htLeaderboardIndicatorSO:SetHeight( 25 )
94 HyperToxic-7971
        htLeaderboardIndicatorSO:SetHorizontalAlignment(1)
95 HyperToxic-7971
 
96 HyperToxic-7971
    htLeaderboardIndicatorDSA:ClearAnchors();
97 HyperToxic-7971
    htLeaderboardIndicatorDSA:SetAnchor(TOP, htLeaderboardIndicatorSO, BOTTOM, 0, 0)
98 13 HyperToxic-7971
    --htLeaderboardIndicatorDSA:SetWidth( 350 )
99 5 HyperToxic-7971
        htLeaderboardIndicatorDSA:SetHeight( 25 )
100 HyperToxic-7971
        htLeaderboardIndicatorDSA:SetHorizontalAlignment(1)
101 HyperToxic-7971
 
102 HyperToxic-7971
        self:RestorePosition()
103 HyperToxic-7971
 
104 HyperToxic-7971
        EVENT_MANAGER:RegisterForEvent(self.name, EVENT_RETICLE_TARGET_CHANGED, htLeaderboard.TargetChange)
105 HyperToxic-7971
 
106 HyperToxic-7971
        EVENT_MANAGER:RegisterForEvent(self.name, EVENT_GAME_CAMERA_UI_MODE_CHANGED, htLeaderboard.UIModeChanged)
107 HyperToxic-7971
 
108 HyperToxic-7971
        EVENT_MANAGER:RegisterForEvent(self.name, EVENT_PLAYER_ACTIVATED, htLeaderboard.LateInitialize);
109 HyperToxic-7971
        EVENT_MANAGER:UnregisterForEvent(self.name, EVENT_ADD_ON_LOADED);
110 HyperToxic-7971
 
111 4 HyperToxic-7971
    EVENT_MANAGER:RegisterForEvent(self.name,  EVENT_ACTION_LAYER_POPPED , htLeaderboard.ShowInterface)
112 5 HyperToxic-7971
    EVENT_MANAGER:RegisterForEvent(self.name,  EVENT_ACTION_LAYER_PUSHED , htLeaderboard.HideInterface)
113 HyperToxic-7971
end
114 HyperToxic-7971
 
115 HyperToxic-7971
-- Fancy loaded message
116 HyperToxic-7971
function htLeaderboard.LateInitialize(eventCode, addOnName)
117 10 HyperToxic-7971
        d("HyperToxic's Leaderboard loaded...")
118 5 HyperToxic-7971
 
119 HyperToxic-7971
        htLeaderboard:UpdateRaidLeaderboardData()
120 HyperToxic-7971
        htLeaderboard:DisplayRaidLeaderboardData()
121 HyperToxic-7971
 
122 HyperToxic-7971
        EVENT_MANAGER:UnregisterForEvent(htLeaderboard.name, EVENT_PLAYER_ACTIVATED);
123 HyperToxic-7971
end
124 HyperToxic-7971
 
125 HyperToxic-7971
function htLeaderboard:ShowTooltip(control, characterName)
126 HyperToxic-7971
        local tooltip = characterName
127 HyperToxic-7971
        for i, board in ipairs(htLeaderboard.boards) do
128 HyperToxic-7971
                local boardData = htLeaderboard:GetCharectorNameRaidLeaderboardData(board, characterName)
129 HyperToxic-7971
                if boardData then
130 12 HyperToxic-7971
 
131 HyperToxic-7971
                        --local timeinminutes = boardData.time / 1000.0 / 60.0;
132 HyperToxic-7971
                        --local minutes = math.floor(timeinminutes);
133 HyperToxic-7971
                        --local seconds = math.floor((timeinminutes - minutes) * 60.0);
134 HyperToxic-7971
                        --tooltip = tooltip .. "\n" .. board .. " (" .. boardData.ranking .. ") " .. string.format("%d", minutes) .. ":" .. string.format("%02d", seconds)
135 HyperToxic-7971
 
136 13 HyperToxic-7971
                        tooltip = tooltip .. "\n" .. board .. " (#" .. boardData.ranking .. ") " .. string.format("%d", boardData.time)
137 HyperToxic-7971
 
138 5 HyperToxic-7971
                end
139 HyperToxic-7971
        end
140 HyperToxic-7971
 
141 7 HyperToxic-7971
        InitializeTooltip(InformationTooltip, control, BOTTOM, 0, 0, TOPCENTER)
142 5 HyperToxic-7971
        SetTooltipText(InformationTooltip, tooltip)
143 HyperToxic-7971
end
144 HyperToxic-7971
 
145 HyperToxic-7971
function htLeaderboard:UpdateRaidLeaderboardData()
146 HyperToxic-7971
        QueryRaidLeaderboardData()
147 HyperToxic-7971
 
148 HyperToxic-7971
        local raidIndex
149 HyperToxic-7971
        local name, isWeekly, raidId, category
150 HyperToxic-7971
        local ranking, charName, time, classId, allianceId
151 HyperToxic-7971
        local currentRanking, currentTime
152 HyperToxic-7971
        local entryIndex
153 HyperToxic-7971
        local currentPlayer
154 HyperToxic-7971
        local currentRaid
155 HyperToxic-7971
        local alliance
156 HyperToxic-7971
 
157 HyperToxic-7971
        alliance = GetUnitAlliance("player")
158 HyperToxic-7971
 
159 HyperToxic-7971
        htLeaderboard.raidLeaderboardData = {}
160 HyperToxic-7971
 
161 HyperToxic-7971
        for raidIndex = 1, GetNumRaidLeaderboards() do
162 HyperToxic-7971
                name, isWeekly, raidId, category = GetRaidLeaderboardInfo(raidIndex)
163 HyperToxic-7971
                if (isWeekly == true) then
164 HyperToxic-7971
                        name = "Weekly"
165 HyperToxic-7971
                end
166 HyperToxic-7971
 
167 HyperToxic-7971
                --d("name: " .. name .. ", isWeekly: " .. string.format("%s", isWeekly and "true" or "false") .. ", raidId: " .. raidId .. ", category: " .. category )
168 HyperToxic-7971
 
169 HyperToxic-7971
                currentRanking = 0
170 HyperToxic-7971
                currentTime = 0
171 HyperToxic-7971
 
172 HyperToxic-7971
                htLeaderboard.raidLeaderboardData[name] = {}
173 HyperToxic-7971
 
174 HyperToxic-7971
                for entryIndex = 1 , GetNumRaidLeaderboardEntries(raidIndex) do
175 HyperToxic-7971
                        ranking, charName, time, classId, allianceId = GetRaidLeaderboardEntryInfo(raidIndex, entryIndex)
176 HyperToxic-7971
 
177 HyperToxic-7971
                        if (ranking > currentRanking) then
178 HyperToxic-7971
                                currentRanking = ranking
179 HyperToxic-7971
                                currentTime = time
180 HyperToxic-7971
                        end
181 HyperToxic-7971
 
182 HyperToxic-7971
                        --if (alliance == allianceId) then
183 HyperToxic-7971
 
184 HyperToxic-7971
                                --d("ranking: " .. currentRanking .. ", charName: " .. charName .. ", time: " .. currentTime .. ", classId: " .. classId .. ", allianceId: " .. allianceId)
185 HyperToxic-7971
 
186 HyperToxic-7971
                                htLeaderboard.raidLeaderboardData[name][charName] = {ranking = currentRanking, charName = charName, time = currentTime, classId = classId, allianceId = allianceId}
187 HyperToxic-7971
                        --end
188 HyperToxic-7971
                end
189 HyperToxic-7971
        end
190 HyperToxic-7971
end
191 HyperToxic-7971
 
192 HyperToxic-7971
function htLeaderboard:GetCharectorNameRaidLeaderboardData(leaderboardName, charName)
193 9 HyperToxic-7971
        local data = htLeaderboard.raidLeaderboardData[leaderboardName]
194 HyperToxic-7971
        if data then
195 HyperToxic-7971
                for key,value in pairs(data) do
196 HyperToxic-7971
                        if (key == charName) then
197 HyperToxic-7971
                                return value
198 HyperToxic-7971
                        end
199 5 HyperToxic-7971
                end
200 HyperToxic-7971
        end
201 HyperToxic-7971
        return nil
202 HyperToxic-7971
end
203 HyperToxic-7971
 
204 HyperToxic-7971
function htLeaderboard:DisplayRaidLeaderboardDataForCharacter(leaderboardName, charName)
205 HyperToxic-7971
        local charData
206 HyperToxic-7971
        local timeinminutes
207 HyperToxic-7971
        local minutes
208 HyperToxic-7971
        local seconds
209 HyperToxic-7971
        charData = self:GetCharectorNameRaidLeaderboardData(leaderboardName, charName);
210 HyperToxic-7971
        if (charData ~= nil) then
211 12 HyperToxic-7971
                --timeinminutes = charData.time / 1000.0 / 60.0;
212 HyperToxic-7971
                --minutes = math.floor(timeinminutes);
213 HyperToxic-7971
                --seconds = math.floor((timeinminutes - minutes) * 60.0);
214 HyperToxic-7971
                --d(charData.time)
215 HyperToxic-7971
                --d(leaderboardName .. " Rank: #" .. charData.ranking .. " Time: " .. string.format("%02d", minutes) .. ":" .. string.format("%02d", seconds) )
216 HyperToxic-7971
 
217 13 HyperToxic-7971
                d(leaderboardName .. " (#" .. charData.ranking .. ") " .. string.format("%d", charData.time) )
218 5 HyperToxic-7971
        end
219 HyperToxic-7971
end
220 HyperToxic-7971
 
221 HyperToxic-7971
function htLeaderboard:DisplayRaidLeaderboardData()
222 HyperToxic-7971
        local playerName
223 HyperToxic-7971
        playerName = GetUnitName("player")
224 HyperToxic-7971
        self:DisplayRaidLeaderboardDataForName(playerName)
225 HyperToxic-7971
end
226 HyperToxic-7971
 
227 HyperToxic-7971
function htLeaderboard:DisplayRaidLeaderboardDataForName(playerName)
228 HyperToxic-7971
        for i, board in ipairs(htLeaderboard.boards) do
229 HyperToxic-7971
                self:DisplayRaidLeaderboardDataForCharacter(board, playerName)
230 HyperToxic-7971
        end
231 HyperToxic-7971
end
232 HyperToxic-7971
 
233 HyperToxic-7971
function htLeaderboard.OnIndicatorMoveStop()
234 HyperToxic-7971
        htLeaderboard.savedVariables.left = htLeaderboardIndicator:GetLeft()
235 HyperToxic-7971
        htLeaderboard.savedVariables.top = htLeaderboardIndicator:GetTop()
236 HyperToxic-7971
end
237 HyperToxic-7971
 
238 HyperToxic-7971
function htLeaderboard:RestorePosition()
239 HyperToxic-7971
        local left = self.savedVariables.left
240 HyperToxic-7971
        local top = self.savedVariables.top
241 HyperToxic-7971
 
242 HyperToxic-7971
        htLeaderboardIndicator:ClearAnchors()
243 HyperToxic-7971
        htLeaderboardIndicator:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, left, top)
244 HyperToxic-7971
end
245 HyperToxic-7971
 
246 HyperToxic-7971
function htLeaderboard.OnPlayerCombatState(event, inCombat)
247 HyperToxic-7971
        -- The ~= operator is "not equal to" in Lua.
248 HyperToxic-7971
        if inCombat ~= htLeaderboard.inCombat then
249 HyperToxic-7971
                -- The player's state has changed. Update the stored state...
250 HyperToxic-7971
                htLeaderboard.inCombat = inCombat
251 HyperToxic-7971
        end
252 HyperToxic-7971
end
253 HyperToxic-7971
 
254 HyperToxic-7971
function htLeaderboard:UpdateControl(raidName, playerName, control)
255 HyperToxic-7971
 
256 HyperToxic-7971
        local charData
257 HyperToxic-7971
        local timeinminutes
258 HyperToxic-7971
        local minutes
259 HyperToxic-7971
        local seconds
260 HyperToxic-7971
        local text
261 HyperToxic-7971
 
262 HyperToxic-7971
        charData = htLeaderboard:GetCharectorNameRaidLeaderboardData(raidName, playerName)
263 HyperToxic-7971
        if (charData ~= nil) then
264 12 HyperToxic-7971
                --timeinminutes = charData.time / 1000.0 / 60.0;
265 HyperToxic-7971
                --minutes = math.floor(timeinminutes);
266 HyperToxic-7971
                --seconds = math.floor((timeinminutes - minutes) * 60.0);
267 HyperToxic-7971
 
268 HyperToxic-7971
                --text = raidName .. " (" .. charData.ranking .. ") " .. string.format("%d:%02d", minutes, seconds)
269 HyperToxic-7971
 
270 13 HyperToxic-7971
                text = raidName .. " (#" .. charData.ranking .. ") " .. string.format("%d", charData.time);
271 12 HyperToxic-7971
 
272 5 HyperToxic-7971
                control:SetText(text)
273 HyperToxic-7971
                control:SetHeight( 25 )
274 HyperToxic-7971
        else
275 HyperToxic-7971
                control:SetText("")
276 HyperToxic-7971
                control:SetHeight( 0 )
277 HyperToxic-7971
        end
278 HyperToxic-7971
 
279 HyperToxic-7971
end
280 HyperToxic-7971
 
281 HyperToxic-7971
function htLeaderboard.TargetChange()
282 HyperToxic-7971
 
283 HyperToxic-7971
        local playerName
284 HyperToxic-7971
 
285 HyperToxic-7971
        if (IsReticleHidden() == false) then
286 HyperToxic-7971
 
287 HyperToxic-7971
                if (IsUnitPlayer('reticleover')) then
288 HyperToxic-7971
                        playerName = GetUnitName('reticleover')
289 HyperToxic-7971
 
290 HyperToxic-7971
                        htLeaderboard:UpdateControl(htLeaderboard.WEEKLY, playerName, htLeaderboardIndicatorW)
291 HyperToxic-7971
                        htLeaderboard:UpdateControl(htLeaderboard.HEL_RA_CITADEL, playerName, htLeaderboardIndicatorHRC)
292 HyperToxic-7971
                        htLeaderboard:UpdateControl(htLeaderboard.AETHERIAN_ARCHIVE, playerName, htLeaderboardIndicatorAA)
293 HyperToxic-7971
                        htLeaderboard:UpdateControl(htLeaderboard.SANCTUM_OPHIDIA, playerName, htLeaderboardIndicatorSO)
294 HyperToxic-7971
                        htLeaderboard:UpdateControl(htLeaderboard.DRAGONSTAR_ARENA, playerName, htLeaderboardIndicatorDSA)
295 HyperToxic-7971
                else
296 HyperToxic-7971
                        htLeaderboardIndicatorW:SetText("")
297 HyperToxic-7971
                        htLeaderboardIndicatorW:SetHeight( 0 )
298 HyperToxic-7971
                        htLeaderboardIndicatorHRC:SetText("")
299 HyperToxic-7971
                        htLeaderboardIndicatorHRC:SetHeight( 0 )
300 HyperToxic-7971
                        htLeaderboardIndicatorAA:SetText("")
301 HyperToxic-7971
                        htLeaderboardIndicatorAA:SetHeight( 0 )
302 HyperToxic-7971
                        htLeaderboardIndicatorSO:SetText("")
303 HyperToxic-7971
                        htLeaderboardIndicatorSO:SetHeight( 0 )
304 HyperToxic-7971
                        htLeaderboardIndicatorDSA:SetText("")
305 HyperToxic-7971
                        htLeaderboardIndicatorDSA:SetHeight( 0 )
306 HyperToxic-7971
                end
307 HyperToxic-7971
 
308 HyperToxic-7971
        end
309 HyperToxic-7971
end
310 HyperToxic-7971
 
311 HyperToxic-7971
function htLeaderboard.UIModeChanged()
312 HyperToxic-7971
 
313 HyperToxic-7971
        -- zo_callLater(function () d(IsMenuVisisble()) end, 1000)
314 HyperToxic-7971
 
315 HyperToxic-7971
        if (IsReticleHidden()) then
316 HyperToxic-7971
                htLeaderboardIndicatorBG:SetAlpha(100)
317 HyperToxic-7971
                htLeaderboardIndicatorW:SetText(htLeaderboard.WEEKLY)
318 HyperToxic-7971
                htLeaderboardIndicatorW:SetHeight( 25 )
319 HyperToxic-7971
                htLeaderboardIndicatorHRC:SetText(htLeaderboard.HEL_RA_CITADEL)
320 HyperToxic-7971
                htLeaderboardIndicatorHRC:SetHeight( 25 )
321 HyperToxic-7971
                htLeaderboardIndicatorAA:SetText(htLeaderboard.AETHERIAN_ARCHIVE)
322 HyperToxic-7971
                htLeaderboardIndicatorAA:SetHeight( 25 )
323 HyperToxic-7971
                htLeaderboardIndicatorSO:SetText(htLeaderboard.SANCTUM_OPHIDIA)
324 HyperToxic-7971
                htLeaderboardIndicatorSO:SetHeight( 25 )
325 HyperToxic-7971
                htLeaderboardIndicatorDSA:SetText(htLeaderboard.DRAGONSTAR_ARENA)
326 HyperToxic-7971
                htLeaderboardIndicatorDSA:SetHeight( 25 )
327 HyperToxic-7971
        else
328 HyperToxic-7971
                htLeaderboardIndicatorBG:SetAlpha(0)
329 HyperToxic-7971
                htLeaderboardIndicatorW:SetText("")
330 HyperToxic-7971
                htLeaderboardIndicatorW:SetHeight( 0 )
331 HyperToxic-7971
                htLeaderboardIndicatorHRC:SetText("")
332 HyperToxic-7971
                htLeaderboardIndicatorHRC:SetHeight( 0 )
333 HyperToxic-7971
                htLeaderboardIndicatorAA:SetText("")
334 HyperToxic-7971
                htLeaderboardIndicatorAA:SetHeight( 0 )
335 HyperToxic-7971
                htLeaderboardIndicatorSO:SetText("")
336 HyperToxic-7971
                htLeaderboardIndicatorSO:SetHeight( 0 )
337 HyperToxic-7971
                htLeaderboardIndicatorDSA:SetText("")
338 HyperToxic-7971
                htLeaderboardIndicatorDSA:SetHeight( 0 )
339 HyperToxic-7971
        end
340 HyperToxic-7971
end
341 HyperToxic-7971
 
342 4 HyperToxic-7971
-- Hide or show the add-on when other panels are open, like inventory.
343 HyperToxic-7971
-- There's probably a better way to hook this into the scene manager.
344 HyperToxic-7971
function htLeaderboard.HideInterface(eventCode,layerIndex,activeLayerIndex)
345 HyperToxic-7971
    --d(layerIndex .. ":" .. activeLayerIndex)
346 HyperToxic-7971
    -- We don't want to hide the interface if this is the user pressing the "." key, only if there's an interface displayed
347 HyperToxic-7971
    if (activeLayerIndex == 3) then
348 HyperToxic-7971
        htLeaderboardIndicator:SetHidden(true)
349 HyperToxic-7971
    end
350 HyperToxic-7971
end
351 HyperToxic-7971
 
352 HyperToxic-7971
function htLeaderboard.ShowInterface(...)
353 HyperToxic-7971
    htLeaderboardIndicator:SetHidden(false)
354 HyperToxic-7971
end
355 HyperToxic-7971
 
356 HyperToxic-7971
 
357 5 HyperToxic-7971
 
358 HyperToxic-7971
 
359 HyperToxic-7971
EVENT_MANAGER:RegisterForEvent("htLeaderboard", EVENT_ADD_ON_LOADED, htLeaderboard.OnAddOnLoaded);