mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 09:50:43 -05:00
Generate ammo box Ragfair offers with cartridges (!198)
#### TL;DR Previously, Ragfair offers involving ammo boxes weren't generated with cartridges inside of them. This copies a lot of the logic from `InventoryHelper.hydrateAmmoBoxWithAmmo()` to add ammo to offers when they are generated. Made to fix #312. #### Testing Purchased various ammo boxes from Flea:  Purchased ammo boxes are listed as full:  Unloading them produces correct ammunition:  Co-authored-by: Spoony <Spoony@example.com> Reviewed-on: SPT-AKI/Server#198 Co-authored-by: Spoony <spoony@noreply.dev.sp-tarkov.com> Co-committed-by: Spoony <spoony@noreply.dev.sp-tarkov.com>
This commit is contained in:
parent
2787b25c8d
commit
e1a8f26507
@ -119,6 +119,14 @@ export class RagfairOfferGenerator
|
|||||||
offerRequirements.push(requirement);
|
offerRequirements.push(requirement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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]);
|
||||||
|
}
|
||||||
|
|
||||||
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));
|
||||||
|
|
||||||
@ -136,7 +144,7 @@ export class RagfairOfferGenerator
|
|||||||
avatar: this.getAvatarUrl(isTrader, userID),
|
avatar: this.getAvatarUrl(isTrader, userID),
|
||||||
},
|
},
|
||||||
root: items[0]._id,
|
root: items[0]._id,
|
||||||
items: this.jsonUtil.clone(items),
|
items: itemsClone,
|
||||||
requirements: offerRequirements,
|
requirements: offerRequirements,
|
||||||
requirementsCost: roublePrice,
|
requirementsCost: roublePrice,
|
||||||
itemsCost: Math.round(this.handbookHelper.getTemplatePrice(items[0]._tpl)), // Handbook price
|
itemsCost: Math.round(this.handbookHelper.getTemplatePrice(items[0]._tpl)), // Handbook price
|
||||||
|
Loading…
x
Reference in New Issue
Block a user