code style

This commit is contained in:
Lightczx
2023-07-07 22:50:07 +08:00
parent f4fa08a939
commit 133a1a532e
22 changed files with 137 additions and 122 deletions

View File

@@ -9,7 +9,7 @@ namespace Snap.Hutao.Model;
/// <typeparam name="TEntity">实体</typeparam>
/// <typeparam name="TMetadata">元数据</typeparam>
[HighQuality]
internal interface IEntityWithMetadata<TEntity, TMetadata>
internal interface IEntityWithMetadata<out TEntity, out TMetadata>
{
/// <summary>
/// 实体

View File

@@ -29,13 +29,15 @@ internal abstract partial class DbStoreOptions : ObservableObject, IOptions<DbSt
/// <returns>值</returns>
protected string GetOption(ref string? storage, string key, string defaultValue = "")
{
if (storage == null)
if (storage is not null)
{
using (IServiceScope scope = serviceProvider.CreateScope())
{
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
storage = appDbContext.Settings.SingleOrDefault(e => e.Key == key)?.Value ?? defaultValue;
}
return storage;
}
using (IServiceScope scope = serviceProvider.CreateScope())
{
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
storage = appDbContext.Settings.SingleOrDefault(e => e.Key == key)?.Value ?? defaultValue;
}
return storage;
@@ -50,14 +52,16 @@ internal abstract partial class DbStoreOptions : ObservableObject, IOptions<DbSt
/// <returns>值</returns>
protected bool GetOption(ref bool? storage, string key, bool defaultValue = false)
{
if (storage == null)
if (storage is not null)
{
using (IServiceScope scope = serviceProvider.CreateScope())
{
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
string? value = appDbContext.Settings.SingleOrDefault(e => e.Key == key)?.Value;
storage = value == null ? defaultValue : bool.Parse(value);
}
return storage.Value;
}
using (IServiceScope scope = serviceProvider.CreateScope())
{
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
string? value = appDbContext.Settings.SingleOrDefault(e => e.Key == key)?.Value;
storage = value == null ? defaultValue : bool.Parse(value);
}
return storage.Value;
@@ -72,14 +76,16 @@ internal abstract partial class DbStoreOptions : ObservableObject, IOptions<DbSt
/// <returns>值</returns>
protected int GetOption(ref int? storage, string key, int defaultValue = 0)
{
if (storage == null)
if (storage is not null)
{
using (IServiceScope scope = serviceProvider.CreateScope())
{
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
string? value = appDbContext.Settings.SingleOrDefault(e => e.Key == key)?.Value;
storage = value == null ? defaultValue : int.Parse(value);
}
return storage.Value;
}
using (IServiceScope scope = serviceProvider.CreateScope())
{
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
string? value = appDbContext.Settings.SingleOrDefault(e => e.Key == key)?.Value;
storage = value == null ? defaultValue : int.Parse(value);
}
return storage.Value;
@@ -97,14 +103,16 @@ internal abstract partial class DbStoreOptions : ObservableObject, IOptions<DbSt
protected T GetOption<T>(ref T? storage, string key, Func<string, T> deserializer, T defaultValue)
where T : class
{
if (storage == null)
if (storage != null)
{
using (IServiceScope scope = serviceProvider.CreateScope())
{
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
string? value = appDbContext.Settings.SingleOrDefault(e => e.Key == key)?.Value;
storage = value == null ? defaultValue : deserializer(value);
}
return storage;
}
using (IServiceScope scope = serviceProvider.CreateScope())
{
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
string? value = appDbContext.Settings.SingleOrDefault(e => e.Key == key)?.Value;
storage = value == null ? defaultValue : deserializer(value);
}
return storage;
@@ -122,14 +130,16 @@ internal abstract partial class DbStoreOptions : ObservableObject, IOptions<DbSt
protected T GetOption<T>(ref T? storage, string key, Func<string, T> deserializer, T defaultValue)
where T : struct
{
if (storage == null)
if (storage is not null)
{
using (IServiceScope scope = serviceProvider.CreateScope())
{
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
string? value = appDbContext.Settings.SingleOrDefault(e => e.Key == key)?.Value;
storage = value == null ? defaultValue : deserializer(value);
}
return storage.Value;
}
using (IServiceScope scope = serviceProvider.CreateScope())
{
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
string? value = appDbContext.Settings.SingleOrDefault(e => e.Key == key)?.Value;
storage = value == null ? defaultValue : deserializer(value);
}
return storage.Value;
@@ -144,14 +154,16 @@ internal abstract partial class DbStoreOptions : ObservableObject, IOptions<DbSt
/// <param name="propertyName">属性名称</param>
protected void SetOption(ref string? storage, string key, string value, [CallerMemberName] string? propertyName = null)
{
if (SetProperty(ref storage, value, propertyName))
if (!SetProperty(ref storage, value, propertyName))
{
using (IServiceScope scope = serviceProvider.CreateScope())
{
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
appDbContext.Settings.ExecuteDeleteWhere(e => e.Key == key);
appDbContext.Settings.AddAndSave(new(key, value));
}
return;
}
using (IServiceScope scope = serviceProvider.CreateScope())
{
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
appDbContext.Settings.ExecuteDeleteWhere(e => e.Key == key);
appDbContext.Settings.AddAndSave(new(key, value));
}
}
@@ -166,14 +178,16 @@ internal abstract partial class DbStoreOptions : ObservableObject, IOptions<DbSt
protected bool SetOption(ref bool? storage, string key, bool value, [CallerMemberName] string? propertyName = null)
{
bool set = SetProperty(ref storage, value, propertyName);
if (set)
if (!set)
{
using (IServiceScope scope = serviceProvider.CreateScope())
{
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
appDbContext.Settings.ExecuteDeleteWhere(e => e.Key == key);
appDbContext.Settings.AddAndSave(new(key, value.ToString()));
}
return set;
}
using (IServiceScope scope = serviceProvider.CreateScope())
{
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
appDbContext.Settings.ExecuteDeleteWhere(e => e.Key == key);
appDbContext.Settings.AddAndSave(new(key, value.ToString()));
}
return set;
@@ -188,14 +202,16 @@ internal abstract partial class DbStoreOptions : ObservableObject, IOptions<DbSt
/// <param name="propertyName">属性名称</param>
protected void SetOption(ref int? storage, string key, int value, [CallerMemberName] string? propertyName = null)
{
if (SetProperty(ref storage, value, propertyName))
if (!SetProperty(ref storage, value, propertyName))
{
using (IServiceScope scope = serviceProvider.CreateScope())
{
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
appDbContext.Settings.ExecuteDeleteWhere(e => e.Key == key);
appDbContext.Settings.AddAndSave(new(key, value.ToString()));
}
return;
}
using (IServiceScope scope = serviceProvider.CreateScope())
{
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
appDbContext.Settings.ExecuteDeleteWhere(e => e.Key == key);
appDbContext.Settings.AddAndSave(new(key, value.ToString()));
}
}
@@ -211,14 +227,16 @@ internal abstract partial class DbStoreOptions : ObservableObject, IOptions<DbSt
protected void SetOption<T>(ref T? storage, string key, T value, Func<T, string> serializer, [CallerMemberName] string? propertyName = null)
where T : class
{
if (SetProperty(ref storage, value, propertyName))
if (!SetProperty(ref storage, value, propertyName))
{
using (IServiceScope scope = serviceProvider.CreateScope())
{
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
appDbContext.Settings.ExecuteDeleteWhere(e => e.Key == key);
appDbContext.Settings.AddAndSave(new(key, serializer(value)));
}
return;
}
using (IServiceScope scope = serviceProvider.CreateScope())
{
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
appDbContext.Settings.ExecuteDeleteWhere(e => e.Key == key);
appDbContext.Settings.AddAndSave(new(key, serializer(value)));
}
}
@@ -234,14 +252,16 @@ internal abstract partial class DbStoreOptions : ObservableObject, IOptions<DbSt
protected void SetOption<T>(ref T? storage, string key, T value, Func<T, string> serializer, [CallerMemberName] string? propertyName = null)
where T : struct
{
if (SetProperty(ref storage, value, propertyName))
if (!SetProperty(ref storage, value, propertyName))
{
using (IServiceScope scope = serviceProvider.CreateScope())
{
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
appDbContext.Settings.ExecuteDeleteWhere(e => e.Key == key);
appDbContext.Settings.AddAndSave(new(key, serializer(value)));
}
return;
}
using (IServiceScope scope = serviceProvider.CreateScope())
{
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
appDbContext.Settings.ExecuteDeleteWhere(e => e.Key == key);
appDbContext.Settings.AddAndSave(new(key, serializer(value)));
}
}
}

View File

@@ -61,7 +61,7 @@ internal sealed partial class AchievementDbBulkOperation
EntityAchievement? entity = entityEnumerator.Current;
UIAFItem? uiaf = uiafEnumerator.Current;
if (entity == null && uiaf != null)
if (entity is null && uiaf is not null)
{
appDbContext.Achievements.AddAndSave(EntityAchievement.Create(archiveId, uiaf));
add++;
@@ -146,7 +146,7 @@ internal sealed partial class AchievementDbBulkOperation
EntityAchievement? oldEntity = oldDataEnumerator.Current;
EntityAchievement? newEntity = newDataEnumerator.Current;
if (oldEntity == null && newEntity != null)
if (oldEntity is null && newEntity is not null)
{
appDbContext.Achievements.AddAndSave(newEntity);
add++;

View File

@@ -52,7 +52,7 @@ internal sealed partial class AchievementService : IAchievementService
return metadata.SelectList(meta =>
{
EntityAchievement? entity = entityMap.GetValueOrDefault(meta.Id) ?? EntityAchievement.Create(archive.InnerId, meta.Id);
EntityAchievement entity = entityMap.GetValueOrDefault(meta.Id) ?? EntityAchievement.Create(archive.InnerId, meta.Id);
return new AchievementView(entity, meta);
});
}

View File

@@ -6,7 +6,6 @@ using Snap.Hutao.Model.Entity.Database;
using Snap.Hutao.Model.Metadata;
using Snap.Hutao.Model.Primitive;
using Snap.Hutao.Service.AvatarInfo.Transformer;
using Snap.Hutao.Service.Metadata;
using Snap.Hutao.ViewModel.User;
using Snap.Hutao.Web.Hoyolab.Takumi.Event.Calculate;
using Snap.Hutao.Web.Hoyolab.Takumi.GameRecord;
@@ -105,10 +104,6 @@ internal sealed partial class AvatarInfoDbBulkOperation
List<RecordCharacter> characters = charactersResponse.Data.Avatars;
GameRecordCharacterAvatarInfoTransformer transformer = serviceProvider.GetRequiredService<GameRecordCharacterAvatarInfoTransformer>();
transformer.IdAvatarMap = await serviceProvider
.GetRequiredService<IMetadataService>()
.GetIdToAvatarMapAsync(token)
.ConfigureAwait(false);
foreach (RecordCharacter character in characters)
{

View File

@@ -18,9 +18,9 @@ internal static class SummaryAvatarProperties
/// </summary>
/// <param name="fightPropMap">属性映射</param>
/// <returns>列表</returns>
public static List<AvatarProperty> Create(Dictionary<FightProperty, float> fightPropMap)
public static List<AvatarProperty> Create(Dictionary<FightProperty, float>? fightPropMap)
{
if (fightPropMap == null)
if (fightPropMap is null)
{
return new();
}

View File

@@ -28,7 +28,7 @@ internal sealed partial class SummaryFactory : ISummaryFactory
IdReliquaryAffixWeightMap = await metadataService.GetIdToReliquaryAffixWeightMapAsync(token).ConfigureAwait(false),
IdReliquaryMainAffixMap = await metadataService.GetIdToReliquaryMainPropertyMapAsync(token).ConfigureAwait(false),
IdReliquarySubAffixMap = await metadataService.GetIdToReliquarySubAffixMapAsync(token).ConfigureAwait(false),
ReliqueryLevels = await metadataService.GetReliquaryLevelsAsync(token).ConfigureAwait(false),
ReliquaryLevels = await metadataService.GetReliquaryLevelsAsync(token).ConfigureAwait(false),
Reliquaries = await metadataService.GetReliquariesAsync(token).ConfigureAwait(false),
};

View File

@@ -39,9 +39,9 @@ internal static class SummaryHelper
/// <param name="proudSkillExtraLevelMap">额外提升等级映射</param>
/// <param name="proudSkills">技能列表</param>
/// <returns>技能</returns>
public static List<SkillView> CreateSkills(Dictionary<SkillId, SkillLevel> skillLevelMap, Dictionary<SkillGroupId, SkillLevel>? proudSkillExtraLevelMap, List<ProudableSkill> proudSkills)
public static List<SkillView> CreateSkills(Dictionary<SkillId, SkillLevel>? skillLevelMap, Dictionary<SkillGroupId, SkillLevel>? proudSkillExtraLevelMap, List<ProudableSkill> proudSkills)
{
if (skillLevelMap == null)
if (skillLevelMap is null)
{
return new();
}
@@ -80,7 +80,7 @@ internal static class SummaryHelper
/// <returns>最大属性Id</returns>
public static ReliquarySubAffixId GetAffixMaxId(in ReliquarySubAffixId appendId)
{
uint value = (uint)appendId / 100000U;
uint value = appendId / 100000U;
uint max = value switch
{
1 => 2,
@@ -131,9 +131,9 @@ internal static class SummaryHelper
/// </summary>
/// <param name="fightPropMap">属性</param>
/// <returns>评分</returns>
public static float ScoreCrit(Dictionary<FightProperty, float> fightPropMap)
public static float ScoreCrit(Dictionary<FightProperty, float>? fightPropMap)
{
if (fightPropMap == null)
if (fightPropMap is null)
{
return 0F;
}

View File

@@ -44,7 +44,7 @@ internal sealed class SummaryMetadataContext
/// <summary>
/// 圣遗物等级
/// </summary>
public List<ReliquaryMainAffixLevel> ReliqueryLevels { get; set; } = default!;
public List<ReliquaryMainAffixLevel> ReliquaryLevels { get; set; } = default!;
/// <summary>
/// 圣遗物

View File

@@ -66,7 +66,7 @@ internal sealed class SummaryReliquaryFactory
result.PrimarySubProperties = new(span[..^affixCount].ToArray());
result.SecondarySubProperties = new(span[^affixCount..].ToArray());
result.ComposedSubProperties = equip.Flat.ReliquarySubstats!.SelectList(CreateComposedSubProperty);
ReliquaryMainAffixLevel relicLevel = metadataContext.ReliqueryLevels.Single(r => r.Level == equip.Reliquary!.Level && r.Rank == reliquary.RankLevel);
ReliquaryMainAffixLevel relicLevel = metadataContext.ReliquaryLevels.Single(r => r.Level == equip.Reliquary!.Level && r.Rank == reliquary.RankLevel);
FightProperty property = metadataContext.IdReliquaryMainAffixMap[equip.Reliquary.MainPropId];
result.MainProperty = FightPropertyFormat.ToNameValue(property, relicLevel.PropertyMap[property]);
@@ -116,7 +116,7 @@ internal sealed class SummaryReliquaryFactory
if (equip.Flat.EquipType > EquipType.EQUIP_SHOES)
{
ReliquaryAffixWeight affixWeight = metadataContext.IdReliquaryAffixWeightMap.GetValueOrDefault(avatarInfo.AvatarId, ReliquaryAffixWeight.Default);
ReliquaryMainAffixLevel maxRelicLevel = metadataContext.ReliqueryLevels.Where(r => r.Rank == reliquary.RankLevel).MaxBy(r => r.Level)!;
ReliquaryMainAffixLevel maxRelicLevel = metadataContext.ReliquaryLevels.Where(r => r.Rank == reliquary.RankLevel).MaxBy(r => r.Level)!;
float percent = relicLevel.PropertyMap[property] / maxRelicLevel.PropertyMap[property];
float baseScore = 8 * percent * affixWeight[property];
@@ -136,9 +136,9 @@ internal sealed class SummaryReliquaryFactory
FormatMethod method = substat.AppendPropId.GetFormatMethod();
string valueFormatted = method switch
{
FormatMethod.Integer => Math.Round((double)substat.StatValue, MidpointRounding.AwayFromZero).ToString(),
FormatMethod.Integer => $"{MathF.Round(substat.StatValue, MidpointRounding.AwayFromZero)}",
FormatMethod.Percent => $"{substat.StatValue}%",
_ => substat.StatValue.ToString(),
_ => $"{substat.StatValue}",
};
return new(substat.AppendPropId.GetLocalizedDescription(), valueFormatted, 0);

View File

@@ -15,16 +15,9 @@ namespace Snap.Hutao.Service.AvatarInfo.Transformer;
[Injection(InjectAs.Transient)]
internal sealed class GameRecordCharacterAvatarInfoTransformer : IAvatarInfoTransformer<Character>
{
/// <summary>
/// Id 角色映射
/// </summary>
public Dictionary<AvatarId, Model.Metadata.Avatar.Avatar>? IdAvatarMap { get; set; }
/// <inheritdoc/>
public void Transform(ref Web.Enka.Model.AvatarInfo avatarInfo, Character source)
{
Model.Metadata.Avatar.Avatar avatar = Must.NotNull(IdAvatarMap!)[source.Id];
// update fetter
avatarInfo.FetterInfo ??= new();
avatarInfo.FetterInfo.ExpLevel = source.Fetter;
@@ -45,7 +38,7 @@ internal sealed class GameRecordCharacterAvatarInfoTransformer : IAvatarInfoTran
});
Equip? equipTest = avatarInfo.EquipList.LastOrDefault();
if (equipTest == null || equipTest.Weapon == null)
if (equipTest?.Weapon is null)
{
// 不存在武器则添加
avatarInfo.EquipList.Add(new());

View File

@@ -8,7 +8,7 @@ namespace Snap.Hutao.Service.AvatarInfo.Transformer;
/// </summary>
/// <typeparam name="TSource">源类型</typeparam>
[HighQuality]
internal interface IAvatarInfoTransformer<TSource>
internal interface IAvatarInfoTransformer<in TSource>
{
/// <summary>
/// 合并到角色信息

View File

@@ -110,7 +110,7 @@ internal sealed partial class CultivationService : ICultivationService
List<Material> materials = await scope.ServiceProvider
.GetRequiredService<IMetadataService>()
.GetMaterialsAsync(default)
.GetMaterialsAsync(token)
.ConfigureAwait(false);
Guid projectId = cultivateProject.InnerId;
@@ -126,13 +126,13 @@ internal sealed partial class CultivationService : ICultivationService
continue;
}
if (resultItems.SingleOrDefault(i => i.Inner.Id == item.ItemId) is StatisticsCultivateItem existedItem)
if (resultItems.SingleOrDefault(i => i.Inner.Id == item.ItemId) is { } existedItem)
{
existedItem.Count += item.Count;
}
else
{
resultItems.Add(new(materials!.Single(m => m.Id == item.ItemId), item));
resultItems.Add(new(materials.Single(m => m.Id == item.ItemId), item));
}
}
}
@@ -141,7 +141,7 @@ internal sealed partial class CultivationService : ICultivationService
foreach (InventoryItem inventoryItem in await GetProjectInventoryAsync(appDbContext, projectId).ConfigureAwait(false))
{
if (resultItems.SingleOrDefault(i => i.Inner.Id == inventoryItem.ItemId) is StatisticsCultivateItem existedItem)
if (resultItems.SingleOrDefault(i => i.Inner.Id == inventoryItem.ItemId) is { } existedItem)
{
existedItem.TotalCount += inventoryItem.Count;
}

View File

@@ -57,8 +57,6 @@ internal sealed class DailyNoteNotifier
using (IServiceScope scope = serviceProvider.CreateScope())
{
DailyNoteOptions options = scope.ServiceProvider.GetRequiredService<DailyNoteOptions>();
BindingClient bindingClient = scope.ServiceProvider.GetRequiredService<BindingClient>();
AuthClient authClient = scope.ServiceProvider.GetRequiredService<AuthClient>();
string? attribution = SH.ServiceDailyNoteNotifierAttribution;

View File

@@ -10,9 +10,9 @@ namespace Snap.Hutao.Service.GachaLog.Factory;
/// <summary>
/// 祈愿配置类型比较器
/// </summary>
internal sealed class GachaConfigTypeComparar : IComparer<GachaConfigType>
internal sealed class GachaConfigTypeComparer : IComparer<GachaConfigType>
{
private static readonly GachaConfigTypeComparar InnerShared = new();
private static readonly GachaConfigTypeComparer InnerShared = new();
private static readonly ImmutableDictionary<GachaConfigType, int> OrderMap = new Dictionary<GachaConfigType, int>()
{
[GachaConfigType.AvatarEventWish] = 0,
@@ -25,7 +25,7 @@ internal sealed class GachaConfigTypeComparar : IComparer<GachaConfigType>
/// <summary>
/// 共享的比较器
/// </summary>
public static GachaConfigTypeComparar Shared { get => InnerShared; }
public static GachaConfigTypeComparer Shared { get => InnerShared; }
/// <inheritdoc/>
public int Compare(GachaConfigType x, GachaConfigType y)

View File

@@ -29,6 +29,11 @@ internal static class GachaStatisticsExtension
count++;
}
if (count == 0)
{
return 0;
}
return unchecked((byte)(sum / count));
}

View File

@@ -123,7 +123,7 @@ internal sealed partial class GachaStatisticsFactory : IGachaStatisticsFactory
HistoryWishes = historyWishBuilders
.Where(b => isEmptyHistoryWishVisible || (!b.IsEmpty))
.OrderByDescending(builder => builder.From)
.ThenBy(builder => builder.ConfigType, GachaConfigTypeComparar.Shared)
.ThenBy(builder => builder.ConfigType, GachaConfigTypeComparer.Shared)
.Select(builder => builder.ToHistoryWish())
.ToList(),

View File

@@ -31,8 +31,8 @@ internal sealed class TypedWishSummaryBuilder
public static readonly Func<GachaConfigType, bool> IsWeaponEventWish = type => type is GachaConfigType.WeaponEventWish;
private readonly string name;
private readonly int guarenteeOrangeThreshold;
private readonly int guarenteePurpleThreshold;
private readonly int guaranteeOrangeThreshold;
private readonly int guaranteePurpleThreshold;
private readonly Func<GachaConfigType, bool> typeEvaluator;
private readonly List<int> averageOrangePullTracker = new();
@@ -57,14 +57,14 @@ internal sealed class TypedWishSummaryBuilder
/// </summary>
/// <param name="name">祈愿配置</param>
/// <param name="typeEvaluator">祈愿类型判断器</param>
/// <param name="guarenteeOrangeThreshold">五星保底</param>
/// <param name="guarenteePurpleThreshold">四星保底</param>
public TypedWishSummaryBuilder(string name, Func<GachaConfigType, bool> typeEvaluator, int guarenteeOrangeThreshold, int guarenteePurpleThreshold)
/// <param name="guaranteeOrangeThreshold">五星保底</param>
/// <param name="guaranteePurpleThreshold">四星保底</param>
public TypedWishSummaryBuilder(string name, Func<GachaConfigType, bool> typeEvaluator, int guaranteeOrangeThreshold, int guaranteePurpleThreshold)
{
this.name = name;
this.typeEvaluator = typeEvaluator;
this.guarenteeOrangeThreshold = guarenteeOrangeThreshold;
this.guarenteePurpleThreshold = guarenteePurpleThreshold;
this.guaranteeOrangeThreshold = guaranteeOrangeThreshold;
this.guaranteePurpleThreshold = guaranteePurpleThreshold;
}
/// <summary>
@@ -142,9 +142,9 @@ internal sealed class TypedWishSummaryBuilder
MaxOrangePull = maxOrangePullTracker,
MinOrangePull = minOrangePullTracker,
LastOrangePull = lastOrangePullTracker,
GuaranteeOrangeThreshold = guarenteeOrangeThreshold,
GuaranteeOrangeThreshold = guaranteeOrangeThreshold,
LastPurplePull = lastPurplePullTracker,
GuaranteePurpleThreshold = guarenteePurpleThreshold,
GuaranteePurpleThreshold = guaranteePurpleThreshold,
TotalOrangePull = totalOrangePullTracker,
TotalPurplePull = totalPurplePullTracker,
TotalBluePull = totalBluePullTracker,

View File

@@ -21,7 +21,7 @@ internal static class GachaLogQueryProviderExtension
string? name = option switch
{
RefreshOption.WebCache => nameof(GachaLogQueryWebCacheProvider),
RefreshOption.SToken => nameof(GachaLogQuerySTokenProvider),
RefreshOption.SToken => nameof(GachaLogQuerySToken2Provider),
RefreshOption.ManualInput => nameof(GachaLogQueryManualInputProvider),
_ => null,
};

View File

@@ -15,13 +15,13 @@ namespace Snap.Hutao.Service.GachaLog.QueryProvider;
[HighQuality]
[ConstructorGenerated]
[Injection(InjectAs.Transient, typeof(IGachaLogQueryProvider))]
internal sealed partial class GachaLogQuerySTokenProvider : IGachaLogQueryProvider
internal sealed partial class GachaLogQuerySToken2Provider : IGachaLogQueryProvider
{
private readonly BindingClient2 bindingClient2;
private readonly IUserService userService;
/// <inheritdoc/>
public string Name { get => nameof(GachaLogQuerySTokenProvider); }
public string Name { get => nameof(GachaLogQuerySToken2Provider); }
/// <inheritdoc/>
public async Task<ValueResult<bool, GachaLogQuery>> GetQueryAsync()

View File

@@ -24,6 +24,7 @@ internal sealed class AvatarInfo
/// Character Info Properties List
/// <see cref="PlayerProperty.PROP_EXP"/>
/// </summary>
[MaybeNull]
[JsonPropertyName("propMap")]
public Dictionary<PlayerProperty, TypeValue> PropMap { get; set; } = default!;
@@ -65,6 +66,7 @@ internal sealed class AvatarInfo
/// 最后一个为武器
/// List of Equipments: Weapon, Artifacts
/// </summary>
[MaybeNull]
[JsonPropertyName("equipList")]
public List<Equip> EquipList { get; set; } = default!;
@@ -72,6 +74,7 @@ internal sealed class AvatarInfo
/// 好感度信息
/// Character Friendship Level
/// </summary>
[MaybeNull]
[JsonPropertyName("fetterInfo")]
public FetterInfo FetterInfo { get; set; } = default!;

View File

@@ -29,6 +29,7 @@ internal sealed class Weapon
/// 精炼 相较于实际等级 -1
/// Weapon Refinement Level [0-4]
/// </summary>
[MaybeNull]
[JsonPropertyName("affixMap")]
public Dictionary<EquipAffixId, WeaponAffixLevel> AffixMap { get; set; } = default!;
}