Skip to content

Commit

Permalink
break if present is exchange item
Browse files Browse the repository at this point in the history
  • Loading branch information
moonheart committed Jun 4, 2024
1 parent 58773ad commit 3b41dda
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions MementoMori/MementoMoriFuncs.Ops.cs
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ await ExecuteQuickAction(async (log, token) =>
catch (ApiErrorException e) when (e.ErrorCode == ErrorCode.PresentReceiveOverLimitCountPresent)
{
log(e.Message);
foreach (var presentItem in getListResponse.userPresentDtoInfos.SelectMany(d => d.ItemList).GroupBy(d => new {d.Item.ItemType, d.Item.ItemId}))
var containsExchangeItem = false;
foreach (var presentItem in getListResponse.userPresentDtoInfos.SelectMany(d => d.ItemList).GroupBy(d => new { d.Item.ItemType, d.Item.ItemId }))
{
if (presentItem.Key.ItemType == ItemType.QuestQuickTicket)
{
Expand Down Expand Up @@ -418,11 +419,22 @@ await ExecuteQuickAction(async (log, token) =>
var name = TextResourceTable.Get(EquipmentTable.GetById(presentItem.Key.ItemId).NameKey);
var useCount = (int) Math.Floor(maxItemCount * 0.1);
log($"{ResourceStrings.UseOverLimitItem}: {name}×{useCount}, {count}/{maxItemCount}");
var response = await GetResponse<CastRequest, CastResponse>(new CastRequest {UserEquipment = new UserEquipment(presentItem.Key.ItemId, useCount)});
var response = await GetResponse<CastRequest, CastResponse>(new CastRequest { UserEquipment = new UserEquipment(presentItem.Key.ItemId, useCount) });
response.ResultItemList.PrintUserItems(log);
usedItem = true;
break;
}

if (presentItem.Key.ItemType == ItemType.ExchangePlaceItem)
{
containsExchangeItem = true;
continue;
}
}

if (!usedItem && containsExchangeItem)
{
usedItem = true;
}
}
else
Expand Down

0 comments on commit 3b41dda

Please sign in to comment.