Update types

This commit is contained in:
Dev 2024-03-31 16:47:39 +01:00
parent 909898ea04
commit b992eaf33e
504 changed files with 2304 additions and 1944 deletions

View File

@ -15,6 +15,7 @@ import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails";
import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile";
import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig";
import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig";
import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig";
import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig";
import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig";
import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig";
@ -60,6 +61,7 @@ export declare class GameController {
protected coreConfig: ICoreConfig; protected coreConfig: ICoreConfig;
protected locationConfig: ILocationConfig; protected locationConfig: ILocationConfig;
protected ragfairConfig: IRagfairConfig; protected ragfairConfig: IRagfairConfig;
protected hideoutConfig: IHideoutConfig;
protected pmcConfig: IPmcConfig; protected pmcConfig: IPmcConfig;
protected lootConfig: ILootConfig; protected lootConfig: ILootConfig;
protected botConfig: IBotConfig; protected botConfig: IBotConfig;

View File

@ -222,14 +222,6 @@ export declare class HideoutController {
* @param output Output object to update * @param output Output object to update
*/ */
protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void;
/**
* Start area production for item by adding production to profiles' Hideout.Production array
* @param pmcData Player profile
* @param request Start production request
* @param sessionID Session id
* @returns IItemEventRouterResponse
*/
registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse;
/** /**
* Get quick time event list for hideout * Get quick time event list for hideout
* // TODO - implement this * // TODO - implement this

View File

@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre
import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState";
import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig";
import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig";
import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig";
import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig";
import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig";
import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig";
@ -60,6 +61,7 @@ export declare class InraidController {
protected traderConfig: ITraderConfig; protected traderConfig: ITraderConfig;
protected locationConfig: ILocationConfig; protected locationConfig: ILocationConfig;
protected ragfairConfig: IRagfairConfig; protected ragfairConfig: IRagfairConfig;
protected hideoutConfig: IHideoutConfig;
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil);
/** /**
* Save locationId to active profiles inraid object AND app context * Save locationId to active profiles inraid object AND app context

View File

@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper";
import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper";
import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase";
import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType";
import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails";
import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig";

View File

@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti
import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData";
import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData";
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
import { SkillTypes } from "@spt-aki/models/enums/SkillTypes";
import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder";
@ -149,14 +150,19 @@ export declare class HideoutHelper {
* @param isGeneratorOn Is the generator turned on since last update * @param isGeneratorOn Is the generator turned on since last update
*/ */
protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void;
protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: {
btcFarmCGs: number;
isGeneratorOn: boolean;
waterCollectorHasFilter: boolean;
}): void;
/** /**
* Get craft time and make adjustments to account for dev profile + crafting skill level * Get craft time and make adjustments to account for dev profile + crafting skill level
* @param pmcData Player profile making craft * @param pmcData Player profile making craft
* @param recipeId Recipe being crafted * @param recipeId Recipe being crafted
* @returns * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation
* @returns Items craft time with bonuses subtracted
*/ */
protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string): number; protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number;
/** /**
* Adjust water filter objects resourceValue or delete when they reach 0 resource * Adjust water filter objects resourceValue or delete when they reach 0 resource
* @param waterFilterArea water filter area to update * @param waterFilterArea water filter area to update
@ -174,7 +180,7 @@ export declare class HideoutHelper {
* @param baseFilterDrainRate Base drain rate * @param baseFilterDrainRate Base drain rate
* @returns drain rate (adjusted) * @returns drain rate (adjusted)
*/ */
protected getAdjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number;
/** /**
* Get the water filter drain rate based on hideout bonues player has * Get the water filter drain rate based on hideout bonues player has
* @param pmcData Player profile * @param pmcData Player profile
@ -229,12 +235,21 @@ export declare class HideoutHelper {
*/ */
protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number;
/** /**
* Adjust craft time based on crafting skill level found in player profile * Get a multipler based on players skill level and value per level
* @param pmcData Player profile
* @param skill Player skill from profile
* @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel`
* @returns Multipler from 0 to 1
*/
protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number;
/**
* @param pmcData Player profile * @param pmcData Player profile
* @param productionTime Time to complete hideout craft in seconds * @param productionTime Time to complete hideout craft in seconds
* @returns Adjusted craft time in seconds * @param skill Skill bonus to get reduction from
* @param amountPerLevel Skill bonus amount to apply
* @returns Seconds to reduce craft time by
*/ */
getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number;
isProduction(productive: Productive): productive is Production; isProduction(productive: Productive): productive is Production;
/** /**
* Gather crafted BTC from hideout area and add to inventory * Gather crafted BTC from hideout area and add to inventory

View File

@ -167,7 +167,7 @@ export declare class ProfileHelper {
/** /**
* Get a speciic common skill from supplied profile * Get a speciic common skill from supplied profile
* @param pmcData Player profile * @param pmcData Player profile
* @param skill Skill get get * @param skill Skill to look up and return value from
* @returns Common skill object from desired profile * @returns Common skill object from desired profile
*/ */
getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common;

View File

@ -56,13 +56,6 @@ export declare class TradeHelper {
* @param output IItemEventRouterResponse * @param output IItemEventRouterResponse
*/ */
sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void;
/**
* Increment the assorts buy count by number of items purchased
* Show error on screen if player attempts to buy more than what the buy max allows
* @param assortBeingPurchased assort being bought
* @param itemsPurchasedCount number of items being bought
*/
protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void;
/** /**
* Traders allow a limited number of purchases per refresh cycle (default 60 mins) * Traders allow a limited number of purchases per refresh cycle (default 60 mins)
* @param sessionId Session id * @param sessionId Session id

View File

@ -121,7 +121,7 @@ export declare class TraderHelper {
count: number; count: number;
}[]; }[];
traderId: string; traderId: string;
}): void; }, itemPurchased: Item): void;
/** /**
* Get the highest rouble price for an item from traders * Get the highest rouble price for an item from traders
* UNUSED * UNUSED

View File

@ -1,32 +1,33 @@
import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper";
import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService";
import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { VFS } from "@spt-aki/utils/VFS"; import { VFS } from "@spt-aki/utils/VFS";
export declare class BundleInfo { export declare class BundleInfo {
modPath: string; modpath: string;
key: string; filename: string;
path: string; crc: number;
filepath: string; dependencies: string[];
dependencyKeys: string[]; constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number);
constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string);
} }
export declare class BundleLoader { export declare class BundleLoader {
protected httpServerHelper: HttpServerHelper; protected httpServerHelper: HttpServerHelper;
protected vfs: VFS; protected vfs: VFS;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected bundleHashCacheService: BundleHashCacheService;
protected bundles: Record<string, BundleInfo>; protected bundles: Record<string, BundleInfo>;
constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService);
/** /**
* Handle singleplayer/bundles * Handle singleplayer/bundles
*/ */
getBundles(local: boolean): BundleInfo[]; getBundles(): BundleInfo[];
getBundle(key: string, local: boolean): BundleInfo; getBundle(key: string): BundleInfo;
addBundles(modpath: string): void; addBundles(modpath: string): void;
addBundle(key: string, b: BundleInfo): void; addBundle(key: string, b: BundleInfo): void;
} }
export interface BundleManifest { export interface BundleManifest {
manifest: Array<BundleManifestEntry>; manifest: BundleManifestEntry[];
} }
export interface BundleManifestEntry { export interface BundleManifestEntry {
key: string; key: string;
path: string; dependencyKeys: string[];
} }

View File

@ -1,3 +1,7 @@
export interface IBaseConfig { export interface IBaseConfig {
kind: string; kind: string;
} }
export interface IRunIntervalValues {
inRaid: number;
outOfRaid: number;
}

View File

@ -1,7 +1,10 @@
import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig";
export interface IHideoutConfig extends IBaseConfig { export interface IHideoutConfig extends IBaseConfig {
kind: "aki-hideout"; kind: "aki-hideout";
/** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */
runIntervalSeconds: number; runIntervalSeconds: number;
/** Default values used to hydrate `runIntervalSeconds` with */
runIntervalValues: IRunIntervalValues;
hoursForSkillCrafting: number; hoursForSkillCrafting: number;
expCraftAmount: number; expCraftAmount: number;
} }

View File

