ESO Lua File v100012

ingame/quickslot/quickslot.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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
local DATA_TYPE_QUICKSLOT_ITEM = 1
local DATA_TYPE_COLLECTIBLE_ITEM = 2
local PLAY_ANIMATION = true
local NO_ANIMATION = false
local STOLEN_ICON_TEXTURE = "EsoUI/Art/Inventory/inventory_stolenItem_icon.dds"
local LIST_ENTRY_HEIGHT = 52
-------------------
--Quickslot Manager
-------------------
ZO_QuickslotManager = ZO_Object:Subclass()
function ZO_QuickslotManager:New(container)
    local manager = ZO_Object.New(self)
    manager.container = container
    manager.money = GetControl(container, "InfoBarMoney")
    manager.activeTab = GetControl(container, "TabsActive")
    manager.freeSlotsLabel = GetControl(container, "InfoBarFreeSlots")
    manager.list = GetControl(container, "List")
    ZO_ScrollList_AddDataType(manager.list, DATA_TYPE_QUICKSLOT_ITEM, "ZO_PlayerInventorySlot", LIST_ENTRY_HEIGHT, function(control, data) manager:SetUpQuickSlot(control, data) end, nil, nil, ZO_InventorySlot_OnPoolReset)
    ZO_ScrollList_AddDataType(manager.list, DATA_TYPE_COLLECTIBLE_ITEM, "ZO_CollectionsSlot", LIST_ENTRY_HEIGHT, function(control, data) manager:SetUpCollectionSlot(control, data) end, nil, nil, ZO_InventorySlot_OnPoolReset)
    manager.sortHeadersControl = container:GetNamedChild("SortBy")
    manager.sortHeaders = ZO_SortHeaderGroup:New(manager.sortHeadersControl, true)
    manager.circle = ZO_QuickSlotCircle
    manager.quickSlots = {}
    manager.tabs = GetControl(container, "Tabs")
    local function CreateNewTabFilterData(filterType, normal, pressed, highlight)
        local filterString = GetString("SI_ITEMFILTERTYPE", filterType)
        local tabData =
        {
            -- Custom data
            activeTabText = filterString,
            tooltipText = filterString,
            sortKey = "name",
            sortOrder = ZO_SORT_ORDER_UP,
            -- Menu bar data
            descriptor = filterType,
            normal = normal,
            pressed = pressed,
            highlight = highlight,
            callback = function(tabData) manager:ChangeFilter(tabData) end,
        }
        return tabData
    end
    manager.quickslotFilters =
    {
        CreateNewTabFilterData(ITEMFILTERTYPE_COLLECTIBLE,
                          "EsoUI/Art/MainMenu/menuBar_collections_up.dds",
                          "EsoUI/Art/MainMenu/menuBar_collections_down.dds",
                          "EsoUI/Art/MainMenu/menuBar_collections_over.dds"),
        CreateNewTabFilterData(ITEMFILTERTYPE_QUICKSLOT,
                          "EsoUI/Art/Inventory/inventory_tabIcon_items_up.dds",
                          "EsoUI/Art/Inventory/inventory_tabIcon_items_down.dds",
                          "EsoUI/Art/Inventory/inventory_tabIcon_items_over.dds"),
        CreateNewTabFilterData(ITEMFILTERTYPE_ALL,
                          "EsoUI/Art/Inventory/inventory_tabIcon_all_up.dds",
                          "EsoUI/Art/Inventory/inventory_tabIcon_all_down.dds",
                          "EsoUI/Art/Inventory/inventory_tabIcon_all_over.dds"),
    }
    local menuBarData =
    {
        initialButtonAnchorPoint = RIGHT,
        buttonTemplate = "ZO_QuickSlotTab",
        normalSize = 51,
        downSize = 64,
        buttonPadding = -15,
        animationDuration = 180,
    }
    ZO_MenuBar_SetData(manager.tabs, menuBarData)
    for _, data in ipairs(manager.quickslotFilters) do
        ZO_MenuBar_AddButton(manager.tabs, data)
    end
    ZO_MenuBar_SelectDescriptor(manager.tabs, ITEMFILTERTYPE_QUICKSLOT)
    local function OnSortHeaderClicked(key, order)
        manager.currentFilter.sortKey = key
        manager.currentFilter.sortOrder = order
        manager:ApplySort()
    end
    manager.sortHeaders:RegisterCallback(ZO_SortHeaderGroup.HEADER_CLICKED, OnSortHeaderClicked)
    manager.sortHeaders:AddHeadersFromContainer()
    manager.sortHeaders:SelectHeaderByKey("name", ZO_SortHeaderGroup.SUPPRESS_CALLBACKS)
    local function RefreshQuickslotWindow()
        if not container:IsHidden() then
            manager:UpdateList()
            manager:UpdateFreeSlots()
        end
    end
    local function OnMoneyUpdated(eventCode, newMoney, oldMoney, reason)
        manager:RefreshCurrency(newMoney)
    end
    local function OnQuickSlotUpdated(eventCode, physicalSlot)
        manager:DoQuickSlotUpdate(physicalSlot, PLAY_ANIMATION)
    end
    local function UpdateAllQuickSlots(eventCode)
        for physicalSlot in pairs(manager.quickSlots) do
            manager:DoQuickSlotUpdate(physicalSlot)
        end
    end
    local function HandleInventorySlotPickup(bagId, slotId)
        manager:ShowAppropriateQuickSlotDropCallouts(bagId, slotId)
    end
    local function HandleActionSlotPickup(slotType, sourceSlot, itemId, itemQualityId, itemRequiredLevel, itemInstanceData)
        local metEquipRequirements = true -- This was already in a slot, chances are you're not going to fail equip requirements...
        local isItem = (slotType == ACTION_TYPE_ITEM)
        if(isItem) then
            for slotNum, quickSlot in pairs(manager.quickSlots) do
                local validInSlot = IsValidItemForSlotByItemInfo(itemId, itemQualityId, itemRequiredLevel, itemInstanceData, slotNum)
                if validInSlot then
                    manager:ShowSlotDropCallout(quickSlot:GetNamedChild("DropCallout"), metEquipRequirements)
                end
            end
        end
    end
    local function HandleCollectibleSlotPickup(collectibleId)
        for slotNum, quickSlot in pairs(manager.quickSlots) do
            local validInSlot = IsValidCollectibleForSlot(collectibleId, slotNum)
            if validInSlot then
                manager:ShowSlotDropCallout(quickSlot:GetNamedChild("DropCallout"), true)
            end
        end
    end
    local function HandleCursorPickup(eventCode, cursorType, ...)
        if(cursorType == MOUSE_CONTENT_INVENTORY_ITEM) then
            HandleInventorySlotPickup(...)
        elseif(cursorType == MOUSE_CONTENT_ACTION) then
            HandleActionSlotPickup(...)
        elseif(cursorType == MOUSE_CONTENT_COLLECTIBLE) then
            HandleCollectibleSlotPickup(...)
        end
    end
    local function HandleCursorCleared()
        manager:HideAllQuickSlotDropCallouts()
    end
    manager:RefreshCurrency(GetCarriedCurrencyAmount(CURT_MONEY))
    manager:CreateQuickSlots()
    local function HandleInventoryChanged()
        for slotNum, quickslot in pairs(manager.quickSlots) do
            local slotType = GetSlotType(slotNum)
            if slotType == ACTION_TYPE_ITEM then
                local itemCount = GetSlotItemCount(slotNum)
                manager:SetupQuickslotCount(quickslot, itemCount)
            end
        end
        RefreshQuickslotWindow()
    end
    local function RefreshSlotLocked(slotIndex, locked)
        local scrollData = ZO_ScrollList_GetDataList(manager.list)
        for i = 1, #scrollData do
            local dataEntry = scrollData[i]
            local data = dataEntry.data
            if(data.slotIndex == slotIndex) then
                data.locked = locked
                ZO_ScrollList_RefreshVisible(manager.list)
                break
            end
        end
    end
    local function HandleInventorySlotLocked(_, bagId, slotIndex)
        if(bagId == BAG_BACKPACK) then
            RefreshSlotLocked(slotIndex, true)
        end
    end
    local function HandleInventorySlotUnlocked(_, bagId, slotIndex)
        if(bagId == BAG_BACKPACK) then
            RefreshSlotLocked(slotIndex, false)
        end
    end
    ZO_QuickSlot:RegisterForEvent(EVENT_MONEY_UPDATE, OnMoneyUpdated)
    ZO_QuickSlot:RegisterForEvent(EVENT_INVENTORY_FULL_UPDATE, HandleInventoryChanged)
    ZO_QuickSlot:RegisterForEvent(EVENT_INVENTORY_SINGLE_SLOT_UPDATE, HandleInventoryChanged)
    ZO_QuickSlot:RegisterForEvent(EVENT_LEVEL_UPDATE, function(eventCode, unitTag) if unitTag == "player" then HandleInventoryChanged() end end)
    ZO_QuickSlot:RegisterForEvent(EVENT_ACTION_SLOT_UPDATED, OnQuickSlotUpdated)
    ZO_QuickSlot:RegisterForEvent(EVENT_ACTION_SLOTS_FULL_UPDATE, UpdateAllQuickSlots)
    ZO_QuickSlot:RegisterForEvent(EVENT_CURSOR_PICKUP, HandleCursorPickup)
    ZO_QuickSlot:RegisterForEvent(EVENT_CURSOR_DROPPED, HandleCursorCleared)
    ZO_QuickSlot:RegisterForEvent(EVENT_INVENTORY_SLOT_LOCKED, HandleInventorySlotLocked)
    ZO_QuickSlot:RegisterForEvent(EVENT_INVENTORY_SLOT_UNLOCKED, HandleInventorySlotUnlocked)
    manager:InitializeKeybindDescriptor()
    manager.quickSlotState = false
    QUICKSLOT_FRAGMENT = ZO_FadeSceneFragment:New(ZO_QuickSlot)
    QUICKSLOT_FRAGMENT:RegisterCallback("StateChange",  function(oldState, newState)
                                                            if(newState == SCENE_FRAGMENT_SHOWN) then
                                                                manager:UpdateList()
                                                                manager:UpdateFreeSlots()
                                                            end
                                                        end)
    QUICKSLOT_CIRCLE_FRAGMENT = ZO_FadeSceneFragment:New(ZO_QuickSlotCircle)
    QUICKSLOT_CIRCLE_FRAGMENT:RegisterCallback("StateChange",  function(oldState, newState)
                                                            if(newState == SCENE_FRAGMENT_SHOWN) then
                                                                manager.quickSlotState = true
                                                            elseif(newState == SCENE_FRAGMENT_HIDDEN) then
                                                                manager.quickSlotState = false
                                                            end
                                                        end)
    COLLECTIONS_INVENTORY_SINGLETON:RegisterCallback("CollectionsInventoryUpdate", RefreshQuickslotWindow)
    return manager
