1
0
forked from liza/Deliveroo

Fix logic when buying a limited amount of items with stacksize 99

This commit is contained in:
Liza 2024-01-17 23:13:35 +01:00
parent fe4637e941
commit eea9825723
Signed by: liza
GPG Key ID: 7199F8D727D55F67
2 changed files with 8 additions and 4 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework> <TargetFramework>net7.0-windows</TargetFramework>
<Version>2.25</Version> <Version>2.26</Version>
<LangVersion>11.0</LangVersion> <LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

View File

@ -30,11 +30,15 @@ partial class DeliverooPlugin
{ {
foreach (PurchaseItemRequest request in _itemsToPurchaseNow) foreach (PurchaseItemRequest request in _itemsToPurchaseNow)
{ {
int offset = 0; int toBuy = 0;
if (request == previousRequest) 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; return request;
} }