Fix fence item not being removed after purchase

This commit is contained in:
Dev 2024-02-02 17:22:12 +00:00
parent e6e77d49a5
commit 796d63b3e2

View File

@ -904,6 +904,7 @@ export class FenceService
*/ */
public amendOrRemoveFenceOffer(assortId: string, buyCount: number): void public amendOrRemoveFenceOffer(assortId: string, buyCount: number): void
{ {
let isNormalAssort = true;
let fenceAssortItem = this.fenceAssort.items.find(item => item._id === assortId); let fenceAssortItem = this.fenceAssort.items.find(item => item._id === assortId);
if (!fenceAssortItem) if (!fenceAssortItem)
{ {
@ -915,12 +916,13 @@ export class FenceService
return; return;
} }
isNormalAssort = false;
} }
// Player wants to buy whole stack, delete stack // Player wants to buy whole stack, delete stack
if (fenceAssortItem.upd.StackObjectsCount === buyCount) if (fenceAssortItem.upd.StackObjectsCount === buyCount)
{ {
this.deleteOffer(assortId, this.fenceAssort.items); this.deleteOffer(assortId, isNormalAssort ? this.fenceAssort.items : this.fenceDiscountAssort.items);
return; return;
} }