Fix ammo packs not showing on fence
This commit is contained in:
parent
d352f678b3
commit
2965709535
@ -120,7 +120,8 @@
|
|||||||
"5b3f15d486f77432d0509248": 3,
|
"5b3f15d486f77432d0509248": 3,
|
||||||
"543be6564bdc2df4348b4568": 0,
|
"543be6564bdc2df4348b4568": 0,
|
||||||
"5448ecbe4bdc2d60728b4568": 0,
|
"5448ecbe4bdc2d60728b4568": 0,
|
||||||
"5671435f4bdc2d96058b4569": 0
|
"5671435f4bdc2d96058b4569": 0,
|
||||||
|
"543be5cb4bdc2deb348b4568": 3
|
||||||
},
|
},
|
||||||
"weaponDurabilityPercentMinMax": {
|
"weaponDurabilityPercentMinMax": {
|
||||||
"current": {
|
"current": {
|
||||||
@ -205,7 +206,8 @@
|
|||||||
"616eb7aea207f41933308f46": 40000,
|
"616eb7aea207f41933308f46": 40000,
|
||||||
"5b3f15d486f77432d0509248": 5000,
|
"5b3f15d486f77432d0509248": 5000,
|
||||||
"5448f3ac4bdc2dce718b4569": 42000,
|
"5448f3ac4bdc2dce718b4569": 42000,
|
||||||
"5448f3a14bdc2d27728b4569": 20000
|
"5448f3a14bdc2d27728b4569": 20000,
|
||||||
|
"543be5cb4bdc2deb348b4568": 15000
|
||||||
},
|
},
|
||||||
"presetSlotsToRemoveChancePercent": {
|
"presetSlotsToRemoveChancePercent": {
|
||||||
"mod_scope": 70,
|
"mod_scope": 70,
|
||||||
|
@ -105,13 +105,12 @@ export class FenceBaseAssortGenerator
|
|||||||
if (itemWithChildrenToAdd.length > 1)
|
if (itemWithChildrenToAdd.length > 1)
|
||||||
{
|
{
|
||||||
this.itemHelper.reparentItemAndChildren(itemWithChildrenToAdd[0], itemWithChildrenToAdd);
|
this.itemHelper.reparentItemAndChildren(itemWithChildrenToAdd[0], itemWithChildrenToAdd);
|
||||||
|
itemWithChildrenToAdd[0].parentId = "hideout";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create barter scheme (price)
|
// Create barter scheme (price)
|
||||||
const barterSchemeToAdd: IBarterScheme = {
|
const barterSchemeToAdd: IBarterScheme = {
|
||||||
count: Math.round(
|
count: Math.round(this.getItemPrice(rootItemDb._id, itemWithChildrenToAdd)),
|
||||||
this.handbookHelper.getTemplatePrice(rootItemDb._id) * this.traderConfig.fence.itemPriceMult,
|
|
||||||
),
|
|
||||||
_tpl: Money.ROUBLES,
|
_tpl: Money.ROUBLES,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -176,6 +175,27 @@ export class FenceBaseAssortGenerator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected getItemPrice(itemTpl: string, items: Item[]): number
|
||||||
|
{
|
||||||
|
return this.itemHelper.isOfBaseclass(itemTpl, BaseClasses.AMMO_BOX)
|
||||||
|
? this.getAmmoBoxPrice(items) * this.traderConfig.fence.itemPriceMult
|
||||||
|
: this.handbookHelper.getTemplatePrice(itemTpl) * this.traderConfig.fence.itemPriceMult;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getAmmoBoxPrice(items: Item[]): number
|
||||||
|
{
|
||||||
|
let total = 0;
|
||||||
|
for (const item of items)
|
||||||
|
{
|
||||||
|
if (this.itemHelper.isOfBaseclass(item._tpl, BaseClasses.AMMO))
|
||||||
|
{
|
||||||
|
total += this.handbookHelper.getTemplatePrice(item._tpl) * (item.upd.StackObjectsCount ?? 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add soft inserts + armor plates to an armor
|
* Add soft inserts + armor plates to an armor
|
||||||
* @param armor Armor item array to add mods into
|
* @param armor Armor item array to add mods into
|
||||||
|
Loading…
Reference in New Issue
Block a user