@ -1,5 +1,5 @@
import { MinMax } from "@spt-aki/models/common/MinMax"; import { MinMax } from "@spt-aki/models/common/MinMax";
import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig";
export interface IRagfairConfig extends IBaseConfig { export interface IRagfairConfig extends IBaseConfig {
kind: "aki-ragfair"; kind: "aki-ragfair";
/** How many seconds should pass before expired offers and procesed + player offers checked if sold */ /** How many seconds should pass before expired offers and procesed + player offers checked if sold */
@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig {
traders: Record<string, boolean>; traders: Record<string, boolean>;
dynamic: Dynamic; dynamic: Dynamic;
} }
export interface IRunIntervalValues {
inRaid: number;
outOfRaid: number;
}
export interface Sell { export interface Sell {
/** Should a fee be deducted from player when liting an item for sale */ /** Should a fee be deducted from player when liting an item for sale */
fees: boolean; fees: boolean;

View File

@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig {
tradersResetFromServerStart: boolean; tradersResetFromServerStart: boolean;
updateTimeDefault: number; updateTimeDefault: number;
traderPriceMultipler: number; traderPriceMultipler: number;
/** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */
persistPurchaseDataInProfile: boolean;
fence: FenceConfig; fence: FenceConfig;
} }
export interface UpdateTime { export interface UpdateTime {

View File

@ -1,5 +1,5 @@
/// <reference types="node" /> /// <reference types="node" />
import http, { IncomingMessage, ServerResponse } from "node:http"; import { IncomingMessage, ServerResponse } from "node:http";
import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext";
import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper";
import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig";
@ -25,5 +25,5 @@ export declare class HttpServer {
*/ */
load(): void; load(): void;
protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void;
protected getCookies(req: http.IncomingMessage): Record<string, string>; protected getCookies(req: IncomingMessage): Record<string, string>;
} }

View File

@ -1,30 +0,0 @@
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { VFS } from "@spt-aki/utils/VFS";
export declare class HashCacheService {
protected vfs: VFS;
protected hashUtil: HashUtil;
protected jsonUtil: JsonUtil;
protected logger: ILogger;
protected jsonHashes: any;
protected modHashes: any;
protected readonly modCachePath = "./user/cache/modCache.json";
constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger);
/**
* Return a stored hash by key
* @param modName Name of mod to get hash for
* @returns Mod hash
*/
getStoredModHash(modName: string): string;
/**
* Does the generated hash match the stored hash
* @param modName name of mod
* @param modContent
* @returns True if they match
*/
modContentMatchesStoredHash(modName: string, modContent: string): boolean;
hashMatchesStoredHash(modName: string, modHash: string): boolean;
storeModContent(modName: string, modContent: string): void;
storeModHash(modName: string, modHash: string): void;
}

View File

@ -1,13 +1,13 @@
import ts from "typescript"; import ts from "typescript";
import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { HashCacheService } from "@spt-aki/services/HashCacheService"; import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService";
import { VFS } from "@spt-aki/utils/VFS"; import { VFS } from "@spt-aki/utils/VFS";
export declare class ModCompilerService { export declare class ModCompilerService {
protected logger: ILogger; protected logger: ILogger;
protected hashCacheService: HashCacheService; protected modHashCacheService: ModHashCacheService;
protected vfs: VFS; protected vfs: VFS;
protected serverDependencies: string[]; protected serverDependencies: string[];
constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS);
/** /**
* Convert a mods TS into JS * Convert a mods TS into JS
* @param modName Name of mod * @param modName Name of mod

View File

@ -1,8 +1,8 @@
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
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";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
export declare class TraderServicesService { export declare class TraderServicesService {
protected profileHelper: ProfileHelper; protected profileHelper: ProfileHelper;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;

View File

@ -0,0 +1,18 @@
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { VFS } from "@spt-aki/utils/VFS";
export declare class BundleHashCacheService {
protected vfs: VFS;
protected hashUtil: HashUtil;
protected jsonUtil: JsonUtil;
protected logger: ILogger;
protected bundleHashes: Record<string, number>;
protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json";
constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger);
getStoredValue(key: string): number;
storeValue(key: string, value: number): void;
matchWithStoredHash(bundlePath: string, hash: number): boolean;
calculateAndMatchHash(bundlePath: string): boolean;
calculateAndStoreHash(bundlePath: string): void;
}

View File

@ -0,0 +1,18 @@
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { VFS } from "@spt-aki/utils/VFS";
export declare class ModHashCacheService {
protected vfs: VFS;
protected hashUtil: HashUtil;
protected jsonUtil: JsonUtil;
protected logger: ILogger;
protected modHashes: Record<string, string>;
protected readonly modCachePath = "./user/cache/modCache.json";
constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger);
getStoredValue(key: string): string;
storeValue(key: string, value: string): void;
matchWithStoredHash(modName: string, hash: string): boolean;
calculateAndCompareHash(modName: string, modContent: string): boolean;
calculateAndStoreHash(modName: string, modContent: string): void;
}

View File

@ -1,5 +1,7 @@
/// <reference types="node" /> /// <reference types="node" />
/// <reference types="node" />
import crypto from "node:crypto"; import crypto from "node:crypto";
import fs from "node:fs";
import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil";
export declare class HashUtil { export declare class HashUtil {
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
@ -11,6 +13,7 @@ export declare class HashUtil {
generate(): string; generate(): string;
generateMd5ForData(data: string): string; generateMd5ForData(data: string): string;
generateSha1ForData(data: string): string; generateSha1ForData(data: string): string;
generateCRC32ForFile(filePath: fs.PathLike): number;
/** /**
* Create a hash for the data parameter * Create a hash for the data parameter
* @param algorithm algorithm to use to hash * @param algorithm algorithm to use to hash

View File

@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper";
export declare class HttpFileUtil { export declare class HttpFileUtil {
protected httpServerHelper: HttpServerHelper; protected httpServerHelper: HttpServerHelper;
constructor(httpServerHelper: HttpServerHelper); constructor(httpServerHelper: HttpServerHelper);
sendFile(resp: ServerResponse, file: any): void; sendFile(resp: ServerResponse, filePath: string): void;
} }

View File

@ -15,6 +15,7 @@ import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails";
import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile";
import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig";
import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig";
import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig";
import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig";
import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig";
import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig";
@ -60,6 +61,7 @@ export declare class GameController {
protected coreConfig: ICoreConfig; protected coreConfig: ICoreConfig;
protected locationConfig: ILocationConfig; protected locationConfig: ILocationConfig;
protected ragfairConfig: IRagfairConfig; protected ragfairConfig: IRagfairConfig;
protected hideoutConfig: IHideoutConfig;
protected pmcConfig: IPmcConfig; protected pmcConfig: IPmcConfig;
protected lootConfig: ILootConfig; protected lootConfig: ILootConfig;
protected botConfig: IBotConfig; protected botConfig: IBotConfig;

View File

@ -222,14 +222,6 @@ export declare class HideoutController {
* @param output Output object to update * @param output Output object to update
*/ */
protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void;
/**
* Start area production for item by adding production to profiles' Hideout.Production array
* @param pmcData Player profile
* @param request Start production request
* @param sessionID Session id
* @returns IItemEventRouterResponse
*/
registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse;
/** /**
* Get quick time event list for hideout * Get quick time event list for hideout
* // TODO - implement this * // TODO - implement this

View File

@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre
import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState";
import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig";
import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig";
import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig";
import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig";
import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig";
import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig";
@ -60,6 +61,7 @@ export declare class InraidController {
protected traderConfig: ITraderConfig; protected traderConfig: ITraderConfig;
protected locationConfig: ILocationConfig; protected locationConfig: ILocationConfig;
protected ragfairConfig: IRagfairConfig; protected ragfairConfig: IRagfairConfig;
protected hideoutConfig: IHideoutConfig;
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil);
/** /**
* Save locationId to active profiles inraid object AND app context * Save locationId to active profiles inraid object AND app context

View File

@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper";
import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper";
import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase";
import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType";
import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails";
import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig";

View File

@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti
import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData";
import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData";
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
import { SkillTypes } from "@spt-aki/models/enums/SkillTypes";
import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder";
@ -149,14 +150,19 @@ export declare class HideoutHelper {
* @param isGeneratorOn Is the generator turned on since last update * @param isGeneratorOn Is the generator turned on since last update
*/ */
protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void;
protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: {
btcFarmCGs: number;
isGeneratorOn: boolean;
waterCollectorHasFilter: boolean;
}): void;
/** /**
* Get craft time and make adjustments to account for dev profile + crafting skill level * Get craft time and make adjustments to account for dev profile + crafting skill level
* @param pmcData Player profile making craft * @param pmcData Player profile making craft
* @param recipeId Recipe being crafted * @param recipeId Recipe being crafted
* @returns * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation
* @returns Items craft time with bonuses subtracted
*/ */
protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string): number; protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number;
/** /**
* Adjust water filter objects resourceValue or delete when they reach 0 resource * Adjust water filter objects resourceValue or delete when they reach 0 resource
* @param waterFilterArea water filter area to update * @param waterFilterArea water filter area to update
@ -174,7 +180,7 @@ export declare class HideoutHelper {
* @param baseFilterDrainRate Base drain rate * @param baseFilterDrainRate Base drain rate
* @returns drain rate (adjusted) * @returns drain rate (adjusted)
*/ */
protected getAdjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number;
/** /**
* Get the water filter drain rate based on hideout bonues player has * Get the water filter drain rate based on hideout bonues player has
* @param pmcData Player profile * @param pmcData Player profile
@ -229,12 +235,21 @@ export declare class HideoutHelper {
*/ */
protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number;
/** /**
* Adjust craft time based on crafting skill level found in player profile * Get a multipler based on players skill level and value per level
* @param pmcData Player profile
* @param skill Player skill from profile
* @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel`
* @returns Multipler from 0 to 1
*/
protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number;
/**
* @param pmcData Player profile * @param pmcData Player profile
* @param productionTime Time to complete hideout craft in seconds * @param productionTime Time to complete hideout craft in seconds
* @returns Adjusted craft time in seconds * @param skill Skill bonus to get reduction from
* @param amountPerLevel Skill bonus amount to apply
* @returns Seconds to reduce craft time by
*/ */
getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number;
isProduction(productive: Productive): productive is Production; isProduction(productive: Productive): productive is Production;
/** /**
* Gather crafted BTC from hideout area and add to inventory * Gather crafted BTC from hideout area and add to inventory

View File

@ -167,7 +167,7 @@ export declare class ProfileHelper {
/** /**
* Get a speciic common skill from supplied profile * Get a speciic common skill from supplied profile
* @param pmcData Player profile * @param pmcData Player profile
* @param skill Skill get get * @param skill Skill to look up and return value from
* @returns Common skill object from desired profile * @returns Common skill object from desired profile
*/ */
getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common;

View File

@ -56,13 +56,6 @@ export declare class TradeHelper {
* @param output IItemEventRouterResponse * @param output IItemEventRouterResponse
*/ */
sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void;
/**
* Increment the assorts buy count by number of items purchased
* Show error on screen if player attempts to buy more than what the buy max allows
* @param assortBeingPurchased assort being bought
* @param itemsPurchasedCount number of items being bought
*/
protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void;
/** /**
* Traders allow a limited number of purchases per refresh cycle (default 60 mins) * Traders allow a limited number of purchases per refresh cycle (default 60 mins)
* @param sessionId Session id * @param sessionId Session id

View File

@ -121,7 +121,7 @@ export declare class TraderHelper {
count: number; count: number;
}[]; }[];
traderId: string; traderId: string;
}): void; }, itemPurchased: Item): void;
/** /**
* Get the highest rouble price for an item from traders * Get the highest rouble price for an item from traders
* UNUSED * UNUSED

View File

@ -1,32 +1,33 @@
import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper";
import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService";
import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { VFS } from "@spt-aki/utils/VFS"; import { VFS } from "@spt-aki/utils/VFS";
export declare class BundleInfo { export declare class BundleInfo {
modPath: string; modpath: string;
key: string; filename: string;
path: string; crc: number;
filepath: string; dependencies: string[];
dependencyKeys: string[]; constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number);
constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string);
} }
export declare class BundleLoader { export declare class BundleLoader {
protected httpServerHelper: HttpServerHelper; protected httpServerHelper: HttpServerHelper;
protected vfs: VFS; protected vfs: VFS;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected bundleHashCacheService: BundleHashCacheService;
protected bundles: Record<string, BundleInfo>; protected bundles: Record<string, BundleInfo>;
constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService);
/** /**
* Handle singleplayer/bundles * Handle singleplayer/bundles
*/ */
getBundles(local: boolean): BundleInfo[]; getBundles(): BundleInfo[];
getBundle(key: string, local: boolean): BundleInfo; getBundle(key: string): BundleInfo;
addBundles(modpath: string): void; addBundles(modpath: string): void;
addBundle(key: string, b: BundleInfo): void; addBundle(key: string, b: BundleInfo): void;
} }
export interface BundleManifest { export interface BundleManifest {
manifest: Array<BundleManifestEntry>; manifest: BundleManifestEntry[];
} }
export interface BundleManifestEntry { export interface BundleManifestEntry {
key: string; key: string;
path: string; dependencyKeys: string[];
} }

