Add system to override handbook price, add christmas gift items small/med/large

This commit is contained in:
Dev 2024-02-06 12:16:26 +00:00
parent 72345abb4a
commit 7bc9fdbe95
3 changed files with 20 additions and 2 deletions

View File

@ -92,5 +92,10 @@
"5efde6b4f5448336730dbd61",
"609e860ebd219504d8507525",
"63626d904aa74b8fe30ab426"
]
],
"handbookPriceOverride": {
"63a8970d7108f713591149f5": 1000,
"63a898a328e385334e0640a5": 5000,
"63a897c6b1ff6e29734fcc95": 10000
}
}

View File

@ -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);

View File

@ -7,4 +7,5 @@ export interface IItemConfig extends IBaseConfig
blacklist: string[];
/** Items that can only be found on bosses */
bossItems: string[];
handbookPriceOverride: Record<string, number>;
}