From 3b41ddafe801fa7b1372578a7fffa7968a0be700 Mon Sep 17 00:00:00 2001 From: moonheart Date: Tue, 4 Jun 2024 06:52:57 +0200 Subject: [PATCH] break if present is exchange item --- MementoMori/MementoMoriFuncs.Ops.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/MementoMori/MementoMoriFuncs.Ops.cs b/MementoMori/MementoMoriFuncs.Ops.cs index ecd84c9..57c243e 100644 --- a/MementoMori/MementoMoriFuncs.Ops.cs +++ b/MementoMori/MementoMoriFuncs.Ops.cs @@ -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) { @@ -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(new CastRequest {UserEquipment = new UserEquipment(presentItem.Key.ItemId, useCount)}); + var response = await GetResponse(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