From 3c113ddf7f1247bb86714bb5d61e7828170aaa40 Mon Sep 17 00:00:00 2001 From: Kaeno Date: Mon, 26 Feb 2024 16:32:56 +0000 Subject: [PATCH] Fixed ammobox breaking client + profile due to ragfair refresh adding extra ammo to ammo boxes --- project/src/generators/RagfairOfferGenerator.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/project/src/generators/RagfairOfferGenerator.ts b/project/src/generators/RagfairOfferGenerator.ts index 397cecd6..f8e26d8f 100644 --- a/project/src/generators/RagfairOfferGenerator.ts +++ b/project/src/generators/RagfairOfferGenerator.ts @@ -126,10 +126,15 @@ export class RagfairOfferGenerator const itemsClone = this.jsonUtil.clone(items); + // Add cartridges to offers for ammo boxes if (this.itemHelper.isOfBaseclass(itemsClone[0]._tpl, BaseClasses.AMMO_BOX)) { - this.itemHelper.addCartridgesToAmmoBox(itemsClone, this.itemHelper.getItem(items[0]._tpl)[1]); + // On offer refresh dont re-add cartidges to ammobox that already has cartidges + if (Object.keys(itemsClone).length === 1) + { + this.itemHelper.addCartridgesToAmmoBox(itemsClone, this.itemHelper.getItem(items[0]._tpl)[1]); + } } const itemCount = items.filter((x) => x.slotId === "hideout").length;