This commit is contained in:
DismissedLight
2023-09-07 23:06:09 +08:00
parent 1fefcacd9a
commit 8e625e19ee
2 changed files with 16 additions and 13 deletions

View File

@@ -3,6 +3,7 @@
using Snap.Hutao.Model;
using Snap.Hutao.Model.Intrinsic;
using Snap.Hutao.Model.Intrinsic.Format;
using Snap.Hutao.Model.Metadata.Converter;
using Snap.Hutao.Model.Primitive;
using Snap.Hutao.ViewModel.AvatarProperty;
@@ -150,8 +151,7 @@ internal sealed class SummaryAvatarFactory
}
else
{
// 是否为整数
float statValue = subStat.StatValue == MathF.Truncate(subStat.StatValue)
float statValue = subStat.AppendPropId.GetFormatMethod() is FormatMethod.Percent
? subStat.StatValue / 100F
: subStat.StatValue;
subProperty = FightPropertyFormat.ToNameDescription(subStat.AppendPropId, statValue);

View File

@@ -36,8 +36,7 @@ internal sealed class GameRecordCharacterAvatarInfoTransformer : IAvatarInfoTran
Flat = new() { ItemType = ItemType.ITEM_RELIQUARY, EquipType = r.Position, },
});
Equip? equipTest = avatarInfo.EquipList.LastOrDefault();
if (equipTest?.Weapon is null)
if (avatarInfo.EquipList.LastOrDefault() is null or { Weapon: null })
{
// 不存在武器则添加
avatarInfo.EquipList.Add(new());
@@ -45,17 +44,21 @@ internal sealed class GameRecordCharacterAvatarInfoTransformer : IAvatarInfoTran
Equip equip = avatarInfo.EquipList.Last();
equip.ItemId = source.Weapon.Id;
equip.Weapon = new()
if (equip.ItemId != source.Weapon.Id)
{
Level = source.Weapon.Level,
AffixMap = new()
// 切换了武器
equip.ItemId = source.Weapon.Id;
equip.Weapon = new()
{
[100000 + source.Weapon.Id] = source.Weapon.AffixLevel - 1,
},
};
Level = source.Weapon.Level,
AffixMap = new()
{
[100000 + source.Weapon.Id] = source.Weapon.AffixLevel - 1,
},
};
// Special case here, don't set EQUIP_WEAPON
equip.Flat = new() { ItemType = ItemType.ITEM_WEAPON, };
// Special case here, don't set EQUIP_WEAPON
equip.Flat = new() { ItemType = ItemType.ITEM_WEAPON, };
}
}
}