Fix flea armor not having proper random durability (!223)

Clone flea items prior to passing them off to the createSingleOfferForItem method

This change results in more armor on the flea having 100% durability, and less having identical non-max durability values

Resolves: https://dev.sp-tarkov.com/SPT-AKI/Issues/issues/447

Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/223
Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
This commit is contained in:
DrakiaXYZ 2024-02-13 08:34:55 +00:00 committed by chomp
parent 136117a552
commit bf60fb7ea9

View File

@ -376,17 +376,16 @@ export class RagfairOfferGenerator
const assortSingleOfferProcesses = []; const assortSingleOfferProcesses = [];
for (let index = 0; index < offerCount; index++) for (let index = 0; index < offerCount; index++)
{ {
if (!isPreset) // Clone the item so we don't have shared references and generate new item IDs
{ const clonedAssort = this.jsonUtil.clone(assortItemWithChildren);
// Presets get unique id generated during getPresetItems() earlier + would require regenerating all children to match this.itemHelper.reparentItemAndChildren(clonedAssort[0], clonedAssort);
assortItemWithChildren[0]._id = this.hashUtil.generate();
}
delete assortItemWithChildren[0].parentId; // Clear unnecessary properties
delete assortItemWithChildren[0].slotId; delete clonedAssort[0].parentId;
delete clonedAssort[0].slotId;
assortSingleOfferProcesses.push( assortSingleOfferProcesses.push(
this.createSingleOfferForItem(assortItemWithChildren, isPreset, itemDetails), this.createSingleOfferForItem(clonedAssort, isPreset, itemDetails),
); );
} }