When addin a custom weapon, add it to weapon shelf whitelist
This commit is contained in:
parent
dac3588a1d
commit
f48f1b0c6f
@ -2,6 +2,8 @@ import { inject, injectable } from "tsyringe";
|
|||||||
|
|
||||||
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
|
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
|
||||||
import { ITemplateItem, Props } from "@spt-aki/models/eft/common/tables/ITemplateItem";
|
import { ITemplateItem, Props } from "@spt-aki/models/eft/common/tables/ITemplateItem";
|
||||||
|
import { BaseClasses } from "@spt-aki/models/enums/BaseClasses";
|
||||||
|
import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas";
|
||||||
import {
|
import {
|
||||||
CreateItemResult,
|
CreateItemResult,
|
||||||
LocaleDetails,
|
LocaleDetails,
|
||||||
@ -72,6 +74,11 @@ export class CustomItemService
|
|||||||
|
|
||||||
this.addToFleaPriceDb(newItemId, newItemDetails.fleaPriceRoubles);
|
this.addToFleaPriceDb(newItemId, newItemDetails.fleaPriceRoubles);
|
||||||
|
|
||||||
|
if (this.itemHelper.isOfBaseclass(itemClone._id, BaseClasses.WEAPON))
|
||||||
|
{
|
||||||
|
this.addToWeaponShelf(newItemId);
|
||||||
|
}
|
||||||
|
|
||||||
result.success = true;
|
result.success = true;
|
||||||
result.itemId = newItemId;
|
result.itemId = newItemId;
|
||||||
|
|
||||||
@ -200,6 +207,26 @@ export class CustomItemService
|
|||||||
this.tables.templates.prices[newItemId] = fleaPriceRoubles;
|
this.tables.templates.prices[newItemId] = fleaPriceRoubles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a weapon to the hideout weapon shelf whitelist
|
||||||
|
* @param newItemId Weapon id to add
|
||||||
|
*/
|
||||||
|
protected addToWeaponShelf(newItemId: string): void
|
||||||
|
{
|
||||||
|
this.databaseServer.getTables().templates.items;
|
||||||
|
|
||||||
|
// Ids for wall stashes in db
|
||||||
|
const wallStashIds = ["6401c7b213d9b818bf0e7dd7", "64381b582bb1c5dedd0fc925", "64381b6e44b37a080d0245b9"];
|
||||||
|
for (const wallId of wallStashIds)
|
||||||
|
{
|
||||||
|
const wall = this.itemHelper.getItem(wallId);
|
||||||
|
if (wall[0])
|
||||||
|
{
|
||||||
|
wall[1]._props.Grids[0]._props.filters[0].Filter.push(newItemId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a custom weapon to PMCs loadout
|
* Add a custom weapon to PMCs loadout
|
||||||
* @param weaponTpl Custom weapon tpl to add to PMCs
|
* @param weaponTpl Custom weapon tpl to add to PMCs
|
||||||
|
Loading…
Reference in New Issue
Block a user