diff --git a/AetherBags/Commands/CommandHandler.cs b/AetherBags/Commands/CommandHandler.cs index 2cecabd..7c97136 100644 --- a/AetherBags/Commands/CommandHandler.cs +++ b/AetherBags/Commands/CommandHandler.cs @@ -73,6 +73,16 @@ public class CommandHandler : IDisposable HandleExport(); break; + case "import": + ImportExportResetHelper.TryImportConfigFromClipboard(System.Config); + System.AddonInventoryWindow.ManualInventoryRefresh(); + break; + + case "reset": + ImportExportResetHelper.TryResetConfig(); + System.AddonInventoryWindow.ManualInventoryRefresh(); + break; + case "help": case "?": PrintHelp(); @@ -101,8 +111,7 @@ public class CommandHandler : IDisposable private void HandleExport() { - // TODO: Implement export functionality - PrintChat("Export functionality coming soon!"); + ImportExportResetHelper.TryExportConfigToClipboard(System.Config); } private void PrintHelp() @@ -114,8 +123,10 @@ public class CommandHandler : IDisposable /ab hide - Close inventory window /ab refresh - Force refresh inventory /ab search - Open and search for items + /ab import - Import config from clipboard (hold Shift) /ab import-sk - Import from SortaKinda clipboard /ab export - Export config to clipboard + /ab reset - Reset config to default /ab help - Show this help message"; PrintChat(helpText); diff --git a/AetherBags/Configuration/CategorySettings.cs b/AetherBags/Configuration/CategorySettings.cs index 1ab344b..f831eac 100644 --- a/AetherBags/Configuration/CategorySettings.cs +++ b/AetherBags/Configuration/CategorySettings.cs @@ -43,6 +43,10 @@ public class CategoryRuleSet public StateFilter Collectable { get; set; } = new(); public StateFilter Dyeable { 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 where T : struct, IComparable diff --git a/AetherBags/Configuration/GeneralSettings.cs b/AetherBags/Configuration/GeneralSettings.cs index 00f6fb9..3215ba5 100644 --- a/AetherBags/Configuration/GeneralSettings.cs +++ b/AetherBags/Configuration/GeneralSettings.cs @@ -13,6 +13,7 @@ public class GeneralSettings public bool CompactStableInsert { get; set; } = true; public bool OpenWithGameInventory { get; set; } = true; public bool HideGameInventory { get; set; } = false; + public bool ShowCategoryItemCount { get; set; } = false; } public enum InventoryStackMode : byte diff --git a/AetherBags/Inventory/ItemInfo.cs b/AetherBags/Inventory/ItemInfo.cs index 1893dde..3083413 100644 --- a/AetherBags/Inventory/ItemInfo.cs +++ b/AetherBags/Inventory/ItemInfo.cs @@ -57,6 +57,12 @@ public sealed class ItemInfo : IEquatable public bool IsDyeable => Row.DyeCount > 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(); public InventoryMappedLocation VisualLocation => diff --git a/AetherBags/Inventory/UserCategoryMatcher.cs b/AetherBags/Inventory/UserCategoryMatcher.cs index 7f84052..4e2e29b 100644 --- a/AetherBags/Inventory/UserCategoryMatcher.cs +++ b/AetherBags/Inventory/UserCategoryMatcher.cs @@ -73,6 +73,10 @@ internal static class UserCategoryMatcher if (!MatchesToggle(rules.Collectable, item.IsCollectable)) return false; if (!MatchesToggle(rules.Dyeable, item.IsDyeable)) 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; } diff --git a/AetherBags/Nodes/Configuration/Category/CategoryDefinitionConfigurationNode.cs b/AetherBags/Nodes/Configuration/Category/CategoryDefinitionConfigurationNode.cs index 968f8f9..29666ec 100644 --- a/AetherBags/Nodes/Configuration/Category/CategoryDefinitionConfigurationNode.cs +++ b/AetherBags/Nodes/Configuration/Category/CategoryDefinitionConfigurationNode.cs @@ -40,6 +40,10 @@ public sealed class CategoryDefinitionConfigurationNode : VerticalListNode private readonly StateFilterRowNode _collectableFilter; private readonly StateFilterRowNode _dyeableFilter; 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 StringListEditorNode _allowedNamePatternsEditor; @@ -241,6 +245,18 @@ public sealed class CategoryDefinitionConfigurationNode : VerticalListNode _repairableFilter = new StateFilterRowNode("Repairable", CategoryDefinition.Rules.Repairable, NotifyChanged); 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")); _allowedItemIdsEditor = new UintListEditorNode( diff --git a/AetherBags/Nodes/Configuration/Layout/LayoutConfigurationNode.cs b/AetherBags/Nodes/Configuration/Layout/LayoutConfigurationNode.cs index c7d3e0e..0669999 100644 --- a/AetherBags/Nodes/Configuration/Layout/LayoutConfigurationNode.cs +++ b/AetherBags/Nodes/Configuration/Layout/LayoutConfigurationNode.cs @@ -24,6 +24,20 @@ internal class LayoutConfigurationNode : TabbedVerticalListNode 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 { Size = Size with { Y = 18 }, diff --git a/AetherBags/Nodes/Inventory/InventoryCategoryNode.cs b/AetherBags/Nodes/Inventory/InventoryCategoryNode.cs index 3606974..12b6180 100644 --- a/AetherBags/Nodes/Inventory/InventoryCategoryNode.cs +++ b/AetherBags/Nodes/Inventory/InventoryCategoryNode.cs @@ -72,7 +72,9 @@ public class InventoryCategoryNode : SimpleComponentNode { field = value; - _fullHeaderText = value.Category.Name; + _fullHeaderText = System.Config.General.ShowCategoryItemCount + ? $"{value.Category.Name} ({value.Items.Count})" + : value.Category.Name; _categoryNameTextNode.String = _fullHeaderText; _categoryNameTextNode.TextColor = value.Category.Color;