From eea9825723bd8de8338cfbd0dcc164ec5ffa0ab7 Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Wed, 17 Jan 2024 23:13:35 +0100 Subject: [PATCH] Fix logic when buying a limited amount of items with stacksize 99 --- Deliveroo/Deliveroo.csproj | 2 +- Deliveroo/DeliverooPlugin.Exchange.cs | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Deliveroo/Deliveroo.csproj b/Deliveroo/Deliveroo.csproj index 461d967..1ccaeee 100644 --- a/Deliveroo/Deliveroo.csproj +++ b/Deliveroo/Deliveroo.csproj @@ -1,7 +1,7 @@ net7.0-windows - 2.25 + 2.26 11.0 enable true diff --git a/Deliveroo/DeliverooPlugin.Exchange.cs b/Deliveroo/DeliverooPlugin.Exchange.cs index 2eb9616..de6a4da 100644 --- a/Deliveroo/DeliverooPlugin.Exchange.cs +++ b/Deliveroo/DeliverooPlugin.Exchange.cs @@ -30,11 +30,15 @@ partial class DeliverooPlugin { foreach (PurchaseItemRequest request in _itemsToPurchaseNow) { - int offset = 0; + int toBuy = 0; if (request == previousRequest) - offset = (int)request.StackSize; + { + toBuy = (int)request.StackSize; + if (request.ItemId != ItemIds.Venture && !_configuration.IgnoreCertainLimitations) + toBuy = Math.Min(toBuy, 99); + } - if (GetItemCount(request.ItemId) + offset < request.EffectiveLimit) + if (GetItemCount(request.ItemId) + toBuy < request.EffectiveLimit) return request; }