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;
using Snap.Hutao.Model.Intrinsic; using Snap.Hutao.Model.Intrinsic;
using Snap.Hutao.Model.Intrinsic.Format;
using Snap.Hutao.Model.Metadata.Converter; using Snap.Hutao.Model.Metadata.Converter;
using Snap.Hutao.Model.Primitive; using Snap.Hutao.Model.Primitive;
using Snap.Hutao.ViewModel.AvatarProperty; using Snap.Hutao.ViewModel.AvatarProperty;
@@ -150,8 +151,7 @@ internal sealed class SummaryAvatarFactory
} }
else else
{ {
// 是否为整数 float statValue = subStat.AppendPropId.GetFormatMethod() is FormatMethod.Percent
float statValue = subStat.StatValue == MathF.Truncate(subStat.StatValue)
? subStat.StatValue / 100F ? subStat.StatValue / 100F
: subStat.StatValue; : subStat.StatValue;
subProperty = FightPropertyFormat.ToNameDescription(subStat.AppendPropId, 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, }, Flat = new() { ItemType = ItemType.ITEM_RELIQUARY, EquipType = r.Position, },
}); });
Equip? equipTest = avatarInfo.EquipList.LastOrDefault(); if (avatarInfo.EquipList.LastOrDefault() is null or { Weapon: null })
if (equipTest?.Weapon is null)
{ {
// 不存在武器则添加 // 不存在武器则添加
avatarInfo.EquipList.Add(new()); avatarInfo.EquipList.Add(new());
@@ -45,17 +44,21 @@ internal sealed class GameRecordCharacterAvatarInfoTransformer : IAvatarInfoTran
Equip equip = avatarInfo.EquipList.Last(); Equip equip = avatarInfo.EquipList.Last();
equip.ItemId = source.Weapon.Id; if (equip.ItemId != source.Weapon.Id)
equip.Weapon = new()
{ {
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 // Special case here, don't set EQUIP_WEAPON
equip.Flat = new() { ItemType = ItemType.ITEM_WEAPON, }; equip.Flat = new() { ItemType = ItemType.ITEM_WEAPON, };
}
} }
} }