Add system to override handbook price, add christmas gift items small/med/large
This commit is contained in:
parent
72345abb4a
commit
7bc9fdbe95
@ -92,5 +92,10 @@
|
|||||||
"5efde6b4f5448336730dbd61",
|
"5efde6b4f5448336730dbd61",
|
||||||
"609e860ebd219504d8507525",
|
"609e860ebd219504d8507525",
|
||||||
"63626d904aa74b8fe30ab426"
|
"63626d904aa74b8fe30ab426"
|
||||||
]
|
],
|
||||||
|
"handbookPriceOverride": {
|
||||||
|
"63a8970d7108f713591149f5": 1000,
|
||||||
|
"63a898a328e385334e0640a5": 5000,
|
||||||
|
"63a897c6b1ff6e29734fcc95": 10000
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,10 @@ import { inject, injectable } from "tsyringe";
|
|||||||
|
|
||||||
import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase";
|
import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase";
|
||||||
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
|
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 { 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 { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
|
||||||
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
|
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
|
||||||
|
|
||||||
@ -33,14 +36,18 @@ export class LookupCollection
|
|||||||
@injectable()
|
@injectable()
|
||||||
export class HandbookHelper
|
export class HandbookHelper
|
||||||
{
|
{
|
||||||
|
protected itemConfig: IItemConfig;
|
||||||
protected lookupCacheGenerated = false;
|
protected lookupCacheGenerated = false;
|
||||||
protected handbookPriceCache = new LookupCollection();
|
protected handbookPriceCache = new LookupCollection();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||||
@inject("JsonUtil") protected jsonUtil: JsonUtil,
|
@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
|
* 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;
|
this.lookupCacheGenerated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.itemConfig.handbookPriceOverride[tpl])
|
||||||
|
{
|
||||||
|
return this.itemConfig.handbookPriceOverride[tpl];
|
||||||
|
}
|
||||||
|
|
||||||
if (this.handbookPriceCache.items.byId.has(tpl))
|
if (this.handbookPriceCache.items.byId.has(tpl))
|
||||||
{
|
{
|
||||||
return this.handbookPriceCache.items.byId.get(tpl);
|
return this.handbookPriceCache.items.byId.get(tpl);
|
||||||
|
@ -7,4 +7,5 @@ export interface IItemConfig extends IBaseConfig
|
|||||||
blacklist: string[];
|
blacklist: string[];
|
||||||
/** Items that can only be found on bosses */
|
/** Items that can only be found on bosses */
|
||||||
bossItems: string[];
|
bossItems: string[];
|
||||||
|
handbookPriceOverride: Record<string, number>;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user