end
function ZO_QuickslotManager:AreQuickSlotsShowing()
    return self.quickSlotState
end
function ZO_QuickslotManager:InitializeKeybindDescriptor()
    self.keybindStripDescriptor =
    {
        alignment = KEYBIND_STRIP_ALIGN_RIGHT,
        -- Remove
        {
            name = GetString(SI_ABILITY_ACTION_CLEAR_SLOT),
            keybind = "UI_SHORTCUT_PRIMARY",
            callback = function()
                local slotId = self.mouseOverSlot.slotNum
                ClearSlot(slotId)
                PlaySound(SOUNDS.QUICKSLOT_CLEAR)
            end,
        },
    }
end
local EMPTY_QUICKSLOT_TEXTURE = "EsoUI/Art/Quickslots/quickslot_emptySlot.dds"
local INITIAL_ROTATION = 0
local TWO_PI = math.pi * 2
function ZO_QuickslotManager:PerformQuickSlotLayout()
    local width, height = self.circle:GetDimensions()
    local scale = self.circle:GetScale()
    local halfWidth, halfHeight = width * scale * 0.5, height * scale * 0.5
    local numQuickSlots = ACTION_BAR_UTILITY_BAR_SIZE
    for i = 1, numQuickSlots do
        local control = self.quickSlots[i + ACTION_BAR_FIRST_UTILITY_BAR_SLOT]
        local centerAngle = INITIAL_ROTATION + i / numQuickSlots * TWO_PI
        local x = math.sin(centerAngle)
        local y = math.cos(centerAngle)
        control:SetAnchor(CENTER, nil, CENTER, x * halfWidth, y * halfHeight)
        control:SetHidden(false)
    end
