use weapon sort

This commit is contained in:
Lightczx
2024-06-11 15:06:15 +08:00
parent 98c8df5c8e
commit 069407abbc
3 changed files with 10 additions and 4 deletions

View File

@@ -24,6 +24,8 @@ internal sealed partial class Weapon : INameQualityAccess,
public PromoteId PromoteId { get; set; }
public uint Sort { get; set; }
public WeaponType WeaponType { get; set; }
public QualityType RankLevel { get; set; }

View File

@@ -4,6 +4,7 @@
using Google.OrTools.LinearSolver;
using Microsoft.Extensions.Caching.Memory;
using Snap.Hutao.Core;
using Snap.Hutao.Core.Diagnostics;
using Snap.Hutao.Core.ExceptionService;
using Snap.Hutao.Model.Metadata.Abstraction;
using Snap.Hutao.Model.Primitive;
@@ -21,6 +22,7 @@ internal sealed partial class MinimalPromotionDelta
{
private const string CacheKey = $"{nameof(MinimalPromotionDelta)}.Cache";
private readonly ILogger<MinimalPromotionDelta> logger;
private readonly IMetadataService metadataService;
private readonly IMemoryCache memoryCache;
@@ -37,7 +39,11 @@ internal sealed partial class MinimalPromotionDelta
.. (await metadataService.GetWeaponListAsync().ConfigureAwait(false)).Where(w => w.Quality >= Model.Intrinsic.QualityType.QUALITY_BLUE),
];
List<ICultivationItemsAccess> minimal = Minimize(cultivationItemsEntryList);
List<ICultivationItemsAccess> minimal;
using (ValueStopwatch.MeasureExecution(logger))
{
minimal = Minimize(cultivationItemsEntryList);
}
// Gurantee the order of avatar and weapon
// Make sure weapons can have avatar to attach

View File

@@ -102,9 +102,7 @@ internal sealed partial class WikiWeaponViewModel : Abstraction.ViewModel
List<Weapon> weapons = await metadataService.GetWeaponListAsync().ConfigureAwait(false);
IEnumerable<Weapon> sorted = weapons
.OrderByDescending(weapon => weapon.RankLevel)
.ThenBy(weapon => weapon.WeaponType)
.ThenByDescending(weapon => weapon.Id.Value);
.OrderByDescending(weapon => weapon.Sort);
List<Weapon> list = [.. sorted];
await CombineComplexDataAsync(list, idMaterialMap).ConfigureAwait(false);