Fixed ammobox breaking client + profile due to ragfair refresh adding extra ammo to ammo boxes

This commit is contained in:
Kaeno 2024-02-26 16:32:56 +00:00
parent 3c0471b288
commit 3c113ddf7f

View File

@ -126,11 +126,16 @@ export class RagfairOfferGenerator
const itemsClone = this.jsonUtil.clone(items); const itemsClone = this.jsonUtil.clone(items);
// Add cartridges to offers for ammo boxes // Add cartridges to offers for ammo boxes
if (this.itemHelper.isOfBaseclass(itemsClone[0]._tpl, BaseClasses.AMMO_BOX)) if (this.itemHelper.isOfBaseclass(itemsClone[0]._tpl, BaseClasses.AMMO_BOX))
{
// 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]); this.itemHelper.addCartridgesToAmmoBox(itemsClone, this.itemHelper.getItem(items[0]._tpl)[1]);
} }
}
const itemCount = items.filter((x) => x.slotId === "hideout").length; const itemCount = items.filter((x) => x.slotId === "hideout").length;
const roublePrice = Math.round(this.convertOfferRequirementsIntoRoubles(offerRequirements)); const roublePrice = Math.round(this.convertOfferRequirementsIntoRoubles(offerRequirements));