Implement basic usercategories

This commit is contained in:
Zeffuro
2025-12-21 14:07:00 +01:00
parent 16f9311a13
commit bada2bdc8a
8 changed files with 312 additions and 32 deletions
@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Numerics;
using KamiToolKit.Classes;
namespace AetherBags.Configuration;
public class CategorySettings
{
public bool GameCategoriesEnabled { get; set; } = true;
public bool UserCategoriesEnabled { get; set; } = true;
public List<UserCategoryDefinition> UserCategories { get; set; } = new();
}
public class UserCategoryDefinition
{
public string Id { get; set; } = Guid.NewGuid().ToString("N");
public string Name { get; set; } = "New Category";
public string Description { get; set; } = string.Empty;
public int Order { get; set; }
public int Priority { get; set; } = 100;
public Vector4 Color { get; set; } = ColorHelper.GetColor(50);
public CategoryRuleSet Rules { get; set; } = new();
}
public class CategoryRuleSet
{
public List<uint> AllowedItemIds { get; set; } = new();
public List<string> AllowedItemNamePatterns { get; set; } = new();
public List<uint> AllowedUiCategoryIds { get; set; } = new();
public List<int> AllowedRarities { get; set; } = new();
public RangeFilter<int> ItemLevel { get; set; } = new() { Enabled = false, Min = 0, Max = 2000 };
public RangeFilter<uint> VendorPrice { get; set; } = new() { Enabled = false, Min = 0, Max = 9_999_999 };
}
public class RangeFilter<T> where T : struct, IComparable<T>
{
public bool Enabled { get; set; }
public T Min { get; set; }
public T Max { get; set; }
}
@@ -0,0 +1,39 @@
using System.Collections.Generic;
using System.Numerics;
namespace AetherBags.Configuration.Import;
// Possible Mapping:
// Index -> Order
// Color/Id/Name
// AllowedItemNames -> AllowedItemNamePatterns
// AllowedItemTypes -> AllowedUiCategoryIds
// AllowedItemRarities -> AllowedRarities
// ItemLevelFilter / VendorPriceFilter -> RangeFilter
public sealed class SortaKindaCategory
{
public Vector4 Color { get; set; }
public string Id { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public int Index { get; set; }
public List<string> AllowedItemNames { get; set; } = new();
public List<uint> AllowedItemTypes { get; set; } = new();
public List<int> AllowedItemRarities { get; set; } = new();
public ExternalRangeFilterDto<int> ItemLevelFilter { get; set; } = new();
public ExternalRangeFilterDto<uint> VendorPriceFilter { get; set; } = new();
public int Direction { get; set; }
public int FillMode { get; set; }
public int SortMode { get; set; }
}
public sealed class ExternalRangeFilterDto<T> where T : struct
{
public bool Enable { get; set; }
public string Label { get; set; } = string.Empty;
public T MinValue { get; set; }
public T MaxValue { get; set; }
}
@@ -8,4 +8,5 @@ public class SystemConfiguration
public const string FileName = "AetherBags.json";
public CurrencySettings Currency { get; set; } = new();
public CategorySettings Categories { get; set; } = new();
}