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
@@ -352,20 +352,27 @@ public static class CategoryBucketManager
if (!bucket.Used)
continue;
// TODO: Make configurable
bucket.Items.Sort(ItemCountDescComparer.Instance);
sortedCategoryKeys.Add(bucket.Key);
}
// TODO: Make sortable by user
sortedCategoryKeys.Sort((left, right) =>
{
bool leftUser = IsUserCategoryKey(left);
bool rightUser = IsUserCategoryKey(right);
bool leftAllagan = IsAllaganFilterKey(left);
bool rightAllagan = IsAllaganFilterKey(right);
if (leftUser != rightUser) return leftUser ? -1 : 1;
if (leftAllagan != rightAllagan) return leftAllagan ? -1 : 1;
int GetPriority(uint key)
{
if (IsUserCategoryKey(key)) return 1;
if (IsBisBuddyKey(key)) return 2;
if (IsAllaganFilterKey(key)) return 3;
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)
{
CategoryBucketManager.BucketByAllaganFilters(ItemInfoByKey, BucketsByKey, ClaimedKeys, true);
HighlightState.ClearFilter(HighlightSource.AllaganTools);
CategoryBucketManager.BucketByBisBuddyItems(ItemInfoByKey, BucketsByKey, ClaimedKeys, true);
HighlightState.ClearFilter(HighlightSource.BiSBuddy);
}
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)
=> InventoryFilter.FilterCategories(AllCategories, BucketsByKey, FilteredCategories, filter, invert);
@@ -117,7 +117,7 @@ public sealed class CategoryGeneralConfigurationNode : TabbedVerticalListNode
}
};
AddNode(bisBuddyEnabled);
AddNode(bbModeDropdown);
AddNode(1, bbModeDropdown);
bool allaganReady = System.IPC.AllaganTools?.IsReady ?? false;
@@ -162,8 +162,7 @@ public sealed class CategoryGeneralConfigurationNode : TabbedVerticalListNode
};
AddNode(_allaganToolsCheckbox);
AddTab(1);
AddNode(atModeDropdown);
AddNode(1, atModeDropdown);
SubtractTab(1);
}