Fix user categories

This commit is contained in:
Zeffuro
2026-01-11 17:43:10 +01:00
parent 29fbd4de61
commit d46d780778
@@ -19,6 +19,7 @@ public abstract class InventoryStateBase
protected readonly List<CategorizedInventory> AllCategories = new(capacity: 256); protected readonly List<CategorizedInventory> AllCategories = new(capacity: 256);
protected readonly List<CategorizedInventory> FilteredCategories = new(capacity: 256); protected readonly List<CategorizedInventory> FilteredCategories = new(capacity: 256);
protected readonly List<UserCategoryDefinition> UserCategoriesSortedScratch = new(capacity: 64); protected readonly List<UserCategoryDefinition> UserCategoriesSortedScratch = new(capacity: 64);
protected readonly List<UserCategoryDefinition> EnabledUserCategoriesScratch = new(capacity: 64);
protected readonly List<ulong> RemoveKeysScratch = new(capacity: 256); protected readonly List<ulong> RemoveKeysScratch = new(capacity: 256);
protected readonly HashSet<ulong> ClaimedKeys = new(capacity: 512); protected readonly HashSet<ulong> ClaimedKeys = new(capacity: 512);
@@ -69,18 +70,22 @@ public abstract class InventoryStateBase
bool allaganCategoriesEnabled = config.Categories.AllaganToolsCategoriesEnabled && categoriesEnabled; bool allaganCategoriesEnabled = config.Categories.AllaganToolsCategoriesEnabled && categoriesEnabled;
bool bisCategoriesEnabled = config.Categories.BisBuddyEnabled && categoriesEnabled; bool bisCategoriesEnabled = config.Categories.BisBuddyEnabled && categoriesEnabled;
// TODO: Cache this when config changes // TODO: Cache this when config changes
UserCategoriesSortedScratch.Clear(); EnabledUserCategoriesScratch.Clear();
foreach (var cat in config.Categories.UserCategories) foreach (var cat in config.Categories.UserCategories)
{ {
if (cat.Enabled) if (cat.Enabled)
UserCategoriesSortedScratch.Add(cat); EnabledUserCategoriesScratch.Add(cat);
} }
var userCategories = UserCategoriesSortedScratch;
if (userCategoriesEnabled && userCategories.Count > 0) if (userCategoriesEnabled && EnabledUserCategoriesScratch.Count > 0)
{ {
CategoryBucketManager.BucketByUserCategories( CategoryBucketManager.BucketByUserCategories(
ItemInfoByKey, userCategories, BucketsByKey, ClaimedKeys, UserCategoriesSortedScratch); ItemInfoByKey,
EnabledUserCategoriesScratch,
BucketsByKey,
ClaimedKeys,
UserCategoriesSortedScratch
);
} }
if (allaganCategoriesEnabled) if (allaganCategoriesEnabled)