end
function ZO_QuickslotManager:SetupQuickslotCount(quickslot, count)
    if count then
        quickslot.icon:SetDesaturation(count == 0 and 1 or 0)
        quickslot.countText:SetText(count)
        quickslot.countText:SetHidden(false)
    else
        quickslot.icon:SetDesaturation(0)
        quickslot.countText:SetHidden(true)
    end
end
function ZO_QuickslotManager:CreateQuickSlots()
    local lastButton = nil
    for i = ACTION_BAR_FIRST_UTILITY_BAR_SLOT + 1, ACTION_BAR_FIRST_UTILITY_BAR_SLOT + ACTION_BAR_UTILITY_BAR_SIZE do
        local quickSlot = CreateControlFromVirtual("ZO_QuickSlot"..i, self.circle, "ZO_QuickSlotTemplate")
        self.quickSlots[i] = quickSlot
        quickSlot.button = quickSlot:GetNamedChild("Button")
        quickSlot.button.slotNum = i
        quickSlot.icon = quickSlot:GetNamedChild("Icon")
        quickSlot.countText = quickSlot:GetNamedChild("CountText")
        ZO_ActionSlot_SetupSlot(quickSlot.icon, quickSlot.button, EMPTY_QUICKSLOT_TEXTURE)
        CreateOnEquippedAnimation(quickSlot)
        lastButton = quickSlot
    end