View File

@ -1,3 +1,7 @@
export interface IBaseConfig { export interface IBaseConfig {
kind: string; kind: string;
} }
export interface IRunIntervalValues {
inRaid: number;
outOfRaid: number;
}

View File

@ -1,7 +1,10 @@
import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig";
export interface IHideoutConfig extends IBaseConfig { export interface IHideoutConfig extends IBaseConfig {
kind: "aki-hideout"; kind: "aki-hideout";
/** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */
runIntervalSeconds: number; runIntervalSeconds: number;
/** Default values used to hydrate `runIntervalSeconds` with */
runIntervalValues: IRunIntervalValues;
hoursForSkillCrafting: number; hoursForSkillCrafting: number;
expCraftAmount: number; expCraftAmount: number;
} }

View File

@ -1,5 +1,5 @@
import { MinMax } from "@spt-aki/models/common/MinMax"; import { MinMax } from "@spt-aki/models/common/MinMax";
import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig";
export interface IRagfairConfig extends IBaseConfig { export interface IRagfairConfig extends IBaseConfig {
kind: "aki-ragfair"; kind: "aki-ragfair";
/** How many seconds should pass before expired offers and procesed + player offers checked if sold */ /** How many seconds should pass before expired offers and procesed + player offers checked if sold */
@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig {
traders: Record<string, boolean>; traders: Record<string, boolean>;
dynamic: Dynamic; dynamic: Dynamic;
} }
export interface IRunIntervalValues {
inRaid: number;
outOfRaid: number;
}
export interface Sell { export interface Sell {
/** Should a fee be deducted from player when liting an item for sale */ /** Should a fee be deducted from player when liting an item for sale */
fees: boolean; fees: boolean;

View File

@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig {
tradersResetFromServerStart: boolean; tradersResetFromServerStart: boolean;
updateTimeDefault: number; updateTimeDefault: number;
traderPriceMultipler: number; traderPriceMultipler: number;
/** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */
persistPurchaseDataInProfile: boolean;
fence: FenceConfig; fence: FenceConfig;
} }
export interface UpdateTime { export interface UpdateTime {

View File

@ -1,5 +1,5 @@
/// <reference types="node" /> /// <reference types="node" />
import http, { IncomingMessage, ServerResponse } from "node:http"; import { IncomingMessage, ServerResponse } from "node:http";
import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext";
import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper";
import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig";
@ -25,5 +25,5 @@ export declare class HttpServer {
*/ */
load(): void; load(): void;
protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void;
protected getCookies(req: http.IncomingMessage): Record<string, string>; protected getCookies(req: IncomingMessage): Record<string, string>;
} }

View File

@ -1,30 +0,0 @@
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { VFS } from "@spt-aki/utils/VFS";
export declare class HashCacheService {
protected vfs: VFS;
protected hashUtil: HashUtil;
protected jsonUtil: JsonUtil;
protected logger: ILogger;
protected jsonHashes: any;
protected modHashes: any;
protected readonly modCachePath = "./user/cache/modCache.json";
constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger);
/**
* Return a stored hash by key
* @param modName Name of mod to get hash for
* @returns Mod hash
*/
getStoredModHash(modName: string): string;
/**
* Does the generated hash match the stored hash
* @param modName name of mod
* @param modContent
* @returns True if they match
*/
modContentMatchesStoredHash(modName: string, modContent: string): boolean;
hashMatchesStoredHash(modName: string, modHash: string): boolean;
storeModContent(modName: string, modContent: string): void;
storeModHash(modName: string, modHash: string): void;
}

View File

@ -1,13 +1,13 @@
import ts from "typescript"; import ts from "typescript";
import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { HashCacheService } from "@spt-aki/services/HashCacheService"; import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService";
import { VFS } from "@spt-aki/utils/VFS"; import { VFS } from "@spt-aki/utils/VFS";
export declare class ModCompilerService { export declare class ModCompilerService {
protected logger: ILogger; protected logger: ILogger;
protected hashCacheService: HashCacheService; protected modHashCacheService: ModHashCacheService;
protected vfs: VFS; protected vfs: VFS;
protected serverDependencies: string[]; protected serverDependencies: string[];
constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS);
/** /**
* Convert a mods TS into JS * Convert a mods TS into JS
* @param modName Name of mod * @param modName Name of mod

View File

@ -1,8 +1,8 @@
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
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";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
export declare class TraderServicesService { export declare class TraderServicesService {
protected profileHelper: ProfileHelper; protected profileHelper: ProfileHelper;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;

View File

@ -0,0 +1,18 @@
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { VFS } from "@spt-aki/utils/VFS";
export declare class BundleHashCacheService {
protected vfs: VFS;
protected hashUtil: HashUtil;
protected jsonUtil: JsonUtil;
protected logger: ILogger;
protected bundleHashes: Record<string, number>;
protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json";
constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger);
getStoredValue(key: string): number;
storeValue(key: string, value: number): void;
matchWithStoredHash(bundlePath: string, hash: number): boolean;
calculateAndMatchHash(bundlePath: string): boolean;
calculateAndStoreHash(bundlePath: string): void;
}

View File

@ -0,0 +1,18 @@
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { VFS } from "@spt-aki/utils/VFS";
export declare class ModHashCacheService {
protected vfs: VFS;
protected hashUtil: HashUtil;
protected jsonUtil: JsonUtil;
protected logger: ILogger;
protected modHashes: Record<string, string>;
protected readonly modCachePath = "./user/cache/modCache.json";
constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger);
getStoredValue(key: string): string;
storeValue(key: string, value: string): void;
matchWithStoredHash(modName: string, hash: string): boolean;
calculateAndCompareHash(modName: string, modContent: string): boolean;
calculateAndStoreHash(modName: string, modContent: string): void;
}

View File

@ -1,5 +1,7 @@
/// <reference types="node" /> /// <reference types="node" />
/// <reference types="node" />
import crypto from "node:crypto"; import crypto from "node:crypto";
import fs from "node:fs";
import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil";
export declare class HashUtil { export declare class HashUtil {
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
@ -11,6 +13,7 @@ export declare class HashUtil {
generate(): string; generate(): string;
generateMd5ForData(data: string): string; generateMd5ForData(data: string): string;
generateSha1ForData(data: string): string; generateSha1ForData(data: string): string;
generateCRC32ForFile(filePath: fs.PathLike): number;
/** /**
* Create a hash for the data parameter * Create a hash for the data parameter
* @param algorithm algorithm to use to hash * @param algorithm algorithm to use to hash

View File

@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper";
export declare class HttpFileUtil { export declare class HttpFileUtil {
protected httpServerHelper: HttpServerHelper; protected httpServerHelper: HttpServerHelper;
constructor(httpServerHelper: HttpServerHelper); constructor(httpServerHelper: HttpServerHelper);
sendFile(resp: ServerResponse, file: any): void; sendFile(resp: ServerResponse, filePath: string): void;
} }

View File

@ -15,6 +15,7 @@ import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails";
import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile";
import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig";
import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig";
import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig";
import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig";
import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig";
import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig";
@ -60,6 +61,7 @@ export declare class GameController {
protected coreConfig: ICoreConfig; protected coreConfig: ICoreConfig;
protected locationConfig: ILocationConfig; protected locationConfig: ILocationConfig;
protected ragfairConfig: IRagfairConfig; protected ragfairConfig: IRagfairConfig;
protected hideoutConfig: IHideoutConfig;
protected pmcConfig: IPmcConfig; protected pmcConfig: IPmcConfig;
protected lootConfig: ILootConfig; protected lootConfig: ILootConfig;
protected botConfig: IBotConfig; protected botConfig: IBotConfig;

View File

@ -222,14 +222,6 @@ export declare class HideoutController {
* @param output Output object to update * @param output Output object to update
*/ */
protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void;
/**
* Start area production for item by adding production to profiles' Hideout.Production array
* @param pmcData Player profile
* @param request Start production request
* @param sessionID Session id
* @returns IItemEventRouterResponse
*/
registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse;
/** /**
* Get quick time event list for hideout * Get quick time event list for hideout
* // TODO - implement this * // TODO - implement this

View File

@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre
import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState";
import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig";
import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig";
import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig";
import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig";
import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig";
import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig";
@ -60,6 +61,7 @@ export declare class InraidController {
protected traderConfig: ITraderConfig; protected traderConfig: ITraderConfig;
protected locationConfig: ILocationConfig; protected locationConfig: ILocationConfig;
protected ragfairConfig: IRagfairConfig; protected ragfairConfig: IRagfairConfig;
protected hideoutConfig: IHideoutConfig;
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil);
/** /**
* Save locationId to active profiles inraid object AND app context * Save locationId to active profiles inraid object AND app context

View File

@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper";
import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper";
import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase";
import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType";
import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails";
import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig";

View File

@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti
import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData";
import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData";
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
import { SkillTypes } from "@spt-aki/models/enums/SkillTypes";
import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder";
@ -149,14 +150,19 @@ export declare class HideoutHelper {
* @param isGeneratorOn Is the generator turned on since last update * @param isGeneratorOn Is the generator turned on since last update
*/ */
protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void;
protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: {
btcFarmCGs: number;
isGeneratorOn: boolean;
waterCollectorHasFilter: boolean;
}): void;
/** /**
* Get craft time and make adjustments to account for dev profile + crafting skill level * Get craft time and make adjustments to account for dev profile + crafting skill level
* @param pmcData Player profile making craft * @param pmcData Player profile making craft
* @param recipeId Recipe being crafted * @param recipeId Recipe being crafted
* @returns * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation
* @returns Items craft time with bonuses subtracted
*/ */
protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string): number; protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number;
/** /**
* Adjust water filter objects resourceValue or delete when they reach 0 resource * Adjust water filter objects resourceValue or delete when they reach 0 resource
* @param waterFilterArea water filter area to update * @param waterFilterArea water filter area to update
@ -174,7 +180,7 @@ export declare class HideoutHelper {
* @param baseFilterDrainRate Base drain rate * @param baseFilterDrainRate Base drain rate
* @returns drain rate (adjusted) * @returns drain rate (adjusted)
*/ */
protected getAdjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number;
/** /**
* Get the water filter drain rate based on hideout bonues player has * Get the water filter drain rate based on hideout bonues player has
* @param pmcData Player profile * @param pmcData Player profile
@ -229,12 +235,21 @@ export declare class HideoutHelper {
*/ */
protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number;
/** /**
* Adjust craft time based on crafting skill level found in player profile * Get a multipler based on players skill level and value per level
* @param pmcData Player profile
* @param skill Player skill from profile
* @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel`
* @returns Multipler from 0 to 1
*/
protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number;
/**
* @param pmcData Player profile * @param pmcData Player profile
* @param productionTime Time to complete hideout craft in seconds * @param productionTime Time to complete hideout craft in seconds
* @returns Adjusted craft time in seconds * @param skill Skill bonus to get reduction from
* @param amountPerLevel Skill bonus amount to apply
* @returns Seconds to reduce craft time by
*/ */
getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number;
isProduction(productive: Productive): productive is Production; isProduction(productive: Productive): productive is Production;
/** /**
* Gather crafted BTC from hideout area and add to inventory * Gather crafted BTC from hideout area and add to inventory

View File

@ -167,7 +167,7 @@ export declare class ProfileHelper {
/** /**
* Get a speciic common skill from supplied profile * Get a speciic common skill from supplied profile
* @param pmcData Player profile * @param pmcData Player profile
* @param skill Skill get get * @param skill Skill to look up and return value from
* @returns Common skill object from desired profile * @returns Common skill object from desired profile
*/ */
getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common;

View File

@ -56,13 +56,6 @@ export declare class TradeHelper {
* @param output IItemEventRouterResponse * @param output IItemEventRouterResponse
*/ */
sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void;
/**
* Increment the assorts buy count by number of items purchased
* Show error on screen if player attempts to buy more than what the buy max allows
* @param assortBeingPurchased assort being bought
* @param itemsPurchasedCount number of items being bought
*/
protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void;
/** /**
* Traders allow a limited number of purchases per refresh cycle (default 60 mins) * Traders allow a limited number of purchases per refresh cycle (default 60 mins)
* @param sessionId Session id * @param sessionId Session id

View File

@ -121,7 +121,7 @@ export declare class TraderHelper {
count: number; count: number;
}[]; }[];
traderId: string; traderId: string;
}): void; }, itemPurchased: Item): void;
/** /**
* Get the highest rouble price for an item from traders * Get the highest rouble price for an item from traders
* UNUSED * UNUSED

View File

@ -1,32 +1,33 @@
import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper";
import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService";
import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { VFS } from "@spt-aki/utils/VFS"; import { VFS } from "@spt-aki/utils/VFS";
export declare class BundleInfo { export declare class BundleInfo {
modPath: string; modpath: string;
key: string; filename: string;
path: string; crc: number;
filepath: string; dependencies: string[];
dependencyKeys: string[]; constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number);
constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string);
} }
export declare class BundleLoader { export declare class BundleLoader {
protected httpServerHelper: HttpServerHelper; protected httpServerHelper: HttpServerHelper;
protected vfs: VFS; protected vfs: VFS;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected bundleHashCacheService: BundleHashCacheService;
protected bundles: Record<string, BundleInfo>; protected bundles: Record<string, BundleInfo>;
constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService);
/** /**
* Handle singleplayer/bundles * Handle singleplayer/bundles
*/ */
getBundles(local: boolean): BundleInfo[]; getBundles(): BundleInfo[];
getBundle(key: string, local: boolean): BundleInfo; getBundle(key: string): BundleInfo;
addBundles(modpath: string): void; addBundles(modpath: string): void;
addBundle(key: string, b: BundleInfo): void; addBundle(key: string, b: BundleInfo): void;
} }
export interface BundleManifest { export interface BundleManifest {
manifest: Array<BundleManifestEntry>; manifest: BundleManifestEntry[];
} }
export interface BundleManifestEntry { export interface BundleManifestEntry {
key: string; key: string;
path: string; dependencyKeys: string[];
} }

