Call itemBaseClassService.hydrateItemBaseClassCache() as part of adding custom item

This commit is contained in:
Dev 2024-03-16 13:11:17 +00:00
parent 64f644c417
commit ab2018c13f

View File

@ -12,6 +12,7 @@ import {
import { IDatabaseTables } from "@spt-aki/models/spt/server/IDatabaseTables";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { ItemBaseClassService } from "@spt-aki/services/ItemBaseClassService";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
@ -26,6 +27,7 @@ export class CustomItemService
@inject("JsonUtil") protected jsonUtil: JsonUtil,
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
@inject("ItemHelper") protected itemHelper: ItemHelper,
@inject("ItemBaseClassService") protected itemBaseClassService: ItemBaseClassService,
)
{
this.tables = this.databaseServer.getTables();
@ -73,6 +75,8 @@ export class CustomItemService
this.addToFleaPriceDb(newItemId, newItemDetails.fleaPriceRoubles);
this.itemBaseClassService.hydrateItemBaseClassCache();
if (this.itemHelper.isOfBaseclass(itemClone._id, BaseClasses.WEAPON))
{
this.addToWeaponShelf(newItemId);
@ -115,6 +119,8 @@ export class CustomItemService
this.addToFleaPriceDb(newItem._id, newItemDetails.fleaPriceRoubles);
this.itemBaseClassService.hydrateItemBaseClassCache();
if (this.itemHelper.isOfBaseclass(newItem._id, BaseClasses.WEAPON))
{
this.addToWeaponShelf(newItem._id);