end
function ZO_QuickslotManager:DoQuickSlotUpdate(physicalSlot, animationOption)
    local quickSlot = self.quickSlots[physicalSlot]
    if(quickSlot) then
        local slotType = GetSlotType(physicalSlot)
        if(slotType == ACTION_TYPE_NOTHING) then
            ZO_ActionSlot_SetupSlot(quickSlot.icon, quickSlot.button, EMPTY_QUICKSLOT_TEXTURE)
            self:SetupQuickslotCount(quickSlot)
        else
            local slotIcon = GetSlotTexture(physicalSlot)
            local itemCount = GetSlotItemCount(physicalSlot)
            ZO_ActionSlot_SetupSlot(quickSlot.icon, quickSlot.button, slotIcon)
            self:SetupQuickslotCount(quickSlot, itemCount)
            -- TODO: There's not a lot to go off of to determine if this quick slot was changing contents
            -- or being used, or anything else. Probably going to need to add additional event info for
            -- something being placed here instead of just doing a full slot update.
            if(animationOption == PLAY_ANIMATION and not quickSlot:IsHidden()) then
                PlayOnEquippedAnimation(quickSlot)
            end
            local numSlotted = 0
            for i = ACTION_BAR_FIRST_UTILITY_BAR_SLOT + 1, ACTION_BAR_FIRST_UTILITY_BAR_SLOT + ACTION_BAR_UTILITY_BAR_SIZE do
                local slotType = GetSlotType(i)
                if(slotType ~= ACTION_TYPE_NOTHING) then
                    numSlotted = numSlotted + 1
                end
            end
            if(numSlotted == 1) then
                SetCurrentQuickslot(physicalSlot)
            end
        end
        local mouseOverControl = WINDOW_MANAGER:GetMouseOverControl()
        if(mouseOverControl == quickSlot.button)
        then
            ZO_AbilitySlot_OnMouseEnter(quickSlot.button)
        end
    end
end
function ZO_QuickslotManager:HideAllQuickSlotDropCallouts()
    for _, quickSlot in pairs(self.quickSlots) do
        quickSlot:GetNamedChild("DropCallout"):SetHidden(true)
    end
end
function ZO_QuickslotManager:ShowSlotDropCallout(calloutControl, meetsUsageRequirement)
    calloutControl:SetHidden(false)
    if(meetsUsageRequirement) then
        calloutControl:SetColor(1, 1, 1, 1)
    else
        calloutControl:SetColor(1, 0, 0, 1)
    end
end
function ZO_QuickslotManager:ShowAppropriateQuickSlotDropCallouts(bagId, slotIndex)
    local _, _, _, meetsUsageRequirement = GetItemInfo(bagId, slotIndex)
    for slotNum, quickSlot in pairs(self.quickSlots) do
        local validInSlot = IsValidItemForSlot(bagId, slotIndex, slotNum)
        if validInSlot
        then
            self:ShowSlotDropCallout(quickSlot:GetNamedChild("DropCallout"), meetsUsageRequirement)
        end
    end
