mirror of
https://github.com/wangdage12/Snap.Hutao.git
synced 2026-06-06 09:51:06 +08:00
修复审查问题
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user