diff --git a/project/assets/configs/item.json b/project/assets/configs/item.json index aadbaf48..53a58727 100644 --- a/project/assets/configs/item.json +++ b/project/assets/configs/item.json @@ -92,5 +92,10 @@ "5efde6b4f5448336730dbd61", "609e860ebd219504d8507525", "63626d904aa74b8fe30ab426" - ] + ], + "handbookPriceOverride": { + "63a8970d7108f713591149f5": 1000, + "63a898a328e385334e0640a5": 5000, + "63a897c6b1ff6e29734fcc95": 10000 + } } diff --git a/project/src/helpers/HandbookHelper.ts b/project/src/helpers/HandbookHelper.ts index 3c46baae..563f0b2f 100644 --- a/project/src/helpers/HandbookHelper.ts +++ b/project/src/helpers/HandbookHelper.ts @@ -2,7 +2,10 @@ import { inject, injectable } from "tsyringe"; import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import { Item } from "@spt-aki/models/eft/common/tables/IItem"; +import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes"; import { Money } from "@spt-aki/models/enums/Money"; +import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; @@ -33,14 +36,18 @@ export class LookupCollection @injectable() export class HandbookHelper { + protected itemConfig: IItemConfig; protected lookupCacheGenerated = false; protected handbookPriceCache = new LookupCollection(); constructor( @inject("DatabaseServer") protected databaseServer: DatabaseServer, @inject("JsonUtil") protected jsonUtil: JsonUtil, + @inject("ConfigServer") protected configServer: ConfigServer, ) - {} + { + this.itemConfig = this.configServer.getConfig(ConfigTypes.ITEM); + } /** * Create an in-memory cache of all items with associated handbook price in handbookPriceCache class @@ -86,6 +93,11 @@ export class HandbookHelper this.lookupCacheGenerated = true; } + if (this.itemConfig.handbookPriceOverride[tpl]) + { + return this.itemConfig.handbookPriceOverride[tpl]; + } + if (this.handbookPriceCache.items.byId.has(tpl)) { return this.handbookPriceCache.items.byId.get(tpl); diff --git a/project/src/models/spt/config/IItemConfig.ts b/project/src/models/spt/config/IItemConfig.ts index 610cd8ee..23c51fe1 100644 --- a/project/src/models/spt/config/IItemConfig.ts +++ b/project/src/models/spt/config/IItemConfig.ts @@ -7,4 +7,5 @@ export interface IItemConfig extends IBaseConfig blacklist: string[]; /** Items that can only be found on bosses */ bossItems: string[]; + handbookPriceOverride: Record; }