Category Amount and more State Filters

This commit is contained in:
Zeffuro
2025-12-29 09:54:35 +01:00
parent c3b61e8045
commit 2d254701d7
8 changed files with 61 additions and 3 deletions
+13 -2
View File
@@ -73,6 +73,16 @@ public class CommandHandler : IDisposable
HandleExport(); HandleExport();
break; break;
case "import":
ImportExportResetHelper.TryImportConfigFromClipboard(System.Config);
System.AddonInventoryWindow.ManualInventoryRefresh();
break;
case "reset":
ImportExportResetHelper.TryResetConfig();
System.AddonInventoryWindow.ManualInventoryRefresh();
break;
case "help": case "help":
case "?": case "?":
PrintHelp(); PrintHelp();
@@ -101,8 +111,7 @@ public class CommandHandler : IDisposable
private void HandleExport() private void HandleExport()
{ {
// TODO: Implement export functionality ImportExportResetHelper.TryExportConfigToClipboard(System.Config);
PrintChat("Export functionality coming soon!");
} }
private void PrintHelp() private void PrintHelp()
@@ -114,8 +123,10 @@ public class CommandHandler : IDisposable
/ab hide - Close inventory window /ab hide - Close inventory window
/ab refresh - Force refresh inventory /ab refresh - Force refresh inventory
/ab search <term> - Open and search for items /ab search <term> - Open and search for items
/ab import - Import config from clipboard (hold Shift)
/ab import-sk - Import from SortaKinda clipboard /ab import-sk - Import from SortaKinda clipboard
/ab export - Export config to clipboard /ab export - Export config to clipboard
/ab reset - Reset config to default
/ab help - Show this help message"; /ab help - Show this help message";
PrintChat(helpText); PrintChat(helpText);
@@ -43,6 +43,10 @@ public class CategoryRuleSet
public StateFilter Collectable { get; set; } = new(); public StateFilter Collectable { get; set; } = new();
public StateFilter Dyeable { get; set; } = new(); public StateFilter Dyeable { get; set; } = new();
public StateFilter Repairable { get; set; } = new(); public StateFilter Repairable { get; set; } = new();
public StateFilter HighQuality { get; set; } = new();
public StateFilter Desynthesizable { get; set; } = new();
public StateFilter Glamourable { get; set; } = new();
public StateFilter FullySpiritbonded { get; set; } = new();
} }
public class RangeFilter<T> where T : struct, IComparable<T> public class RangeFilter<T> where T : struct, IComparable<T>
@@ -13,6 +13,7 @@ public class GeneralSettings
public bool CompactStableInsert { get; set; } = true; public bool CompactStableInsert { get; set; } = true;
public bool OpenWithGameInventory { get; set; } = true; public bool OpenWithGameInventory { get; set; } = true;
public bool HideGameInventory { get; set; } = false; public bool HideGameInventory { get; set; } = false;
public bool ShowCategoryItemCount { get; set; } = false;
} }
public enum InventoryStackMode : byte public enum InventoryStackMode : byte
+6
View File
@@ -57,6 +57,12 @@ public sealed class ItemInfo : IEquatable<ItemInfo>
public bool IsDyeable => Row.DyeCount > 0; public bool IsDyeable => Row.DyeCount > 0;
public bool IsRepairable => Row.ItemRepair.RowId != 0; public bool IsRepairable => Row.ItemRepair.RowId != 0;
public bool IsHq => Item.Flags.HasFlag(InventoryItem.ItemFlags.HighQuality);
public bool IsDesynthesizable => Row.Desynth > 0;
public bool IsCraftable => Row.ItemAction.RowId != 0 || Row.CanBeHq; // Simplified check
public bool IsGlamourable => Row.IsGlamorous;
public bool IsSpiritbonded => Item.SpiritbondOrCollectability >= 10000; // 100% = 10000
private string Description => _description ??= Row.Description.ToString(); private string Description => _description ??= Row.Description.ToString();
public InventoryMappedLocation VisualLocation => public InventoryMappedLocation VisualLocation =>
@@ -73,6 +73,10 @@ internal static class UserCategoryMatcher
if (!MatchesToggle(rules.Collectable, item.IsCollectable)) return false; if (!MatchesToggle(rules.Collectable, item.IsCollectable)) return false;
if (!MatchesToggle(rules.Dyeable, item.IsDyeable)) return false; if (!MatchesToggle(rules.Dyeable, item.IsDyeable)) return false;
if (!MatchesToggle(rules.Repairable, item.IsRepairable)) return false; if (!MatchesToggle(rules.Repairable, item.IsRepairable)) return false;
if (!MatchesToggle(rules.HighQuality, item.IsHq)) return false;
if (!MatchesToggle(rules.Desynthesizable, item.IsDesynthesizable)) return false;
if (!MatchesToggle(rules.Glamourable, item.IsGlamourable)) return false;
if (!MatchesToggle(rules.FullySpiritbonded, item.IsSpiritbonded)) return false;
return true; return true;
} }
@@ -40,6 +40,10 @@ public sealed class CategoryDefinitionConfigurationNode : VerticalListNode
private readonly StateFilterRowNode _collectableFilter; private readonly StateFilterRowNode _collectableFilter;
private readonly StateFilterRowNode _dyeableFilter; private readonly StateFilterRowNode _dyeableFilter;
private readonly StateFilterRowNode _repairableFilter; private readonly StateFilterRowNode _repairableFilter;
private readonly StateFilterRowNode _hqFilter;
private readonly StateFilterRowNode _desynthFilter;
private readonly StateFilterRowNode _glamourFilter;
private readonly StateFilterRowNode _spiritbondFilter;
private readonly UintListEditorNode _allowedItemIdsEditor; private readonly UintListEditorNode _allowedItemIdsEditor;
private readonly StringListEditorNode _allowedNamePatternsEditor; private readonly StringListEditorNode _allowedNamePatternsEditor;
@@ -241,6 +245,18 @@ public sealed class CategoryDefinitionConfigurationNode : VerticalListNode
_repairableFilter = new StateFilterRowNode("Repairable", CategoryDefinition.Rules.Repairable, NotifyChanged); _repairableFilter = new StateFilterRowNode("Repairable", CategoryDefinition.Rules.Repairable, NotifyChanged);
AddNode(_repairableFilter); AddNode(_repairableFilter);
_hqFilter = new StateFilterRowNode("High Quality", CategoryDefinition.Rules.HighQuality, NotifyChanged);
AddNode(_hqFilter);
_desynthFilter = new StateFilterRowNode("Desynthesizable", CategoryDefinition.Rules.Desynthesizable, NotifyChanged);
AddNode(_desynthFilter);
_glamourFilter = new StateFilterRowNode("Glamourable", CategoryDefinition.Rules.Glamourable, NotifyChanged);
AddNode(_glamourFilter);
_spiritbondFilter = new StateFilterRowNode("Spiritbonded", CategoryDefinition.Rules.FullySpiritbonded, NotifyChanged);
AddNode(_spiritbondFilter);
AddNode(CreateSectionHeader("List Filters")); AddNode(CreateSectionHeader("List Filters"));
_allowedItemIdsEditor = new UintListEditorNode( _allowedItemIdsEditor = new UintListEditorNode(
@@ -24,6 +24,20 @@ internal class LayoutConfigurationNode : TabbedVerticalListNode
AddTab(1); AddTab(1);
var showCategoryItemAmountCheckboxNode = new CheckboxNode
{
Size = Size with { Y = 18 },
IsVisible = true,
String = "Show Category Item Amount",
IsChecked = config.ShowCategoryItemCount,
OnClick = isChecked =>
{
config.ShowCategoryItemCount = isChecked;
System.AddonInventoryWindow.ManualInventoryRefresh();
}
};
AddNode(showCategoryItemAmountCheckboxNode);
var compactPackingCheckboxNode = new CheckboxNode var compactPackingCheckboxNode = new CheckboxNode
{ {
Size = Size with { Y = 18 }, Size = Size with { Y = 18 },
@@ -72,7 +72,9 @@ public class InventoryCategoryNode : SimpleComponentNode
{ {
field = value; field = value;
_fullHeaderText = value.Category.Name; _fullHeaderText = System.Config.General.ShowCategoryItemCount
? $"{value.Category.Name} ({value.Items.Count})"
: value.Category.Name;
_categoryNameTextNode.String = _fullHeaderText; _categoryNameTextNode.String = _fullHeaderText;
_categoryNameTextNode.TextColor = value.Category.Color; _categoryNameTextNode.TextColor = value.Category.Color;