-
Notifications
You must be signed in to change notification settings - Fork 13
/
AutoCategory_Hooks.lua
492 lines (448 loc) · 20.6 KB
/
AutoCategory_Hooks.lua
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
local LMP = LibStub:GetLibrary("LibMediaProvider-1.0")
local CUSTOM_GAMEPAD_ITEM_SORT =
{
sortPriorityName = { tiebreaker = "bestItemTypeName" },
bestItemTypeName = { tiebreaker = "name" },
name = { tiebreaker = "requiredLevel" },
requiredLevel = { tiebreaker = "requiredChampionPoints", isNumeric = true },
requiredChampionPoints = { tiebreaker = "iconFile", isNumeric = true },
iconFile = { tiebreaker = "uniqueId" },
uniqueId = { isId64 = true },
}
local sortKeys =
{
slotIndex = { isNumeric = true },
stackCount = { tiebreaker = "slotIndex", isNumeric = true },
name = { tiebreaker = "stackCount" },
quality = { tiebreaker = "name", isNumeric = true },
stackSellPrice = { tiebreaker = "name", tieBreakerSortOrder = ZO_SORT_ORDER_UP, isNumeric = true },
statusSortOrder = { tiebreaker = "age", isNumeric = true},
age = { tiebreaker = "name", tieBreakerSortOrder = ZO_SORT_ORDER_UP, isNumeric = true},
statValue = { tiebreaker = "name", isNumeric = true, tieBreakerSortOrder = ZO_SORT_ORDER_UP },
traitInformationSortOrder = { tiebreaker = "name", isNumeric = true, tieBreakerSortOrder = ZO_SORT_ORDER_UP },
}
local function AutoCategory_ItemSortComparator(left, right)
return ZO_TableOrderingFunction(left, right, "sortPriorityName", CUSTOM_GAMEPAD_ITEM_SORT, ZO_SORT_ORDER_UP)
end
local function NilOrLessThan(value1, value2)
if value1 == nil then
return true
elseif value2 == nil then
return false
else
return value1 < value2
end
end
local backupListData
AutoCategory.dataCount = {}
function AutoCategory.HookKeyboardMode()
local function AC_Setup_InventoryRowWithHeader(rowControl, slot, overrideOptions)
--set header
local headerLabel = rowControl:GetNamedChild("HeaderName")
if AutoCategory.acctSavedVariables.general["SHOW_CATEGORY_ITEM_COUNT"] then
headerLabel:SetText(string.format('%s |cFFE690[%d]|r', slot.bestItemTypeName, slot.dataEntry.num))
else
headerLabel:SetText(slot.bestItemTypeName)
end
local appearance = AutoCategory.acctSavedVariables.appearance
headerLabel:SetHorizontalAlignment(appearance["CATEGORY_FONT_ALIGNMENT"])
headerLabel:SetFont(string.format('%s|%d|%s', LMP:Fetch('font', appearance["CATEGORY_FONT_NAME"]), appearance["CATEGORY_FONT_SIZE"], appearance["CATEGORY_FONT_STYLE"]))
headerLabel:SetColor(appearance["CATEGORY_FONT_COLOR"][1], appearance["CATEGORY_FONT_COLOR"][2], appearance["CATEGORY_FONT_COLOR"][3], appearance["CATEGORY_FONT_COLOR"][4])
local marker = rowControl:GetNamedChild("CollapseMarker")
local cateName = slot.dataEntry.bestItemTypeName
local bagTypeId = slot.dataEntry.bagTypeId
local collapsed = AutoCategory.IsCategoryCollapsed(bagTypeId, cateName)
if collapsed then
marker:SetTexture("EsoUI/Art/Buttons/plus_up.dds")
else
marker:SetTexture("EsoUI/Art/Buttons/minus_up.dds")
end
rowControl:SetHeight(AutoCategory.acctSavedVariables.appearance["CATEGORY_HEADER_HEIGHT"])
rowControl.slot = slot
end
--Add a new data type: row with header
local rowHeight = AutoCategory.acctSavedVariables.appearance["CATEGORY_HEADER_HEIGHT"]
ZO_ScrollList_AddDataType(ZO_PlayerInventoryList, 998, "AC_InventoryItemRowHeader", rowHeight, AC_Setup_InventoryRowWithHeader, PLAYER_INVENTORY.inventories[INVENTORY_BACKPACK].listHiddenCallback, nil, ZO_InventorySlot_OnPoolReset)
ZO_ScrollList_AddDataType(ZO_CraftBagList, 998, "AC_InventoryItemRowHeader", rowHeight, AC_Setup_InventoryRowWithHeader, PLAYER_INVENTORY.inventories[INVENTORY_BACKPACK].listHiddenCallback, nil, ZO_InventorySlot_OnPoolReset)
ZO_ScrollList_AddDataType(ZO_PlayerBankBackpack, 998, "AC_InventoryItemRowHeader", rowHeight, AC_Setup_InventoryRowWithHeader, PLAYER_INVENTORY.inventories[INVENTORY_BACKPACK].listHiddenCallback, nil, ZO_InventorySlot_OnPoolReset)
ZO_ScrollList_AddDataType(ZO_GuildBankBackpack, 998, "AC_InventoryItemRowHeader", rowHeight, AC_Setup_InventoryRowWithHeader, PLAYER_INVENTORY.inventories[INVENTORY_BACKPACK].listHiddenCallback, nil, ZO_InventorySlot_OnPoolReset)
ZO_ScrollList_AddDataType(ZO_QuestItemsList, 998, "AC_InventoryItemRowHeader", rowHeight, AC_Setup_InventoryRowWithHeader, PLAYER_INVENTORY.inventories[INVENTORY_QUEST_ITEM].listHiddenCallback, nil, ZO_InventorySlot_OnPoolReset)
ZO_ScrollList_AddDataType(SMITHING.deconstructionPanel.inventory.list, 998, "AC_InventoryItemRowHeader", rowHeight, AC_Setup_InventoryRowWithHeader, nil, nil, ZO_InventorySlot_OnPoolReset)
ZO_ScrollList_AddDataType(SMITHING.improvementPanel.inventory.list, 998, "AC_InventoryItemRowHeader", rowHeight, AC_Setup_InventoryRowWithHeader, nil, nil, ZO_InventorySlot_OnPoolReset)
local function resetCount(bagTypeId, name)
if AutoCategory.dataCount[bagTypeId] == nil then
AutoCategory.dataCount[bagTypeId] = {}
end
AutoCategory.dataCount[bagTypeId][name] = 0
end
local function addCount(bagTypeId, name)
if AutoCategory.dataCount[bagTypeId] == nil then
AutoCategory.dataCount[bagTypeId] = {}
end
if AutoCategory.dataCount[bagTypeId][name] == nil then
AutoCategory.dataCount[bagTypeId][name] = 0
end
AutoCategory.dataCount[bagTypeId][name] = AutoCategory.dataCount[bagTypeId][name] + 1
end
local function getCount(bagTypeId, name)
if AutoCategory.dataCount[bagTypeId] == nil then
AutoCategory.dataCount[bagTypeId] = {}
end
if AutoCategory.dataCount[bagTypeId][name] == nil then
AutoCategory.dataCount[bagTypeId][name] = 0
end
return AutoCategory.dataCount[bagTypeId][name]
end
local function prehookSort(self, inventoryType)
local inventory
if inventoryType == INVENTORY_BANK then
inventory = self.inventories[INVENTORY_BANK]
elseif inventoryType == INVENTORY_GUILD_BANK then
inventory = self.inventories[INVENTORY_GUILD_BANK]
elseif inventoryType == INVENTORY_CRAFT_BAG then
inventory = self.inventories[INVENTORY_CRAFT_BAG]
else
-- Use normal inventory by default (instead of the quest item inventory for example)
inventory = self.inventories[self.selectedTabType]
end
--change sort function
inventory.sortFn = function(left, right)
if AutoCategory.Enabled then
if right.sortPriorityName ~= left.sortPriorityName then
return NilOrLessThan(left.sortPriorityName, right.sortPriorityName)
end
if right.isHeader ~= left.isHeader then
return NilOrLessThan(right.isHeader, left.isHeader)
end
--compatible with quality sort
if type(inventory.currentSortKey) == "function" then
if inventory.currentSortOrder == ZO_SORT_ORDER_UP then
return inventory.currentSortKey(left.data, right.data)
else
return inventory.currentSortKey(right.data, left.data)
end
end
end
return ZO_TableOrderingFunction(left.data, right.data, inventory.currentSortKey, sortKeys, inventory.currentSortOrder)
end
local list = inventory.listView
local scrollData = ZO_ScrollList_GetDataList(list)
for i, entry in ipairs(scrollData) do
--only match items(not headers)
if entry.typeId ~= 998 then
local slotData = entry.data
local matched, categoryName, categoryPriority, bagTypeId, isHidden = AutoCategory:MatchCategoryRules(slotData.bagId, slotData.slotIndex)
if not matched or not AutoCategory.Enabled then
entry.bestItemTypeName = AutoCategory.acctSavedVariables.appearance["CATEGORY_OTHER_TEXT"]
entry.sortPriorityName = string.format("%03d%s", 999 , categoryName)
entry.bagTypeId = bagTypeId
if not AutoCategory.Enabled or bagTypeId == nil then
entry.isHidden = false
else
entry.isHidden = AutoCategory.curSavedVars.bags[bagTypeId].isUngroupedHidden
end
else
entry.bestItemTypeName = categoryName
entry.sortPriorityName = string.format("%03d%s", 100 - categoryPriority , categoryName)
entry.bagTypeId = bagTypeId
entry.isHidden = isHidden
end
end
end
--sort data to add header
table.sort(scrollData, inventory.sortFn)
-- add header data
local lastBestItemCategoryName
local newScrollData = {}
local hiddenItem = false
local countItems = false
for i, entry in ipairs(scrollData) do
if AutoCategory.Enabled and entry.bagTypeId ~= nil then
if entry.bestItemTypeName ~= lastBestItemCategoryName then
--new header
hiddenItem = false
lastBestItemCategoryName = entry.bestItemTypeName
local headerEntry = ZO_ScrollList_CreateDataEntry(998, {bestItemTypeName = entry.bestItemTypeName, stackLaunderPrice = 0})
headerEntry.sortPriorityName = entry.sortPriorityName
headerEntry.isHeader = true
headerEntry.bestItemTypeName = entry.bestItemTypeName
headerEntry.bagTypeId = entry.bagTypeId
local num = getCount(entry.bagTypeId, entry.bestItemTypeName)
headerEntry.num = num
if entry.isHeader then
countItems = false
else
countItems = true
resetCount(entry.bagTypeId, entry.bestItemTypeName)
end
if entry.isHidden then
--don't add header
hiddenItem = true
else
table.insert(newScrollData, headerEntry)
--check collapse
if AutoCategory.IsCategoryCollapsed(entry.bagTypeId, entry.bestItemTypeName) then
hiddenItem = true
end
end
end
end
if entry.typeId ~= 998 then
if not hiddenItem then
table.insert(newScrollData, entry)
end
if countItems then
addCount(entry.bagTypeId, entry.bestItemTypeName)
end
end
end
list.data = newScrollData
end
ZO_PreHook(ZO_InventoryManager, "ApplySort", prehookSort)
ZO_PreHook(PLAYER_INVENTORY, "ApplySort", prehookSort)
local function prehookCraftSort(self)
--change sort function
self.sortFunction = function(left, right)
if AutoCategory.Enabled then
if right.sortPriorityName ~= left.sortPriorityName then
return NilOrLessThan(left.sortPriorityName, right.sortPriorityName)
end
if right.isHeader ~= left.isHeader then
return NilOrLessThan(right.isHeader, left.isHeader)
end
--compatible with quality sort
if type(self.sortKey) == "function" then
if self.sortOrder == ZO_SORT_ORDER_UP then
return self.sortKey(left.data, right.data)
else
return self.sortKey(right.data, left.data)
end
end
end
return ZO_TableOrderingFunction(left.data, right.data, self.sortKey, sortKeys, self.sortOrder)
end
--add header data
local scrollData = ZO_ScrollList_GetDataList(self.list)
for i, entry in ipairs(scrollData) do
--only match items(not headers)
if entry.typeId ~= 998 then
local slotData = entry.data
local matched, categoryName, categoryPriority, bagTypeId, isHidden = AutoCategory:MatchCategoryRules(slotData.bagId, slotData.slotIndex, AC_BAG_TYPE_CRAFTSTATION)
if not matched or not AutoCategory.Enabled then
entry.bestItemTypeName = AutoCategory.acctSavedVariables.appearance["CATEGORY_OTHER_TEXT"]
entry.sortPriorityName = string.format("%03d%s", 999 , categoryName)
entry.bagTypeId = bagTypeId
if not AutoCategory.Enabled then
entry.isHidden = false
else
entry.isHidden = AutoCategory.curSavedVars.bags[bagTypeId].isUngroupedHidden
end
else
entry.bestItemTypeName = categoryName
entry.sortPriorityName = string.format("%03d%s", 100 - categoryPriority , categoryName)
entry.bagTypeId = bagTypeId
entry.isHidden = isHidden
end
end
end
--sort data to add header
table.sort(scrollData, self.sortFunction)
-- add header data
local lastBestItemCategoryName
local newScrollData = {}
local hiddenItem = false
local countItems = true
local lastHeaderEntry
for i, entry in ipairs(scrollData) do
if AutoCategory.Enabled then
if entry.bestItemTypeName ~= lastBestItemCategoryName then
--new header
hiddenItem = false
lastBestItemCategoryName = entry.bestItemTypeName
local headerEntry = ZO_ScrollList_CreateDataEntry(998, {bestItemTypeName = entry.bestItemTypeName, stackLaunderPrice = 0})
headerEntry.sortPriorityName = entry.sortPriorityName
headerEntry.isHeader = true
headerEntry.bestItemTypeName = entry.bestItemTypeName
headerEntry.bagTypeId = entry.bagTypeId
--local num = getCount(entry.bagTypeId, entry.bestItemTypeName)
if lastHeaderEntry then
lastHeaderEntry.num = getCount(lastHeaderEntry.bagTypeId, lastHeaderEntry.bestItemTypeName)
end
lastHeaderEntry = headerEntry
--headerEntry.num = num
if entry.isHeader then
countItems = false
else
countItems = true
resetCount(entry.bagTypeId, entry.bestItemTypeName)
end
if entry.isHidden then
--don't add header
hiddenItem = true
else
table.insert(newScrollData, headerEntry)
--check collapse
if AutoCategory.IsCategoryCollapsed(entry.bagTypeId, entry.bestItemTypeName) then
hiddenItem = true
end
end
end
end
if entry.typeId ~= 998 then
if not hiddenItem then
table.insert(newScrollData, entry)
end
if countItems then
addCount(entry.bagTypeId, entry.bestItemTypeName)
end
end
end
if lastHeaderEntry then
lastHeaderEntry.num = getCount(lastHeaderEntry.bagTypeId, lastHeaderEntry.bestItemTypeName)
end
self.list.data = newScrollData
end
ZO_PreHook(SMITHING.deconstructionPanel.inventory, "SortData", prehookCraftSort)
ZO_PreHook(SMITHING.improvementPanel.inventory, "SortData", prehookCraftSort)
end
function AutoCategory.HookGamepadInventory()
function ZO_GamepadInventoryList_AddSlotDataToTable(self, slotsTable, inventoryType, slotIndex)
local itemFilterFunction = self.itemFilterFunction
local categorizationFunction = self.categorizationFunction or ZO_InventoryUtils_Gamepad_GetBestItemCategoryDescription
local slotData = SHARED_INVENTORY:GenerateSingleSlotData(inventoryType, slotIndex)
if slotData then
--[[
if (not itemFilterFunction) or itemFilterFunction(slotData) then
-- itemData is shared in several places and can write their own value of bestItemCategoryName.
-- We'll use bestGamepadItemCategoryName instead so there are no conflicts.
slotData.bestGamepadItemCategoryName = categorizationFunction(slotData)
table.insert(slotsTable, slotData)
end
]]
local itemData = slotData
local matched, categoryName, categoryPriority = AutoCategory:MatchCategoryRules(itemData.bagId, itemData.slotIndex)
if not matched then
itemData.bestItemTypeName = AutoCategory.acctSavedVariables.appearance["CATEGORY_OTHER_TEXT"]
itemData.bestGamepadItemCategoryName = AutoCategory.acctSavedVariables.appearance["CATEGORY_OTHER_TEXT"]
itemData.sortPriorityName = string.format("%03d%s", 999 , categoryName)
else
itemData.bestItemTypeName = categoryName
itemData.bestGamepadItemCategoryName = categoryName
itemData.sortPriorityName = string.format("%03d%s", 100 - categoryPriority , categoryName)
end
table.insert(slotsTable, slotData)
end
end
ZO_GamepadInventoryList.AddSlotDataToTable = ZO_GamepadInventoryList_AddSlotDataToTable
ZO_GamepadInventoryList.sortFunction = AutoCategory_ItemSortComparator
end
function AutoCategory.HookGamepadCraftStation()
--API 100021
local function ZO_GamepadCraftingInventory_AddFilteredDataToList(self, filteredDataTable)
table.sort(filteredDataTable, AutoCategory_ItemSortComparator)
local lastBestItemCategoryName
for i, itemData in ipairs(filteredDataTable) do
if itemData.bestItemCategoryName ~= lastBestItemCategoryName then
lastBestItemCategoryName = itemData.bestItemCategoryName
itemData:SetHeader(zo_strformat(SI_GAMEPAD_CRAFTING_INVENTORY_HEADER, lastBestItemCategoryName))
end
local template = self:GetListEntryTemplate(itemData)
self.list:AddEntry(template, itemData)
end
end
ZO_GamepadCraftingInventory.AddFilteredDataToList = ZO_GamepadCraftingInventory_AddFilteredDataToList
function ZO_GamepadCraftingInventory_GenerateCraftingInventoryEntryData(self, bagId, slotIndex, stackCount, slotData)
local itemName = GetItemName(bagId, slotIndex)
local icon = GetItemInfo(bagId, slotIndex)
local name = zo_strformat(SI_TOOLTIP_ITEM_NAME, itemName)
local customSortData = self.customDataSortFunction and self.customDataSortFunction(bagId, slotIndex) or 0
local newData = ZO_GamepadEntryData:New(name)
newData:InitializeCraftingInventoryVisualData(bagId, slotIndex, stackCount, customSortData, self.customBestItemCategoryNameFunction, slotData)
--Auto Category Modify
if slotData then
local matched, categoryName, categoryPriority = AutoCategory:MatchCategoryRules(slotData.bagId, slotData.slotIndex, AC_BAG_TYPE_CRAFTSTATION)
if not matched then
newData.bestItemTypeName = AutoCategory.acctSavedVariables.appearance["CATEGORY_OTHER_TEXT"]
newData.bestItemCategoryName = AutoCategory.acctSavedVariables.appearance["CATEGORY_OTHER_TEXT"]
newData.sortPriorityName = string.format("%03d%s", 999 , categoryName)
else
newData.bestItemTypeName = categoryName
newData.bestItemCategoryName = categoryName
newData.sortPriorityName = string.format("%03d%s", 100 - categoryPriority , categoryName)
end
end
--end
ZO_InventorySlot_SetType(newData, self.baseSlotType)
if self.customExtraDataFunction then
self.customExtraDataFunction(bagId, slotIndex, newData)
end
return newData
end
ZO_GamepadCraftingInventory.GenerateCraftingInventoryEntryData = ZO_GamepadCraftingInventory_GenerateCraftingInventoryEntryData
--API 100021
end
function AutoCategory.HookGamepadTradeInventory()
local originalFunction = ZO_GamepadTradeWindow.InitializeInventoryList
local function ZO_GamepadInventoryList_AddSlotDataToTable(self, slotsTable, inventoryType, slotIndex)
local itemFilterFunction = self.itemFilterFunction
local categorizationFunction = self.categorizationFunction or ZO_InventoryUtils_Gamepad_GetBestItemCategoryDescription
local slotData = SHARED_INVENTORY:GenerateSingleSlotData(inventoryType, slotIndex)
if slotData then
if (not itemFilterFunction) or itemFilterFunction(slotData) then
-- itemData is shared in several places and can write their own value of bestItemCategoryName.
-- We'll use bestGamepadItemCategoryName instead so there are no conflicts.
--slotData.bestGamepadItemCategoryName = categorizationFunction(slotData)
local matched, categoryName, categoryPriority = AutoCategory:MatchCategoryRules(slotData.bagId, slotData.slotIndex)
if not matched then
slotData.bestItemTypeName = AutoCategory.acctSavedVariables.appearance["CATEGORY_OTHER_TEXT"]
slotData.bestGamepadItemCategoryName = AutoCategory.acctSavedVariables.appearance["CATEGORY_OTHER_TEXT"]
slotData.sortPriorityName = string.format("%03d%s", 999 , categoryName)
else
slotData.bestItemTypeName = categoryName
slotData.bestGamepadItemCategoryName = categoryName
slotData.sortPriorityName = string.format("%03d%s", 100 - categoryPriority , categoryName)
end
table.insert(slotsTable, slotData)
end
end
end
ZO_GamepadTradeWindow.InitializeInventoryList = function(self)
originalFunction(self)
self.inventoryList.AddSlotDataToTable = ZO_GamepadInventoryList_AddSlotDataToTable
self.inventoryList.sortFunction = AutoCategory_ItemSortComparator
end
end
function AutoCategory.HookGamepadStore(list)
--change item
local originalUpdateFunc = list.updateFunc
list.updateFunc = function( ... )
local filteredDataTable = originalUpdateFunc(...)
--add new fields to item data
local tempDataTable = {}
for i = 1, #filteredDataTable do
local itemData = filteredDataTable[i]
--use custom categories
local matched, categoryName, categoryPriority = AutoCategory:MatchCategoryRules(itemData.bagId, itemData.slotIndex)
if not matched then
itemData.bestItemTypeName = AutoCategory.acctSavedVariables.appearance["CATEGORY_OTHER_TEXT"]
itemData.bestGamepadItemCategoryName = AutoCategory.acctSavedVariables.appearance["CATEGORY_OTHER_TEXT"]
itemData.sortPriorityName = string.format("%03d%s", 999 , categoryName)
else
itemData.bestItemTypeName = categoryName
itemData.bestGamepadItemCategoryName = categoryName
itemData.sortPriorityName = string.format("%03d%s", 100 - categoryPriority , categoryName)
end
table.insert(tempDataTable, itemData)
end
filteredDataTable = tempDataTable
return filteredDataTable
end
list.sortFunc = AutoCategory_ItemSortComparator
end
function AutoCategory.HookGamepadMode()
AutoCategory.HookGamepadInventory()
AutoCategory.HookGamepadCraftStation()
AutoCategory.HookGamepadStore(STORE_WINDOW_GAMEPAD.components[ZO_MODE_STORE_SELL].list)
AutoCategory.HookGamepadStore(STORE_WINDOW_GAMEPAD.components[ZO_MODE_STORE_BUY_BACK].list)
AutoCategory.HookGamepadTradeInventory()
end