end
function ZO_QuickslotManager:ChangeFilter(filterData)
    self.currentFilter = filterData
    self.activeTab:SetText(filterData.activeTabText)
    self:UpdateList()
    
    self.sortHeaders:SelectAndResetSortForKey(filterData.sortKey)
    local isCollectibleFilter = self.currentFilter.descriptor == ITEMFILTERTYPE_COLLECTIBLE
    self.sortHeaders:SetHeaderHiddenForKey("stackSellPrice", isCollectibleFilter)
    self.sortHeaders:SetHeaderHiddenForKey("age", isCollectibleFilter)
end
function ZO_QuickslotManager:ShouldAddItemToList(itemData)
    for i = 1, #itemData.filterData do
        if(itemData.filterData[i] == ITEMFILTERTYPE_QUICKSLOT) then
            return true
        end
    end
    return false
end
local sortKeys =
{
    name = { },
    age = { tiebreaker = "name", isNumeric = true },
    stackSellPrice = { tiebreaker = "name", isNumeric = true },
}
function ZO_QuickslotManager:SortData()
    local scrollData = ZO_ScrollList_GetDataList(self.list)
    self.sortFunction = self.sortFunction or function(entry1, entry2)
        local sortKey = self.currentFilter.sortKey
        local sortOrder = self.currentFilter.sortOrder
        return ZO_TableOrderingFunction(entry1.data, entry2.data, sortKey, sortKeys, sortOrder)
    end
    table.sort(scrollData, self.sortFunction)
end
function ZO_QuickslotManager:ApplySort()
    self:SortData()
end
function ZO_QuickslotManager:RefreshCurrency(value)
    ZO_CurrencyControl_SetSimpleCurrency(self.money, CURT_MONEY, value, ZO_KEYBOARD_CARRIED_CURRENCY_OPTIONS)