View File

@ -1,3 +1,7 @@
export interface IBaseConfig { export interface IBaseConfig {
kind: string; kind: string;
} }
export interface IRunIntervalValues {
inRaid: number;
outOfRaid: number;
}

View File

@ -1,7 +1,10 @@
import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig";
export interface IHideoutConfig extends IBaseConfig { export interface IHideoutConfig extends IBaseConfig {
kind: "aki-hideout"; kind: "aki-hideout";
/** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */
runIntervalSeconds: number; runIntervalSeconds: number;
/** Default values used to hydrate `runIntervalSeconds` with */
runIntervalValues: IRunIntervalValues;
hoursForSkillCrafting: number; hoursForSkillCrafting: number;
expCraftAmount: number; expCraftAmount: number;
} }

View File

@ -1,5 +1,5 @@
import { MinMax } from "@spt-aki/models/common/MinMax"; import { MinMax } from "@spt-aki/models/common/MinMax";
import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig";
export interface IRagfairConfig extends IBaseConfig { export interface IRagfairConfig extends IBaseConfig {
kind: "aki-ragfair"; kind: "aki-ragfair";
/** How many seconds should pass before expired offers and procesed + player offers checked if sold */ /** How many seconds should pass before expired offers and procesed + player offers checked if sold */
@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig {
traders: Record<string, boolean>; traders: Record<string, boolean>;
dynamic: Dynamic; dynamic: Dynamic;
} }
export interface IRunIntervalValues {
inRaid: number;
outOfRaid: number;
}
export interface Sell { export interface Sell {
/** Should a fee be deducted from player when liting an item for sale */ /** Should a fee be deducted from player when liting an item for sale */
fees: boolean; fees: boolean;

View File

@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig {
tradersResetFromServerStart: boolean; tradersResetFromServerStart: boolean;
updateTimeDefault: number; updateTimeDefault: number;
traderPriceMultipler: number; traderPriceMultipler: number;
/** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */
persistPurchaseDataInProfile: boolean;
fence: FenceConfig; fence: FenceConfig;
} }
export interface UpdateTime { export interface UpdateTime {

View File

@ -1,5 +1,5 @@
/// <reference types="node" /> /// <reference types="node" />
import http, { IncomingMessage, ServerResponse } from "node:http"; import { IncomingMessage, ServerResponse } from "node:http";
import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext";
import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper";
import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig";
@ -25,5 +25,5 @@ export declare class HttpServer {
*/ */
load(): void; load(): void;
protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void;
protected getCookies(req: http.IncomingMessage): Record<string, string>; protected getCookies(req: IncomingMessage): Record<string, string>;
} }

View File

@ -1,30 +0,0 @@
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { VFS } from "@spt-aki/utils/VFS";
export declare class HashCacheService {
protected vfs: VFS;
protected hashUtil: HashUtil;
protected jsonUtil: JsonUtil;
protected logger: ILogger;
protected jsonHashes: any;
protected modHashes: any;
protected readonly modCachePath = "./user/cache/modCache.json";
constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger);
/**
* Return a stored hash by key
* @param modName Name of mod to get hash for
* @returns Mod hash
*/
getStoredModHash(modName: string): string;
/**
* Does the generated hash match the stored hash
* @param modName name of mod
* @param modContent
* @returns True if they match
*/
modContentMatchesStoredHash(modName: string, modContent: string): boolean;
hashMatchesStoredHash(modName: string, modHash: string): boolean;
storeModContent(modName: string, modContent: string): void;
storeModHash(modName: string, modHash: string): void;
}

View File

@ -1,13 +1,13 @@
import ts from "typescript"; import ts from "typescript";
import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { HashCacheService } from "@spt-aki/services/HashCacheService"; import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService";
import { VFS } from "@spt-aki/utils/VFS"; import { VFS } from "@spt-aki/utils/VFS";
export declare class ModCompilerService { export declare class ModCompilerService {
protected logger: ILogger; protected logger: ILogger;
protected hashCacheService: HashCacheService; protected modHashCacheService: ModHashCacheService;
protected vfs: VFS; protected vfs: VFS;
protected serverDependencies: string[]; protected serverDependencies: string[];
constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS);
/** /**
* Convert a mods TS into JS * Convert a mods TS into JS
* @param modName Name of mod * @param modName Name of mod

View File

@ -1,8 +1,8 @@
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
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";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
export declare class TraderServicesService { export declare class TraderServicesService {
protected profileHelper: ProfileHelper; protected profileHelper: ProfileHelper;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;

View File

@ -0,0 +1,18 @@
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { VFS } from "@spt-aki/utils/VFS";
export declare class BundleHashCacheService {
protected vfs: VFS;
protected hashUtil: HashUtil;
protected jsonUtil: JsonUtil;
protected logger: ILogger;
protected bundleHashes: Record<string, number>;
protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json";
constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger);
getStoredValue(key: string): number;
storeValue(key: string, value: number): void;
matchWithStoredHash(bundlePath: string, hash: number): boolean;
calculateAndMatchHash(bundlePath: string): boolean;
calculateAndStoreHash(bundlePath: string): void;
}

View File

@ -0,0 +1,18 @@
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { VFS } from "@spt-aki/utils/VFS";
export declare class ModHashCacheService {
protected vfs: VFS;
protected hashUtil: HashUtil;
protected jsonUtil: JsonUtil;
protected logger: ILogger;
protected modHashes: Record<string, string>;
protected readonly modCachePath = "./user/cache/modCache.json";
constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger);
getStoredValue(key: string): string;
storeValue(key: string, value: string): void;
matchWithStoredHash(modName: string, hash: string): boolean;
calculateAndCompareHash(modName: string, modContent: string): boolean;
calculateAndStoreHash(modName: string, modContent: string): void;
}

View File

@ -1,5 +1,7 @@
/// <reference types="node" /> /// <reference types="node" />
/// <reference types="node" />
import crypto from "node:crypto"; import crypto from "node:crypto";
import fs from "node:fs";
import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil";
export declare class HashUtil { export declare class HashUtil {
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
@ -11,6 +13,7 @@ export declare class HashUtil {
generate(): string; generate(): string;
generateMd5ForData(data: string): string; generateMd5ForData(data: string): string;
generateSha1ForData(data: string): string; generateSha1ForData(data: string): string;
generateCRC32ForFile(filePath: fs.PathLike): number;
/** /**
* Create a hash for the data parameter * Create a hash for the data parameter
* @param algorithm algorithm to use to hash * @param algorithm algorithm to use to hash

View File

@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper";
export declare class HttpFileUtil { export declare class HttpFileUtil {
protected httpServerHelper: HttpServerHelper; protected httpServerHelper: HttpServerHelper;
constructor(httpServerHelper: HttpServerHelper); constructor(httpServerHelper: HttpServerHelper);
sendFile(resp: ServerResponse, file: any): void; sendFile(resp: ServerResponse, filePath: string): void;
} }

View File

@ -15,6 +15,7 @@ import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails";
import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile";
import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig";
import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig";
import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig";
import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig";
import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig";
import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig";
@ -60,6 +61,7 @@ export declare class GameController {
protected coreConfig: ICoreConfig; protected coreConfig: ICoreConfig;
protected locationConfig: ILocationConfig; protected locationConfig: ILocationConfig;
protected ragfairConfig: IRagfairConfig; protected ragfairConfig: IRagfairConfig;
protected hideoutConfig: IHideoutConfig;
protected pmcConfig: IPmcConfig; protected pmcConfig: IPmcConfig;
protected lootConfig: ILootConfig; protected lootConfig: ILootConfig;
protected botConfig: IBotConfig; protected botConfig: IBotConfig;

View File

@ -222,14 +222,6 @@ export declare class HideoutController {
* @param output Output object to update * @param output Output object to update
*/ */
protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void;
/**
* Start area production for item by adding production to profiles' Hideout.Production array
* @param pmcData Player profile
* @param request Start production request
* @param sessionID Session id
* @returns IItemEventRouterResponse
*/
registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse;
/** /**
* Get quick time event list for hideout * Get quick time event list for hideout
* // TODO - implement this * // TODO - implement this

View File

@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre
import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState";
import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig";
import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig";
import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig";
import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig";
import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig";
import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig";
@ -60,6 +61,7 @@ export declare class InraidController {
protected traderConfig: ITraderConfig; protected traderConfig: ITraderConfig;
protected locationConfig: ILocationConfig; protected locationConfig: ILocationConfig;
protected ragfairConfig: IRagfairConfig; protected ragfairConfig: IRagfairConfig;
protected hideoutConfig: IHideoutConfig;
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil);
/** /**
* Save locationId to active profiles inraid object AND app context * Save locationId to active profiles inraid object AND app context

View File

@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper";
import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper";
import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase";
import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType";
import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails";
import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig";

View File

@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti
import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData";
import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData";
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
import { SkillTypes } from "@spt-aki/models/enums/SkillTypes";
import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder";
@ -149,14 +150,19 @@ export declare class HideoutHelper {
* @param isGeneratorOn Is the generator turned on since last update * @param isGeneratorOn Is the generator turned on since last update
*/ */
protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void;
protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: {
btcFarmCGs: number;
isGeneratorOn: boolean;
waterCollectorHasFilter: boolean;
}): void;
/** /**
* Get craft time and make adjustments to account for dev profile + crafting skill level * Get craft time and make adjustments to account for dev profile + crafting skill level
* @param pmcData Player profile making craft * @param pmcData Player profile making craft
* @param recipeId Recipe being crafted * @param recipeId Recipe being crafted
* @returns * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation
* @returns Items craft time with bonuses subtracted
*/ */
protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string): number; protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number;
/** /**
* Adjust water filter objects resourceValue or delete when they reach 0 resource * Adjust water filter objects resourceValue or delete when they reach 0 resource
* @param waterFilterArea water filter area to update * @param waterFilterArea water filter area to update
@ -174,7 +180,7 @@ export declare class HideoutHelper {
* @param baseFilterDrainRate Base drain rate * @param baseFilterDrainRate Base drain rate
* @returns drain rate (adjusted) * @returns drain rate (adjusted)
*/ */
protected getAdjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number;
/** /**
* Get the water filter drain rate based on hideout bonues player has * Get the water filter drain rate based on hideout bonues player has
* @param pmcData Player profile * @param pmcData Player profile
@ -229,12 +235,21 @@ export declare class HideoutHelper {
*/ */
protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number;
/** /**
* Adjust craft time based on crafting skill level found in player profile * Get a multipler based on players skill level and value per level
* @param pmcData Player profile
* @param skill Player skill from profile
* @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel`
* @returns Multipler from 0 to 1
*/
protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number;
/**
* @param pmcData Player profile * @param pmcData Player profile
* @param productionTime Time to complete hideout craft in seconds * @param productionTime Time to complete hideout craft in seconds
* @returns Adjusted craft time in seconds * @param skill Skill bonus to get reduction from
* @param amountPerLevel Skill bonus amount to apply
* @returns Seconds to reduce craft time by
*/ */
getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number;
isProduction(productive: Productive): productive is Production; isProduction(productive: Productive): productive is Production;
/** /**
* Gather crafted BTC from hideout area and add to inventory * Gather crafted BTC from hideout area and add to inventory

View File

@ -167,7 +167,7 @@ export declare class ProfileHelper {
/** /**
* Get a speciic common skill from supplied profile * Get a speciic common skill from supplied profile
* @param pmcData Player profile * @param pmcData Player profile
* @param skill Skill get get * @param skill Skill to look up and return value from
* @returns Common skill object from desired profile * @returns Common skill object from desired profile
*/ */
getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common;

View File

@ -56,13 +56,6 @@ export declare class TradeHelper {
* @param output IItemEventRouterResponse * @param output IItemEventRouterResponse
*/ */
sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void;
/**
* Increment the assorts buy count by number of items purchased
* Show error on screen if player attempts to buy more than what the buy max allows
* @param assortBeingPurchased assort being bought
* @param itemsPurchasedCount number of items being bought
*/
protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void;
/** /**
* Traders allow a limited number of purchases per refresh cycle (default 60 mins) * Traders allow a limited number of purchases per refresh cycle (default 60 mins)
* @param sessionId Session id * @param sessionId Session id

View File

@ -121,7 +121,7 @@ export declare class TraderHelper {
count: number; count: number;
}[]; }[];
traderId: string; traderId: string;
}): void; }, itemPurchased: Item): void;
/** /**
* Get the highest rouble price for an item from traders * Get the highest rouble price for an item from traders
* UNUSED * UNUSED

View File

@ -1,32 +1,33 @@
import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper";
import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService";
import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { VFS } from "@spt-aki/utils/VFS"; import { VFS } from "@spt-aki/utils/VFS";
export declare class BundleInfo { export declare class BundleInfo {
modPath: string; modpath: string;
key: string; filename: string;
path: string; crc: number;
filepath: string; dependencies: string[];
dependencyKeys: string[]; constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number);
constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string);
} }
export declare class BundleLoader { export declare class BundleLoader {
protected httpServerHelper: HttpServerHelper; protected httpServerHelper: HttpServerHelper;
protected vfs: VFS; protected vfs: VFS;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected bundleHashCacheService: BundleHashCacheService;
protected bundles: Record<string, BundleInfo>; protected bundles: Record<string, BundleInfo>;
constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService);
/** /**
* Handle singleplayer/bundles * Handle singleplayer/bundles
*/ */
getBundles(local: boolean): BundleInfo[]; getBundles(): BundleInfo[];
getBundle(key: string, local: boolean): BundleInfo; getBundle(key: string): BundleInfo;
addBundles(modpath: string): void; addBundles(modpath: string): void;
addBundle(key: string, b: BundleInfo): void; addBundle(key: string, b: BundleInfo): void;
} }
export interface BundleManifest { export interface BundleManifest {
manifest: Array<BundleManifestEntry>; manifest: BundleManifestEntry[];
} }
export interface BundleManifestEntry { export interface BundleManifestEntry {
key: string; key: string;
path: string; dependencyKeys: string[];
} }

