From f48f1b0c6f454f5720c19bfa1b2a3a9905f14f83 Mon Sep 17 00:00:00 2001 From: Dev Date: Sun, 31 Dec 2023 10:04:12 +0000 Subject: [PATCH] When addin a custom weapon, add it to weapon shelf whitelist --- project/src/services/mod/CustomItemService.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/project/src/services/mod/CustomItemService.ts b/project/src/services/mod/CustomItemService.ts index 2e73f7bb..e3cd1370 100644 --- a/project/src/services/mod/CustomItemService.ts +++ b/project/src/services/mod/CustomItemService.ts @@ -2,6 +2,8 @@ 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 { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas"; import { CreateItemResult, LocaleDetails, @@ -72,6 +74,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; @@ -200,6 +207,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