Finish BiS bucket stuff

This commit is contained in:
Zeffuro
2026-01-09 22:02:52 +01:00
parent ac3b802799
commit 4e6523f8a0
4 changed files with 41 additions and 16 deletions
@@ -246,7 +246,7 @@ public static class CategoryBucketManager
if (!System.IPC.BisBuddy.IsReady) return; if (!System.IPC.BisBuddy.IsReady) return;
var bisItems = System.IPC.BisBuddy.ItemLookup; var bisItems = System.IPC.BisBuddy.ItemLookup;
if (bisItems. Count == 0) return; if (bisItems.Count == 0) return;
uint bucketKey = MakeBisBuddyKey(); uint bucketKey = MakeBisBuddyKey();
@@ -265,7 +265,7 @@ public static class CategoryBucketManager
FilteredItems = new List<ItemInfo>(capacity: 16), FilteredItems = new List<ItemInfo>(capacity: 16),
Used = true, Used = true,
}; };
bucketsByKey. Add(bucketKey, bucket); bucketsByKey.Add(bucketKey, bucket);
} }
else else
{ {
@@ -282,7 +282,7 @@ public static class CategoryBucketManager
if (bisItems.ContainsKey(item.Item.ItemId)) if (bisItems.ContainsKey(item.Item.ItemId))
{ {
bucket.Items. Add(item); bucket.Items.Add(item);
claimedKeys.Add(itemKey); claimedKeys.Add(itemKey);
} }
} }
@@ -352,20 +352,27 @@ public static class CategoryBucketManager
if (!bucket.Used) if (!bucket.Used)
continue; continue;
// TODO: Make configurable
bucket.Items.Sort(ItemCountDescComparer.Instance); bucket.Items.Sort(ItemCountDescComparer.Instance);
sortedCategoryKeys.Add(bucket.Key); sortedCategoryKeys.Add(bucket.Key);
} }
// TODO: Make sortable by user
sortedCategoryKeys.Sort((left, right) => sortedCategoryKeys.Sort((left, right) =>
{ {
bool leftUser = IsUserCategoryKey(left); int GetPriority(uint key)
bool rightUser = IsUserCategoryKey(right); {
bool leftAllagan = IsAllaganFilterKey(left); if (IsUserCategoryKey(key)) return 1;
bool rightAllagan = IsAllaganFilterKey(right); if (IsBisBuddyKey(key)) return 2;
if (leftUser != rightUser) return leftUser ? -1 : 1; if (IsAllaganFilterKey(key)) return 3;
if (leftAllagan != rightAllagan) return leftAllagan ? -1 : 1; if (key == 0) return 99;
return 10;
}
return left.CompareTo(right); int leftPrio = GetPriority(left);
int rightPrio = GetPriority(right);
return leftPrio != rightPrio ? leftPrio.CompareTo(rightPrio) : left.CompareTo(right);
}); });
} }
@@ -97,8 +97,8 @@ public abstract class InventoryStateBase
{ {
if (config.Categories.BisBuddyMode == PluginFilterMode.Categorize) if (config.Categories.BisBuddyMode == PluginFilterMode.Categorize)
{ {
CategoryBucketManager.BucketByAllaganFilters(ItemInfoByKey, BucketsByKey, ClaimedKeys, true); CategoryBucketManager.BucketByBisBuddyItems(ItemInfoByKey, BucketsByKey, ClaimedKeys, true);
HighlightState.ClearFilter(HighlightSource.AllaganTools); HighlightState.ClearFilter(HighlightSource.BiSBuddy);
} }
else else
{ {
@@ -141,6 +141,25 @@ public abstract class InventoryStateBase
} }
} }
private void UpdateBisBuddyHighlight(string? filterKey)
{
if (string.IsNullOrEmpty(filterKey) || !System.IPC.BisBuddy.IsReady)
{
HighlightState.ClearFilter(HighlightSource.BiSBuddy);
return;
}
var filterItems = System.IPC.AllaganTools.GetFilterItems(filterKey);
if (filterItems != null)
{
HighlightState.SetFilter(HighlightSource.BiSBuddy, filterItems.Keys);
}
else
{
HighlightState.ClearFilter(HighlightSource.BiSBuddy);
}
}
public IReadOnlyList<CategorizedInventory> GetCategories(string filter = "", bool invert = false) public IReadOnlyList<CategorizedInventory> GetCategories(string filter = "", bool invert = false)
=> InventoryFilter.FilterCategories(AllCategories, BucketsByKey, FilteredCategories, filter, invert); => InventoryFilter.FilterCategories(AllCategories, BucketsByKey, FilteredCategories, filter, invert);
@@ -117,7 +117,7 @@ public sealed class CategoryGeneralConfigurationNode : TabbedVerticalListNode
} }
}; };
AddNode(bisBuddyEnabled); AddNode(bisBuddyEnabled);
AddNode(bbModeDropdown); AddNode(1, bbModeDropdown);
bool allaganReady = System.IPC.AllaganTools?.IsReady ?? false; bool allaganReady = System.IPC.AllaganTools?.IsReady ?? false;
@@ -162,8 +162,7 @@ public sealed class CategoryGeneralConfigurationNode : TabbedVerticalListNode
}; };
AddNode(_allaganToolsCheckbox); AddNode(_allaganToolsCheckbox);
AddTab(1); AddNode(1, atModeDropdown);
AddNode(atModeDropdown);
SubtractTab(1); SubtractTab(1);
} }