end
function ZO_QuickslotManager:UpdateList()
    local scrollData = ZO_ScrollList_GetDataList(self.list)
    local currentFilterType = self.currentFilter.descriptor
    if currentFilterType == ITEMFILTERTYPE_ALL then
        self:AppendItemData(scrollData)
        self:AppendCollectiblesData(scrollData)
    elseif currentFilterType == ITEMFILTERTYPE_QUICKSLOT then
        self:AppendItemData(scrollData)
    elseif currentFilterType == ITEMFILTERTYPE_COLLECTIBLE then
        self:AppendCollectiblesData(scrollData)
    end
    self:ApplySort()
    self.sortHeadersControl:SetHidden(#scrollData == 0)
end
function ZO_QuickslotManager:AppendItemData(scrollData)
    local bagSlots = GetBagSize(BAG_BACKPACK)
    for slotIndex = 0, bagSlots - 1 do
        local slotData = SHARED_INVENTORY:GenerateSingleSlotData(BAG_BACKPACK, slotIndex)
        if slotData and slotData.stackCount > 0 then
            local itemData =
            {
            iconFile = slotData.iconFile,
            stackCount = slotData.stackCount,
            sellPrice = slotData.sellPrice,
            stackSellPrice = slotData.stackCount * slotData.sellPrice,
            bagId = BAG_BACKPACK,
            slotIndex = slotIndex,
            meetsUsageRequirement = slotData.meetsUsageRequirement,
            locked = slotData.locked,
            quality = slotData.quality,
            slotType = SLOT_TYPE_ITEM,
            filterData = { GetItemFilterTypeInfo(BAG_BACKPACK, slotIndex) },
            age = slotData.age,
            stolen = IsItemStolen(BAG_BACKPACK, slotIndex),
            name = slotData.name or zo_strformat(SI_TOOLTIP_ITEM_NAME, GetItemName(BAG_BACKPACK, slotIndex))
        }
            if self:ShouldAddItemToList(itemData) then
                table.insert(scrollData, ZO_ScrollList_CreateDataEntry(DATA_TYPE_QUICKSLOT_ITEM, itemData))
            end
        end
    end
end
function ZO_QuickslotManager:AppendCollectiblesData(scrollData)
    local data = COLLECTIONS_INVENTORY_SINGLETON:GetQuickslotData()
    for i = 1, #data do
        table.insert(scrollData, ZO_ScrollList_CreateDataEntry(DATA_TYPE_COLLECTIBLE_ITEM, data[i]))
    end
end
local function UpdateNewStatusControl(control, data)
    PLAYER_INVENTORY:UpdateNewStatus(INVENTORY_BACKPACK, data.slotIndex)
end
function ZO_QuickslotManager:SetUpQuickSlot(control, data)
    local r, g, b = GetInterfaceColor(INTERFACE_COLOR_TYPE_ITEM_QUALITY_COLORS, data.quality)
    local nameControl = GetControl(control, "Name")
    nameControl:SetText(data.name)
    nameControl:SetColor(r, g, b, 1)
    local sellPriceControl = GetControl(control, "SellPrice")
    sellPriceControl:SetHidden(false)
    ZO_CurrencyControl_SetSimpleCurrency(sellPriceControl, CURT_MONEY, data.stackSellPrice, ITEM_SLOT_CURRENCY_OPTIONS)
    local inventorySlot = GetControl(control, "Button")
    ZO_Inventory_BindSlot(inventorySlot, data.slotType, data.slotIndex, data.bagId)
    ZO_PlayerInventorySlot_SetupSlot(control, data.stackCount, data.iconFile, data.meetsUsageRequirement, data.locked)
    local statusControl = GetControl(control, "StatusTexture")
    statusControl:ClearIcons()
    if (data.stolen) then
        statusControl:AddIcon(STOLEN_ICON_TEXTURE)
        statusControl:Show()        
    end
end
function ZO_QuickslotManager:SetUpCollectionSlot(control, data)
    control:GetNamedChild("ActiveIcon"):SetHidden(not data.active)
    local slot = GetControl(control, "Button")
    slot.collectibleId = data.collectibleId
    slot.active = data.active
    slot.categoryType = data.categoryType
    ZO_InventorySlot_SetType(slot, SLOT_TYPE_COLLECTIONS_INVENTORY)
    ZO_ItemSlot_SetupSlotBase(slot, 1, data.iconFile)
end
function ZO_QuickslotManager:UpdateFreeSlots()
    local numUsedSlots, numSlots = PLAYER_INVENTORY:GetNumSlots(INVENTORY_BACKPACK)
    if(numUsedSlots < numSlots) then
        self.freeSlotsLabel:SetText(zo_strformat(SI_INVENTORY_BACKPACK_REMAINING_SPACES, numUsedSlots, numSlots))
    else
        self.freeSlotsLabel:SetText(zo_strformat(SI_INVENTORY_BACKPACK_COMPLETELY_FULL, numUsedSlots, numSlots))
    end
end
-------------------
-- Global functions
-------------------
    InitializeTooltip(InformationTooltip, self, BOTTOMRIGHT, 0, 32)
    SetTooltipText(InformationTooltip, ZO_MenuBarButtonTemplate_GetData(self).tooltipText)
end
    ClearTooltip(InformationTooltip)
end
    QUICKSLOT_WINDOW = ZO_QuickslotManager:New(control)
end
    if(control.animation)
    then
        control.animation:PlayForward()
    end
    if QUICKSLOT_WINDOW.mouseOverSlot ~= control then
        PlaySound(SOUNDS.QUICKSLOT_MOUSEOVER)
        QUICKSLOT_WINDOW.mouseOverSlot = control
    end
    if IsSlotUsed(control.slotNum) then
        KEYBIND_STRIP:AddKeybindButtonGroup(QUICKSLOT_WINDOW.keybindStripDescriptor)
    else
        KEYBIND_STRIP:RemoveKeybindButtonGroup(QUICKSLOT_WINDOW.keybindStripDescriptor)
    end
end
    if(control.animation)
    then
        control.animation:PlayBackward()
    end
    QUICKSLOT_WINDOW.mouseOverSlot = nil
    KEYBIND_STRIP:RemoveKeybindButtonGroup(QUICKSLOT_WINDOW.keybindStripDescriptor)
end
    local button = control:GetNamedChild("Button")
    button:SetDrawTier(DT_MEDIUM)
    button:SetDrawLayer(DL_BACKGROUND)
    button.slotType = ABILITY_SLOT_TYPE_QUICKSLOT
    local glow = control:GetNamedChild("Glow")
    button.animation = ANIMATION_MANAGER:CreateTimelineFromVirtual("QuickslotGlowAlphaAnimation", glow)
    local icon = control:GetNamedChild("Icon")
    icon:SetDrawTier(DT_MEDIUM)
    icon:SetDrawLayer(DL_BACKGROUND)
end