View File

@ -1,3 +1,7 @@
export interface IBaseConfig { export interface IBaseConfig {
kind: string; kind: string;
} }
export interface IRunIntervalValues {
inRaid: number;
outOfRaid: number;
}

View File

@ -1,7 +1,10 @@
import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig";
export interface IHideoutConfig extends IBaseConfig { export interface IHideoutConfig extends IBaseConfig {
kind: "aki-hideout"; kind: "aki-hideout";
/** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */
runIntervalSeconds: number; runIntervalSeconds: number;
/** Default values used to hydrate `runIntervalSeconds` with */
runIntervalValues: IRunIntervalValues;
hoursForSkillCrafting: number; hoursForSkillCrafting: number;
expCraftAmount: number; expCraftAmount: number;
} }

View File

@ -1,5 +1,5 @@
import { MinMax } from "@spt-aki/models/common/MinMax"; import { MinMax } from "@spt-aki/models/common/MinMax";
import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig";
export interface IRagfairConfig extends IBaseConfig { export interface IRagfairConfig extends IBaseConfig {
kind: "aki-ragfair"; kind: "aki-ragfair";
/** How many seconds should pass before expired offers and procesed + player offers checked if sold */ /** How many seconds should pass before expired offers and procesed + player offers checked if sold */
@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig {
traders: Record<string, boolean>; traders: Record<string, boolean>;
dynamic: Dynamic; dynamic: Dynamic;
} }
export interface IRunIntervalValues {
inRaid: number;
outOfRaid: number;
}
export interface Sell { export interface Sell {
/** Should a fee be deducted from player when liting an item for sale */ /** Should a fee be deducted from player when liting an item for sale */
fees: boolean; fees: boolean;

View File

@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig {
tradersResetFromServerStart: boolean; tradersResetFromServerStart: boolean;
updateTimeDefault: number; updateTimeDefault: number;
traderPriceMultipler: number; traderPriceMultipler: number;
/** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */
persistPurchaseDataInProfile: boolean;
fence: FenceConfig; fence: FenceConfig;
} }
export interface UpdateTime { export interface UpdateTime {

View File

@ -1,5 +1,5 @@
/// <reference types="node" /> /// <reference types="node" />
import http, { IncomingMessage, ServerResponse } from "node:http"; import { IncomingMessage, ServerResponse } from "node:http";
import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext";
import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper";
import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig";
@ -25,5 +25,5 @@ export declare class HttpServer {
*/ */
load(): void; load(): void;
protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void;
protected getCookies(req: http.IncomingMessage): Record<string, string>; protected getCookies(req: IncomingMessage): Record<string, string>;
} }

View File

@ -1,30 +0,0 @@
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { VFS } from "@spt-aki/utils/VFS";
export declare class HashCacheService {
protected vfs: VFS;
protected hashUtil: HashUtil;
protected jsonUtil: JsonUtil;
protected logger: ILogger;
protected jsonHashes: any;
protected modHashes: any;
protected readonly modCachePath = "./user/cache/modCache.json";
constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger);
/**
* Return a stored hash by key
* @param modName Name of mod to get hash for
* @returns Mod hash
*/
getStoredModHash(modName: string): string;
/**
* Does the generated hash match the stored hash
* @param modName name of mod
* @param modContent
* @returns True if they match
*/
modContentMatchesStoredHash(modName: string, modContent: string): boolean;
hashMatchesStoredHash(modName: string, modHash: string): boolean;
storeModContent(modName: string, modContent: string): void;
storeModHash(modName: string, modHash: string): void;
}

View File

@ -1,13 +1,13 @@
import ts from "typescript"; import ts from "typescript";
import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { HashCacheService } from "@spt-aki/services/HashCacheService"; import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService";
import { VFS } from "@spt-aki/utils/VFS"; import { VFS } from "@spt-aki/utils/VFS";
export declare class ModCompilerService { export declare class ModCompilerService {
protected logger: ILogger; protected logger: ILogger;
protected hashCacheService: HashCacheService; protected modHashCacheService: ModHashCacheService;
protected vfs: VFS; protected vfs: VFS;
protected serverDependencies: string[]; protected serverDependencies: string[];
constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS);
/** /**
* Convert a mods TS into JS * Convert a mods TS into JS
* @param modName Name of mod * @param modName Name of mod

View File

@ -1,8 +1,8 @@
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel"; import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
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";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
export declare class TraderServicesService { export declare class TraderServicesService {
protected profileHelper: ProfileHelper; protected profileHelper: ProfileHelper;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;

View File

@ -0,0 +1,18 @@
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { VFS } from "@spt-aki/utils/VFS";
export declare class BundleHashCacheService {
protected vfs: VFS;
protected hashUtil: HashUtil;
protected jsonUtil: JsonUtil;
protected logger: ILogger;
protected bundleHashes: Record<string, number>;
protected readonly bundleHashCachePath = "./user/cache/bundleHashCache.json";
constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger);
getStoredValue(key: string): number;
storeValue(key: string, value: number): void;
matchWithStoredHash(bundlePath: string, hash: number): boolean;
calculateAndMatchHash(bundlePath: string): boolean;
calculateAndStoreHash(bundlePath: string): void;
}

View File

@ -0,0 +1,18 @@
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { VFS } from "@spt-aki/utils/VFS";
export declare class ModHashCacheService {
protected vfs: VFS;
protected hashUtil: HashUtil;
protected jsonUtil: JsonUtil;
protected logger: ILogger;
protected modHashes: Record<string, string>;
protected readonly modCachePath = "./user/cache/modCache.json";
constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger);
getStoredValue(key: string): string;
storeValue(key: string, value: string): void;
matchWithStoredHash(modName: string, hash: string): boolean;
calculateAndCompareHash(modName: string, modContent: string): boolean;
calculateAndStoreHash(modName: string, modContent: string): void;
}

View File

@ -1,5 +1,7 @@
/// <reference types="node" /> /// <reference types="node" />
/// <reference types="node" />
import crypto from "node:crypto"; import crypto from "node:crypto";
import fs from "node:fs";
import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil";
export declare class HashUtil { export declare class HashUtil {
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
@ -11,6 +13,7 @@ export declare class HashUtil {
generate(): string; generate(): string;
generateMd5ForData(data: string): string; generateMd5ForData(data: string): string;
generateSha1ForData(data: string): string; generateSha1ForData(data: string): string;
generateCRC32ForFile(filePath: fs.PathLike): number;
/** /**
* Create a hash for the data parameter * Create a hash for the data parameter
* @param algorithm algorithm to use to hash * @param algorithm algorithm to use to hash

View File

@ -4,5 +4,5 @@ import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper";
export declare class HttpFileUtil { export declare class HttpFileUtil {
protected httpServerHelper: HttpServerHelper; protected httpServerHelper: HttpServerHelper;
constructor(httpServerHelper: HttpServerHelper); constructor(httpServerHelper: HttpServerHelper);
sendFile(resp: ServerResponse, file: any): void; sendFile(resp: ServerResponse, filePath: string): void;
} }

View File

@ -15,6 +15,7 @@ import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails";
import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile";
import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig";
import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig"; import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig";
import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig";
import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig";
import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig";
import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig"; import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig";
@ -60,6 +61,7 @@ export declare class GameController {
protected coreConfig: ICoreConfig; protected coreConfig: ICoreConfig;
protected locationConfig: ILocationConfig; protected locationConfig: ILocationConfig;
protected ragfairConfig: IRagfairConfig; protected ragfairConfig: IRagfairConfig;
protected hideoutConfig: IHideoutConfig;
protected pmcConfig: IPmcConfig; protected pmcConfig: IPmcConfig;
protected lootConfig: ILootConfig; protected lootConfig: ILootConfig;
protected botConfig: IBotConfig; protected botConfig: IBotConfig;

View File

@ -222,14 +222,6 @@ export declare class HideoutController {
* @param output Output object to update * @param output Output object to update
*/ */
protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void;
/**
* Start area production for item by adding production to profiles' Hideout.Production array
* @param pmcData Player profile
* @param request Start production request
* @param sessionID Session id
* @returns IItemEventRouterResponse
*/
registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse;
/** /**
* Get quick time event list for hideout * Get quick time event list for hideout
* // TODO - implement this * // TODO - implement this

View File

@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre
import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState"; import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState";
import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig"; import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig";
import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig"; import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig";
import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig";
import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig";
import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig";
import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig";
@ -60,6 +61,7 @@ export declare class InraidController {
protected traderConfig: ITraderConfig; protected traderConfig: ITraderConfig;
protected locationConfig: ILocationConfig; protected locationConfig: ILocationConfig;
protected ragfairConfig: IRagfairConfig; protected ragfairConfig: IRagfairConfig;
protected hideoutConfig: IHideoutConfig;
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil); constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil);
/** /**
* Save locationId to active profiles inraid object AND app context * Save locationId to active profiles inraid object AND app context

View File

@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper";
import { BotHelper } from "@spt-aki/helpers/BotHelper"; import { BotHelper } from "@spt-aki/helpers/BotHelper";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper"; import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper";
import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase"; import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase";
import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType"; import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType";
import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails"; import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails";
import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig";

View File

@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti
import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData";
import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData";
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse"; import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
import { SkillTypes } from "@spt-aki/models/enums/SkillTypes";
import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig"; import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder"; import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder";
@ -149,14 +150,19 @@ export declare class HideoutHelper {
* @param isGeneratorOn Is the generator turned on since last update * @param isGeneratorOn Is the generator turned on since last update
*/ */
protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void; protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void;
protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: {
btcFarmCGs: number;
isGeneratorOn: boolean;
waterCollectorHasFilter: boolean;
}): void;
/** /**
* Get craft time and make adjustments to account for dev profile + crafting skill level * Get craft time and make adjustments to account for dev profile + crafting skill level
* @param pmcData Player profile making craft * @param pmcData Player profile making craft
* @param recipeId Recipe being crafted * @param recipeId Recipe being crafted
* @returns * @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation
* @returns Items craft time with bonuses subtracted
*/ */
protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string): number; protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number;
/** /**
* Adjust water filter objects resourceValue or delete when they reach 0 resource * Adjust water filter objects resourceValue or delete when they reach 0 resource
* @param waterFilterArea water filter area to update * @param waterFilterArea water filter area to update
@ -174,7 +180,7 @@ export declare class HideoutHelper {
* @param baseFilterDrainRate Base drain rate * @param baseFilterDrainRate Base drain rate
* @returns drain rate (adjusted) * @returns drain rate (adjusted)
*/ */
protected getAdjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number; protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number;
/** /**
* Get the water filter drain rate based on hideout bonues player has * Get the water filter drain rate based on hideout bonues player has
* @param pmcData Player profile * @param pmcData Player profile
@ -229,12 +235,21 @@ export declare class HideoutHelper {
*/ */
protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number; protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number;
/** /**
* Adjust craft time based on crafting skill level found in player profile * Get a multipler based on players skill level and value per level
* @param pmcData Player profile
* @param skill Player skill from profile
* @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel`
* @returns Multipler from 0 to 1
*/
protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number;
/**
* @param pmcData Player profile * @param pmcData Player profile
* @param productionTime Time to complete hideout craft in seconds * @param productionTime Time to complete hideout craft in seconds
* @returns Adjusted craft time in seconds * @param skill Skill bonus to get reduction from
* @param amountPerLevel Skill bonus amount to apply
* @returns Seconds to reduce craft time by
*/ */
getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number; getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number;
isProduction(productive: Productive): productive is Production; isProduction(productive: Productive): productive is Production;
/** /**
* Gather crafted BTC from hideout area and add to inventory * Gather crafted BTC from hideout area and add to inventory

View File

@ -167,7 +167,7 @@ export declare class ProfileHelper {
/** /**
* Get a speciic common skill from supplied profile * Get a speciic common skill from supplied profile
* @param pmcData Player profile * @param pmcData Player profile
* @param skill Skill get get * @param skill Skill to look up and return value from
* @returns Common skill object from desired profile * @returns Common skill object from desired profile
*/ */
getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common;

View File

@ -56,13 +56,6 @@ export declare class TradeHelper {
* @param output IItemEventRouterResponse * @param output IItemEventRouterResponse
*/ */
sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void;
/**
* Increment the assorts buy count by number of items purchased
* Show error on screen if player attempts to buy more than what the buy max allows
* @param assortBeingPurchased assort being bought
* @param itemsPurchasedCount number of items being bought
*/
protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void;
/** /**
* Traders allow a limited number of purchases per refresh cycle (default 60 mins) * Traders allow a limited number of purchases per refresh cycle (default 60 mins)
* @param sessionId Session id * @param sessionId Session id

View File

@ -121,7 +121,7 @@ export declare class TraderHelper {
count: number; count: number;
}[]; }[];
traderId: string; traderId: string;
}): void; }, itemPurchased: Item): void;
/** /**
* Get the highest rouble price for an item from traders * Get the highest rouble price for an item from traders
* UNUSED * UNUSED

View File

@ -1,32 +1,33 @@
import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper";
import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService";
import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { VFS } from "@spt-aki/utils/VFS"; import { VFS } from "@spt-aki/utils/VFS";
export declare class BundleInfo { export declare class BundleInfo {
modPath: string; modpath: string;
key: string; filename: string;
path: string; crc: number;
filepath: string; dependencies: string[];
dependencyKeys: string[]; constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number);
constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string);
} }
export declare class BundleLoader { export declare class BundleLoader {
protected httpServerHelper: HttpServerHelper; protected httpServerHelper: HttpServerHelper;
protected vfs: VFS; protected vfs: VFS;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected bundleHashCacheService: BundleHashCacheService;
protected bundles: Record<string, BundleInfo>; protected bundles: Record<string, BundleInfo>;
constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil); constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService);
/** /**
* Handle singleplayer/bundles * Handle singleplayer/bundles
*/ */
getBundles(local: boolean): BundleInfo[]; getBundles(): BundleInfo[];
getBundle(key: string, local: boolean): BundleInfo; getBundle(key: string): BundleInfo;
addBundles(modpath: string): void; addBundles(modpath: string): void;
addBundle(key: string, b: BundleInfo): void; addBundle(key: string, b: BundleInfo): void;
} }
export interface BundleManifest { export interface BundleManifest {
manifest: Array<BundleManifestEntry>; manifest: BundleManifestEntry[];
} }
export interface BundleManifestEntry { export interface BundleManifestEntry {
key: string; key: string;
path: string; dependencyKeys: string[];
} }

