another Inventory.Do fix

This commit is contained in:
rfi 2024-01-17 22:54:02 +07:00
parent d94f60c09e
commit 7bb8a962af
1 changed files with 4 additions and 4 deletions

View File

@ -78,19 +78,19 @@ namespace AscNet.Common.Database
if (item is not null && itemTable is not null)
{
if (itemTable.MaxCount <= item.Count + amount && item.Count + amount >= 0)
if (item.Count + amount <= itemTable.MaxCount && item.Count + amount >= 0)
{
item.Count += amount;
item.RefreshTime = DateTimeOffset.Now.ToUnixTimeSeconds();
}
else if (itemTable.MaxCount <= item.Count + amount)
else if (item.Count + amount < 0)
{
item.Count = itemTable.MaxCount ?? item.Count + amount;
item.Count = 0;
item.RefreshTime = DateTimeOffset.Now.ToUnixTimeSeconds();
}
else
{
item.Count = 0;
item.Count = itemTable.MaxCount ?? item.Count + amount;
item.RefreshTime = DateTimeOffset.Now.ToUnixTimeSeconds();
}
}