1
0
mirror of https://github.com/wangdage12/Snap.Hutao.git synced 2026-06-06 09:51:06 +08:00

修复审查问题

This commit is contained in:
mfkvfhpdx
2026-05-04 17:05:54 +08:00
parent 57461a06dd
commit a02d7e533f

View File

@@ -105,7 +105,18 @@ internal sealed partial class InventoryService : IInventoryService
{
static IEnumerable<InventoryItem> ToInventoryItems(ImmutableArray<Item> consumeItems, Guid projectId)
{
return consumeItems.SelectAsArray(static (item, pid) => InventoryItem.From(pid, item.Id, (uint)((int)item.Num - item.LackNum)), projectId);
static uint ToSafeCount(Item item)
{
long delta = (long)item.Num - item.LackNum;
if (delta <= 0)
{
return 0U;
}
return delta >= uint.MaxValue ? uint.MaxValue : (uint)delta;
}
return consumeItems.SelectAsArray(static (item, pid) => InventoryItem.From(pid, item.Id, ToSafeCount(item)), projectId);
}
if (syncToAllProjects)