Allow custom item server to add weapons to weapon shelf
This commit is contained in:
parent
cd830e4303
commit
8984711cba
@ -2,6 +2,7 @@ import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
|
||||
import { ITemplateItem, Props } from "@spt-aki/models/eft/common/tables/ITemplateItem";
|
||||
import { BaseClasses } from "@spt-aki/models/enums/BaseClasses";
|
||||
import {
|
||||
CreateItemResult,
|
||||
LocaleDetails,
|
||||
@ -72,6 +73,11 @@ export class CustomItemService
|
||||
|
||||
this.addToFleaPriceDb(newItemId, newItemDetails.fleaPriceRoubles);
|
||||
|
||||
if (this.itemHelper.isOfBaseclass(itemClone._id, BaseClasses.WEAPON))
|
||||
{
|
||||
this.addToWeaponShelf(newItemId);
|
||||
}
|
||||
|
||||
result.success = true;
|
||||
result.itemId = newItemId;
|
||||
|
||||
@ -109,6 +115,11 @@ export class CustomItemService
|
||||
|
||||
this.addToFleaPriceDb(newItem._id, newItemDetails.fleaPriceRoubles);
|
||||
|
||||
if (this.itemHelper.isOfBaseclass(newItem._id, BaseClasses.WEAPON))
|
||||
{
|
||||
this.addToWeaponShelf(newItem._id);
|
||||
}
|
||||
|
||||
result.itemId = newItemDetails.newItem._id;
|
||||
result.success = true;
|
||||
|
||||
@ -200,6 +211,26 @@ export class CustomItemService
|
||||
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
|
||||
* @param weaponTpl Custom weapon tpl to add to PMCs
|
||||
|
Loading…
x
Reference in New Issue
Block a user