View File

@ -1,3 +1,7 @@
export interface IBaseConfig { export interface IBaseConfig {
kind: string; kind: string;
} }
export interface IRunIntervalValues {
inRaid: number;
outOfRaid: number;
}

View File

@ -1,7 +1,10 @@
import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig";
export interface IHideoutConfig extends IBaseConfig { export interface IHideoutConfig extends IBaseConfig {
kind: "aki-hideout"; kind: "aki-hideout";
/** How many seconds should pass before hideout crafts / fuel usage is checked and procesed */
runIntervalSeconds: number; runIntervalSeconds: number;
/** Default values used to hydrate `runIntervalSeconds` with */
runIntervalValues: IRunIntervalValues;
hoursForSkillCrafting: number; hoursForSkillCrafting: number;
expCraftAmount: number; expCraftAmount: number;
} }

View File

@ -1,5 +1,5 @@
import { MinMax } from "@spt-aki/models/common/MinMax"; import { MinMax } from "@spt-aki/models/common/MinMax";
import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; import { IBaseConfig, IRunIntervalValues } from "@spt-aki/models/spt/config/IBaseConfig";
export interface IRagfairConfig extends IBaseConfig { export interface IRagfairConfig extends IBaseConfig {
kind: "aki-ragfair"; kind: "aki-ragfair";
/** How many seconds should pass before expired offers and procesed + player offers checked if sold */ /** How many seconds should pass before expired offers and procesed + player offers checked if sold */
@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig {
traders: Record<string, boolean>; traders: Record<string, boolean>;
dynamic: Dynamic; dynamic: Dynamic;
} }
export interface IRunIntervalValues {
inRaid: number;
outOfRaid: number;
}
export interface Sell { export interface Sell {
/** Should a fee be deducted from player when liting an item for sale */ /** Should a fee be deducted from player when liting an item for sale */
fees: boolean; fees: boolean;

View File

@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig {
tradersResetFromServerStart: boolean; tradersResetFromServerStart: boolean;
updateTimeDefault: number; updateTimeDefault: number;
traderPriceMultipler: number; traderPriceMultipler: number;
/** Keep track of purchased trader-limited items beyond server restarts to prevent server-restart item scumming */
persistPurchaseDataInProfile: boolean;
fence: FenceConfig; fence: FenceConfig;
} }
export interface UpdateTime { export interface UpdateTime {

View File

@ -1,5 +1,5 @@
/// <reference types="node" /> /// <reference types="node" />
import http, { IncomingMessage, ServerResponse } from "node:http"; import { IncomingMessage, ServerResponse } from "node:http";
import { ApplicationContext } from "@spt-aki/context/ApplicationContext"; import { ApplicationContext } from "@spt-aki/context/ApplicationContext";
import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper";
import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig"; import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig";
@ -25,5 +25,5 @@ export declare class HttpServer {
*/ */
load(): void; load(): void;
protected handleRequest(req: IncomingMessage, resp: ServerResponse): void; protected handleRequest(req: IncomingMessage, resp: ServerResponse): void;
protected getCookies(req: http.IncomingMessage): Record<string, string>; protected getCookies(req: IncomingMessage): Record<string, string>;
} }

View File

@ -1,30 +0,0 @@
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { VFS } from "@spt-aki/utils/VFS";
export declare class HashCacheService {
protected vfs: VFS;
protected hashUtil: HashUtil;
protected jsonUtil: JsonUtil;
protected logger: ILogger;
protected jsonHashes: any;
protected modHashes: any;
protected readonly modCachePath = "./user/cache/modCache.json";
constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger);
/**
* Return a stored hash by key
* @param modName Name of mod to get hash for
* @returns Mod hash
*/
getStoredModHash(modName: string): string;
/**
* Does the generated hash match the stored hash
* @param modName name of mod
* @param modContent
* @returns True if they match
*/
modContentMatchesStoredHash(modName: string, modContent: string): boolean;
hashMatchesStoredHash(modName: string, modHash: string): boolean;
storeModContent(modName: string, modContent: string): void;
storeModHash(modName: string, modHash: string): void;
}

View File

@ -1,13 +1,13 @@
import ts from "typescript"; import ts from "typescript";
import type { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import type { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { HashCacheService } from "@spt-aki/services/HashCacheService"; import { ModHashCacheService } from "@spt-aki/services/cache/ModHashCacheService";
import { VFS } from "@spt-aki/utils/VFS"; import { VFS } from "@spt-aki/utils/VFS";
export declare class ModCompilerService { export declare class ModCompilerService {
protected logger: ILogger; protected logger: ILogger;
protected hashCacheService: HashCacheService; protected modHashCacheService: ModHashCacheService;
protected vfs: VFS; protected vfs: VFS;
protected serverDependencies: string[]; protected serverDependencies: string[];
constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); constructor(logger: ILogger, modHashCacheService: ModHashCacheService, vfs: VFS);
/** /**
* Convert a mods TS into JS * Convert a mods TS into JS
* @param modName Name of mod * @param modName Name of mod

Some files were not shown because too many files have changed in this diff Show More